summaryrefslogtreecommitdiff
path: root/patches/vba/vba-worksheet-copy-otherdoc-api-support.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/vba/vba-worksheet-copy-otherdoc-api-support.diff')
-rw-r--r--patches/vba/vba-worksheet-copy-otherdoc-api-support.diff207
1 files changed, 0 insertions, 207 deletions
diff --git a/patches/vba/vba-worksheet-copy-otherdoc-api-support.diff b/patches/vba/vba-worksheet-copy-otherdoc-api-support.diff
deleted file mode 100644
index 22c36106a..000000000
--- a/patches/vba/vba-worksheet-copy-otherdoc-api-support.diff
+++ /dev/null
@@ -1,207 +0,0 @@
----
- sc/source/ui/docshell/docsh5.cxx | 41 +++++++++++++++++++++++++++++
- sc/source/ui/inc/docsh.hxx | 4 +++
- sc/source/ui/vba/vbaworksheet.cxx | 35 +++++++++++++++++++++----
- sc/source/ui/view/viewfun2.cxx | 51 ++----------------------------------
- 4 files changed, 77 insertions(+), 54 deletions(-)
-
-diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
-index aa3ca3e..d4d79e4 100644
---- sc/source/ui/docshell/docsh5.cxx
-+++ sc/source/ui/docshell/docsh5.cxx
-@@ -857,6 +857,47 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const String& rName, const String& r
- return nTab;
- }
-
-+ULONG ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint )
-+{
-+ ScDocument* pSrcDoc = rSrcDocShell.GetDocument();
-+
-+ ULONG nErrVal = aDocument.TransferTab( pSrcDoc, nSrcPos, nDestPos,
-+ bInsertNew ); // no insert
-+
-+ // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-+ if ( nErrVal > 0 && !bInsertNew)
-+ aDocument.TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
-+
-+ if(nErrVal>0 && pSrcDoc->IsScenario( nSrcPos ))
-+ {
-+ String aComment;
-+ Color aColor;
-+ USHORT nFlags;
-+
-+ pSrcDoc->GetScenarioData( nSrcPos, aComment,aColor, nFlags);
-+ aDocument.SetScenario(nDestPos,TRUE);
-+ aDocument.SetScenarioData(nDestPos,aComment,aColor,nFlags);
-+ BOOL bActive = pSrcDoc->IsActiveScenario(nSrcPos);
-+ aDocument.SetActiveScenario(nDestPos, bActive );
-+
-+ BOOL bVisible=pSrcDoc->IsVisible(nSrcPos);
-+ aDocument.SetVisible(nDestPos,bVisible );
-+
-+ }
-+
-+ if ( nErrVal > 0 && pSrcDoc->IsTabProtected( nSrcPos ) )
-+ aDocument.SetTabProtection(nDestPos, pSrcDoc->GetTabProtection(nSrcPos));
-+ if ( bNotifyAndPaint )
-+ {
-+ Broadcast( ScTablesHint( SC_TAB_INSERTED, nDestPos ) );
-+ PostPaintExtras();
-+ PostPaintGridAll();
-+ }
-+ return nErrVal;
-+}
-+
- BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord )
- {
- ScDocShellModificator aModificator( *this );
-diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
-index beb3e4e..8f62ca0 100644
---- sc/source/ui/inc/docsh.hxx
-+++ sc/source/ui/inc/docsh.hxx
-@@ -297,6 +297,10 @@ public:
- ScMarkData& rMark, BOOL bRecord = TRUE );
- void ModifyScenario( SCTAB nTab, const String& rName, const String& rComment,
- const Color& rColor, USHORT nFlags );
-+ ULONG TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint );
-+
- BOOL MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord );
-
- void DoRecalc( BOOL bApi );
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index 2af3a04..0525850 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -486,20 +486,43 @@ ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno
- return;
- }
-
-- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY );
-+ ScVbaWorksheet* pDestSheet = static_cast< ScVbaWorksheet* >(xSheet.get());
-+ uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
-+
- SCTAB nDest = 0;
-+ SCTAB nSrc = 0;
- aSheetName = xSheet->getName();
-- bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nDest );
-
-- if ( bSheetExists )
-+ bool bSameDoc = ( pDestSheet->getModel() == getModel() );
-+ bool bDestSheetExists = nameExists (xDestDoc, aSheetName, nDest );
-+ bool bSheetExists = nameExists (xSrcDoc, aCurrSheetName, nSrc );
-+
-+ // set sheet name to be newSheet name
-+ aSheetName = aCurrSheetName;
-+ SCTAB nDummy=0;
-+ if ( bSheetExists && bDestSheetExists )
- {
- sal_Bool bAfter = After.hasValue();
- if(bAfter)
- nDest++;
-- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
-- getNewSpreadsheetName(aSheetName,aCurrSheetName,xSpreadDoc);
-- xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
-+ if ( bSameDoc || nameExists( xDestDoc, aCurrSheetName, nDummy ) )
-+ getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
-+ if ( bSameDoc )
-+ xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ else
-+ {
-+ ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
-+ ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
-+ if ( pDestDocShell && pSrcDocShell )
-+ pDestDocShell->TransferTab( *pSrcDocShell, static_cast<SCTAB>(nSrc), static_cast<SCTAB>(nDest), TRUE, TRUE );
-+ }
- }
-+ // active the new sheet
-+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW );
-+ xNewSheet->Activate();
- }
-
-
-diff --git sc/source/ui/view/viewfun2.cxx sc/source/ui/view/viewfun2.cxx
-index 9f2bc5e..2030372 100644
---- sc/source/ui/view/viewfun2.cxx
-+++ sc/source/ui/view/viewfun2.cxx
-@@ -2474,8 +2474,8 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- {
- SCTAB nSrcTab = pSrcTabs[i];
- SCTAB nDestTab1=nTab+i;
-- ULONG nErrVal = pDoc->TransferTab( pSrcDoc, nSrcTab, nDestTab1,
-- FALSE ); // no insert
-+ ULONG nErrVal = pDocSh->TransferTab( *pSrcShell, nSrcTab, nDestTab1,
-+ FALSE, FALSE ); // no insert
-
- switch (nErrVal)
- {
-@@ -2493,25 +2493,6 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- break;
- }
-
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( !bError )
-- pDoc->TransferDrawPage( pSrcDoc, nSrcTab, nDestTab1 );
--
-- if(!bError &&pSrcDoc->IsScenario(nSrcTab))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pSrcDoc->GetScenarioData(nSrcTab, aComment,aColor, nFlags);
-- pDoc->SetScenario( nDestTab1,TRUE);
-- pDoc->SetScenarioData( nTab+i,aComment,aColor,nFlags);
-- BOOL bActive = pSrcDoc->IsActiveScenario(nSrcTab );
-- pDoc->SetActiveScenario( nDestTab1, bActive );
-- BOOL bVisible=pSrcDoc->IsVisible(nSrcTab);
-- pDoc->SetVisible(nDestTab1,bVisible );
--
-- }
- }
-
- if (bLink)
-@@ -2695,33 +2676,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy )
- nDestTab1 = nDestTab;
- for(USHORT i=0;i<TheTabs.Count();i++)
- {
-- nErrVal = pDestDoc->TransferTab( pDoc, TheTabs[i], nDestTab1,
-- FALSE ); // no insert
--
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( nErrVal > 0 )
-- pDestDoc->TransferDrawPage( pDoc, TheTabs[i], nDestTab1 );
--
-- if(nErrVal>0 && pDoc->IsScenario(TheTabs[i]))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pDoc->GetScenarioData(TheTabs[i], aComment,aColor, nFlags);
-- pDestDoc->SetScenario(nDestTab1,TRUE);
-- pDestDoc->SetScenarioData(nDestTab1,aComment,aColor,nFlags);
-- BOOL bActive = pDoc->IsActiveScenario(TheTabs[i]);
-- pDestDoc->SetActiveScenario(nDestTab1, bActive );
--
-- BOOL bVisible=pDoc->IsVisible(TheTabs[i]);
-- pDestDoc->SetVisible(nDestTab1,bVisible );
--
-- }
--
-- if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
-- pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
--
-+ nErrVal = pDestShell->TransferTab( *pDocShell, static_cast<SCTAB>(TheTabs[i]), static_cast<SCTAB>(nDestTab1), FALSE, FALSE );
- nDestTab1++;
- }
- }
---
-1.7.0.1
-