[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Jul 16 09:17:20 PDT 2014
sw/qa/extras/ooxmlexport/data/plausable-border.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 8 ++++++
sw/source/filter/ww8/writerwordglue.cxx | 23 +++++++++++++++++---
3 files changed, 28 insertions(+), 3 deletions(-)
New commits:
commit 385852e9add39081f8e915bd88ad8560630762a2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Jul 16 16:48:35 2014 +0200
sw::util::IsPlausableSingleWordSection: take care of Boxes if LRSpace differs
The problem was the following: due to borders, the LR space items were
not equal, but we still want to merge the page styles, as they only
differ due to the page border.
Change-Id: I55069368edba27ab9c70421e5e71ca24c73350e9
diff --git a/sw/qa/extras/ooxmlexport/data/plausable-border.docx b/sw/qa/extras/ooxmlexport/data/plausable-border.docx
new file mode 100644
index 0000000..a1a9547
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/plausable-border.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0e69a54..a5aa50d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3810,6 +3810,14 @@ DECLARE_OOXMLEXPORT_TEST(testSdtCitationRun, "sdt-citation-run.docx")
}
}
+DECLARE_OOXMLEXPORT_TEST(testPlausableBorder, "plausable-border.docx")
+{
+ // sw::util::IsPlausableSingleWordSection() did not merge two page styles due to borders.
+ if (xmlDocPtr pXmlDoc = parseExport())
+ // Page break was exported as section break, this was 0
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index ddc8313..f6b1f0d 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -334,6 +334,23 @@ namespace myImplHelpers
};
}
+/// Count what Word calls left/right margin from a format's LRSpace + Box.
+static SvxLRSpaceItem lcl_getWordLRSpace(const SwFrmFmt& rFmt)
+{
+ SvxLRSpaceItem aLR(rFmt.GetLRSpace());
+ const SvxBoxItem& rBox = rFmt.GetBox();
+
+ aLR.SetLeft(aLR.GetLeft() + rBox.GetDistance(BOX_LINE_LEFT));
+ if (const editeng::SvxBorderLine* pLeft = rBox.GetLeft())
+ aLR.SetLeft(aLR.GetLeft() + pLeft->GetWidth());
+
+ aLR.SetRight(aLR.GetRight() + rBox.GetDistance(BOX_LINE_RIGHT));
+ if (const editeng::SvxBorderLine* pRight = rBox.GetRight())
+ aLR.SetRight(aLR.GetRight() + pRight->GetWidth());
+
+ return aLR;
+}
+
namespace sw
{
namespace util
@@ -347,8 +364,8 @@ namespace sw
const SwFmtCol& rFollowCols = rFollowFmt.GetCol();
const SwColumns& rFirstColumns = rFirstCols.GetColumns();
const SwColumns& rFollowColumns = rFollowCols.GetColumns();
- const SvxLRSpaceItem &rOneLR = rTitleFmt.GetLRSpace();
- const SvxLRSpaceItem &rTwoLR= rFollowFmt.GetLRSpace();
+ SvxLRSpaceItem aOneLR = lcl_getWordLRSpace(rTitleFmt);
+ SvxLRSpaceItem aTwoLR = lcl_getWordLRSpace(rFollowFmt);
const SwFmtFrmSize& rFirstFrmSize = rTitleFmt.GetFrmSize();
const SwFmtFrmSize& rFollowFrmSize = rFollowFmt.GetFrmSize();
@@ -357,7 +374,7 @@ namespace sw
//e.g. #i4320#
bPlausableSingleWordSection = false;
}
- else if (rOneLR != rTwoLR)
+ else if (aOneLR != aTwoLR)
bPlausableSingleWordSection = false;
else if (rFirstFrmSize != rFollowFrmSize)
bPlausableSingleWordSection = false;
More information about the Libreoffice-commits
mailing list