summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2020-04-17 12:58:59 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-04-22 18:03:02 +0200
commitcf13fe3e6f6a40f6db064d65d4514d13a23a31f0 (patch)
tree6a2124006d55765c9874a5b312e7a2d9cabf57d5 /writerfilter
parent90e73c8cb949e2ef96e9a77b2208f53e5feab3ab (diff)
tdf#108496: DOCX: redesign of override in lists
List level overrides are not just about numbering, it is about numbering restart. Thus some changes to DOCX import/export were added. Improved support for several lists referring the same abstract list, especially in situation when one list have overrides. In addition some export cleanup is made: less unnecessary list duplications, less level overrides when no properties were changed. Change-Id: Ic7a69bc2e3080b39f5205cb90b46d14247abf305 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92412 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx10
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx8
-rw-r--r--writerfilter/source/dmapper/NumberingManager.hxx4
3 files changed, 18 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3bbc3c8e00ff..d75ab67b2222 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1700,6 +1700,16 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
m_xPreviousParagraph->setPropertyValue("ListId", uno::makeAny(listId));
}
}
+ if (pList->GetCurrentLevel())
+ {
+ sal_Int16 nOverrideLevel = pList->GetCurrentLevel()->GetStartOverride();
+ if (nOverrideLevel != -1)
+ {
+ // Restart list, it is overriden
+ m_xPreviousParagraph->setPropertyValue("ParaIsNumberingRestart", uno::makeAny(true));
+ m_xPreviousParagraph->setPropertyValue("NumberingStartValue", uno::makeAny(nOverrideLevel));
+ }
+ }
}
}
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 5bb17c39ebd3..b855028c40f0 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -100,6 +100,9 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue )
case NS_ooxml::LN_CT_Lvl_start:
m_nIStartAt = nValue;
break;
+ case NS_ooxml::LN_CT_NumLvl_startOverride:
+ m_nStartOverride = nValue;
+ break;
case NS_ooxml::LN_CT_NumFmt_val:
m_nNFC = nValue;
break;
@@ -633,7 +636,6 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_POSITION_AND_SPACE_MODE), sal_Int16(text::PositionAndSpaceMode::LABEL_ALIGNMENT)));
-
// Replace the numbering rules for the level
m_xNumRules->replaceByIndex(nLevel, uno::makeAny(comphelper::containerToSequence(aLvlProps)));
@@ -1107,9 +1109,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
{
if (ListLevel::Pointer pCurrentLevel = m_pCurrentDefinition->GetCurrentLevel())
{
- // <w:num> -> <w:lvlOverride> -> <w:startOverride> is the non-abstract equivalent of
- // <w:abstractNum> -> <w:lvl> -> <w:start>
- pCurrentLevel->SetValue(NS_ooxml::LN_CT_Lvl_start, nIntValue);
+ pCurrentLevel->SetValue(NS_ooxml::LN_CT_NumLvl_startOverride, nIntValue);
}
}
}
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index 9dc034eff2b6..c337b88e9872 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -43,6 +43,7 @@ class StyleSheetEntry;
class ListLevel : public PropertyMap
{
sal_Int32 m_nIStartAt; //LN_CT_Lvl_start
+ sal_Int32 m_nStartOverride;
sal_Int32 m_nNFC; //LN_CT_Lvl_numFmt
/// LN_CT_NumFmt_format, in case m_nNFC is custom.
OUString m_aCustomNumberFormat;
@@ -61,6 +62,7 @@ public:
ListLevel() :
m_nIStartAt(-1)
+ ,m_nStartOverride(-1)
,m_nNFC(-1)
,m_nXChFollow(SvxNumberFormat::LISTTAB)
,m_nTabstop( 0 )
@@ -80,7 +82,9 @@ public:
// Getters
const OUString& GetBulletChar( ) const { return m_sBulletChar; };
const tools::SvRef< StyleSheetEntry >& GetParaStyle( ) const { return m_pParaStyle; };
+ sal_Int32 GetStartAt() const { return m_nIStartAt; };
bool isOutlineNumbering() const { return m_outline; }
+ sal_Int32 GetStartOverride() const { return m_nStartOverride; };
/// Determines if SetValue() was called at least once.
bool HasValues() const;