[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Nov 21 09:43:55 PST 2014
sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 8 +++++++-
sw/source/filter/ww8/docxattributeoutput.cxx | 11 ++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 5009ed5eaff6769375d8d0423a98fe8d1a31e0d1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 21 18:22:53 2014 +0100
DOCX export: fix page border spacing in case of headers/footers
It is clear that Word/Writer has different page margin / border spacing
models: in Word, the page margin includes everything and border spacing
is a subset of that, in Writer the real distance between the body frame
and the page frame is the sum of the two.
What was less clear is what headers / footers add to this mix. It turns
out that in case we have a header as well, then for large borders, we
need to count the difference of the page frame and the header frame, not
the difference of the page frame and the body frame.
Change-Id: I3c828eeec2df461985110064ab0bf21b36594095
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index fd9341c..26f521b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -702,9 +702,15 @@ DECLARE_OOXMLEXPORT_TEST(testFD083057, "fdo83057.docx")
DECLARE_OOXMLEXPORT_TEST(testHeaderBorder, "header-border.docx")
{
- // This was 0, as header margin was lost during import.
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+ {
+ // This was 0, as header margin was lost during import.
assertXPath(pXmlDoc, "//w:pgMar", "header", "720");
+ // This was 33: 33 points -> 660 twips. We counted 900 - 240 (distance
+ // of page and body frame) instead of 720 - 240 (distance of page and
+ // header frame).
+ assertXPath(pXmlDoc, "//w:pgBorders/w:top", "space", "24");
+ }
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index cacbe97..4e4dccd 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5499,8 +5499,17 @@ void DocxAttributeOutput::SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmF
aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation();
}
+ // By top margin, impl_borders() means the distance between the top of the page and the header frame.
+ PageMargins aMargins = m_pageMargins;
+ HdFtDistanceGlue aGlue(pFmt->GetAttrSet());
+ if (aGlue.HasHeader())
+ aMargins.nPageMarginTop = aGlue.dyaHdrTop;
+ // Ditto for bottom margin.
+ if (aGlue.HasFooter())
+ aMargins.nPageMarginBottom = aGlue.dyaHdrBottom;
+
std::map<sal_uInt16, css::table::BorderLine2> aEmptyMap; // empty styles map
- impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &m_pageMargins,
+ impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &aMargins,
aEmptyMap );
m_pSerializer->endElementNS( XML_w, XML_pgBorders );
More information about the Libreoffice-commits
mailing list