diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-13 11:12:50 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-19 14:46:56 -0400 |
commit | 1d38cb365543924f9c50014e6b2227e77de1d0c9 (patch) | |
tree | 1e77d0d2f82330f16c09cda60864824397d132c4 /sd | |
parent | 2538e30ccc2e98de92de5157ca523fdb347eb537 (diff) |
fdo#71076, fdo#71767: Preserve number formats when charts are copied.
Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdxfer.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/TabControl.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/View.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/inc/sdtreelb.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/sdxfer.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/view/tabcontr.cxx | 2 |
10 files changed, 35 insertions, 21 deletions
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index bc2af1cffc63..65b6ff7d5a01 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1095,7 +1095,7 @@ bool SdDrawDocument::InsertBookmarkAsObject( pBMView->GetDoc().SetAllocDocSh(true); SdDrawDocument* pTmpDoc = (SdDrawDocument*) pBMView->GetMarkedObjModel(); - bOK = pView->Paste(*pTmpDoc, aObjPos, pPage); + bOK = pView->Paste(*pTmpDoc, aObjPos, pPage, 0, OUString(), OUString()); if (bOLEObjFound) pBMView->GetDoc().SetAllocDocSh(false); diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index cff6d88dea58..08acf398b9e6 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -448,7 +448,7 @@ void SdTransferable::AddSupportedFormats() } } -bool SdTransferable::GetData( const DataFlavor& rFlavor ) +bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc ) { if (SD_MOD()==NULL) return false; @@ -476,7 +476,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor ) if( nFormat == FORMAT_GDIMETAFILE && mpGraphic ) bOK = SetGDIMetaFile( mpGraphic->GetGDIMetaFile(), rFlavor ); else - bOK = SetAny( mpOLEDataHelper->GetAny( rFlavor ), rFlavor ); + bOK = SetAny( mpOLEDataHelper->GetAny(rFlavor, rDestDoc), rFlavor ); if( mpSdDrawDocumentIntern ) mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode ); diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 83978f8f0540..370c0da71fc9 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -125,7 +125,7 @@ void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats() -bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { sal_uLong nFormatId = SotExchange::GetFormat( rFlavor ); switch (nFormatId) diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx index 2ec16b904d42..1700921dfee5 100644 --- a/sd/source/ui/inc/TabControl.hxx +++ b/sd/source/ui/inc/TabControl.hxx @@ -95,7 +95,7 @@ private: virtual ~TabControlTransferable(); 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 void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; }; diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 80dd74e77716..b78671d48566 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -195,7 +195,10 @@ public: virtual void onAccessibilityOptionsChanged() SAL_OVERRIDE; virtual SdrModel* GetMarkedObjModel() const SAL_OVERRIDE; - virtual bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE; + virtual bool Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) SAL_OVERRIDE; + using SdrExchangeView::Paste; /** returns true if we have an undo manager and there is an open list undo action */ diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index be54329fdde6..8a40c6037f45 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -100,7 +100,7 @@ public: SAL_DLLPRIVATE virtual ~SdPageObjsTransferable(); SAL_DLLPRIVATE virtual void AddSupportedFormats() SAL_OVERRIDE; - SAL_DLLPRIVATE virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + SAL_DLLPRIVATE virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; SAL_DLLPRIVATE virtual void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE; SAL_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx index 095beecf83dd..d9aa56e3826c 100644 --- a/sd/source/ui/inc/sdxfer.hxx +++ b/sd/source/ui/inc/sdxfer.hxx @@ -106,7 +106,7 @@ public: 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; virtual void ObjectReleased() SAL_OVERRIDE; diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 631a238e97c8..9fdad1d90b76 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -976,9 +976,11 @@ SdrModel* View::GetMarkedObjModel() const return FmFormView::GetMarkedObjModel();; } -bool View::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst /* =NULL */, sal_uInt32 nOptions /* =0 */) +bool View::Paste( + const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions, + const OUString& rSrcShellID, const OUString& rDestShellID ) { - return FmFormView::Paste( rMod, rPos, pLst,nOptions );; + return FmFormView::Paste(rMod, rPos, pLst, nOptions, rSrcShellID, rDestShellID); } } // end of namespace sd diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index bce24cd103dc..315433c93223 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -604,7 +604,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, SdDrawDocument* pSourceDoc = (SdDrawDocument*) pSourceView->GetModel(); pSourceDoc->CreatingDataObj( pOwnData ); SdDrawDocument* pModel = (SdDrawDocument*) pSourceView->GetMarkedObjModel(); - bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); if( !pPage ) pPage = (SdPage*) GetSdrPageView()->GetPage(); @@ -645,7 +645,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, pWorkModel->DeletePage( (sal_uInt16) i ); } - bReturn = Paste( *pWorkModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); if( !pPage ) pPage = (SdPage*) GetSdrPageView()->GetPage(); @@ -804,7 +804,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 ); } - bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); } xShell->DoClose(); @@ -845,9 +845,15 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, uno::Reference < io::XInputStream > xStm; TransferableObjectDescriptor aObjDesc; - if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) && - ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) || - aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ, xStm ) ) ) + if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc)) + { + OUString aDocShellID = SfxObjectShell::CreateShellID(mrDoc.GetDocSh()); + xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, aDocShellID); + if (!xStm.is()) + xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ, aDocShellID); + } + + if (xStm.is()) { if( mrDoc.GetDocSh() && ( mrDoc.GetDocSh()->GetClassName() == aObjDesc.maClassName ) ) { @@ -881,7 +887,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, pModel->DeletePage( (sal_uInt16) i ); } - bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); if( !pPage ) pPage = (SdPage*) GetSdrPageView()->GetPage(); @@ -1030,8 +1036,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, uno::Reference < embed::XEmbeddedObject > xObj; OUString aName; - if ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm ) || - aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) ) + xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString()); + if (!xStm.is()) + xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString()); + + if (xStm.is()) { xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName ); } @@ -1504,7 +1513,7 @@ bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nP pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); CreateTableFromRTF( *xStm, pModel.get() ); - bool bRet = Paste( *pModel, maDropPos, pPage, nPasteOptions ); + bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString()); xComponent->dispose(); xComponent.clear(); diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index 827739acff84..2df6a85b04b7 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -62,7 +62,7 @@ void TabControl::TabControlTransferable::AddSupportedFormats() -bool TabControl::TabControlTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& ) +bool TabControl::TabControlTransferable::GetData( const css::datatransfer::DataFlavor& /*rFlavor*/, const OUString& /*rDestDoc*/ ) { return false; } |