summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-11-23 16:57:57 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-11-24 10:43:24 +0100
commit8858962ec09478c203d43feb58f550bb36af37bb (patch)
tree74f672da8cba88d574e9922e36edfc35c0baeeaf /writerfilter
parent4521cb0c409036036f1340e3ffc4e8f113091ecc (diff)
Introduce ParagraphProeprtiesPropertyMap
StylePropertyMap and ParagraphPropertyMap should be has-a, not is-a ParagraphProperties. (I came across this with a tentative new loplugin flagging uses of dynamic_cast that implement cross casts between unrelated classes. This would silence that plugin, but also IMO makes intent more explicit here.) (And PropertyMap and ParagraphProperties no longer need their base classes to be virtual now.) Change-Id: Id89547f7824262b80e8a23c9c1d5ea6406dfcc9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143203 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx62
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx75
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx4
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx20
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx9
5 files changed, 96 insertions, 74 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 781cdfeac764..3521f705fdf8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -811,22 +811,22 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_FramePr_hSpace:
case NS_ooxml::LN_CT_FramePr_vSpace:
{
- ParagraphProperties* pParaProperties = nullptr;
+ ParagraphPropertiesPropertyMap* pParaProperties = nullptr;
// handle frame properties at styles
if( m_pImpl->GetTopContextType() == CONTEXT_STYLESHEET )
- pParaProperties = dynamic_cast< ParagraphProperties*>( m_pImpl->GetTopContextOfType( CONTEXT_STYLESHEET ).get() );
+ pParaProperties = dynamic_cast< ParagraphPropertiesPropertyMap*>( m_pImpl->GetTopContextOfType( CONTEXT_STYLESHEET ).get() );
else
- pParaProperties = dynamic_cast< ParagraphProperties*>( m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() );
+ pParaProperties = dynamic_cast< ParagraphPropertiesPropertyMap*>( m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() );
if( pParaProperties )
{
switch( nName )
{
case NS_ooxml::LN_CT_FramePr_dropCap:
- pParaProperties->SetDropCap( nIntValue );
+ pParaProperties->props().SetDropCap( nIntValue );
break;
case NS_ooxml::LN_CT_FramePr_lines:
- pParaProperties->SetLines( nIntValue );
+ pParaProperties->props().SetLines( nIntValue );
break;
case NS_ooxml::LN_CT_FramePr_hAnchor:
switch(nIntValue)
@@ -837,7 +837,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_Value_doc_ST_HAnchor_page: nIntValue = text::RelOrientation::PAGE_FRAME; break;
default:;
}
- pParaProperties->SethAnchor( nIntValue );
+ pParaProperties->props().SethAnchor( nIntValue );
break;
case NS_ooxml::LN_CT_FramePr_vAnchor:
switch(nIntValue)
@@ -848,11 +848,12 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_Value_doc_ST_VAnchor_page: nIntValue = text::RelOrientation::PAGE_FRAME; break;
default:;
}
- pParaProperties->SetvAnchor( nIntValue );
+ pParaProperties->props().SetvAnchor( nIntValue );
break;
case NS_ooxml::LN_CT_FramePr_x:
- pParaProperties->Setx( ConversionHelper::convertTwipToMM100(nIntValue ));
- pParaProperties->SetxAlign( text::HoriOrientation::NONE );
+ pParaProperties->props().Setx(
+ ConversionHelper::convertTwipToMM100(nIntValue ));
+ pParaProperties->props().SetxAlign( text::HoriOrientation::NONE );
break;
case NS_ooxml::LN_CT_FramePr_xAlign:
switch( nIntValue )
@@ -864,11 +865,12 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_Value_doc_ST_XAlign_left : nIntValue = text::HoriOrientation::LEFT; break;
default: nIntValue = text::HoriOrientation::NONE;
}
- pParaProperties->SetxAlign( nIntValue );
+ pParaProperties->props().SetxAlign( nIntValue );
break;
case NS_ooxml::LN_CT_FramePr_y:
- pParaProperties->Sety( ConversionHelper::convertTwipToMM100(nIntValue ));
- pParaProperties->SetyAlign( text::VertOrientation::NONE );
+ pParaProperties->props().Sety(
+ ConversionHelper::convertTwipToMM100(nIntValue ));
+ pParaProperties->props().SetyAlign( text::VertOrientation::NONE );
break;
case NS_ooxml::LN_CT_FramePr_yAlign:
switch( nIntValue )
@@ -891,7 +893,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
{
ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() );
if (pParaContext)
- pParaContext->SetFrameMode(false);
+ pParaContext->props().SetFrameMode(false);
}
nIntValue = text::VertOrientation::NONE;
break;
@@ -900,7 +902,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
nIntValue = text::VertOrientation::NONE;
break;
}
- pParaProperties->SetyAlign( nIntValue );
+ pParaProperties->props().SetyAlign( nIntValue );
break;
case NS_ooxml::LN_CT_FramePr_hRule:
switch( nIntValue )
@@ -916,7 +918,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
default:;
nIntValue = text::SizeType::VARIABLE;
}
- pParaProperties->SethRule( nIntValue );
+ pParaProperties->props().SethRule( nIntValue );
break;
case NS_ooxml::LN_CT_FramePr_wrap:
{
@@ -929,26 +931,30 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
"wrap not around, not_Beside, through, none or auto?");
if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_through ||
sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_auto )
- pParaProperties->SetWrap ( text::WrapTextMode_DYNAMIC ) ;
+ pParaProperties->props().SetWrap ( text::WrapTextMode_DYNAMIC ) ;
else if (sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_around)
- pParaProperties->SetWrap(text::WrapTextMode_PARALLEL);
+ pParaProperties->props().SetWrap(text::WrapTextMode_PARALLEL);
else if (sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_none)
- pParaProperties->SetWrap ( text::WrapTextMode_THROUGH ) ;
+ pParaProperties->props().SetWrap ( text::WrapTextMode_THROUGH ) ;
else
- pParaProperties->SetWrap ( text::WrapTextMode_NONE ) ;
+ pParaProperties->props().SetWrap ( text::WrapTextMode_NONE ) ;
}
break;
case NS_ooxml::LN_CT_FramePr_w:
- pParaProperties->Setw(ConversionHelper::convertTwipToMM100(nIntValue));
+ pParaProperties->props().Setw(
+ ConversionHelper::convertTwipToMM100(nIntValue));
break;
case NS_ooxml::LN_CT_FramePr_h:
- pParaProperties->Seth(ConversionHelper::convertTwipToMM100(nIntValue));
+ pParaProperties->props().Seth(
+ ConversionHelper::convertTwipToMM100(nIntValue));
break;
case NS_ooxml::LN_CT_FramePr_hSpace:
- pParaProperties->SethSpace( ConversionHelper::convertTwipToMM100(nIntValue ));
+ pParaProperties->props().SethSpace(
+ ConversionHelper::convertTwipToMM100(nIntValue ));
break;
case NS_ooxml::LN_CT_FramePr_vSpace:
- pParaProperties->SetvSpace( ConversionHelper::convertTwipToMM100(nIntValue ));
+ pParaProperties->props().SetvSpace(
+ ConversionHelper::convertTwipToMM100(nIntValue ));
break;
default:;
}
@@ -1332,7 +1338,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
if (ParagraphPropertyMap* pParaContext
= dynamic_cast<ParagraphPropertyMap*>(m_pImpl->GetTopContext().get()))
{
- pParaContext->SetParaId(sStringValue);
+ pParaContext->props().SetParaId(sStringValue);
}
break;
default:
@@ -1428,7 +1434,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
//style sheets cannot have a numbering rule attached
StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
if (pStyleSheetPropertyMap)
- pStyleSheetPropertyMap->SetListId( nIntValue );
+ pStyleSheetPropertyMap->props().SetListId( nIntValue );
}
if( pList )
{
@@ -1440,7 +1446,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
if (pContext)
{
assert(dynamic_cast<ParagraphPropertyMap*>(pContext.get()));
- static_cast<ParagraphPropertyMap*>(pContext.get())->SetListId(pList->GetId());
+ static_cast<ParagraphPropertyMap*>(pContext.get())->props().SetListId(pList->GetId());
}
// Indentation can came from:
@@ -2259,7 +2265,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() );
if (pParaContext)
- pParaContext->SetFrameMode();
+ pParaContext->props().SetFrameMode();
if (!IsInHeaderFooter())
m_pImpl->m_bIsActualParagraphFramed = true;
@@ -4018,7 +4024,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
// to the next paragraph in sw SplitNode and then be applied to
// every following paragraph
xContext->Erase(PROP_NUMBERING_RULES);
- static_cast<ParagraphPropertyMap*>(xContext.get())->SetListId(-1);;
+ static_cast<ParagraphPropertyMap*>(xContext.get())->props().SetListId(-1);;
xContext->Erase(PROP_NUMBERING_LEVEL);
}
finishParagraph(bRemove, bNoNumbering);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6477e58bbdaf..ec0861caa4e3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -135,7 +135,7 @@ static void lcl_linenumberingHeaderFooter( const uno::Reference<container::XName
const StyleSheetPropertyMap* pStyleSheetProperties = pEntry->pProperties.get();
if ( !pStyleSheetProperties )
return;
- sal_Int32 nListId = pStyleSheetProperties->GetListId();
+ sal_Int32 nListId = pStyleSheetProperties->props().GetListId();
if( xStyles.is() )
{
if( xStyles->hasByName( rname ) )
@@ -204,7 +204,7 @@ static uno::Any lcl_GetPropertyFromParaStyleSheetNoNum(PropertyIds eId, StyleShe
pEntry->pProperties->getProperty(eId);
if (aProperty)
{
- if (pEntry->pProperties->GetListId())
+ if (pEntry->pProperties->props().GetListId())
// It is a paragraph style with list. Paragraph list styles are not taken into account
return uno::Any();
else
@@ -1561,7 +1561,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
sal_Int32 nWidth =
rAppendContext.pLastParagraphProperties->Getw() > 0 ?
rAppendContext.pLastParagraphProperties->Getw() :
- pStyleProperties->Getw();
+ pStyleProperties->props().Getw();
bool bAutoWidth = nWidth < 1;
if( bAutoWidth )
nWidth = DEFAULT_FRAME_MIN_WIDTH;
@@ -1570,16 +1570,16 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HEIGHT),
rAppendContext.pLastParagraphProperties->Geth() > 0 ?
rAppendContext.pLastParagraphProperties->Geth() :
- pStyleProperties->Geth() > 0 ? pStyleProperties->Geth() : DEFAULT_FRAME_MIN_HEIGHT));
+ pStyleProperties->props().Geth() > 0 ? pStyleProperties->props().Geth() : DEFAULT_FRAME_MIN_HEIGHT));
sal_Int16 nhRule = sal_Int16(
rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
rAppendContext.pLastParagraphProperties->GethRule() :
- pStyleProperties->GethRule());
+ pStyleProperties->props().GethRule());
if ( nhRule < 0 )
{
if ( rAppendContext.pLastParagraphProperties->Geth() >= 0 ||
- pStyleProperties->GethRule() >= 0 )
+ pStyleProperties->props().GethRule() >= 0 )
{
// [MS-OE376] Word uses a default value of "atLeast" for
// this attribute when the value of the h attribute is not 0.
@@ -1602,55 +1602,59 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
sal_Int16 nHoriOrient = sal_Int16(
rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ?
rAppendContext.pLastParagraphProperties->GetxAlign() :
- pStyleProperties->GetxAlign() >= 0 ? pStyleProperties->GetxAlign() : text::HoriOrientation::NONE );
+ pStyleProperties->props().GetxAlign() >= 0 ? pStyleProperties->props().GetxAlign() : text::HoriOrientation::NONE );
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT), nHoriOrient));
//set a non negative default value
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION),
rAppendContext.pLastParagraphProperties->IsxValid() ?
rAppendContext.pLastParagraphProperties->Getx() :
- pStyleProperties->IsxValid() ? pStyleProperties->Getx() : DEFAULT_VALUE));
+ pStyleProperties->props().IsxValid()
+ ? pStyleProperties->props().Getx() : DEFAULT_VALUE));
//Default the anchor in case FramePr_hAnchor is missing ECMA 17.3.1.11
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_RELATION), sal_Int16(
rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ?
rAppendContext.pLastParagraphProperties->GethAnchor() :
- pStyleProperties->GethAnchor() >=0 ? pStyleProperties->GethAnchor() : text::RelOrientation::FRAME )));
+ pStyleProperties->props().GethAnchor() >=0 ? pStyleProperties->props().GethAnchor() : text::RelOrientation::FRAME )));
sal_Int16 nVertOrient = sal_Int16(
rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
rAppendContext.pLastParagraphProperties->GetyAlign() :
- pStyleProperties->GetyAlign() >= 0 ? pStyleProperties->GetyAlign() : text::VertOrientation::NONE );
+ pStyleProperties->props().GetyAlign() >= 0 ? pStyleProperties->props().GetyAlign() : text::VertOrientation::NONE );
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), nVertOrient));
//set a non negative default value
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_POSITION),
rAppendContext.pLastParagraphProperties->IsyValid() ?
rAppendContext.pLastParagraphProperties->Gety() :
- pStyleProperties->IsyValid() ? pStyleProperties->Gety() : DEFAULT_VALUE));
+ pStyleProperties->props().IsyValid()
+ ? pStyleProperties->props().Gety() : DEFAULT_VALUE));
//Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11
if (rAppendContext.pLastParagraphProperties->GetWrap() == text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE &&
- pStyleProperties->GetWrap() == text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
+ pStyleProperties->props().GetWrap()
+ == text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
{
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), sal_Int16(
rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ?
rAppendContext.pLastParagraphProperties->GetvAnchor() :
- pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::FRAME)));
+ pStyleProperties->props().GetvAnchor() >= 0 ? pStyleProperties->props().GetvAnchor() : text::RelOrientation::FRAME)));
}
else
{
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), sal_Int16(
rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ?
rAppendContext.pLastParagraphProperties->GetvAnchor() :
- pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::PAGE_PRINT_AREA)));
+ pStyleProperties->props().GetvAnchor() >= 0 ? pStyleProperties->props().GetvAnchor() : text::RelOrientation::PAGE_PRINT_AREA)));
}
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SURROUND),
rAppendContext.pLastParagraphProperties->GetWrap() != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE
? rAppendContext.pLastParagraphProperties->GetWrap()
- : pStyleProperties->GetWrap() != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE
- ? pStyleProperties->GetWrap()
+ : pStyleProperties->props().GetWrap()
+ != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE
+ ? pStyleProperties->props().GetWrap()
: text::WrapTextMode_NONE ));
/** FDO#73546 : distL & distR should be unsigned integers <Ecma 20.4.3.6>
@@ -1661,7 +1665,8 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
sal_Int32 nLeftDist = nRightDist =
rAppendContext.pLastParagraphProperties->GethSpace() >= 0 ?
rAppendContext.pLastParagraphProperties->GethSpace() :
- pStyleProperties->GethSpace() >= 0 ? pStyleProperties->GethSpace() : 0;
+ pStyleProperties->props().GethSpace() >= 0
+ ? pStyleProperties->props().GethSpace() : 0;
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LEFT_MARGIN), nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_RIGHT_MARGIN), nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
@@ -1670,7 +1675,8 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
sal_Int32 nTopDist = nBottomDist =
rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ?
rAppendContext.pLastParagraphProperties->GetvSpace() :
- pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0;
+ pStyleProperties->props().GetvSpace() >= 0
+ ? pStyleProperties->props().GetvSpace() : 0;
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN), nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN), nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
@@ -1779,7 +1785,7 @@ static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleShee
if (!pEntryProperties)
return -1;
- sal_Int32 nListId = pEntryProperties->GetListId();
+ sal_Int32 nListId = pEntryProperties->props().GetListId();
// The style itself has a list id.
if (nListId >= 0)
return nListId;
@@ -1927,7 +1933,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
const StyleSheetEntryPtr pEntry = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( GetCurrentParaStyleName() );
OSL_ENSURE( pEntry, "no style sheet found" );
const StyleSheetPropertyMap* pStyleSheetProperties = pEntry ? pEntry->pProperties.get() : nullptr;
- sal_Int32 nListId = pParaContext ? pParaContext->GetListId() : -1;
+ sal_Int32 nListId = pParaContext ? pParaContext->props().GetListId() : -1;
bool isNumberingViaStyle(false);
bool isNumberingViaRule = nListId > -1;
if ( !bRemove && pStyleSheetProperties && pParaContext )
@@ -2135,8 +2141,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
*/
bool bIsDropCap =
- pParaContext->IsFrameMode() &&
- sal::static_int_cast<Id>(pParaContext->GetDropCap()) != NS_ooxml::LN_Value_doc_ST_DropCap_none;
+ pParaContext->props().IsFrameMode() &&
+ sal::static_int_cast<Id>(pParaContext->props().GetDropCap()) != NS_ooxml::LN_Value_doc_ST_DropCap_none;
style::DropCapFormat aDrop;
ParagraphPropertiesPtr pToBeSavedProperties;
@@ -2151,7 +2157,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
xParaProperties->setPropertyToDefault(getPropertyName(PROP_CHAR_ESCAPEMENT));
xParaProperties->setPropertyToDefault(getPropertyName(PROP_CHAR_HEIGHT));
//handles (2) and part of (6)
- pToBeSavedProperties = new ParagraphProperties(*pParaContext);
+ pToBeSavedProperties = new ParagraphProperties(pParaContext->props());
sal_Int32 nCount = xParaCursor->getString().getLength();
pToBeSavedProperties->SetDropCapLength(nCount > 0 && nCount < 255 ? static_cast<sal_Int8>(nCount) : 1);
}
@@ -2167,10 +2173,10 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
sal_Int32 nHSpace = rAppendContext.pLastParagraphProperties->GethSpace();
aDrop.Distance = nHSpace > 0 && nHSpace < SAL_MAX_INT16 ? static_cast<sal_Int16>(nHSpace) : 0;
//completes (5)
- if( pParaContext->IsFrameMode() )
- pToBeSavedProperties = new ParagraphProperties(*pParaContext);
+ if( pParaContext->props().IsFrameMode() )
+ pToBeSavedProperties = new ParagraphProperties(pParaContext->props());
}
- else if(*rAppendContext.pLastParagraphProperties == *pParaContext )
+ else if(*rAppendContext.pLastParagraphProperties == pParaContext->props() )
{
//handles (7)
rAppendContext.pLastParagraphProperties->SetEndingRange(rAppendContext.xInsertPosition.is() ? rAppendContext.xInsertPosition : xTextAppend->getEnd());
@@ -2182,9 +2188,9 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
CheckUnregisteredFrameConversion( );
// If different frame properties are set on this paragraph, keep them.
- if ( !bIsDropCap && pParaContext->IsFrameMode() )
+ if ( !bIsDropCap && pParaContext->props().IsFrameMode() )
{
- pToBeSavedProperties = new ParagraphProperties(*pParaContext);
+ pToBeSavedProperties = new ParagraphProperties(pParaContext->props());
lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap, rAppendContext);
}
}
@@ -2193,9 +2199,9 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
{
// (1) doesn't need handling
- if( !bIsDropCap && pParaContext->IsFrameMode() )
+ if( !bIsDropCap && pParaContext->props().IsFrameMode() )
{
- pToBeSavedProperties = new ParagraphProperties(*pParaContext);
+ pToBeSavedProperties = new ParagraphProperties(pParaContext->props());
lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap, rAppendContext);
}
}
@@ -2612,13 +2618,14 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
}
bool bIgnoreFrameState = IsInHeaderFooter();
- if( (!bIgnoreFrameState && pParaContext && pParaContext->IsFrameMode()) || (bIgnoreFrameState && GetIsPreviousParagraphFramed()) )
+ if( (!bIgnoreFrameState && pParaContext && pParaContext->props().IsFrameMode()) || (bIgnoreFrameState && GetIsPreviousParagraphFramed()) )
SetIsPreviousParagraphFramed(true);
else
SetIsPreviousParagraphFramed(false);
m_bRemoveThisParagraph = false;
- if( !IsInHeaderFooter() && !IsInShape() && (!pParaContext || !pParaContext->IsFrameMode()) )
+ if( !IsInHeaderFooter() && !IsInShape()
+ && (!pParaContext || !pParaContext->props().IsFrameMode()) )
{ // If the paragraph is in a frame, shape or header/footer, it's not a paragraph of the section itself.
SetIsFirstParagraphInSection(false);
// don't count an empty deleted paragraph as first paragraph in section to avoid of
@@ -2634,7 +2641,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
if (m_bIsInComments && pParaContext)
{
- if (const OUString sParaId = pParaContext->GetParaId(); !sParaId.isEmpty())
+ if (const OUString sParaId = pParaContext->props().GetParaId(); !sParaId.isEmpty())
{
if (const auto& item = m_aCommentProps.find(sParaId); item != m_aCommentProps.end())
{
@@ -2649,7 +2656,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
if (pParaContext)
{
// Reset the frame properties for the next paragraph
- pParaContext->ResetFrameProperties();
+ pParaContext->props().ResetFrameProperties();
}
SetIsOutsideAParagraph(true);
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 8c84a1208b15..6be6e7310686 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -1132,9 +1132,9 @@ AbstractListDef::Pointer ListsManager::GetAbstractList( sal_Int32 nId )
const StyleSheetPropertyMap* pStyleSheetProperties =
pStyleSheetEntry ? pStyleSheetEntry->pProperties.get() : nullptr;
- if( pStyleSheetProperties && pStyleSheetProperties->GetListId() >= 0 )
+ if( pStyleSheetProperties && pStyleSheetProperties->props().GetListId() >= 0 )
{
- ListDef::Pointer pList = GetList( pStyleSheetProperties->GetListId() );
+ ListDef::Pointer pList = GetList( pStyleSheetProperties->props().GetListId() );
if ( pList!=nullptr )
return pList->GetAbstractDefinition();
}
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index b222c5d1508d..f9f66e3dcc0b 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -130,7 +130,7 @@ public:
class PropertyMap;
typedef tools::SvRef< PropertyMap > PropertyMapPtr;
-class PropertyMap : public virtual SvRefBase
+class PropertyMap : public SvRefBase
{
private:
// Cache the property values for the GetPropertyValues() call(s).
@@ -412,7 +412,7 @@ public:
void ClearHeaderFooterLinkToPrevious( bool bHeader, PageType eType );
};
-class ParagraphProperties : public virtual SvRefBase
+class ParagraphProperties : public SvRefBase
{
private:
bool m_bFrameMode;
@@ -521,6 +521,16 @@ public:
typedef tools::SvRef< ParagraphProperties > ParagraphPropertiesPtr;
+class ParagraphPropertiesPropertyMap: public PropertyMap {
+public:
+ ParagraphProperties & props() { return m_props; }
+
+ ParagraphProperties const & props() const { return m_props; }
+
+private:
+ ParagraphProperties m_props;
+};
+
/*-------------------------------------------------------------------------
property map of a stylesheet
-----------------------------------------------------------------------*/
@@ -529,8 +539,7 @@ typedef tools::SvRef< ParagraphProperties > ParagraphPropertiesPtr;
#define WW_OUTLINE_MIN sal_Int16( 0 )
class StyleSheetPropertyMap
- : public PropertyMap
- , public ParagraphProperties
+ : public ParagraphPropertiesPropertyMap
{
private:
sal_Int16 mnListLevel;
@@ -547,8 +556,7 @@ public:
};
class ParagraphPropertyMap
- : public PropertyMap
- , public ParagraphProperties
+ : public ParagraphPropertiesPropertyMap
{
public:
explicit ParagraphPropertyMap() {}
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index cb0bd5a922b9..9641a2a032bd 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -910,7 +910,7 @@ void StyleSheetTable::ApplyNumberingStyleNameToParaStyles()
if ( pEntry->nStyleTypeCode == STYLE_TYPE_PARA && (pStyleSheetProperties = pEntry->pProperties.get()) )
{
// ListId 0 means turn off numbering - to cancel inheritance - so make sure that can be set.
- if (pStyleSheetProperties->GetListId() > -1)
+ if (pStyleSheetProperties->props().GetListId() > -1)
{
uno::Reference< style::XStyle > xStyle;
xParaStyles->getByName( ConvertStyleName(pEntry->sStyleName) ) >>= xStyle;
@@ -919,8 +919,9 @@ void StyleSheetTable::ApplyNumberingStyleNameToParaStyles()
break;
uno::Reference<beans::XPropertySet> xPropertySet( xStyle, uno::UNO_QUERY_THROW );
- const OUString sNumberingStyleName = m_pImpl->m_rDMapper.GetListStyleName( pStyleSheetProperties->GetListId() );
- if ( !sNumberingStyleName.isEmpty() || !pStyleSheetProperties->GetListId() )
+ const OUString sNumberingStyleName = m_pImpl->m_rDMapper.GetListStyleName( pStyleSheetProperties->props().GetListId() );
+ if ( !sNumberingStyleName.isEmpty()
+ || !pStyleSheetProperties->props().GetListId() )
xPropertySet->setPropertyValue( getPropertyName(PROP_NUMBERING_STYLE_NAME), uno::Any(sNumberingStyleName) );
// Word 2010+ (not Word 2003, and Word 2007 is completely broken)
@@ -1063,7 +1064,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
xStyle.set(xStyles->getByName(sConvertedStyleName), uno::UNO_QUERY_THROW);
StyleSheetPropertyMap* pPropertyMap = pEntry->pProperties.get();
- if (pPropertyMap && pPropertyMap->GetListId() == -1)
+ if (pPropertyMap && pPropertyMap->props().GetListId() == -1)
{
// No properties? Word default is 'none', Writer one is 'arabic', handle this.
uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY_THROW);