diff options
author | Justin Luth <justin_luth@sil.org> | 2018-01-12 20:44:06 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-15 13:57:29 +0100 |
commit | 7201d157a2ff2f0a8b6bb8fa57e31871187cbc81 (patch) | |
tree | 2eebe2d8f6cdacd102b79e52a081fa5471dbfec4 /writerfilter/source | |
parent | a6b69a9384801f77f4cc30a366a45561c28eab3e (diff) |
tdf#76817 ooxmlimport: connect Heading to existing numbers
This fixes the inability to insert a numbered Heading into
an existing sequence in an opened document. Before it would
start a new sequence, but now it connects to / adjusts
the other numbered Headings.
LibreOffice has built-in handling for "Chapter Numbering".
All of the formatting for this is tied to the paragraph stylename.
Since MSO has a different structure, in docx format these
are defined as "regular" styles with an OutlineLvl component.
During import, that style information was copied to LO's special
Outline chapter numbering style. *From this point on, the
"regular" list style should no longer be referred to.* Numbering is only
defined by the paragraph stylename (which by definition is "Heading X").
The unit test I am hijacking has an unchangeable Paragraph Numbering
style of "Outline Numbering" and not WWNumX. So, in reality the
document ought to require the style name to be the internal Outline
style like it originally was.
A followup patch allows this to round-trip.
Change-Id: If5d544529fa32d4abaa2b46403bc61c028e53f21
Reviewed-on: https://gerrit.libreoffice.org/47827
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.hxx | 1 |
4 files changed, 6 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index f79809c78fcd..2d56bd9a449b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2166,8 +2166,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) sal_Int32 nListId = pEntry ? lcl_getListId(pEntry, pStyleTable) : -1; if( pStyleSheetProperties && nListId >= 0 ) { - rContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( - ListDef::GetStyleName( nListId ) ), false); + if ( !pEntry->bIsChapterNumbering ) + rContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( ListDef::GetStyleName( nListId ) ), false); // We're inheriting properties from a numbering style. Make sure a possible right margin is inherited from the base style. sal_Int32 nParaRightMargin = 0; diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 273501e6ccc6..72308e05c117 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -629,6 +629,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, xOutlines->getChapterNumberingRules( ); StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( ); + pParaStyle->bIsChapterNumbering = true; aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HEADING_STYLE_NAME), pParaStyle->sConvertedStyleName)); xOutlineRules->replaceByIndex(nLevel, uno::makeAny(comphelper::containerToSequence(aLvlProps))); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 54a85958f11e..3e17b25eae89 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -56,6 +56,7 @@ StyleSheetEntry::StyleSheetEntry() : sStyleIdentifierI() ,sStyleIdentifierD() ,bIsDefaultStyle(false) + ,bIsChapterNumbering(false) ,bInvalidHeight(false) ,bHasUPE(false) ,nStyleTypeCode(STYLE_TYPE_UNKNOWN) @@ -73,8 +74,8 @@ StyleSheetEntry::~StyleSheetEntry() TableStyleSheetEntry::TableStyleSheetEntry( StyleSheetEntry const & rEntry ): StyleSheetEntry( ) { - bIsDefaultStyle = rEntry.bIsDefaultStyle; + bIsChapterNumbering = rEntry.bIsChapterNumbering; bInvalidHeight = rEntry.bInvalidHeight; bHasUPE = rEntry.bHasUPE; nStyleTypeCode = STYLE_TYPE_TABLE; diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index 40b65fb95694..959a2b9184a1 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -56,6 +56,7 @@ public: OUString sStyleIdentifierI; OUString sStyleIdentifierD; bool bIsDefaultStyle; + bool bIsChapterNumbering; //LO built-in Chapter Numbering "Outline" list style bool bInvalidHeight; bool bHasUPE; //universal property expansion StyleType nStyleTypeCode; //sgc |