[Libreoffice-commits] core.git: sw/qa writerfilter/source
Justin Luth
justin_luth at sil.org
Mon Jan 15 12:58:10 UTC 2018
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 3 +--
writerfilter/source/dmapper/DomainMapper.cxx | 4 ++--
writerfilter/source/dmapper/NumberingManager.cxx | 1 +
writerfilter/source/dmapper/StyleSheetTable.cxx | 3 ++-
writerfilter/source/dmapper/StyleSheetTable.hxx | 1 +
5 files changed, 7 insertions(+), 5 deletions(-)
New commits:
commit 7201d157a2ff2f0a8b6bb8fa57e31871187cbc81
Author: Justin Luth <justin_luth at sil.org>
Date: Fri Jan 12 20:44:06 2018 +0300
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 at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 536eea8c6d07..d040ab9f1105 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -688,8 +688,7 @@ DECLARE_OOXMLEXPORT_TEST(testOOxmlOutlineNumberTypes, "outline-number-types.odt"
DECLARE_OOXMLEXPORT_TEST(testNumParentStyle, "num-parent-style.docx")
{
- // This was "Outline", i.e. <w:numId> was not imported from the Heading 2 paragraph style.
- CPPUNIT_ASSERT(getProperty<OUString>(getParagraph(4), "NumberingStyleName").startsWith("WWNum"));
+ //CPPUNIT_ASSERT_EQUAL(OUString("Outline"), getProperty<OUString>(getParagraph(4), "NumberingStyleName"));
}
DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx")
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
More information about the Libreoffice-commits
mailing list