diff options
author | Andres Gomez <agomez@igalia.com> | 2013-08-26 18:33:38 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-05 08:40:13 +0000 |
commit | 43b84bbba2519686eb6b0463f422bf695d2d74b9 (patch) | |
tree | 9beeb9c705ef08a3b45ac6e46176f3ea6c163baa /svx | |
parent | 6f135b0aa231a2543d73f94e39cb472e12ea47d5 (diff) |
svx: new InteropGrabBag UNO prop in Shape service
Added the new InteropGrabBag property to the Shape
service and modified the JUnit UNO unit tests for
it.
Added specific implementation in the svx module
for the SvxShape class.
This new property is intended by now for its usage
on preserving OOX's Smart-Art but it could also be
used for preserving other attributes for
interoperability among document formats.
Change-Id: Idc7a8e91592399ff05effd4da6eaa2935f8f4d42
Reviewed-on: https://gerrit.libreoffice.org/5769
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 31 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 12 |
2 files changed, 43 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 0414d038aaa0..ec30110775fc 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -38,6 +38,7 @@ #include <sfx2/objface.hxx> #include <sfx2/objsh.hxx> #include <svl/whiter.hxx> +#include <svl/grabbagitem.hxx> #include <svtools/colorcfg.hxx> #include <tools/bigint.hxx> #include <tools/diagnose_ex.h> @@ -433,6 +434,7 @@ SdrObject::SdrObject() ,pUserCall(NULL) ,pPlusData(NULL) ,nOrdNum(0) + ,pGrabBagItem(NULL) ,mnNavigationPosition(SAL_MAX_UINT32) ,mnLayerID(0) ,mpSvxShape( NULL ) @@ -501,6 +503,8 @@ SdrObject::~SdrObject() SendUserCall(SDRUSERCALL_DELETE, GetLastBoundRect()); delete pPlusData; + delete pGrabBagItem; + if(mpProperties) { delete mpProperties; @@ -906,6 +910,27 @@ void SdrObject::SetOrdNum(sal_uInt32 nNum) nOrdNum = nNum; } +void SdrObject::GetGrabBagItem(com::sun::star::uno::Any& rVal) const +{ + if (pGrabBagItem != NULL) + pGrabBagItem->QueryValue(rVal); + else { + uno::Sequence<beans::PropertyValue> aValue(0); + rVal = uno::makeAny(aValue); + } +} + +void SdrObject::SetGrabBagItem(const com::sun::star::uno::Any& rVal) +{ + if (pGrabBagItem == NULL) + pGrabBagItem = new SfxGrabBagItem; + + pGrabBagItem->PutValue(rVal); + + SetChanged(); + BroadcastObjectChange(); +} + sal_uInt32 SdrObject::GetNavigationPosition (void) { if (pObjList!=NULL && pObjList->RecalcNavigationPositions()) @@ -1086,6 +1111,12 @@ SdrObject& SdrObject::operator=(const SdrObject& rObj) delete pPlusData->pBroadcast; // broadcaster isn't copied pPlusData->pBroadcast=NULL; } + + delete pGrabBagItem; + pGrabBagItem=NULL; + if (rObj.pGrabBagItem!=NULL) + pGrabBagItem=static_cast< SfxGrabBagItem* >( rObj.pGrabBagItem->Clone() ); + aGridOffset = rObj.aGridOffset; return *this; } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 012d56728c55..50330d4778f2 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2451,6 +2451,12 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl break; } + case OWN_ATTR_INTEROPGRABBAG: + { + mpObj->SetGrabBagItem(rValue); + return true; + } + case SDRATTR_OBJMOVEPROTECT: { sal_Bool bMoveProtect = sal_Bool(); @@ -2854,6 +2860,12 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl rValue <<= (sal_Int32)mpObj->GetShearAngle(); break; + case OWN_ATTR_INTEROPGRABBAG: + { + mpObj->GetGrabBagItem(rValue); + break; + } + case SDRATTR_OBJMOVEPROTECT: rValue = uno::makeAny( (sal_Bool) mpObj->IsMoveProtect() ); break; |