summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorJonathan Clark <jonathan@libreoffice.org>2024-11-08 01:12:48 -0700
committerJonathan Clark <jonathan@libreoffice.org>2024-11-13 15:01:11 +0100
commit2cb039f570379213ffc9469a132f5b24f425b7be (patch)
treee67e7cb151de276cec6d3a4bc24d7f184aeac001 /svx/source
parenta095909899622ce16bac020fa7034ff162fe0df5 (diff)
tdf#36709 editeng: Layout for font-relative first-line indent
This change extends layout for font-relative paragraph first-line indentation into Edit Engine. Change-Id: I5906f493b91fbcb87ded165709fb132b33ce1906 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176487 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/dialog/svxruler.cxx8
-rw-r--r--svx/source/sidebar/paragraph/ParaPropertyPanel.cxx7
-rw-r--r--svx/source/sidebar/paragraph/ParaSpacingWindow.cxx6
3 files changed, 13 insertions, 8 deletions
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 3f447bf9a1af..6bbf1b1a9ddd 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -567,7 +567,7 @@ void SvxRuler::MouseMove( const MouseEvent& rMEvt )
if (nIndex == INDENT_LEFT_MARGIN)
nIndentValue = mxParaItem->GetTextLeft();
else if (nIndex == INDENT_FIRST_LINE)
- nIndentValue = mxParaItem->GetTextFirstLineOffset();
+ nIndentValue = mxParaItem->ResolveTextFirstLineOffset({});
else if (nIndex == INDENT_RIGHT_MARGIN)
nIndentValue = mxParaItem->GetRight();
@@ -846,13 +846,13 @@ void SvxRuler::UpdatePara()
if(bRTLText)
{
leftMargin = nRightFrameMargin - mxParaItem->GetTextLeft() + lAppNullOffset;
- leftFirstLine = leftMargin - mxParaItem->GetTextFirstLineOffset();
+ leftFirstLine = leftMargin - mxParaItem->ResolveTextFirstLineOffset({});
rightMargin = nLeftFrameMargin + mxParaItem->GetRight() + lAppNullOffset;
}
else
{
leftMargin = nLeftFrameMargin + mxParaItem->GetTextLeft() + lAppNullOffset;
- leftFirstLine = leftMargin + mxParaItem->GetTextFirstLineOffset();
+ leftFirstLine = leftMargin + mxParaItem->ResolveTextFirstLineOffset({});
rightMargin = nRightFrameMargin - mxParaItem->GetRight() + lAppNullOffset;
}
@@ -2194,7 +2194,7 @@ void SvxRuler::ApplyIndents()
nNewRight = RoundToCurrentMapMode(nNewRight);
}
- mxParaItem->SetTextFirstLineOffset(sal::static_int_cast<short>(nNewFirstLineOffset));
+ mxParaItem->SetTextFirstLineOffset(SvxIndentValue::twips(nNewFirstLineOffset));
mxParaItem->SetTextLeft(nNewTxtLeft);
mxParaItem->SetRight(nNewRight);
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 269946d8f852..2fd5647d8666 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -221,7 +221,9 @@ IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl, weld::MetricSpinButton
SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
aMargin.SetTextLeft(mxLeftIndent->GetCoreValue(m_eLRSpaceUnit));
aMargin.SetRight(mxRightIndent->GetCoreValue(m_eLRSpaceUnit));
- aMargin.SetTextFirstLineOffset(static_cast<short>(mxFLineIndent->GetCoreValue(m_eLRSpaceUnit)));
+ // tdf#36709: TODO: Handle font-relative units from GUI
+ aMargin.SetTextFirstLineOffset(
+ SvxIndentValue::twips(mxFLineIndent->GetCoreValue(m_eLRSpaceUnit)));
GetBindings()->GetDispatcher()->ExecuteList(
SID_ATTR_PARA_LRSPACE, SfxCallMode::RECORD, { &aMargin });
@@ -401,7 +403,8 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo
tools::Long aTxtRight = pSpace->GetRight();
aTxtRight = OutputDevice::LogicToLogic(aTxtRight, m_eLRSpaceUnit, MapUnit::MapTwip);
- tools::Long aTxtFirstLineOfst = pSpace->GetTextFirstLineOffset();
+ // tdf#36709: TODO: Handle font-relative units
+ tools::Long aTxtFirstLineOfst = pSpace->ResolveTextFirstLineOffset({});
aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, m_eLRSpaceUnit, MapUnit::MapTwip );
tools::Long nVal = o3tl::convert(maTxtLeft, o3tl::Length::twip, o3tl::Length::mm100);
diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
index 8952f91a0f5f..933a2f5f06ab 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
@@ -215,7 +215,8 @@ void ParaLRSpacingWindow::SetValue(SfxItemState eState, const SfxPoolItem* pStat
const SvxLRSpaceItem* pSpace = static_cast<const SvxLRSpaceItem*>(pState);
tools::Long aTxtLeft = pSpace->GetTextLeft();
tools::Long aTxtRight = pSpace->GetRight();
- tools::Long aTxtFirstLineOfst = pSpace->GetTextFirstLineOffset();
+ // tdf#36709: TODO: Handle font-relative units
+ tools::Long aTxtFirstLineOfst = pSpace->ResolveTextFirstLineOffset({});
aTxtLeft = m_xBeforeSpacing->normalize(aTxtLeft);
@@ -294,7 +295,8 @@ IMPL_LINK_NOARG(ParaLRSpacingWindow, ModifySpacingHdl, weld::MetricSpinButton&,
SvxLRSpaceItem aMargin(SID_ATTR_PARA_LRSPACE);
aMargin.SetTextLeft(m_xBeforeSpacing->GetCoreValue(m_eUnit));
aMargin.SetRight(m_xAfterSpacing->GetCoreValue(m_eUnit));
- aMargin.SetTextFirstLineOffset(m_xFLSpacing->GetCoreValue(m_eUnit));
+ // tdf#36709: TODO: Handle font-relative units from GUI
+ aMargin.SetTextFirstLineOffset(SvxIndentValue::twips(m_xFLSpacing->GetCoreValue(m_eUnit)));
pDisp->ExecuteList(SID_ATTR_PARA_LRSPACE, SfxCallMode::RECORD, {&aMargin});
}