summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-16 19:38:38 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-17 01:16:20 +0200
commit6b5c0a5cb25fc0c7c673a9332c8d30b6efbb819b (patch)
tree0b1aad541ecdec6993e372ee680d63ad8d3de93b /oox
parent0d602133d627c1837eb64895855c2a7ed0144de6 (diff)
VML export: handle textbox text
Previously, we always exported the text of the shape itself. Bring the VML export in sync with the drawingML export, where we only do that if the shape doesn't have an associated textbox -- if that's the case, then export the textbox's text instead. CppunitTest_sw_ooxmlsdrexport's testFdo69636 is a reproducer for this problem, the VML assert failed because of the lack of this. Change-Id: Icb236579da4e3b74e983a95aa5675fed7862d1e1
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/vmlexport.cxx37
1 files changed, 35 insertions, 2 deletions
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index f31576636944..b0d712eb7b27 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -27,11 +27,13 @@
#include <rtl/ustring.hxx>
#include <tools/stream.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#include <svx/svdotext.hxx>
#include <vcl/cvtgrf.hxx>
#include <filter/msfilter/msdffimp.hxx>
#include <filter/msfilter/escherex.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
@@ -958,6 +960,17 @@ std::vector<OString> lcl_getShapeTypes()
return aRet;
}
+bool lcl_isTextBox(const SdrObject* pSdrObject)
+{
+ uno::Reference<beans::XPropertySet> xPropertySet(const_cast<SdrObject*>(pSdrObject)->getUnoShape(), uno::UNO_QUERY);
+ if (xPropertySet.is())
+ {
+ uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
+ return xPropertySetInfo->hasPropertyByName("TextBox") && xPropertySet->getPropertyValue("TextBox").get<bool>();
+ }
+ return false;
+}
+
sal_Int32 VMLExport::StartShape()
{
if ( m_nShapeType == ESCHER_ShpInst_Nil )
@@ -1092,9 +1105,9 @@ sal_Int32 VMLExport::StartShape()
m_pSerializer->startElementNS( XML_v, nShapeElement, XFastAttributeListRef( m_pShapeAttrList ) );
}
- // now check if we have some text and we have a text exporter registered
+ // 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 && m_nShapeType != ESCHER_ShpInst_TextPlainText)
+ if (pTxtObj && m_pTextExport && m_nShapeType != ESCHER_ShpInst_TextPlainText && !IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject))
{
const OutlinerParaObject* pParaObj = 0;
bool bOwnParaObj = false;
@@ -1132,6 +1145,26 @@ void VMLExport::EndShape( sal_Int32 nShapeElement )
{
if ( nShapeElement >= 0 )
{
+ if (m_pTextExport && lcl_isTextBox(m_pSdrObject))
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(const_cast<SdrObject*>(m_pSdrObject)->getUnoShape(), uno::UNO_QUERY);
+ comphelper::SequenceAsHashMap aCustomShapeProperties(xPropertySet->getPropertyValue("CustomShapeGeometry"));
+ sax_fastparser::FastAttributeList* pTextboxAttrList = m_pSerializer->createAttrList();
+ if (aCustomShapeProperties.find("TextPreRotateAngle") != aCustomShapeProperties.end())
+ {
+ sal_Int32 nTextRotateAngle = aCustomShapeProperties["TextPreRotateAngle"].get<sal_Int32>();
+ if (nTextRotateAngle == -270)
+ pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
+ }
+ sax_fastparser::XFastAttributeListRef xTextboxAttrList(pTextboxAttrList);
+ pTextboxAttrList = 0;
+ m_pSerializer->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
+
+ m_pTextExport->WriteVMLTextBox(uno::Reference<drawing::XShape>(xPropertySet, uno::UNO_QUERY_THROW));
+
+ m_pSerializer->endElementNS(XML_v, XML_textbox);
+ }
+
// end of the shape
m_pSerializer->endElementNS( XML_v, nShapeElement );
}