[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 4 commits - sw/qa sw/source writerfilter/qa writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 6 08:08:15 UTC 2020
sw/qa/extras/ooxmlexport/data/table-style-conf-nested.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 44 +++++
sw/qa/uibase/shells/shells.cxx | 4
sw/source/filter/ww8/docxattributeoutput.cxx | 21 +-
sw/source/filter/ww8/docxattributeoutput.hxx | 2
sw/source/filter/ww8/wrtw8sty.cxx | 84 ++++++++++
writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 17 ++
writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx |binary
writerfilter/source/dmapper/GraphicImport.cxx | 1
9 files changed, 161 insertions(+), 12 deletions(-)
New commits:
commit 4b16d500a2e2881df48f533c5961e8b930826baf
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 11 09:51:14 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 6 09:57:48 2020 +0200
DOCX import: fix margins of inline shapes with effects, imported as Draw shapes
Effects have an extent, and unhandled effects (like this blurred shadow)
need to take space in the margin of the shape to make sure they use the
correct amount of space in the layout.
This was working in general, but not in case the importer decided to
import the shape as Draw shape + the shape was inline.
(And also disable a new CppunitTest_sw_uibase_shells test on Windows,
which is only stable on Linux, it seems.)
(cherry picked from commit bf25e69f8f657d5e3bcdd0bd54c5fa0d66ec85fe)
Conflicts:
writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
Change-Id: I9d0531d9393d8c2cd274e6f54bbbfe8024bf270f
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 05b5c6b5e27b..376f95b18c59 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -81,8 +81,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testTdf130179)
CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment)
{
-// FIXME find out why this fails on macOS
-#ifndef MACOSX
+// FIXME find out why this fails on macOS/Windows
+#if !defined(MACOSX) && !defined(_WIN32)
// Create a document with a rectangle in it.
SwDoc* pDoc = createDoc();
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
index d2143a2366c4..f20694b828cc 100644
--- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
@@ -90,6 +90,23 @@ CPPUNIT_TEST_FIXTURE(Test, testRelfromhInsidemargin)
xShape->getPropertyValue("PageToggle") >>= bPageToggle;
CPPUNIT_ASSERT(bPageToggle);
}
+
+CPPUNIT_TEST_FIXTURE(Test, testDrawShapeInlineEffect)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "draw-shape-inline-effect.docx";
+ getComponent() = loadFromDesktop(aURL);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ sal_Int32 nBottomMargin = 0;
+ xShape->getPropertyValue("BottomMargin") >>= nBottomMargin;
+ // 273 in mm100 is 98425 EMUs from the file.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 273
+ // - Actual : 0
+ // i.e. the layout result had less pages than expected (compared to Word).
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(273), nBottomMargin);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx b/writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx
new file mode 100644
index 000000000000..3eb5b0e2f448
Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx differ
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index a2c19383c95d..b69f4565fb13 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -897,6 +897,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
else if (bUseShape && m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_INLINE)
{
uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW);
+ m_pImpl->applyMargins(xShapeProps);
comphelper::SequenceAsHashMap aInteropGrabBag(xShapeProps->getPropertyValue("InteropGrabBag"));
aInteropGrabBag.update(m_pImpl->getInteropGrabBag());
xShapeProps->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag.getAsConstPropertyValueList()));
commit 9b13dab4da0bbfa560a6bbe6c26dd9cff2a2537b
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 7 16:06:19 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 6 09:56:10 2020 +0200
DOCX export: fix handling of section starts that originally had page margins
This is similar to commit 26f2a9e1a10a22e864e71ee7c94934821703e021 (DOCX
export: fix handling of section starts that originally had headers,
2020-02-06), except here the top margin has to taken from that follow
page style, not the header.
Without this, it can happen that the page number in the original Writer
doc model and the exported Word result do not match.
This required reworking WriteNextStyleHeaderFooter(), which assumed that
the header/footer status is already calculated by the time its called.
But the page margin code runs earlier, so we need to make that decision
earlier, even when the header/footer status is not yet calculated.
Change-Id: Ife7396603702d2048d544aa46f96acfa337a041a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88211
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
(cherry picked from commit f0decd9c932b50eddeecd49a6ee44182e78be938)
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 9e81f4552670..f96451dda24d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -459,6 +459,18 @@ DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-
// - Expected: Header, section 2
// - Actual : First page header, section 2
// i.e. both the header and the footer on page 3 was wrong.
+
+ // Additional problem: top margin on page 3 was wrong.
+ if (mbExported)
+ {
+ xmlDocPtr pXml = parseExport("word/document.xml");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 2200
+ // - Actual : 2574
+ // i.e. the top margin on page 3 was too large and now matches the value from the input
+ // document.
+ assertXPath(pXml, "/w:document/w:body/w:sectPr/w:pgMar", "top", "2200");
+ }
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 2908f78fef0e..bfe6483b7f41 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1523,11 +1523,11 @@ void WW8Export::WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
namespace
{
/**
- * Find a node near the section start that has a page break, it may have a follow header/footer for
- * us.
+ * Determines if the continuous section break we start should use page style properties (header,
+ * footer, margins) from the next page style of the previous section.
*/
-bool WriteNextStyleHeaderFooter(sal_uInt8 nBreakCode, sal_uInt8 nHeadFootFlags,
- const SwPageDesc* pPd, const WW8_SepInfo& rSepInfo)
+bool UsePrevSectionNextStyle(sal_uInt8 nBreakCode, const SwPageDesc* pPd,
+ const WW8_SepInfo& rSepInfo)
{
if (nBreakCode != 0)
{
@@ -1535,12 +1535,6 @@ bool WriteNextStyleHeaderFooter(sal_uInt8 nBreakCode, sal_uInt8 nHeadFootFlags,
return false;
}
- if (nHeadFootFlags != 0)
- {
- // Would write some header/footer anyway.
- return false;
- }
-
if (!pPd->GetFollow())
{
// Page style has no follow style.
@@ -1624,6 +1618,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
bool bOutPgDscSet = true, bLeftRightPgChain = false, bOutputStyleItemSet = false;
bool bEnsureHeaderFooterWritten = rSepInfo.pSectionFormat && rSepInfo.bIsFirstParagraph;
const SwFrameFormat* pPdFormat = &pPd->GetMaster();
+ bool bUsePrevSectionNextStyle = false;
if ( rSepInfo.pSectionFormat )
{
// if pSectionFormat is set, then there is a SectionNode
@@ -1649,6 +1644,15 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
// produce Itemset, which inherits PgDesk-Attr-Set:
// as child also the parent is searched if 'deep'-OutputItemSet
const SfxItemSet* pPdSet = &pPdFormat->GetAttrSet();
+
+ bUsePrevSectionNextStyle = GetExportFormat() == ExportFormat::DOCX
+ && UsePrevSectionNextStyle(nBreakCode, pPd, rSepInfo);
+ if (bUsePrevSectionNextStyle)
+ {
+ // Take page margins from the previous section's next style.
+ pPdSet = &pPd->GetFollow()->GetMaster().GetAttrSet();
+ }
+
SfxItemSet aSet( *pPdSet->GetPool(), pPdSet->GetRanges() );
aSet.SetParent( pPdSet );
@@ -1841,9 +1845,9 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
const SwTextNode *pOldPageRoot = GetHdFtPageRoot();
SetHdFtPageRoot( rSepInfo.pPDNd ? rSepInfo.pPDNd->GetTextNode() : nullptr );
- if (GetExportFormat() == ExportFormat::DOCX
- && WriteNextStyleHeaderFooter(nBreakCode, nHeadFootFlags, pPd, rSepInfo))
+ if (bUsePrevSectionNextStyle && nHeadFootFlags == 0)
{
+ // Take headers/footers from the previous section's next style.
pPdFormat = &pPd->GetFollow()->GetMaster();
MSWordSections::SetHeaderFlag(nHeadFootFlags, *pPdFormat, WW8_HEADER_ODD);
MSWordSections::SetFooterFlag(nHeadFootFlags, *pPdFormat, WW8_FOOTER_ODD);
commit 1b0f859c625b32c9fb21d0fc67b786f464794389
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Feb 6 14:47:08 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 6 09:54:46 2020 +0200
DOCX export: fix handling of section starts that originally had headers
Both the DOC import (in wwSectionManager::InsertSegments()) and DOCX
import (in SectionPropertyMap::CloseSectionGroup()) have a mechanism to
try to attach changed headers/footers from a continuous section break
somewhere, so they are not lost.
This means that even if the rendering of such documents is OK, explicit
code is needed to undo the effect of the importer at export time, or
those headers will be lost.
Start doing this for the DOCX export case when the headers/footers are
placed at the "previous-in-practice" paragraph, more cases (handled at
the import side) can be added later.
(cherry picked from commit 26f2a9e1a10a22e864e71ee7c94934821703e021)
Conflicts:
sw/source/filter/ww8/wrtw8sty.cxx
Change-Id: Ic2304a74919d18da3ba9cb4afe301e0247a50dc2
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 5ef10cc73ca1..9e81f4552670 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -430,7 +430,7 @@ DECLARE_OOXMLEXPORT_TEST(testHyphenationAuto, "hyphenation.odt")
assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:pPrDefault/w:pPr/w:suppressAutoHyphens", "val", "true");
}
-DECLARE_OOXMLIMPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-footer.docx")
+DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-footer.docx")
{
// Load a document with a continuous section break on page 2.
CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 1"),
@@ -454,6 +454,11 @@ DECLARE_OOXMLIMPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-
// the own footer text.
CPPUNIT_ASSERT_EQUAL(OUString("Footer, section 3"),
parseDump("/root/page[3]/footer/txt/text()"));
+
+ // Without the export fix in place, the import-export-import test would have failed with:
+ // - Expected: Header, section 2
+ // - Actual : First page header, section 2
+ // i.e. both the header and the footer on page 3 was wrong.
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index d04cfeb8e6f8..2908f78fef0e 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -34,6 +34,7 @@
#include <editeng/frmdiritem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
+#include <editeng/fhgtitem.hxx>
#include <doc.hxx>
#include "wrtww8.hxx"
#include <docary.hxx>
@@ -60,6 +61,7 @@
#include <redline.hxx>
#include <msfilter.hxx>
#include <swmodule.hxx>
+#include <charatr.hxx>
#include "sprmids.hxx"
@@ -1518,6 +1520,76 @@ void WW8Export::WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
pSepx->OutHeaderFooter( *this, false, rFirstPageFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_FIRST, nBreakCode );
}
+namespace
+{
+/**
+ * Find a node near the section start that has a page break, it may have a follow header/footer for
+ * us.
+ */
+bool WriteNextStyleHeaderFooter(sal_uInt8 nBreakCode, sal_uInt8 nHeadFootFlags,
+ const SwPageDesc* pPd, const WW8_SepInfo& rSepInfo)
+{
+ if (nBreakCode != 0)
+ {
+ // Not a continuous section break.
+ return false;
+ }
+
+ if (nHeadFootFlags != 0)
+ {
+ // Would write some header/footer anyway.
+ return false;
+ }
+
+ if (!pPd->GetFollow())
+ {
+ // Page style has no follow style.
+ return false;
+ }
+
+ // We start a continuous section break without headers/footers. Possibly the importer had
+ // headers/footers for this section break and put them to the closest page break's page style's
+ // next page style. See "find a node in the section that has a page break" in writerfilter/.
+ // Try the last-in-practice paragraph of the previous section.
+ const SwSectionFormat* pSection = rSepInfo.pSectionFormat;
+ if (pSection == reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)))
+ {
+ return false;
+ }
+
+ const SwNodeIndex* pSectionStart = pSection->GetContent().GetContentIdx();
+ if (!pSectionStart)
+ {
+ return false;
+ }
+
+ SwPaM aPaM(*pSectionStart);
+ aPaM.Move(fnMoveBackward);
+ if (!aPaM.GetNode().IsTextNode())
+ {
+ return false;
+ }
+
+ SwTextNode* pTextNode = aPaM.GetNode().GetTextNode();
+ const SwAttrSet* pParaProps = &pTextNode->GetSwAttrSet();
+ sal_uInt32 nCharHeight = pParaProps->GetSize().GetHeight();
+ if (nCharHeight > 20)
+ {
+ return false;
+ }
+
+ aPaM.Move(fnMoveBackward);
+ if (!aPaM.GetNode().IsTextNode())
+ {
+ return false;
+ }
+
+ pTextNode = aPaM.GetNode().GetTextNode();
+ pParaProps = &pTextNode->GetSwAttrSet();
+ return pParaProps->HasItem(RES_PAGEDESC);
+}
+}
+
void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAttrDesc* pA )
{
const SwPageDesc* pPd = rSepInfo.pPageDesc;
@@ -1769,6 +1841,14 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
const SwTextNode *pOldPageRoot = GetHdFtPageRoot();
SetHdFtPageRoot( rSepInfo.pPDNd ? rSepInfo.pPDNd->GetTextNode() : nullptr );
+ if (GetExportFormat() == ExportFormat::DOCX
+ && WriteNextStyleHeaderFooter(nBreakCode, nHeadFootFlags, pPd, rSepInfo))
+ {
+ pPdFormat = &pPd->GetFollow()->GetMaster();
+ MSWordSections::SetHeaderFlag(nHeadFootFlags, *pPdFormat, WW8_HEADER_ODD);
+ MSWordSections::SetFooterFlag(nHeadFootFlags, *pPdFormat, WW8_FOOTER_ODD);
+ }
+
WriteHeadersFooters( nHeadFootFlags, *pPdFormat, *pPdLeftFormat, *pPdFirstPgFormat, nBreakCode );
SetHdFtPageRoot( pOldPageRoot );
commit 3213ba158478f7571db2d2ac3147d51b25238b71
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Feb 3 17:21:32 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 6 09:49:20 2020 +0200
DOCX export: fix table style config handling wrt nested tables
The bugdoc had 2 tables: both using the TableGrid table style, but one
had a direct formatting to disable all borders. The second was in the A1
cell of the first, and given that the table style config state was not
separated for nested tables, the border settings of the inner table
affected the settings of the later cells of the outer table.
Change-Id: Ie7897bc661d9f47ca9f5c1b3ed1c439ef0406037
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87899
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
(cherry picked from commit 2d87b09e6e675dd593e26cb266deb4ea91f0e7a7)
diff --git a/sw/qa/extras/ooxmlexport/data/table-style-conf-nested.docx b/sw/qa/extras/ooxmlexport/data/table-style-conf-nested.docx
new file mode 100644
index 000000000000..e35612addc1b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/table-style-conf-nested.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index f2867ccd5629..5ef10cc73ca1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -23,10 +23,12 @@
#include <com/sun/star/style/LineSpacingMode.hpp>
#include <com/sun/star/text/XDependentTextField.hpp>
+char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
+
class Test : public SwModelTestBase
{
public:
- Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
+ Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text") {}
protected:
/**
@@ -247,6 +249,27 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121658, "tdf121658.docx")
assertXPath(pXmlSettings, "/w:settings/w:doNotHyphenateCaps");
}
+CPPUNIT_TEST_FIXTURE(SwModelTestBase, testTableStyleConfNested)
+{
+ // Create the doc model.
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "table-style-conf-nested.docx";
+ loadURL(aURL, nullptr);
+
+ // Export to docx.
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OUString("Office Open XML Text");
+ xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+ validate(maTempFile.GetFileName(), test::OOXML);
+ mbExported = true;
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ CPPUNIT_ASSERT(pXmlDoc);
+ // Without the accompanying fix in place, this test would have failed, as the custom table cell
+ // border properties were lost, so the outer A2 cell started to have borders, not present in the
+ // doc model.
+ assertXPath(pXmlDoc, "//w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders/w:top", "val", "nil");
+}
+
CPPUNIT_TEST_FIXTURE(SwModelTestBase, testZeroLineSpacing)
{
// Create the doc model.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 993a6b984ca5..13e55ca1ec84 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3521,7 +3521,8 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
const SvxBoxItem& rDefaultBox = (*tableFirstCells.rbegin())->getTableBox( )->GetFrameFormat( )->GetBox( );
{
// The cell borders
- impl_borders( m_pSerializer, rBox, lcl_getTableCellBorderOptions(bEcma), m_aTableStyleConf );
+ impl_borders(m_pSerializer, rBox, lcl_getTableCellBorderOptions(bEcma),
+ m_aTableStyleConfs.back());
}
TableBackgrounds( pTableTextNodeInfoInner );
@@ -3560,6 +3561,8 @@ void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t
void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner )
{
+ m_aTableStyleConfs.push_back({});
+
// In case any paragraph SDT's are open, close them here.
EndParaSdtBlock();
@@ -3593,7 +3596,7 @@ void DocxAttributeOutput::EndTable()
// Cleans the table helper
m_xTableWrt.reset();
- m_aTableStyleConf.clear();
+ m_aTableStyleConfs.pop_back();
}
void DocxAttributeOutput::StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner )
@@ -3823,7 +3826,8 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
// We should clear the TableStyle map. In case of Table inside multiple tables it contains the
// table border style of the previous table.
- m_aTableStyleConf.clear();
+ std::map<SvxBoxItemLine, css::table::BorderLine2>& rTableStyleConf = m_aTableStyleConfs.back();
+ rTableStyleConf.clear();
// Extract properties from grab bag
for( const auto & rGrabBagElement : aGrabBag )
@@ -3834,13 +3838,16 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
m_pSerializer->singleElementNS(XML_w, XML_tblStyle, FSNS(XML_w, XML_val), sStyleName);
}
else if( rGrabBagElement.first == "TableStyleTopBorder" )
- m_aTableStyleConf[ SvxBoxItemLine::TOP ] = rGrabBagElement.second.get<table::BorderLine2>();
+ rTableStyleConf[SvxBoxItemLine::TOP] = rGrabBagElement.second.get<table::BorderLine2>();
else if( rGrabBagElement.first == "TableStyleBottomBorder" )
- m_aTableStyleConf[ SvxBoxItemLine::BOTTOM ] = rGrabBagElement.second.get<table::BorderLine2>();
+ rTableStyleConf[SvxBoxItemLine::BOTTOM]
+ = rGrabBagElement.second.get<table::BorderLine2>();
else if( rGrabBagElement.first == "TableStyleLeftBorder" )
- m_aTableStyleConf[ SvxBoxItemLine::LEFT ] = rGrabBagElement.second.get<table::BorderLine2>();
+ rTableStyleConf[SvxBoxItemLine::LEFT]
+ = rGrabBagElement.second.get<table::BorderLine2>();
else if( rGrabBagElement.first == "TableStyleRightBorder" )
- m_aTableStyleConf[ SvxBoxItemLine::RIGHT ] = rGrabBagElement.second.get<table::BorderLine2>();
+ rTableStyleConf[SvxBoxItemLine::RIGHT]
+ = rGrabBagElement.second.get<table::BorderLine2>();
else if (rGrabBagElement.first == "TableStyleLook")
{
FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList();
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index edb6825f1fdc..478b69a2a362 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -972,7 +972,7 @@ private:
/// Currently paragraph SDT has a <w:id> child element.
bool m_bParagraphSdtHasId;
- std::map<SvxBoxItemLine, css::table::BorderLine2> m_aTableStyleConf;
+ std::vector<std::map<SvxBoxItemLine, css::table::BorderLine2>> m_aTableStyleConfs;
public:
DocxAttributeOutput( DocxExport &rExport, const ::sax_fastparser::FSHelperPtr& pSerializer, oox::drawingml::DrawingML* pDrawingML );
More information about the Libreoffice-commits
mailing list