summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-24 16:15:51 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-25 08:12:30 +0000
commit6d67b812403e1c22ee09b70dddf6b2ac13e73b58 (patch)
tree9b325fc54ee56085f79f23f5f1dfe4fe09f27d3d
parentc64554aec5a90daa800dd3a70b777dca510c56dc (diff)
fdo#60990 VML export: handle paragraph/run properties of shape text
(cherry picked from commits 1753c4f9f1713ca4a9a1ac3a145269c850eef6fb, 0ffed545adbb8a27a024d4d6a74dcaa8a87ba66a and 94b3ec0597ee21b933d02496402ff0f3a416e6a3) Change-Id: Iaeb7f9826308ea94a036cb4bfa87bf65f0cfe22f Reviewed-on: https://gerrit.libreoffice.org/5094 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo60990.odtbin0 -> 10945 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx15
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx16
3 files changed, 29 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo60990.odt b/sw/qa/extras/ooxmlexport/data/fdo60990.odt
new file mode 100644
index 000000000000..c855f327a90c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo60990.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4a58bf1b7b08..2ed291fbe183 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -72,6 +72,7 @@ public:
void testI120928();
void testN822175();
void testFdo58577();
+ void testFdo60990();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -121,6 +122,7 @@ void Test::run()
{"i120928.docx", &Test::testI120928},
{"n822175.odt", &Test::testN822175},
{"fdo58577.odt", &Test::testFdo58577},
+ {"fdo60990.odt", &Test::testFdo60990},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -694,6 +696,19 @@ void Test::testFdo58577()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
}
+void Test::testFdo60990()
+{
+ // The shape had no background, no paragraph adjust and no font color.
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00CFE7F5), getProperty<sal_Int32>(xShape, "BackColor"));
+ uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+ uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
+ CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, "ParaAdjust")));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00FF00), getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"));
+}
+
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 153580cda321..08d79f02118b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2635,7 +2635,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
sal_Int32 nPara = rEditObj.GetParagraphCount();
- m_pSerializer->startElementNS( XML_w, XML_textbox, FSEND );
+ m_pSerializer->startElementNS( XML_v, XML_textbox, FSEND );
m_pSerializer->startElementNS( XML_w, XML_txbxContent, FSEND );
for (sal_Int32 n = 0; n < nPara; ++n)
{
@@ -2647,12 +2647,24 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
xub_StrLen nEnd = aStr.Len();
m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
+
+ // Write paragraph properties.
+ m_pSerializer->startElementNS(XML_w, XML_pPr, FSEND);
+ aAttrIter.OutParaAttr(false);
+ m_pSerializer->endElementNS(XML_w, XML_pPr);
+
do {
xub_StrLen nNextAttr = aAttrIter.WhereNext();
if( nNextAttr > nEnd )
nNextAttr = nEnd;
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+
+ // Write run properties.
+ m_pSerializer->startElementNS(XML_w, XML_rPr, FSEND);
+ aAttrIter.OutAttr(nAktPos);
+ m_pSerializer->endElementNS(XML_w, XML_rPr);
+
bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
if( !bTxtAtr )
{
@@ -2669,7 +2681,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
m_pSerializer->endElementNS( XML_w, XML_p );
}
m_pSerializer->endElementNS( XML_w, XML_txbxContent );
- m_pSerializer->endElementNS( XML_w, XML_textbox );
+ m_pSerializer->endElementNS( XML_v, XML_textbox );
}
oox::drawingml::DrawingML& DocxAttributeOutput::GetDrawingML()