summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Co <rattles2013@gmail.com>2013-07-29 19:37:33 +0300
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-31 16:19:21 +0000
commita4b4bde0a28b06f150ec80a65e322491a547f803 (patch)
tree47c8496d50cf63935cc087ac5c1320704ee702be
parentea4003de2ea92424c60ef2aaa9c5ff260b804852 (diff)
fdo#67013 : fix for borders in headers and footers
Change-Id: I45d71348a64b8e79c34e24829cceadedd0d8f6a9 Reviewed-on: https://gerrit.libreoffice.org/5170 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo67013.docxbin0 -> 27038 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx53
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx6
-rw-r--r--sw/source/filter/ww8/docxexport.cxx6
5 files changed, 59 insertions, 9 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo67013.docx b/sw/qa/extras/ooxmlexport/data/fdo67013.docx
new file mode 100644
index 000000000000..5512550ead18
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo67013.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f4932ffd7f65..0b4003eb5d3c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -105,6 +105,7 @@ public:
void testFdo60990();
void testFdo65718();
void testFdo64350();
+ void testFdo67013();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -186,6 +187,7 @@ void Test::run()
{"fdo60990.odt", &Test::testFdo60990},
{"fdo65718.docx", &Test::testFdo65718},
{"fdo64350.docx", &Test::testFdo64350},
+ {"fdo67013.docx", &Test::testFdo67013},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -998,14 +1000,12 @@ void Test::testFdo66929()
void Test::testPageBorderSpacingExportCase2()
{
- /*
- * The problem was that the exporter didn't mirror the workaround of the
- * importer, regarding the page border's spacing : the <w:pgBorders w:offsetFrom="page">
- * and the inner nodes like <w:top w:space="24" .... />
- *
- * The exporter ALWAYS exported 'w:offsetFrom="text"' even when the spacing values where too large
- * for Word to handle (larger than 31 points)
- */
+ // The problem was that the exporter didn't mirror the workaround of the
+ // importer, regarding the page border's spacing : the <w:pgBorders w:offsetFrom="page">
+ // and the inner nodes like <w:top w:space="24" .... />
+ //
+ // The exporter ALWAYS exported 'w:offsetFrom="text"' even when the spacing values where too large
+ // for Word to handle (larger than 31 points)
xmlDocPtr pXmlDoc = parseExport();
@@ -1097,6 +1097,43 @@ void Test::testFdo64350()
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
}
+void Test::testFdo67013()
+{
+ /*
+ * The problem was that borders inside headers \ footers were not exported
+ * This was checked in xray using these commands:
+ *
+ * xHeaderText = ThisComponent.getStyleFamilies().getByName("PageStyles").getByName("Standard").HeaderText
+ * xHeaderEnum = xHeaderText.createEnumeration()
+ * xHeaderFirstParagraph = xHeaderEnum.nextElement()
+ * xHeaderBottomBorder = xHeaderFirstParagraph.BottomBorder
+ *
+ * xFooterText = ThisComponent.getStyleFamilies().getByName("PageStyles").getByName("Standard").FooterText
+ * xFooterEnum = xFooterText.createEnumeration()
+ * xFooterFirstParagraph = xFooterEnum.nextElement()
+ * xFooterTopBorder = xFooterFirstParagraph.TopBorder
+ */
+ uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
+ uno::Reference< text::XTextRange > xHeaderParagraph = getParagraphOfText( 1, xHeaderText );
+ table::BorderLine2 aHeaderBottomBorder = getProperty<table::BorderLine2>(xHeaderParagraph, "BottomBorder");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aHeaderBottomBorder.Color);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(106), aHeaderBottomBorder.InnerLineWidth);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(26), aHeaderBottomBorder.LineDistance);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(7), aHeaderBottomBorder.LineStyle);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(159), aHeaderBottomBorder.LineWidth);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(26), aHeaderBottomBorder.OuterLineWidth);
+
+ uno::Reference<text::XText> xFooterText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "FooterText");
+ uno::Reference< text::XTextRange > xFooterParagraph = getParagraphOfText( 1, xFooterText );
+ table::BorderLine2 aFooterTopBorder = getProperty<table::BorderLine2>(xFooterParagraph, "TopBorder");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aFooterTopBorder.Color);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(26), aFooterTopBorder.InnerLineWidth);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(26), aFooterTopBorder.LineDistance);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(4), aFooterTopBorder.LineStyle);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(159), aFooterTopBorder.LineWidth);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(106), aFooterTopBorder.OuterLineWidth);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 820d06cc1917..55de9c98dfaf 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5126,7 +5126,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
OutputBorderOptions aOutputBorderOptions = lcl_getBoxBorderOptions();
- if ( m_bOpenedSectPr )
+ if ( m_bOpenedSectPr && GetWritingHeaderFooter() == false)
{
// Inside a section
@@ -5330,6 +5330,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_pRedlineData( NULL ),
m_nRedlineId( 0 ),
m_bOpenedSectPr( false ),
+ m_bWritingHeaderFooter( false ),
m_sFieldBkm( ),
m_nNextMarkId( 0 ),
m_bPostitStart(false),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 02aeb45abd8e..e02eaaed8ddf 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -629,6 +629,9 @@ private:
/// Flag indicating that the section properties are being written
bool m_bOpenedSectPr;
+ /// Flag indicating that the header \ footer are being written
+ bool m_bWritingHeaderFooter;
+
/// Field data to remember in the text run
std::vector< FieldInfos > m_Fields;
String m_sFieldBkm;
@@ -734,6 +737,9 @@ public:
virtual oox::drawingml::DrawingML& GetDrawingML();
void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize) SAL_OVERRIDE;
+
+ void SetWritingHeaderFooter( bool bWritingHeaderFooter ) { m_bWritingHeaderFooter = bWritingHeaderFooter; }
+ bool GetWritingHeaderFooter( ) { return m_bWritingHeaderFooter; }
};
#endif // _DOCXATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 99c646068095..24c573bf43c3 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -195,6 +195,9 @@ bool DocxExport::DisallowInheritingOutlineNumbering( const SwFmt& rFmt )
void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt, sal_uInt8 /*nBreakCode*/ )
{
+ // Turn ON flag for 'Writing Headers \ Footers'
+ m_pAttrOutput->SetWritingHeaderFooter( true );
+
// headers
if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN )
WriteHeaderFooter( rLeftFmt, true, "even" );
@@ -218,6 +221,9 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
if ( nHeadFootFlags & ( nsHdFtFlags::WW8_FOOTER_EVEN | nsHdFtFlags::WW8_HEADER_EVEN ))
settings.evenAndOddHeaders = true;
+ // Turn OFF flag for 'Writing Headers \ Footers'
+ m_pAttrOutput->SetWritingHeaderFooter( false );
+
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "DocxExport::WriteHeadersFooters() - nBreakCode introduced, but ignored\n" );
#endif