summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-08-13 17:36:50 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-08-13 17:42:54 +0200
commit7fd28f4de77d12acb68a6b7f5fb578fedd8b76bb (patch)
tree8a691aea20043c377577dc8b99652fadba542e35 /oox
parent2dbd722b93578fc722e13f72144c78ee3e5e1246 (diff)
fdo#53113 oox::VMLExport: allow a callback to be registered for shape text
Change-Id: I1df58fa067287a37b0f62b0b05b0567da73d03b0
Diffstat (limited to 'oox')
-rw-r--r--oox/Library_oox.mk1
-rw-r--r--oox/inc/oox/export/vmlexport.hxx21
-rw-r--r--oox/source/export/vmlexport.cxx42
3 files changed, 61 insertions, 3 deletions
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index 5fba3f2ef531..dee336ad48b5 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -61,6 +61,7 @@ $(eval $(call gb_Library_use_libraries,oox,\
comphelper \
cppu \
cppuhelper \
+ editeng \
msfilter \
sal \
sax \
diff --git a/oox/inc/oox/export/vmlexport.hxx b/oox/inc/oox/export/vmlexport.hxx
index 6685f0934898..ec5a4d9baef9 100644
--- a/oox/inc/oox/export/vmlexport.hxx
+++ b/oox/inc/oox/export/vmlexport.hxx
@@ -23,6 +23,7 @@
#include <oox/dllapi.h>
#include <sax/fshelper.hxx>
#include <filter/msfilter/escherex.hxx>
+#include <editeng/outlobj.hxx>
namespace rtl {
class OString;
@@ -33,11 +34,27 @@ namespace oox {
namespace vml {
+/// Interface to be implemented by the parent exporter that knows how to handle shape text.
+class OOX_DLLPUBLIC VMLTextExport
+{
+public:
+ virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
+protected:
+ VMLTextExport() {}
+ virtual ~VMLTextExport() {}
+};
+
class OOX_DLLPUBLIC VMLExport : public EscherEx
{
/// Fast serializer to output the data
::sax_fastparser::FSHelperPtr m_pSerializer;
+ /// Parent exporter, used for text callback.
+ VMLTextExport* m_pTextExport;
+
+ /// The object we're exporting.
+ const SdrObject* m_pSdrObject;
+
/// Fill the shape attributes as they come.
::sax_fastparser::FastAttributeList *m_pShapeAttrList;
@@ -54,7 +71,7 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
bool *m_pShapeTypeWritten;
public:
- VMLExport( ::sax_fastparser::FSHelperPtr pSerializer );
+ VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = 0 );
virtual ~VMLExport();
::sax_fastparser::FSHelperPtr
@@ -63,7 +80,7 @@ public:
/// Export the sdr object as VML.
///
/// Call this when you need to export the object as VML.
- using EscherEx::AddSdrObject;
+ sal_uInt32 AddSdrObject( const SdrObject& rObj );
protected:
/// Add an attribute to the generated <v:shape/> element.
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 17ff426cff7d..08aac17aee86 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -25,6 +25,7 @@
#include <rtl/ustring.hxx>
#include <tools/stream.hxx>
+#include <svx/svdotext.hxx>
#include <cstdio>
@@ -36,9 +37,11 @@ using rtl::OUStringBuffer;
using namespace sax_fastparser;
using namespace oox::vml;
-VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer )
+VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport )
: EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), 0 ),
m_pSerializer( pSerializer ),
+ m_pTextExport( pTextExport ),
+ m_pSdrObject( 0 ),
m_pShapeAttrList( NULL ),
m_nShapeType( ESCHER_ShpInst_Nil ),
m_pShapeStyle( new OStringBuffer( 200 ) ),
@@ -824,6 +827,37 @@ 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
+ const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
+ if (pTxtObj && m_pTextExport)
+ {
+ const OutlinerParaObject* pParaObj = 0;
+ bool bOwnParaObj = false;
+
+ /*
+ #i13885#
+ When the object is actively being edited, that text is not set into
+ the objects normal text object, but lives in a seperate object.
+ */
+ if (pTxtObj->IsTextEditActive())
+ {
+ pParaObj = pTxtObj->GetEditOutlinerParaObject();
+ bOwnParaObj = true;
+ }
+ else
+ {
+ pParaObj = pTxtObj->GetOutlinerParaObject();
+ }
+
+ if( pParaObj )
+ {
+ // this is reached only in case some text is attached to the shape
+ m_pTextExport->WriteOutliner(*pParaObj);
+ if( bOwnParaObj )
+ delete pParaObj;
+ }
+ }
+
return nShapeElement;
}
@@ -836,4 +870,10 @@ void VMLExport::EndShape( sal_Int32 nShapeElement )
}
}
+sal_uInt32 VMLExport::AddSdrObject( const SdrObject& rObj )
+{
+ m_pSdrObject = &rObj;
+ return EscherEx::AddSdrObject(rObj);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */