summaryrefslogtreecommitdiff
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
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>
-rw-r--r--cui/source/tabpages/paragrph.cxx30
-rw-r--r--cui/source/tabpages/tabstpge.cxx3
-rw-r--r--editeng/source/editeng/editdbg.cxx3
-rw-r--r--editeng/source/editeng/editdoc.cxx7
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx2
-rw-r--r--editeng/source/editeng/impedit2.cxx25
-rw-r--r--editeng/source/editeng/impedit3.cxx16
-rw-r--r--editeng/source/editeng/impedit4.cxx3
-rw-r--r--editeng/source/items/frmitems.cxx227
-rw-r--r--editeng/source/outliner/outliner.cxx6
-rw-r--r--editeng/source/rtf/rtfitem.cxx2
-rw-r--r--filter/source/msfilter/svdfppt.cxx2
-rw-r--r--include/editeng/lrspitem.hxx48
-rw-r--r--include/editeng/unoprnms.hxx2
-rw-r--r--include/editeng/unotext.hxx2
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx6
-rw-r--r--sc/source/core/data/stlsheet.cxx11
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx4
-rw-r--r--sd/source/core/stlpool.cxx2
-rw-r--r--sd/source/core/stlsheet.cxx5
-rw-r--r--sd/source/filter/xml/sdtransform.cxx4
-rw-r--r--sd/source/ui/func/fupage.cxx5
-rw-r--r--sd/source/ui/view/drtxtob1.cxx6
-rw-r--r--sd/source/ui/view/drviews3.cxx36
-rw-r--r--sd/source/ui/view/outlview.cxx2
-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
-rw-r--r--sw/source/core/attr/format.cxx2
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx21
-rw-r--r--sw/source/core/doc/docfmt.cxx5
-rw-r--r--sw/source/core/doc/fmtcol.cxx3
-rw-r--r--sw/source/core/docnode/ndtbl.cxx3
-rw-r--r--sw/source/core/layout/fly.cxx1
-rw-r--r--sw/source/core/layout/frmtool.cxx2
-rw-r--r--sw/source/core/text/frmcrsr.cxx2
-rw-r--r--sw/source/core/text/frmpaint.cxx1
-rw-r--r--sw/source/core/text/itratr.cxx1
-rw-r--r--sw/source/core/text/porfld.cxx1
-rw-r--r--sw/source/core/tox/ToxTabStopTokenHandler.cxx1
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx21
-rw-r--r--sw/source/core/txtnode/thints.cxx7
-rw-r--r--sw/source/filter/html/css1atr.cxx4
-rw-r--r--sw/source/filter/html/htmlctxt.cxx2
-rw-r--r--sw/source/filter/html/htmltab.cxx3
-rw-r--r--sw/source/filter/html/svxcss1.cxx3
-rw-r--r--sw/source/filter/html/swhtml.cxx4
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx6
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx12
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx6
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx7
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx13
-rw-r--r--sw/source/filter/ww8/ww8par.cxx18
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx7
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx17
-rw-r--r--sw/source/filter/xml/xmlexpit.cxx9
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx3
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx6
-rw-r--r--sw/source/uibase/app/applab.cxx2
-rw-r--r--sw/source/uibase/app/docstyle.cxx11
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx4
-rw-r--r--sw/source/uibase/shells/textsh1.cxx3
-rw-r--r--sw/source/uibase/shells/txtattr.cxx3
-rw-r--r--sw/source/uibase/sidebar/WrapPropertyPanel.cxx2
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx14
-rw-r--r--sw/source/uibase/wrtsh/delete.cxx4
-rw-r--r--vcl/qa/cppunit/pdfexport/data/tdf36709.fodt95
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport2.cxx24
71 files changed, 545 insertions, 295 deletions
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 2b262378a361..2889ea2cdf76 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -412,22 +412,21 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
if (m_aFLineIndent.IsRelative())
{
item.SetTextFirstLineOffset(
- rOldItem.GetTextFirstLineOffsetValue(), rOldItem.GetTextFirstLineOffsetUnit(),
+ rOldItem.GetTextFirstLineOffset(),
static_cast<sal_uInt16>(m_aFLineIndent.get_value(FieldUnit::NONE)));
}
else
{
// tdf#36709: TODO: Handle font-relative units from GUI
item.SetTextFirstLineOffset(
- static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)),
+ SvxIndentValue::twips(m_aFLineIndent.GetCoreValue(eUnit)),
css::util::MeasureUnit::TWIP);
}
}
else
{
// tdf#36709: TODO: Handle font-relative units from GUI
- item.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)),
- css::util::MeasureUnit::TWIP);
+ item.SetTextFirstLineOffset(SvxIndentValue::twips(m_aFLineIndent.GetCoreValue(eUnit)));
}
item.SetAutoFirst(m_xAutoCB->get_active());
if (item.GetTextFirstLineOffsetValue() < 0)
@@ -474,19 +473,26 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
if ( m_aFLineIndent.IsRelative() )
- aMargin.SetTextFirstLineOffset( rOldItem.GetTextFirstLineOffset(),
- static_cast<sal_uInt16>(m_aFLineIndent.get_value(FieldUnit::NONE)) );
+ aMargin.SetTextFirstLineOffset(
+ rOldItem.GetTextFirstLineOffset(),
+ static_cast<sal_uInt16>(m_aFLineIndent.get_value(FieldUnit::NONE)));
else
- aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
+ {
+ // tdf#36709: TODO: Handle font-relative units from GUI
+ aMargin.SetTextFirstLineOffset(
+ SvxIndentValue::twips(m_aFLineIndent.GetCoreValue(eUnit)));
+ }
}
else
{
aMargin.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
- aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
+ // tdf#36709: TODO: Handle font-relative units from GUI
+ aMargin.SetTextFirstLineOffset(
+ SvxIndentValue::twips(m_aFLineIndent.GetCoreValue(eUnit)));
}
aMargin.SetAutoFirst(m_xAutoCB->get_active());
- if ( aMargin.GetTextFirstLineOffset() < 0 )
+ if ( aMargin.GetTextFirstLineOffsetValue() < 0.0 )
bNullTab = true;
if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin ||
@@ -733,7 +739,8 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
m_aFLineIndent.SetRelative(false);
m_aFLineIndent.set_min(-9999, FieldUnit::NONE);
m_aFLineIndent.SetFieldUnit(eFUnit);
- m_aFLineIndent.SetMetricValue(rOldItem.GetTextFirstLineOffset(), eUnit);
+ // tdf#36709: TODO: Populate GUI with font-relative unit
+ m_aFLineIndent.SetMetricValue(rOldItem.GetTextFirstLineOffsetValue(), eUnit);
}
m_xAutoCB->set_active(rOldItem.IsAutoFirst());
}
@@ -744,7 +751,8 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
m_aLeftIndent.SetMetricValue(rSpace.GetTextLeft(), eUnit);
m_aRightIndent.SetMetricValue(rSpace.GetRight(), eUnit);
- m_aFLineIndent.SetMetricValue(rSpace.GetTextFirstLineOffset(), eUnit);
+ // tdf#36709: TODO: Populate GUI with font-relative units
+ m_aFLineIndent.SetMetricValue(rSpace.GetTextFirstLineOffsetValue(), eUnit);
m_xAutoCB->set_active(rSpace.IsAutoFirst());
}
AutoHdl_Impl(*m_xAutoCB);
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 3b4ca844f095..34b0b631af3a 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -176,7 +176,8 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet)
if (SfxItemState::SET != rSet->GetItemState(GetWhich(SID_ATTR_LRSPACE), true, &pLRSpace))
pLRSpace = GetOldItem(*rSet, SID_ATTR_LRSPACE);
- if (pLRSpace && static_cast<const SvxLRSpaceItem*>(pLRSpace)->GetTextFirstLineOffset() < 0)
+ if (pLRSpace
+ && static_cast<const SvxLRSpaceItem*>(pLRSpace)->GetTextFirstLineOffsetValue() < 0.0)
{
SvxTabStop aNull(0, SvxTabAdjust::Default);
aNewTabs->Insert(aNull);
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 39c7de5b2ffa..0ff602376509 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -69,7 +69,8 @@ struct DebOutBuffer
}
void append(std::string_view descr, const SvxLRSpaceItem& rItem)
{
- str.append(OString::Concat(descr) + "FI=" + OString::number(rItem.GetTextFirstLineOffset())
+ str.append(OString::Concat(descr)
+ + "FI=" + OString::number(rItem.ResolveTextFirstLineOffset({}))
+ ", LI=" + OString::number(rItem.GetTextLeft())
+ ", RI=" + OString::number(rItem.GetRight()));
}
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 541d652bf8f1..fdc52e57a7fc 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -574,7 +574,12 @@ void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit,
{
assert(dynamic_cast<const SvxLRSpaceItem *>(rPoolItem.get()) != nullptr);
SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(*rPoolItem);
- rItem.SetTextFirstLineOffset( sal::static_int_cast< short >( OutputDevice::LogicToLogic( rItem.GetTextFirstLineOffset(), eSourceUnit, eDestUnit ) ) );
+ if (rItem.GetTextFirstLineOffsetUnit() == css::util::MeasureUnit::TWIP)
+ {
+ rItem.SetTextFirstLineOffset(
+ SvxIndentValue::twips(sal::static_int_cast<short>(OutputDevice::LogicToLogic(
+ rItem.ResolveTextFirstLineOffset({}), eSourceUnit, eDestUnit))));
+ }
rItem.SetTextLeft( OutputDevice::LogicToLogic( rItem.GetTextLeft(), eSourceUnit, eDestUnit ) );
rItem.SetRight( OutputDevice::LogicToLogic( rItem.GetRight(), eSourceUnit, eDestUnit ) );
}
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 2ab10fda7e6f..7176e3961985 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -570,7 +570,7 @@ void EditView::HideCursor(bool bDeactivate)
bool EditView::IsCursorVisible() const { return getImpl().GetCursor()->IsVisible(); }
-Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck )
+::Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck )
{
return getImpl().Scroll( ndX, ndY, nRangeCheck );
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index d4b7ce6109af..aa2846126c23 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -67,6 +67,7 @@ class OutlinerSearchable;
class SvxSearchItem;
class SvxLRSpaceItem;
+struct SvxFontUnitMetrics;
class TextRanger;
class SvKeyValueIterator;
class SvxForbiddenCharactersTable;
@@ -1270,6 +1271,7 @@ public:
SvxAdjust GetJustification( sal_Int32 nPara ) const;
SvxCellJustifyMethod GetJustifyMethod( sal_Int32 nPara ) const;
SvxCellVerJustify GetVerJustification( sal_Int32 nPara ) const;
+ SvxFontUnitMetrics GetFontUnitMetrics(ContentNode* pNode);
void setScalingParameters(ScalingParameters const& rScalingParameters);
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index c638fa147ffd..cd5d25cfd90e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2130,6 +2130,21 @@ SvxCellVerJustify ImpEditEngine::GetVerJustification( sal_Int32 nPara ) const
return static_cast<SvxCellVerJustify>(rItem.GetEnumValue());
}
+SvxFontUnitMetrics ImpEditEngine::GetFontUnitMetrics(ContentNode* pNode)
+{
+ SvxFont aTmpFont{ pNode->GetCharAttribs().GetDefFont() };
+ SeekCursor(pNode, /*index*/ 1, aTmpFont);
+ aTmpFont.SetPhysFont(*GetRefDevice());
+
+ // tdf#36709: Metrics conversion should use em and ic values from the bound fonts.
+ // Unfortunately, this currently poses a problem due to font substitution: tests
+ // abort when a missing font is set on a device.
+ // In the interim, use height for all metrics. This is technically not correct, but
+ // should be close enough for common fonts.
+ auto dTextLineHeight = static_cast<double>(aTmpFont.GetPhysTxtSize(GetRefDevice()).Height());
+ return SvxFontUnitMetrics{ /*em*/ dTextLineHeight, /*ic*/ dTextLineHeight };
+}
+
// Text changes
void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_Int32 nChars )
{
@@ -3452,6 +3467,7 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace
const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pPortion->GetNode() );
sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pPortion->GetNode() );
+ auto stMetrics = GetFontUnitMetrics(pPortion->GetNode());
// On the lines of the paragraph ...
@@ -3467,7 +3483,7 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace
tools::Long nCurWidth = scaleXSpacingValue(rLRItem.GetTextLeft() + nSpaceBeforeAndMinLabelWidth);
if ( nLine == 0 )
{
- tools::Long nFI = scaleXSpacingValue(rLRItem.GetTextFirstLineOffset());
+ tools::Long nFI = scaleXSpacingValue(rLRItem.ResolveTextFirstLineOffset(stMetrics));
nCurWidth -= nFI;
if ( pPortion->GetBulletX() > nCurWidth )
{
@@ -3770,6 +3786,9 @@ Point ImpEditEngine::GetDocPosTopLeft( sal_Int32 nParagraph )
{
const ParaPortion* pPPortion = maParaPortionList.SafeGetObject(nParagraph);
DBG_ASSERT( pPPortion, "Paragraph not found: GetWindowPosTopLeft" );
+
+ auto stMetrics = GetFontUnitMetrics(pPPortion->GetNode());
+
Point aPoint;
if ( pPPortion )
{
@@ -3789,8 +3808,8 @@ Point ImpEditEngine::GetDocPosTopLeft( sal_Int32 nParagraph )
sal_Int32 nSpaceBefore = 0;
GetSpaceBeforeAndMinLabelWidth(pPPortion->GetNode(), &nSpaceBefore);
short nX = static_cast<short>(rLRItem.GetTextLeft()
- + rLRItem.GetTextFirstLineOffset()
- + nSpaceBefore);
+ + rLRItem.ResolveTextFirstLineOffset(stMetrics)
+ + nSpaceBefore);
aPoint.setX(scaleXSpacingValue(nX));
}
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index f74d7664d305..049cb1527008 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -815,7 +815,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
tools::Long nStartXNextLine = nStartX;
if ( nIndex == 0 )
{
- tools::Long nFI = scaleXSpacingValue(rLRItem.GetTextFirstLineOffset());
+ auto stMetrics = GetFontUnitMetrics(pNode);
+ tools::Long nFI = scaleXSpacingValue(rLRItem.ResolveTextFirstLineOffset(stMetrics));
nStartX += nFI;
if (!nLine && rParaPortion.GetBulletX() > nStartX)
@@ -1791,17 +1792,22 @@ void ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion& rParaPortion)
pTmpLine->SetEnd(rParaPortion.GetNode()->Len());
rParaPortion.GetLines().Append(std::unique_ptr<EditLine>(pTmpLine));
+ auto stMetrics = GetFontUnitMetrics(rParaPortion.GetNode());
+
bool bLineBreak = rParaPortion.GetNode()->Len() > 0;
sal_Int32 nSpaceBefore = 0;
sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth(rParaPortion.GetNode(), &nSpaceBefore);
const SvxLRSpaceItem& rLRItem = GetLRSpaceItem(rParaPortion.GetNode());
const SvxLineSpacingItem& rLSItem = rParaPortion.GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
- tools::Long nStartX = scaleXSpacingValue(rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOffset() + nSpaceBefore);
+ tools::Long nStartX = scaleXSpacingValue(
+ rLRItem.GetTextLeft() + rLRItem.ResolveTextFirstLineOffset(stMetrics) + nSpaceBefore);
tools::Rectangle aBulletArea { Point(), Point() };
if ( bLineBreak )
{
- nStartX = scaleXSpacingValue(rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOffset() + nSpaceBeforeAndMinLabelWidth);
+ nStartX = scaleXSpacingValue(rLRItem.GetTextLeft()
+ + rLRItem.ResolveTextFirstLineOffset(stMetrics)
+ + nSpaceBeforeAndMinLabelWidth);
}
else
{
@@ -1812,7 +1818,9 @@ void ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion& rParaPortion)
rParaPortion.SetBulletX( 0 ); // If Bullet set incorrectly.
if (rParaPortion.GetBulletX() > nStartX)
{
- nStartX = scaleXSpacingValue(rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOffset() + nSpaceBeforeAndMinLabelWidth);
+ nStartX = scaleXSpacingValue(rLRItem.GetTextLeft()
+ + rLRItem.ResolveTextFirstLineOffset(stMetrics)
+ + nSpaceBeforeAndMinLabelWidth);
if (rParaPortion.GetBulletX() > nStartX)
nStartX = rParaPortion.GetBulletX();
}
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 05cf8c28a13d..cc45b717f5d5 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -770,7 +770,8 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput,
case EE_PARA_LRSPACE:
{
rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_FI );
- sal_Int32 nTxtFirst = static_cast<const SvxLRSpaceItem&>(rItem).GetTextFirstLineOffset();
+ sal_Int32 nTxtFirst
+ = static_cast<const SvxLRSpaceItem&>(rItem).ResolveTextFirstLineOffset({});
nTxtFirst = LogicToTwips( nTxtFirst );
rOutput.WriteNumberAsString( nTxtFirst );
rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_LI );
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 3f11d48057ac..930fdd70f2e2 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -291,7 +291,6 @@ bool SvxSizeItem::HasMetrics() const
SvxLRSpaceItem::SvxLRSpaceItem(const sal_uInt16 nId)
: SfxPoolItem(nId, SfxItemType::SvxLRSpaceItemType)
- , nFirstLineOffset(0)
, nLeftMargin(0)
, nRightMargin(0)
, m_nGutterMargin(0)
@@ -305,23 +304,21 @@ SvxLRSpaceItem::SvxLRSpaceItem(const sal_uInt16 nId)
{
}
-
-SvxLRSpaceItem::SvxLRSpaceItem( const tools::Long nLeft, const tools::Long nRight,
- const short nOfset,
- const sal_uInt16 nId )
+SvxLRSpaceItem::SvxLRSpaceItem(const tools::Long nLeft, const tools::Long nRight,
+ SvxIndentValue stOffset, const sal_uInt16 nId)
: SfxPoolItem(nId, SfxItemType::SvxLRSpaceItemType)
- , nFirstLineOffset(nOfset)
, nLeftMargin(nLeft)
, nRightMargin(nRight)
, m_nGutterMargin(0)
- , m_nRightGutterMargin(0),
- nPropFirstLineOffset( 100 ),
- nPropLeftMargin( 100 ),
- nPropRightMargin( 100 ),
- bAutoFirst ( false ),
- bExplicitZeroMarginValRight(false),
- bExplicitZeroMarginValLeft(false)
+ , m_nRightGutterMargin(0)
+ , nPropFirstLineOffset(100)
+ , nPropLeftMargin(100)
+ , nPropRightMargin(100)
+ , bAutoFirst(false)
+ , bExplicitZeroMarginValRight(false)
+ , bExplicitZeroMarginValLeft(false)
{
+ SetTextFirstLineOffset(stOffset);
}
@@ -341,7 +338,10 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
aLRSpace.Right = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin);
aLRSpace.ScaleLeft = static_cast<sal_Int16>(nPropLeftMargin);
aLRSpace.ScaleRight = static_cast<sal_Int16>(nPropRightMargin);
- aLRSpace.FirstLine = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nFirstLineOffset) : nFirstLineOffset);
+
+ auto nFirstLineOffsetTwips = ResolveTextFirstLineOffset({});
+ aLRSpace.FirstLine = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nFirstLineOffsetTwips) : nFirstLineOffsetTwips);
+
aLRSpace.ScaleFirstLine = static_cast<sal_Int16>(nPropFirstLineOffset);
aLRSpace.AutoFirstLine = IsAutoFirst();
rVal <<= aLRSpace;
@@ -365,13 +365,39 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
break;
case MID_FIRST_LINE_INDENT:
- rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nFirstLineOffset) : nFirstLineOffset);
- break;
+ // MID_FIRST_LINE_INDENT only supports statically-convertible measures.
+ // In practice, these are always stored here in twips.
+ if (m_nFirstLineUnit == css::util::MeasureUnit::TWIP)
+ {
+ auto nConvOffset
+ = (bConvert ? convertTwipToMm100(m_dFirstLineOffset) : m_dFirstLineOffset);
+ rVal <<= static_cast<sal_Int32>(std::llround(nConvOffset));
+ }
+ else
+ {
+ bRet = false;
+ }
+ break;
case MID_FIRST_LINE_REL_INDENT:
rVal <<= static_cast<sal_Int16>(nPropFirstLineOffset);
break;
+ case MID_FIRST_LINE_UNIT_INDENT:
+ // MID_FIRST_LINE_UNIT_INDENT is used for any values that must be serialized
+ // as a unit-value pair. In practice, this will be limited to font-relative
+ // units (e.g. em, ic), and all other units will be pre-converted to twips.
+ if (m_nFirstLineUnit != css::util::MeasureUnit::TWIP)
+ {
+ rVal
+ <<= css::beans::Pair<double, sal_Int16>{ m_dFirstLineOffset, m_nFirstLineUnit };
+ }
+ else
+ {
+ bRet = false;
+ }
+ break;
+
case MID_FIRST_AUTO:
rVal <<= IsAutoFirst();
break;
@@ -395,8 +421,8 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal = 0;
- if( nMemberId != 0 && nMemberId != MID_FIRST_AUTO &&
- nMemberId != MID_L_REL_MARGIN && nMemberId != MID_R_REL_MARGIN)
+ if (nMemberId != 0 && nMemberId != MID_FIRST_AUTO && nMemberId != MID_L_REL_MARGIN
+ && nMemberId != MID_R_REL_MARGIN && nMemberId != MID_FIRST_LINE_UNIT_INDENT)
if(!(rVal >>= nVal))
return false;
@@ -413,7 +439,9 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
SetRight(bConvert ? o3tl::toTwips(aLRSpace.Right, o3tl::Length::mm100) : aLRSpace.Right);
nPropLeftMargin = aLRSpace.ScaleLeft;
nPropRightMargin = aLRSpace.ScaleRight;
- SetTextFirstLineOffset(bConvert ? o3tl::toTwips(aLRSpace.FirstLine, o3tl::Length::mm100) : aLRSpace.FirstLine);
+ SetTextFirstLineOffset(SvxIndentValue::twips(
+ bConvert ? o3tl::toTwips(aLRSpace.FirstLine, o3tl::Length::mm100)
+ : aLRSpace.FirstLine));
SetPropTextFirstLineOffset ( aLRSpace.ScaleFirstLine );
SetAutoFirst( aLRSpace.AutoFirstLine );
break;
@@ -445,13 +473,26 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
case MID_FIRST_LINE_INDENT :
- SetTextFirstLineOffset(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
+ SetTextFirstLineOffset(
+ SvxIndentValue::twips(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal));
break;
case MID_FIRST_LINE_REL_INDENT:
SetPropTextFirstLineOffset ( nVal );
break;
+ case MID_FIRST_LINE_UNIT_INDENT:
+ {
+ css::beans::Pair<double, sal_Int16> stVal;
+ if (!(rVal >>= stVal))
+ {
+ return false;
+ }
+
+ SetTextFirstLineOffset(SvxIndentValue{ stVal.First, stVal.Second });
+ break;
+ }
+
case MID_FIRST_AUTO:
SetAutoFirst( Any2Bool(rVal) );
break;
@@ -476,7 +517,8 @@ void SvxLeftMarginItem::SetLeft(const tools::Long nL, const sal_uInt16 nProp)
void SvxLRSpaceItem::SetLeft(const tools::Long nL, const sal_uInt16 nProp)
{
nLeftMargin = (nL * nProp) / 100;
- SAL_WARN_IF(nFirstLineOffset != 0, "editeng", "probably call SetTextLeft instead? looks inconsistent otherwise");
+ SAL_WARN_IF(m_dFirstLineOffset != 0.0, "editeng",
+ "probably call SetTextLeft instead? looks inconsistent otherwise");
nPropLeftMargin = nProp;
}
@@ -497,18 +539,26 @@ void SvxLRSpaceItem::SetRight(const tools::Long nR, const sal_uInt16 nProp)
nPropRightMargin = nProp;
}
-void SvxLRSpaceItem::SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp)
+void SvxLRSpaceItem::SetTextFirstLineOffset(SvxIndentValue stValue, sal_uInt16 nProp)
{
// note: left margin contains any negative first line offset - preserve it!
- if (nFirstLineOffset < 0)
+ if (m_dFirstLineOffset < 0.0)
{
- nLeftMargin -= nFirstLineOffset;
+ nLeftMargin -= ResolveTextFirstLineOffset({});
}
- nFirstLineOffset = short((tools::Long(nF) * nProp ) / 100);
+
+ m_dFirstLineOffset = stValue.m_dValue;
+ m_nFirstLineUnit = stValue.m_nUnit;
nPropFirstLineOffset = nProp;
- if (nFirstLineOffset < 0)
+
+ if (nProp != 100)
+ {
+ m_dFirstLineOffset = (stValue.m_dValue * static_cast<double>(nProp)) / 100.0;
+ }
+
+ if (m_dFirstLineOffset < 0.0)
{
- nLeftMargin += nFirstLineOffset;
+ nLeftMargin += ResolveTextFirstLineOffset({});
}
}
@@ -542,12 +592,47 @@ void SvxLRSpaceItem::SetTextLeft(const tools::Long nL, const sal_uInt16 nProp)
auto const nTxtLeft = (nL * nProp) / 100;
nPropLeftMargin = nProp;
// note: left margin contains any negative first line offset
- if ( 0 > nFirstLineOffset )
- nLeftMargin = nTxtLeft + nFirstLineOffset;
+ if (0.0 > m_dFirstLineOffset)
+ nLeftMargin = nTxtLeft + ResolveTextFirstLineOffset({});
else
nLeftMargin = nTxtLeft;
}
+SvxIndentValue SvxLRSpaceItem::GetTextFirstLineOffset() const
+{
+ return { m_dFirstLineOffset, m_nFirstLineUnit };
+}
+
+double SvxLRSpaceItem::GetTextFirstLineOffsetValue() const { return m_dFirstLineOffset; }
+
+sal_Int16 SvxLRSpaceItem::GetTextFirstLineOffsetUnit() const { return m_nFirstLineUnit; }
+
+double SvxLRSpaceItem::ResolveTextFirstLineOffsetDouble(const SvxFontUnitMetrics& rMetrics) const
+{
+ if (m_nFirstLineUnit == css::util::MeasureUnit::TWIP)
+ return m_dFirstLineOffset;
+
+ SAL_WARN_IF(!rMetrics.m_bInitialized, "editeng", "font-relative indentation lost");
+
+ switch (m_nFirstLineUnit)
+ {
+ case css::util::MeasureUnit::FONT_EM:
+ return m_dFirstLineOffset * rMetrics.m_dEmTwips;
+
+ case css::util::MeasureUnit::FONT_CJK_ADVANCE:
+ return m_dFirstLineOffset * rMetrics.m_dIcTwips;
+
+ default:
+ SAL_WARN("editeng", "unhandled type conversion");
+ return 0.0;
+ }
+}
+
+sal_Int32 SvxLRSpaceItem::ResolveTextFirstLineOffset(const SvxFontUnitMetrics& rMetrics) const
+{
+ return static_cast<sal_Int32>(std::llround(ResolveTextFirstLineOffsetDouble(rMetrics)));
+}
+
tools::Long SvxTextLeftMarginItem::GetTextLeft() const
{
return m_nTextLeftMargin;
@@ -569,9 +654,7 @@ tools::Long SvxTextLeftMarginItem::GetLeft(const SvxFirstLineIndentItem& rFirstL
tools::Long SvxLRSpaceItem::GetTextLeft() const
{
// remove any negative first line offset from left margin to get text-left
- return (nFirstLineOffset < 0)
- ? nLeftMargin - nFirstLineOffset
- : nLeftMargin;
+ return (m_dFirstLineOffset < 0) ? nLeftMargin - ResolveTextFirstLineOffset({}) : nLeftMargin;
}
SvxLeftMarginItem::SvxLeftMarginItem(const sal_uInt16 nId)
@@ -935,11 +1018,10 @@ SvxFirstLineIndentItem::SvxFirstLineIndentItem(const sal_uInt16 nId)
{
}
-SvxFirstLineIndentItem::SvxFirstLineIndentItem(double dValue, sal_uInt16 nUnit,
- const sal_uInt16 nId)
+SvxFirstLineIndentItem::SvxFirstLineIndentItem(SvxIndentValue stValue, const sal_uInt16 nId)
: SvxFirstLineIndentItem(nId)
{
- SetTextFirstLineOffset(dValue, nUnit);
+ SetTextFirstLineOffset(stValue);
}
bool SvxFirstLineIndentItem::IsAutoFirst() const { return m_bAutoFirst; }
@@ -961,20 +1043,24 @@ sal_uInt16 SvxFirstLineIndentItem::GetPropTextFirstLineOffset() const
return m_nPropFirstLineOffset;
}
-void SvxFirstLineIndentItem::SetTextFirstLineOffset(double dValue, sal_Int16 nUnit,
- sal_uInt16 nProp)
+void SvxFirstLineIndentItem::SetTextFirstLineOffset(SvxIndentValue stValue, sal_uInt16 nProp)
{
ASSERT_CHANGE_REFCOUNTED_ITEM;
- m_dFirstLineOffset = dValue;
- m_nUnit = nUnit;
+ m_dFirstLineOffset = stValue.m_dValue;
+ m_nUnit = stValue.m_nUnit;
m_nPropFirstLineOffset = nProp;
if (nProp != 100)
{
- m_dFirstLineOffset = (dValue * static_cast<double>(nProp)) / 100.0;
+ m_dFirstLineOffset = (stValue.m_dValue * static_cast<double>(nProp)) / 100.0;
}
}
+SvxIndentValue SvxFirstLineIndentItem::GetTextFirstLineOffset() const
+{
+ return { m_dFirstLineOffset, m_nUnit };
+}
+
double SvxFirstLineIndentItem::GetTextFirstLineOffsetValue() const { return m_dFirstLineOffset; }
sal_Int16 SvxFirstLineIndentItem::GetTextFirstLineOffsetUnit() const { return m_nUnit; }
@@ -1098,9 +1184,7 @@ bool SvxFirstLineIndentItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId)
return false;
}
- m_dFirstLineOffset = stVal.First;
- m_nUnit = stVal.Second;
- m_nPropFirstLineOffset = 100;
+ SetTextFirstLineOffset(SvxIndentValue{ stVal.First, stVal.Second });
break;
}
case MID_FIRST_AUTO:
@@ -1669,18 +1753,15 @@ bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const
const SvxLRSpaceItem& rOther = static_cast<const SvxLRSpaceItem&>(rAttr);
- return (
- nFirstLineOffset == rOther.GetTextFirstLineOffset() &&
- m_nGutterMargin == rOther.GetGutterMargin() &&
- m_nRightGutterMargin == rOther.GetRightGutterMargin() &&
- nLeftMargin == rOther.GetLeft() &&
- nRightMargin == rOther.GetRight() &&
- nPropFirstLineOffset == rOther.GetPropTextFirstLineOffset() &&
- nPropLeftMargin == rOther.GetPropLeft() &&
- nPropRightMargin == rOther.GetPropRight() &&
- bAutoFirst == rOther.IsAutoFirst() &&
- bExplicitZeroMarginValRight == rOther.IsExplicitZeroMarginValRight() &&
- bExplicitZeroMarginValLeft == rOther.IsExplicitZeroMarginValLeft() );
+ return std::tie(m_dFirstLineOffset, m_nFirstLineUnit, m_nGutterMargin, m_nRightGutterMargin,
+ nLeftMargin, nRightMargin, nPropFirstLineOffset, nPropLeftMargin,
+ nPropRightMargin, bAutoFirst, bExplicitZeroMarginValRight,
+ bExplicitZeroMarginValLeft)
+ == std::tie(rOther.m_dFirstLineOffset, rOther.m_nFirstLineUnit, rOther.m_nGutterMargin,
+ rOther.m_nRightGutterMargin, rOther.nLeftMargin, rOther.nRightMargin,
+ rOther.nPropFirstLineOffset, rOther.nPropLeftMargin, rOther.nPropRightMargin,
+ rOther.bAutoFirst, rOther.bExplicitZeroMarginValRight,
+ rOther.bExplicitZeroMarginValLeft);
}
SvxLRSpaceItem* SvxLRSpaceItem::Clone( SfxItemPool* ) const
@@ -1714,9 +1795,15 @@ bool SvxLRSpaceItem::GetPresentation
rText += unicode::formatPercent(nPropFirstLineOffset,
Application::GetSettings().GetUILanguageTag());
}
+ else if (m_nFirstLineUnit != css::util::MeasureUnit::TWIP)
+ {
+ OUStringBuffer stBuf;
+ sax::Converter::convertMeasureUnit(stBuf, m_dFirstLineOffset, m_nFirstLineUnit);
+ rText += stBuf.makeStringAndClear();
+ }
else
- rText += GetMetricText( static_cast<tools::Long>(nFirstLineOffset),
- eCoreUnit, ePresUnit, &rIntl );
+ rText += GetMetricText(static_cast<tools::Long>(m_dFirstLineOffset), eCoreUnit,
+ ePresUnit, &rIntl);
rText += cpDelim;
if ( 100 != nRightMargin )
{
@@ -1740,17 +1827,23 @@ bool SvxLRSpaceItem::GetPresentation
" " + EditResId(GetMetricId(ePresUnit));
}
rText += cpDelim;
- if ( 100 != nPropFirstLineOffset || nFirstLineOffset )
+ if (100 != nPropFirstLineOffset || m_dFirstLineOffset != 0.0)
{
rText += EditResId(RID_SVXITEMS_LRSPACE_FLINE);
if ( 100 != nPropFirstLineOffset )
rText += unicode::formatPercent(nPropFirstLineOffset,
Application::GetSettings().GetUILanguageTag());
+ else if (m_nFirstLineUnit != css::util::MeasureUnit::TWIP)
+ {
+ OUStringBuffer stBuf;
+ sax::Converter::convertMeasureUnit(stBuf, m_dFirstLineOffset, m_nFirstLineUnit);
+ rText += stBuf.makeStringAndClear();
+ }
else
{
- rText += GetMetricText( static_cast<tools::Long>(nFirstLineOffset),
- eCoreUnit, ePresUnit, &rIntl ) +
- " " + EditResId(GetMetricId(ePresUnit));
+ rText += GetMetricText(static_cast<tools::Long>(m_dFirstLineOffset), eCoreUnit,
+ ePresUnit, &rIntl)
+ + " " + EditResId(GetMetricId(ePresUnit));
}
rText += cpDelim;
}
@@ -1774,7 +1867,8 @@ bool SvxLRSpaceItem::GetPresentation
void SvxLRSpaceItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
{
- nFirstLineOffset = static_cast<short>(BigInt::Scale( nFirstLineOffset, nMult, nDiv ));
+ m_dFirstLineOffset
+ = (m_dFirstLineOffset * static_cast<double>(nMult)) / static_cast<double>(nDiv);
nLeftMargin = BigInt::Scale( nLeftMargin, nMult, nDiv );
nRightMargin = BigInt::Scale( nRightMargin, nMult, nDiv );
}
@@ -1790,7 +1884,10 @@ void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxLRSpaceItem"));
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
- (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nFirstLineOffset"), BAD_CAST(OString::number(nFirstLineOffset).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_dFirstLineOffset"),
+ BAD_CAST(OString::number(m_dFirstLineOffset).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nFirstLineUnit"),
+ BAD_CAST(OString::number(m_nFirstLineUnit).getStr()));
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLeftMargin"), BAD_CAST(OString::number(nLeftMargin).getStr()));
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRightMargin"), BAD_CAST(OString::number(nRightMargin).getStr()));
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nGutterMargin"),
@@ -1821,8 +1918,8 @@ boost::property_tree::ptree SvxLRSpaceItem::dumpAsJSON() const
OUString sRight = GetMetricText(GetRight(),
MapUnit::MapTwip, eTargetUnit, nullptr);
- OUString sFirstline = GetMetricText(GetTextFirstLineOffset(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
+ OUString sFirstline
+ = GetMetricText(ResolveTextFirstLineOffset({}), MapUnit::MapTwip, eTargetUnit, nullptr);
aState.put("left", sLeft);
aState.put("right", sRight);
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 1a5ad1e0cbdd..171c296beaa1 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1492,9 +1492,11 @@ tools::Rectangle Outliner::ImpCalcBulletArea( sal_Int32 nPara, bool bAdjust, boo
const auto nSpaceBefore = pFmt->GetAbsLSpace() + pFmt->GetFirstLineOffset();
const SvxLRSpaceItem& rLR = pEditEngine->GetParaAttrib( nPara, bOutlineMode ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE );
- aTopLeft.setX( rLR.GetTextLeft() + rLR.GetTextFirstLineOffset() + nSpaceBefore );
+ aTopLeft.setX(rLR.GetTextLeft() + rLR.ResolveTextFirstLineOffset({}) + nSpaceBefore);
- tools::Long nBulletWidth = std::max( static_cast<tools::Long>(-rLR.GetTextFirstLineOffset()), static_cast<tools::Long>((-pFmt->GetFirstLineOffset()) + pFmt->GetCharTextDistance()) );
+ tools::Long nBulletWidth = std::max(
+ static_cast<tools::Long>(-rLR.ResolveTextFirstLineOffset({})),
+ static_cast<tools::Long>((-pFmt->GetFirstLineOffset()) + pFmt->GetCharTextDistance()));
if ( nBulletWidth < aBulletSize.Width() ) // The Bullet creates its space
nBulletWidth = aBulletSize.Width();
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index a5cfd41efae9..129e43ebc33c 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -325,7 +325,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
CalcValue();
nSz = sal_uInt16(nTokenValue);
}
- aLR.SetTextFirstLineOffset( nSz );
+ aLR.SetTextFirstLineOffset(SvxIndentValue::twips(nSz));
pSet->Put( aLR );
}
break;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 141f4fed9a20..c85d32b1ae64 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -6189,7 +6189,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, std::optional< sal_Int16 >& rS
{
auto const nAbsLSpace = convertMasterUnitToMm100(_nTextOfs);
auto const nFirstLineOffset = nAbsLSpace - convertMasterUnitToMm100(_nBulletOfs);
- aLRSpaceItem.SetTextFirstLineOffsetValue( -nFirstLineOffset );
+ aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(-nFirstLineOffset));
aLRSpaceItem.SetTextLeft( nAbsLSpace );
}
rSet.Put( aLRSpaceItem );
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
index e4f0e8a3dbf7..c47f9a8f29cf 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -63,6 +63,24 @@ struct SvxFontUnitMetrics
}
};
+/// helper struct for passing indentation along with units
+struct SvxIndentValue
+{
+ double m_dValue;
+ sal_Int16 m_nUnit;
+
+ SvxIndentValue() = delete;
+ SvxIndentValue(double dValue, sal_Int16 nUnit)
+ : m_dValue(dValue)
+ , m_nUnit(nUnit)
+ {
+ }
+
+ static SvxIndentValue twips(double dValue) { return { dValue, css::util::MeasureUnit::TWIP }; }
+
+ static SvxIndentValue zero() { return twips(0.0); }
+};
+
/// GetLeft() - for everything that's not applied to a paragraph
class EDITENG_DLLPUBLIC SvxLeftMarginItem final : public SfxPoolItem
{
@@ -166,14 +184,15 @@ public:
void SetPropTextFirstLineOffset(sal_uInt16 nProp);
sal_uInt16 GetPropTextFirstLineOffset() const;
- void SetTextFirstLineOffset(double dValue, sal_Int16 nUnit, sal_uInt16 nProp = 100);
+ void SetTextFirstLineOffset(SvxIndentValue stValue, sal_uInt16 nProp = 100);
+ SvxIndentValue GetTextFirstLineOffset() const;
double GetTextFirstLineOffsetValue() const;
sal_Int16 GetTextFirstLineOffsetUnit() const;
double ResolveTextFirstLineOffsetDouble(const SvxFontUnitMetrics& rMetrics) const;
sal_Int32 ResolveTextFirstLineOffset(const SvxFontUnitMetrics& rMetrics) const;
explicit SvxFirstLineIndentItem(const sal_uInt16 nId);
- SvxFirstLineIndentItem(double dValue, sal_uInt16 nUnit, const sal_uInt16 nId);
+ SvxFirstLineIndentItem(SvxIndentValue stValue, const sal_uInt16 nId);
SvxFirstLineIndentItem(SvxFirstLineIndentItem const &) = default; // SfxPoolItem copy function dichotomy
// "pure virtual Methods" from SfxPoolItem
@@ -306,7 +325,8 @@ public:
class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public SfxPoolItem
{
/// First-line indent always relative to GetTextLeft()
- short nFirstLineOffset;
+ double m_dFirstLineOffset = 0.0;
+ sal_Int16 m_nFirstLineUnit = css::util::MeasureUnit::TWIP;
tools::Long nLeftMargin; // nLeft or the negative first-line indent
tools::Long nRightMargin; // The unproblematic right edge
/// The amount of extra space added to the left margin.
@@ -324,9 +344,8 @@ public:
static SfxPoolItem* CreateDefault();
explicit SvxLRSpaceItem( const sal_uInt16 nId );
- SvxLRSpaceItem( const tools::Long nLeft, const tools::Long nRight,
- const short nOfset /*= 0*/,
- const sal_uInt16 nId );
+ SvxLRSpaceItem(const tools::Long nLeft, const tools::Long nRight, SvxIndentValue stValue,
+ const sal_uInt16 nId);
SvxLRSpaceItem(SvxLRSpaceItem const &) = default; // SfxPoolItem copy function dichotomy
// "pure virtual Methods" from SfxPoolItem
@@ -351,7 +370,11 @@ public:
// Query/direct setting of the absolute values
tools::Long GetLeft() const { return nLeftMargin; }
tools::Long GetRight() const { return nRightMargin;}
- void SetLeftValue( const tools::Long nL ) { assert(nFirstLineOffset == 0); nLeftMargin = nL; }
+ void SetLeftValue(const tools::Long nL)
+ {
+ assert(m_dFirstLineOffset == 0.0);
+ nLeftMargin = nL;
+ }
void SetRightValue( const tools::Long nR ) { nRightMargin = nR; }
bool IsAutoFirst() const { return bAutoFirst; }
void SetAutoFirst( const bool bNew ) { bAutoFirst = bNew; }
@@ -367,14 +390,17 @@ public:
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp = 100);
tools::Long GetTextLeft() const;
- void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp = 100);
- short GetTextFirstLineOffset() const { return nFirstLineOffset; }
+ void SetTextFirstLineOffset(SvxIndentValue stValue, sal_uInt16 nProp = 100);
+ SvxIndentValue GetTextFirstLineOffset() const;
+ double GetTextFirstLineOffsetValue() const;
+ sal_Int16 GetTextFirstLineOffsetUnit() const;
+ double ResolveTextFirstLineOffsetDouble(const SvxFontUnitMetrics& rMetrics) const;
+ sal_Int32 ResolveTextFirstLineOffset(const SvxFontUnitMetrics& rMetrics) const;
+
void SetPropTextFirstLineOffset( const sal_uInt16 nProp )
{ nPropFirstLineOffset = nProp; }
sal_uInt16 GetPropTextFirstLineOffset() const
{ return nPropFirstLineOffset; }
- void SetTextFirstLineOffsetValue( const short nValue )
- { nFirstLineOffset = nValue; }
void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; }
tools::Long GetGutterMargin() const { return m_nGutterMargin; }
void SetRightGutterMargin(const tools::Long nRightGutterMargin) { m_nRightGutterMargin = nRightGutterMargin; }
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 947cfb0d1ca3..0ba35cbee24a 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -305,6 +305,8 @@ inline constexpr OUString UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION = u"ParaIsHa
inline constexpr OUString UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE = u"ParaIsCharacterDistance"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES = u"ParaIsForbiddenRules"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT = u"ParaFirstLineIndent"_ustr;
+inline constexpr OUString UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT_UNIT
+ = u"ParaFirstLineIndentUnit"_ustr;
inline constexpr OUString UNO_NAME_EDIT_CHAR_HEIGHT = u"CharHeight"_ustr;
inline constexpr OUString UNO_NAME_EDIT_CHAR_FONTNAME = u"CharFontName"_ustr;
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 9cb53b5b3063..b5cecccbf625 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/Pair.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
@@ -153,6 +154,7 @@ struct SfxItemPropertyMapEntry;
{ UNO_NAME_EDIT_PARA_TABSTOP_DEFAULT_DISTANCE, EE_PARA_TABS, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TABSTOP_DEFAULT_DISTANCE }, \
{ UNO_NAME_EDIT_PARA_TMARGIN, EE_PARA_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_UP_MARGIN, PropertyMoreFlags::METRIC_ITEM },\
{ UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_FIRST_LINE_INDENT, PropertyMoreFlags::METRIC_ITEM}, \
+ { UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT_UNIT, EE_PARA_LRSPACE, ::cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), 0, MID_FIRST_LINE_UNIT_INDENT }, \
{ UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION,EE_PARA_HANGINGPUNCTUATION, cppu::UnoType<bool>::get(), 0 ,0 }, \
{ UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE, EE_PARA_ASIANCJKSPACING, cppu::UnoType<bool>::get(), 0 ,0 }, \
{ UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES, EE_PARA_FORBIDDENRULES, cppu::UnoType<bool>::get(), 0 ,0 },\
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 83e354df6ead..41914a33ca7a 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2415,8 +2415,10 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
{
aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,
VCLUnoHelper::ConvertToVCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
- aDescriptor.Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN)
- ,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,RPTUI_ID_LRSPACE));
+ aDescriptor.Put(SvxLRSpaceItem(
+ getStyleProperty<sal_Int32>(m_xReportDefinition, PROPERTY_LEFTMARGIN),
+ getStyleProperty<sal_Int32>(m_xReportDefinition, PROPERTY_RIGHTMARGIN),
+ SvxIndentValue::zero(), RPTUI_ID_LRSPACE));
aDescriptor.Put(SvxULSpaceItem(static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN))
,static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BOTTOMMARGIN)),RPTUI_ID_ULSPACE));
aDescriptor.Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<sal_uInt16>(eUserMetric)));
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 4f9ebcb5527d..eafe3f48a264 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -175,10 +175,10 @@ SfxItemSet& ScStyleSheet::GetItemSet()
HFDIST_CM,// nLow
ATTR_ULSPACE );
- SvxLRSpaceItem aLRSpaceItem( TWO_CM, // nLeft
- TWO_CM, // nRight
- 0, // nFirstLineOffset
- ATTR_LRSPACE );
+ SvxLRSpaceItem aLRSpaceItem(TWO_CM, // nLeft
+ TWO_CM, // nRight
+ SvxIndentValue::zero(), // nFirstLineOffset
+ ATTR_LRSPACE);
SvxULSpaceItem aULSpaceItem( TWO_CM, // nUp
TWO_CM, // nLow
ATTR_ULSPACE );
@@ -193,7 +193,8 @@ SfxItemSet& ScStyleSheet::GetItemSet()
rHFSet.Put( aBoxInfoItem );
rHFSet.Put( aHFSizeItem );
rHFSet.Put( aHFDistItem );
- rHFSet.Put( SvxLRSpaceItem(0, 0, 0, ATTR_LRSPACE) ); // Set border to Null
+ rHFSet.Put(SvxLRSpaceItem(0, 0, SvxIndentValue::zero(),
+ ATTR_LRSPACE)); // Set border to Null
aHFSetItem.SetWhich(ATTR_PAGE_HEADERSET);
pSet->Put( aHFSetItem );
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 48f0c0df135d..cc2b3e561488 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -970,8 +970,8 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq )
pArgs->Get( nId ));
SfxItemSetFixed<EE_PARA_LRSPACE, EE_PARA_LRSPACE> aAttr( GetPool() );
nId = EE_PARA_LRSPACE;
- SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
- rItem.GetRight(), rItem.GetTextFirstLineOffset(), nId );
+ SvxLRSpaceItem aLRSpaceItem(rItem.GetLeft(), rItem.GetRight(),
+ rItem.GetTextFirstLineOffset(), nId);
aAttr.Put( aLRSpaceItem );
pView->SetAttributes( aAttr );
}
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 9823c031c251..7af9b22146d3 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -439,7 +439,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName,
rNotesSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF) );
rNotesSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_COLOR ) );
rNotesSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ) );
- rNotesSet.Put( SvxLRSpaceItem( 0, 0, -600, EE_PARA_LRSPACE ) );
+ rNotesSet.Put(SvxLRSpaceItem(0, 0, SvxIndentValue::twips(-600.0), EE_PARA_LRSPACE));
// #i16874# enable kerning by default but only for new documents
rNotesSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 0389adbb145f..9c402c8956e5 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -582,8 +582,9 @@ void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems)
double fIndentFraction = double(rLRItem.GetTextLeft()) / nOldHeight;
SvxLRSpaceItem aNewLRItem(rLRItem);
aNewLRItem.SetTextLeft(fIndentFraction * nNewHeight);
- double fFirstIndentFraction = double(rLRItem.GetTextFirstLineOffset()) / nOldHeight;
- aNewLRItem.SetTextFirstLineOffset(static_cast<short>(fFirstIndentFraction * nNewHeight));
+ double fFirstIndentFraction = rLRItem.GetTextFirstLineOffsetValue() / nOldHeight;
+ aNewLRItem.SetTextFirstLineOffset(SvxIndentValue{ fFirstIndentFraction * nNewHeight,
+ rLRItem.GetTextFirstLineOffsetUnit() });
rSet.Put(aNewLRItem);
}
diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx
index 418f65470315..d11327c76fbb 100644
--- a/sd/source/filter/xml/sdtransform.cxx
+++ b/sd/source/filter/xml/sdtransform.cxx
@@ -294,10 +294,10 @@ bool SdTransformOOo2xDocument::transformItemSet( SfxItemSet& rSet, bool bNumberi
if (pItem)
{
SvxLRSpaceItem aItem(*pItem);
- if( (aItem.GetLeft() != 0) || (aItem.GetTextFirstLineOffset() != 0) )
+ if ((aItem.GetLeft() != 0) || (aItem.GetTextFirstLineOffsetValue() != 0.0))
{
aItem.SetLeftValue( 0 );
- aItem.SetTextFirstLineOffset( 0 );
+ aItem.SetTextFirstLineOffset(SvxIndentValue::zero());
rSet.Put( aItem );
bRet = true;
}
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index a90861d1a7a8..9170f72622b2 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -244,7 +244,10 @@ void FuPage::ExecuteAsyncDialog(weld::Window* pParent, const SfxRequest& rReq)
SvxPaperBinItem aPaperBinItem( SID_ATTR_PAGE_PAPERBIN, static_cast<sal_uInt8>(mpPage->GetPaperBin()) );
aNewAttr->Put( aPaperBinItem );
- SvxLRSpaceItem aLRSpaceItem( static_cast<sal_uInt16>(mpPage->GetLeftBorder()), static_cast<sal_uInt16>(mpPage->GetRightBorder()), 0, mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE));
+ SvxLRSpaceItem aLRSpaceItem(static_cast<sal_uInt16>(mpPage->GetLeftBorder()),
+ static_cast<sal_uInt16>(mpPage->GetRightBorder()),
+ SvxIndentValue::zero(),
+ mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE));
aNewAttr->Put( aLRSpaceItem );
SvxULSpaceItem aULSpaceItem( static_cast<sal_uInt16>(mpPage->GetUpperBorder()), static_cast<sal_uInt16>(mpPage->GetLowerBorder()), mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_ULSPACE));
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index eed3b9662676..b90bff224518 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -347,14 +347,14 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR
SvxLRSpaceItem aNewMargin( EE_PARA_LRSPACE );
- ::tools::Long nIndentDist = aParaMargin.GetTextFirstLineOffset();
+ auto nIndentDist = aParaMargin.ResolveTextFirstLineOffset({});
- if (nIndentDist == 0)
+ if (nIndentDist == 0.0)
nIndentDist = nIndentDefaultDist;
aNewMargin.SetTextLeft(aParaMargin.GetTextLeft() + nIndentDist);
aNewMargin.SetRight(aParaMargin.GetRight());
- aNewMargin.SetTextFirstLineOffset(nIndentDist * -1);
+ aNewMargin.SetTextFirstLineOffset(SvxIndentValue::twips(nIndentDist * -1));
aLRSpaceSet.Put( aNewMargin );
mpView->SetAttributes( aLRSpaceSet );
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 4ec6b61390d8..63add2a2aca8 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -815,9 +815,8 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq)
mpDrawView->GetAttributes( aEditAttr );
nId = EE_PARA_LRSPACE;
- SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
- rItem.GetRight(),
- rItem.GetTextFirstLineOffset(), nId );
+ SvxLRSpaceItem aLRSpaceItem(rItem.GetLeft(), rItem.GetRight(),
+ rItem.GetTextFirstLineOffset(), nId);
const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue();
const SvxLRSpaceItem& rOrigLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE );
@@ -843,21 +842,19 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq)
// negative first line indent goes to the number
// format, positive to the lrSpace item
- if( rItem.GetTextFirstLineOffset() < 0 )
+ if (rItem.GetTextFirstLineOffsetValue() < 0.0)
{
- aFormat.SetFirstLineOffset(
- rItem.GetTextFirstLineOffset()
- - rOrigLRSpaceItem.GetTextFirstLineOffset()
- + aFormat.GetCharTextDistance());
- aLRSpaceItem.SetTextFirstLineOffset(0);
+ aFormat.SetFirstLineOffset(rItem.ResolveTextFirstLineOffset({})
+ - rOrigLRSpaceItem.ResolveTextFirstLineOffset({})
+ + aFormat.GetCharTextDistance());
+ aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::zero());
}
else
{
aFormat.SetFirstLineOffset(0);
- aLRSpaceItem.SetTextFirstLineOffset(
- rItem.GetTextFirstLineOffset()
- - aFormat.GetFirstLineOffset() //TODO: overflow
- + aFormat.GetCharTextDistance());
+ aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(
+ rItem.ResolveTextFirstLineOffset({}) - aFormat.GetFirstLineOffset()
+ + aFormat.GetCharTextDistance()));
}
if( rFormat != aFormat )
@@ -945,9 +942,9 @@ void DrawViewShell::GetRulerState(SfxItemSet& rSet)
rSet.Put( rItem );
const SvxLRSpaceItem& rLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE );
- SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(),
- rLRSpaceItem.GetRight(),
- rLRSpaceItem.GetTextFirstLineOffset(), SID_ATTR_PARA_LRSPACE );
+ SvxLRSpaceItem aLRSpaceItem(rLRSpaceItem.GetLeft(), rLRSpaceItem.GetRight(),
+ rLRSpaceItem.GetTextFirstLineOffset(),
+ SID_ATTR_PARA_LRSPACE);
const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue();
const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET );
@@ -956,10 +953,9 @@ void DrawViewShell::GetRulerState(SfxItemSet& rSet)
{
const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule().GetLevel(nOutlineLevel);
aLRSpaceItem.SetTextLeft(rFormat.GetAbsLSpace() + rLRSpaceItem.GetTextLeft());
- aLRSpaceItem.SetTextFirstLineOffset(
- rLRSpaceItem.GetTextFirstLineOffset() + rFormat.GetFirstLineOffset()
- //TODO: overflow
- - rFormat.GetCharTextDistance());
+ aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(
+ rLRSpaceItem.ResolveTextFirstLineOffset({})
+ + rFormat.GetFirstLineOffset() - rFormat.GetCharTextDistance()));
}
rSet.Put( aLRSpaceItem );
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 33d8f78ba3c5..0fa6402f1a04 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -78,7 +78,7 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie
, mnPagesProcessed(0)
, mbFirstPaint(true)
, maDocColor( COL_WHITE )
-, maLRSpaceItem(2000, 0, 0, EE_PARA_OUTLLRSPACE)
+, maLRSpaceItem(2000, 0, SvxIndentValue::zero(), EE_PARA_OUTLLRSPACE)
{
bool bInitOutliner = false;
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});
}
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 68ec83a6178d..eacf0e8129f0 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -674,7 +674,7 @@ void SwFormat::DelDiffs( const SfxItemSet& rSet )
void SwFormat::SetPageFormatToDefault()
{
const sal_Int32 nSize = o3tl::convert(2, o3tl::Length::cm, o3tl::Length::twip);
- SetFormatAttr(SvxLRSpaceItem(nSize, nSize, 0, RES_LR_SPACE));
+ SetFormatAttr(SvxLRSpaceItem(nSize, nSize, SvxIndentValue::zero(), RES_LR_SPACE));
SetFormatAttr(SvxULSpaceItem(nSize, nSize, RES_UL_SPACE));
}
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index e187159bc7d3..fc7aac7814d4 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -2438,7 +2438,7 @@ bool SwCursorShell::SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode )
RES_MARGIN_FIRSTLINE, RES_MARGIN_TEXTLEFT> aSet(GetDoc()->GetAttrPool());
SvxFirstLineIndentItem firstLine(pCNd->GetAttr(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem leftMargin(pCNd->GetAttr(RES_MARGIN_TEXTLEFT));
- firstLine.SetTextFirstLineOffset(0.0, css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::zero());
leftMargin.SetTextLeft(aFPos.nTabCnt);
aSet.Put(firstLine);
aSet.Put(leftMargin);
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 7df2dc58ebfd..665f8094232e 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -212,8 +212,9 @@ namespace
{
SvxFirstLineIndentItem firstLine(pColl->GetFormatAttr(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem leftMargin(pColl->GetFormatAttr(RES_MARGIN_TEXTLEFT));
- firstLine.SetTextFirstLineOffset(rNFormat.GetFirstLineOffset(),
- rNFormat.GetFirstLineOffsetUnit());
+ firstLine.SetTextFirstLineOffset(
+ SvxIndentValue{ static_cast<double>(rNFormat.GetFirstLineOffset()),
+ rNFormat.GetFirstLineOffsetUnit() });
leftMargin.SetTextLeft(rNFormat.GetAbsLSpace());
pColl->SetFormatAttr(firstLine);
pColl->SetFormatAttr(leftMargin);
@@ -257,7 +258,7 @@ namespace
sal_uInt16 nNxt, SwTwips nEZ, SwTwips nLeft,
SwTwips nUpper, SwTwips nLower )
{
- SvxFirstLineIndentItem firstLine(nEZ, css::util::MeasureUnit::TWIP, RES_MARGIN_FIRSTLINE);
+ SvxFirstLineIndentItem firstLine(SvxIndentValue::twips(nEZ), RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(sal_uInt16(nLeft), RES_MARGIN_TEXTLEFT);
rSet.Put(firstLine);
@@ -711,7 +712,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
case RES_POOLCOLL_TEXT_IDENT: // Text body indentation
{
auto const first(o3tl::convert(5, o3tl::Length::mm, o3tl::Length::twip));
- SvxFirstLineIndentItem const firstLine(first, css::util::MeasureUnit::TWIP,
+ SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(0, RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
@@ -722,7 +723,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
{
auto const first(-o3tl::convert(5, o3tl::Length::mm, o3tl::Length::twip));
auto const left(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip));
- SvxFirstLineIndentItem const firstLine(first, css::util::MeasureUnit::TWIP,
+ SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
@@ -747,7 +748,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
{
auto const first(-o3tl::convert(45, o3tl::Length::mm, o3tl::Length::twip));
auto const left(o3tl::convert(5, o3tl::Length::cm, o3tl::Length::twip));
- SvxFirstLineIndentItem const firstLine(first, css::util::MeasureUnit::TWIP,
+ SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
@@ -956,7 +957,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
{
auto const first(-o3tl::convert(6, o3tl::Length::mm, o3tl::Length::twip));
auto const left(o3tl::convert(6, o3tl::Length::mm, o3tl::Length::twip));
- SvxFirstLineIndentItem const firstLine(first, css::util::MeasureUnit::TWIP,
+ SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
@@ -1683,7 +1684,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
aBox.SetLine( &aLine, SvxBoxItemLine::RIGHT );
aBox.SetAllDistances( 85 );
aSet.Put( aBox );
- aSet.Put( SvxLRSpaceItem( 114, 114, 0, RES_LR_SPACE ) );
+ aSet.Put(SvxLRSpaceItem(114, 114, SvxIndentValue::zero(), RES_LR_SPACE));
aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) );
}
@@ -1705,7 +1706,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
{
aSet.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR ) );
aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) );
- aSet.Put( SvxLRSpaceItem( 0, 0, 0, RES_LR_SPACE ) );
+ aSet.Put(SvxLRSpaceItem(0, 0, SvxIndentValue::zero(), RES_LR_SPACE));
if ( RES_POOLFRM_INLINE_HEADING == nId )
{
@@ -1746,7 +1747,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
{
aSet.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR ) );
aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
- aSet.Put( SvxLRSpaceItem( 114, 114, 0, RES_LR_SPACE ) );
+ aSet.Put(SvxLRSpaceItem(114, 114, SvxIndentValue::zero(), RES_LR_SPACE));
SvxProtectItem aProtect( RES_PROTECT );
aProtect.SetSizeProtect( true );
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index adec26e403c4..c9a0dfd62c05 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1706,8 +1706,9 @@ void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
}
if (indents & ::sw::ListLevelIndents::FirstLine)
{
- firstLine.SetTextFirstLineOffset(rFormat.GetFirstLineIndent(),
- rFormat.GetFirstLineIndentUnit());
+ firstLine.SetTextFirstLineOffset(SvxIndentValue{
+ static_cast<double>(rFormat.GetFirstLineIndent()),
+ rFormat.GetFirstLineIndentUnit() });
}
}
}
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index a7d47a8681fe..353048fcb7c8 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -252,8 +252,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rH
if (100 != pOldFirstLineIndent->GetPropTextFirstLineOffset())
{
const double dOld = pOldFirstLineIndent->GetTextFirstLineOffsetValue();
- aNew.SetTextFirstLineOffset(pNewFirstLineIndent->GetTextFirstLineOffsetValue(),
- pNewFirstLineIndent->GetTextFirstLineOffsetUnit(),
+ aNew.SetTextFirstLineOffset(pNewFirstLineIndent->GetTextFirstLineOffset(),
pOldFirstLineIndent->GetPropTextFirstLineOffset());
bChg = dOld != aNew.GetTextFirstLineOffsetValue();
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 15cd4b39fbe1..e6005663e99a 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -431,7 +431,8 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts,
{
sal_uInt16 nFrameWidth = nLastPos;
nLastPos = (*pColArr)[ pColArr->size()-2 ];
- pTableFormat->SetFormatAttr( SvxLRSpaceItem( nSttPos, nFrameWidth - nLastPos, 0, RES_LR_SPACE ) );
+ pTableFormat->SetFormatAttr(SvxLRSpaceItem(nSttPos, nFrameWidth - nLastPos,
+ SvxIndentValue::zero(), RES_LR_SPACE));
}
nWidth = nLastPos - nSttPos;
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 9a91f98d75a1..42e7af795e73 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -3021,7 +3021,6 @@ static SwTwips lcl_CalcAutoWidth( const SwLayoutFrame& rFrame )
SvxRightMarginItem const& rRightMargin(rParaSet.GetRightMargin());
if (!static_cast<const SwTextFrame*>(pFrame)->IsLocked())
{
- // tdf#36709: TODO: Handle font-relative first-line indent
nMin += rRightMargin.GetRight() + rLeftMargin.GetTextLeft()
+ rFirstLine.ResolveTextFirstLineOffset({});
}
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 1cf9fac80564..14cac86e962a 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2353,7 +2353,6 @@ tools::Long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const
{
if (pCaller->IsRightToLeft())
{
- // tdf#36709: TODO: Handle font-relative units
nRight += m_pTextLeftMargin->GetLeft(*m_pFirstLineIndent, /*metrics*/ {});
}
else
@@ -2409,7 +2408,6 @@ tools::Long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
{
if (pCaller->IsTextFrame())
{
- // tdf#36709: TODO: Handle font-relative units
nLeft += m_pTextLeftMargin->GetLeft(*m_pFirstLineIndent, /*metrics*/ {});
}
else
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 0c845b0150a7..7961e14a58ff 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -216,7 +216,6 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
Point aPnt1 = pFrame->getFrameArea().Pos() + pFrame->getFramePrintArea().Pos();
SwTextNode const*const pTextNd(GetTextNodeForParaProps());
short nFirstOffset;
- // tdf#36709: TODO: Handle font-relative units
pTextNd->GetFirstLineOfsWithNum(nFirstOffset, {});
Point aPnt2;
@@ -1484,7 +1483,6 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
rRect.Top( rRect.Top() + nFirst );
rRect.Height( nLineHeight );
- // tdf#36709: TODO: Handle font-relative units
SwTwips nLeft = rFill.Left() + rTextLeftMargin.GetLeft(rFirstLine, /*metrics*/ {})
+ GetTextNodeForParaProps()->GetLeftMarginWithNum();
SwTwips nRight = rFill.Right() - rRightMargin.GetRight();
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index c39ea7b7395f..b23741335cb0 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -575,7 +575,6 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
const SvxFirstLineIndentItem& rFirstLine(
GetTextNodeForParaProps()->GetSwAttrSet().GetFirstLineIndent());
- // tdf#36709: TODO: Handle font-relative first-line indentation
if (0.0 < rFirstLine.GetTextFirstLineOffsetValue())
{
aPos.AdjustX(rFirstLine.ResolveTextFirstLineOffset({}));
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index c7d03b80b9f9..f93b7274e257 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1085,7 +1085,6 @@ void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong
tools::Long nLROffset = rTextLeftMargin.GetTextLeft() + GetLeftMarginWithNum( true );
short nFLOffs;
// For enumerations a negative first line indentation is probably filled already
- // tdf#36709: TODO: Handle font-relative units
if (!GetFirstLineOfsWithNum(nFLOffs, {}) || nFLOffs > nLROffset)
nLROffset = nFLOffs;
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 36cbdbce162d..3330129be981 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -604,7 +604,6 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf )
(IsFootnoteNumPortion() &&
rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::NO_GAP_AFTER_NOTE_NUMBER)))
{
- // tdf#36709: TODO: Handle font-relative first line indentation
nDiff = rInf.Left()
+ rInf.GetTextFrame()
->GetTextNodeForParaProps()
diff --git a/sw/source/core/tox/ToxTabStopTokenHandler.cxx b/sw/source/core/tox/ToxTabStopTokenHandler.cxx
index 3ebedfec05a3..45020252f592 100644
--- a/sw/source/core/tox/ToxTabStopTokenHandler.cxx
+++ b/sw/source/core/tox/ToxTabStopTokenHandler.cxx
@@ -115,7 +115,6 @@ auto DefaultToxTabStopTokenHandler::CalcEndStop(SwTextNode const& rNode,
SvxTextLeftMarginItem const& rTextLeftMargin(
rNode.GetTextColl()->GetTextLeftMargin());
- // tdf#36709: TODO: Handle font-relative units
nRightMargin -= rTextLeftMargin.GetLeft(rFirstLine, /*metrics*/ {});
nRightMargin -= rFirstLine.ResolveTextFirstLineOffset(/*metrics*/ {});
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index edb760a33ba9..38b034c7c24d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3311,7 +3311,6 @@ tools::Long SwTextNode::GetLeftMarginWithNum( bool bTextLeft ) const
if( pRule->IsAbsSpaces() )
{
SvxFirstLineIndentItem const& rFirst(GetSwAttrSet().GetFirstLineIndent());
- // tdf#36709: TODO: Handle font-relative units
nRet = nRet - GetSwAttrSet().GetTextLeftMargin().GetLeft(rFirst, /*metrics*/ {});
}
}
@@ -3325,7 +3324,6 @@ tools::Long SwTextNode::GetLeftMarginWithNum( bool bTextLeft ) const
// list/paragraph items. (this is rather inelegant)
SvxFirstLineIndentItem firstLine(GetSwAttrSet().GetFirstLineIndent());
SvxTextLeftMarginItem leftMargin(GetSwAttrSet().GetTextLeftMargin());
- // tdf#36709: TODO: Handle font-relative units
nRet = bTextLeft ? -leftMargin.GetTextLeft()
: -leftMargin.GetLeft(firstLine, /*metrics*/ {});
if (indents & ::sw::ListLevelIndents::LeftMargin)
@@ -3334,10 +3332,10 @@ tools::Long SwTextNode::GetLeftMarginWithNum( bool bTextLeft ) const
}
if (indents & ::sw::ListLevelIndents::FirstLine)
{
- firstLine.SetTextFirstLineOffset(rFormat.GetFirstLineIndent(),
- rFormat.GetFirstLineIndentUnit());
+ firstLine.SetTextFirstLineOffset(
+ SvxIndentValue{ static_cast<double>(rFormat.GetFirstLineIndent()),
+ rFormat.GetFirstLineIndentUnit() });
}
- // tdf#36709: TODO: Handle font-relative units
nRet += bTextLeft ? leftMargin.GetTextLeft()
: leftMargin.GetLeft(firstLine, /*metrics*/ {});
}
@@ -3402,12 +3400,10 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
{
SvxFirstLineIndentItem const& rFirst(GetSwAttrSet().GetFirstLineIndent());
- // tdf#36709: TODO: Handle font-relative indentation
nAdditionalIndent = GetSwAttrSet().GetTextLeftMargin().GetLeft(rFirst, /*metrics*/ {});
if (getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING))
{
- // tdf#36709: TODO: Handle font-relative indentation
nAdditionalIndent
= nAdditionalIndent
- GetSwAttrSet().GetFirstLineIndent().ResolveTextFirstLineOffset({});
@@ -3420,21 +3416,21 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
// other use of it.
::sw::ListLevelIndents const indents(AreListLevelIndentsApplicable());
SvxFirstLineIndentItem const aFirst(
- indents & ::sw::ListLevelIndents::FirstLine
- ? SvxFirstLineIndentItem(rFormat.GetFirstLineIndent(),
- rFormat.GetFirstLineIndentUnit(), RES_MARGIN_FIRSTLINE)
+ indents & ::sw::ListLevelIndents::FirstLine
+ ? SvxFirstLineIndentItem(
+ SvxIndentValue{ static_cast<double>(rFormat.GetFirstLineIndent()),
+ rFormat.GetFirstLineIndentUnit() },
+ RES_MARGIN_FIRSTLINE)
: GetSwAttrSet().GetFirstLineIndent());
SvxTextLeftMarginItem const aLeft(
indents & ::sw::ListLevelIndents::LeftMargin
? SvxTextLeftMarginItem(rFormat.GetIndentAt(), RES_MARGIN_TEXTLEFT)
: GetSwAttrSet().GetTextLeftMargin());
- // tdf#36709: TODO: Handle font-relative indentation
nAdditionalIndent = aLeft.GetLeft(aFirst, /*metrics*/ {});
if (!(indents & ::sw::ListLevelIndents::FirstLine))
{
if (getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING))
{
- // tdf#36709: TODO: Handle font-relative first line indentation
nAdditionalIndent = nAdditionalIndent - aFirst.ResolveTextFirstLineOffset({});
}
}
@@ -3442,7 +3438,6 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
}
else
{
- // tdf#36709: TODO: Handle font-relative first line indentation
SvxFirstLineIndentItem const& rFirst(GetSwAttrSet().GetFirstLineIndent());
nAdditionalIndent = GetSwAttrSet().GetTextLeftMargin().GetLeft(rFirst, /*metrics*/ {});
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 4dab2b5ee23d..a2dffac99636 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2135,9 +2135,10 @@ static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTextNode& rTextNode,
{
if (indents & ::sw::ListLevelIndents::FirstLine)
{
- SvxFirstLineIndentItem const firstLine(rFormat.GetFirstLineIndent(),
- rFormat.GetFirstLineIndentUnit(),
- RES_MARGIN_FIRSTLINE);
+ SvxFirstLineIndentItem const firstLine(
+ SvxIndentValue{ static_cast<double>(rFormat.GetFirstLineIndent()),
+ rFormat.GetFirstLineIndentUnit() },
+ RES_MARGIN_FIRSTLINE);
rSet.Put(firstLine);
}
if (indents & ::sw::ListLevelIndents::LeftMargin)
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index de2c160f3330..90c505eba8bd 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -2867,8 +2867,8 @@ static SwHTMLWriter& OutCSS1_SvxLRSpace( SwHTMLWriter& rWrt, const SfxPoolItem&
}
// The LineIndent of the first line might contain the room for numbering
- tools::Long nFirstLineIndent = static_cast<tools::Long>(rLRItem.GetTextFirstLineOffset()) -
- rWrt.m_nFirstLineIndent;
+ tools::Long nFirstLineIndent = static_cast<tools::Long>(rLRItem.ResolveTextFirstLineOffset({}))
+ - rWrt.m_nFirstLineIndent;
if( rWrt.m_nDfltFirstLineIndent != nFirstLineIndent )
{
rWrt.OutCSS1_UnitProperty( sCSS1_P_text_indent,
diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx
index bb0a1d58c734..4035a4dde407 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -644,7 +644,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
pContext->SetMargins( nLeft, nRight, nIndent );
// Set the attribute on the current paragraph
- SvxFirstLineIndentItem firstLine(nIndent, css::util::MeasureUnit::TWIP,
+ SvxFirstLineIndentItem firstLine(SvxIndentValue::twips(nIndent),
RES_MARGIN_FIRSTLINE);
NewAttr(m_xAttrTab, &m_xAttrTab->pFirstLineIndent, firstLine);
EndAttr(m_xAttrTab->pFirstLineIndent, false);
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 92ca567aeeb0..23ec0f9b6d7b 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -3459,7 +3459,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
sal_uInt16 nSpace = pCurTable->GetHSpace();
if( nSpace )
- aFrameSet.Put( SvxLRSpaceItem(nSpace, nSpace, 0, RES_LR_SPACE) );
+ aFrameSet.Put(
+ SvxLRSpaceItem(nSpace, nSpace, SvxIndentValue::zero(), RES_LR_SPACE));
nSpace = pCurTable->GetVSpace();
if( nSpace )
aFrameSet.Put( SvxULSpaceItem(nSpace,nSpace, RES_UL_SPACE) );
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 8350dff92c7d..b1dc184d722f 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -1987,8 +1987,7 @@ static void ParseCSS1_text_indent( const CSS1Expression *pExpr,
if( !bSet )
return;
- SvxFirstLineIndentItem const firstLine(nIndent, css::util::MeasureUnit::TWIP,
- RES_MARGIN_FIRSTLINE);
+ SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(nIndent), RES_MARGIN_FIRSTLINE);
rItemSet.Put(firstLine);
rPropInfo.m_bTextIndent = true;
}
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 5f8236f97217..b1a85351a5af 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -4846,7 +4846,7 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext )
SvxFirstLineIndentItem firstLine(rFirstLine);
SvxTextLeftMarginItem leftMargin(rTextLeftMargin);
SvxRightMarginItem rightMargin(rRightMargin);
- firstLine.SetTextFirstLineOffset(nFirstLineIndent, css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::twips(nFirstLineIndent));
leftMargin.SetTextLeft(nLeftMargin);
rightMargin.SetRight(nRightMargin);
if( pItemSet )
@@ -5081,7 +5081,7 @@ void SwHTMLParser::InsertSpacer()
GetMarginsFromContextWithNumberBullet( nLeft, nRight, nIndent );
nIndent = nIndent + static_cast<short>(nSize);
- SvxFirstLineIndentItem const firstLine(nIndent, css::util::MeasureUnit::TWIP,
+ SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(nIndent),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(nLeft, RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(nRight, RES_MARGIN_RIGHT);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c36fc02f633a..294651fbeb22 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9397,7 +9397,8 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
{
pLRSpaceAttrList->add( FSNS(XML_w, (bEcma ? XML_right : XML_end)), OString::number(pLRSpace->GetRight()) );
}
- sal_Int32 const nFirstLineAdjustment = pLRSpace->GetTextFirstLineOffset();
+ // tdf#83844: TODO: export FONT_CJK_ADVANCE first line indent as HangingChars/FirstLineChars
+ sal_Int32 const nFirstLineAdjustment = pLRSpace->ResolveTextFirstLineOffset({});
if (nFirstLineAdjustment > 0)
pLRSpaceAttrList->add( FSNS( XML_w, XML_firstLine ), OString::number( nFirstLineAdjustment ) );
else
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index bea6f6940c6e..7ddde4e78101 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3254,8 +3254,8 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 n
SvxTextLeftMarginItem leftMargin(rNdSet.Get(RES_MARGIN_TEXTLEFT));
leftMargin.SetTextLeft(leftMargin.GetTextLeft() + pFormat->GetIndentAt());
- firstLine.SetTextFirstLineOffset(pFormat->GetFirstLineOffset(),
- pFormat->GetFirstLineOffsetUnit());
+ firstLine.SetTextFirstLineOffset(SvxIndentValue{
+ static_cast<double>(pFormat->GetFirstLineOffset()), pFormat->GetFirstLineOffsetUnit() });
sal_uInt16 nStyle = m_rExport.GetId(pFormat->GetCharFormat());
OString* pString = m_rExport.GetStyle(nStyle);
@@ -3459,7 +3459,7 @@ void RtfAttributeOutput::FormatLRSpace(const SvxLRSpaceItem& rLRSpace)
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RIN);
m_aStyles.append(static_cast<sal_Int32>(rLRSpace.GetRight()));
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FI);
- m_aStyles.append(static_cast<sal_Int32>(rLRSpace.GetTextFirstLineOffset()));
+ m_aStyles.append(rLRSpace.ResolveTextFirstLineOffset({}));
}
}
else if (m_rExport.GetRTFFlySyntax())
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 5f113a231ea0..463646a1cfee 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -3062,17 +3062,15 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
{
if (bParaRTL)
{
- firstLine.SetTextFirstLineOffset(
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::twips(
firstLine.ResolveTextFirstLineOffset({}) + pFormat->GetAbsLSpace()
- - pFormat->GetFirstLineOffset(),
- css::util::MeasureUnit::TWIP);
+ - pFormat->GetFirstLineOffset()));
}
else
{
firstLine.SetTextFirstLineOffset(
- firstLine.ResolveTextFirstLineOffset({})
- + GetWordFirstLineOffset(*pFormat),
- css::util::MeasureUnit::TWIP);
+ SvxIndentValue::twips(firstLine.ResolveTextFirstLineOffset({})
+ + GetWordFirstLineOffset(*pFormat)));
}
}
@@ -3205,7 +3203,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
// (first line indent is ignored)
if (!bParaRTL)
{
- firstLine.SetTextFirstLineOffset(0.0, css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::zero());
}
// put back the new item
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index d36541a0a891..39f195bc3d6e 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1729,9 +1729,9 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
const SvxLRSpaceItem &rPageLR =
pPdFormat->GetFormatAttr( RES_LR_SPACE );
- SvxLRSpaceItem aResultLR( rPageLR.GetLeft() +
- rSectionLR.GetLeft(), rPageLR.GetRight() +
- rSectionLR.GetRight(), 0, RES_LR_SPACE );
+ SvxLRSpaceItem aResultLR(rPageLR.GetLeft() + rSectionLR.GetLeft(),
+ rPageLR.GetRight() + rSectionLR.GetRight(),
+ SvxIndentValue::zero(), RES_LR_SPACE);
//i120133: The Section width should consider section indent value.
if (rSectionLR.GetLeft()+rSectionLR.GetRight()!=0)
{
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 50b35698c620..37915ccf7b66 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -927,8 +927,8 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b
SvxTextLeftMarginItem leftMargin(aSet.Get(RES_MARGIN_TEXTLEFT));
leftMargin.SetTextLeft(leftMargin.GetTextLeft() + rNFormat.GetAbsLSpace());
- firstLine.SetTextFirstLineOffset(GetWordFirstLineOffset(rNFormat),
- css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(
+ SvxIndentValue::twips(GetWordFirstLineOffset(rNFormat)));
aSet.Put(firstLine);
aSet.Put(leftMargin);
@@ -4427,8 +4427,9 @@ void WW8AttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLR )
m_rWW8Export.InsUInt16( o3tl::narrowing<sal_uInt16>(rLR.GetRight()) );
// sprmPDxaLeft1
+ // tdf#80596: TODO export sprmPDxcLeft1 for first line indents in ICs
m_rWW8Export.InsUInt16( 0x8460 ); //asian version ?
- m_rWW8Export.InsUInt16( rLR.GetTextFirstLineOffset() );
+ m_rWW8Export.InsUInt16(rLR.ResolveTextFirstLineOffset({}));
}
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index d3e8cd0bc20e..466e5d66e365 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -525,8 +525,8 @@ void SwWW8ImplReader::InsertTxbxStyAttrs(SfxItemSet& rS, sal_uInt16 nColl, ManTy
&& "unnecessary when EditEng learns about the separate pieces");
SvxLRSpaceItem aLR(rS.Get(EE_PARA_LRSPACE));
- aLR.SetTextFirstLineOffset(
- pStyInf->m_pFormat->GetFirstLineIndent().ResolveTextFirstLineOffset({}));
+ const auto& rFirstLine = pStyInf->m_pFormat->GetFirstLineIndent();
+ aLR.SetTextFirstLineOffset(rFirstLine.GetTextFirstLineOffset());
aLR.SetTextLeft(pStyInf->m_pFormat->GetTextLeftMargin().GetTextLeft());
aLR.SetRight(pStyInf->m_pFormat->GetRightMargin().GetRight());
rS.Put(aLR);
@@ -771,9 +771,9 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp,
SvxLRSpaceItem aLR(pS->Get(EE_PARA_LRSPACE));
if (nWhich == RES_MARGIN_FIRSTLINE)
{
- aLR.SetTextFirstLineOffset(
- static_cast<const SvxFirstLineIndentItem*>(pItem)
- ->ResolveTextFirstLineOffset({}));
+ const auto* pFirstLine
+ = static_cast<const SvxFirstLineIndentItem*>(pItem);
+ aLR.SetTextFirstLineOffset(pFirstLine->GetTextFirstLineOffset());
}
else if (nWhich == RES_MARGIN_TEXTLEFT)
{
@@ -2052,7 +2052,8 @@ void SwWW8ImplReader::MapWrapIntoFlyFormat(const SvxMSDffImportRec& rRecord,
if (rRecord.nDxWrapDistLeft || rRecord.nDxWrapDistRight)
{
SvxLRSpaceItem aLR(writer_cast<sal_uInt16>(rRecord.nDxWrapDistLeft),
- writer_cast<sal_uInt16>(rRecord.nDxWrapDistRight), 0, RES_LR_SPACE);
+ writer_cast<sal_uInt16>(rRecord.nDxWrapDistRight),
+ SvxIndentValue::zero(), RES_LR_SPACE);
AdjustLRWrapForWordMargins(rRecord, aLR);
rFlyFormat.SetFormatAttr(aLR);
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 397d1b9c7ae9..e3fb612e75de 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1249,15 +1249,16 @@ void SyncIndentWithList( SvxFirstLineIndentItem & rFirstLine,
tools::Long nWantedFirstLinePos;
tools::Long nExtraListIndent = lcl_GetTrueMargin(rFirstLine, rLeftMargin, rFormat, nWantedFirstLinePos);
rLeftMargin.SetTextLeft(nWantedFirstLinePos - nExtraListIndent);
- rFirstLine.SetTextFirstLineOffset(0.0, css::util::MeasureUnit::TWIP);
+ rFirstLine.SetTextFirstLineOffset(SvxIndentValue::zero());
}
else if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
if ( !bFirstLineOfstSet && bLeftIndentSet &&
rFormat.GetFirstLineIndent() != 0 )
{
- rFirstLine.SetTextFirstLineOffset(rFormat.GetFirstLineIndent(),
- rFormat.GetFirstLineIndentUnit());
+ rFirstLine.SetTextFirstLineOffset(
+ SvxIndentValue{ static_cast<double>(rFormat.GetFirstLineIndent()),
+ rFormat.GetFirstLineIndentUnit() });
}
else if ( bFirstLineOfstSet && !bLeftIndentSet &&
rFormat.GetIndentAt() != 0 )
@@ -1268,8 +1269,9 @@ void SyncIndentWithList( SvxFirstLineIndentItem & rFirstLine,
{
if ( rFormat.GetFirstLineIndent() != 0 )
{
- rFirstLine.SetTextFirstLineOffset(rFormat.GetFirstLineIndent(),
- rFormat.GetFirstLineIndentUnit());
+ rFirstLine.SetTextFirstLineOffset(
+ SvxIndentValue{ static_cast<double>(rFormat.GetFirstLineIndent()),
+ rFormat.GetFirstLineIndentUnit() });
}
if ( rFormat.GetIndentAt() != 0 )
{
@@ -1358,8 +1360,7 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{
SvxFirstLineIndentItem const firstLineEntry(*static_cast<SvxFirstLineIndentItem*>(rEntry.m_pAttr.get()));
firstLineNew.SetTextFirstLineOffset(
- firstLineEntry.GetTextFirstLineOffsetValue(),
- firstLineEntry.GetTextFirstLineOffsetUnit(),
+ firstLineEntry.GetTextFirstLineOffset(),
firstLineEntry.GetPropTextFirstLineOffset());
firstLineNew.SetAutoFirst(firstLineEntry.IsAutoFirst());
}
@@ -1386,8 +1387,7 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
else
{
firstLineNew.SetTextFirstLineOffset(
- firstLineOld.GetTextFirstLineOffsetValue(),
- firstLineOld.GetTextFirstLineOffsetUnit(),
+ firstLineOld.GetTextFirstLineOffset(),
firstLineOld.GetPropTextFirstLineOffset());
firstLineNew.SetAutoFirst(firstLineOld.IsAutoFirst());
}
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index adf1a5e31f31..e3fc0acabd88 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1680,8 +1680,7 @@ void UseListIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
SvxFirstLineIndentItem firstLine(rStyle.m_pFormat->GetFormatAttr(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem leftMargin(rStyle.m_pFormat->GetFormatAttr(RES_MARGIN_TEXTLEFT));
leftMargin.SetTextLeft(nAbsLSpace);
- firstLine.SetTextFirstLineOffset(writer_cast<short>(nListFirstLineIndent),
- css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::twips(nListFirstLineIndent));
rStyle.m_pFormat->SetFormatAttr(firstLine);
rStyle.m_pFormat->SetFormatAttr(leftMargin);
rStyle.m_bListRelevantIndentSet = true;
@@ -1703,7 +1702,7 @@ void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
else
{
leftMargin.SetTextLeft(0);
- firstLine.SetTextFirstLineOffset(0.0, css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::zero());
}
rStyle.m_pFormat->SetFormatAttr(firstLine);
rStyle.m_pFormat->SetFormatAttr(leftMargin);
@@ -2021,7 +2020,7 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
pFirstLine.reset(pItem->Clone());
// reset/blank the left indent (and only the left)
- pFirstLine->SetTextFirstLineOffset(0.0, css::util::MeasureUnit::TWIP);
+ pFirstLine->SetTextFirstLineOffset(SvxIndentValue::zero());
SvxTextLeftMarginItem leftMargin(0, RES_MARGIN_TEXTLEFT);
// apply the modified SvxLRSpaceItem to the current paragraph
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index a81ab545e38a..5ea42441dde8 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -523,7 +523,8 @@ void wwSectionManager::SetPage(SwPageDesc &rInPageDesc, SwFrameFormat &rFormat,
aSz.SetHeight(SvxPaperInfo::GetSloppyPaperDimension(rSection.GetPageHeight()));
rFormat.SetFormatAttr(aSz);
- SvxLRSpaceItem aLR(rSection.GetPageLeft(), rSection.GetPageRight(), 0, RES_LR_SPACE);
+ SvxLRSpaceItem aLR(rSection.GetPageLeft(), rSection.GetPageRight(), SvxIndentValue::zero(),
+ RES_LR_SPACE);
aLR.SetGutterMargin(rSection.m_nPgGutter);
rFormat.SetFormatAttr(aLR);
@@ -761,7 +762,7 @@ SwSectionFormat *wwSectionManager::InsertSection(
tools::Long nSectionRight = rSection.GetPageRight() - nPageRight;
if ((nSectionLeft != 0) || (nSectionRight != 0))
{
- SvxLRSpaceItem aLR(nSectionLeft, nSectionRight, 0, RES_LR_SPACE);
+ SvxLRSpaceItem aLR(nSectionLeft, nSectionRight, SvxIndentValue::zero(), RES_LR_SPACE);
pFormat->SetFormatAttr(aLR);
}
@@ -2198,7 +2199,8 @@ WW8FlySet::WW8FlySet(SwWW8ImplReader& rReader, const WW8FlyPara* pFW,
Put( SwFormatVertOrient( pFS->nYPos, pFS->eVAlign, pFS->eVRel ) );
if (pFS->nLeftMargin || pFS->nRightMargin) // set borders
- Put(SvxLRSpaceItem(pFS->nLeftMargin, pFS->nRightMargin, 0, RES_LR_SPACE));
+ Put(SvxLRSpaceItem(pFS->nLeftMargin, pFS->nRightMargin, SvxIndentValue::zero(),
+ RES_LR_SPACE));
if (pFS->nUpperMargin || pFS->nLowerMargin)
Put(SvxULSpaceItem(pFS->nUpperMargin, pFS->nLowerMargin, RES_UL_SPACE));
@@ -2259,7 +2261,7 @@ WW8FlySet::WW8FlySet( SwWW8ImplReader& rReader, const SwPaM* pPaM,
brcVer9[i] = WW8_BRCVer9(rPic.rgbrc[i]);
if (SwWW8ImplReader::SetFlyBordersShadow( *this, brcVer9, &aSizeArray[0]))
{
- Put(SvxLRSpaceItem( aSizeArray[WW8_LEFT], 0, 0, RES_LR_SPACE ) );
+ Put(SvxLRSpaceItem(aSizeArray[WW8_LEFT], 0, SvxIndentValue::zero(), RES_LR_SPACE));
Put(SvxULSpaceItem( aSizeArray[WW8_TOP], 0, RES_UL_SPACE ));
aSizeArray[WW8_RIGHT]*=2;
aSizeArray[WW8_BOT]*=2;
@@ -4306,8 +4308,9 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
if ( pFormat && pFormat->GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
pLeftMargin->SetTextLeft(pFormat->GetIndentAt());
- pFirstLine->SetTextFirstLineOffset(pFormat->GetFirstLineIndent(),
- pFormat->GetFirstLineIndentUnit());
+ pFirstLine->SetTextFirstLineOffset(
+ SvxIndentValue{ static_cast<double>(pFormat->GetFirstLineIndent()),
+ pFormat->GetFirstLineIndentUnit() });
// make paragraph have hard-set indent attributes
pTextNode->SetAttr(*pLeftMargin);
pTextNode->SetAttr(*pFirstLine);
@@ -4385,7 +4388,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
}
// tdf#80596: TODO handle sprmPDxcLeft1
- pFirstLine->SetTextFirstLineOffset(nPara, css::util::MeasureUnit::TWIP);
+ pFirstLine->SetTextFirstLineOffset(SvxIndentValue::twips(nPara));
if (!m_pCurrentColl)
{
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index e731281937df..637adfcccbe5 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -425,10 +425,17 @@ bool SvXMLExportItemMapper::QueryXMLValue(
::sax::Converter::convertPercent(
aOut, rLRSpace.GetPropTextFirstLineOffset() );
}
+ else if (rLRSpace.GetTextFirstLineOffsetUnit()
+ != css::util::MeasureUnit::TWIP)
+ {
+ ::sax::Converter::convertMeasureUnit(
+ aOut, rLRSpace.GetTextFirstLineOffsetValue(),
+ rLRSpace.GetTextFirstLineOffsetUnit());
+ }
else
{
rUnitConverter.convertMeasureToXML(
- aOut, rLRSpace.GetTextFirstLineOffset() );
+ aOut, rLRSpace.GetTextFirstLineOffsetValue());
}
}
else
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index 081322ca1843..a4dbe7e328b1 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -367,7 +367,8 @@ bool SvXMLImportItemMapper::PutXMLValue(
bOk = rUnitConverter.convertMeasureToCore(nAbs, rValue,
-0x7fff, 0x7fff );
- rLRSpace.SetTextFirstLineOffset( static_cast<short>(nAbs), o3tl::narrowing<sal_uInt16>(nProp) );
+ rLRSpace.SetTextFirstLineOffset(SvxIndentValue::twips(nAbs),
+ o3tl::narrowing<sal_uInt16>(nProp));
}
break;
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 03ac7d48c9d1..d82f13a14049 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -2091,9 +2091,9 @@ bool SwSectionIndentTabPage::FillItemSet(SfxItemSet* rSet)
{
if (m_xBeforeMF->get_value_changed_from_saved() || m_xAfterMF->get_value_changed_from_saved())
{
- SvxLRSpaceItem aLRSpace(
- m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)) ,
- m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)), 0, RES_LR_SPACE);
+ SvxLRSpaceItem aLRSpace(m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FieldUnit::TWIP)),
+ m_xAfterMF->denormalize(m_xAfterMF->get_value(FieldUnit::TWIP)),
+ SvxIndentValue::zero(), RES_LR_SPACE);
rSet->Put(aLRSpace);
}
return true;
diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index 0b9aa2e90312..279bed8d1e74 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -282,7 +282,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
//frame represents label itself, no border space
SvxULSpaceItem aFrameNoULSpace( 0, 0, RES_UL_SPACE );
- SvxLRSpaceItem aFrameNoLRSpace( 0, 0, 0, RES_LR_SPACE );
+ SvxLRSpaceItem aFrameNoLRSpace(0, 0, SvxIndentValue::zero(), RES_LR_SPACE);
pFormat->SetFormatAttr( aFrameNoULSpace );
pFormat->SetFormatAttr( aFrameNoLRSpace );
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 02236edde471..277679464613 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -215,9 +215,7 @@ public:
if (!oLRSpaceItem)
oLRSpaceItem.emplace(EE_PARA_LRSPACE);
auto pFirstLineItem = static_cast<const SvxFirstLineIndentItem*>(pItem);
- // tdf#36709: TODO: Handle font-relative first-line indentation
- (*oLRSpaceItem)
- .SetTextFirstLineOffsetValue(pFirstLineItem->ResolveTextFirstLineOffset({}));
+ (*oLRSpaceItem).SetTextFirstLineOffset(pFirstLineItem->GetTextFirstLineOffset());
(*oLRSpaceItem).SetAutoFirst(pFirstLineItem->IsAutoFirst());
}
else if (nWhich == RES_MARGIN_TEXTLEFT)
@@ -1605,9 +1603,10 @@ void SwDocStyleSheet::MergeIndentAttrsOfListStyle( SfxItemSet& rSet )
{
if (indents & ::sw::ListLevelIndents::FirstLine)
{
- SvxFirstLineIndentItem const firstLine(rFormat.GetFirstLineIndent(),
- rFormat.GetFirstLineIndentUnit(),
- RES_MARGIN_FIRSTLINE);
+ SvxFirstLineIndentItem const firstLine(
+ SvxIndentValue{ static_cast<double>(rFormat.GetFirstLineIndent()),
+ rFormat.GetFirstLineIndentUnit() },
+ RES_MARGIN_FIRSTLINE);
rSet.Put(firstLine);
}
if (indents & ::sw::ListLevelIndents::LeftMargin)
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 2148180c9970..38d2a8521057 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -242,7 +242,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
SvxLRSpaceItem aParaMargin = aEditAttr.Get( EE_PARA_LRSPACE );
aParaMargin.SetWhich( EE_PARA_LRSPACE );
- tools::Long nIndentDist = aParaMargin.GetTextFirstLineOffset();
+ tools::Long nIndentDist = aParaMargin.ResolveTextFirstLineOffset({});
if (nIndentDist == 0)
{
@@ -252,7 +252,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
aParaMargin.SetTextLeft(aParaMargin.GetTextLeft() + nIndentDist);
aParaMargin.SetRight(aParaMargin.GetRight());
- aParaMargin.SetTextFirstLineOffset(nIndentDist * -1);
+ aParaMargin.SetTextFirstLineOffset(SvxIndentValue::twips(nIndentDist * -1));
aNewAttr.Put(aParaMargin);
rReq.Done();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 3578543a2357..c9b9ceb60e38 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1746,7 +1746,8 @@ void SwTextShell::Execute(SfxRequest &rReq)
SvxFirstLineIndentItem firstLine(RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem leftMargin(RES_MARGIN_TEXTLEFT);
SvxRightMarginItem rightMargin(RES_MARGIN_RIGHT);
- firstLine.SetTextFirstLineOffset(aParaMargin.GetTextFirstLineOffset(), aParaMargin.GetPropTextFirstLineOffset());
+ firstLine.SetTextFirstLineOffset(aParaMargin.GetTextFirstLineOffset(),
+ aParaMargin.GetPropTextFirstLineOffset());
firstLine.SetAutoFirst(aParaMargin.IsAutoFirst());
leftMargin.SetTextLeft(aParaMargin.GetTextLeft(), aParaMargin.GetPropLeft());
rightMargin.SetRight(aParaMargin.GetRight(), aParaMargin.GetPropRight());
diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx
index c8ac640ad940..6846e101de8a 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -772,8 +772,7 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
SvxTextLeftMarginItem const& rLeftMargin(aCoreSet.Get(RES_MARGIN_TEXTLEFT));
SvxRightMarginItem const& rRightMargin(aCoreSet.Get(RES_MARGIN_RIGHT));
- // tdf#36709: TODO: Handle font-relative units
- aLR.SetTextFirstLineOffset(rFirstLine.ResolveTextFirstLineOffset({}),
+ aLR.SetTextFirstLineOffset(rFirstLine.GetTextFirstLineOffset(),
rFirstLine.GetPropTextFirstLineOffset());
aLR.SetAutoFirst(rFirstLine.IsAutoFirst());
aLR.SetTextLeft(rLeftMargin.GetTextLeft(), rLeftMargin.GetPropLeft());
diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
index 627dad0b406c..12d16bca5d26 100644
--- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
+++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
@@ -120,7 +120,7 @@ IMPL_LINK(WrapPropertyPanel, SpacingLBHdl, weld::ComboBox&, rBox, void)
{
sal_uInt16 nVal = rBox.get_active_id().toUInt32();
- SvxLRSpaceItem aLRItem(nVal, nVal, 0, RES_LR_SPACE);
+ SvxLRSpaceItem aLRItem(nVal, nVal, SvxIndentValue::zero(), RES_LR_SPACE);
SvxULSpaceItem aULItem(nVal, nVal, RES_UL_SPACE);
m_nTop = m_nBottom = m_nLeft = m_nRight = nVal;
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 9386cccb6638..4302a5439f9b 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -705,8 +705,8 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
{
SvxFirstLineIndentItem firstLine(aLRSpaceSet.Get(RES_MARGIN_FIRSTLINE));
const OUString ratio = fLineIndent->GetValue();
- firstLine.SetTextFirstLineOffset(nPageWidth * ratio.toFloat(),
- css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(
+ SvxIndentValue::twips(nPageWidth * ratio.toFloat()));
rSh.SetAttrItem(firstLine);
}
else if (const SfxStringItem *pLeftIndent = pReqArgs->GetItemIfSet(SID_PARAGRAPH_LEFT_INDENT))
@@ -744,7 +744,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
}
leftMargin.SetTextLeft(leftMargin.GetTextLeft() + nIndentDist);
- firstLine.SetTextFirstLineOffset(nIndentDist * -1, css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::twips(nIndentDist * -1));
firstLine.SetAutoFirst(false); // old code would do this, is it wanted?
rSh.SetAttrItem(firstLine);
@@ -765,7 +765,8 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
SwTextFormatColl* pColl = rSh.GetCurTextFormatColl();
SvxFirstLineIndentItem firstLine(RES_MARGIN_FIRSTLINE);
- firstLine.SetTextFirstLineOffset(aParaMargin.GetTextFirstLineOffset(), aParaMargin.GetPropTextFirstLineOffset());
+ firstLine.SetTextFirstLineOffset(aParaMargin.GetTextFirstLineOffset(),
+ aParaMargin.GetPropTextFirstLineOffset());
firstLine.SetAutoFirst(aParaMargin.IsAutoFirst());
SvxTextLeftMarginItem const leftMargin(aParaMargin.GetTextLeft(), RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(aParaMargin.GetRight(), RES_MARGIN_RIGHT);
@@ -801,7 +802,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
rSh.SetAttrItem(rightMargin);
}
- if ( aParaMargin.GetTextFirstLineOffset() < 0 )
+ if (aParaMargin.GetTextFirstLineOffsetValue() < 0.0)
{
SfxItemSetFixed<RES_PARATR_TABSTOP, RES_PARATR_TABSTOP> aSet( GetPool() );
@@ -1673,8 +1674,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
SvxTextLeftMarginItem const& rLeftMargin(aCoreSet.Get(RES_MARGIN_TEXTLEFT));
SvxRightMarginItem const& rRightMargin(aCoreSet.Get(RES_MARGIN_RIGHT));
- // tdf#36709: TODO: Handle font-relative first-line indentation
- aLR->SetTextFirstLineOffset(rFirstLine.ResolveTextFirstLineOffset({}),
+ aLR->SetTextFirstLineOffset(rFirstLine.GetTextFirstLineOffset(),
rFirstLine.GetPropTextFirstLineOffset());
aLR->SetAutoFirst(rFirstLine.IsAutoFirst());
aLR->SetTextLeft(rLeftMargin.GetTextLeft(), rLeftMargin.GetPropLeft());
diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx
index 79172e8a6819..3d3d7624f196 100644
--- a/sw/source/uibase/wrtsh/delete.cxx
+++ b/sw/source/uibase/wrtsh/delete.cxx
@@ -74,13 +74,13 @@ bool SwWrtShell::TryRemoveIndent()
if (aOldFirstLineOfst > 0)
{
- firstLine.SetTextFirstLineOffset(0.0, css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::zero());
bResult = true;
}
else if (aOldFirstLineOfst < 0)
{
// this used to call SetLeft() but this should be the same result
- firstLine.SetTextFirstLineOffset(0.0, css::util::MeasureUnit::TWIP);
+ firstLine.SetTextFirstLineOffset(SvxIndentValue::zero());
leftMargin.SetTextLeft(leftMargin.GetTextLeft() + aOldFirstLineOfst);
bResult = true;
}
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt b/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt
index 9aa29be8086b..d7dc9310b2b0 100644
--- a/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt
+++ b/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
- <office:meta><meta:creation-date>2024-10-31T13:46:50.189497642</meta:creation-date><meta:generator>LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/5f12ad737bbb930b76299df0433c8635ae27a7bd</meta:generator><dc:date>2024-10-31T13:49:19.200988598</dc:date><meta:editing-duration>PT2M30S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="8" meta:word-count="32" meta:character-count="144" meta:non-whitespace-character-count="120"/></office:meta>
+ <office:meta><meta:creation-date>2024-10-31T13:46:50.189497642</meta:creation-date><meta:generator>LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/372a9f642e1268a1888f6a85d42da0499e1f8516</meta:generator><dc:date>2024-11-08T04:00:30.046342730</dc:date><meta:editing-duration>PT4M32S</meta:editing-duration><meta:editing-cycles>3</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="8" meta:word-count="32" meta:character-count="144" meta:non-whitespace-character-count="120"/></office:meta>
<office:font-face-decls>
<style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Noto Sans1" svg:font-family="'Noto Sans'" style:font-family-generic="system" style:font-pitch="variable"/>
@@ -8,8 +8,8 @@
</office:font-face-decls>
<office:styles>
<style:default-style style:family="graphic">
- <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
- <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0in" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:writing-mode="lr-tb" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0in" style:font-independent-line-spacing="false">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
@@ -26,52 +26,52 @@
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text"/>
<text:outline-style style:name="Outline">
- <text:outline-level-style text:level="1" style:num-format="">
+ <text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="2" style:num-format="">
+ <text:outline-level-style text:level="2" loext:num-list-format="%2%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="3" style:num-format="">
+ <text:outline-level-style text:level="3" loext:num-list-format="%3%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="4" style:num-format="">
+ <text:outline-level-style text:level="4" loext:num-list-format="%4%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="5" style:num-format="">
+ <text:outline-level-style text:level="5" loext:num-list-format="%5%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="6" style:num-format="">
+ <text:outline-level-style text:level="6" loext:num-list-format="%6%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="7" style:num-format="">
+ <text:outline-level-style text:level="7" loext:num-list-format="%7%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="8" style:num-format="">
+ <text:outline-level-style text:level="8" loext:num-list-format="%8%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="9" style:num-format="">
+ <text:outline-level-style text:level="9" loext:num-list-format="%9%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
- <text:outline-level-style text:level="10" style:num-format="">
+ <text:outline-level-style text:level="10" loext:num-list-format="%10%" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
@@ -103,30 +103,67 @@
</style:style>
<style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/>
- <style:text-properties/>
- </style:style>
- <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Standard">
- <style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/>
<style:text-properties fo:font-size="16pt" style:font-size-asian="16pt" style:font-size-complex="16pt"/>
</style:style>
- <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard">
+ <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/>
<style:text-properties fo:font-size="20pt" style:font-size-asian="20pt" style:font-size-complex="20pt"/>
</style:style>
- <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard">
+ <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/>
<style:text-properties fo:font-size="24pt" style:font-size-asian="24pt" style:font-size-complex="24pt"/>
</style:style>
+ <style:style style:name="P9" style:family="paragraph">
+ <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/>
+ </style:style>
+ <style:style style:name="P10" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="1em"/>
+ <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/>
+ </style:style>
+ <style:style style:name="P11" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/>
+ <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/>
+ </style:style>
+ <style:style style:name="P12" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="3em"/>
+ <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/>
+ </style:style>
+ <style:style style:name="P13" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/>
+ <style:text-properties style:font-name="Liberation Serif" fo:font-size="16pt" style:font-size-complex="16pt"/>
+ </style:style>
+ <style:style style:name="P14" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/>
+ <style:text-properties style:font-name="Liberation Serif" fo:font-size="20pt" style:font-size-complex="20pt"/>
+ </style:style>
+ <style:style style:name="P15" style:family="paragraph">
+ <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/>
+ <style:text-properties style:font-name="Liberation Serif" fo:font-size="24pt" style:font-size-complex="24pt"/>
+ </style:style>
+ <style:style style:name="P16" style:family="paragraph">
+ <loext:graphic-properties draw:fill="none" draw:fill-color="#ffffff"/>
+ <style:text-properties style:font-name="Liberation Serif"/>
+ </style:style>
+ <style:style style:name="T1" style:family="text">
+ <style:text-properties style:font-name="Liberation Serif"/>
+ </style:style>
+ <style:style style:name="gr1" style:family="graphic">
+ <style:graphic-properties draw:stroke="none" svg:stroke-color="#000000" draw:fill="none" draw:fill-color="#ffffff" fo:min-height="3.7945in" loext:decorative="false" style:run-through="foreground" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph"/>
+ <style:paragraph-properties style:writing-mode="lr-tb"/>
+ </style:style>
<style:page-layout style:name="pm1">
- <style:page-layout-properties fo:page-width="8.2681in" fo:page-height="11.6929in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in" loext:margin-gutter="0in">
+ <style:page-layout-properties fo:page-width="8.2681in" fo:page-height="11.6929in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.278in" style:layout-grid-ruby-height="0.139in" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0in" loext:margin-gutter="0in">
<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
+ <style:style style:name="dp1" style:family="drawing-page">
+ <style:drawing-page-properties draw:background-size="full"/>
+ </style:style>
</office:automatic-styles>
<office:master-styles>
- <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/>
</office:master-styles>
<office:body>
<office:text>
@@ -142,10 +179,22 @@
<text:p text:style-name="P3">2 em constant size</text:p>
<text:p text:style-name="P4">3 em constant size</text:p>
<text:p text:style-name="P5"/>
+ <text:p text:style-name="P3">2 em variable size</text:p>
<text:p text:style-name="P6">2 em variable size</text:p>
<text:p text:style-name="P7">2 em variable size</text:p>
- <text:p text:style-name="P8">2 em variable size</text:p>
- <text:p text:style-name="P9">2 em variable size</text:p>
+ <text:p text:style-name="P8"><draw:frame text:anchor-type="paragraph" draw:z-index="0" draw:name="Text Frame 1" draw:style-name="gr1" draw:text-style-name="P16" svg:width="6.4587in" svg:height="3.7949in" svg:x="0.0689in" svg:y="0.5937in">
+ <draw:text-box>
+ <text:p text:style-name="P9"><text:span text:style-name="T1">0 em constant size</text:span></text:p>
+ <text:p text:style-name="P10"><text:span text:style-name="T1">1 em constant size</text:span></text:p>
+ <text:p text:style-name="P11"><text:span text:style-name="T1">2 em constant size</text:span></text:p>
+ <text:p text:style-name="P12"><text:span text:style-name="T1">3 em constant size</text:span></text:p>
+ <text:p text:style-name="P9"><text:span text:style-name="T1"/></text:p>
+ <text:p text:style-name="P11"><text:span text:style-name="T1">2 em variable size</text:span></text:p>
+ <text:p text:style-name="P13"><text:span text:style-name="T1">2 em variable size</text:span></text:p>
+ <text:p text:style-name="P14"><text:span text:style-name="T1">2 em variable size</text:span></text:p>
+ <text:p text:style-name="P15"><text:span text:style-name="T1">2 em variable size</text:span></text:p>
+ </draw:text-box>
+ </draw:frame>2 em variable size</text:p>
</office:text>
</office:body>
</office:document> \ No newline at end of file
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
index 4bd91576bfec..ed035f6f8fb9 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
@@ -5836,7 +5836,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf36709FirstLineIndentEm)
int nPageObjectCount = pPdfPage->getObjectCount();
- CPPUNIT_ASSERT_EQUAL(8, nPageObjectCount);
+ CPPUNIT_ASSERT_EQUAL(16, nPageObjectCount);
std::vector<OUString> aText;
std::vector<basegfx::B2DRectangle> aRect;
@@ -5852,8 +5852,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf36709FirstLineIndentEm)
}
}
- CPPUNIT_ASSERT_EQUAL(size_t(8), aText.size());
+ CPPUNIT_ASSERT_EQUAL(size_t(16), aText.size());
+ // Lines from the Writer portion
CPPUNIT_ASSERT_EQUAL(u"0 em constant size"_ustr, aText.at(0).trim());
CPPUNIT_ASSERT_DOUBLES_EQUAL(57.256, aRect.at(0).getMinX(), /*delta*/ 2.0);
CPPUNIT_ASSERT_EQUAL(u"1 em constant size"_ustr, aText.at(1).trim());
@@ -5871,6 +5872,25 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf36709FirstLineIndentEm)
CPPUNIT_ASSERT_DOUBLES_EQUAL(97.680, aRect.at(6).getMinX(), /*delta*/ 2.0);
CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(7).trim());
CPPUNIT_ASSERT_DOUBLES_EQUAL(105.856, aRect.at(7).getMinX(), /*delta*/ 2.0);
+
+ // Lines from the Edit Engine portion
+ CPPUNIT_ASSERT_EQUAL(u"0 em constant size"_ustr, aText.at(8).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(62.106, aRect.at(8).getMinX(), /*delta*/ 2.0);
+ CPPUNIT_ASSERT_EQUAL(u"1 em constant size"_ustr, aText.at(9).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(76.010, aRect.at(9).getMinX(), /*delta*/ 2.0);
+ CPPUNIT_ASSERT_EQUAL(u"2 em constant size"_ustr, aText.at(10).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(88.778, aRect.at(10).getMinX(), /*delta*/ 2.0);
+ CPPUNIT_ASSERT_EQUAL(u"3 em constant size"_ustr, aText.at(11).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(102.126, aRect.at(11).getMinX(), /*delta*/ 2.0);
+
+ CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(12).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(88.778, aRect.at(12).getMinX(), /*delta*/ 2.0);
+ CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(13).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(97.754, aRect.at(13).getMinX(), /*delta*/ 2.0);
+ CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(14).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(106.830, aRect.at(14).getMinX(), /*delta*/ 2.0);
+ CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(15).trim());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(115.906, aRect.at(15).getMinX(), /*delta*/ 2.0);
}
} // end anonymous namespace