summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-08-16 17:50:11 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-16 19:53:33 +0200
commite41ce95ca86d37af35e7725edc2f63bd6634051e (patch)
tree9e8dc016e2133d758f116ccb5b22664444ed1b39 /sw
parentcea495b0dbb6dcace3a3b46f88f7084d127c0482 (diff)
DOCX export: fix bottom paragraph margin inside text frame
Having non-null mpParentFrame during the export of text (not during the export of the frame properties) resulted in getting the frame margins as an SvxULSpaceItem, not the real paragraph margins. Change-Id: Icab8906ef7935a86098d7340f5469e732393663c
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx18
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
2 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index c5b141973d7a..2db8917f5c06 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -46,6 +46,7 @@
class Test : public SwModelTestBase
{
public:
+ Test();
void testZoom();
void defaultTabStopNotInStyles();
void testFdo38244();
@@ -125,8 +126,15 @@ private:
*/
xmlDocPtr parseExport();
void assertXPath(xmlDocPtr pXmlDoc, OString aXPath, OString aAttribute = OString(), OUString aExpectedValue = OUString());
+ /// If the XPath test for now runs only after one export iteration, check for this variable.
+ bool m_bImport;
};
+Test::Test()
+ : m_bImport(false)
+{
+}
+
void Test::run()
{
MethodEntry<Test> aMethods[] = {
@@ -204,9 +212,11 @@ void Test::run()
{
MethodEntry<Test>& rEntry = aMethods[i];
load("/sw/qa/extras/ooxmlexport/data/", rEntry.pName);
+ m_bImport = true;
// If the testcase is stored in some other format, it's pointless to test.
if (OString(rEntry.pName).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), rEntry.pName) == vBlacklist.end())
(this->*rEntry.pMethod)();
+ m_bImport = false;
reload("Office Open XML Text");
(this->*rEntry.pMethod)();
finish();
@@ -242,6 +252,7 @@ void Test::assertXPath(xmlDocPtr pXmlDoc, OString aXPath, OString aAttribute, OU
{
xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w"), BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml"));
xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx);
xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes));
@@ -1156,6 +1167,13 @@ void Test::testTableFloatingMargins()
// These were 0, due to lack of import/export.
CPPUNIT_ASSERT_EQUAL(sal_Int32(1000), getProperty<sal_Int32>(xFrame, "TopMargin"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), getProperty<sal_Int32>(xFrame, "BottomMargin"));
+
+ if (m_bImport)
+ {
+ // Paragraph bottom margin wasn't 0 in the A1 cell of the floating table.
+ xmlDocPtr pXmlDoc = parseExport();
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:pict/v:rect/v:textbox/w:txbxContent/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0");
+ }
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index dd88b386b9f2..869db458efd0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -330,6 +330,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
m_pTextboxAttrList = NULL;
m_bTextFrameSyntax = false;
m_pFlyFrameSize = 0;
+ m_rExport.mpParentFrame = NULL;
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
m_pSerializer->startElementNS( XML_w, XML_pict, FSEND );
@@ -360,7 +361,6 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
m_rExport.RestoreData();
- m_rExport.mpParentFrame = NULL;
}
m_pSerializer->endElementNS( XML_w, XML_p );