diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-13 11:12:50 -0400 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-06-23 15:02:14 +0000 |
commit | 22cd19eeeb476c40b68bb1ff040fce6103fdeba4 (patch) | |
tree | c4550dfcfbc10ebb75e3b6130ca44d44a28484ec /svx | |
parent | a28256553dcc29d67c530b29727bfbf3ba6aa81a (diff) |
fdo#71076, fdo#71767: Preserve number formats when charts are copied.
(cherry picked from commit 1d38cb365543924f9c50014e6b2227e77de1d0c9)
Conflicts:
sd/source/ui/view/sdview3.cxx
xmloff/source/chart/SchXMLExport.cxx
Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a
Reviewed-on: https://gerrit.libreoffice.org/9836
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/engine3d/view3d.cxx | 6 | ||||
-rw-r--r-- | svx/source/fmcomp/dbaexchange.cxx | 12 | ||||
-rw-r--r-- | svx/source/fmcomp/dbaobjectex.cxx | 4 | ||||
-rw-r--r-- | svx/source/fmcomp/xmlexchg.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmexch.cxx | 10 | ||||
-rw-r--r-- | svx/source/form/fmview.cxx | 7 | ||||
-rw-r--r-- | svx/source/gallery2/galmisc.cxx | 2 | ||||
-rw-r--r-- | svx/source/inc/fmexch.hxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 23 | ||||
-rw-r--r-- | svx/source/svdraw/svdxcgv.cxx | 6 | ||||
-rw-r--r-- | svx/source/tbxctrls/colrctrl.cxx | 4 |
12 files changed, 52 insertions, 33 deletions
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 9659771a960a..3ac2c0d6a49f 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -441,7 +441,9 @@ SdrModel* E3dView::GetMarkedObjModel() const // When pasting objects have to integrated if a scene is inserted, but // not the scene itself -bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions) +bool E3dView::Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) { bool bRetval = false; @@ -486,7 +488,7 @@ bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, s else { // call parent - bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions); + bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID); } return bRetval; diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx index fd639185e4c9..4cd42174270f 100644 --- a/svx/source/fmcomp/dbaexchange.cxx +++ b/svx/source/fmcomp/dbaexchange.cxx @@ -224,7 +224,7 @@ namespace svx } - bool OColumnTransferable::GetData( const DataFlavor& _rFlavor ) + bool OColumnTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); switch (nFormatId) @@ -276,7 +276,7 @@ namespace svx SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor); OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - Any aDescriptor = _rData.GetAny(aFlavor); + Any aDescriptor = _rData.GetAny(aFlavor, OUString()); // extract the property value sequence Sequence< PropertyValue > aDescriptorProps; @@ -469,7 +469,7 @@ namespace svx } - bool ODataAccessObjectTransferable::GetData( const DataFlavor& rFlavor ) + bool ODataAccessObjectTransferable::GetData( const DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uIntPtr nFormat = SotExchange::GetFormat(rFlavor); switch (nFormat) @@ -524,7 +524,7 @@ namespace svx SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor); OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - Any aDescriptor = _rData.GetAny(aFlavor); + Any aDescriptor = _rData.GetAny(aFlavor, OUString()); // extract the property value sequence Sequence< PropertyValue > aDescriptorProps; @@ -644,7 +644,7 @@ namespace svx AddFormat(getDescriptorFormatId()); } - bool OMultiColumnTransferable::GetData( const DataFlavor& _rFlavor ) + bool OMultiColumnTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); if (nFormatId == getDescriptorFormatId()) @@ -682,7 +682,7 @@ namespace svx SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor); OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - _rData.GetAny(aFlavor) >>= aList; + _rData.GetAny(aFlavor, OUString()) >>= aList; } // if (_rData.HasFormat(getDescriptorFormatId())) return aList; } diff --git a/svx/source/fmcomp/dbaobjectex.cxx b/svx/source/fmcomp/dbaobjectex.cxx index b64beae98f72..c994db3426db 100644 --- a/svx/source/fmcomp/dbaobjectex.cxx +++ b/svx/source/fmcomp/dbaobjectex.cxx @@ -90,7 +90,7 @@ namespace svx } - bool OComponentTransferable::GetData( const DataFlavor& _rFlavor ) + bool OComponentTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); if ( nFormatId == getDescriptorFormatId(true) || nFormatId == getDescriptorFormatId(false) ) @@ -131,7 +131,7 @@ namespace svx SotExchange::GetFormatDataFlavor(getDescriptorFormatId(bForm), aFlavor); OSL_ENSURE(bSuccess, "OComponentTransferable::extractColumnDescriptor: invalid data format (no flavor)!"); - Any aDescriptor = _rData.GetAny(aFlavor); + Any aDescriptor = _rData.GetAny(aFlavor, OUString()); // extract the property value sequence Sequence< PropertyValue > aDescriptorProps; diff --git a/svx/source/fmcomp/xmlexchg.cxx b/svx/source/fmcomp/xmlexchg.cxx index b02ea58f3e99..058d36d85d81 100644 --- a/svx/source/fmcomp/xmlexchg.cxx +++ b/svx/source/fmcomp/xmlexchg.cxx @@ -43,7 +43,7 @@ namespace svx AddFormat( SOT_FORMATSTR_ID_XFORMS ); } - bool OXFormsTransferable::GetData( const DataFlavor& _rFlavor ) + bool OXFormsTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor ); if ( SOT_FORMATSTR_ID_XFORMS == nFormatId ) diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx index 48d5838b8286..b224432d8e86 100644 --- a/svx/source/form/fmexch.cxx +++ b/svx/source/form/fmexch.cxx @@ -115,7 +115,7 @@ namespace svxform } - bool OLocalExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& /*_rFlavor*/ ) + bool OLocalExchange::GetData( const css::datatransfer::DataFlavor& /*_rFlavor*/, const OUString& /*rDestDoc*/ ) { return false; // do not have any formats by default } @@ -139,7 +139,7 @@ namespace svxform if ( OControlExchange::hasControlPathFormat( aExchangedData.GetDataFlavorExVector() ) ) { // paths to the controls, relative to a root Sequence< Any > aControlPathData; - if ( aExchangedData.GetAny( OControlExchange::getControlPathFormatId() ) >>= aControlPathData ) + if ( aExchangedData.GetAny(OControlExchange::getControlPathFormatId(), OUString()) >>= aControlPathData ) { DBG_ASSERT( aControlPathData.getLength() >= 2, "OControlTransferData::OControlTransferData: invalid data for the control path format!" ); if ( aControlPathData.getLength() >= 2 ) @@ -155,7 +155,7 @@ namespace svxform } if ( OControlExchange::hasHiddenControlModelsFormat( aExchangedData.GetDataFlavorExVector() ) ) { // sequence of models of hidden controls - aExchangedData.GetAny( OControlExchange::getHiddenControlModelsFormatId() ) >>= m_aHiddenControlModels; + aExchangedData.GetAny(OControlExchange::getHiddenControlModelsFormatId(), OUString()) >>= m_aHiddenControlModels; } updateFormats( ); @@ -290,7 +290,7 @@ namespace svxform } - bool OControlExchange::GetData( const DataFlavor& _rFlavor ) + bool OControlExchange::GetData( const DataFlavor& _rFlavor, const OUString& rDestDoc ) { const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor ); @@ -310,7 +310,7 @@ namespace svxform SetAny( makeAny( m_aHiddenControlModels ), _rFlavor ); } else - return OLocalExchange::GetData( _rFlavor ); + return OLocalExchange::GetData(_rFlavor, rDestDoc); return true; } diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index e6234e2c942c..702fd00ef0c1 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -379,13 +379,6 @@ SdrModel* FmFormView::GetMarkedObjModel() const return E3dView::GetMarkedObjModel(); } - -bool FmFormView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions) -{ - return E3dView::Paste(rMod, rPos, pLst, nOptions); -} - - void FmFormView::ActivateControls(SdrPageView* pPageView) { if (!pPageView) diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index e89658761cdd..47b05eabaccd 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -507,7 +507,7 @@ void GalleryTransferable::AddSupportedFormats() } } -bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor ) +bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); bool bRet = false; diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx index 8e47403aa43e..dbdc4f3c5140 100644 --- a/svx/source/inc/fmexch.hxx +++ b/svx/source/inc/fmexch.hxx @@ -82,7 +82,7 @@ namespace svxform // TransferableHelper virtual void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; private: void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions, sal_Int32 nDragPointer = DND_POINTER_NONE, sal_Int32 nDragImage = DND_IMAGE_NONE ) @@ -225,7 +225,7 @@ namespace svxform inline static bool hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats ); protected: - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; virtual void AddSupportedFormats() SAL_OVERRIDE; }; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index ca94637feb5a..96db7302698f 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1065,6 +1065,11 @@ SdrObject* SdrObject::Clone() const return CloneHelper< SdrObject >(); } +SdrObject* SdrObject::CloneWithShellIDs( const OUString& /*rSrcShellID*/, const OUString& /*rDestShellID*/ ) const +{ + return Clone(); +} + SdrObject& SdrObject::operator=(const SdrObject& rObj) { if( this == &rObj ) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index e01dae90f35a..86379ce7f8fd 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1624,7 +1624,20 @@ SdrOle2Obj* SdrOle2Obj::Clone() const return CloneHelper< SdrOle2Obj >(); } -SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) +SdrOle2Obj* SdrOle2Obj::CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const +{ + SdrOle2Obj* pObj = + dynamic_cast<SdrOle2Obj*>( + SdrObjFactory::MakeNewObject(GetObjInventor(), GetObjIdentifier(), NULL)); + + if (pObj) + pObj->assignFrom(*this, rSrcShellID, rDestShellID); + + return pObj; +} + +SdrOle2Obj& SdrOle2Obj::assignFrom( + const SdrOle2Obj& rObj, const OUString& rSrcShellID, const OUString& rDestShellID ) { //TODO/LATER: who takes over control of my old object?! if( &rObj != this ) @@ -1671,7 +1684,8 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) if ( xObj.is() ) { OUString aTmp; - xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( rContainer, xObj, aTmp ), rOle2Obj.GetAspect() ); + xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( + rContainer, xObj, aTmp, rSrcShellID, rDestShellID), rOle2Obj.GetAspect()); m_bTypeAsked = false; mpImpl->aPersistName = aTmp; CheckFileLink_Impl(); @@ -1684,7 +1698,10 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) return *this; } - +SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) +{ + return assignFrom(rObj, OUString(), OUString()); +} void SdrOle2Obj::ImpSetVisAreaSize() { diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 0ec6046e8584..5b3c57b14944 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -223,7 +223,9 @@ bool SdrExchangeView::Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt return true; } -bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions) +bool SdrExchangeView::Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) { const SdrModel* pSrcMod=&rMod; if (pSrcMod==pMod) @@ -298,7 +300,7 @@ bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* { const SdrObject* pSrcOb=pSrcPg->GetObj(nOb); - SdrObject* pNeuObj = pSrcOb->Clone(); + SdrObject* pNeuObj = pSrcOb->CloneWithShellIDs(rSrcShellID, rDestShellID); if (pNeuObj!=NULL) { diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 28809d41c303..5209fa9bfca2 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -49,7 +49,7 @@ private: protected: virtual void AddSupportedFormats() SAL_OVERRIDE; - virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; public: @@ -67,7 +67,7 @@ void SvxColorValueSetData::AddSupportedFormats() -bool SvxColorValueSetData::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool SvxColorValueSetData::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { bool bRet = false; |