summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r--sc/source/ui/docshell/arealink.cxx14
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx17
-rw-r--r--sc/source/ui/docshell/docfunc.cxx101
-rw-r--r--sc/source/ui/docshell/docsh.cxx85
-rw-r--r--sc/source/ui/docshell/docsh3.cxx4
-rw-r--r--sc/source/ui/docshell/docsh4.cxx7
-rw-r--r--sc/source/ui/docshell/docsh5.cxx9
-rw-r--r--sc/source/ui/docshell/docsh8.cxx199
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx106
-rw-r--r--sc/source/ui/docshell/impex.cxx4
-rw-r--r--sc/source/ui/docshell/tablink.cxx2
11 files changed, 306 insertions, 242 deletions
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index a290a81d9078..fd3a562ecb42 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -63,6 +63,7 @@
#include "sc.hrc" //CHINA001
#include "scabstdlg.hxx" //CHINA001
+#include "clipparam.hxx"
struct AreaLink_Impl
{
@@ -354,12 +355,12 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
}
else
pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aOldRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
else // ohne Einfuegen
{
pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aMaxRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
}
@@ -369,7 +370,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
if (bDoInsert)
pDoc->FitBlock( aOldRange, aNewRange ); // incl. loeschen
else
- pDoc->DeleteAreaTab( aMaxRange, IDF_ALL );
+ pDoc->DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
// Daten kopieren
@@ -389,9 +390,8 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
aSourceMark.SelectOneTable( nSrcTab ); // selektieren fuer CopyToClip
aSourceMark.SetMarkArea( aTokenRange );
- pSrcDoc->CopyToClip( aTokenRange.aStart.Col(), aTokenRange.aStart.Row(),
- aTokenRange.aEnd.Col(), aTokenRange.aEnd.Row(),
- FALSE, &aClipDoc, FALSE, &aSourceMark );
+ ScClipParam aClipParam(aTokenRange, false);
+ pSrcDoc->CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
@@ -426,7 +426,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
{
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab );
- pDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc );
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoUpdateAreaLink( pImpl->m_pDocSh,
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index ae176868162e..09e4dd7aa4af 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -576,18 +576,21 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (bRecord)
{
+ // do not touch notes (ScUndoImportData does not support drawing undo)
+ sal_uInt16 nCopyFlags = IDF_ALL & ~IDF_NOTE;
+
// nFormulaCols is set only if column count is unchanged
pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
if ( rParam.nCol2 > nEndCol )
pDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
nUndoEndCol, nUndoEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
if ( rParam.nRow2 > nEndRow )
pDoc->CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
nUndoEndCol+nFormulaCols, nUndoEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
}
//
@@ -601,7 +604,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
ScRange aDelRange( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2, rParam.nRow2, nTab );
- pDoc->DeleteAreaTab( aDelRange, IDF_ALL ); // ohne die Formeln
+ pDoc->DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
ScRange aOld( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
@@ -611,10 +614,10 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
}
else if ( nEndCol < rParam.nCol2 ) // DeleteArea calls PutInOrder
pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
- aNewMark, IDF_CONTENTS );
+ aNewMark, IDF_CONTENTS & ~IDF_NOTE );
// CopyToDocument doesn't remove contents
- pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS );
+ pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
// #41216# remove each column from ImportDoc after copying to reduce memory usage
BOOL bOldAutoCalc = pDoc->GetAutoCalc();
@@ -671,7 +674,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (nFormulaCols > 0) // include filled formulas for redo
pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ALL, FALSE, pRedoDoc );
+ IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc );
ScDBData* pRedoDBData = pDBData ? new ScDBData( *pDBData ) : NULL;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ebb080a89cfa..cb5d2ead509f 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -94,6 +94,7 @@
#include "compiler.hxx"
#include "scui_def.hxx" //CHINA001
#include "tabprotection.hxx"
+#include "clipparam.hxx"
#include <memory>
@@ -113,6 +114,14 @@ IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
else
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) );
rDocShell.SetDrawModified();
+
+ // the affected sheet isn't known, so all stream positions are invalidated
+ ScDocument* pDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (pDoc->IsStreamValid(nTab))
+ pDoc->SetStreamValid(nTab, FALSE);
+
return 0;
}
@@ -1061,6 +1070,9 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
if( rDoc.IsUndoEnabled() )
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) );
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), FALSE);
+
rDocShell.SetDocumentModified();
return true;
@@ -1089,6 +1101,9 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bA
//! Undo !!!
+ if (pDoc->IsStreamValid(rPos.Tab()))
+ pDoc->SetStreamValid(rPos.Tab(), FALSE);
+
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1142,6 +1157,10 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con
// repaint cell (to make note marker visible)
rDocShell.PostPaintCell( rPos );
+
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), FALSE);
+
aModificator.SetDocumentModified();
bDone = true;
}
@@ -1997,7 +2016,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nScenarioCount ++;
pDoc->CopyToDocument( nUndoStartX, nUndoStartY, i, nUndoEndX, nUndoEndY, i+nScenarioCount,
- IDF_ALL, FALSE, pUndoDoc );
+ IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
}
@@ -2258,8 +2277,8 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
}
ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
- pDoc->CopyToClip( nStartCol, nStartRow, nEndCol, nEndRow, bCut, pClipDoc,
- FALSE, &aSourceMark, bScenariosAdded, TRUE );
+ ScClipParam aClipParam(ScRange(nStartCol, nStartRow, 0, nEndCol, nEndRow, 0), bCut);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true);
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -2766,42 +2785,42 @@ BOOL ScDocFunc::SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL /* bApi */ )
return TRUE;
}
-BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar )
-{
- ScDocument* pDoc = rDocShell.GetDocument();
-
- if ( pDoc->GetGrammar() == eGrammar )
- return TRUE;
-
- BOOL bUndo(pDoc->IsUndoEnabled());
- ScDocShellModificator aModificator( rDocShell );
-
- pDoc->SetGrammar( eGrammar );
-
- if (bUndo)
- {
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) );
- }
-
- rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL );
-
- ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if (NULL != pViewSh)
- {
- pViewSh->UpdateInputHandler( FALSE, FALSE );
- }
-
- aModificator.SetDocumentModified();
-
- SfxBindings* pBindings = rDocShell.GetViewBindings();
- if (pBindings)
- {
- // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1
- //pBindings->Invalidate( FID_TAB_USE_R1C1 );
- }
-
- return TRUE;
-}
+//UNUSED2009-05 BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar )
+//UNUSED2009-05 {
+//UNUSED2009-05 ScDocument* pDoc = rDocShell.GetDocument();
+//UNUSED2009-05
+//UNUSED2009-05 if ( pDoc->GetGrammar() == eGrammar )
+//UNUSED2009-05 return TRUE;
+//UNUSED2009-05
+//UNUSED2009-05 BOOL bUndo(pDoc->IsUndoEnabled());
+//UNUSED2009-05 ScDocShellModificator aModificator( rDocShell );
+//UNUSED2009-05
+//UNUSED2009-05 pDoc->SetGrammar( eGrammar );
+//UNUSED2009-05
+//UNUSED2009-05 if (bUndo)
+//UNUSED2009-05 {
+//UNUSED2009-05 rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL );
+//UNUSED2009-05
+//UNUSED2009-05 ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
+//UNUSED2009-05 if (NULL != pViewSh)
+//UNUSED2009-05 {
+//UNUSED2009-05 pViewSh->UpdateInputHandler( FALSE, FALSE );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 aModificator.SetDocumentModified();
+//UNUSED2009-05
+//UNUSED2009-05 SfxBindings* pBindings = rDocShell.GetViewBindings();
+//UNUSED2009-05 if (pBindings)
+//UNUSED2009-05 {
+//UNUSED2009-05 // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1
+//UNUSED2009-05 //pBindings->Invalidate( FID_TAB_USE_R1C1 );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 return TRUE;
+//UNUSED2009-05 }
BOOL ScDocFunc::RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
{
@@ -3558,7 +3577,7 @@ BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
//! auch bei Undo selektierte Tabellen beruecksichtigen
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
// use TokenArray if given, string (and flags) otherwise
@@ -3646,7 +3665,7 @@ BOOL ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
//! auch bei Undo selektierte Tabellen beruecksichtigen
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoTabOp( &rDocShell,
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c62c2dc41fdf..f7d1e2ccae2f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -120,6 +120,7 @@
#include "cfgids.hxx"
#include "warnpassword.hxx"
#include "optsolver.hxx"
+#include "sheetdata.hxx"
#include "tabprotection.hxx"
#include "docsh.hxx"
@@ -755,8 +756,13 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() )
{
}
+ UseSheetSaveEntries(); // use positions from saved file for next saving
}
break;
+ case SFX_EVENT_SAVEASDOCDONE:
+ // new positions are used after "save" and "save as", but not "save to"
+ UseSheetSaveEntries(); // use positions from saved file for next saving
+ break;
default:
{
}
@@ -1850,38 +1856,28 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
-#if ENABLE_SHEET_PROTECTION
- bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_XL);
- if (bNeedRetypePassDlg && !pViewShell->ExecuteRetypePassDlg(PASSHASH_XL))
+ /* #115980# #i104990# If the imported document contains a medium
+ password, determine if we can save it, otherwise ask the users
+ whether they want to save without it. */
+ if( !::sfx2::CheckMSPasswordCapabilityForExport( aFltName ) )
{
- SetError( ERRCODE_ABORT );
- return false;
- }
-#else
-
- do
- {
- SfxItemSet* pSet = rMed.GetItemSet();
- if (!pSet)
- break;
-
- const SfxPoolItem* pItem = NULL;
- if (SFX_ITEM_SET != pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
- // password is not set.
- break;
-
- /* #115980 #If the imported document contained an encrypted password -
- determine if we should save without it. */
- bDoSave = ScWarnPassword::WarningOnPassword( rMed );
-
- if (bDoSave)
+ SfxItemSet* pItemSet = rMed.GetItemSet();
+ const SfxPoolItem* pItem = 0;
+ if( pItemSet && pItemSet->GetItemState( SID_PASSWORD, sal_True, &pItem ) == SFX_ITEM_SET )
{
- // #i42858# warn only one time
- pSet->ClearItem(SID_PASSWORD);
+ bDoSave = ScWarnPassword::WarningOnPassword( rMed );
+ // #i42858# remove password from medium (warn only one time)
+ if( bDoSave )
+ pItemSet->ClearItem( SID_PASSWORD );
}
}
- while (false);
+#if ENABLE_SHEET_PROTECTION
+ if( bDoSave )
+ {
+ bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen( aDocument, PASSHASH_XL );
+ bDoSave = !bNeedRetypePassDlg || pViewShell->ExecuteRetypePassDlg( PASSHASH_XL );
+ }
#endif
}
@@ -2212,6 +2208,7 @@ BOOL ScDocShell::HasAutomaticTableName( const String& rFilter ) // static
pPaintLockData ( NULL ), \
pOldJobSetup ( NULL ), \
pSolverSaveData ( NULL ), \
+ pSheetSaveData ( NULL ), \
pModificator ( NULL )
//------------------------------------------------------------------
@@ -2305,6 +2302,7 @@ __EXPORT ScDocShell::~ScDocShell()
delete pOldJobSetup; // gesetzt nur bei Fehler in StartJob()
delete pSolverSaveData;
+ delete pSheetSaveData;
delete pOldAutoDBRange;
if (pModificator)
@@ -2475,6 +2473,39 @@ void ScDocShell::SetSolverSaveData( const ScOptSolverSave& rData )
pSolverSaveData = new ScOptSolverSave( rData );
}
+ScSheetSaveData* ScDocShell::GetSheetSaveData()
+{
+ if (!pSheetSaveData)
+ pSheetSaveData = new ScSheetSaveData;
+
+ return pSheetSaveData;
+}
+
+void ScDocShell::UseSheetSaveEntries()
+{
+ if (pSheetSaveData)
+ {
+ pSheetSaveData->UseSaveEntries(); // use positions from saved file for next saving
+
+ bool bHasEntries = false;
+ SCTAB nTabCount = aDocument.GetTableCount();
+ SCTAB nTab;
+ for (nTab = 0; nTab < nTabCount; ++nTab)
+ if (pSheetSaveData->HasStreamPos(nTab))
+ bHasEntries = true;
+
+ if (!bHasEntries)
+ {
+ // if no positions were set (for example, export to other format),
+ // reset all "valid" flags
+
+ for (nTab = 0; nTab < nTabCount; ++nTab)
+ if (aDocument.IsStreamValid(nTab))
+ aDocument.SetStreamValid(nTab, FALSE);
+ }
+ }
+}
+
// --- ScDocShellModificator ------------------------------------------
ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index fcbfb648ae14..380f4635cdcf 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -483,6 +483,10 @@ OutputDevice* ScDocShell::GetRefDevice()
USHORT ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags )
{
+ SfxPrinter *pOld = aDocument.GetPrinter( FALSE );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
if (nDiffFlags & SFX_PRINTER_PRINTER)
{
if ( aDocument.GetPrinter() != pNewPrinter )
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index d4df2863eec5..80b0c76a64be 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1300,6 +1300,13 @@ void ScDocShell::DoHardRecalc( BOOL /* bApi */ )
aDocument.BroadcastUno( SfxSimpleHint( SC_HINT_CALCALL ) );
aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ // use hard recalc also to disable stream-copying of all sheets
+ // (somewhat consistent with charts)
+ SCTAB nTabCount = aDocument.GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (aDocument.IsStreamValid(nTab))
+ aDocument.SetStreamValid(nTab, FALSE);
+
PostPaintGridAll();
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 281f03ff3622..b7c726deeb71 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -406,6 +406,7 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
{
BOOL bIsUndoEnabled = aDocument.IsUndoEnabled();
aDocument.EnableUndo( FALSE );
+ aDocument.LockStreamValid( true ); // ignore draw page size (but not formula results)
if ( bBefore ) // check all sheets up to nUpdateTab
{
SCTAB nTabCount = aDocument.GetTableCount();
@@ -437,16 +438,10 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
aDocument.SetPendingRowHeights( nUpdateTab, FALSE );
}
}
+ aDocument.LockStreamValid( false );
aDocument.EnableUndo( bIsUndoEnabled );
}
-#if OLD_PIVOT_IMPLEMENTATION
-void ScDocShell::PivotUpdate( ScPivot*, ScPivot*, BOOL, BOOL )
-{
- DBG_ERRORFILE("PivotUpdate is obsolete!");
-}
-#endif
-
void ScDocShell::RefreshPivotTables( const ScRange& rSource )
{
//! rename to RefreshDataPilotTables?
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 149856b4aa6b..d58777b9b5d5 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -43,13 +43,14 @@
#include <ucbhelper/content.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <comphelper/processfactory.hxx>
-#include <connectivity/dbcharset.hxx>
#include <svx/txenctab.hxx>
+#include <svx/dbcharsethelper.hxx>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbc/XDriverAccess.hpp>
#include <com/sun/star/sdbc/XDriverManager.hpp>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -104,6 +105,61 @@ using namespace com::sun::star;
#define SC_ROWCOUNT_ERROR (-1)
+namespace
+{
+ ULONG lcl_getDBaseConnection(uno::Reference<sdbc::XDriverManager>& _rDrvMgr,uno::Reference<sdbc::XConnection>& _rConnection,String& _rTabName,const String& rFullFileName,rtl_TextEncoding eCharSet)
+ {
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( rFullFileName );
+ _rTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
+ INetURLObject::DECODE_UNAMBIGUOUS );
+ String aExtension = aURL.getExtension();
+ aURL.removeSegment();
+ aURL.removeFinalSlash();
+ String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
+ if (!xFactory.is()) return SCERR_EXPORT_CONNECT;
+
+ _rDrvMgr.set( xFactory->createInstance(
+ rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
+ uno::UNO_QUERY);
+ DBG_ASSERT( _rDrvMgr.is(), "can't get DriverManager" );
+ if (!_rDrvMgr.is()) return SCERR_EXPORT_CONNECT;
+
+ // get connection
+
+ String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
+ aConnUrl += aPath;
+
+ svxform::ODataAccessCharsetHelper aHelper;
+ ::std::vector< rtl_TextEncoding > aEncodings;
+ aHelper.getSupportedTextEncodings( aEncodings );
+ ::std::vector< rtl_TextEncoding >::iterator aIter = ::std::find(aEncodings.begin(),aEncodings.end(),(rtl_TextEncoding) eCharSet);
+ if ( aIter == aEncodings.end() )
+ {
+ DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" );
+ return SCERR_IMPORT_CONNECT;
+ } // if ( aIter == aMap.end() )
+ rtl::OUString aCharSetStr;
+ if ( RTL_TEXTENCODING_DONTKNOW != *aIter )
+ { // it's not the virtual "system charset"
+ const char* pIanaName = rtl_getMimeCharsetFromTextEncoding( *aIter );
+ OSL_ENSURE( pIanaName, "invalid mime name!" );
+ if ( pIanaName )
+ aCharSetStr = ::rtl::OUString::createFromAscii( pIanaName );
+ }
+
+ uno::Sequence<beans::PropertyValue> aProps(2);
+ aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
+ aProps[0].Value <<= rtl::OUString( aExtension );
+ aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
+ aProps[1].Value <<= aCharSetStr;
+
+ _rConnection = _rDrvMgr->getConnectionWithInfo( aConnUrl, aProps );
+ return 0L;
+ }
+}
// -----------------------------------------------------------------------
// MoveFile/KillFile/IsDocument: similar to SfxContentHelper
@@ -201,48 +257,13 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
try
{
- INetURLObject aURL;
- aURL.SetSmartProtocol( INET_PROT_FILE );
- aURL.SetSmartURL( rFullFileName );
- String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
- INetURLObject::DECODE_UNAMBIGUOUS );
- String aExtension = aURL.getExtension();
- aURL.removeSegment();
- aURL.removeFinalSlash();
- String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
- uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
- if (!xFactory.is())
- return ERRCODE_IO_GENERAL;
-
- uno::Reference<sdbc::XDriverManager> xDrvMan( xFactory->createInstance(
- rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
- uno::UNO_QUERY);
- DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" );
- if (!xDrvMan.is()) return SCERR_IMPORT_CONNECT;
-
- String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
- aConnUrl += aPath;
-
- dbtools::OCharsetMap aMap;
- dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet );
- if ( aIter == aMap.end() )
- {
- DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" );
- return SCERR_IMPORT_CONNECT;
- }
- rtl::OUString aCharSetStr = (*aIter).getIanaName();
-
- uno::Sequence<beans::PropertyValue> aProps(2);
- aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
- aProps[0].Value <<= rtl::OUString( aExtension );
- aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
- aProps[1].Value <<= aCharSetStr;
-
- uno::Reference<sdbc::XConnection> xConnection =
- xDrvMan->getConnectionWithInfo( aConnUrl, aProps );
- DBG_ASSERT( xConnection.is(), "can't get Connection" );
- if (!xConnection.is()) return SCERR_IMPORT_CONNECT;
+ String aTabName;
+ uno::Reference<sdbc::XDriverManager> xDrvMan;
+ uno::Reference<sdbc::XConnection> xConnection;
+ ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet);
+ if ( !xConnection.is() || !xDrvMan.is() )
+ return nRet;
+ ::utl::DisposableComponent aConnectionHelper(xConnection);
long nRowCount = 0;
if ( nRowCount < 0 )
@@ -252,10 +273,11 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
}
ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), nRowCount );
-
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance(
rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ),
uno::UNO_QUERY);
+ ::utl::DisposableComponent aRowSetHelper(xRowSet);
uno::Reference<beans::XPropertySet> xRowProp( xRowSet, uno::UNO_QUERY );
DBG_ASSERT( xRowProp.is(), "can't get RowSet" );
if (!xRowProp.is()) return SCERR_IMPORT_CONNECT;
@@ -369,9 +391,6 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
if ( nRowCount )
aProgress.SetStateOnPercent( nRow );
}
-
- comphelper::disposeComponent( xRowSet );
- comphelper::disposeComponent( xConnection );
}
catch ( sdbc::SQLException& )
{
@@ -733,91 +752,29 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO
aColNames.getArray(), aColTypes.getArray(),
aColLengths.getArray(), aColScales.getArray(),
bHasMemo, eCharSet );
-
- INetURLObject aURL;
- aURL.SetSmartProtocol( INET_PROT_FILE );
- aURL.SetSmartURL( rFullFileName );
- String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
- INetURLObject::DECODE_UNAMBIGUOUS );
- String aExtension = aURL.getExtension();
- aURL.removeSegment();
- aURL.removeFinalSlash();
- String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
// also needed for exception catch
SCROW nDocRow = 0;
ScFieldEditEngine aEditEngine( aDocument.GetEditPool() );
String aString;
+ String aTabName;
try
{
- uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
- if (!xFactory.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<sdbc::XDriverManager> xDrvMan( xFactory->createInstance(
- rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
- uno::UNO_QUERY);
- DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" );
- if (!xDrvMan.is()) return SCERR_EXPORT_CONNECT;
-
- // get connection
-
- String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
- aConnUrl += aPath;
-
- dbtools::OCharsetMap aMap;
- dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet );
- if ( aIter == aMap.end() )
- {
- DBG_ERRORFILE( "DBaseExport: dbtools::OCharsetMap doesn't know text encoding" );
- return SCERR_EXPORT_CONNECT;
- }
- rtl::OUString aCharSetStr = (*aIter).getIanaName();
-
- uno::Sequence<beans::PropertyValue> aProps(2);
- aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
- aProps[0].Value <<= rtl::OUString( aExtension );
- aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
- aProps[1].Value <<= aCharSetStr;
-
- uno::Reference<sdbc::XConnection> xConnection =
- xDrvMan->getConnectionWithInfo( aConnUrl, aProps );
- DBG_ASSERT( xConnection.is(), "can't get Connection" );
- if (!xConnection.is()) return SCERR_EXPORT_CONNECT;
+ uno::Reference<sdbc::XDriverManager> xDrvMan;
+ uno::Reference<sdbc::XConnection> xConnection;
+ ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet);
+ if ( !xConnection.is() || !xDrvMan.is() )
+ return nRet;
::utl::DisposableComponent aConnectionHelper(xConnection);
// get dBase driver
-
- uno::Reference<sdbc::XDriver> xDriver;
- BOOL bDriverFound = FALSE;
-
- uno::Reference<container::XEnumerationAccess> xEnAcc( xDrvMan, uno::UNO_QUERY );
- DBG_ASSERT( xEnAcc.is(), "can't get DriverManager EnumerationAccess" );
- if (!xEnAcc.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<container::XEnumeration> xEnum = xEnAcc->createEnumeration();
- DBG_ASSERT( xEnum.is(), "can't get DriverManager Enumeration" );
- if (!xEnum.is()) return SCERR_EXPORT_CONNECT;
-
- while ( xEnum->hasMoreElements() && !bDriverFound )
- {
- uno::Any aElement = xEnum->nextElement();
- if ( aElement >>= xDriver )
- if ( xDriver.is() && xDriver->acceptsURL( aConnUrl ) )
- bDriverFound = TRUE;
- }
-
- DBG_ASSERT( bDriverFound, "can't get dBase driver" );
- if (!bDriverFound) return SCERR_EXPORT_CONNECT;
+ uno::Reference< sdbc::XDriverAccess> xAccess(xDrvMan,uno::UNO_QUERY);
+ uno::Reference< sdbcx::XDataDefinitionSupplier > xDDSup( xAccess->getDriverByURL( xConnection->getMetaData()->getURL() ), uno::UNO_QUERY );
+ if ( !xDDSup.is() )
+ return SCERR_EXPORT_CONNECT;
// create table
-
- uno::Reference<sdbcx::XDataDefinitionSupplier> xDDSup( xDriver, uno::UNO_QUERY );
- DBG_ASSERT( xDDSup.is(), "can't get XDataDefinitionSupplier" );
- if (!xDDSup.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<sdbcx::XTablesSupplier> xTablesSupp =
- xDDSup->getDataDefinitionByConnection( xConnection );
+ uno::Reference<sdbcx::XTablesSupplier> xTablesSupp =xDDSup->getDataDefinitionByConnection( xConnection );
DBG_ASSERT( xTablesSupp.is(), "can't get Data Definition" );
if (!xTablesSupp.is()) return SCERR_EXPORT_CONNECT;
@@ -893,7 +850,7 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO
// if (!xConnection.is()) return SCERR_EXPORT_CONNECT;
// get row set for writing
-
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance(
rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ),
uno::UNO_QUERY);
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 9cc0b274028e..5cfc833be5dd 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -950,9 +950,18 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex)
{
+ // In API, the index is transported as cached sheet ID of type sal_Int32 in
+ // sheet::SingleReference.Sheet or sheet::ComplexReference.Reference1.Sheet
+ // in a sheet::FormulaToken, choose a sensible value for N/A. Effectively
+ // being 0xffffffff
+ const size_t nNotAvailable = static_cast<size_t>( static_cast<sal_Int32>( -1));
+
DocItem* pDoc = getDocItem(nFileId);
if (!pDoc)
+ {
+ if (pnIndex) *pnIndex = nNotAvailable;
return TableTypeRef();
+ }
DocItem& rDoc = *pDoc;
@@ -966,7 +975,10 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF
}
if (!bCreateNew)
+ {
+ if (pnIndex) *pnIndex = nNotAvailable;
return TableTypeRef();
+ }
// Specified table doesn't exist yet. Create one.
nIndex = rDoc.maTables.size();
@@ -1045,7 +1057,7 @@ void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rV
else
{
// The source document has changed.
- pMgr->switchSrcFile(mnFileId, aFile);
+ pMgr->switchSrcFile(mnFileId, aFile, aFilter);
maFilterName = aFilter;
}
}
@@ -1891,24 +1903,17 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
if (!pFileData)
return NULL;
+ // Always load the document by using the path created from the relative
+ // path. If the referenced document is not there, simply exit. The
+ // original file name should be used only when the relative path is not
+ // given.
String aFile = pFileData->maFileName;
- if (!isFileLoadable(aFile))
- {
- // The original file path is not loadable. Try the relative path.
- // Note that the path is relative to the content.xml substream which
- // is one-level higher than the file itself.
+ maybeCreateRealFileName(nFileId);
+ if (pFileData->maRealFileName.Len())
+ aFile = pFileData->maRealFileName;
- if (!pFileData->maRelativeName.Len())
- return NULL;
-
- INetURLObject aBaseURL(getOwnDocumentName());
- aBaseURL.insertName(OUString::createFromAscii("content.xml"));
- bool bWasAbs = false;
- aFile = aBaseURL.smartRel2Abs(pFileData->maRelativeName, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
- if (!isFileLoadable(aFile))
- // Ok, I've tried both paths but no success. Bail out.
- return NULL;
- }
+ if (!isFileLoadable(aFile))
+ return NULL;
String aOptions;
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
@@ -1960,6 +1965,9 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
bool ScExternalRefManager::isFileLoadable(const String& rFile) const
{
+ if (!rFile.Len())
+ return false;
+
if (isOwnDocument(rFile))
return false;
@@ -1994,6 +2002,32 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
maLinkedDocs.insert(LinkedDocMap::value_type(nFileId, true));
}
+void ScExternalRefManager::SrcFileData::maybeCreateRealFileName(const String& rOwnDocName)
+{
+ if (!maRelativeName.Len())
+ // No relative path given. Nothing to do.
+ return;
+
+ if (maRealFileName.Len())
+ // Real file name already created. Nothing to do.
+ return;
+
+ // Formulate the absolute file path from the relative path.
+ const String& rRelPath = maRelativeName;
+ INetURLObject aBaseURL(rOwnDocName);
+ aBaseURL.insertName(OUString::createFromAscii("content.xml"));
+ bool bWasAbs = false;
+ maRealFileName = aBaseURL.smartRel2Abs(rRelPath, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
+}
+
+void ScExternalRefManager::maybeCreateRealFileName(sal_uInt16 nFileId)
+{
+ if (nFileId >= maSrcFiles.size())
+ return;
+
+ maSrcFiles[nFileId].maybeCreateRealFileName(getOwnDocumentName());
+}
+
bool ScExternalRefManager::compileTokensByCell(const ScAddress& rCell)
{
ScBaseCell* pCell;
@@ -2064,12 +2098,20 @@ sal_uInt16 ScExternalRefManager::getExternalFileId(const String& rFile)
return static_cast<sal_uInt16>(maSrcFiles.size() - 1);
}
-const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId) const
+const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal)
{
if (nFileId >= maSrcFiles.size())
return NULL;
- return &maSrcFiles[nFileId].maFileName;
+ if (bForceOriginal)
+ return &maSrcFiles[nFileId].maFileName;
+
+ maybeCreateRealFileName(nFileId);
+
+ if (maSrcFiles[nFileId].maRealFileName.Len())
+ return &maSrcFiles[nFileId].maRealFileName;
+ else
+ return &maSrcFiles[nFileId].maFileName;
}
bool ScExternalRefManager::hasExternalFile(sal_uInt16 nFileId) const
@@ -2138,10 +2180,17 @@ void ScExternalRefManager::breakLink(sal_uInt16 nFileId)
notifyAllLinkListeners(nFileId, LINK_BROKEN);
}
-void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile)
+void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter)
{
maSrcFiles[nFileId].maFileName = rNewFile;
maSrcFiles[nFileId].maRelativeName.Erase();
+ maSrcFiles[nFileId].maRealFileName.Erase();
+ if (!maSrcFiles[nFileId].maFilterName.Equals(rNewFilter))
+ {
+ // Filter type has changed.
+ maSrcFiles[nFileId].maFilterName = rNewFilter;
+ maSrcFiles[nFileId].maFilterOptions.Erase();
+ }
refreshNames(nFileId);
}
@@ -2175,19 +2224,18 @@ bool ScExternalRefManager::hasExternalData() const
return !maSrcFiles.empty();
}
-void ScExternalRefManager::resetSrcFileData()
+void ScExternalRefManager::resetSrcFileData(const String& rBaseFileUrl)
{
- INetURLObject aBaseURL(getOwnDocumentName());
- aBaseURL.insertName(OUString::createFromAscii("content.xml"));
- String aBaseUrlStr = aBaseURL.GetMainURL(INetURLObject::NO_DECODE);
for (vector<SrcFileData>::iterator itr = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
itr != itrEnd; ++itr)
{
- if (!itr->maRelativeName.Len())
- {
- itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
- aBaseUrlStr, itr->maFileName);
- }
+ // Re-generate relative file name from the absolute file name.
+ String aAbsName = itr->maRealFileName;
+ if (!aAbsName.Len())
+ aAbsName = itr->maFileName;
+
+ itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
+ rBaseFileUrl, aAbsName);
}
}
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 67186f84a84a..1561e4c6efeb 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -253,7 +253,7 @@ BOOL ScImportExport::StartPaste()
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
- pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
return TRUE;
}
@@ -270,7 +270,7 @@ void ScImportExport::EndPaste()
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
- pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pRedoDoc );
ScMarkData aDestMark;
aDestMark.SelectOneTable( aRange.aStart.Tab() );
pDocSh->GetUndoManager()->AddUndoAction(
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 9f7c201c8aca..570d41f7885d 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -280,7 +280,7 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
{
String aName;
pDoc->GetName( nTab, aName );
- if ( ScGlobal::pTransliteration->isEqual(
+ if ( ScGlobal::GetpTransliteration()->isEqual(
ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) )
{
pDoc->RenameTab( nTab,