summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-13 11:12:50 -0400
committerAndras Timar <andras.timar@collabora.com>2014-07-15 23:44:08 +0200
commit388f2fa9fcabe1b2adaff282fa9509216f3af6de (patch)
tree7f3f9bf662aaafbdcf8ed80c29cbeed8418042f5 /sc/source/ui/view
parent1c269727b470c03f0ea538cad7e1331fd569a579 (diff)
fdo#71076, fdo#71767: Preserve number formats when charts are copied.
(cherry picked from commit 1d38cb365543924f9c50014e6b2227e77de1d0c9) Signed-off-by: Andras Timar <andras.timar@collabora.com> Conflicts: xmloff/source/chart/SchXMLExport.cxx sd/source/ui/view/sdview3.cxx chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx chart2/source/controller/main/ChartTransferable.cxx chart2/source/controller/main/ChartTransferable.hxx chart2/source/model/main/Axis.cxx chart2/source/model/template/ChartTypeTemplate.cxx chart2/source/tools/AxisHelper.cxx chart2/source/view/main/ChartView.cxx comphelper/source/container/embeddedobjectcontainer.cxx dbaccess/source/ui/browser/dbexchange.cxx dbaccess/source/ui/inc/JoinExchange.hxx dbaccess/source/ui/inc/TableRowExchange.hxx dbaccess/source/ui/inc/dbexchange.hxx dbaccess/source/ui/querydesign/JoinExchange.cxx dbaccess/source/ui/tabledesign/TableRowExchange.cxx embeddedobj/source/commonembedding/persistence.cxx embeddedobj/source/inc/commonembobj.hxx include/comphelper/embeddedobjectcontainer.hxx include/svtools/embedtransfer.hxx include/svtools/stringtransfer.hxx include/svtools/transfer.hxx include/svx/dbaexchange.hxx include/svx/dbaobjectex.hxx include/svx/fmview.hxx include/svx/galmisc.hxx include/svx/svdobj.hxx include/svx/svdoole2.hxx include/svx/svdxcgv.hxx include/svx/view3d.hxx include/svx/xmlexchg.hxx include/xmloff/xmlexp.hxx reportdesign/source/ui/dlg/GroupExchange.cxx reportdesign/source/ui/dlg/GroupExchange.hxx reportdesign/source/ui/inc/dlgedclip.hxx reportdesign/source/ui/report/dlgedclip.cxx sc/inc/column.hxx sc/source/ui/app/drwtrans.cxx sc/source/ui/app/lnktrans.cxx sc/source/ui/app/seltrans.cxx sc/source/ui/app/transobj.cxx sc/source/ui/inc/drwtrans.hxx sc/source/ui/inc/lnktrans.hxx sc/source/ui/inc/seltrans.hxx sc/source/ui/inc/transobj.hxx sc/source/ui/inc/viewfunc.hxx sc/source/ui/view/viewfun5.cxx sc/source/ui/view/viewfun7.cxx sd/source/ui/app/sdxfer.cxx sd/source/ui/dlg/sdtreelb.cxx sd/source/ui/inc/TabControl.hxx sd/source/ui/inc/View.hxx sd/source/ui/inc/sdtreelb.hxx sd/source/ui/inc/sdxfer.hxx sd/source/ui/view/sdview2.cxx sd/source/ui/view/tabcontr.cxx sfx2/source/doc/objxtor.cxx svtools/source/misc/embedtransfer.cxx svtools/source/misc/stringtransfer.cxx svtools/source/misc/transfer.cxx svtools/source/misc/transfer2.cxx svx/source/engine3d/view3d.cxx svx/source/fmcomp/dbaexchange.cxx svx/source/fmcomp/dbaobjectex.cxx svx/source/fmcomp/xmlexchg.cxx svx/source/form/fmexch.cxx svx/source/form/fmview.cxx svx/source/gallery2/galmisc.cxx svx/source/inc/fmexch.hxx svx/source/svdraw/svdoole2.cxx svx/source/svdraw/svdxcgv.cxx svx/source/tbxctrls/colrctrl.cxx sw/source/core/uibase/dochdl/swdtflvr.cxx sw/source/core/uibase/inc/swdtflvr.hxx sw/source/core/undo/unins.cxx Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a (cherry picked from commit 4ee53683df4beda260aff26d2c9e56fe643f45bb) Signed-off-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/gridwin.cxx8
-rw-r--r--sc/source/ui/view/viewfun3.cxx11
-rw-r--r--sc/source/ui/view/viewfun5.cxx22
-rw-r--r--sc/source/ui/view/viewfun7.cxx6
4 files changed, 30 insertions, 17 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 1fa83c563e6e..cd38c6d24783 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4412,7 +4412,8 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
bPasteIsMove = bIsMove;
- pViewData->GetView()->PasteDraw( aLogicPos, rData.pDrawTransfer->GetModel() );
+ pViewData->GetView()->PasteDraw(
+ aLogicPos, rData.pDrawTransfer->GetModel(), false, "A", "B");
if (bPasteIsMove)
rData.pDrawTransfer->SetDragWasInternal();
@@ -4517,8 +4518,9 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel )
// bSameDocClipboard argument for PasteDraw is needed
// because only DragData is checked directly inside PasteDraw
- pViewData->GetView()->PasteDraw( aLogicPos, pDrawTransfer->GetModel(), false,
- pDrawTransfer->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
+ pViewData->GetView()->PasteDraw(
+ aLogicPos, pDrawTransfer->GetModel(), false,
+ pDrawTransfer->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell()));
}
}
}
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index f8454d3570c5..5cb568d5298e 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -449,8 +449,11 @@ void ScViewFunc::PasteDraw()
pViewData->GetActivePart() ) );
ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard( pWin );
if (pDrawClip)
- PasteDraw( aPos, pDrawClip->GetModel(), false,
- pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
+ {
+ OUString aSrcShellID = pDrawClip->GetShellID();
+ OUString aDestShellID = SfxObjectShell::CreateShellID(pViewData->GetDocShell());
+ PasteDraw(aPos, pDrawClip->GetModel(), false, aSrcShellID, aDestShellID);
+ }
}
void ScViewFunc::PasteFromSystem()
@@ -586,7 +589,9 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran
SCROW nPosY = pViewData->GetCurY();
Window* pWin = GetActiveWin();
Point aPos = pWin->PixelToLogic( pViewData->GetScrPos( nPosX, nPosY, pViewData->GetActivePart() ) );
- PasteDraw( aPos, pDrawClip->GetModel(), false, pDrawClip->GetSourceDocID() == pViewData->GetDocument()->GetDocumentID() );
+ PasteDraw(
+ aPos, pDrawClip->GetModel(), false,
+ pDrawClip->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell()));
}
else
{
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 9319bd6d5126..d5c32980f2a2 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -120,8 +120,10 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
uno::Reference < io::XInputStream > xStm;
TransferableObjectDescriptor aObjDesc;
- if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
- aDataHelper.GetInputStream( nFormatId, xStm ) )
+ if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc))
+ xStm = aDataHelper.GetInputStream(nFormatId, OUString());
+
+ if (xStm.is())
{
if ( aObjDesc.maClassName == SvGlobalName( SO3_SC_CLASSID_60 ) )
{
@@ -205,9 +207,11 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
{
OUString aName;
uno::Reference < embed::XEmbeddedObject > xObj;
+ xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString());
+ if (!xStm.is())
+ aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString());
- if ( aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm )
- || aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) )
+ if (xStm.is())
{
xObj = GetViewData()->GetDocShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
}
@@ -515,7 +519,7 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
nObjCount += pPage->GetObjCount(); // count group object only once
}
- PasteDraw( aPos, pModel, (nObjCount > 1) ); // grouped if more than 1 object
+ PasteDraw(aPos, pModel, (nObjCount > 1), "A", "B"); // grouped if more than 1 object
delete pModel;
aDragShellRef->DoClose();
bRet = sal_True;
@@ -525,8 +529,8 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
{
// do excel import into a clipboard document
//TODO/MBA: testing
- uno::Reference < io::XInputStream > xStm;
- if( aDataHelper.GetInputStream( nFormatId, xStm ) )
+ uno::Reference <io::XInputStream> xStm = aDataHelper.GetInputStream(nFormatId, OUString());
+ if (xStm.is())
{
ScDocument* pInsDoc = new ScDocument( SCDOCMODE_CLIP );
SCTAB nSrcTab = 0; // Biff5 in clipboard: always sheet 0
@@ -626,8 +630,8 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r
// get link data from transferable before string data,
// so the source knows it will be used for a link
- uno::Sequence<sal_Int8> aSequence;
- if ( !aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aSequence ) )
+ uno::Sequence<sal_Int8> aSequence = aDataHelper.GetSequence(SOT_FORMATSTR_ID_LINK, OUString());
+ if (!aSequence.getLength())
{
OSL_FAIL("DDE Data not found.");
return false;
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 1904bcec5c77..7506f029cc2f 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -73,8 +73,10 @@ static void lcl_AdjustInsertPos( ScViewData* pData, Point& rPos, Size& rSize )
}
void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
- sal_Bool bGroup, sal_Bool bSameDocClipboard )
+ bool bGroup, const OUString& rSrcShellID, const OUString& rDestShellID )
{
+ bool bSameDocClipboard = rSrcShellID == rDestShellID;
+
MakeDrawLayer();
Point aPos( rLogicPos );
@@ -219,7 +221,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
if ( !bSameDocClipboard )
GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( sal_True );
- pScDrawView->Paste( *pModel, aPos, NULL, nOptions );
+ pScDrawView->Paste(*pModel, aPos, NULL, nOptions, rSrcShellID, rDestShellID);
if ( !bSameDocClipboard )
GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( false );