summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-12-03 10:50:44 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-12-03 11:58:23 +0100
commita44e42b9cd08d1ac8438ed2944cf174ffd68b80e (patch)
treeb1e272d4bb5b9c90aaa4ce91da08756408006e81 /filter
parentf5e2d31331839fd8c6039bec057a9c28ed3c7396 (diff)
filter: handle ooxml shapes in EscherPropertyContainer::GetCustomShapeType()
The problem was that the shapes produced by the drawingML import had types like ooxml-triangle, and EnhancedCustomShapeTypeNames::Get() only handles VML/binary MSO shapes (e.g. isosceles-triangle). Add an OOXML mode, and in that case use msfilter::util::GETVMLShapeType() instead, and only fall back to EnhancedCustomShapeTypeNames::Get() if necessary. Change-Id: Ic93ba4719133dd3e96c17d2562642a03e559fefa
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/escherex.cxx23
-rw-r--r--filter/source/msfilter/eschesdo.cxx17
-rw-r--r--filter/source/msfilter/eschesdo.hxx4
3 files changed, 34 insertions, 10 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 320c1b5692a2..4f94859c0139 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -22,6 +22,7 @@
#include <svx/svdomedia.hxx>
#include <svx/xflftrit.hxx>
#include <filter/msfilter/escherex.hxx>
+#include <filter/msfilter/util.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdoashp.hxx>
@@ -3761,7 +3762,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
}
}
-MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags, OUString& rShapeType )
+MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags, OUString& rShapeType, bool bOOXML )
{
MSO_SPT eShapeType = mso_sptNil;
nMirrorFlags = 0;
@@ -3782,7 +3783,20 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi
if ( rProp.Name == "Type" )
{
if ( rProp.Value >>= rShapeType )
- eShapeType = EnhancedCustomShapeTypeNames::Get( rShapeType );
+ {
+ if (bOOXML)
+ {
+ // In case of VML export, try to handle the
+ // ooxml- prefix in rShapeType. If that fails,
+ // just do the same as the binary export.
+ OString aType = OUStringToOString(rShapeType, RTL_TEXTENCODING_UTF8);
+ eShapeType = msfilter::util::GETVMLShapeType(aType);
+ if (eShapeType == mso_sptNil)
+ eShapeType = EnhancedCustomShapeTypeNames::Get(rShapeType);
+ }
+ else
+ eShapeType = EnhancedCustomShapeTypeNames::Get( rShapeType );
+ }
}
else if ( rProp.Name == "MirroredX" )
{
@@ -4933,7 +4947,7 @@ public:
virtual ~SvNullStream() {}
};
-EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm ) :
+EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm, bool bOOXML ) :
mxGlobal ( rxGlobal ),
mpOutStrm ( pOutStrm ),
mbOwnsStrm ( false ),
@@ -4944,7 +4958,8 @@ EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm ) :
mnHellLayerId ( USHRT_MAX ),
mbEscherSpgr ( sal_False ),
- mbEscherDg ( sal_False )
+ mbEscherDg ( sal_False ),
+ mbOOXML(bOOXML)
{
if (!mpOutStrm)
{
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 1a6e33d01368..af2a9541dc4d 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -254,7 +254,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
sal_uInt32 nMirrorFlags;
OUString sCustomShapeType;
- MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( rObj.GetShapeRef(), nMirrorFlags, sCustomShapeType );
+ MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( rObj.GetShapeRef(), nMirrorFlags, sCustomShapeType, rObj.GetOOXML() );
if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == "col-60da8460" )
{
ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
@@ -953,7 +953,7 @@ void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes )
sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj )
{
- ImplEESdrObject aObj( *mpImplEscherExSdr, rObj );
+ ImplEESdrObject aObj( *mpImplEscherExSdr, rObj, mbOOXML );
if( aObj.IsValid() )
return mpImplEscherExSdr->ImplWriteTheShape( aObj );
return 0;
@@ -1006,13 +1006,14 @@ const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape )
ImplEESdrObject::ImplEESdrObject( ImplEscherExSdr& rEx,
- const SdrObject& rObj ) :
+ const SdrObject& rObj, bool bOOXML ) :
mnShapeId( 0 ),
mnTextSize( 0 ),
mnAngle( 0 ),
mbValid( sal_False ),
mbPresObj( sal_False ),
- mbEmptyPresObj( sal_False )
+ mbEmptyPresObj( sal_False ),
+ mbOOXML(bOOXML)
{
SdrPage* pPage = rObj.GetPage();
DBG_ASSERT( pPage, "ImplEESdrObject::ImplEESdrObject: no SdrPage" );
@@ -1033,7 +1034,8 @@ ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter& rEx,
mnAngle( 0 ),
mbValid( sal_False ),
mbPresObj( sal_False ),
- mbEmptyPresObj( sal_False )
+ mbEmptyPresObj( sal_False ),
+ mbOOXML(false)
{
Init( rEx );
}
@@ -1255,4 +1257,9 @@ sal_Bool ImplEESdrObject::ImplHasText() const
return xXText.is() && !xXText->getString().isEmpty();
}
+bool ImplEESdrObject::GetOOXML() const
+{
+ return mbOOXML;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx
index f01128533318..9d90e6a709e1 100644
--- a/filter/source/msfilter/eschesdo.hxx
+++ b/filter/source/msfilter/eschesdo.hxx
@@ -43,12 +43,13 @@ class ImplEESdrObject
sal_Bool mbValid : 1;
sal_Bool mbPresObj : 1;
sal_Bool mbEmptyPresObj : 1;
+ bool mbOOXML;
void Init( ImplEESdrWriter& rEx );
public:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPropSet;
- ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj );
+ ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj, bool bOOXML = false );
ImplEESdrObject( ImplEESdrWriter& rEx, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape );
~ImplEESdrObject();
@@ -85,6 +86,7 @@ public:
sal_uInt32 ImplGetText();
sal_Bool ImplHasText() const;
+ bool GetOOXML() const;
};