summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPallavi Jadhav <pallavi.jadhav@synerzip.com>2014-01-23 15:56:32 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-13 11:00:08 +0100
commite5a891793baafb4504dcedaec82e6827d847ecf1 (patch)
tree55d7c4190789ef847f9266178c6472afe5091510 /sw
parent2d3030b1fa3669b72731863df078c72882fe94e5 (diff)
Fix for: DOCX-Preservation of Line style Dash type of "Shape with text inside"
Issue : File containing Shape with text inside it having Line style as Dash type is not getting preserved after RT in MS office 2007. Implementation : 1] Added XML element <v:stroke> with attribute dashstyle="dash". 2] Written Export Unit test case. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7611 Change-Id: Id01c5975c2c1cf176a7459f65973f4c9c3c9b9d8
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docxbin0 -> 15661 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx15
-rw-r--r--sw/source/filter/ww8/docxsdrexport.hxx1
5 files changed, 29 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docx b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docx
new file mode 100644
index 000000000000..8b9567231816
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b11f4ca2d34d..06b881ccbf3f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2974,6 +2974,17 @@ DECLARE_OOXMLEXPORT_TEST(fdo69656, "Table_cell_auto_width_fdo69656.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","auto");
}
+DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType_VML, "LineStyle_DashType_VML.docx")
+{
+ /* DOCX contatining "Shape with text inside" having Line Style as "Dash Type" should get
+ * preserved inside an XML tag <v:stroke> with attribute dashstyle having value "dash".
+ */
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:stroke", "dashstyle", "dash");
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 97ec8b7b5007..87b1c6e20c11 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5919,6 +5919,9 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), 2,
XML_strokecolor, sColor.getStr(),
XML_strokeweight, sWidth.getStr() );
+ if( LineStyle_DASH == pTop->GetBorderLineStyle() ) // Line Style is Dash type
+ AddToAttrList( m_rExport.SdrExporter().getDashLineStyle(),
+ XML_dashstyle, "dash" );
}
else
{
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index a99f5eade8ed..7abc92a94f6f 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -74,6 +74,7 @@ struct DocxSdrExport::Impl
sax_fastparser::FastAttributeList* m_pFlyFillAttrList;
sax_fastparser::FastAttributeList* m_pFlyWrapAttrList;
sax_fastparser::FastAttributeList* m_pBodyPrAttrList;
+ sax_fastparser::FastAttributeList* m_pDashLineStyleAttr;
Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
: m_rSdrExport(rSdrExport),
@@ -88,7 +89,8 @@ struct DocxSdrExport::Impl
m_bFrameBtLr(false),
m_pFlyFillAttrList(0),
m_pFlyWrapAttrList(0),
- m_pBodyPrAttrList(0)
+ m_pBodyPrAttrList(0),
+ m_pDashLineStyleAttr(0)
{
}
@@ -177,6 +179,11 @@ sax_fastparser::FastAttributeList* DocxSdrExport::getBodyPrAttrList()
return m_pImpl->m_pBodyPrAttrList;
}
+sax_fastparser::FastAttributeList*& DocxSdrExport::getDashLineStyle()
+{
+ return m_pImpl->m_pDashLineStyleAttr;
+}
+
void DocxSdrExport::setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList)
{
m_pImpl->m_pFlyWrapAttrList = pAttrList;
@@ -981,6 +988,12 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame)
m_pImpl->m_pFlyFillAttrList = NULL;
pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList);
}
+ if (m_pImpl->m_pDashLineStyleAttr)
+ {
+ sax_fastparser::XFastAttributeListRef xDashLineStyleAttr(m_pImpl->m_pDashLineStyleAttr);
+ m_pImpl->m_pFlyFillAttrList = NULL;
+ pFS->singleElementNS(XML_v, XML_stroke, xDashLineStyleAttr);
+ }
pFS->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
pFS->startElementNS(XML_w, XML_txbxContent, FSEND);
m_pImpl->m_rExport.WriteText();
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx
index 0f871ac02917..04598f882dbf 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -69,6 +69,7 @@ public:
void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList);
/// Attributes of <wps:bodyPr>, used during DML export of text frames.
sax_fastparser::FastAttributeList* getBodyPrAttrList();
+ sax_fastparser::FastAttributeList*& getDashLineStyle();
void startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rSize);
void endDMLAnchorInline(const SwFrmFmt* pFrmFmt);