summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/source/msfilter/util.cxx12
-rw-r--r--include/filter/msfilter/util.hxx8
-rw-r--r--oox/source/export/vmlexport.cxx15
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo78663.docxbin0 -> 30861 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx28
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx3
6 files changed, 49 insertions, 17 deletions
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 5aad6fe4f0d5..9f3a640155d1 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -1333,6 +1333,18 @@ MSO_SPT GETVMLShapeType(const OString& aType)
return i == pDMLToVMLMap->end() ? mso_sptNil : i->second;
}
+bool HasTextBoxContent(sal_uInt32 nShapeType)
+{
+ switch (nShapeType)
+ {
+ case ESCHER_ShpInst_TextPlainText:
+ case ESCHER_ShpInst_TextSlantUp:
+ case ESCHER_ShpInst_TextDeflateInflateDeflate:
+ return false;
+ default:
+ return true;
+ }
+}
}
}
diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx
index ddf5a120ac5c..c1bb36dbc929 100644
--- a/include/filter/msfilter/util.hxx
+++ b/include/filter/msfilter/util.hxx
@@ -17,6 +17,7 @@
#include <filter/msfilter/msfilterdllapi.h>
#include <svx/msdffdef.hxx>
#include <com/sun/star/awt/Size.hpp>
+#include <filter/msfilter/escherex.hxx>
namespace msfilter {
namespace util {
@@ -138,6 +139,13 @@ MSFILTER_DLLPUBLIC const char* GetOOXMLPresetGeometry( const char* sShapeType );
/// Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
MSFILTER_DLLPUBLIC MSO_SPT GETVMLShapeType(const OString& aType);
+/**
+ * The following function checks if a MSO shapetype is allowed to have textboxcontent.
+ *
+ * @param nShapeType shape to check
+ */
+MSFILTER_DLLPUBLIC bool HasTextBoxContent(sal_uInt32 nShapeType);
+
}
}
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 039514d03c1e..a0a1ac7677db 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -31,6 +31,7 @@
#include <svx/svdotext.hxx>
#include <vcl/cvtgrf.hxx>
#include <filter/msfilter/msdffimp.hxx>
+#include <filter/msfilter/util.hxx>
#include <filter/msfilter/escherex.hxx>
#include <com/sun/star/drawing/XShape.hpp>
@@ -970,18 +971,6 @@ bool lcl_isTextBox(const SdrObject* pSdrObject)
return false;
}
-bool lcl_hasTextBoxContent(sal_uInt32 nShapeType)
-{
- switch (nShapeType)
- {
- case ESCHER_ShpInst_TextPlainText:
- case ESCHER_ShpInst_TextSlantUp:
- return false;
- default:
- return true;
- }
-}
-
OUString lcl_getAnchorIdFromGrabBag(const SdrObject* pSdrObject)
{
OUString aResult;
@@ -1137,7 +1126,7 @@ sal_Int32 VMLExport::StartShape()
// now check if we have some editeng text (not associated textbox) and we have a text exporter registered
const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
- if (pTxtObj && m_pTextExport && lcl_hasTextBoxContent(m_nShapeType) && !IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject))
+ if (pTxtObj && m_pTextExport && msfilter::util::HasTextBoxContent(m_nShapeType) && !IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject))
{
const OutlinerParaObject* pParaObj = 0;
bool bOwnParaObj = false;
diff --git a/sw/qa/extras/ooxmlexport/data/fdo78663.docx b/sw/qa/extras/ooxmlexport/data/fdo78663.docx
new file mode 100644
index 000000000000..be35b6c0045e
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo78663.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 92dc825e444f..20f7fd7a4e28 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1595,10 +1595,32 @@ DECLARE_OOXMLEXPORT_TEST(testWordArtWithinDraingtool, "testWordArtWithinDraingto
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1]",1);
- assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]/v:textbox[1]/w:txbxContent[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1]",1);
+ assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent",1);
+ assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:p/w:r/w:pict/v:shape",1);
// Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict.
- assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1]/w:p/w:r/w:pict",1);
+ assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict",1);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testfdo78663, "fdo78663.docx")
+{
+/* * A 2007 word art tool is enclosed in a 2010 drawing toolWithin a file,
+ * Originally the file has the following xml tag hierarchy.
+ *
+ * <p> <r> <ac> <drawing> <txbx> <txbxContent> <pict><shapetype> <shape> ...</shape></shapetype> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
+ * After RT :
+ * <p> <r> <ac> <drawing> <txbx> <txbxContent> <pict><shapetype> <shape> <textbox><txbxContent> ... </txbxContent></textbox></shape></shapetype> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
+ * MSO doesn't allow nesting of txbxContent tags.
+ * As the text of the wordart tool is written in the tag <v:textpath string="Welcome to... "History is fun and informative"/>
+ * We shouldn't repeat it again in <shapetype><shape> <textbox><txbxContent>
+ * */
+
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict/v:shape/v:path",1);
+ assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:p/w:r/w:pict/v:shape/v:path",1);
+ // Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict.
+ assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict",1);
}
DECLARE_OOXMLEXPORT_TEST(testFdo78957, "fdo78957.docx")
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index da9dc23bc1d0..8e137d9b9557 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -852,7 +852,8 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrmFm
MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType(xShape, nMirrorFlags, sShapeType);
// In case we are already inside a DML block, then write the shape only as VML, turn out that's allowed to do.
- if (eShapeType != ESCHER_ShpInst_TextPlainText && m_pImpl->isSupportedDMLShape(xShape) && !bDMLAndVMLDrawingOpen)
+ // A common service created in util to check for VML shapes which are allowed to have textbox in content
+ if ( (msfilter::util::HasTextBoxContent(eShapeType)) && m_pImpl->isSupportedDMLShape(xShape) && !bDMLAndVMLDrawingOpen)
{
m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);