tdf#163913 Implement font-relative margins

This change adds loext:margin-left and loext:margin-right, which
implement margins that support font-relative units.

See tdf#36709 for additional details.

Change-Id: I31b0dd2b6f98cb5b02fd4dca3608db6fdee4054c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177473
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
This commit is contained in:
Jonathan Clark 2024-11-18 10:03:13 -07:00
parent c73e52d295
commit 7e4f4a0ccd
135 changed files with 1990 additions and 1142 deletions

View file

@ -336,13 +336,13 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
if ( pItem )
{
const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
SetMetricValue( *m_xLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
SetMetricValue(*m_xLeftMarginEdit, rLRSpace.ResolveLeft({}), eUnit);
SetMetricValue(*m_xGutterMarginEdit, rLRSpace.GetGutterMargin(), eUnit);
m_aBspWin.SetLeft(
static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetLeft(), eUnit )) );
SetMetricValue( *m_xRightMarginEdit, rLRSpace.GetRight(), eUnit );
static_cast<sal_uInt16>(ConvertLong_Impl(rLRSpace.ResolveLeft({}), eUnit)));
SetMetricValue(*m_xRightMarginEdit, rLRSpace.ResolveRight({}), eUnit);
m_aBspWin.SetRight(
static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetRight(), eUnit )) );
static_cast<sal_uInt16>(ConvertLong_Impl(rLRSpace.ResolveRight({}), eUnit)));
}
// adjust margins (top/bottom)
@ -633,13 +633,15 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
if (m_xLeftMarginEdit->get_value_changed_from_saved())
{
aMargin.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_xLeftMarginEdit, eUnit )) );
aMargin.SetLeft(SvxIndentValue::twips(
static_cast<sal_uInt16>(GetCoreValue(*m_xLeftMarginEdit, eUnit))));
bModified = true;
}
if (m_xRightMarginEdit->get_value_changed_from_saved())
{
aMargin.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_xRightMarginEdit, eUnit )) );
aMargin.SetRight(SvxIndentValue::twips(
static_cast<sal_uInt16>(GetCoreValue(*m_xRightMarginEdit, eUnit))));
bModified = true;
}
@ -1254,8 +1256,8 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
m_aBspWin.SetHdDist( nDist );
const SvxLRSpaceItem& rLR =
rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
m_aBspWin.SetHdLeft( rLR.GetLeft() );
m_aBspWin.SetHdRight( rLR.GetRight() );
m_aBspWin.SetHdLeft(rLR.ResolveLeft({}));
m_aBspWin.SetHdRight(rLR.ResolveRight({}));
m_aBspWin.SetHeader( true );
}
else
@ -1309,8 +1311,8 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
m_aBspWin.SetFtDist( nDist );
const SvxLRSpaceItem& rLR =
rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
m_aBspWin.SetFtLeft( rLR.GetLeft() );
m_aBspWin.SetFtRight( rLR.GetRight() );
m_aBspWin.SetFtLeft(rLR.ResolveLeft({}));
m_aBspWin.SetFtRight(rLR.ResolveRight({}));
m_aBspWin.SetFooter( true );
}
else

View file

@ -381,12 +381,12 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
else
{
item.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
item.SetTextLeft(lcl_GetFontRelativeValue(m_aLeftIndent, eUnit));
}
}
else
{
item.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
item.SetTextLeft(lcl_GetFontRelativeValue(m_aLeftIndent, eUnit));
}
if (!pOld || *static_cast<const SvxTextLeftMarginItem*>(pOld) != item
|| SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
@ -417,12 +417,12 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
else
{
item.SetRight(m_aRightIndent.GetCoreValue(eUnit));
item.SetRight(lcl_GetFontRelativeValue(m_aRightIndent, eUnit));
}
}
else
{
item.SetRight(m_aRightIndent.GetCoreValue(eUnit));
item.SetRight(lcl_GetFontRelativeValue(m_aRightIndent, eUnit));
}
if (!pOld || *static_cast<const SvxRightMarginItem*>(pOld) != item
|| SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
@ -463,7 +463,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
item.SetTextFirstLineOffset(lcl_GetFontRelativeValue(m_aFLineIndent, eUnit));
}
item.SetAutoFirst(m_xAutoCB->get_active());
if (item.GetTextFirstLineOffsetValue() < 0)
if (item.GetTextFirstLineOffset().m_dValue < 0.0)
{
bNullTab = true;
}
@ -498,13 +498,13 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
aMargin.SetTextLeft( rOldItem.GetTextLeft(),
static_cast<sal_uInt16>(m_aLeftIndent.get_value(FieldUnit::NONE)) );
else
aMargin.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
aMargin.SetTextLeft(lcl_GetFontRelativeValue(m_aLeftIndent, eUnit));
if ( m_aRightIndent.IsRelative() )
aMargin.SetRight( rOldItem.GetRight(),
static_cast<sal_uInt16>(m_aRightIndent.get_value(FieldUnit::NONE)) );
else
aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
aMargin.SetRight(lcl_GetFontRelativeValue(m_aRightIndent, eUnit));
if ( m_aFLineIndent.IsRelative() )
aMargin.SetTextFirstLineOffset(
@ -517,12 +517,12 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
else
{
aMargin.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
aMargin.SetTextLeft(lcl_GetFontRelativeValue(m_aLeftIndent, eUnit));
aMargin.SetRight(lcl_GetFontRelativeValue(m_aRightIndent, eUnit));
aMargin.SetTextFirstLineOffset(lcl_GetFontRelativeValue(m_aFLineIndent, eUnit));
}
aMargin.SetAutoFirst(m_xAutoCB->get_active());
if ( aMargin.GetTextFirstLineOffsetValue() < 0.0 )
if (aMargin.GetTextFirstLineOffset().m_dValue < 0.0)
bNullTab = true;
if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin ||
@ -642,12 +642,12 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
{
m_aLeftIndent.SetRelative(false);
m_aLeftIndent.SetFieldUnit(eFUnit);
m_aLeftIndent.SetMetricValue(rOldLeftMargin.GetTextLeft(), eUnit);
lcl_SetFontRelativeValue(m_aLeftIndent, rOldLeftMargin.GetTextLeft(), eUnit);
}
}
else
{
m_aLeftIndent.SetMetricValue(rOldLeftMargin.GetTextLeft(), eUnit);
lcl_SetFontRelativeValue(m_aLeftIndent, rOldLeftMargin.GetTextLeft(), eUnit);
}
}
else if (m_bSplitLRSpace)
@ -673,12 +673,12 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
{
m_aRightIndent.SetRelative(false);
m_aRightIndent.SetFieldUnit(eFUnit);
m_aRightIndent.SetMetricValue(rOldRightMargin.GetRight(), eUnit);
lcl_SetFontRelativeValue(m_aRightIndent, rOldRightMargin.GetRight(), eUnit);
}
}
else
{
m_aRightIndent.SetMetricValue(rOldRightMargin.GetRight(), eUnit);
lcl_SetFontRelativeValue(m_aRightIndent, rOldRightMargin.GetRight(), eUnit);
}
}
else if (m_bSplitLRSpace)
@ -743,7 +743,7 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
{
m_aLeftIndent.SetRelative(false);
m_aLeftIndent.SetFieldUnit(eFUnit);
m_aLeftIndent.SetMetricValue(rOldItem.GetTextLeft(), eUnit);
lcl_SetFontRelativeValue(m_aLeftIndent, rOldItem.GetTextLeft(), eUnit);
}
if ( rOldItem.GetPropRight() != 100 )
@ -755,7 +755,7 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
{
m_aRightIndent.SetRelative(false);
m_aRightIndent.SetFieldUnit(eFUnit);
m_aRightIndent.SetMetricValue(rOldItem.GetRight(), eUnit);
lcl_SetFontRelativeValue(m_aRightIndent, rOldItem.GetRight(), eUnit);
}
if ( rOldItem.GetPropTextFirstLineOffset() != 100 )
@ -777,8 +777,8 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
const SvxLRSpaceItem& rSpace =
static_cast<const SvxLRSpaceItem&>(rSet->Get( _nWhich ));
m_aLeftIndent.SetMetricValue(rSpace.GetTextLeft(), eUnit);
m_aRightIndent.SetMetricValue(rSpace.GetRight(), eUnit);
lcl_SetFontRelativeValue(m_aLeftIndent, rSpace.GetTextLeft(), eUnit);
lcl_SetFontRelativeValue(m_aRightIndent, rSpace.GetRight(), eUnit);
lcl_SetFontRelativeValue(m_aFLineIndent, rSpace.GetTextFirstLineOffset(), eUnit);
m_xAutoCB->set_active(rSpace.IsAutoFirst());
}
@ -979,6 +979,9 @@ SvxStdParagraphTabPage::SvxStdParagraphTabPage(weld::Container* pPage, weld::Dia
Init_Impl();
m_aFLineIndent.set_min(-9999, FieldUnit::NONE); // is set to 0 on default
m_aFLineIndent.EnableFontRelativeMode();
m_aLeftIndent.EnableFontRelativeMode();
m_aRightIndent.EnableFontRelativeMode();
}
SvxStdParagraphTabPage::~SvxStdParagraphTabPage()

View file

@ -177,7 +177,8 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet)
pLRSpace = GetOldItem(*rSet, SID_ATTR_LRSPACE);
if (pLRSpace
&& static_cast<const SvxLRSpaceItem*>(pLRSpace)->GetTextFirstLineOffsetValue() < 0.0)
&& static_cast<const SvxLRSpaceItem*>(pLRSpace)->GetTextFirstLineOffset().m_dValue
< 0.0)
{
SvxTabStop aNull(0, SvxTabAdjust::Default);
aNewTabs->Insert(aNull);

View file

@ -71,8 +71,8 @@ struct DebOutBuffer
{
str.append(OString::Concat(descr)
+ "FI=" + OString::number(rItem.ResolveTextFirstLineOffset({}))
+ ", LI=" + OString::number(rItem.GetTextLeft())
+ ", RI=" + OString::number(rItem.GetRight()));
+ ", LI=" + OString::number(rItem.ResolveTextLeft({}))
+ ", RI=" + OString::number(rItem.ResolveRight({})));
}
void append(std::string_view descr, const SvxNumBulletItem& rItem)
{

View file

@ -574,14 +574,19 @@ void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit,
{
assert(dynamic_cast<const SvxLRSpaceItem *>(rPoolItem.get()) != nullptr);
SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(*rPoolItem);
if (rItem.GetTextFirstLineOffsetUnit() == css::util::MeasureUnit::TWIP)
if (rItem.GetTextFirstLineOffset().m_nUnit == 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 ) );
rItem.SetTextLeft(SvxIndentValue::twips(
OutputDevice::LogicToLogic(rItem.ResolveTextLeft({}), eSourceUnit, eDestUnit)));
if (rItem.GetRight().m_nUnit == css::util::MeasureUnit::TWIP)
{
rItem.SetRight(SvxIndentValue::twips(
OutputDevice::LogicToLogic(rItem.ResolveRight({}), eSourceUnit, eDestUnit)));
}
}
break;
case EE_PARA_ULSPACE:

View file

@ -686,7 +686,8 @@ private:
EditPaM RemoveText();
bool createLinesForEmptyParagraph(ParaPortion& rParaPortion);
tools::Long calculateMaxLineWidth(tools::Long nStartX, SvxLRSpaceItem const& rLRItem);
tools::Long calculateMaxLineWidth(tools::Long nStartX, SvxLRSpaceItem const& rLRItem,
const SvxFontUnitMetrics& rMetrics);
bool CreateLines(sal_Int32 nPara, sal_uInt32 nStartPosY);
void CreateAndInsertEmptyLine(ParaPortion& rParaPortion);

View file

@ -3473,7 +3473,8 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace
// width, here not preferred. I general, it is best not leave it
// to StartPosX, also the right indents have to be taken into
// account!
tools::Long nCurWidth = scaleXSpacingValue(rLRItem.GetTextLeft() + nSpaceBeforeAndMinLabelWidth);
tools::Long nCurWidth
= scaleXSpacingValue(rLRItem.ResolveTextLeft({}) + nSpaceBeforeAndMinLabelWidth);
if ( nLine == 0 )
{
tools::Long nFI = scaleXSpacingValue(rLRItem.ResolveTextFirstLineOffset(stMetrics));
@ -3485,7 +3486,7 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace
nCurWidth = pPortion->GetBulletX();
}
}
nCurWidth += scaleXSpacingValue(rLRItem.GetRight());
nCurWidth += scaleXSpacingValue(rLRItem.ResolveRight({}));
nCurWidth += CalcLineWidth(*pPortion, rLine, bIgnoreExtraSpace);
if ( nCurWidth > nMaxWidth )
{
@ -3800,7 +3801,7 @@ Point ImpEditEngine::GetDocPosTopLeft( sal_Int32 nParagraph )
const SvxLRSpaceItem& rLRItem = GetLRSpaceItem(pPPortion->GetNode());
sal_Int32 nSpaceBefore = 0;
GetSpaceBeforeAndMinLabelWidth(pPPortion->GetNode(), &nSpaceBefore);
short nX = static_cast<short>(rLRItem.GetTextLeft()
short nX = static_cast<short>(rLRItem.ResolveTextLeft(stMetrics)
+ rLRItem.ResolveTextFirstLineOffset(stMetrics)
+ nSpaceBefore);

View file

@ -605,18 +605,20 @@ bool ImpEditEngine::createLinesForEmptyParagraph(ParaPortion& rParaPortion)
return FinishCreateLines(rParaPortion);
}
tools::Long ImpEditEngine::calculateMaxLineWidth(tools::Long nStartX, SvxLRSpaceItem const& rLRItem)
tools::Long ImpEditEngine::calculateMaxLineWidth(tools::Long nStartX, SvxLRSpaceItem const& rLRItem,
const SvxFontUnitMetrics& rMetrics)
{
const bool bAutoSize = IsEffectivelyVertical() ? maStatus.AutoPageHeight() : maStatus.AutoPageWidth();
tools::Long nMaxLineWidth = GetColumnWidth(bAutoSize ? maMaxAutoPaperSize : maPaperSize);
nMaxLineWidth -= scaleXSpacingValue(rLRItem.GetRight());
nMaxLineWidth -= scaleXSpacingValue(rLRItem.ResolveRight(rMetrics));
nMaxLineWidth -= nStartX;
// If PaperSize == long_max, one cannot take away any negative
// first line indent. (Overflow)
if (nMaxLineWidth < 0 && nStartX < 0)
nMaxLineWidth = GetColumnWidth(maPaperSize) - scaleXSpacingValue(rLRItem.GetRight());
nMaxLineWidth
= GetColumnWidth(maPaperSize) - scaleXSpacingValue(rLRItem.ResolveRight(rMetrics));
// If still less than 0, it may be just the right edge.
if (nMaxLineWidth <= 0)
@ -810,12 +812,13 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
sal_Int32 nPortionStart = 0;
sal_Int32 nPortionEnd = 0;
tools::Long nStartX = scaleXSpacingValue(rLRItem.GetTextLeft() + nSpaceBeforeAndMinLabelWidth);
auto stMetrics = GetFontUnitMetrics(pNode);
tools::Long nStartX
= scaleXSpacingValue(rLRItem.ResolveTextLeft(stMetrics) + nSpaceBeforeAndMinLabelWidth);
// Multiline hyperlink may need to know if the next line is bigger.
tools::Long nStartXNextLine = nStartX;
if ( nIndex == 0 )
{
auto stMetrics = GetFontUnitMetrics(pNode);
tools::Long nFI = scaleXSpacingValue(rLRItem.ResolveTextFirstLineOffset(stMetrics));
nStartX += nFI;
@ -827,7 +830,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
nStartX += nStartNextLineAfterMultiLineField;
nStartNextLineAfterMultiLineField = 0;
tools::Long nMaxLineWidth = calculateMaxLineWidth(nStartX, rLRItem);
tools::Long nMaxLineWidth = calculateMaxLineWidth(nStartX, rLRItem, stMetrics);
// Problem:
// Since formatting starts a line _before_ the invalid position,
@ -906,7 +909,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
}
nXWidth = nMaxRangeWidth;
if (nXWidth)
nMaxLineWidth = nXWidth - nStartX - scaleXSpacingValue(rLRItem.GetRight());
nMaxLineWidth
= nXWidth - nStartX - scaleXSpacingValue(rLRItem.ResolveRight(stMetrics));
else
{
// Try further down in the polygon.
@ -1002,7 +1006,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
if (maStatus.DoStretch() && (fFontScalingX != 1.0))
nCurPos = basegfx::fround<tools::Long>(double(nCurPos) / std::max(fFontScalingX, 0.01));
short nAllSpaceBeforeText = short(rLRItem.GetTextLeft());
short nAllSpaceBeforeText = short(rLRItem.ResolveTextLeft({}));
aCurrentTab.aTabStop = pNode->GetContentAttribs().FindTabStop( nCurPos - nAllSpaceBeforeText , maEditDoc.GetDefTab() );
aCurrentTab.nTabPos = tools::Long(aCurrentTab.aTabStop.GetTabPos() + nAllSpaceBeforeText);
aCurrentTab.bValid = false;
@ -1575,7 +1579,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
// has to be used for the Alignment. If it does not fit or if it
// will change the paper width, it will be formatted again for
// Justification! = LEFT anyway.
tools::Long nMaxLineWidthFix = GetColumnWidth(maPaperSize) - scaleXSpacingValue(rLRItem.GetRight()) - nStartX;
tools::Long nMaxLineWidthFix = GetColumnWidth(maPaperSize)
- scaleXSpacingValue(rLRItem.ResolveRight(stMetrics))
- nStartX;
if ( aTextSize.Width() < nMaxLineWidthFix )
nMaxLineWidth = nMaxLineWidthFix;
}
@ -1799,13 +1805,14 @@ void ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion& rParaPortion)
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.ResolveTextFirstLineOffset(stMetrics) + nSpaceBefore);
tools::Long nStartX
= scaleXSpacingValue(rLRItem.ResolveTextLeft(stMetrics)
+ rLRItem.ResolveTextFirstLineOffset(stMetrics) + nSpaceBefore);
tools::Rectangle aBulletArea { Point(), Point() };
if ( bLineBreak )
{
nStartX = scaleXSpacingValue(rLRItem.GetTextLeft()
nStartX = scaleXSpacingValue(rLRItem.ResolveTextLeft(stMetrics)
+ rLRItem.ResolveTextFirstLineOffset(stMetrics)
+ nSpaceBeforeAndMinLabelWidth);
}
@ -1818,7 +1825,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion& rParaPortion)
rParaPortion.SetBulletX( 0 ); // If Bullet set incorrectly.
if (rParaPortion.GetBulletX() > nStartX)
{
nStartX = scaleXSpacingValue(rLRItem.GetTextLeft()
nStartX = scaleXSpacingValue(rLRItem.ResolveTextLeft(stMetrics)
+ rLRItem.ResolveTextFirstLineOffset(stMetrics)
+ nSpaceBeforeAndMinLabelWidth);
if (rParaPortion.GetBulletX() > nStartX)
@ -1848,7 +1855,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion& rParaPortion)
sal_Int32 nPara = GetParaPortions().GetPos(&rParaPortion);
SvxAdjust eJustification = GetJustification( nPara );
tools::Long nMaxLineWidth = GetColumnWidth(maPaperSize);
nMaxLineWidth -= scaleXSpacingValue(rLRItem.GetRight());
nMaxLineWidth -= scaleXSpacingValue(rLRItem.ResolveRight(stMetrics));
if ( nMaxLineWidth < 0 )
nMaxLineWidth = 1;
if ( eJustification == SvxAdjust::Center )

View file

@ -780,11 +780,11 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput,
nTxtFirst = LogicToTwips( nTxtFirst );
rOutput.WriteNumberAsString( nTxtFirst );
rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_LI );
sal_uInt32 nTxtLeft = static_cast< sal_uInt32 >(static_cast<const SvxLRSpaceItem&>(rItem).GetTextLeft());
sal_uInt32 nTxtLeft = static_cast<const SvxLRSpaceItem&>(rItem).ResolveTextLeft({});
nTxtLeft = static_cast<sal_uInt32>(LogicToTwips( nTxtLeft ));
rOutput.WriteNumberAsString( nTxtLeft );
rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_RI );
sal_uInt32 nTxtRight = static_cast<const SvxLRSpaceItem&>(rItem).GetRight();
sal_uInt32 nTxtRight = static_cast<const SvxLRSpaceItem&>(rItem).ResolveRight({});
nTxtRight = LogicToTwips( nTxtRight);
rOutput.WriteNumberAsString( nTxtRight );
}

File diff suppressed because it is too large Load diff

View file

@ -1492,7 +1492,7 @@ 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.ResolveTextFirstLineOffset({}) + nSpaceBefore);
aTopLeft.setX(rLR.ResolveTextLeft({}) + rLR.ResolveTextFirstLineOffset({}) + nSpaceBefore);
tools::Long nBulletWidth = std::max(
static_cast<tools::Long>(-rLR.ResolveTextFirstLineOffset({})),

View file

@ -342,7 +342,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
CalcValue();
nSz = sal_uInt16(nTokenValue);
}
aLR.SetTextLeft( nSz );
aLR.SetTextLeft(SvxIndentValue::twips(nSz));
pSet->Put( aLR );
}
break;
@ -359,7 +359,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
CalcValue();
nSz = sal_uInt16(nTokenValue);
}
aLR.SetRight( nSz );
aLR.SetRight(SvxIndentValue::twips(nSz));
pSet->Put( aLR );
}
break;

View file

@ -6187,7 +6187,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, std::optional< sal_Int16 >& rS
auto const nAbsLSpace = convertMasterUnitToMm100(_nTextOfs);
auto const nFirstLineOffset = nAbsLSpace - convertMasterUnitToMm100(_nBulletOfs);
aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(-nFirstLineOffset));
aLRSpaceItem.SetTextLeft( nAbsLSpace );
aLRSpaceItem.SetTextLeft(SvxIndentValue::twips(nAbsLSpace));
}
rSet.Put( aLRSpaceItem );

View file

@ -79,6 +79,16 @@ struct SvxIndentValue
static SvxIndentValue twips(double dValue) { return { dValue, css::util::MeasureUnit::TWIP }; }
static SvxIndentValue zero() { return twips(0.0); }
double ResolveDouble(const SvxFontUnitMetrics& rMetrics) const;
sal_Int32 Resolve(const SvxFontUnitMetrics& rMetrics) const;
sal_Int32 ResolveFixedPart() const;
sal_Int32 ResolveVariablePart(const SvxFontUnitMetrics& rMetrics) const;
void ScaleMetrics(tools::Long nMult, tools::Long nDiv);
size_t hashCode() const;
bool operator==(SvxIndentValue const&) const = default;
};
/// GetLeft() - for everything that's not applied to a paragraph
@ -127,22 +137,24 @@ class EDITENG_DLLPUBLIC SvxTextLeftMarginItem final : public SfxPoolItem
private:
friend class SvxFirstLineIndentItem;
/// left margin including negative first-line indent
tools::Long m_nTextLeftMargin = 0;
SvxIndentValue m_stTextLeftMargin = SvxIndentValue::zero();
sal_uInt16 m_nPropLeftMargin = 100;
public:
//TODO: need this?
//void SetLeft(SvxFirstLineIndentItem const& rFirstLine, const tools::Long nL, const sal_uInt16 nProp = 100);
/// get left margin without negative first-line indent
tools::Long GetLeft(const SvxFirstLineIndentItem& rFirstLine,
sal_Int32 ResolveLeft(const SvxFirstLineIndentItem& rFirstLine,
const SvxFontUnitMetrics& rMetrics) const;
sal_uInt16 GetPropLeft() const { return m_nPropLeftMargin; }
sal_Int32 ResolveLeftFixedPart(const SvxFirstLineIndentItem& rFirstLine) const;
sal_Int32 ResolveLeftVariablePart(const SvxFirstLineIndentItem& rFirstLine,
const SvxFontUnitMetrics& rMetrics) const;
sal_uInt16 GetPropLeft() const;
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp = 100);
tools::Long GetTextLeft() const;
void SetTextLeft(SvxIndentValue stL, const sal_uInt16 nProp = 100);
sal_Int32 ResolveTextLeft(const SvxFontUnitMetrics& rMetrics) const;
SvxIndentValue GetTextLeft() const;
explicit SvxTextLeftMarginItem(const sal_uInt16 nId);
SvxTextLeftMarginItem(const tools::Long nLeft, const sal_uInt16 nId);
SvxTextLeftMarginItem(SvxIndentValue stLeft, const sal_uInt16 nId);
SvxTextLeftMarginItem(SvxTextLeftMarginItem const &) = default; // SfxPoolItem copy function dichotomy
// "pure virtual Methods" from SfxPoolItem
@ -171,8 +183,7 @@ class EDITENG_DLLPUBLIC SvxFirstLineIndentItem final : public SfxPoolItem
{
private:
/// First-line indent always relative to GetTextLeft()
double m_dFirstLineOffset = 0.0;
sal_Int16 m_nUnit = css::util::MeasureUnit::TWIP;
SvxIndentValue m_stFirstLineOffset = SvxIndentValue::zero();
sal_uInt16 m_nPropFirstLineOffset = 100;
/// Automatic calculation of the first line indent
bool m_bAutoFirst = false;
@ -186,9 +197,6 @@ public:
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);
@ -220,20 +228,23 @@ class EDITENG_DLLPUBLIC SvxRightMarginItem final : public SfxPoolItem
{
private:
/// right margin: nothing special
tools::Long m_nRightMargin = 0;
SvxIndentValue m_stRightMargin = SvxIndentValue::zero();
sal_uInt16 m_nPropRightMargin = 100;
public:
// The "layout interface":
void SetRight(const tools::Long nR, const sal_uInt16 nProp = 100);
void SetRight(SvxIndentValue stR, const sal_uInt16 nProp = 100);
// Query/direct setting of the absolute values
tools::Long GetRight() const { return m_nRightMargin;}
SvxIndentValue GetRight() const;
sal_Int32 ResolveRight(const SvxFontUnitMetrics& rMetrics) const;
sal_Int32 ResolveRightFixedPart() const;
sal_Int32 ResolveRightVariablePart(const SvxFontUnitMetrics& rMetrics) const;
sal_uInt16 GetPropRight() const { return m_nPropRightMargin; }
sal_uInt16 GetPropRight() const;
explicit SvxRightMarginItem(const sal_uInt16 nId);
SvxRightMarginItem(const tools::Long nRight, const sal_uInt16 nId);
SvxRightMarginItem(SvxIndentValue stRight, const sal_uInt16 nId);
SvxRightMarginItem(SvxRightMarginItem const &) = default; // SfxPoolItem copy function dichotomy
// "pure virtual Methods" from SfxPoolItem
@ -325,10 +336,10 @@ public:
class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public SfxPoolItem
{
/// First-line indent always relative to GetTextLeft()
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
SvxIndentValue m_stFirstLineOffset = SvxIndentValue::zero();
SvxIndentValue m_stLeftMargin
= SvxIndentValue::zero(); // nLeft or the negative first-line indent
SvxIndentValue m_stRightMargin = SvxIndentValue::zero();
/// The amount of extra space added to the left margin.
tools::Long m_nGutterMargin;
/// The amount of extra space added to the right margin, on mirrored pages.
@ -344,7 +355,7 @@ public:
static SfxPoolItem* CreateDefault();
explicit SvxLRSpaceItem( const sal_uInt16 nId );
SvxLRSpaceItem(const tools::Long nLeft, const tools::Long nRight, SvxIndentValue stValue,
SvxLRSpaceItem(SvxIndentValue stLeft, SvxIndentValue stRight, SvxIndentValue stValue,
const sal_uInt16 nId);
SvxLRSpaceItem(SvxLRSpaceItem const &) = default; // SfxPoolItem copy function dichotomy
@ -364,18 +375,14 @@ public:
virtual bool HasMetrics() const override;
// The "layout interface":
void SetLeft (const tools::Long nL, const sal_uInt16 nProp = 100);
void SetRight(const tools::Long nR, const sal_uInt16 nProp = 100);
void SetLeft(SvxIndentValue stL, const sal_uInt16 nProp = 100);
void SetRight(SvxIndentValue stR, const sal_uInt16 nProp = 100);
// 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(m_dFirstLineOffset == 0.0);
nLeftMargin = nL;
}
void SetRightValue( const tools::Long nR ) { nRightMargin = nR; }
SvxIndentValue GetLeft() const;
sal_Int32 ResolveLeft(const SvxFontUnitMetrics& rMetrics) const;
SvxIndentValue GetRight() const;
sal_Int32 ResolveRight(const SvxFontUnitMetrics& rMetrics) const;
bool IsAutoFirst() const { return bAutoFirst; }
void SetAutoFirst( const bool bNew ) { bAutoFirst = bNew; }
@ -387,14 +394,12 @@ public:
sal_uInt16 GetPropRight() const { return nPropRightMargin;}
// The UI/text interface:
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp = 100);
tools::Long GetTextLeft() const;
void SetTextLeft(SvxIndentValue stL, const sal_uInt16 nProp = 100);
SvxIndentValue GetTextLeft() const;
sal_Int32 ResolveTextLeft(const SvxFontUnitMetrics& rMetrics) const;
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 )

View file

@ -139,6 +139,8 @@
#define MID_TXT_LMARGIN 11
#define MID_GUTTER_MARGIN 12
#define MID_FIRST_LINE_UNIT_INDENT 13
#define MID_R_UNIT_MARGIN 14
#define MID_L_UNIT_MARGIN 15
//ProtectItem
#define MID_PROTECT_CONTENT 0

View file

@ -295,8 +295,10 @@ inline constexpr OUString UNO_NAME_EDIT_PARA_ADJUST = u"ParaAdjust"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_BMARGIN = u"ParaBottomMargin"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_LASTLINEADJ = u"ParaLastLineAdjust"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_LMARGIN = u"ParaLeftMargin"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_LMARGIN_UNIT = u"ParaLeftMarginUnit"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_LINESPACING = u"ParaLineSpacing"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_RMARGIN = u"ParaRightMargin"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_RMARGIN_UNIT = u"ParaRightMarginUnit"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_TABSTOPS = u"ParaTabStops"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_TABSTOP_DEFAULT_DISTANCE = u"ParaTabStopDefaultDistance"_ustr;
inline constexpr OUString UNO_NAME_EDIT_PARA_TMARGIN = u"ParaTopMargin"_ustr;

View file

@ -148,8 +148,10 @@ struct SfxItemPropertyMapEntry;
{u"ParaHyphenationNoLastWord"_ustr, EE_PARA_HYPHENATE_NO_LAST_WORD, ::cppu::UnoType<bool>::get(), 0, 0 }, \
{ UNO_NAME_EDIT_PARA_LASTLINEADJ, EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_LAST_LINE_ADJUST }, \
{ UNO_NAME_EDIT_PARA_LMARGIN, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TXT_LMARGIN, PropertyMoreFlags::METRIC_ITEM }, \
{ UNO_NAME_EDIT_PARA_LMARGIN_UNIT, EE_PARA_LRSPACE, ::cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), 0, MID_L_UNIT_MARGIN }, \
{ UNO_NAME_EDIT_PARA_LINESPACING, EE_PARA_SBL, cppu::UnoType<css::style::LineSpacing>::get(), 0, CONVERT_TWIPS}, \
{ UNO_NAME_EDIT_PARA_RMARGIN, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \
{ UNO_NAME_EDIT_PARA_RMARGIN_UNIT, EE_PARA_LRSPACE, ::cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), 0, MID_R_UNIT_MARGIN }, \
{ UNO_NAME_EDIT_PARA_TABSTOPS, EE_PARA_TABS, cppu::UnoType<css::uno::Sequence< css::style::TabStop >>::get(), 0, 0 }, \
{ 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 },\

View file

@ -2415,9 +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),
aDescriptor.Put(SvxLRSpaceItem(SvxIndentValue::twips(getStyleProperty<sal_Int32>(
m_xReportDefinition, PROPERTY_LEFTMARGIN)),
SvxIndentValue::twips(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));

View file

@ -313,9 +313,9 @@ static bool lcl_HFPresentation
sal_uInt16 nPropRightMargin = rLRItem.GetPropRight();
sal_uInt16 nLeftMargin, nRightMargin;
tools::Long nTmp;
nTmp = rLRItem.GetLeft();
nTmp = rLRItem.ResolveLeft({});
nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
nTmp = rLRItem.GetRight();
nTmp = rLRItem.ResolveRight({});
nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
aText = EditResId(RID_SVXITEMS_LRSPACE_LEFT);

View file

@ -175,8 +175,8 @@ SfxItemSet& ScStyleSheet::GetItemSet()
HFDIST_CM,// nLow
ATTR_ULSPACE );
SvxLRSpaceItem aLRSpaceItem(TWO_CM, // nLeft
TWO_CM, // nRight
SvxLRSpaceItem aLRSpaceItem(SvxIndentValue::twips(TWO_CM), // nLeft
SvxIndentValue::twips(TWO_CM), // nRight
SvxIndentValue::zero(), // nFirstLineOffset
ATTR_LRSPACE);
SvxULSpaceItem aULSpaceItem( TWO_CM, // nUp
@ -193,7 +193,8 @@ SfxItemSet& ScStyleSheet::GetItemSet()
rHFSet.Put( aBoxInfoItem );
rHFSet.Put( aHFSizeItem );
rHFSet.Put( aHFDistItem );
rHFSet.Put(SvxLRSpaceItem(0, 0, SvxIndentValue::zero(),
rHFSet.Put(SvxLRSpaceItem(SvxIndentValue::zero(), SvxIndentValue::zero(),
SvxIndentValue::zero(),
ATTR_LRSPACE)); // Set border to Null
aHFSetItem.SetWhich(ATTR_PAGE_HEADERSET);

View file

@ -246,8 +246,8 @@ XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) :
maData.mbManualStart = maData.mnStartPage && (!nScTab || rDoc.NeedPageResetAfterTab( nScTab - 1 ));
const SvxLRSpaceItem& rLRItem = rItemSet.Get( ATTR_LRSPACE );
maData.mfLeftMargin = XclTools::GetInchFromTwips( rLRItem.GetLeft() );
maData.mfRightMargin = XclTools::GetInchFromTwips( rLRItem.GetRight() );
maData.mfLeftMargin = XclTools::GetInchFromTwips(rLRItem.ResolveLeft({}));
maData.mfRightMargin = XclTools::GetInchFromTwips(rLRItem.ResolveRight({}));
const SvxULSpaceItem& rULItem = rItemSet.Get( ATTR_ULSPACE );
maData.mfTopMargin = XclTools::GetInchFromTwips( rULItem.GetUpper() );
maData.mfBottomMargin = XclTools::GetInchFromTwips( rULItem.GetLower() );

View file

@ -215,9 +215,9 @@ void lclPutMarginItem( SfxItemSet& rItemSet, sal_uInt16 nRecId, double fMarginIn
{
SvxLRSpaceItem aItem( rItemSet.Get( ATTR_LRSPACE ) );
if (nRecId == EXC_ID_LEFTMARGIN)
aItem.SetLeftValue( nMarginTwips );
aItem.SetLeft(SvxIndentValue::twips(nMarginTwips));
else
aItem.SetRightValue( nMarginTwips );
aItem.SetRight(SvxIndentValue::twips(nMarginTwips));
rItemSet.Put( aItem );
}
break;

View file

@ -72,8 +72,8 @@ ScHTMLImport::ScHTMLImport( ScDocument* pDocP, const OUString& rBaseURL, const S
{
const SfxItemSet& rSet = pStyleSheet->GetItemSet();
const SvxLRSpaceItem* pLRItem = &rSet.Get( ATTR_LRSPACE );
tools::Long nLeftMargin = pLRItem->GetLeft();
tools::Long nRightMargin = pLRItem->GetRight();
tools::Long nLeftMargin = pLRItem->ResolveLeft({});
tools::Long nRightMargin = pLRItem->ResolveRight({});
const SvxULSpaceItem* pULItem = &rSet.Get( ATTR_ULSPACE );
tools::Long nTopMargin = pULItem->GetUpper();
tools::Long nBottomMargin = pULItem->GetLower();

View file

@ -2426,7 +2426,7 @@ static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const std::u
SfxStyleSheetBase* pStyleSheet = pStylePool->Find(rDoc.GetPageStyle(nTab), SfxStyleFamily::Page);
SfxItemSet* pItemSet = &pStyleSheet->GetItemSet();
tools::Long nLeftMargin(pItemSet->Get(ATTR_LRSPACE).GetLeft());
tools::Long nLeftMargin(pItemSet->Get(ATTR_LRSPACE).ResolveLeft({}));
nLeftMargin = o3tl::convert(nLeftMargin, o3tl::Length::twip, o3tl::Length::mm100);
tools::Long nTopMargin(pItemSet->Get(ATTR_ULSPACE).GetUpper());

View file

@ -1064,12 +1064,20 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
bMoveRulerAction = false;
Invalidate(tools::Rectangle(0, 0, 10000, 10000));
}
else if( bLeftRulerChange && ( o3tl::convert(aButtonUpPt.X(), o3tl::Length::mm100, o3tl::Length::twip) > nWidth - aLRItem.GetRight() - o3tl::convert(aOffset.X(), o3tl::Length::mm100, o3tl::Length::twip) ) )
else if (bLeftRulerChange
&& (o3tl::convert(aButtonUpPt.X(), o3tl::Length::mm100, o3tl::Length::twip)
> nWidth - aLRItem.ResolveRight({})
- o3tl::convert(aOffset.X(), o3tl::Length::mm100,
o3tl::Length::twip)))
{
bMoveRulerAction = false;
Invalidate(tools::Rectangle(0, 0, 10000, 10000));
}
else if( bRightRulerChange && ( o3tl::convert(aButtonUpPt.X(), o3tl::Length::mm100, o3tl::Length::twip) < aLRItem.GetLeft() - o3tl::convert(aOffset.X(), o3tl::Length::mm100, o3tl::Length::twip) ) )
else if (bRightRulerChange
&& (o3tl::convert(aButtonUpPt.X(), o3tl::Length::mm100, o3tl::Length::twip)
< aLRItem.ResolveLeft({})
- o3tl::convert(aOffset.X(), o3tl::Length::mm100,
o3tl::Length::twip)))
{
bMoveRulerAction = false;
Invalidate(tools::Rectangle(0, 0, 10000, 10000));
@ -1084,13 +1092,19 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
ScDocShellModificator aModificator( *pDocShell );
if( bLeftRulerChange && bLeftRulerMove )
{
aLRItem.SetLeft(o3tl::convert( aButtonUpPt.X(), o3tl::Length::mm100, o3tl::Length::twip) + o3tl::convert(aOffset.X(), o3tl::Length::mm100, o3tl::Length::twip));
aLRItem.SetLeft(SvxIndentValue::twips(
o3tl::convert(aButtonUpPt.X(), o3tl::Length::mm100, o3tl::Length::twip)
+ o3tl::convert(aOffset.X(), o3tl::Length::mm100, o3tl::Length::twip)));
rStyleSet.Put(aLRItem);
pDocShell->SetModified();
}
else if( bRightRulerChange && bRightRulerMove )
{
aLRItem.SetRight(nWidth - o3tl::convert(aButtonUpPt.X(), o3tl::Length::mm100, o3tl::Length::twip) - o3tl::convert(aOffset.X(), o3tl::Length::mm100, o3tl::Length::twip));
aLRItem.SetRight(SvxIndentValue::twips(
nWidth
- o3tl::convert(aButtonUpPt.X(), o3tl::Length::mm100,
o3tl::Length::twip)
- o3tl::convert(aOffset.X(), o3tl::Length::mm100, o3tl::Length::twip)));
rStyleSet.Put( aLRItem );
pDocShell->SetModified();
}

View file

@ -669,9 +669,9 @@ static void lcl_FillHFParam( ScPrintHFParam& rParam, const SfxItemSet* pHFSet )
rParam.nHeight = pHFSet->Get(ATTR_PAGE_SIZE).GetSize().Height();
const SvxLRSpaceItem* pHFLR = &pHFSet->Get(ATTR_LRSPACE);
tools::Long nTmp;
nTmp = pHFLR->GetLeft();
nTmp = pHFLR->ResolveLeft({});
rParam.nLeft = nTmp < 0 ? 0 : sal_uInt16(nTmp);
nTmp = pHFLR->GetRight();
nTmp = pHFLR->ResolveRight({});
rParam.nRight = nTmp < 0 ? 0 : sal_uInt16(nTmp);
rParam.pBorder = &pHFSet->Get(ATTR_BORDER);
rParam.pBack = &pHFSet->Get(ATTR_BACKGROUND);
@ -862,9 +862,9 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
// TabPage "Page"
const SvxLRSpaceItem* pLRItem = &pParamSet->Get( ATTR_LRSPACE );
tools::Long nTmp;
nTmp = pLRItem->GetLeft();
nTmp = pLRItem->ResolveLeft({});
nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
nTmp = pLRItem->GetRight();
nTmp = pLRItem->ResolveRight({});
nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
const SvxULSpaceItem* pULItem = &pParamSet->Get( ATTR_ULSPACE );
nTopMargin = pULItem->GetUpper();

View file

@ -3125,6 +3125,30 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:choice>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="loext:margin">
<rng:choice>
<rng:ref name="cssLength"/>
<rng:ref name="percent"/>
</rng:choice>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="loext:margin-left">
<rng:choice>
<rng:ref name="cssLength"/>
<rng:ref name="percent"/>
</rng:choice>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="loext:margin-right">
<rng:choice>
<rng:ref name="cssLength"/>
<rng:ref name="percent"/>
</rng:choice>
</rng:attribute>
</rng:optional>
</rng:define>
<!-- TODO no proposal -->

View file

@ -2144,7 +2144,7 @@ static rtl::Reference<SdrObject> convertPresentationObjectImpl(SdPage& rPage, Sd
const SvxLRSpaceItem& rLRItem = aSet.Get(EE_PARA_LRSPACE);
SvxLRSpaceItem aNewLRItem(rLRItem);
aNewLRItem.SetTextLeft(0);
aNewLRItem.SetTextLeft(SvxIndentValue::zero());
aSet.Put(aNewLRItem);
pNewObj->SetMergedItemSet(aSet);

View file

@ -394,7 +394,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName,
rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
// #i16874# enable kerning by default but only for new documents
rSubtitleSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
aSvxLRSpaceItem.SetTextLeft(0);
aSvxLRSpaceItem.SetTextLeft(SvxIndentValue::zero());
rSubtitleSet.Put(aSvxLRSpaceItem);
vcl::Font aTmpFont( GetBulletFont() );
@ -439,7 +439,8 @@ 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, SvxIndentValue::twips(-600.0), EE_PARA_LRSPACE));
rNotesSet.Put(SvxLRSpaceItem(SvxIndentValue::zero(), SvxIndentValue::zero(),
SvxIndentValue::twips(-600.0), EE_PARA_LRSPACE));
// #i16874# enable kerning by default but only for new documents
rNotesSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );

View file

@ -579,12 +579,12 @@ void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems)
if (rSet.GetItemState(EE_PARA_LRSPACE) != SfxItemState::SET || !bOnlyMissingItems)
{
const SvxLRSpaceItem& rLRItem = pCurSet->Get(EE_PARA_LRSPACE);
double fIndentFraction = double(rLRItem.GetTextLeft()) / nOldHeight;
double fIndentFraction = double(rLRItem.ResolveTextLeft({})) / nOldHeight;
SvxLRSpaceItem aNewLRItem(rLRItem);
aNewLRItem.SetTextLeft(fIndentFraction * nNewHeight);
double fFirstIndentFraction = rLRItem.GetTextFirstLineOffsetValue() / nOldHeight;
aNewLRItem.SetTextLeft(SvxIndentValue::twips(fIndentFraction * nNewHeight));
double fFirstIndentFraction = rLRItem.GetTextFirstLineOffset().m_dValue / nOldHeight;
aNewLRItem.SetTextFirstLineOffset(SvxIndentValue{ fFirstIndentFraction * nNewHeight,
rLRItem.GetTextFirstLineOffsetUnit() });
rLRItem.GetTextFirstLineOffset().m_nUnit });
rSet.Put(aNewLRItem);
}

View file

@ -294,9 +294,9 @@ bool SdTransformOOo2xDocument::transformItemSet( SfxItemSet& rSet, bool bNumberi
if (pItem)
{
SvxLRSpaceItem aItem(*pItem);
if ((aItem.GetLeft() != 0) || (aItem.GetTextFirstLineOffsetValue() != 0.0))
if ((aItem.GetLeft().m_dValue != 0.0) || (aItem.GetTextFirstLineOffset().m_dValue != 0.0))
{
aItem.SetLeftValue( 0 );
aItem.SetLeft(SvxIndentValue::zero());
aItem.SetTextFirstLineOffset(SvxIndentValue::zero());
rSet.Put( aItem );
bRet = true;

View file

@ -244,8 +244,8 @@ 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()),
SvxLRSpaceItem aLRSpaceItem(SvxIndentValue::twips(mpPage->GetLeftBorder()),
SvxIndentValue::twips(mpPage->GetRightBorder()),
SvxIndentValue::zero(),
mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE));
aNewAttr->Put( aLRSpaceItem );
@ -526,8 +526,8 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
if( pArgs->GetItemState(mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE),
true, &pPoolItem) == SfxItemState::SET )
{
nLeft = static_cast<const SvxLRSpaceItem*>(pPoolItem)->GetLeft();
nRight = static_cast<const SvxLRSpaceItem*>(pPoolItem)->GetRight();
nLeft = static_cast<const SvxLRSpaceItem*>(pPoolItem)->ResolveLeft({});
nRight = static_cast<const SvxLRSpaceItem*>(pPoolItem)->ResolveRight({});
if( mpPage->GetLeftBorder() != nLeft || mpPage->GetRightBorder() != nRight )
bSetPageSizeAndBorder = true;

View file

@ -74,7 +74,7 @@ void FuParagraph::DoExecute( SfxRequest& rReq )
aNewAttr.Put( aEditAttr );
// left border is offset
const ::tools::Long nOff = aNewAttr.Get( EE_PARA_LRSPACE ).GetTextLeft();
const ::tools::Long nOff = aNewAttr.Get(EE_PARA_LRSPACE).ResolveTextLeft({});
// conversion since TabulatorTabPage always uses Twips!
SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
aNewAttr.Put( aOff );

View file

@ -158,7 +158,7 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR
const SvxLRSpaceItem& rItem = aAttr.Get( EE_PARA_LRSPACE );
std::unique_ptr<SvxLRSpaceItem> pNewItem(rItem.Clone());
::tools::Long nLeft = pNewItem->GetLeft();
::tools::Long nLeft = pNewItem->ResolveLeft({});
if( nSlot == SID_INC_INDENT )
nLeft += nIndentDefaultDist;
else
@ -166,7 +166,7 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR
nLeft -= nIndentDefaultDist;
nLeft = std::max<::tools::Long>( nLeft, 0 );
}
pNewItem->SetLeftValue( static_cast<sal_uInt16>(nLeft) );
pNewItem->SetLeft(SvxIndentValue::twips(static_cast<sal_uInt16>(nLeft)));
aAttr.Put( std::move(pNewItem) );
pOLV->GetOutliner()->SetParaAttribs( nPara, aAttr );
@ -352,7 +352,8 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR
if (nIndentDist == 0.0)
nIndentDist = nIndentDefaultDist;
aNewMargin.SetTextLeft(aParaMargin.GetTextLeft() + nIndentDist);
aNewMargin.SetTextLeft(
SvxIndentValue::twips(aParaMargin.ResolveTextLeft({}) + nIndentDist));
aNewMargin.SetRight(aParaMargin.GetRight());
aNewMargin.SetTextFirstLineOffset(SvxIndentValue::twips(nIndentDist * -1));

View file

@ -833,16 +833,16 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq)
// become negative - EditEngine really does not
// like that.
const auto nAbsLSpace=aFormat.GetAbsLSpace();
const ::tools::Long nTxtLeft=rItem.GetTextLeft();
const ::tools::Long nTxtLeft = rItem.ResolveTextLeft({});
const ::tools::Long nLeftIndent=std::max(::tools::Long(0),nTxtLeft - nAbsLSpace);
aLRSpaceItem.SetTextLeft(nLeftIndent);
aLRSpaceItem.SetTextLeft(SvxIndentValue::twips(nLeftIndent));
// control for clipped left indent - remainder
// reduces number format first line indent
aFormat.SetAbsLSpace(nTxtLeft - nLeftIndent);
// negative first line indent goes to the number
// format, positive to the lrSpace item
if (rItem.GetTextFirstLineOffsetValue() < 0.0)
if (rItem.GetTextFirstLineOffset().m_dValue < 0.0)
{
aFormat.SetFirstLineOffset(rItem.ResolveTextFirstLineOffset({})
- rOrigLRSpaceItem.ResolveTextFirstLineOffset({})
@ -952,7 +952,8 @@ void DrawViewShell::GetRulerState(SfxItemSet& rSet)
rNumBulletItem.GetNumRule().GetLevelCount() > nOutlineLevel )
{
const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule().GetLevel(nOutlineLevel);
aLRSpaceItem.SetTextLeft(rFormat.GetAbsLSpace() + rLRSpaceItem.GetTextLeft());
aLRSpaceItem.SetTextLeft(SvxIndentValue::twips(
rFormat.GetAbsLSpace() + rLRSpaceItem.ResolveTextLeft({})));
aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(
rLRSpaceItem.ResolveTextFirstLineOffset({})
+ rFormat.GetFirstLineOffset() - rFormat.GetCharTextDistance()));

View file

@ -70,7 +70,8 @@ namespace sd {
// PROCESS_WITH_PROGRESS_THRESHOLD pages are concerned
#define PROCESS_WITH_PROGRESS_THRESHOLD 5
OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineViewShell& rOutlineViewShell)
OutlineView::OutlineView(DrawDocShell& rDocSh, vcl::Window* pWindow,
OutlineViewShell& rOutlineViewShell)
: ::sd::SimpleOutlinerView(*rDocSh.GetDoc(), pWindow->GetOutDev(), &rOutlineViewShell)
, mrOutlineViewShell(rOutlineViewShell)
, mrOutliner(*mrDoc.GetOutliner())
@ -78,7 +79,8 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie
, mnPagesProcessed(0)
, mbFirstPaint(true)
, maDocColor(COL_WHITE)
, maLRSpaceItem(2000, 0, SvxIndentValue::zero(), EE_PARA_OUTLLRSPACE)
, maLRSpaceItem(SvxIndentValue::twips(2000), SvxIndentValue::zero(), SvxIndentValue::zero(),
EE_PARA_OUTLLRSPACE)
{
bool bInitOutliner = false;

View file

@ -255,8 +255,8 @@ bool SvxHFPage::FillItemSet( SfxItemSet* rSet )
// Margins
SvxLRSpaceItem aLR( nWLRSpace );
aLR.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_xLMEdit, eUnit )) );
aLR.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_xRMEdit, eUnit )) );
aLR.SetLeft(SvxIndentValue::twips(GetCoreValue(*m_xLMEdit, eUnit)));
aLR.SetRight(SvxIndentValue::twips(GetCoreValue(*m_xRMEdit, eUnit)));
aSet.Put( aLR );
SvxULSpaceItem aUL( nWULSpace );
@ -372,8 +372,8 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
}
m_xHeightDynBtn->set_active(rDynamic.GetValue());
SetMetricValue( *m_xLMEdit, rLR.GetLeft(), eUnit );
SetMetricValue( *m_xRMEdit, rLR.GetRight(), eUnit );
SetMetricValue(*m_xLMEdit, rLR.ResolveLeft({}), eUnit);
SetMetricValue(*m_xRMEdit, rLR.ResolveRight({}), eUnit);
m_xCntSharedBox->set_active(rShared.GetValue());
if (pSharedFirst)
m_xCntSharedFirstBox->set_active(pSharedFirst->GetValue());
@ -794,8 +794,8 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
// Set left and right margins
const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
m_aBspWin.SetLeft( rLRSpace.GetLeft() );
m_aBspWin.SetRight( rLRSpace.GetRight() );
m_aBspWin.SetLeft(rLRSpace.ResolveLeft({}));
m_aBspWin.SetRight(rLRSpace.ResolveRight({}));
}
else
{
@ -865,8 +865,8 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
m_aBspWin.SetHdDist( nDist );
m_aBspWin.SetHdLeft( rLR.GetLeft() );
m_aBspWin.SetHdRight( rLR.GetRight() );
m_aBspWin.SetHdLeft(rLR.ResolveLeft({}));
m_aBspWin.SetHdRight(rLR.ResolveRight({}));
m_aBspWin.SetHeader( true );
}
else
@ -903,8 +903,8 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
m_aBspWin.SetFtDist( nDist );
m_aBspWin.SetFtLeft( rLR.GetLeft() );
m_aBspWin.SetFtRight( rLR.GetRight() );
m_aBspWin.SetFtLeft(rLR.ResolveLeft({}));
m_aBspWin.SetFtRight(rLR.ResolveRight({}));
m_aBspWin.SetFooter( true );
}
else

View file

@ -565,11 +565,11 @@ void SvxRuler::MouseMove( const MouseEvent& rMEvt )
tools::Long nIndentValue = 0.0;
if (nIndex == INDENT_LEFT_MARGIN)
nIndentValue = mxParaItem->GetTextLeft();
nIndentValue = mxParaItem->ResolveTextLeft({});
else if (nIndex == INDENT_FIRST_LINE)
nIndentValue = mxParaItem->ResolveTextFirstLineOffset({});
else if (nIndex == INDENT_RIGHT_MARGIN)
nIndentValue = mxParaItem->GetRight();
nIndentValue = mxParaItem->ResolveRight({});
double fValue = OutputDevice::LogicToLogic(Size(nIndentValue, 0), pEditWin->GetMapMode(), GetCurrentMapMode()).Width();
fValue = rtl::math::round(fValue / aUnitData.nTickUnit, aNoDecimalPlaces);
@ -845,15 +845,15 @@ void SvxRuler::UpdatePara()
if(bRTLText)
{
leftMargin = nRightFrameMargin - mxParaItem->GetTextLeft() + lAppNullOffset;
leftMargin = nRightFrameMargin - mxParaItem->ResolveTextLeft({}) + lAppNullOffset;
leftFirstLine = leftMargin - mxParaItem->ResolveTextFirstLineOffset({});
rightMargin = nLeftFrameMargin + mxParaItem->GetRight() + lAppNullOffset;
rightMargin = nLeftFrameMargin + mxParaItem->ResolveRight({}) + lAppNullOffset;
}
else
{
leftMargin = nLeftFrameMargin + mxParaItem->GetTextLeft() + lAppNullOffset;
leftMargin = nLeftFrameMargin + mxParaItem->ResolveTextLeft({}) + lAppNullOffset;
leftFirstLine = leftMargin + mxParaItem->ResolveTextFirstLineOffset({});
rightMargin = nRightFrameMargin - mxParaItem->GetRight() + lAppNullOffset;
rightMargin = nRightFrameMargin - mxParaItem->ResolveRight({}) + lAppNullOffset;
}
mpIndents[INDENT_LEFT_MARGIN].nPos = ConvertHPosPixel(leftMargin);
@ -1024,7 +1024,7 @@ void SvxRuler::UpdateTabs()
const tools::Long nRightFrameMargin = GetRightFrameMargin();
//#i24363# tab stops relative to indent
const tools::Long nParaItemTxtLeft = mxParaItem->GetTextLeft();
const tools::Long nParaItemTxtLeft = mxParaItem->ResolveTextLeft({});
const tools::Long lParaIndent = nLeftFrameMargin + nParaItemTxtLeft;
const tools::Long lRightMargin = nRightFrameMargin - nParaItemTxtLeft;
@ -1033,7 +1033,8 @@ void SvxRuler::UpdateTabs()
? ConvertHPosPixel(mxTabStopItem->At(mxTabStopItem->Count() - 1).GetTabPos())
: 0;
const tools::Long lPosPixel = ConvertHPosPixel(lParaIndent) + lLastTab;
const tools::Long lRightIndent = ConvertHPosPixel(nRightFrameMargin - mxParaItem->GetRight());
const tools::Long lRightIndent
= ConvertHPosPixel(nRightFrameMargin - mxParaItem->ResolveRight({}));
tools::Long lCurrentDefTabDist = lDefTabDist;
if(mxTabStopItem->GetDefaultDistance())
@ -1301,7 +1302,8 @@ tools::Long SvxRuler::GetRightIndent() const
tools::Long SvxRuler::GetLogicRightIndent() const
{
/* Get Right paragraph margin in Logic */
return mxParaItem ? GetRightFrameMargin() - mxParaItem->GetRight() : GetRightFrameMargin();
return mxParaItem ? GetRightFrameMargin() - mxParaItem->ResolveRight({})
: GetRightFrameMargin();
}
// Left margin in App values, is either the margin (= 0) or the left edge of
@ -1320,7 +1322,7 @@ tools::Long SvxRuler::GetLeftFrameMargin() const
}
if (mxBorderItem && (!mxColumnItem || mxColumnItem->IsTable()))
nLeft += mxBorderItem->GetLeft();
nLeft += mxBorderItem->ResolveLeft({});
return nLeft;
}
@ -1374,7 +1376,7 @@ tools::Long SvxRuler::GetRightFrameMargin() const
lResult += mxULSpaceItem->GetLower();
if (bHorz && mxBorderItem && (!mxColumnItem || mxColumnItem->IsTable()))
lResult += mxBorderItem->GetRight();
lResult += mxBorderItem->ResolveRight({});
if(bHorz)
lResult = mxPagePosItem->GetWidth() - lResult;
@ -2195,8 +2197,8 @@ void SvxRuler::ApplyIndents()
}
mxParaItem->SetTextFirstLineOffset(SvxIndentValue::twips(nNewFirstLineOffset));
mxParaItem->SetTextLeft(nNewTxtLeft);
mxParaItem->SetRight(nNewRight);
mxParaItem->SetTextLeft(SvxIndentValue::twips(nNewTxtLeft));
mxParaItem->SetRight(SvxIndentValue::twips(nNewRight));
sal_uInt16 nParagraphId = bHorz ? SID_ATTR_PARA_LRSPACE : SID_ATTR_PARA_LRSPACE_VERTICAL;
pBindings->GetDispatcher()->ExecuteList(nParagraphId, SfxCallMode::RECORD,
@ -2257,7 +2259,8 @@ void SvxRuler::ApplyTabs()
= lAppNullOffset + (bRTL ? GetRightFrameMargin() : GetLeftFrameMargin());
if (mxRulerImpl->bIsTabsRelativeToIndent && mxParaItem)
{
nTmpLeftIndentLogic += bRTL ? mxParaItem->GetRight() : mxParaItem->GetTextLeft();
nTmpLeftIndentLogic
+= bRTL ? mxParaItem->ResolveRight({}) : mxParaItem->ResolveTextLeft({});
}
aTabStop.GetTabPos()
= mxRulerImpl->lMaxRightLogic - lLogicNullOffset - nTmpLeftIndentLogic;

View file

@ -219,9 +219,9 @@ void ParaPropertyPanel::initial()
IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl, weld::MetricSpinButton&, void)
{
SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
aMargin.SetTextLeft(mxLeftIndent->GetCoreValue(m_eLRSpaceUnit));
aMargin.SetRight(mxRightIndent->GetCoreValue(m_eLRSpaceUnit));
// tdf#36709: TODO: Handle font-relative units from GUI
aMargin.SetTextLeft(SvxIndentValue::twips(mxLeftIndent->GetCoreValue(m_eLRSpaceUnit)));
aMargin.SetRight(SvxIndentValue::twips(mxRightIndent->GetCoreValue(m_eLRSpaceUnit)));
aMargin.SetTextFirstLineOffset(
SvxIndentValue::twips(mxFLineIndent->GetCoreValue(m_eLRSpaceUnit)));
@ -396,14 +396,15 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo
if (pState && eState >= SfxItemState::DEFAULT)
{
// tdf#36709: TODO: Handle font-relative units
const SvxLRSpaceItem* pSpace = static_cast<const SvxLRSpaceItem*>(pState);
maTxtLeft = pSpace->GetTextLeft();
maTxtLeft = pSpace->ResolveTextLeft({});
maTxtLeft = OutputDevice::LogicToLogic(maTxtLeft, m_eLRSpaceUnit, MapUnit::MapTwip);
tools::Long aTxtRight = pSpace->GetRight();
tools::Long aTxtRight = pSpace->ResolveRight({});
aTxtRight = OutputDevice::LogicToLogic(aTxtRight, m_eLRSpaceUnit, MapUnit::MapTwip);
// tdf#36709: TODO: Handle font-relative units
tools::Long aTxtFirstLineOfst = pSpace->ResolveTextFirstLineOffset({});
aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, m_eLRSpaceUnit, MapUnit::MapTwip );

View file

@ -213,9 +213,9 @@ void ParaLRSpacingWindow::SetValue(SfxItemState eState, const SfxPoolItem* pStat
m_xFLSpacing->set_sensitive(true);
const SvxLRSpaceItem* pSpace = static_cast<const SvxLRSpaceItem*>(pState);
tools::Long aTxtLeft = pSpace->GetTextLeft();
tools::Long aTxtRight = pSpace->GetRight();
// tdf#36709: TODO: Handle font-relative units
tools::Long aTxtLeft = pSpace->ResolveTextLeft({});
tools::Long aTxtRight = pSpace->ResolveRight({});
tools::Long aTxtFirstLineOfst = pSpace->ResolveTextFirstLineOffset({});
aTxtLeft = m_xBeforeSpacing->normalize(aTxtLeft);
@ -293,9 +293,9 @@ IMPL_LINK_NOARG(ParaLRSpacingWindow, ModifySpacingHdl, weld::MetricSpinButton&,
if(pDisp)
{
SvxLRSpaceItem aMargin(SID_ATTR_PARA_LRSPACE);
aMargin.SetTextLeft(m_xBeforeSpacing->GetCoreValue(m_eUnit));
aMargin.SetRight(m_xAfterSpacing->GetCoreValue(m_eUnit));
// tdf#36709: TODO: Handle font-relative units from GUI
aMargin.SetTextLeft(SvxIndentValue::twips(m_xBeforeSpacing->GetCoreValue(m_eUnit)));
aMargin.SetRight(SvxIndentValue::twips(m_xAfterSpacing->GetCoreValue(m_eUnit)));
aMargin.SetTextFirstLineOffset(SvxIndentValue::twips(m_xFLSpacing->GetCoreValue(m_eUnit)));
pDisp->ExecuteList(SID_ATTR_PARA_LRSPACE, SfxCallMode::RECORD, {&aMargin});

View file

@ -59,6 +59,8 @@ inline constexpr OUString UNO_NAME_PARA_LEFT_MARGIN = u"ParaLeftMargin"_ustr;
inline constexpr OUString UNO_NAME_PARA_RIGHT_MARGIN = u"ParaRightMargin"_ustr;
inline constexpr OUString UNO_NAME_PARA_LEFT_MARGIN_RELATIVE = u"ParaLeftMarginRelative"_ustr;
inline constexpr OUString UNO_NAME_PARA_RIGHT_MARGIN_RELATIVE = u"ParaRightMarginRelative"_ustr;
inline constexpr OUString UNO_NAME_PARA_LEFT_MARGIN_UNIT = u"ParaLeftMarginUnit"_ustr;
inline constexpr OUString UNO_NAME_PARA_RIGHT_MARGIN_UNIT = u"ParaRightMarginUnit"_ustr;
inline constexpr OUString UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT
= u"ParaIsAutoFirstLineIndent"_ustr;
inline constexpr OUString UNO_NAME_PARA_FIRST_LINE_INDENT = u"ParaFirstLineIndent"_ustr;

View file

@ -1692,8 +1692,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf124770)
// Set left and right margin.
SvxLRSpaceItem aLRSpace = rPageSet.GetLRSpace();
aLRSpace.SetLeft(1418);
aLRSpace.SetRight(1418);
aLRSpace.SetLeft(SvxIndentValue::twips(1418));
aLRSpace.SetRight(SvxIndentValue::twips(1418));
rPageFormat.SetFormatAttr(aLRSpace);
pDoc->ChgPageDesc(0, rPageDesc);

View file

@ -0,0 +1,131 @@
<?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-31T15:19:06.580445570</meta:creation-date><dc:date>2024-11-28T01:14:40.961720728</dc:date><meta:editing-duration>PT6M53S</meta:editing-duration><meta:editing-cycles>5</meta:editing-cycles><meta:generator>LibreOfficeDev/25.2.0.0.alpha1$Linux_X86_64 LibreOffice_project/b1c60908eba7871a522777048a72630a6360e4e8</meta:generator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="4" meta:word-count="8" meta:character-count="86" meta:non-whitespace-character-count="82"/></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"/>
<style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
</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: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"/>
</style:default-style>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" loext:hyphenation-keep-type="column" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>
<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" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
</style:default-style>
<style:default-style style:family="table">
<style:table-properties table:border-model="collapsing"/>
</style:default-style>
<style:default-style style:family="table-row">
<style:table-row-properties fo:keep-together="auto"/>
</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" 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" 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" 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" 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" 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" 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" 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" 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" 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" 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>
</text:outline-level-style>
</text:outline-style>
<text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
<text:linenumbering-configuration text:number-lines="false" text:offset="0.1965in" style:num-format="1" text:number-position="left" text:increment="5"/>
</office:styles>
<office:automatic-styles>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="3in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false"/>
</style:style>
<style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties loext:margin="6em" loext:margin-left="6em" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false"/>
</style:style>
<style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="0in" fo:margin-right="3in" fo:text-indent="0in" style:auto-text-indent="false"/>
<style:text-properties/>
</style:style>
<style:style style:name="P4" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="0in" loext:margin-right="6em" fo:text-indent="0in" style:auto-text-indent="false"/>
<style:text-properties/>
</style:style>
<style:style style:name="T1" style:family="text">
<style:text-properties/>
</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: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" draw:style-name="dp1"/>
</office:master-styles>
<office:body>
<office:text>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
<text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
</text:sequence-decls>
<text:p text:style-name="P1">3in loext:<text:span text:style-name="T1">margin-left</text:span></text:p>
<text:p text:style-name="P2">6em loext:<text:span text:style-name="T1">margin-left</text:span></text:p>
<text:p text:style-name="P3"><text:span text:style-name="T1">3in </text:span>loext:<text:span text:style-name="T1">margin-right</text:span></text:p>
<text:p text:style-name="P4">6em loext:<text:span text:style-name="T1">margin-right</text:span></text:p>
</office:text>
</office:body>
</office:document>

View file

@ -1819,6 +1819,50 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf36709)
assertXPath(pXmlDoc, "//style:style[@style:name='P2']/style:paragraph-properties", "text-indent", u"6em");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf163913)
{
// Verifies that loext:left-margin and loext:right-margin correctly round-trip
loadAndReload("tdf163913.fodt");
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);
// Style P1 should have been rewritten as fo:margin-left
assertXPath(pXmlDoc,
"//style:style[@style:name='P1']/style:paragraph-properties[@fo:margin-left]", 1);
assertXPath(pXmlDoc,
"//style:style[@style:name='P1']/style:paragraph-properties[@loext:margin-left]",
0);
assertXPath(pXmlDoc, "//style:style[@style:name='P1']/style:paragraph-properties",
"margin-left", u"3in");
// Style P2 should have round-tripped as loext:margin-left
assertXPath(pXmlDoc,
"//style:style[@style:name='P2']/style:paragraph-properties[@fo:margin-left]", 0);
assertXPath(pXmlDoc,
"//style:style[@style:name='P2']/style:paragraph-properties[@loext:margin-left]",
1);
assertXPath(pXmlDoc, "//style:style[@style:name='P2']/style:paragraph-properties",
"margin-left", u"6em");
// Style P3 should have been rewritten as fo:margin-right
assertXPath(pXmlDoc,
"//style:style[@style:name='P3']/style:paragraph-properties[@fo:margin-right]", 1);
assertXPath(pXmlDoc,
"//style:style[@style:name='P3']/style:paragraph-properties[@loext:margin-right]",
0);
assertXPath(pXmlDoc, "//style:style[@style:name='P3']/style:paragraph-properties",
"margin-right", u"3in");
// Style P4 should have round-tripped as loext:margin-right
assertXPath(pXmlDoc,
"//style:style[@style:name='P4']/style:paragraph-properties[@fo:margin-right]", 0);
assertXPath(pXmlDoc,
"//style:style[@style:name='P4']/style:paragraph-properties[@loext:margin-right]",
1);
assertXPath(pXmlDoc, "//style:style[@style:name='P4']/style:paragraph-properties",
"margin-right", u"6em");
}
} // end of anonymous namespace
CPPUNIT_PLUGIN_IMPLEMENT();

View file

@ -153,7 +153,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101534)
pWrtShell->GetCurAttr(aSet);
CPPUNIT_ASSERT(!aSet.HasItem(RES_MARGIN_FIRSTLINE));
CPPUNIT_ASSERT(aSet.HasItem(RES_MARGIN_TEXTLEFT));
CPPUNIT_ASSERT_EQUAL(::tools::Long(0), aSet.GetItem(RES_MARGIN_TEXTLEFT)->GetTextLeft());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSet.GetItem(RES_MARGIN_TEXTLEFT)->ResolveTextLeft({}));
// Make sure that direct formatting is preserved during paste.
pWrtShell->EndPara(/*bSelect=*/false);
@ -163,7 +163,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101534)
// This failed, direct formatting was lost.
CPPUNIT_ASSERT(!aSet.HasItem(RES_MARGIN_FIRSTLINE));
CPPUNIT_ASSERT(aSet.HasItem(RES_MARGIN_TEXTLEFT));
CPPUNIT_ASSERT_EQUAL(::tools::Long(0), aSet.GetItem(RES_MARGIN_TEXTLEFT)->GetTextLeft());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSet.GetItem(RES_MARGIN_TEXTLEFT)->ResolveTextLeft({}));
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testExtendedSelectAllHang)

View file

@ -414,8 +414,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282)
SwFrameFormat& rSourceMasterFormat = sPageDesc->GetMaster();
//Setting horizontal spaces on master
SvxLRSpaceItem horizontalSpace(RES_LR_SPACE);
horizontalSpace.SetLeft(11);
horizontalSpace.SetRight(12);
horizontalSpace.SetLeft(SvxIndentValue::twips(11));
horizontalSpace.SetRight(SvxIndentValue::twips(12));
rSourceMasterFormat.SetFormatAttr(horizontalSpace);
//Setting vertical spaces on master
SvxULSpaceItem verticalSpace(RES_UL_SPACE);
@ -432,17 +432,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282)
SwFrameFormat& rTargetFirstLeftFormat = tPageDesc->GetFirstLeft();
//Checking horizontal spaces
const SvxLRSpaceItem MasterLRSpace = rTargetMasterFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), MasterLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), MasterLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), MasterLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), MasterLRSpace.ResolveRight({}));
const SvxLRSpaceItem LeftLRSpace = rTargetLeftFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), LeftLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), LeftLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), LeftLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), LeftLRSpace.ResolveRight({}));
const SvxLRSpaceItem FirstMasterLRSpace = rTargetFirstMasterFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstMasterLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstMasterLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), FirstMasterLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), FirstMasterLRSpace.ResolveRight({}));
const SvxLRSpaceItem FirstLeftLRSpace = rTargetFirstLeftFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstLeftLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstLeftLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), FirstLeftLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), FirstLeftLRSpace.ResolveRight({}));
//Checking vertical spaces
const SvxULSpaceItem MasterULSpace = rTargetMasterFormat.GetULSpace();
CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), MasterULSpace.GetUpper());
@ -474,8 +474,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282WithMirror)
SwFrameFormat& rSourceMasterFormat = sPageDesc->GetMaster();
//Setting horizontal spaces on master
SvxLRSpaceItem horizontalSpace(RES_LR_SPACE);
horizontalSpace.SetLeft(11);
horizontalSpace.SetRight(12);
horizontalSpace.SetLeft(SvxIndentValue::twips(11));
horizontalSpace.SetRight(SvxIndentValue::twips(12));
rSourceMasterFormat.SetFormatAttr(horizontalSpace);
//Setting vertical spaces on master
SvxULSpaceItem verticalSpace(RES_UL_SPACE);
@ -492,19 +492,19 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282WithMirror)
SwFrameFormat& rTargetFirstLeftFormat = tPageDesc->GetFirstLeft();
//Checking horizontal spaces
const SvxLRSpaceItem MasterLRSpace = rTargetMasterFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), MasterLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), MasterLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), MasterLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), MasterLRSpace.ResolveRight({}));
//mirror effect should be present
const SvxLRSpaceItem LeftLRSpace = rTargetLeftFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), LeftLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), LeftLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), LeftLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), LeftLRSpace.ResolveRight({}));
const SvxLRSpaceItem FirstMasterLRSpace = rTargetFirstMasterFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstMasterLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstMasterLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), FirstMasterLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), FirstMasterLRSpace.ResolveRight({}));
//mirror effect should be present
const SvxLRSpaceItem FirstLeftLRSpace = rTargetFirstLeftFormat.GetLRSpace();
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstLeftLRSpace.GetLeft());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstLeftLRSpace.GetRight());
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveRight({}), FirstLeftLRSpace.ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(horizontalSpace.ResolveLeft({}), FirstLeftLRSpace.ResolveRight({}));
//Checking vertical spaces
const SvxULSpaceItem MasterULSpace = rTargetMasterFormat.GetULSpace();
CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), MasterULSpace.GetUpper());

View file

@ -989,13 +989,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testInsertAutoTextIntoListFromParaStyle)
CPPUNIT_ASSERT_EQUAL(u"Default Paragraph Style"_ustr, rNode.GetTextColl()->GetName());
CPPUNIT_ASSERT(rNode.GetText().startsWith("As more applicants applied"));
CPPUNIT_ASSERT_EQUAL(pNumRule, rNode.GetNumRule());
CPPUNIT_ASSERT_EQUAL(pTextLeftMargin->GetTextLeft(),
rNode.GetAttr(RES_MARGIN_TEXTLEFT).GetTextLeft());
CPPUNIT_ASSERT_DOUBLES_EQUAL(
pFirstLineIndent->GetTextFirstLineOffsetValue(),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).GetTextFirstLineOffsetValue(), 0.01);
CPPUNIT_ASSERT_EQUAL(pFirstLineIndent->GetTextFirstLineOffsetUnit(),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).GetTextFirstLineOffsetUnit());
CPPUNIT_ASSERT_EQUAL(pTextLeftMargin->ResolveTextLeft({}),
rNode.GetAttr(RES_MARGIN_TEXTLEFT).ResolveTextLeft({}));
CPPUNIT_ASSERT_EQUAL(pFirstLineIndent->ResolveTextFirstLineOffset({}),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).ResolveTextFirstLineOffset({}));
}
pWrtShell->FwdPara();
@ -1018,13 +1015,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testInsertAutoTextIntoListFromParaStyle)
CPPUNIT_ASSERT_EQUAL(u"ListAndIndents"_ustr, rNode.GetTextColl()->GetName());
CPPUNIT_ASSERT(rNode.GetText().endsWith("as soon as we have come to a decision."));
CPPUNIT_ASSERT_EQUAL(pNumRule, rNode.GetNumRule());
CPPUNIT_ASSERT_EQUAL(pTextLeftMargin->GetTextLeft(),
rNode.GetAttr(RES_MARGIN_TEXTLEFT).GetTextLeft());
CPPUNIT_ASSERT_DOUBLES_EQUAL(
pFirstLineIndent->GetTextFirstLineOffsetValue(),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).GetTextFirstLineOffsetValue(), 0.01);
CPPUNIT_ASSERT_EQUAL(pFirstLineIndent->GetTextFirstLineOffsetUnit(),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).GetTextFirstLineOffsetUnit());
CPPUNIT_ASSERT_EQUAL(pTextLeftMargin->ResolveTextLeft({}),
rNode.GetAttr(RES_MARGIN_TEXTLEFT).ResolveTextLeft({}));
CPPUNIT_ASSERT_EQUAL(pFirstLineIndent->ResolveTextFirstLineOffset({}),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).ResolveTextFirstLineOffset({}));
}
pWrtShell->FwdPara();
@ -1047,13 +1041,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testInsertAutoTextIntoListFromParaStyle)
CPPUNIT_ASSERT_EQUAL(u"ListAndIndents"_ustr, rNode.GetTextColl()->GetName());
CPPUNIT_ASSERT_EQUAL(u"more"_ustr, rNode.GetText()); // pre-existing list item
CPPUNIT_ASSERT_EQUAL(pNumRule, rNode.GetNumRule());
CPPUNIT_ASSERT_EQUAL(pTextLeftMargin->GetTextLeft(),
rNode.GetAttr(RES_MARGIN_TEXTLEFT).GetTextLeft());
CPPUNIT_ASSERT_DOUBLES_EQUAL(
pFirstLineIndent->GetTextFirstLineOffsetValue(),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).GetTextFirstLineOffsetValue(), 0.01);
CPPUNIT_ASSERT_EQUAL(pFirstLineIndent->GetTextFirstLineOffsetUnit(),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).GetTextFirstLineOffsetUnit());
CPPUNIT_ASSERT_EQUAL(pTextLeftMargin->ResolveTextLeft({}),
rNode.GetAttr(RES_MARGIN_TEXTLEFT).ResolveTextLeft({}));
CPPUNIT_ASSERT_EQUAL(pFirstLineIndent->ResolveTextFirstLineOffset({}),
rNode.GetAttr(RES_MARGIN_FIRSTLINE).ResolveTextFirstLineOffset({}));
}
}

View file

@ -143,8 +143,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121734)
CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_LR_SPACE, false, &pItem));
auto pLR = static_cast<const SvxLRSpaceItem*>(pItem);
CPPUNIT_ASSERT(pLR);
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pLR->GetLeft());
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pLR->GetRight());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pLR->ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pLR->ResolveRight({}));
CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_UL_SPACE, false, &pItem));
auto pUL = static_cast<const SvxULSpaceItem*>(pItem);
@ -209,8 +209,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122425_1)
CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_LR_SPACE, false, &pItem));
auto pLR = static_cast<const SvxLRSpaceItem*>(pItem);
CPPUNIT_ASSERT(pLR);
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pLR->GetLeft());
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pLR->GetRight());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pLR->ResolveLeft({}));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pLR->ResolveRight({}));
CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_UL_SPACE, false, &pItem));
auto pUL = static_cast<const SvxULSpaceItem*>(pItem);

View file

@ -674,7 +674,8 @@ 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, SvxIndentValue::zero(), RES_LR_SPACE));
SetFormatAttr(SvxLRSpaceItem(SvxIndentValue::twips(nSize), SvxIndentValue::twips(nSize),
SvxIndentValue::zero(), RES_LR_SPACE));
SetFormatAttr(SvxULSpaceItem(nSize, nSize, RES_UL_SPACE));
}

View file

@ -2462,7 +2462,7 @@ bool SwCursorShell::SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode )
SvxFirstLineIndentItem firstLine(pCNd->GetAttr(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem leftMargin(pCNd->GetAttr(RES_MARGIN_TEXTLEFT));
firstLine.SetTextFirstLineOffset(SvxIndentValue::zero());
leftMargin.SetTextLeft(aFPos.nTabCnt);
leftMargin.SetTextLeft(SvxIndentValue::twips(aFPos.nTabCnt));
aSet.Put(firstLine);
aSet.Put(leftMargin);

View file

@ -115,8 +115,8 @@ namespace
// page style
const SwFrameFormat& rPgDscFormat = rDoc.GetPageDesc( 0 ).GetMaster();
const SvxLRSpaceItem& rLR = rPgDscFormat.GetLRSpace();
const tools::Long nLeft = rLR.GetLeft();
const tools::Long nRight = rLR.GetRight();
const tools::Long nLeft = rLR.ResolveLeft({});
const tools::Long nRight = rLR.ResolveRight({});
const tools::Long nWidth = rPgDscFormat.GetFrameSize().GetWidth();
return nWidth - nLeft - nRight;
}
@ -215,7 +215,7 @@ namespace
firstLine.SetTextFirstLineOffset(
SvxIndentValue{ static_cast<double>(rNFormat.GetFirstLineOffset()),
rNFormat.GetFirstLineOffsetUnit() });
leftMargin.SetTextLeft(rNFormat.GetAbsLSpace());
leftMargin.SetTextLeft(SvxIndentValue::twips(rNFormat.GetAbsLSpace()));
pColl->SetFormatAttr(firstLine);
pColl->SetFormatAttr(leftMargin);
}
@ -234,7 +234,7 @@ namespace
{
sal_uInt16 nLeft = o3tl::convert(5 * nFact, o3tl::Length::mm, o3tl::Length::twip);
SvxFirstLineIndentItem const firstLine(RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(nLeft, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(nLeft), RES_MARGIN_TEXTLEFT);
rSet.Put(firstLine);
rSet.Put(leftMargin);
if( bHeader )
@ -260,7 +260,7 @@ namespace
{
SvxFirstLineIndentItem firstLine(SvxIndentValue::twips(nEZ), RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(sal_uInt16(nLeft), RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(nLeft), RES_MARGIN_TEXTLEFT);
rSet.Put(firstLine);
rSet.Put(leftMargin);
SvxULSpaceItem aUL( RES_UL_SPACE );
@ -714,7 +714,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
auto const first(o3tl::convert(5, o3tl::Length::mm, o3tl::Length::twip));
SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(0, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::zero(), RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
aSet.Put(leftMargin);
}
@ -725,7 +725,8 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
auto const left(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip));
SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(left),
RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
aSet.Put(leftMargin);
@ -738,7 +739,8 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
{
auto const left(o3tl::convert(5, o3tl::Length::mm, o3tl::Length::twip));
SvxFirstLineIndentItem const firstLine(RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(left),
RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
aSet.Put(leftMargin);
}
@ -750,7 +752,8 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
auto const left(o3tl::convert(5, o3tl::Length::cm, o3tl::Length::twip));
SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(left),
RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
aSet.Put(leftMargin);
@ -763,7 +766,8 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
{
auto const left(o3tl::convert(4, o3tl::Length::cm, o3tl::Length::twip));
SvxFirstLineIndentItem const firstLine(RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(left),
RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
aSet.Put(leftMargin);
}
@ -959,7 +963,8 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
auto const left(o3tl::convert(6, o3tl::Length::mm, o3tl::Length::twip));
SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(first),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(left),
RES_MARGIN_TEXTLEFT);
aSet.Put(firstLine);
aSet.Put(leftMargin);
@ -1025,8 +1030,10 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
// tdf#159531: Paddings added to ease readability on comments
// Left and Right margin (i.e. Before and After text indent)
auto const aIndent(o3tl::convert(0.1, o3tl::Length::cm, o3tl::Length::twip));
SvxTextLeftMarginItem const leftMargin(aIndent, RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(aIndent, RES_MARGIN_RIGHT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(aIndent),
RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(SvxIndentValue::twips(aIndent),
RES_MARGIN_RIGHT);
aSet.Put(leftMargin);
aSet.Put(rightMargin);
@ -1401,8 +1408,10 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
auto const left(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip));
auto const right(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip));
SvxFirstLineIndentItem const firstLine(RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(right, RES_MARGIN_RIGHT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(left),
RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(SvxIndentValue::twips(right),
RES_MARGIN_RIGHT);
aSet.Put(firstLine);
aSet.Put(leftMargin);
aSet.Put(rightMargin);
@ -1456,7 +1465,8 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
{
// We indent by 1 cm. The IDs are always 2 away from each other!
auto const left(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip));
SvxTextLeftMarginItem const leftMargin(left, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(left),
RES_MARGIN_TEXTLEFT);
aSet.Put(leftMargin);
}
break;
@ -1466,7 +1476,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
pNewColl->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_HTML_DD ));
}
// We indent by 0 cm. The IDs are always 2 away from each other!
SvxTextLeftMarginItem const leftMargin(0, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::zero(), RES_MARGIN_TEXTLEFT);
aSet.Put(leftMargin);
}
break;
@ -1684,7 +1694,8 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
aBox.SetLine( &aLine, SvxBoxItemLine::RIGHT );
aBox.SetAllDistances( 85 );
aSet.Put( aBox );
aSet.Put(SvxLRSpaceItem(114, 114, SvxIndentValue::zero(), RES_LR_SPACE));
aSet.Put(SvxLRSpaceItem(SvxIndentValue::twips(114), SvxIndentValue::twips(114),
SvxIndentValue::zero(), RES_LR_SPACE));
aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) );
}
@ -1706,7 +1717,8 @@ 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, SvxIndentValue::zero(), RES_LR_SPACE));
aSet.Put(SvxLRSpaceItem(SvxIndentValue::zero(), SvxIndentValue::zero(),
SvxIndentValue::zero(), RES_LR_SPACE));
if ( RES_POOLFRM_INLINE_HEADING == nId )
{
@ -1747,7 +1759,8 @@ 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, SvxIndentValue::zero(), RES_LR_SPACE));
aSet.Put(SvxLRSpaceItem(SvxIndentValue::twips(114), SvxIndentValue::twips(114),
SvxIndentValue::zero(), RES_LR_SPACE));
SvxProtectItem aProtect( RES_PROTECT );
aProtect.SetSizeProtect( true );
@ -1815,13 +1828,13 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
SvxLRSpaceItem aLR( RES_LR_SPACE );
{
aLR.SetLeft(o3tl::convert(2, o3tl::Length::cm, o3tl::Length::twip));
aLR.SetLeft(SvxIndentValue::twips(o3tl::convert(2, o3tl::Length::cm, o3tl::Length::twip)));
aLR.SetRight(aLR.GetLeft());
}
SvxULSpaceItem aUL( RES_UL_SPACE );
{
aUL.SetUpper( o3tl::narrowing<sal_uInt16>(aLR.GetLeft()) );
aUL.SetLower( o3tl::narrowing<sal_uInt16>(aLR.GetLeft()) );
aUL.SetUpper(o3tl::narrowing<sal_uInt16>(aLR.ResolveLeft({})));
aUL.SetLower(o3tl::narrowing<sal_uInt16>(aLR.ResolveLeft({})));
}
SwAttrSet aSet( m_rDoc.GetAttrPool(), aPgFrameFormatSetRange );
@ -1877,7 +1890,8 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) );
LandscapeSwap( aPSize );
aSet.Put( SwFormatFrameSize( SwFrameSize::Fixed, aPSize.Width(), aPSize.Height() ));
aLR.SetLeft( 0 ); aLR.SetRight( 0 );
aLR.SetLeft(SvxIndentValue::zero());
aLR.SetRight(SvxIndentValue::zero());
aUL.SetUpper( 0 ); aUL.SetLower( 0 );
aSet.Put( aLR );
aSet.Put( aUL );
@ -1890,9 +1904,10 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
case RES_POOLPAGE_HTML: // "HTML"
{
lcl_PutStdPageSizeIntoItemSet( m_rDoc, aSet );
aLR.SetRight(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip));
aUL.SetUpper( o3tl::narrowing<sal_uInt16>(aLR.GetRight()) );
aUL.SetLower( o3tl::narrowing<sal_uInt16>(aLR.GetRight()) );
aLR.SetRight(
SvxIndentValue::twips(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip)));
aUL.SetUpper(o3tl::narrowing<sal_uInt16>(aLR.ResolveRight({})));
aUL.SetLower(o3tl::narrowing<sal_uInt16>(aLR.ResolveRight({})));
aSet.Put( aLR );
aSet.Put( aUL );

View file

@ -109,8 +109,8 @@ static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId,
aUL.SetUpper( o3tl::narrowing<sal_uInt16>(nMinTop) );
aUL.SetLower( o3tl::narrowing<sal_uInt16>(nMinBottom) );
aLR.SetRight( nMinRight );
aLR.SetLeft( nMinLeft );
aLR.SetRight(SvxIndentValue::twips(nMinRight));
aLR.SetLeft(SvxIndentValue::twips(nMinLeft));
rFormat1.SetFormatAttr( aFrameSize );
rFormat1.SetFormatAttr( aLR );

View file

@ -1703,7 +1703,8 @@ void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
{
if (indents & ::sw::ListLevelIndents::LeftMargin)
{
leftMargin.SetTextLeft(rFormat.GetIndentAt());
leftMargin.SetTextLeft(
SvxIndentValue::twips(rFormat.GetIndentAt()));
}
if (indents & ::sw::ListLevelIndents::FirstLine)
{
@ -1716,7 +1717,7 @@ void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
}
}
tools::Long nNext = leftMargin.GetTextLeft();
tools::Long nNext = leftMargin.ResolveTextLeft({});
if( bModulus )
nNext = ( nNext / nDefDist ) * nDefDist;
@ -1726,7 +1727,7 @@ void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
if(nNext >0) // fdo#75936 set limit for decreasing indent
nNext -= nDefDist;
leftMargin.SetTextLeft( nNext );
leftMargin.SetTextLeft(SvxIndentValue::twips(nNext));
SwRegHistory aRegH( pTNd, *pTNd, pHistory );
pTNd->SetAttr(firstLine);

View file

@ -251,10 +251,10 @@ void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rH
// We had a relative value -> recalculate
if (100 != pOldFirstLineIndent->GetPropTextFirstLineOffset())
{
const double dOld = pOldFirstLineIndent->GetTextFirstLineOffsetValue();
const auto stOld = pOldFirstLineIndent->GetTextFirstLineOffset();
aNew.SetTextFirstLineOffset(pNewFirstLineIndent->GetTextFirstLineOffset(),
pOldFirstLineIndent->GetPropTextFirstLineOffset());
bChg = dOld != aNew.GetTextFirstLineOffsetValue();
bChg = (stOld != aNew.GetTextFirstLineOffset());
}
if( bChg )
{
@ -274,10 +274,10 @@ void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rH
if (100 != pOldTextLeftMargin->GetPropLeft())
{
// note: changing from Left to TextLeft - looked wrong with Left
const tools::Long nOld = pOldTextLeftMargin->GetTextLeft();
const auto stOld = pOldTextLeftMargin->GetTextLeft();
aNew.SetTextLeft(pNewTextLeftMargin->GetTextLeft(),
pOldTextLeftMargin->GetPropLeft());
bChg = nOld != aNew.GetTextLeft();
bChg = (stOld != aNew.GetTextLeft());
}
if( bChg )
{
@ -296,9 +296,9 @@ void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rH
// We had a relative value -> recalculate
if (100 != pOldRightMargin->GetPropRight())
{
const tools::Long nOld = pOldRightMargin->GetRight();
const auto stOld = pOldRightMargin->GetRight();
aNew.SetRight(pNewRightMargin->GetRight(), pOldRightMargin->GetPropRight());
bChg = nOld != aNew.GetRight();
bChg = (stOld != aNew.GetRight());
}
if( bChg )
{

View file

@ -2654,12 +2654,12 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp
{
// silence -Wsign-compare on Android with the static cast
bRet = rSz.GetWidth() < static_cast<unsigned short>(USHRT_MAX) - nRelDiff;
bChgLRSpace = bLeft ? rLR.GetLeft() >= nAbsDiff
: rLR.GetRight() >= nAbsDiff;
bChgLRSpace = bLeft ? rLR.ResolveLeft({}) >= nAbsDiff
: rLR.ResolveRight({}) >= nAbsDiff;
}
else
bRet = bLeft ? rLR.GetLeft() >= nAbsDiff
: rLR.GetRight() >= nAbsDiff;
bRet = bLeft ? rLR.ResolveLeft({}) >= nAbsDiff
: rLR.ResolveRight({}) >= nAbsDiff;
if( !bRet )
{
@ -2714,21 +2714,25 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp
}
if( bLeft )
aLR.SetLeft( sal_uInt16( aLR.GetLeft() - nAbsDiff ) );
aLR.SetLeft(
SvxIndentValue::twips(sal_uInt16(aLR.ResolveLeft({}) - nAbsDiff)));
else
aLR.SetRight( sal_uInt16( aLR.GetRight() - nAbsDiff ) );
aLR.SetRight(
SvxIndentValue::twips(sal_uInt16(aLR.ResolveRight({}) - nAbsDiff)));
}
else if( bLeft )
aLR.SetLeft( sal_uInt16( aLR.GetLeft() + nAbsDiff ) );
aLR.SetLeft(SvxIndentValue::twips(sal_uInt16(aLR.ResolveLeft({}) + nAbsDiff)));
else
aLR.SetRight( sal_uInt16( aLR.GetRight() + nAbsDiff ) );
aLR.SetRight(
SvxIndentValue::twips(sal_uInt16(aLR.ResolveRight({}) + nAbsDiff)));
if( bChgLRSpace )
GetFrameFormat()->SetFormatAttr( aLR );
const SwFormatHoriOrient& rHOri = GetFrameFormat()->GetHoriOrient();
if( text::HoriOrientation::FULL == rHOri.GetHoriOrient() ||
(text::HoriOrientation::LEFT == rHOri.GetHoriOrient() && aLR.GetLeft()) ||
(text::HoriOrientation::RIGHT == rHOri.GetHoriOrient() && aLR.GetRight()))
if (text::HoriOrientation::FULL == rHOri.GetHoriOrient()
|| (text::HoriOrientation::LEFT == rHOri.GetHoriOrient() && aLR.ResolveLeft({}))
|| (text::HoriOrientation::RIGHT == rHOri.GetHoriOrient()
&& aLR.ResolveRight({})))
{
SwFormatHoriOrient aHOri( rHOri );
aHOri.SetHoriOrient( text::HoriOrientation::NONE );
@ -2759,8 +2763,9 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp
aSz.SetWidth( aSz.GetWidth() - nRelDiff );
if (rSz.GetWidthPercent())
aSz.SetWidthPercent( static_cast<sal_uInt8>(( aSz.GetWidth() * 100 ) /
( aSz.GetWidth() + aLR.GetRight() + aLR.GetLeft())));
aSz.SetWidthPercent(static_cast<sal_uInt8>(
(aSz.GetWidth() * 100)
/ (aSz.GetWidth() + aLR.ResolveRight({}) + aLR.ResolveLeft({}))));
GetFrameFormat()->SetFormatAttr( aSz );

View file

@ -1370,7 +1370,7 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape, SdrObject* pOb
// tdf#152142: For RTL, positioning is relative to the right
if (pShape->GetLayoutDir() == SwFrameFormat::HORI_R2L)
{
auto nRightSpace = pShape->GetLRSpace().GetRight();
auto nRightSpace = pShape->GetLRSpace().ResolveRight({});
const bool bMSOLayout = pFormat->getIDocumentSettingAccess().get(
DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS);
@ -1387,7 +1387,7 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape, SdrObject* pOb
}
else
{
auto nLeftSpace = pShape->GetLRSpace().GetLeft();
auto nLeftSpace = pShape->GetLRSpace().ResolveLeft({});
aNewHOri.SetPos(aRect.Left() + nLeftSpace
+ (bIsGroupObj ? pObj->GetRelativePos().getX() : 0));
}

View file

@ -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,
pTableFormat->SetFormatAttr(SvxLRSpaceItem(
SvxIndentValue::twips(nSttPos), SvxIndentValue::twips(nFrameWidth - nLastPos),
SvxIndentValue::zero(), RES_LR_SPACE));
}
nWidth = nLastPos - nSttPos;

View file

@ -1486,7 +1486,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
nLeftTextPos -= m_pCurTextFrame->GetTextNodeForParaProps()
->GetSwAttrSet()
.GetTextLeftMargin()
.GetLeft(m_pCurTextFrame->GetTextNodeForParaProps()
.ResolveLeft(m_pCurTextFrame->GetTextNodeForParaProps()
->GetSwAttrSet()
.GetFirstLineIndent(),
/*metrics*/ {});
@ -2516,10 +2516,10 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags aFlags,
// Unit conversion is not needed here: check the sign only
double dIndentValue = 0.0;
if (pFirstLineIndent)
dIndentValue = pFirstLineIndent->GetTextFirstLineOffsetValue();
dIndentValue = pFirstLineIndent->GetTextFirstLineOffset().m_dValue;
if (0.0 != dIndentValue
|| (pTextLeftMargin && 0 != pTextLeftMargin->GetTextLeft()))
|| (pTextLeftMargin && (0.0 != pTextLeftMargin->GetTextLeft().m_dValue)))
{
// exception: numbering/enumeration can have an indentation
if (IsEnumericChar(*m_pCurTextFrame))
@ -2542,7 +2542,9 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags aFlags,
BuildIndent();
else if (0.0 > dIndentValue) // negative 1st line indentation
BuildNegIndent( aFInfo.GetLineStart() );
else if (pTextLeftMargin && pTextLeftMargin->GetTextLeft() != 0) // is indentation
else if (pTextLeftMargin
&& (pTextLeftMargin->GetTextLeft().m_dValue
!= 0.0)) // is indentation
BuildTextIndent();
}
eStat = READ_NEXT_PARA;
@ -2760,11 +2762,12 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags aFlags,
// Unit conversion is not needed here: check the sign only
double dIndentValue = 0.0;
if (pFirstLineIndent)
dIndentValue = pFirstLineIndent->GetTextFirstLineOffsetValue();
dIndentValue = pFirstLineIndent->GetTextFirstLineOffset().m_dValue;
if (bReplaceStyles
&& (0.0 != dIndentValue
|| (pTextLeftMargin && 0 != pTextLeftMargin->GetTextLeft())))
|| (pTextLeftMargin
&& (0.0 != pTextLeftMargin->GetTextLeft().m_dValue))))
{
// then use one of our templates
if (0.0 < dIndentValue) // positive 1st line indentation
@ -2773,7 +2776,9 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags aFlags,
{
BuildNegIndent( aFInfo.GetLineStart() );
}
else if (pTextLeftMargin && pTextLeftMargin->GetTextLeft()) // is indentation
else if (pTextLeftMargin
&& (0.0
!= pTextLeftMargin->GetTextLeft().m_dValue)) // is indentation
BuildTextIndent();
else
BuildText();

View file

@ -511,7 +511,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
const SvxLRSpaceItem& rLS = pCNd->GetAttr( RES_LR_SPACE );
if( bRight )
{
tools::Long nNext = rLS.GetTextLeft() + nDefDist;
tools::Long nNext = rLS.ResolveTextLeft({}) + nDefDist;
if( bModulus )
nNext = ( nNext / nDefDist ) * nDefDist;
SwFrame* pFrame = pCNd->getLayoutFrame( GetLayout() );

View file

@ -581,9 +581,9 @@ const SwRect& SwAnchoredObject::GetObjRectWithSpaces() const
maObjRectWithSpaces.Top(std::max(
maObjRectWithSpaces.Top() - tools::Long(rUL.GetUpper()), tools::Long(0)));
maObjRectWithSpaces.Left(
std::max(maObjRectWithSpaces.Left() - rLR.GetLeft(), tools::Long(0)));
std::max(maObjRectWithSpaces.Left() - rLR.ResolveLeft({}), tools::Long(0)));
maObjRectWithSpaces.AddHeight(rUL.GetLower());
maObjRectWithSpaces.AddWidth(rLR.GetRight());
maObjRectWithSpaces.AddWidth(rLR.ResolveRight({}));
}
mbObjRectWithSpacesValid = true;

View file

@ -389,23 +389,23 @@ void SwLayoutFrame::AdjustColumns( const SwFormatCol *pAttr, bool bAdjustAttribu
const sal_uInt16 nLeft = pC->GetLeft();
const sal_uInt16 nRight = pC->GetRight();
aLR.SetLeft ( nLeft );
aLR.SetRight( nRight );
aLR.SetLeft(SvxIndentValue::twips(nLeft));
aLR.SetRight(SvxIndentValue::twips(nRight));
if ( bLine )
{
if ( i == 0 )
{
aLR.SetRight( std::max( nRight, nMin ) );
aLR.SetRight(SvxIndentValue::twips(std::max(nRight, nMin)));
}
else if ( i == pAttr->GetNumCols() - 1 )
{
aLR.SetLeft ( std::max( nLeft, nMin ) );
aLR.SetLeft(SvxIndentValue::twips(std::max(nLeft, nMin)));
}
else
{
aLR.SetLeft ( std::max( nLeft, nMin ) );
aLR.SetRight( std::max( nRight, nMin ) );
aLR.SetLeft(SvxIndentValue::twips(std::max(nLeft, nMin)));
aLR.SetRight(SvxIndentValue::twips(std::max(nRight, nMin)));
}
}
@ -419,7 +419,7 @@ void SwLayoutFrame::AdjustColumns( const SwFormatCol *pAttr, bool bAdjustAttribu
static_cast<SwLayoutFrame*>(pCol)->GetFormat()->SetFormatAttr( aUL );
}
nGutter += aLR.GetLeft() + aLR.GetRight();
nGutter += aLR.ResolveLeft({}) + aLR.ResolveRight({});
}
pCol = bR2L ? pCol->GetPrev() : pCol->GetNext();
@ -438,7 +438,7 @@ void SwLayoutFrame::AdjustColumns( const SwFormatCol *pAttr, bool bAdjustAttribu
else
{
SvxLRSpaceItem aLR( pCol->GetAttrSet()->GetLRSpace() );
nWidth = nInnerWidth + aLR.GetLeft() + aLR.GetRight();
nWidth = nInnerWidth + aLR.ResolveLeft({}) + aLR.ResolveRight({});
}
if( nWidth < 0 )
nWidth = 0;

View file

@ -982,8 +982,8 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) ) );
aOld.AddHeight(rUL.GetLower() );
const SvxLRSpaceItem &rLR = static_cast<const SwFormatChg*>(pOld)->pChangedFormat->GetLRSpace();
aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) );
aOld.AddWidth(rLR.GetRight() );
aOld.Left(std::max(aOld.Left() - rLR.ResolveLeft({}), tools::Long(0)));
aOld.AddWidth(rLR.ResolveRight({}));
aNew.Union( aOld );
NotifyBackground( FindPageFrame(), aNew, PrepareHint::Clear );
@ -1106,8 +1106,8 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
else
{
const SvxLRSpaceItem &rLR = *static_cast<const SvxLRSpaceItem*>(pNew);
aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) );
aOld.AddWidth(rLR.GetRight() );
aOld.Left(std::max(aOld.Left() - rLR.ResolveLeft({}), tools::Long(0)));
aOld.AddWidth(rLR.ResolveRight({}));
}
}
aNew.Union( aOld );
@ -3018,7 +3018,7 @@ static SwTwips lcl_CalcAutoWidth( const SwLayoutFrame& rFrame )
SvxRightMarginItem const& rRightMargin(rParaSet.GetRightMargin());
if (!static_cast<const SwTextFrame*>(pFrame)->IsLocked())
{
nMin += rRightMargin.GetRight() + rLeftMargin.GetTextLeft()
nMin += rRightMargin.ResolveRight({}) + rLeftMargin.ResolveTextLeft({})
+ rFirstLine.ResolveTextFirstLineOffset({});
}
}

View file

@ -2351,17 +2351,19 @@ tools::Long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const
// for paragraphs, "left" is "before text" and "right" is "after text"
if (pCaller->IsTextFrame())
{
// tdf#163913: Only apply the fixed-width part of the margin here.
// Font-relative margins will be applied as an adjustment later on.
if (pCaller->IsRightToLeft())
{
nRight += m_pTextLeftMargin->GetLeft(*m_pFirstLineIndent, /*metrics*/ {});
nRight += m_pTextLeftMargin->ResolveLeftFixedPart(*m_pFirstLineIndent);
}
else
{
nRight += m_pRightMargin->GetRight();
nRight += m_pRightMargin->ResolveRightFixedPart();
}
}
else
nRight += m_xLR->GetRight();
nRight += m_xLR->ResolveRight({});
// correction: retrieve left margin for numbering in R2L-layout
if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
@ -2402,16 +2404,23 @@ tools::Long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
}
// for paragraphs, "left" is "before text" and "right" is "after text"
// tdf#163913: Only apply the fixed-width part of the margin here.
// Font-relative margins will be applied as an adjustment later on.
if (pCaller->IsTextFrame() && pCaller->IsRightToLeft())
nLeft += m_pRightMargin->GetRight();
{
nLeft += m_pRightMargin->ResolveRightFixedPart();
}
else
{
if (pCaller->IsTextFrame())
{
nLeft += m_pTextLeftMargin->GetLeft(*m_pFirstLineIndent, /*metrics*/ {});
nLeft += m_pTextLeftMargin->ResolveLeftFixedPart(*m_pFirstLineIndent);
}
else
nLeft += m_xLR->GetLeft();
{
nLeft += m_xLR->ResolveLeft({});
}
}
// correction: do not retrieve left margin for numbering in R2L-layout
@ -3249,8 +3258,8 @@ void Notify( SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld,
const SwRect aFrame( pFly->GetObjRectWithSpaces() );
if ( rOld.Pos() != aFrame.Pos() )
{ // changed position, invalidate old and new area
if ( rOld.HasArea() &&
rOld.Left()+pFly->GetFormat()->GetLRSpace().GetLeft() < FAR_AWAY )
if (rOld.HasArea()
&& rOld.Left() + pFly->GetFormat()->GetLRSpace().ResolveLeft({}) < FAR_AWAY)
{
pFly->NotifyBackground( pOld, rOld, PrepareHint::FlyFrameLeave );
}

View file

@ -139,8 +139,8 @@ void SwSectionFrame::Init()
{
SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
aRectFnSet.SetLeft( aPrt, rLRSpace.GetLeft() );
aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
aRectFnSet.SetLeft(aPrt, rLRSpace.ResolveLeft({}));
aRectFnSet.SetWidth(aPrt, nWidth - rLRSpace.ResolveLeft({}) - rLRSpace.ResolveRight({}));
aRectFnSet.SetHeight( aPrt, 0 );
}
@ -1453,7 +1453,7 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
// #109700# LRSpace for sections
const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace();
aRectFnSet.SetXMargins( *this, rLRSpace.GetLeft(), rLRSpace.GetRight() );
aRectFnSet.SetXMargins(*this, rLRSpace.ResolveLeft({}), rLRSpace.ResolveRight({}));
if( nUpper != aRectFnSet.GetTopMargin(*this) )
{
@ -1515,7 +1515,8 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
{
const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace();
SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
aRectFnSet.SetWidth(aPrt,
nWidth - rLRSpace.ResolveLeft({}) - rLRSpace.ResolveRight({}));
}
// OD 15.10.2002 #103517# - allow grow in online layout

View file

@ -389,9 +389,8 @@ SwTwips SwAnchoredObjectPosition::GetVertRelPos(
case text::VertOrientation::TOP:
{
nRelPosY += aRectFnSet.IsVert()
? ( aRectFnSet.IsVertL2R()
? _rLRSpacing.GetLeft()
: _rLRSpacing.GetRight() )
? (aRectFnSet.IsVertL2R() ? _rLRSpacing.ResolveLeft({})
: _rLRSpacing.ResolveRight({}))
: _rULSpacing.GetUpper();
}
break;
@ -402,11 +401,11 @@ SwTwips SwAnchoredObjectPosition::GetVertRelPos(
break;
case text::VertOrientation::BOTTOM:
{
nRelPosY += nAlignAreaHeight -
( nObjHeight + ( aRectFnSet.IsVert()
? ( aRectFnSet.IsVertL2R()
? _rLRSpacing.GetRight()
: _rLRSpacing.GetLeft() )
nRelPosY += nAlignAreaHeight
- (nObjHeight
+ (aRectFnSet.IsVert()
? (aRectFnSet.IsVertL2R() ? _rLRSpacing.ResolveRight({})
: _rLRSpacing.ResolveLeft({}))
: _rULSpacing.GetLower()));
}
break;
@ -924,11 +923,12 @@ SwTwips SwAnchoredObjectPosition::CalcRelPosX(
else if ( text::HoriOrientation::CENTER == eHoriOrient )
nRelPosX += (nWidth / 2) - (nObjWidth / 2);
else if (text::HoriOrientation::RIGHT == eHoriOrient)
nRelPosX += nWidth -
( nObjWidth +
( aRectFnSet.IsVert() ? _rULSpacing.GetLower() : _rLRSpacing.GetRight() ) );
nRelPosX
+= nWidth
- (nObjWidth
+ (aRectFnSet.IsVert() ? _rULSpacing.GetLower() : _rLRSpacing.ResolveRight({})));
else
nRelPosX += aRectFnSet.IsVert() ? _rULSpacing.GetUpper() : _rLRSpacing.GetLeft();
nRelPosX += aRectFnSet.IsVert() ? _rULSpacing.GetUpper() : _rLRSpacing.ResolveLeft({});
// adjust relative position by distance between anchor frame and
// the frame, the object is oriented at.
@ -1070,30 +1070,33 @@ SwTwips SwAnchoredObjectPosition::AdjustHoriRelPosForDrawAside(
else
{
const SvxLRSpaceItem& rOtherLR = pFly->GetFormat()->GetLRSpace();
const SwTwips nOtherLeft = pFly->getFrameArea().Left() - rOtherLR.GetLeft();
const SwTwips nOtherRight = pFly->getFrameArea().Right() + rOtherLR.GetRight();
if( nOtherLeft <= aTmpObjRect.Right() + _rLRSpacing.GetRight() &&
nOtherRight >= aTmpObjRect.Left() - _rLRSpacing.GetLeft() )
const SwTwips nOtherLeft = pFly->getFrameArea().Left() - rOtherLR.ResolveLeft({});
const SwTwips nOtherRight
= pFly->getFrameArea().Right() + rOtherLR.ResolveRight({});
if (nOtherLeft <= aTmpObjRect.Right() + _rLRSpacing.ResolveRight({})
&& nOtherRight >= aTmpObjRect.Left() - _rLRSpacing.ResolveLeft({}))
{
if ( _eHoriOrient == text::HoriOrientation::LEFT )
{
SwTwips nTmp = nOtherRight + 1 + _rLRSpacing.GetLeft() -
rAnchorTextFrame.getFrameArea().Left();
if ( nTmp > nAdjustedRelPosX &&
rAnchorTextFrame.getFrameArea().Left() + nTmp +
aObjBoundRect.Width() + _rLRSpacing.GetRight()
<= pObjPage->getFrameArea().Width() + pObjPage->getFrameArea().Left() )
SwTwips nTmp = nOtherRight + 1 + _rLRSpacing.ResolveLeft({})
- rAnchorTextFrame.getFrameArea().Left();
if (nTmp > nAdjustedRelPosX
&& rAnchorTextFrame.getFrameArea().Left() + nTmp + aObjBoundRect.Width()
+ _rLRSpacing.ResolveRight({})
<= pObjPage->getFrameArea().Width()
+ pObjPage->getFrameArea().Left())
{
nAdjustedRelPosX = nTmp;
}
}
else if ( _eHoriOrient == text::HoriOrientation::RIGHT )
{
SwTwips nTmp = nOtherLeft - 1 - _rLRSpacing.GetRight() -
aObjBoundRect.Width() -
rAnchorTextFrame.getFrameArea().Left();
if ( nTmp < nAdjustedRelPosX &&
rAnchorTextFrame.getFrameArea().Left() + nTmp - _rLRSpacing.GetLeft()
SwTwips nTmp = nOtherLeft - 1 - _rLRSpacing.ResolveRight({})
- aObjBoundRect.Width()
- rAnchorTextFrame.getFrameArea().Left();
if (nTmp < nAdjustedRelPosX
&& rAnchorTextFrame.getFrameArea().Left() + nTmp
- _rLRSpacing.ResolveLeft({})
>= pObjPage->getFrameArea().Left())
{
nAdjustedRelPosX = nTmp;

View file

@ -106,20 +106,20 @@ void SwAsCharAnchoredObjectPosition::CalcPosition()
// convert the spacing values
nLRSpaceLeft = rULSpace.GetUpper();
nLRSpaceRight = rULSpace.GetLower();
nULSpaceUpper = rLRSpace.GetRight();
nULSpaceLower = rLRSpace.GetLeft();
nULSpaceUpper = rLRSpace.ResolveRight({});
nULSpaceLower = rLRSpace.ResolveLeft({});
}
else
{
if ( rAnchorFrame.IsRightToLeft() )
{
nLRSpaceLeft = rLRSpace.GetRight();
nLRSpaceRight = rLRSpace.GetLeft();
nLRSpaceLeft = rLRSpace.ResolveRight({});
nLRSpaceRight = rLRSpace.ResolveLeft({});
}
else
{
nLRSpaceLeft = rLRSpace.GetLeft();
nLRSpaceRight = rLRSpace.GetRight();
nLRSpaceLeft = rLRSpace.ResolveLeft({});
nLRSpaceRight = rLRSpace.ResolveRight({});
}
nULSpaceUpper = rULSpace.GetUpper();
@ -308,8 +308,8 @@ void SwAsCharAnchoredObjectPosition::CalcPosition()
{
// recalculate object bound rectangle, if object width has changed.
aObjBoundRect = GetAnchoredObj().GetObjRect();
aObjBoundRect.AddLeft( - rLRSpace.GetLeft() );
aObjBoundRect.AddWidth( rLRSpace.GetRight() );
aObjBoundRect.AddLeft(-rLRSpace.ResolveLeft({}));
aObjBoundRect.AddWidth(rLRSpace.ResolveRight({}));
aObjBoundRect.AddTop( - rULSpace.GetUpper() );
aObjBoundRect.AddHeight( rULSpace.GetLower() );
}

View file

@ -307,16 +307,14 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
// determine relative vertical position
SwTwips nRelPosY = nAlignAreaOffset;
const SwTwips nObjHeight = aRectFnSet.GetHeight(aObjBoundRect);
const SwTwips nUpperSpace = aRectFnSet.IsVert()
? ( aRectFnSet.IsVertL2R()
? rLR.GetLeft()
: rLR.GetRight() )
const SwTwips nUpperSpace
= aRectFnSet.IsVert()
? (aRectFnSet.IsVertL2R() ? rLR.ResolveLeft({}) : rLR.ResolveRight({}))
: rUL.GetUpper();
// --> OD 2009-08-31 #monglianlayout#
const SwTwips nLowerSpace = aRectFnSet.IsVert()
? ( aRectFnSet.IsVertL2R()
? rLR.GetLeft()
: rLR.GetRight() )
const SwTwips nLowerSpace
= aRectFnSet.IsVert()
? (aRectFnSet.IsVertL2R() ? rLR.ResolveLeft({}) : rLR.ResolveRight({}))
: rUL.GetLower();
switch ( aVert.GetVertOrient() )
{

View file

@ -173,10 +173,11 @@ void SwToLayoutAnchoredObjectPosition::CalcPosition()
else if ( text::HoriOrientation::CENTER == eHoriOrient )
nRelPosX = (nWidth / 2) - (nObjWidth / 2);
else if (text::HoriOrientation::RIGHT == eHoriOrient)
nRelPosX = nWidth - ( nObjWidth +
( aRectFnSet.IsVert() ? rUL.GetLower() : rLR.GetRight() ) );
nRelPosX
= nWidth
- (nObjWidth + (aRectFnSet.IsVert() ? rUL.GetLower() : rLR.ResolveRight({})));
else
nRelPosX = aRectFnSet.IsVert() ? rUL.GetUpper() : rLR.GetLeft();
nRelPosX = aRectFnSet.IsVert() ? rUL.GetUpper() : rLR.ResolveLeft({});
nRelPosX += nOffset;
// no 'negative' relative horizontal position

View file

@ -854,8 +854,8 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
SwTwips nShRight = aSh.CalcShadowSpace( SvxShadowItemSide::RIGHT );
SwTwips nShLeft = aSh.CalcShadowSpace( SvxShadowItemSide::LEFT );
aLR.SetLeft ( rNew.GetLeft() - nShLeft );
aLR.SetRight( rNew.GetRightMax() - rNew.GetRight() - nShRight );
aLR.SetLeft(SvxIndentValue::twips(rNew.GetLeft() - nShLeft));
aLR.SetRight(SvxIndentValue::twips(rNew.GetRightMax() - rNew.GetRight() - nShRight));
pFormat->SetFormatAttr( aLR );
// The alignment of the table needs to be adjusted accordingly.

View file

@ -1483,9 +1483,9 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
rRect.Top( rRect.Top() + nFirst );
rRect.Height( nLineHeight );
SwTwips nLeft = rFill.Left() + rTextLeftMargin.GetLeft(rFirstLine, /*metrics*/ {})
SwTwips nLeft = rFill.Left() + rTextLeftMargin.ResolveLeft(rFirstLine, /*metrics*/ {})
+ GetTextNodeForParaProps()->GetLeftMarginWithNum();
SwTwips nRight = rFill.Right() - rRightMargin.GetRight();
SwTwips nRight = rFill.Right() - rRightMargin.ResolveRight({});
SwTwips nCenter = ( nLeft + nRight ) / 2;
rRect.Left( nLeft );
if( SwFillMode::Margin == rFill.Mode() )
@ -1555,8 +1555,8 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
}
else if( rFill.X() > nLeft )
{
SwTwips nTextLeft = rFill.Left() + rTextLeftMargin.GetTextLeft() +
GetTextNodeForParaProps()->GetLeftMarginWithNum(true);
SwTwips nTextLeft = rFill.Left() + rTextLeftMargin.ResolveTextLeft({})
+ GetTextNodeForParaProps()->GetLeftMarginWithNum(true);
rFill.nLineWidth += rFill.bFirstLine ? nLeft : nTextLeft;
SwTwips nLeftTab;
SwTwips nRightTab = nLeft;

View file

@ -559,7 +559,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
const SvxFirstLineIndentItem& rFirstLine(
GetTextNodeForParaProps()->GetSwAttrSet().GetFirstLineIndent());
if (0.0 < rFirstLine.GetTextFirstLineOffsetValue())
if (0.0 < rFirstLine.GetTextFirstLineOffset().m_dValue)
{
aPos.AdjustX(rFirstLine.ResolveTextFirstLineOffset({}));
}

View file

@ -1006,10 +1006,10 @@ static void lcl_MinMaxNode(SwFrameFormat* pNd, SwMinMaxNodeArgs& rIn)
}
const SvxLRSpaceItem &rLR = pNd->GetLRSpace();
nMin += rLR.GetLeft();
nMin += rLR.GetRight();
nMax += rLR.GetLeft();
nMax += rLR.GetRight();
nMin += rLR.ResolveLeft({});
nMin += rLR.ResolveRight({});
nMax += rLR.ResolveLeft({});
nMax += rLR.ResolveRight({});
if( css::text::WrapTextMode_THROUGH == pNd->GetSurround().GetSurround() )
{
@ -1082,7 +1082,7 @@ void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong
SvxTextLeftMarginItem const& rTextLeftMargin(GetSwAttrSet().GetTextLeftMargin());
SvxRightMarginItem const& rRightMargin(GetSwAttrSet().GetRightMargin());
tools::Long nLROffset = rTextLeftMargin.GetTextLeft() + GetLeftMarginWithNum( true );
tools::Long nLROffset = rTextLeftMargin.ResolveTextLeft({}) + GetLeftMarginWithNum(true);
short nFLOffs;
// For enumerations a negative first line indentation is probably filled already
if (!GetFirstLineOfsWithNum(nFLOffs, {}) || nFLOffs > nLROffset)
@ -1092,7 +1092,7 @@ void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong
aNodeArgs.m_nMinWidth = 0;
aNodeArgs.m_nMaxWidth = 0;
aNodeArgs.m_nLeftRest = nLROffset;
aNodeArgs.m_nRightRest = rRightMargin.GetRight();
aNodeArgs.m_nRightRest = rRightMargin.ResolveRight({});
aNodeArgs.m_nLeftDiff = 0;
aNodeArgs.m_nRightDiff = 0;
if( nIndex )
@ -1112,7 +1112,7 @@ void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong
aNodeArgs.m_nMaxWidth -= aNodeArgs.m_nLeftRest;
if (aNodeArgs.m_nRightRest < 0)
aNodeArgs.Minimum(rRightMargin.GetRight() - aNodeArgs.m_nRightRest);
aNodeArgs.Minimum(rRightMargin.ResolveRight({}) - aNodeArgs.m_nRightRest);
aNodeArgs.m_nRightRest -= aNodeArgs.m_nRightDiff;
if (aNodeArgs.m_nRightRest < 0)
aNodeArgs.m_nMaxWidth -= aNodeArgs.m_nRightRest;
@ -1234,8 +1234,8 @@ void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong
else
nCurrentWidth = pFrameFormat->GetFrameSize().GetWidth();
}
nCurrentWidth += rLR.GetLeft();
nCurrentWidth += rLR.GetRight();
nCurrentWidth += rLR.ResolveLeft({});
nCurrentWidth += rLR.ResolveRight({});
aArg.m_nWordAdd = nOldWidth + nOldAdd;
aArg.m_nWordWidth = nCurrentWidth;
aArg.m_nRowWidth += nCurrentWidth;
@ -1285,7 +1285,7 @@ void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong
if (static_cast<tools::Long>(rMax) < aArg.m_nRowWidth)
rMax = aArg.m_nRowWidth;
nLROffset += rRightMargin.GetRight();
nLROffset += rRightMargin.ResolveRight({});
rAbsMin += nLROffset;
rAbsMin += nAdd;

View file

@ -165,6 +165,8 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p
SvxFirstLineIndentItem const& rFirstLine(pNode->GetSwAttrSet().GetFirstLineIndent());
SvxTextLeftMarginItem const& rTextLeftMargin(pNode->GetSwAttrSet().GetTextLeftMargin());
SvxRightMarginItem const& rRightMargin(pNode->GetSwAttrSet().GetRightMargin());
// #i95907#
// #i111284#
const SwTextNode *pTextNode = m_pFrame->GetTextNodeForParaProps();
@ -187,14 +189,13 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p
if ( m_pFrame->IsRightToLeft() )
{
// this calculation is identical this the calculation for L2R layout - see below
mnLeft = m_pFrame->getFrameArea().Left() +
m_pFrame->getFramePrintArea().Left() +
nLMWithNum -
pNode->GetLeftMarginWithNum() -
mnLeft = m_pFrame->getFrameArea().Left() + m_pFrame->getFramePrintArea().Left() + nLMWithNum
- pNode->GetLeftMarginWithNum() -
// #i95907#
// #i111284#
// rSpace.GetLeft() + rSpace.GetTextLeft();
(rTextLeftMargin.GetLeft(rFirstLine, stMetrics) - rTextLeftMargin.GetTextLeft());
(rTextLeftMargin.ResolveLeft(rFirstLine, stMetrics)
- rTextLeftMargin.ResolveTextLeft(stMetrics));
}
else
{
@ -204,30 +205,36 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p
!pNode->getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) )
{
// this calculation is identical this the calculation for R2L layout - see above
mnLeft = m_pFrame->getFrameArea().Left() +
m_pFrame->getFramePrintArea().Left() +
nLMWithNum -
pNode->GetLeftMarginWithNum() -
mnLeft = m_pFrame->getFrameArea().Left() + m_pFrame->getFramePrintArea().Left()
+ nLMWithNum - pNode->GetLeftMarginWithNum() -
// #i95907#
// #i111284#
(rTextLeftMargin.GetLeft(rFirstLine, stMetrics) - rTextLeftMargin.GetTextLeft());
(rTextLeftMargin.ResolveLeft(rFirstLine, stMetrics)
- rTextLeftMargin.ResolveTextLeft(stMetrics));
}
else
{
mnLeft = m_pFrame->getFrameArea().Left() +
std::max(tools::Long(rTextLeftMargin.GetTextLeft() + nLMWithNum),
mnLeft
= m_pFrame->getFrameArea().Left()
+ std::max(tools::Long(rTextLeftMargin.ResolveTextLeft(stMetrics) + nLMWithNum),
m_pFrame->getFramePrintArea().Left());
}
}
mnRight = m_pFrame->getFrameArea().Left() + m_pFrame->getFramePrintArea().Left() + m_pFrame->getFramePrintArea().Width();
// tdf#163913: Apply font-relative adjustment to the margins
mnLeft += rTextLeftMargin.ResolveLeftVariablePart(rFirstLine, stMetrics);
mnRight -= rRightMargin.ResolveRightVariablePart(stMetrics);
if (mnLeft >= mnRight &&
// #i53066# Omit adjustment of nLeft for numbered
// paras inside cells inside new documents:
( pNode->getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ||
!m_pFrame->IsInTab() ||
(bListLevelIndentsApplicable && nLMWithNum == rTextLeftMargin.GetTextLeft())
(pNode->getIDocumentSettingAccess()->get(
DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING)
|| !m_pFrame->IsInTab()
|| (bListLevelIndentsApplicable
&& nLMWithNum == rTextLeftMargin.ResolveTextLeft(stMetrics))
|| (!bLabelAlignmentActive && nLMWithNum == 0)))
{
mnLeft = m_pFrame->getFramePrintArea().Left() + m_pFrame->getFrameArea().Left();
@ -323,8 +330,9 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p
}
else
{
mnFirst = m_pFrame->getFrameArea().Left() +
std::max(rTextLeftMargin.GetTextLeft() + nLMWithNum + nFirstLineOfs,
mnFirst = m_pFrame->getFrameArea().Left()
+ std::max(rTextLeftMargin.ResolveTextLeft(stMetrics) + nLMWithNum
+ nFirstLineOfs,
m_pFrame->getFramePrintArea().Left());
}

View file

@ -243,12 +243,12 @@ SwRect SwContourCache::ContourRect( const SwFormat* pFormat,
}
const SvxLRSpaceItem &rLRSpace = pFormat->GetLRSpace();
const SvxULSpaceItem &rULSpace = pFormat->GetULSpace();
CacheItem item {
pObj, // due to #37347 the Object must be entered only after GetContour()
std::make_unique<TextRanger>( aPolyPolygon, pPolyPolygon ? &*pPolyPolygon : nullptr, 20,
o3tl::narrowing<sal_uInt16>(rLRSpace.GetLeft()), o3tl::narrowing<sal_uInt16>(rLRSpace.GetRight()),
pFormat->GetSurround().IsOutside(), false, pFrame->IsVertical() )
};
CacheItem item{ pObj, // due to #37347 the Object must be entered only after GetContour()
std::make_unique<TextRanger>(
aPolyPolygon, pPolyPolygon ? &*pPolyPolygon : nullptr, 20,
o3tl::narrowing<sal_uInt16>(rLRSpace.ResolveLeft({})),
o3tl::narrowing<sal_uInt16>(rLRSpace.ResolveRight({})),
pFormat->GetSurround().IsOutside(), false, pFrame->IsVertical()) };
mvItems.insert(mvItems.begin(), std::move(item));
mvItems[0].mxTextRanger->SetUpper( rULSpace.GetUpper() );
mvItems[0].mxTextRanger->SetLower( rULSpace.GetLower() );

View file

@ -54,9 +54,9 @@ DefaultToxTabStopTokenHandler::HandleTabStopToken(
SvxTextLeftMarginItem const& rTextLeftMargin(
targetNode.SwContentNode::GetAttr(RES_MARGIN_TEXTLEFT));
tools::Long nTabPosition = aToken.nTabStopPosition;
if (!mTabPositionIsRelativeToParagraphIndent && rTextLeftMargin.GetTextLeft() != 0)
if (!mTabPositionIsRelativeToParagraphIndent && rTextLeftMargin.ResolveTextLeft({}) != 0)
{
nTabPosition -= rTextLeftMargin.GetTextLeft();
nTabPosition -= rTextLeftMargin.ResolveTextLeft({});
}
result.tabStop = SvxTabStop(nTabPosition, aToken.eTabAlign, cDfltDecimalChar, aToken.cTabFillChar);
return result;
@ -115,7 +115,7 @@ auto DefaultToxTabStopTokenHandler::CalcEndStop(SwTextNode const& rNode,
SvxTextLeftMarginItem const& rTextLeftMargin(
rNode.GetTextColl()->GetTextLeftMargin());
nRightMargin -= rTextLeftMargin.GetLeft(rFirstLine, /*metrics*/ {});
nRightMargin -= rTextLeftMargin.ResolveLeft(rFirstLine, /*metrics*/ {});
nRightMargin -= rFirstLine.ResolveTextFirstLineOffset(/*metrics*/ {});
}
return nRightMargin - 1; // subtract 1 twip to avoid equal for TabOverMargin
@ -132,8 +132,9 @@ DefaultToxTabStopTokenHandler::CalculatePageMarginFromPageDescription(const SwTe
pPageDesc = &mDefaultPageDescription;
}
const SwFrameFormat& rPgDscFormat = pPageDesc->GetMaster();
tools::Long result = rPgDscFormat.GetFrameSize().GetWidth() - rPgDscFormat.GetLRSpace().GetLeft()
- rPgDscFormat.GetLRSpace().GetRight();
tools::Long result = rPgDscFormat.GetFrameSize().GetWidth()
- rPgDscFormat.GetLRSpace().ResolveLeft({})
- rPgDscFormat.GetLRSpace().ResolveRight({});
// Also consider borders
const SvxBoxItem& rBox = rPgDscFormat.GetBox();
result -= rBox.CalcLineSpace(SvxBoxItemLine::LEFT) + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT);

View file

@ -3313,7 +3313,8 @@ tools::Long SwTextNode::GetLeftMarginWithNum( bool bTextLeft ) const
if( pRule->IsAbsSpaces() )
{
SvxFirstLineIndentItem const& rFirst(GetSwAttrSet().GetFirstLineIndent());
nRet = nRet - GetSwAttrSet().GetTextLeftMargin().GetLeft(rFirst, /*metrics*/ {});
nRet
= nRet - GetSwAttrSet().GetTextLeftMargin().ResolveLeft(rFirst, /*metrics*/ {});
}
}
else if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
@ -3326,11 +3327,11 @@ tools::Long SwTextNode::GetLeftMarginWithNum( bool bTextLeft ) const
// list/paragraph items. (this is rather inelegant)
SvxFirstLineIndentItem firstLine(GetSwAttrSet().GetFirstLineIndent());
SvxTextLeftMarginItem leftMargin(GetSwAttrSet().GetTextLeftMargin());
nRet = bTextLeft ? -leftMargin.GetTextLeft()
: -leftMargin.GetLeft(firstLine, /*metrics*/ {});
nRet = bTextLeft ? -leftMargin.ResolveTextLeft(/*metrics*/ {})
: -leftMargin.ResolveLeft(firstLine, /*metrics*/ {});
if (indents & ::sw::ListLevelIndents::LeftMargin)
{
leftMargin.SetTextLeft(rFormat.GetIndentAt());
leftMargin.SetTextLeft(SvxIndentValue::twips(rFormat.GetIndentAt()));
}
if (indents & ::sw::ListLevelIndents::FirstLine)
{
@ -3338,8 +3339,8 @@ tools::Long SwTextNode::GetLeftMarginWithNum( bool bTextLeft ) const
SvxIndentValue{ static_cast<double>(rFormat.GetFirstLineIndent()),
rFormat.GetFirstLineIndentUnit() });
}
nRet += bTextLeft ? leftMargin.GetTextLeft()
: leftMargin.GetLeft(firstLine, /*metrics*/ {});
nRet += bTextLeft ? leftMargin.ResolveTextLeft(/*metrics*/ {})
: leftMargin.ResolveLeft(firstLine, /*metrics*/ {});
}
}
@ -3402,7 +3403,8 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
{
SvxFirstLineIndentItem const& rFirst(GetSwAttrSet().GetFirstLineIndent());
nAdditionalIndent = GetSwAttrSet().GetTextLeftMargin().GetLeft(rFirst, /*metrics*/ {});
nAdditionalIndent
= GetSwAttrSet().GetTextLeftMargin().ResolveLeft(rFirst, /*metrics*/ {});
if (getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING))
{
@ -3426,9 +3428,10 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
: GetSwAttrSet().GetFirstLineIndent());
SvxTextLeftMarginItem const aLeft(
indents & ::sw::ListLevelIndents::LeftMargin
? SvxTextLeftMarginItem(rFormat.GetIndentAt(), RES_MARGIN_TEXTLEFT)
? SvxTextLeftMarginItem(SvxIndentValue::twips(rFormat.GetIndentAt()),
RES_MARGIN_TEXTLEFT)
: GetSwAttrSet().GetTextLeftMargin());
nAdditionalIndent = aLeft.GetLeft(aFirst, /*metrics*/ {});
nAdditionalIndent = aLeft.ResolveLeft(aFirst, /*metrics*/ {});
if (!(indents & ::sw::ListLevelIndents::FirstLine))
{
if (getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING))
@ -3441,7 +3444,7 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
else
{
SvxFirstLineIndentItem const& rFirst(GetSwAttrSet().GetFirstLineIndent());
nAdditionalIndent = GetSwAttrSet().GetTextLeftMargin().GetLeft(rFirst, /*metrics*/ {});
nAdditionalIndent = GetSwAttrSet().GetTextLeftMargin().ResolveLeft(rFirst, /*metrics*/ {});
}
return nAdditionalIndent;
@ -3468,7 +3471,7 @@ tools::Long SwTextNode::GetLeftMarginForTabCalculation() const
}
if ( !bLeftMarginForTabCalcSetToListLevelIndent )
{
nLeftMarginForTabCalc = GetSwAttrSet().GetTextLeftMargin().GetTextLeft();
nLeftMarginForTabCalc = GetSwAttrSet().GetTextLeftMargin().ResolveTextLeft({});
}
return nLeftMarginForTabCalc;
@ -4784,7 +4787,7 @@ bool SwTextNode::GetListTabStopPosition( tools::Long& nListTabStopPosition ) con
else if (!getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING))
{
SvxTextLeftMarginItem const aItem(GetSwAttrSet().GetTextLeftMargin());
nListTabStopPosition -= aItem.GetTextLeft();
nListTabStopPosition -= aItem.ResolveTextLeft({});
}
}
}

View file

@ -2143,7 +2143,8 @@ static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTextNode& rTextNode,
}
if (indents & ::sw::ListLevelIndents::LeftMargin)
{
SvxTextLeftMarginItem const leftMargin(rFormat.GetIndentAt(), RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(rFormat.GetIndentAt()),
RES_MARGIN_TEXTLEFT);
rSet.Put(leftMargin);
}
}

View file

@ -155,7 +155,9 @@
{ UNO_NAME_PARA_GRAPHIC_FILTER, RES_BACKGROUND, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_GRAPHIC_FILTER }, \
{ UNO_NAME_PARA_GRAPHIC_LOCATION, RES_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PropertyAttribute::MAYBEVOID, MID_GRAPHIC_POSITION }, \
{ UNO_NAME_PARA_LEFT_MARGIN, RES_MARGIN_TEXTLEFT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN | CONVERT_TWIPS }, \
{ UNO_NAME_PARA_LEFT_MARGIN_UNIT, RES_MARGIN_TEXTLEFT, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PropertyAttribute::MAYBEVOID, MID_L_UNIT_MARGIN }, \
{ UNO_NAME_PARA_RIGHT_MARGIN, RES_MARGIN_RIGHT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_R_MARGIN | CONVERT_TWIPS }, \
{ UNO_NAME_PARA_RIGHT_MARGIN_UNIT, RES_MARGIN_RIGHT, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PropertyAttribute::MAYBEVOID, MID_R_UNIT_MARGIN }, \
{ UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT, RES_MARGIN_FIRSTLINE, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_FIRST_AUTO }, \
{ UNO_NAME_PARA_FIRST_LINE_INDENT, RES_MARGIN_FIRSTLINE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT | CONVERT_TWIPS }, \
{ UNO_NAME_PARA_FIRST_LINE_INDENT_UNIT, RES_MARGIN_FIRSTLINE, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_UNIT_INDENT }, \
@ -418,7 +420,9 @@
{ UNO_NAME_CHAR_OVERLINE_HAS_COLOR, RES_CHRATR_OVERLINE , cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_TL_HASCOLOR},\
{ UNO_NAME_CHAR_OVERLINE_COMPLEX_COLOR, RES_CHRATR_OVERLINE, cppu::UnoType<css::util::XComplexColor>::get(), PropertyAttribute::MAYBEVOID, MID_TL_COMPLEX_COLOR }, \
{ UNO_NAME_PARA_LEFT_MARGIN, RES_MARGIN_TEXTLEFT, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_TXT_LMARGIN|CONVERT_TWIPS},\
{ UNO_NAME_PARA_LEFT_MARGIN_UNIT, RES_MARGIN_TEXTLEFT, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PROPERTY_NONE, MID_L_UNIT_MARGIN }, \
{ UNO_NAME_PARA_RIGHT_MARGIN, RES_MARGIN_RIGHT, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},\
{ UNO_NAME_PARA_RIGHT_MARGIN_UNIT, RES_MARGIN_RIGHT, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PROPERTY_NONE, MID_R_UNIT_MARGIN }, \
{ UNO_NAME_PARA_LEFT_MARGIN_RELATIVE, RES_MARGIN_TEXTLEFT, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_L_REL_MARGIN},\
{ UNO_NAME_PARA_RIGHT_MARGIN_RELATIVE, RES_MARGIN_RIGHT, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_R_REL_MARGIN},\
{ UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT, RES_MARGIN_FIRSTLINE, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_FIRST_AUTO},\
@ -549,8 +553,10 @@
{ UNO_NAME_PARA_FIRST_LINE_INDENT, RES_MARGIN_FIRSTLINE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT|CONVERT_TWIPS}, \
{ UNO_NAME_PARA_FIRST_LINE_INDENT_UNIT, RES_MARGIN_FIRSTLINE, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_UNIT_INDENT}, \
{ UNO_NAME_PARA_LEFT_MARGIN, RES_MARGIN_TEXTLEFT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN|CONVERT_TWIPS}, \
{ UNO_NAME_PARA_LEFT_MARGIN_UNIT, RES_MARGIN_TEXTLEFT, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PropertyAttribute::MAYBEVOID, MID_L_UNIT_MARGIN }, \
{ UNO_NAME_PARA_LINE_SPACING, RES_PARATR_LINESPACING, cppu::UnoType<css::style::LineSpacing>::get(), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
{ UNO_NAME_PARA_RIGHT_MARGIN, RES_MARGIN_RIGHT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS}, \
{ UNO_NAME_PARA_RIGHT_MARGIN_UNIT, RES_MARGIN_RIGHT, cppu::UnoType<css::beans::Pair<double, sal_Int16>>::get(), PropertyAttribute::MAYBEVOID, MID_R_UNIT_MARGIN }, \
{ UNO_NAME_TABSTOPS, RES_PARATR_TABSTOP, cppu::UnoType< cppu::UnoSequenceType<css::style::TabStop> >::get(), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
{ UNO_NAME_CHAR_NO_HYPHENATION, RES_CHRATR_NOHYPHEN, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, \

View file

@ -1928,10 +1928,11 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat
// left
if( IsHTMLMode( HTMLMODE_FLY_MARGINS) )
{
nXPos -= aLRItem.GetLeft();
nXPos -= aLRItem.ResolveLeft({});
if( nXPos < 0 )
{
aLRItem.SetLeft( o3tl::narrowing<sal_uInt16>(aLRItem.GetLeft() + nXPos) );
aLRItem.SetLeft(SvxIndentValue::twips(
o3tl::narrowing<sal_uInt16>(aLRItem.ResolveLeft({}) + nXPos)));
nXPos = 0;
}
}
@ -2813,7 +2814,7 @@ static SwHTMLWriter& OutCSS1_SvxTextLeftMargin(SwHTMLWriter & rWrt, SfxPoolItem
// match that of the current template
// A left margin can exist because of a list nearby
tools::Long nLeftMargin = rLeftMargin.GetTextLeft() - rWrt.m_nLeftMargin;
tools::Long nLeftMargin = rLeftMargin.ResolveTextLeft({}) - rWrt.m_nLeftMargin;
if (rWrt.m_nDfltLeftMargin != nLeftMargin)
{
rWrt.OutCSS1_UnitProperty(sCSS1_P_margin_left, nLeftMargin);
@ -2834,9 +2835,9 @@ static SwHTMLWriter& OutCSS1_SvxRightMargin(SwHTMLWriter & rWrt, SfxPoolItem con
// No Export of a firm attribute is needed if the new values
// match that of the current template
if (rWrt.m_nDfltRightMargin != rRightMargin.GetRight())
if (rWrt.m_nDfltRightMargin != rRightMargin.ResolveRight({}))
{
rWrt.OutCSS1_UnitProperty(sCSS1_P_margin_right, rRightMargin.GetRight());
rWrt.OutCSS1_UnitProperty(sCSS1_P_margin_right, rRightMargin.ResolveRight({}));
}
return rWrt;
@ -2850,7 +2851,7 @@ static SwHTMLWriter& OutCSS1_SvxLRSpace( SwHTMLWriter& rWrt, const SfxPoolItem&
// match that of the current template
// A left margin can exist because of a list nearby
tools::Long nLeftMargin = rLRItem.GetTextLeft() - rWrt.m_nLeftMargin;
tools::Long nLeftMargin = rLRItem.ResolveTextLeft({}) - rWrt.m_nLeftMargin;
if( rWrt.m_nDfltLeftMargin != nLeftMargin )
{
rWrt.OutCSS1_UnitProperty( sCSS1_P_margin_left, nLeftMargin );
@ -2861,9 +2862,9 @@ static SwHTMLWriter& OutCSS1_SvxLRSpace( SwHTMLWriter& rWrt, const SfxPoolItem&
}
if( rWrt.m_nDfltRightMargin != rLRItem.GetRight() )
if (rWrt.m_nDfltRightMargin != rLRItem.ResolveRight({}))
{
rWrt.OutCSS1_UnitProperty( sCSS1_P_margin_right, rLRItem.GetRight() );
rWrt.OutCSS1_UnitProperty(sCSS1_P_margin_right, rLRItem.ResolveRight({}));
}
// The LineIndent of the first line might contain the room for numbering
@ -2901,16 +2902,15 @@ static SwHTMLWriter& OutCSS1_SvxULSpace_SvxLRSpace( SwHTMLWriter& rWrt,
const SvxULSpaceItem *pULItem,
const SvxLRSpaceItem *pLRItem )
{
if( pLRItem && pULItem &&
pLRItem->GetLeft() == pLRItem->GetRight() &&
pLRItem->GetLeft() == pULItem->GetUpper() &&
pLRItem->GetLeft() == pULItem->GetLower() &&
pLRItem->GetLeft() != rWrt.m_nDfltLeftMargin &&
pLRItem->GetRight() != rWrt.m_nDfltRightMargin &&
pULItem->GetUpper() != rWrt.m_nDfltTopMargin &&
pULItem->GetLower() != rWrt.m_nDfltBottomMargin )
if (pLRItem && pULItem && pLRItem->GetLeft() == pLRItem->GetRight()
&& pLRItem->GetLeft() == SvxIndentValue::twips(pULItem->GetUpper())
&& pLRItem->GetLeft() == SvxIndentValue::twips(pULItem->GetLower())
&& pLRItem->GetLeft() != SvxIndentValue::twips(rWrt.m_nDfltLeftMargin)
&& pLRItem->GetRight() != SvxIndentValue::twips(rWrt.m_nDfltRightMargin)
&& pULItem->GetUpper() != rWrt.m_nDfltTopMargin
&& pULItem->GetLower() != rWrt.m_nDfltBottomMargin)
{
rWrt.OutCSS1_UnitProperty( sCSS1_P_margin, pLRItem->GetLeft() );
rWrt.OutCSS1_UnitProperty(sCSS1_P_margin, pLRItem->ResolveLeft({}));
}
else
{

View file

@ -375,8 +375,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
(pReferenceFormat ? pReferenceFormat : pFormat)->GetTextLeftMargin());
SvxRightMarginItem const& rRightMargin(
(pReferenceFormat ? pReferenceFormat : pFormat)->GetRightMargin());
nLeftMargin = rTextLeftMargin.GetTextLeft();
nRightMargin = rRightMargin.GetRight();
nLeftMargin = rTextLeftMargin.ResolveTextLeft({});
nRightMargin = rRightMargin.ResolveRight({});
nFirstLineIndent = rFirstLine.ResolveTextFirstLineOffset({});
const SvxULSpaceItem &rULSpace =
@ -650,10 +650,10 @@ static void OutHTML_SwFormat( SwHTMLWriter& rWrt, const SwFormat& rFormat,
{
sal_Int32 nLeftMargin;
if (bForceDL)
nLeftMargin = rTextLeftMargin.GetTextLeft();
nLeftMargin = rTextLeftMargin.ResolveTextLeft({});
else
nLeftMargin = rTextLeftMargin.GetTextLeft() > pFormatInfo->nLeftMargin
? rTextLeftMargin.GetTextLeft() - pFormatInfo->nLeftMargin
nLeftMargin = rTextLeftMargin.ResolveTextLeft({}) > pFormatInfo->nLeftMargin
? rTextLeftMargin.ResolveTextLeft({}) - pFormatInfo->nLeftMargin
: 0;
if( nLeftMargin > 0 && rWrt.m_nDefListMargin > 0 )
@ -724,7 +724,7 @@ static void OutHTML_SwFormat( SwHTMLWriter& rWrt, const SwFormat& rFormat,
if( rInfo.bInNumberBulletList )
{
if (!rWrt.IsHTMLMode(HTMLMODE_LSPACE_IN_NUMBER_BULLET))
rWrt.m_nDfltLeftMargin = rTextLeftMargin.GetTextLeft();
rWrt.m_nDfltLeftMargin = rTextLeftMargin.ResolveTextLeft({});
// In numbered lists, don't output a first line indent.
rWrt.m_nFirstLineIndent = rFirstLine.ResolveTextFirstLineOffset({});
@ -2102,8 +2102,8 @@ SwHTMLWriter& OutHTML_SwTextNode( SwHTMLWriter& rWrt, const SwContentNode& rNode
SvxFirstLineIndentItem const& rFirstLine(pItemSet->Get(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem const& rTextLeftMargin(pItemSet->Get(RES_MARGIN_TEXTLEFT));
SvxRightMarginItem const& rRightMargin(pItemSet->Get(RES_MARGIN_RIGHT));
sal_Int32 const nLeft(rTextLeftMargin.GetLeft(rFirstLine, /*metrics*/ {}));
sal_Int32 const nRight(rRightMargin.GetRight());
sal_Int32 const nLeft(rTextLeftMargin.ResolveLeft(rFirstLine, /*metrics*/ {}));
sal_Int32 const nRight(rRightMargin.ResolveRight({}));
if( nLeft || nRight )
{
const SwFrameFormat& rPgFormat =
@ -2113,7 +2113,8 @@ SwHTMLWriter& OutHTML_SwTextNode( SwHTMLWriter& rWrt, const SwContentNode& rNode
const SvxLRSpaceItem& rLR = rPgFormat.GetLRSpace();
const SwFormatCol& rCol = rPgFormat.GetCol();
tools::Long nPageWidth = rSz.GetWidth() - rLR.GetLeft() - rLR.GetRight();
tools::Long nPageWidth
= rSz.GetWidth() - rLR.ResolveLeft({}) - rLR.ResolveRight({});
if( 1 < rCol.GetNumCols() )
nPageWidth /= rCol.GetNumCols();

View file

@ -1489,7 +1489,7 @@ void SwCSS1Parser::FillDropCap( SwFormatDrop& rDrop,
// a right border becomes the spacing to text!
if (const SvxRightMarginItem *const pRightMargin = rItemSet.GetItemIfSet(RES_MARGIN_RIGHT, false))
{
rDrop.SetDistance(static_cast<sal_uInt16>(pRightMargin->GetRight()));
rDrop.SetDistance(static_cast<sal_uInt16>(pRightMargin->ResolveRight({})));
rItemSet.ClearItem(RES_MARGIN_RIGHT);
}
rItemSet.ClearItem(RES_MARGIN_FIRSTLINE);

View file

@ -615,9 +615,9 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
// the item (with value 0) will be added
if( rPropInfo.m_bLeftMargin )
{
OSL_ENSURE( rPropInfo.m_nLeftMargin < 0 ||
!pTextLeftMargin ||
rPropInfo.m_nLeftMargin == pTextLeftMargin->GetTextLeft(),
OSL_ENSURE(rPropInfo.m_nLeftMargin < 0 || !pTextLeftMargin
|| rPropInfo.m_nLeftMargin
== pTextLeftMargin->ResolveTextLeft({}),
"left margin does not match with item");
if( rPropInfo.m_nLeftMargin < 0 &&
-rPropInfo.m_nLeftMargin > nOldLeft )
@ -627,9 +627,8 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
}
if( rPropInfo.m_bRightMargin )
{
OSL_ENSURE( rPropInfo.m_nRightMargin < 0 ||
!pRightMargin ||
rPropInfo.m_nRightMargin == pRightMargin->GetRight(),
OSL_ENSURE(rPropInfo.m_nRightMargin < 0 || !pRightMargin
|| rPropInfo.m_nRightMargin == pRightMargin->ResolveRight({}),
"right margin does not match with item");
if( rPropInfo.m_nRightMargin < 0 &&
-rPropInfo.m_nRightMargin > nOldRight )
@ -648,10 +647,12 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
RES_MARGIN_FIRSTLINE);
NewAttr(m_xAttrTab, &m_xAttrTab->pFirstLineIndent, firstLine);
EndAttr(m_xAttrTab->pFirstLineIndent, false);
SvxTextLeftMarginItem const leftMargin(nLeft, RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(nLeft),
RES_MARGIN_TEXTLEFT);
NewAttr(m_xAttrTab, &m_xAttrTab->pTextLeftMargin, leftMargin);
EndAttr(m_xAttrTab->pTextLeftMargin, false);
SvxRightMarginItem const rightMargin(nRight, RES_MARGIN_RIGHT);
SvxRightMarginItem const rightMargin(SvxIndentValue::twips(nRight),
RES_MARGIN_RIGHT);
NewAttr(m_xAttrTab, &m_xAttrTab->pRightMargin, rightMargin);
EndAttr(m_xAttrTab->pRightMargin, false);
}

View file

@ -100,7 +100,7 @@ void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj,
if( rCSS1PropInfo.m_bLeftMargin )
{
// should be SvxLeftMarginItem... "cast" it
nLeftSpace = static_cast<sal_uInt16>(pLeft->GetTextLeft());
nLeftSpace = static_cast<sal_uInt16>(pLeft->ResolveTextLeft({}));
rCSS1PropInfo.m_bLeftMargin = false;
}
rCSS1ItemSet.ClearItem(RES_MARGIN_TEXTLEFT);
@ -109,7 +109,7 @@ void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj,
{
if( rCSS1PropInfo.m_bRightMargin )
{
nRightSpace = static_cast< sal_uInt16 >(pRight->GetRight());
nRightSpace = static_cast<sal_uInt16>(pRight->ResolveRight({}));
rCSS1PropInfo.m_bRightMargin = false;
}
rCSS1ItemSet.ClearItem(RES_MARGIN_RIGHT);
@ -117,8 +117,8 @@ void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj,
if( nLeftSpace || nRightSpace )
{
SvxLRSpaceItem aLRItem( RES_LR_SPACE );
aLRItem.SetLeft( nLeftSpace );
aLRItem.SetRight( nRightSpace );
aLRItem.SetLeft(SvxIndentValue::twips(nLeftSpace));
aLRItem.SetRight(SvxIndentValue::twips(nRightSpace));
aFrameSet.Put( aLRItem );
}

View file

@ -323,7 +323,7 @@ void SwHTMLWriter::CollectFlyFrames()
pACNd->GetAttr(RES_MARGIN_TEXTLEFT);
const SvxRightMarginItem& rRightMargin =
pACNd->GetAttr(RES_MARGIN_RIGHT);
if (rTextLeftMargin.GetTextLeft() || rRightMargin.GetRight())
if (rTextLeftMargin.ResolveTextLeft({}) || rRightMargin.ResolveRight({}))
{
nMode = getHTMLOutFrameParaFrameTable(eType, m_nExportMode);
break;
@ -612,8 +612,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat,
if( (nFrameOpts & (HtmlFrmOpts::Space|HtmlFrmOpts::MarginSize)) &&
(pLRSpaceItem = rItemSet.GetItemIfSet( RES_LR_SPACE )) )
{
aTwipSpc.setWidth(
( pLRSpaceItem->GetLeft() + pLRSpaceItem->GetRight() ) / 2 );
aTwipSpc.setWidth((pLRSpaceItem->ResolveLeft({}) + pLRSpaceItem->ResolveRight({})) / 2);
m_nDfltLeftMargin = m_nDfltRightMargin = aTwipSpc.Width();
}
const SvxULSpaceItem* pULSpaceItem;
@ -865,8 +864,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma
if( (nFrameOptions & (HtmlFrmOpts::Space | HtmlFrmOpts::MarginSize)) &&
(pLRSpaceItem = rItemSet.GetItemIfSet( RES_LR_SPACE )) )
{
aTwipSpc.setWidth(
( pLRSpaceItem->GetLeft() + pLRSpaceItem->GetRight() ) / 2 );
aTwipSpc.setWidth((pLRSpaceItem->ResolveLeft({}) + pLRSpaceItem->ResolveRight({})) / 2);
m_nDfltLeftMargin = m_nDfltRightMargin = aTwipSpc.Width();
}
const SvxULSpaceItem* pULSpaceItem;

View file

@ -876,7 +876,7 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl(
if( rCSS1PropInfo.m_bLeftMargin )
{
// should be SvxLeftMarginItem... "cast" it
nLeftSpace = convertTwipToMm100(pLeft->GetTextLeft());
nLeftSpace = convertTwipToMm100(pLeft->ResolveTextLeft({}));
rCSS1PropInfo.m_bLeftMargin = false;
}
rCSS1ItemSet.ClearItem(RES_MARGIN_TEXTLEFT);
@ -885,7 +885,7 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl(
{
if( rCSS1PropInfo.m_bRightMargin )
{
nRightSpace = convertTwipToMm100(pRight->GetRight());
nRightSpace = convertTwipToMm100(pRight->ResolveRight({}));
rCSS1PropInfo.m_bRightMargin = false;
}
rCSS1ItemSet.ClearItem(RES_MARGIN_RIGHT);

View file

@ -258,7 +258,7 @@ void SwHTMLParser::SetSpace( const Size& rPixSpace,
if( rCSS1PropInfo.m_bLeftMargin )
{
// should be SvxLeftMarginItem... "cast" it
nLeftSpace = pLeft->GetTextLeft();
nLeftSpace = pLeft->ResolveTextLeft({});
rCSS1PropInfo.m_bLeftMargin = false;
}
rCSS1ItemSet.ClearItem(RES_MARGIN_TEXTLEFT);
@ -267,7 +267,7 @@ void SwHTMLParser::SetSpace( const Size& rPixSpace,
{
if( rCSS1PropInfo.m_bRightMargin )
{
nRightSpace = pRight->GetRight();
nRightSpace = pRight->ResolveRight({});
rCSS1PropInfo.m_bRightMargin = false;
}
rCSS1ItemSet.ClearItem(RES_MARGIN_RIGHT);
@ -275,8 +275,8 @@ void SwHTMLParser::SetSpace( const Size& rPixSpace,
if( nLeftSpace > 0 || nRightSpace > 0 )
{
SvxLRSpaceItem aLRItem( RES_LR_SPACE );
aLRItem.SetLeft( std::max<sal_Int32>(nLeftSpace, 0) );
aLRItem.SetRight( std::max<sal_Int32>(nRightSpace, 0) );
aLRItem.SetLeft(SvxIndentValue::twips(std::max<sal_Int32>(nLeftSpace, 0)));
aLRItem.SetRight(SvxIndentValue::twips(std::max<sal_Int32>(nRightSpace, 0)));
rFlyItemSet.Put( aLRItem );
if( nLeftSpace )
{

View file

@ -2371,8 +2371,8 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
// The right margin will be ignored anyway.
SvxLRSpaceItem aLRItem( m_pSwTable->GetFrameFormat()->GetLRSpace() );
aLRItem.SetLeft( m_nLeftMargin );
aLRItem.SetRight( m_nRightMargin );
aLRItem.SetLeft(SvxIndentValue::twips(m_nLeftMargin));
aLRItem.SetRight(SvxIndentValue::twips(m_nRightMargin));
pFrameFormat->SetFormatAttr( aLRItem );
}
@ -3459,8 +3459,9 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
sal_uInt16 nSpace = pCurTable->GetHSpace();
if (nSpace)
aFrameSet.Put(
SvxLRSpaceItem(nSpace, nSpace, SvxIndentValue::zero(), RES_LR_SPACE));
aFrameSet.Put(SvxLRSpaceItem(SvxIndentValue::twips(nSpace),
SvxIndentValue::twips(nSpace),
SvxIndentValue::zero(), RES_LR_SPACE));
nSpace = pCurTable->GetVSpace();
if( nSpace )
aFrameSet.Put( SvxULSpaceItem(nSpace,nSpace, RES_UL_SPACE) );

View file

@ -885,7 +885,8 @@ SwHTMLWriter& OutHTML_SwTableNode( SwHTMLWriter& rWrt, SwTableNode & rNode,
eFlyHoriOri = text::HoriOrientation::LEFT;
const SvxLRSpaceItem& rLRSpace = pFlyFrameFormat->GetLRSpace();
nFlyHSpace = static_cast< sal_uInt16 >((rLRSpace.GetLeft() + rLRSpace.GetRight()) / 2);
nFlyHSpace
= static_cast<sal_uInt16>((rLRSpace.ResolveLeft({}) + rLRSpace.ResolveRight({})) / 2);
const SvxULSpaceItem& rULSpace = pFlyFrameFormat->GetULSpace();
nFlyVSpace = (rULSpace.GetUpper() + rULSpace.GetLower()) / 2;
@ -924,7 +925,7 @@ SwHTMLWriter& OutHTML_SwTableNode( SwHTMLWriter& rWrt, SwTableNode & rNode,
case text::HoriOrientation::NONE:
{
const SvxLRSpaceItem& aLRItem = pFormat->GetLRSpace();
if( aLRItem.GetRight() )
if (aLRItem.ResolveRight({}))
{
// The table width is defined on the basis of the left and
// right margin. Therefore we try to define the actual
@ -977,19 +978,18 @@ SwHTMLWriter& OutHTML_SwTableNode( SwHTMLWriter& rWrt, SwTableNode & rNode,
rWrt.GetNextNumInfo(),
"NumInfo for next paragraph is missing!" );
const SvxLRSpaceItem& aLRItem = pFormat->GetLRSpace();
if( aLRItem.GetLeft() > 0 && rWrt.m_nDefListMargin > 0 &&
( !rWrt.GetNumInfo().GetNumRule() ||
( rWrt.GetNextNumInfo() &&
(rWrt.GetNumInfo().GetNumRule() != rWrt.GetNextNumInfo()->GetNumRule() ||
rWrt.GetNextNumInfo()->IsRestart(rWrt.GetNumInfo())) ) ) )
if (aLRItem.ResolveLeft({}) > 0 && rWrt.m_nDefListMargin > 0
&& (!rWrt.GetNumInfo().GetNumRule()
|| (rWrt.GetNextNumInfo()
&& (rWrt.GetNumInfo().GetNumRule() != rWrt.GetNextNumInfo()->GetNumRule()
|| rWrt.GetNextNumInfo()->IsRestart(rWrt.GetNumInfo())))))
{
// If the paragraph before the table is not numbered or the
// paragraph after the table starts with a new numbering or with
// a different rule, we can maintain the indentation with a DL.
// Otherwise we keep the indentation of the numbering.
nNewDefListLvl = static_cast<sal_uInt16>(
(aLRItem.GetLeft() + (rWrt.m_nDefListMargin/2)) /
rWrt.m_nDefListMargin );
(aLRItem.ResolveLeft({}) + (rWrt.m_nDefListMargin / 2)) / rWrt.m_nDefListMargin);
}
}

View file

@ -2046,7 +2046,8 @@ static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
nLeft = 0;
// TODO: other things may need a SvxLeftMarginItem ? but they currently convert it anyway so they can convert that too.
SvxTextLeftMarginItem const leftMargin(o3tl::narrowing<sal_uInt16>(nLeft), RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(
SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nLeft)), RES_MARGIN_TEXTLEFT);
rItemSet.Put(leftMargin);
rPropInfo.m_bLeftMargin = true;
}
@ -2100,7 +2101,8 @@ static void ParseCSS1_margin_right( const CSS1Expression *pExpr,
if( nRight < 0 )
nRight = 0;
SvxRightMarginItem rightMargin(o3tl::narrowing<sal_uInt16>(nRight), RES_MARGIN_RIGHT);
SvxRightMarginItem rightMargin(SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nRight)),
RES_MARGIN_RIGHT);
rItemSet.Put(rightMargin);
rPropInfo.m_bRightMargin = true;
}
@ -2320,12 +2322,15 @@ static void ParseCSS1_margin( const CSS1Expression *pExpr,
if (bSetMargins[3])
{
SvxTextLeftMarginItem const leftMargin(o3tl::narrowing<sal_uInt16>(nMargins[3]), RES_MARGIN_TEXTLEFT);
SvxTextLeftMarginItem const leftMargin(
SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nMargins[3])),
RES_MARGIN_TEXTLEFT);
rItemSet.Put(leftMargin);
}
if (bSetMargins[1])
{
SvxRightMarginItem const rightMargin(o3tl::narrowing<sal_uInt16>(nMargins[1]), RES_MARGIN_RIGHT);
SvxRightMarginItem const rightMargin(
SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nMargins[1])), RES_MARGIN_RIGHT);
rItemSet.Put(rightMargin);
}
}

View file

@ -4428,7 +4428,7 @@ void SwHTMLParser::NewDefList()
SvxTextLeftMarginItem const& rTextLeftMargin =
m_pCSS1Parser->GetTextFormatColl(RES_POOLCOLL_HTML_DD, OUString())
->GetTextLeftMargin();
nLeft = nLeft + static_cast<sal_uInt16>(rTextLeftMargin.GetTextLeft());
nLeft = nLeft + static_cast<sal_uInt16>(rTextLeftMargin.ResolveTextLeft({}));
}
xCntxt->SetMargins( nLeft, nRight, nIndent );
@ -4769,16 +4769,16 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext )
|| rItemSet.GetItemIfSet(RES_MARGIN_TEXTLEFT)
|| rItemSet.GetItemIfSet(RES_MARGIN_RIGHT))
{
sal_Int32 nLeft = rItemSet.Get(RES_MARGIN_TEXTLEFT).GetTextLeft();
sal_Int32 nRight = rItemSet.Get(RES_MARGIN_RIGHT).GetRight();
sal_Int32 nLeft = rItemSet.Get(RES_MARGIN_TEXTLEFT).ResolveTextLeft({});
sal_Int32 nRight = rItemSet.Get(RES_MARGIN_RIGHT).ResolveRight({});
nFirstLineIndent = rItemSet.Get(RES_MARGIN_FIRSTLINE).ResolveTextFirstLineOffset({});
// In Definition lists the margins also contain the margins from the previous levels
if( RES_POOLCOLL_HTML_DD == nTopColl )
{
auto const*const pColl(m_pCSS1Parser->GetTextFormatColl(RES_POOLCOLL_HTML_DT, OUString()));
nLeft -= pColl->GetTextLeftMargin().GetTextLeft();
nRight -= pColl->GetRightMargin().GetRight();
nLeft -= pColl->GetTextLeftMargin().ResolveTextLeft({});
nRight -= pColl->GetRightMargin().ResolveRight({});
}
else if( RES_POOLCOLL_HTML_DT == nTopColl )
{
@ -4805,11 +4805,12 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext )
pCollToSet = m_pCSS1Parser->GetTextCollFromPool( nDfltColl );
if( !nLeftMargin )
{
nLeftMargin = static_cast<sal_uInt16>(pCollToSet->GetTextLeftMargin().GetTextLeft());
nLeftMargin
= static_cast<sal_uInt16>(pCollToSet->GetTextLeftMargin().ResolveTextLeft({}));
}
if( !nRightMargin )
{
nRightMargin = static_cast<sal_uInt16>(pCollToSet->GetRightMargin().GetRight());
nRightMargin = static_cast<sal_uInt16>(pCollToSet->GetRightMargin().ResolveRight({}));
}
if( !nFirstLineIndent )
{
@ -4836,9 +4837,9 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext )
const SvxFirstLineIndentItem & rFirstLine = pCollToSet->GetFirstLineIndent();
const SvxTextLeftMarginItem & rTextLeftMargin = pCollToSet->GetTextLeftMargin();
const SvxRightMarginItem & rRightMargin = pCollToSet->GetRightMargin();
bool bSetLRSpace = nLeftMargin != rTextLeftMargin.GetTextLeft()
bool bSetLRSpace = nLeftMargin != rTextLeftMargin.ResolveTextLeft({})
|| nFirstLineIndent != rFirstLine.ResolveTextFirstLineOffset({})
|| nRightMargin != rRightMargin.GetRight();
|| nRightMargin != rRightMargin.ResolveRight({});
if( bSetLRSpace )
{
@ -4846,8 +4847,8 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext )
SvxTextLeftMarginItem leftMargin(rTextLeftMargin);
SvxRightMarginItem rightMargin(rRightMargin);
firstLine.SetTextFirstLineOffset(SvxIndentValue::twips(nFirstLineIndent));
leftMargin.SetTextLeft(nLeftMargin);
rightMargin.SetRight(nRightMargin);
leftMargin.SetTextLeft(SvxIndentValue::twips(nLeftMargin));
rightMargin.SetRight(SvxIndentValue::twips(nRightMargin));
if( pItemSet )
{
pItemSet->Put(firstLine);
@ -5082,8 +5083,10 @@ void SwHTMLParser::InsertSpacer()
SvxFirstLineIndentItem const firstLine(SvxIndentValue::twips(nIndent),
RES_MARGIN_FIRSTLINE);
SvxTextLeftMarginItem const leftMargin(nLeft, RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(nRight, RES_MARGIN_RIGHT);
SvxTextLeftMarginItem const leftMargin(SvxIndentValue::twips(nLeft),
RES_MARGIN_TEXTLEFT);
SvxRightMarginItem const rightMargin(SvxIndentValue::twips(nRight),
RES_MARGIN_RIGHT);
NewAttr(m_xAttrTab, &m_xAttrTab->pFirstLineIndent, firstLine);
EndAttr(m_xAttrTab->pFirstLineIndent, false);
@ -5123,7 +5126,7 @@ SwTwips SwHTMLParser::GetCurrentBrowseWidth()
const SvxULSpaceItem& rUL = rPgFormat.GetULSpace();
const SwFormatCol& rCol = rPgFormat.GetCol();
m_aHTMLPageSize.setWidth( rSz.GetWidth() - rLR.GetLeft() - rLR.GetRight() );
m_aHTMLPageSize.setWidth(rSz.GetWidth() - rLR.ResolveLeft({}) - rLR.ResolveRight({}));
m_aHTMLPageSize.setHeight( rSz.GetHeight() - rUL.GetUpper() - rUL.GetLower() );
if( 1 < rCol.GetNumCols() )
@ -5382,16 +5385,20 @@ void SwHTMLParser::InsertHorzRule()
switch( eAdjust )
{
case SvxAdjust::Right:
oLeft.emplace(o3tl::narrowing<sal_uInt16>(nDist), RES_MARGIN_TEXTLEFT);
oLeft.emplace(SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nDist)),
RES_MARGIN_TEXTLEFT);
break;
case SvxAdjust::Left:
oRight.emplace(o3tl::narrowing<sal_uInt16>(nDist), RES_MARGIN_RIGHT);
oRight.emplace(SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nDist)),
RES_MARGIN_RIGHT);
break;
case SvxAdjust::Center:
default:
nDist /= 2;
oLeft.emplace(o3tl::narrowing<sal_uInt16>(nDist), RES_MARGIN_TEXTLEFT);
oRight.emplace(o3tl::narrowing<sal_uInt16>(nDist), RES_MARGIN_RIGHT);
oLeft.emplace(SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nDist)),
RES_MARGIN_TEXTLEFT);
oRight.emplace(SvxIndentValue::twips(o3tl::narrowing<sal_uInt16>(nDist)),
RES_MARGIN_RIGHT);
break;
}

View file

@ -492,8 +492,10 @@ ErrCode SwHTMLWriter::WriteStream()
m_nLastLFPos = 0;
m_nDefListLvl = 0;
m_nDefListMargin = ((m_xTemplate.is() && !m_bCfgOutStyles) ? m_xTemplate.get() : m_pDoc)
->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_HTML_DD, false )
->GetTextLeftMargin().GetTextLeft();
->getIDocumentStylePoolAccess()
.GetTextCollFromPool(RES_POOLCOLL_HTML_DD, false)
->GetTextLeftMargin()
.ResolveTextLeft({});
m_nHeaderFooterSpace = 0;
m_nTextAttrsToIgnore = 0;
m_nCSS1OutMode = 0;

View file

@ -1082,8 +1082,8 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor
else if (aPos.Y)
attrList->add( FSNS( XML_w, XML_y), OString::number(aPos.Y));
sal_Int16 nLeft = pFrameFormat->GetLRSpace().GetLeft();
sal_Int16 nRight = pFrameFormat->GetLRSpace().GetRight();
sal_Int16 nLeft = pFrameFormat->GetLRSpace().ResolveLeft({});
sal_Int16 nRight = pFrameFormat->GetLRSpace().ResolveRight({});
sal_Int16 nUpper = pFrameFormat->GetULSpace().GetUpper();
sal_Int16 nLower = pFrameFormat->GetULSpace().GetLower();
@ -6216,10 +6216,12 @@ OString DocxAttributeOutput::GetOLEStyle(const SwFlyFrameFormat& rFormat, const
"pt"; //from VMLExport::AddRectangleDimensions(), it does: value/20
const SvxLRSpaceItem& rLRSpace = rFormat.GetLRSpace();
if (rLRSpace.IsExplicitZeroMarginValLeft() || rLRSpace.GetLeft())
sShapeStyle += ";mso-wrap-distance-left:" + OString::number(double(rLRSpace.GetLeft()) / 20) + "pt";
if (rLRSpace.IsExplicitZeroMarginValRight() || rLRSpace.GetRight())
sShapeStyle += ";mso-wrap-distance-right:" + OString::number(double(rLRSpace.GetRight()) / 20) + "pt";
if (rLRSpace.IsExplicitZeroMarginValLeft() || rLRSpace.ResolveLeft({}))
sShapeStyle += ";mso-wrap-distance-left:"
+ OString::number(double(rLRSpace.ResolveLeft({})) / 20) + "pt";
if (rLRSpace.IsExplicitZeroMarginValRight() || rLRSpace.ResolveRight({}))
sShapeStyle += ";mso-wrap-distance-right:"
+ OString::number(double(rLRSpace.ResolveRight({})) / 20) + "pt";
const SvxULSpaceItem& rULSpace = rFormat.GetULSpace();
if (rULSpace.GetUpper())
sShapeStyle += ";mso-wrap-distance-top:" + OString::number(double(rULSpace.GetUpper()) / 20) + "pt";
@ -9321,9 +9323,8 @@ void DocxAttributeOutput::FormatTextLeftMargin(SvxTextLeftMarginItem const& rTex
}
}
bool const bEcma1st(m_rExport.GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION);
AddToAttrList(m_pLRSpaceAttrList,
FSNS(XML_w, (bEcma1st ? XML_left : XML_start)),
OString::number(pTextLeftMargin->GetTextLeft()));
AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, (bEcma1st ? XML_left : XML_start)),
OString::number(pTextLeftMargin->ResolveTextLeft({})));
}
void DocxAttributeOutput::FormatRightMargin(SvxRightMarginItem const& rRightMargin)
@ -9334,9 +9335,8 @@ void DocxAttributeOutput::FormatRightMargin(SvxRightMarginItem const& rRightMarg
#endif
{
bool const bEcma1st(m_rExport.GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION);
AddToAttrList(m_pLRSpaceAttrList,
FSNS(XML_w, (bEcma1st ? XML_right : XML_end)),
OString::number(rRightMargin.GetRight()));
AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, (bEcma1st ? XML_right : XML_end)),
OString::number(rRightMargin.ResolveRight({})));
}
}
@ -9345,8 +9345,12 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
bool const bEcma = m_rExport.GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION;
if (m_rExport.SdrExporter().getTextFrameSyntax())
{
m_rExport.SdrExporter().getTextFrameStyle().append(";mso-wrap-distance-left:" + OString::number(double(rLRSpace.GetLeft()) / 20) + "pt");
m_rExport.SdrExporter().getTextFrameStyle().append(";mso-wrap-distance-right:" + OString::number(double(rLRSpace.GetRight()) / 20) + "pt");
m_rExport.SdrExporter().getTextFrameStyle().append(
";mso-wrap-distance-left:" + OString::number(double(rLRSpace.ResolveLeft({})) / 20)
+ "pt");
m_rExport.SdrExporter().getTextFrameStyle().append(
";mso-wrap-distance-right:" + OString::number(double(rLRSpace.ResolveRight({})) / 20)
+ "pt");
}
else if (m_rExport.SdrExporter().getDMLTextFrameSyntax())
{
@ -9354,8 +9358,7 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
else if ( m_rExport.m_bOutFlyFrameAttrs )
{
AddToAttrList(m_rExport.SdrExporter().getFlyAttrList(), FSNS(XML_w, XML_hSpace),
OString::number(
( rLRSpace.GetLeft() + rLRSpace.GetRight() ) / 2 ) );
OString::number((rLRSpace.ResolveLeft({}) + rLRSpace.ResolveRight({})) / 2));
}
else if ( m_rExport.m_bOutPageDescs )
{
@ -9369,8 +9372,8 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
m_pageMargins.nRight = pBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT, /*bEvenIfNoLine*/true );
}
m_pageMargins.nLeft += sal::static_int_cast<sal_uInt16>(rLRSpace.GetLeft());
m_pageMargins.nRight += sal::static_int_cast<sal_uInt16>(rLRSpace.GetRight());
m_pageMargins.nLeft += sal::static_int_cast<sal_uInt16>(rLRSpace.ResolveLeft({}));
m_pageMargins.nRight += sal::static_int_cast<sal_uInt16>(rLRSpace.ResolveRight({}));
// if page layout is 'left' then left/right margin need to be exchanged
// as it is exported as mirrored layout starting with even page
const WW8_SepInfo *pSectionInfo = m_rExport.Sections().CurrentSectionInfo();
@ -9396,13 +9399,15 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
::std::optional<SvxLRSpaceItem> oLRSpace;
assert(dynamic_cast<SwContentNode const*>(GetExport().m_pOutFormatNode) == nullptr);
rtl::Reference<FastAttributeList> pLRSpaceAttrList = FastSerializerHelper::createAttrList();
if ((0 != pLRSpace->GetTextLeft()) || (pLRSpace->IsExplicitZeroMarginValLeft()))
if ((0 != pLRSpace->ResolveTextLeft({})) || (pLRSpace->IsExplicitZeroMarginValLeft()))
{
pLRSpaceAttrList->add( FSNS(XML_w, (bEcma ? XML_left : XML_start)), OString::number(pLRSpace->GetTextLeft()) );
pLRSpaceAttrList->add(FSNS(XML_w, (bEcma ? XML_left : XML_start)),
OString::number(pLRSpace->ResolveTextLeft({})));
}
if ((0 != pLRSpace->GetRight()) || (pLRSpace->IsExplicitZeroMarginValRight()))
if ((0 != pLRSpace->ResolveRight({})) || (pLRSpace->IsExplicitZeroMarginValRight()))
{
pLRSpaceAttrList->add( FSNS(XML_w, (bEcma ? XML_right : XML_end)), OString::number(pLRSpace->GetRight()) );
pLRSpaceAttrList->add(FSNS(XML_w, (bEcma ? XML_right : XML_end)),
OString::number(pLRSpace->ResolveRight({})));
}
// tdf#83844: TODO: export FONT_CJK_ADVANCE first line indent as HangingChars/FirstLineChars
sal_Int32 const nFirstLineAdjustment = pLRSpace->ResolveTextFirstLineOffset({});

View file

@ -700,8 +700,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
const SvxULSpaceItem& aULSpaceItem = pFrameFormat->GetULSpace();
sal_Int64 nDistT = aULSpaceItem.GetUpper();
sal_Int64 nDistB = aULSpaceItem.GetLower();
sal_Int64 nDistL = aLRSpaceItem.GetLeft();
sal_Int64 nDistR = aLRSpaceItem.GetRight();
sal_Int64 nDistL = aLRSpaceItem.ResolveLeft({});
sal_Int64 nDistR = aLRSpaceItem.ResolveRight({});
// LibreOffice behaves different for frames and drawing objects, but MS Office treats frames
// as drawing objects too. Therefore we transform the values from frame so as if they come

View file

@ -116,11 +116,11 @@ void CollectFloatingTableAttributes(DocxExport& rExport, const ww8::Frame& rFram
if (nValue != 0)
pAttributes->add(FSNS(XML_w, XML_bottomFromText), OString::number(nValue));
nValue = rFrame.GetFrameFormat().GetLRSpace().GetLeft();
nValue = rFrame.GetFrameFormat().GetLRSpace().ResolveLeft({});
if (nValue != 0)
pAttributes->add(FSNS(XML_w, XML_leftFromText), OString::number(nValue));
nValue = rFrame.GetFrameFormat().GetLRSpace().GetRight();
nValue = rFrame.GetFrameFormat().GetLRSpace().ResolveRight({});
if (nValue != 0)
pAttributes->add(FSNS(XML_w, XML_rightFromText), OString::number(nValue));
@ -459,7 +459,7 @@ void DocxAttributeOutput::TableDefinition(
pJcVal = "left";
else
pJcVal = "start";
nIndent = sal_Int32(pTableFormat->GetLRSpace().GetLeft());
nIndent = pTableFormat->GetLRSpace().ResolveLeft({});
// Table indentation has different meaning in Word, depending if the table is nested or not.
// If nested, tblInd is added to parent table's left spacing and defines left edge position

View file

@ -788,10 +788,10 @@ void RtfAttributeOutput::TablePositioning(SwFrameFormat* pFlyFormat)
m_aRowDefs.append(static_cast<sal_Int32>(nTdfrmtxtBottom));
// Similar to RtfAttributeOutput::FormatLRSpace(), but for tables.
sal_uInt16 nTdfrmtxtLeft = pFlyFormat->GetLRSpace().GetLeft();
sal_uInt16 nTdfrmtxtLeft = pFlyFormat->GetLRSpace().ResolveLeft({});
m_aRowDefs.append(LO_STRING_SVTOOLS_RTF_TDFRMTXTLEFT);
m_aRowDefs.append(static_cast<sal_Int32>(nTdfrmtxtLeft));
sal_uInt16 nTdfrmtxtRight = pFlyFormat->GetLRSpace().GetRight();
sal_uInt16 nTdfrmtxtRight = pFlyFormat->GetLRSpace().ResolveRight({});
m_aRowDefs.append(LO_STRING_SVTOOLS_RTF_TDFRMTXTRIGHT);
m_aRowDefs.append(static_cast<sal_Int32>(nTdfrmtxtRight));
@ -868,7 +868,7 @@ void RtfAttributeOutput::TableDefinition(
// value of nSz is needed.
nSz += pCellFormat->GetFrameSize().GetWidth();
m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CELLX);
m_aRowDefs.append(static_cast<sal_Int32>(pFormat->GetLRSpace().GetLeft()
m_aRowDefs.append(static_cast<sal_Int32>(pFormat->GetLRSpace().ResolveLeft({})
+ rtl::math::round(nSz * fWidthRatio)));
}
}
@ -1093,7 +1093,7 @@ void RtfAttributeOutput::TableOrientation(
case text::HoriOrientation::NONE:
case text::HoriOrientation::LEFT_AND_WIDTH:
aTableAdjust.append(OOO_STRING_SVTOOLS_RTF_TRLEFT);
aTableAdjust.append(static_cast<sal_Int32>(pFormat->GetLRSpace().GetLeft()));
aTableAdjust.append(pFormat->GetLRSpace().ResolveLeft({}));
break;
default:
break;
@ -3252,7 +3252,8 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 n
SvxFirstLineIndentItem firstLine(rNdSet.Get(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem leftMargin(rNdSet.Get(RES_MARGIN_TEXTLEFT));
leftMargin.SetTextLeft(leftMargin.GetTextLeft() + pFormat->GetIndentAt());
leftMargin.SetTextLeft(
SvxIndentValue::twips(leftMargin.ResolveTextLeft({}) + pFormat->GetIndentAt()));
firstLine.SetTextFirstLineOffset(SvxIndentValue{
static_cast<double>(pFormat->GetFirstLineOffset()), pFormat->GetFirstLineOffsetUnit() });
@ -3388,9 +3389,9 @@ void RtfAttributeOutput::FormatFirstLineIndent(SvxFirstLineIndentItem const& rFi
void RtfAttributeOutput::FormatTextLeftMargin(SvxTextLeftMarginItem const& rTextLeftMargin)
{
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LI);
m_aStyles.append(static_cast<sal_Int32>(rTextLeftMargin.GetTextLeft()));
m_aStyles.append(rTextLeftMargin.ResolveTextLeft({}));
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LIN);
m_aStyles.append(static_cast<sal_Int32>(rTextLeftMargin.GetTextLeft()));
m_aStyles.append(rTextLeftMargin.ResolveTextLeft({}));
}
void RtfAttributeOutput::FormatRightMargin(SvxRightMarginItem const& rRightMargin)
@ -3401,9 +3402,9 @@ void RtfAttributeOutput::FormatRightMargin(SvxRightMarginItem const& rRightMargi
#endif
{
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RI);
m_aStyles.append(static_cast<sal_Int32>(rRightMargin.GetRight()));
m_aStyles.append(rRightMargin.ResolveRight({}));
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RIN);
m_aStyles.append(static_cast<sal_Int32>(rRightMargin.GetRight()));
m_aStyles.append(rRightMargin.ResolveRight({}));
}
}
@ -3424,15 +3425,15 @@ void RtfAttributeOutput::FormatLRSpace(const SvxLRSpaceItem& rLRSpace)
= pBoxItem->CalcLineSpace(SvxBoxItemLine::RIGHT, /*bEvenIfNoLine*/ true);
}
m_aPageMargins.nLeft += sal::static_int_cast<sal_uInt16>(rLRSpace.GetLeft());
m_aPageMargins.nRight += sal::static_int_cast<sal_uInt16>(rLRSpace.GetRight());
m_aPageMargins.nLeft += sal::static_int_cast<sal_uInt16>(rLRSpace.ResolveLeft({}));
m_aPageMargins.nRight += sal::static_int_cast<sal_uInt16>(rLRSpace.ResolveRight({}));
if (rLRSpace.GetLeft())
if (rLRSpace.ResolveLeft({}))
{
m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGLSXN);
m_aSectionBreaks.append(static_cast<sal_Int32>(m_aPageMargins.nLeft));
}
if (rLRSpace.GetRight())
if (rLRSpace.ResolveRight({}))
{
m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGRSXN);
m_aSectionBreaks.append(static_cast<sal_Int32>(m_aPageMargins.nRight));
@ -3451,13 +3452,13 @@ void RtfAttributeOutput::FormatLRSpace(const SvxLRSpaceItem& rLRSpace)
else
{
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LI);
m_aStyles.append(static_cast<sal_Int32>(rLRSpace.GetTextLeft()));
m_aStyles.append(rLRSpace.ResolveTextLeft({}));
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RI);
m_aStyles.append(static_cast<sal_Int32>(rLRSpace.GetRight()));
m_aStyles.append(rLRSpace.ResolveRight({}));
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LIN);
m_aStyles.append(static_cast<sal_Int32>(rLRSpace.GetTextLeft()));
m_aStyles.append(rLRSpace.ResolveTextLeft({}));
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RIN);
m_aStyles.append(static_cast<sal_Int32>(rLRSpace.GetRight()));
m_aStyles.append(rLRSpace.ResolveRight({}));
m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FI);
m_aStyles.append(rLRSpace.ResolveTextFirstLineOffset({}));
}
@ -3468,11 +3469,11 @@ void RtfAttributeOutput::FormatLRSpace(const SvxLRSpaceItem& rLRSpace)
m_aFlyProperties.push_back(std::make_pair<OString, OString>(
"dxWrapDistLeft"_ostr,
OString::number(
o3tl::convert(rLRSpace.GetLeft(), o3tl::Length::twip, o3tl::Length::emu))));
o3tl::convert(rLRSpace.ResolveLeft({}), o3tl::Length::twip, o3tl::Length::emu))));
m_aFlyProperties.push_back(std::make_pair<OString, OString>(
"dxWrapDistRight"_ostr,
OString::number(
o3tl::convert(rLRSpace.GetRight(), o3tl::Length::twip, o3tl::Length::emu))));
o3tl::convert(rLRSpace.ResolveRight({}), o3tl::Length::twip, o3tl::Length::emu))));
}
}

View file

@ -894,8 +894,10 @@ ErrCode RtfExport::ExportDocument_Impl()
{
const SvxLRSpaceItem& rLR = rFormatPage.GetLRSpace();
Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_MARGL);
Strm().WriteNumberAsString(rLR.GetLeft()).WriteOString(OOO_STRING_SVTOOLS_RTF_MARGR);
Strm().WriteNumberAsString(rLR.GetRight());
Strm()
.WriteNumberAsString(rLR.ResolveLeft({}))
.WriteOString(OOO_STRING_SVTOOLS_RTF_MARGR);
Strm().WriteNumberAsString(rLR.ResolveRight({}));
}
{

View file

@ -357,13 +357,15 @@ static SvxLRSpaceItem lcl_getWordLRSpace(const SwFrameFormat& rFormat)
SvxLRSpaceItem aLR(rFormat.GetLRSpace());
const SvxBoxItem& rBox = rFormat.GetBox();
aLR.SetLeft(aLR.GetLeft() + rBox.GetDistance(SvxBoxItemLine::LEFT));
aLR.SetLeft(
SvxIndentValue::twips(aLR.ResolveLeft({}) + rBox.GetDistance(SvxBoxItemLine::LEFT)));
if (const editeng::SvxBorderLine* pLeft = rBox.GetLeft())
aLR.SetLeft(aLR.GetLeft() + pLeft->GetWidth());
aLR.SetLeft(SvxIndentValue::twips(aLR.ResolveLeft({}) + pLeft->GetWidth()));
aLR.SetRight(aLR.GetRight() + rBox.GetDistance(SvxBoxItemLine::RIGHT));
aLR.SetRight(
SvxIndentValue::twips(aLR.ResolveRight({}) + rBox.GetDistance(SvxBoxItemLine::RIGHT)));
if (const editeng::SvxBorderLine* pRight = rBox.GetRight())
aLR.SetRight(aLR.GetRight() + pRight->GetWidth());
aLR.SetRight(SvxIndentValue::twips(aLR.ResolveRight({}) + pRight->GetWidth()));
return aLR;
}

View file

@ -2069,10 +2069,8 @@ sal_Int32 SwEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eS
*/
if (const SvxLRSpaceItem* pItem = rFormat.GetItemIfSet(RES_LR_SPACE))
{
rPropOpt.AddOpt( ESCHER_Prop_dxWrapDistLeft,
DrawModelToEmu( pItem->GetLeft() ) );
rPropOpt.AddOpt( ESCHER_Prop_dxWrapDistRight,
DrawModelToEmu( pItem->GetRight() ) );
rPropOpt.AddOpt(ESCHER_Prop_dxWrapDistLeft, DrawModelToEmu(pItem->ResolveLeft({})));
rPropOpt.AddOpt(ESCHER_Prop_dxWrapDistRight, DrawModelToEmu(pItem->ResolveRight({})));
}
else
{

View file

@ -3051,7 +3051,8 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
if ( pFormat->GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
leftMargin.SetTextLeft(leftMargin.GetTextLeft() + pFormat->GetAbsLSpace());
leftMargin.SetTextLeft(SvxIndentValue::twips(leftMargin.ResolveTextLeft({})
+ pFormat->GetAbsLSpace()));
}
if( rNode.IsNumbered() && rNode.IsCountedInList() )
@ -3170,9 +3171,10 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
SvxFirstLineIndentItem firstLine(pFirstLineIndent
? *pFirstLineIndent
: SvxFirstLineIndentItem(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem leftMargin(pTextLeftMargin
SvxTextLeftMarginItem leftMargin(
pTextLeftMargin
? *pTextLeftMargin
: SvxTextLeftMarginItem(0, RES_MARGIN_TEXTLEFT));
: SvxTextLeftMarginItem(SvxIndentValue::zero(), RES_MARGIN_TEXTLEFT));
// new left margin = old left + label space
const SwNumRule* pRule = rNode.GetNumRule();
@ -3190,13 +3192,15 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
if ( rNumFormat.GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
leftMargin.SetTextLeft(leftMargin.GetLeft(firstLine, /*metrics*/ {})
+ rNumFormat.GetAbsLSpace());
leftMargin.SetTextLeft(
SvxIndentValue::twips(leftMargin.ResolveLeft(firstLine, /*metrics*/ {})
+ rNumFormat.GetAbsLSpace()));
}
else
{
leftMargin.SetTextLeft(leftMargin.GetLeft(firstLine, /*metrics*/ {})
+ rNumFormat.GetIndentAt());
leftMargin.SetTextLeft(
SvxIndentValue::twips(leftMargin.ResolveLeft(firstLine, /*metrics*/ {})
+ rNumFormat.GetIndentAt()));
}
// new first line indent = 0

View file

@ -1729,15 +1729,16 @@ 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(),
SvxLRSpaceItem aResultLR(
SvxIndentValue::twips(rPageLR.ResolveLeft({}) + rSectionLR.ResolveLeft({})),
SvxIndentValue::twips(rPageLR.ResolveRight({}) + rSectionLR.ResolveRight({})),
SvxIndentValue::zero(), RES_LR_SPACE);
//i120133: The Section width should consider section indent value.
if (rSectionLR.GetLeft()+rSectionLR.GetRight()!=0)
if (rSectionLR.ResolveLeft({}) + rSectionLR.ResolveRight({}) != 0)
{
const SwFormatCol& rCol = rSepInfo.pSectionFormat->GetFormatAttr(RES_COL);
SwFormatCol aCol(rCol);
aCol.SetAdjustValue(rSectionLR.GetLeft()+rSectionLR.GetRight());
aCol.SetAdjustValue(rSectionLR.ResolveLeft({}) + rSectionLR.ResolveRight({}));
aSet.Put(aCol);
}
else

Some files were not shown because too many files have changed in this diff Show more