summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <er@openoffice.org>2001-04-21 19:31:39 +0000
committerEike Rathke <er@openoffice.org>2001-04-21 19:31:39 +0000
commit0dcf4e2883792e3669da696bba3e84fecb195ce9 (patch)
treeb29658459dd24b160a445333d446db780c7a8a97 /sc
parent9de196b8b7e92a761b8dfed2292d8862805661d7 (diff)
linked documents refresh timer and control
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/arealink.hxx15
-rw-r--r--sc/inc/dbcolect.hxx10
-rw-r--r--sc/inc/document.hxx12
-rw-r--r--sc/inc/tablink.hxx16
-rw-r--r--sc/source/core/data/documen2.cxx14
-rw-r--r--sc/source/core/tool/dbcolect.cxx29
-rw-r--r--sc/source/ui/docshell/arealink.cxx22
-rw-r--r--sc/source/ui/docshell/docsh.cxx25
-rw-r--r--sc/source/ui/docshell/docsh5.cxx26
-rw-r--r--sc/source/ui/docshell/tablink.cxx25
-rw-r--r--sc/source/ui/inc/docsh.hxx9
11 files changed, 155 insertions, 48 deletions
diff --git a/sc/inc/arealink.hxx b/sc/inc/arealink.hxx
index f6a73984a691..c73a1fe13df1 100644
--- a/sc/inc/arealink.hxx
+++ b/sc/inc/arealink.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: arealink.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dr $ $Date: 2001-04-05 10:42:48 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:31:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,9 @@
#ifndef SC_SCGLOB_HXX
#include "global.hxx"
#endif
+#ifndef SC_REFRESHTIMER_HXX
+#include "refreshtimer.hxx"
+#endif
#ifndef _LNKBASE_HXX //autogen
#include <so3/lnkbase.hxx>
@@ -73,7 +76,7 @@
class ScDocShell;
class SfxObjectShell;
-class ScAreaLink : public ::so3::SvBaseLink
+class ScAreaLink : public ::so3::SvBaseLink, public ScRefreshTimer
{
private:
ScDocShell* pDocShell; // Container
@@ -82,7 +85,6 @@ private:
String aOptions;
String aSourceArea;
ScRange aDestArea;
- ULONG nRefreshDelay; // refresh delay in seconds; 0 = off
BOOL bAddUndo;
BOOL bInCreate;
BOOL bDoInsert; // wird fuer das erste Update auf FALSE gesetzt
@@ -106,7 +108,6 @@ public:
void SetInCreate(BOOL bSet) { bInCreate = bSet; }
void SetDoInsert(BOOL bSet) { bDoInsert = bSet; }
void SetDestArea(const ScRange& rNew);
- void SetRefreshDelay(ULONG nRefresh) { nRefreshDelay = nRefresh; }
void SetSource(const String& rDoc, const String& rFlt, const String& rOpt,
const String& rArea);
@@ -118,7 +119,9 @@ public:
const String& GetOptions() const { return aOptions; }
const String& GetSource() const { return aSourceArea; }
const ScRange& GetDestArea() const { return aDestArea; }
- ULONG GetRefreshDelay() const { return nRefreshDelay; }
+
+ DECL_LINK( RefreshHdl, ScAreaLink* );
+
};
diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx
index 3c2058b9e30b..f0e45203adf8 100644
--- a/sc/inc/dbcolect.hxx
+++ b/sc/inc/dbcolect.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbcolect.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-03-13 09:51:56 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:31:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,6 +74,9 @@
#include "sortparam.hxx" // MAXSORT
#endif
+#ifndef SC_REFRESHTIMER_HXX
+#include "refreshtimer.hxx"
+#endif
//------------------------------------------------------------------------
@@ -83,7 +86,7 @@ class ScMultipleWriteHeader;
//------------------------------------------------------------------------
-class ScDBData : public DataObject
+class ScDBData : public DataObject, public ScRefreshTimer
{
private:
@@ -236,6 +239,7 @@ public:
void SetExportIndex( USHORT nIdx ) { nExportIndex = nIdx; }
USHORT GetExportIndex() const { return nExportIndex; }
+
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 2754e2c8efa5..28af622b303e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.hxx,v $
*
- * $Revision: 1.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: er $ $Date: 2001-04-18 12:34:53 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:31:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -162,6 +162,7 @@ class ScScriptTypeData;
class ScPoolHelper;
class ScImpExpLogMsg;
struct ScSortParam;
+class ScRefreshTimerControl;
namespace com { namespace sun { namespace star {
namespace lang {
@@ -362,6 +363,7 @@ private:
SfxBroadcaster* pUnoBroadcaster;
ScChangeViewSettings* pChangeViewSettings;
ScScriptTypeData* pScriptTypeData;
+ ScRefreshTimerControl* pRefreshTimerControl;
vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharacters;
com::sun::star::uno::Sequence<sal_Int8> aProtectPass;
@@ -1488,6 +1490,11 @@ public:
void AddToImpExpLog( const ScImpExpLogMsg& rMsg );
void AddToImpExpLog( ScImpExpLogMsg* pMsg );
+ ScRefreshTimerControl* GetRefreshTimerControl() const
+ { return pRefreshTimerControl; }
+ ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const
+ { return &pRefreshTimerControl; }
+
private: // CLOOK-Impl-Methoden
void ImplLoadDocOptions( SvStream& rStream );
void ImplLoadViewOptions( SvStream& rStream );
@@ -1516,6 +1523,7 @@ private: // CLOOK-Impl-Methoden
const ScRange& r, short nDx, short nDy, short nDz );
BOOL HasPartOfMerged( const ScRange& rRange );
+
};
diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
index a9d7d17c7dbc..deb2b7e1737c 100644
--- a/sc/inc/tablink.hxx
+++ b/sc/inc/tablink.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tablink.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: er $ $Date: 2001-04-18 12:34:53 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:31:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,6 +62,10 @@
#ifndef SC_TABLINK_HXX
#define SC_TABLINK_HXX
+#ifndef SC_REFRESHTIMER_HXX
+#include "refreshtimer.hxx"
+#endif
+
#ifndef _LNKBASE_HXX //autogen
#include <so3/lnkbase.hxx>
#endif
@@ -74,14 +78,13 @@ SO2_DECL_REF(SvEmbeddedObject)
class ScDocShell;
class SfxObjectShell;
-class ScTableLink : public ::so3::SvBaseLink
+class ScTableLink : public ::so3::SvBaseLink, public ScRefreshTimer
{
private:
ScDocShell* pDocShell; // Container
String aFileName;
String aFilterName;
String aOptions;
- ULONG nRefreshDelay; // refresh delay in seconds; 0 = off
BOOL bInCreate;
BOOL bAddUndo;
BOOL bDoPaint;
@@ -104,14 +107,15 @@ public:
void SetInCreate(BOOL bSet) { bInCreate = bSet; }
void SetAddUndo(BOOL bSet) { bAddUndo = bSet; }
void SetPaint(BOOL bSet) { bDoPaint = bSet; }
- void SetRefreshDelay(ULONG nRefresh) { nRefreshDelay = nRefresh; }
const String& GetFileName() const { return aFileName; }
const String& GetFilterName() const { return aFilterName; }
const String& GetOptions() const { return aOptions; }
- ULONG GetRefreshDelay() const { return nRefreshDelay; }
BOOL IsUsed() const;
+
+ DECL_LINK( RefreshHdl, ScTableLink* );
+
};
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 1c290160187e..267827cd5a15 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: documen2.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: nn $ $Date: 2001-04-11 14:36:34 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:30:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -383,12 +383,14 @@ ScDocument::ScDocument( ScDocumentMode eMode,
pTab[0] = NULL;
pBASM = new ScBroadcastAreaSlotMachine( this );
pChartListenerCollection = new ScChartListenerCollection( this );
+ pRefreshTimerControl = new ScRefreshTimerControl;
}
else
{
pTab[0] = NULL;
pBASM = NULL;
pChartListenerCollection = NULL;
+ pRefreshTimerControl = NULL;
}
for (USHORT i=1; i<=MAXTAB; i++)
@@ -472,6 +474,14 @@ ScDocument::~ScDocument()
bInDtorClear = TRUE;
+ // first of all disable all refresh timers by deleting the control
+ if ( pRefreshTimerControl )
+ { // To be sure there isn't anything running do it with a protector,
+ // this ensures also that nothing needs the control anymore.
+ ScRefreshTimerProtector aProt( GetRefreshTimerControlAddress() );
+ delete pRefreshTimerControl, pRefreshTimerControl = NULL;
+ }
+
// Links aufrauemen
if ( pLinkManager )
diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx
index 88339f4ad23e..19f461bd75be 100644
--- a/sc/source/core/tool/dbcolect.cxx
+++ b/sc/source/core/tool/dbcolect.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbcolect.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: er $ $Date: 2001-03-14 18:10:21 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:29:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -402,6 +402,7 @@ BOOL ScDBData::Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const
}
ScDBData::ScDBData( const ScDBData& rData ) :
+ ScRefreshTimer ( rData ),
aName (rData.aName),
nTable (rData.nTable),
nStartCol (rData.nStartCol),
@@ -495,6 +496,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
USHORT i;
USHORT j;
+ ScRefreshTimer::operator=( rData );
aName = rData.aName;
nTable = rData.nTable;
nStartCol = rData.nStartCol;
@@ -590,7 +592,9 @@ BOOL ScDBData::operator== (const ScDBData& rData) const
bDoSize != rData.bDoSize ||
bKeepFmt != rData.bKeepFmt ||
bIsAdvanced!= rData.bIsAdvanced||
- bStripData != rData.bStripData )
+ bStripData != rData.bStripData ||
+ ScRefreshTimer::operator!=( rData )
+ )
return FALSE;
if ( bIsAdvanced && aAdvSource != rData.aAdvSource )
@@ -625,6 +629,7 @@ BOOL ScDBData::operator== (const ScDBData& rData) const
ScDBData::~ScDBData()
{
+ StopRefreshTimer();
USHORT i;
for (i=0; i<MAXQUERY; i++)
@@ -1003,6 +1008,7 @@ DataObject* ScDBData::Clone() const
return new ScDBData(*this);
}
+
//---------------------------------------------------------------------------------------
// Compare zum Sortieren
@@ -1217,9 +1223,20 @@ ScDBData* ScDBCollection::FindIndex(USHORT nIndex)
BOOL ScDBCollection::Insert(DataObject* pDataObject)
{
- if (!((ScDBData*)pDataObject)->GetIndex()) // schon gesetzt?
- ((ScDBData*)pDataObject)->SetIndex(nEntryIndex++);
- return SortedCollection::Insert(pDataObject);
+ ScDBData* pData = (ScDBData*) pDataObject;
+ if (!pData->GetIndex()) // schon gesetzt?
+ pData->SetIndex(nEntryIndex++);
+ BOOL bInserted = SortedCollection::Insert(pDataObject);
+ if ( bInserted && pData->HasImportParam() && !pData->HasImportSelection() )
+ {
+//!!!!!!!
+//! TODO: (erAck 21.04.01) we can't access the ScDocShell of ui/inc. Solution?
+//!!!!!!!
+// pData->SetRefreshHandler(
+// LINK( pDoc->GetDocumentShell(), ScDocShell, RefreshDBDataHdl ) );
+ pData->SetRefreshControl( pDoc->GetRefreshTimerControlAddress() );
+ }
+ return bInserted;
}
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index 1c8efdfd2363..4e195665fea3 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: arealink.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: dr $ $Date: 2001-04-05 10:48:47 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:28:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,23 +98,25 @@ ScAreaLink::ScAreaLink( SfxObjectShell* pShell, const String& rFile,
const String& rArea, const ScRange& rDest,
ULONG nRefresh ) :
::so3::SvBaseLink(LINKUPDATE_ONCALL,FORMAT_FILE),
+ ScRefreshTimer ( nRefresh ),
pDocShell ((ScDocShell*)pShell),
aFileName (rFile),
aFilterName (rFilter),
aOptions (rOpt),
aSourceArea (rArea),
aDestArea (rDest),
- nRefreshDelay (nRefresh),
bAddUndo (TRUE),
bInCreate (FALSE),
bDoInsert (TRUE)
{
DBG_ASSERT(pShell->ISA(ScDocShell), "ScAreaLink mit falscher ObjectShell");
+ SetRefreshHandler( LINK( this, ScAreaLink, RefreshHdl ) );
+ SetRefreshControl( pDocShell->GetDocument()->GetRefreshTimerControlAddress() );
}
__EXPORT ScAreaLink::~ScAreaLink()
{
- // Verbindung aufheben
+ StopRefreshTimer();
}
BOOL __EXPORT ScAreaLink::Edit(Window* pParent)
@@ -165,7 +167,7 @@ void __EXPORT ScAreaLink::DataChanged( const String&,
SetName( aLinkName );
}
- Refresh( aFile, aFilter, aArea, nRefreshDelay );
+ Refresh( aFile, aFilter, aArea, GetRefreshDelay() );
}
}
@@ -179,7 +181,7 @@ void __EXPORT ScAreaLink::Closed()
{
pDocShell->GetUndoManager()->AddUndoAction( new ScUndoRemoveAreaLink( pDocShell,
aFileName, aFilterName, aOptions,
- aSourceArea, aDestArea, nRefreshDelay ) );
+ aSourceArea, aDestArea, GetRefreshDelay() ) );
bAddUndo = FALSE; // nur einmal
}
@@ -391,7 +393,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
pDocShell->GetUndoManager()->AddUndoAction(
new ScUndoUpdateAreaLink( pDocShell,
aFileName, aFilterName, aOptions,
- aSourceArea, aOldRange, nRefreshDelay,
+ aSourceArea, aOldRange, GetRefreshDelay(),
aNewUrl, rNewFilter, aNewOpt,
rNewArea, aNewRange, nNewRefresh,
pUndoDoc, pRedoDoc, bDoInsert ) );
@@ -455,4 +457,10 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
}
+IMPL_LINK( ScAreaLink, RefreshHdl, ScAreaLink*, pCaller )
+{
+ long nRes = Refresh( aFileName, aFilterName, aSourceArea,
+ GetRefreshDelay() ) != 0;
+ return nRes;
+}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c1790518af13..92c7719e4f11 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docsh.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: sab $ $Date: 2001-04-05 16:14:18 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:28:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -136,6 +136,7 @@ SO2_DECL_REF(SvStorageStream)
#include "hints.hxx"
#include "xmlwrap.hxx"
#include "drwlayer.hxx"
+#include "refreshtimer.hxx"
#include "docsh.hxx"
@@ -581,6 +582,8 @@ BOOL ScDocShell::SaveXML( SfxMedium* pMedium, SvStorage* pStor )
BOOL __EXPORT ScDocShell::Load( SvStorage* pStor )
{
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
DBG_ASSERT( pStor, "Load without storage?" );
BOOL bXML = ( pStor->GetVersion() >= SOFFICE_FILEFORMAT_60 );
@@ -665,6 +668,8 @@ void __EXPORT ScDocShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType
BOOL __EXPORT ScDocShell::LoadFrom( SvStorage* pStor )
{
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
DBG_ASSERT( pStor, "Nanu... LoadFrom ohne Storage?" );
BOOL bXML = ( pStor->GetVersion() >= SOFFICE_FILEFORMAT_60 );
@@ -728,6 +733,8 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
BOOL bRet = FALSE; // FALSE heisst Benutzerabbruch !!
// bei Fehler: Fehler am Stream setzen!!
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
GetUndoManager()->Clear();
// ob nach dem Import optimale Spaltenbreiten gesetzt werden sollen
@@ -1325,6 +1332,8 @@ void __EXPORT ScDocShell::HandsOff()
BOOL __EXPORT ScDocShell::Save()
{
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
SvStorage* pStor = GetStorage();
DBG_ASSERT( pStor, "Save: no storage" );
BOOL bXML = ( pStor->GetVersion() >= SOFFICE_FILEFORMAT_60 );
@@ -1358,6 +1367,8 @@ BOOL __EXPORT ScDocShell::Save()
BOOL __EXPORT ScDocShell::SaveAs( SvStorage* pStor )
{
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
DBG_ASSERT( pStor, "SaveAs without storage?" );
BOOL bXML = ( pStor->GetVersion() >= SOFFICE_FILEFORMAT_60 );
@@ -1614,6 +1625,8 @@ void ScDocShell::AsciiSave( SvStream& rStream, sal_Unicode cDelim, sal_Unicode c
BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
{
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
DoEnterHandler(); // nicht abgeschlossene Zelle beenden
if (pAutoStyleList)
pAutoStyleList->ExecuteAllNow(); // Vorlagen-Timeouts jetzt ausfuehren
@@ -2279,8 +2292,10 @@ Window* ScDocShell::GetDialogParent()
// --- ScDocShellModificator ------------------------------------------
-ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS ) :
- rDocShell( rDS )
+ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
+ :
+ rDocShell( rDS ),
+ aProtector( rDS.GetDocument()->GetRefreshTimerControlAddress() )
{
ScDocument* pDoc = rDocShell.GetDocument();
bAutoCalcShellDisabled = pDoc->IsAutoCalcShellDisabled();
@@ -2295,7 +2310,7 @@ ScDocShellModificator::~ScDocShellModificator()
ScDocument* pDoc = rDocShell.GetDocument();
pDoc->SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
if ( !bAutoCalcShellDisabled && rDocShell.IsDocumentModifiedPending() )
- rDocShell.SetDocumentModified(); // der letzte macht das Licht aus
+ rDocShell.SetDocumentModified(); // last one shuts off the lights
pDoc->DisableIdle( bIdleDisabled );
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 9b9914b065b1..96af14ebbc61 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docsh5.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: nn $ $Date: 2001-03-16 11:48:02 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:28:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -962,4 +962,26 @@ BOOL ScDocShell::MoveTable( USHORT nSrcTab, USHORT nDestTab, BOOL bCopy, BOOL bR
}
+IMPL_LINK( ScDocShell, RefreshDBDataHdl, ScDBData*, pDBData )
+{
+ ScDBDocFunc aFunc(*this);
+
+ BOOL bContinue = TRUE;
+ ScImportParam aImportParam;
+ pDBData->GetImportParam( aImportParam );
+ if (aImportParam.bImport && !pDBData->HasImportSelection())
+ {
+ ScRange aRange;
+ pDBData->GetArea( aRange );
+ bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, NULL, TRUE, FALSE ); //! Api-Flag as parameter
+ // internal operations (sort, query, subtotal) only if no error
+ if (bContinue)
+ {
+ aFunc.RepeatDB( pDBData->GetName(), TRUE, TRUE );
+ RefreshPivotTables(aRange);
+ }
+ }
+
+ return bContinue != 0;
+}
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 8a0671054017..36c082a38d44 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tablink.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: er $ $Date: 2001-04-18 12:30:51 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:28:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,11 +103,11 @@ ScTableLink::ScTableLink(ScDocShell* pDocSh, const String& rFile,
const String& rFilter, const String& rOpt,
ULONG nRefresh ):
::so3::SvBaseLink(LINKUPDATE_ONCALL,FORMAT_FILE),
+ ScRefreshTimer( nRefresh ),
pDocShell(pDocSh),
aFileName(rFile),
aFilterName(rFilter),
aOptions(rOpt),
- nRefreshDelay(nRefresh),
bInCreate( FALSE ),
bAddUndo( TRUE ),
bDoPaint( TRUE )
@@ -118,21 +118,24 @@ ScTableLink::ScTableLink(SfxObjectShell* pShell, const String& rFile,
const String& rFilter, const String& rOpt,
ULONG nRefresh ):
::so3::SvBaseLink(LINKUPDATE_ONCALL,FORMAT_FILE),
+ ScRefreshTimer( nRefresh ),
pDocShell((ScDocShell*)pShell),
aFileName(rFile),
aFilterName(rFilter),
aOptions(rOpt),
- nRefreshDelay(nRefresh),
bInCreate( FALSE ),
bAddUndo( TRUE ),
bDoPaint( TRUE )
{
+ SetRefreshHandler( LINK( this, ScTableLink, RefreshHdl ) );
+ SetRefreshControl( pDocShell->GetDocument()->GetRefreshTimerControlAddress() );
}
__EXPORT ScTableLink::~ScTableLink()
{
// Verbindung aufheben
+ StopRefreshTimer();
String aEmpty;
ScDocument* pDoc = pDocShell->GetDocument();
USHORT nCount = pDoc->GetTableCount();
@@ -172,7 +175,7 @@ void __EXPORT ScTableLink::DataChanged( const String&,
ScDocumentLoader::RemoveAppPrefix( aFilter );
if (!bInCreate)
- Refresh( aFile, aFilter, NULL, nRefreshDelay ); // don't load twice
+ Refresh( aFile, aFilter, NULL, GetRefreshDelay() ); // don't load twice
}
}
@@ -282,7 +285,7 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
pDoc->CopyToDocument(aRange, IDF_ALL, FALSE, pUndoDoc);
pUndoDoc->TransferDrawPage( pDoc, nTab, nTab );
pUndoDoc->SetLink( nTab, nMode, aFileName, aFilterName,
- aOptions, aTabName, nRefreshDelay );
+ aOptions, aTabName, GetRefreshDelay() );
}
// Tabellenname einer ExtDocRef anpassen
@@ -326,7 +329,7 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
if ( bNewUrlName || rNewFilter != aFilterName ||
aNewOpt != aOptions || pNewOptions ||
- nNewRefresh != nRefreshDelay )
+ nNewRefresh != GetRefreshDelay() )
pDoc->SetLink( nTab, nMode, aNewUrl, rNewFilter, aNewOpt,
aTabName, nNewRefresh );
}
@@ -377,6 +380,14 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
return TRUE;
}
+
+IMPL_LINK( ScTableLink, RefreshHdl, ScTableLink*, pCaller )
+{
+ long nRes = Refresh( aFileName, aFilterName, NULL, GetRefreshDelay() ) != 0;
+ return nRes;
+}
+
+
// === ScDocumentLoader ==================================================
String ScDocumentLoader::GetOptions( SfxMedium& rMedium ) // static
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 6cb4a86942ec..94845f11e9c6 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docsh.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: jp $ $Date: 2001-03-08 20:50:39 $
+ * last change: $Author: er $ $Date: 2001-04-21 20:26:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,7 @@
#include "document.hxx"
#include "shellids.hxx"
+#include "refreshtimer.hxx"
class ScEditEngineDefaulter;
class FontList;
@@ -376,6 +377,9 @@ public:
static ScDocShell* GetShellByNum( USHORT nDocNo );
static String GetOwnFilterName();
static BOOL HasAutomaticTableName( const String& rFilter );
+
+ DECL_LINK( RefreshDBDataHdl, ScDBData* );
+
};
SO2_DECL_REF(ScDocShell)
@@ -392,6 +396,7 @@ SO2_IMPL_REF(ScDocShell)
class ScDocShellModificator
{
ScDocShell& rDocShell;
+ ScRefreshTimerProtector aProtector;
BOOL bAutoCalcShellDisabled;
BOOL bIdleDisabled;