sc/inc/document.hxx | 10 +++++----- sc/inc/global.hxx | 9 ++++----- sc/inc/table.hxx | 20 ++++++++++---------- sc/source/core/data/documen3.cxx | 8 ++++---- sc/source/core/data/table1.cxx | 4 ++-- sc/source/core/tool/interpr1.cxx | 2 +- sc/source/filter/excel/xelink.cxx | 2 +- sc/source/filter/xml/XMLTableSourceContext.cxx | 6 +++--- sc/source/ui/docshell/tablink.cxx | 12 ++++++------ sc/source/ui/inc/undotab.hxx | 2 +- sc/source/ui/undo/undotab.cxx | 8 ++++---- sc/source/ui/unoobj/cellsuno.cxx | 14 +++++++------- sc/source/ui/view/viewfun2.cxx | 2 +- 13 files changed, 49 insertions(+), 50 deletions(-)
New commits: commit bd6f61ad7afcd51f7cb23c14558fdccbda1803a1 Author: Noel Grandin <noelgran...@gmail.com> Date: Sun Sep 20 15:52:48 2015 +0200 convert SC_LINK constants to scoped enum Change-Id: I20470070740fcc39bce85f90ff4e8c14cdd86862 Reviewed-on: https://gerrit.libreoffice.org/18731 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index afa2b7e..2f275a8 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -714,19 +714,19 @@ public: SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const; SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const { return eGrammar;} SC_DLLPUBLIC void SetGrammar( formula::FormulaGrammar::Grammar eGram ); - SC_DLLPUBLIC sal_uInt8 GetLinkMode( SCTAB nTab ) const; - bool IsLinked( SCTAB nTab ) const; + SC_DLLPUBLIC ScLinkMode GetLinkMode( SCTAB nTab ) const; + bool IsLinked( SCTAB nTab ) const; SC_DLLPUBLIC const OUString GetLinkDoc( SCTAB nTab ) const; const OUString GetLinkFlt( SCTAB nTab ) const; const OUString GetLinkOpt( SCTAB nTab ) const; SC_DLLPUBLIC const OUString GetLinkTab( SCTAB nTab ) const; sal_uLong GetLinkRefreshDelay( SCTAB nTab ) const; - void SetLink( SCTAB nTab, sal_uInt8 nMode, const OUString& rDoc, + void SetLink( SCTAB nTab, ScLinkMode nMode, const OUString& rDoc, const OUString& rFilter, const OUString& rOptions, const OUString& rTabName, sal_uLong nRefreshDelay ); bool HasLink( const OUString& rDoc, const OUString& rFilter, const OUString& rOptions ) const; - SC_DLLPUBLIC bool LinkExternalTab( SCTAB& nTab, const OUString& aDocTab, + SC_DLLPUBLIC bool LinkExternalTab( SCTAB& nTab, const OUString& aDocTab, const OUString& aFileName, const OUString& aTabName ); @@ -734,7 +734,7 @@ public: SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const; bool IsInExternalReferenceMarking() const; void MarkUsedExternalReferences(); - bool MarkUsedExternalReferences( ScTokenArray& rArr, const ScAddress& rPos ); + bool MarkUsedExternalReferences( ScTokenArray& rArr, const ScAddress& rPos ); /** Returns the pool containing external formula parsers. Creates the pool on first call. */ diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 51a8d94..a030e38 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -234,11 +234,10 @@ const InsertDeleteFlags IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS); #define SC_LAYER_CONTROLS 3 #define SC_LAYER_HIDDEN 4 - // link tables -#define SC_LINK_NONE 0 -#define SC_LINK_NORMAL 1 -#define SC_LINK_VALUE 2 - +// link tables +enum class ScLinkMode { + NONE, NORMAL, VALUE +}; // input #define SC_ENTER_NORMAL 0 #define SC_ENTER_BLOCK 1 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 8a12532..ed832f1 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -125,15 +125,15 @@ private: OUString aCodeName; OUString aComment; - OUString aLinkDoc; - OUString aLinkFlt; - OUString aLinkOpt; - OUString aLinkTab; - sal_uLong nLinkRefreshDelay; - sal_uInt8 nLinkMode; + OUString aLinkDoc; + OUString aLinkFlt; + OUString aLinkOpt; + OUString aLinkTab; + sal_uLong nLinkRefreshDelay; + ScLinkMode nLinkMode; // page style template - OUString aPageStyle; + OUString aPageStyle; Size aPageSizeTwips; // size of the print-page SCCOL nRepeatStartX; // repeating rows/columns SCCOL nRepeatEndX; // REPEAT_NONE, if not used @@ -282,15 +282,15 @@ public: void SetActiveScenario(bool bSet) { bActiveScenario = bSet; } bool IsActiveScenario() const { return bActiveScenario; } - sal_uInt8 GetLinkMode() const { return nLinkMode; } - bool IsLinked() const { return nLinkMode != SC_LINK_NONE; } + ScLinkMode GetLinkMode() const { return nLinkMode; } + bool IsLinked() const { return nLinkMode != ScLinkMode::NONE; } const OUString& GetLinkDoc() const { return aLinkDoc; } const OUString& GetLinkFlt() const { return aLinkFlt; } const OUString& GetLinkOpt() const { return aLinkOpt; } const OUString& GetLinkTab() const { return aLinkTab; } sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; } - void SetLink( sal_uInt8 nMode, const OUString& rDoc, const OUString& rFlt, + void SetLink( ScLinkMode nMode, const OUString& rDoc, const OUString& rFlt, const OUString& rOpt, const OUString& rTab, sal_uLong nRefreshDelay ); void GetName( OUString& rName ) const; diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 15d407a..df944a3 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -464,11 +464,11 @@ void ScDocument::SetGrammar( formula::FormulaGrammar::Grammar eGram ) eGrammar = eGram; } -sal_uInt8 ScDocument::GetLinkMode( SCTAB nTab ) const +ScLinkMode ScDocument::GetLinkMode( SCTAB nTab ) const { if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab]) return maTabs[nTab]->GetLinkMode(); - return SC_LINK_NONE; + return ScLinkMode::NONE; } const OUString ScDocument::GetLinkDoc( SCTAB nTab ) const @@ -506,7 +506,7 @@ sal_uLong ScDocument::GetLinkRefreshDelay( SCTAB nTab ) const return 0; } -void ScDocument::SetLink( SCTAB nTab, sal_uInt8 nMode, const OUString& rDoc, +void ScDocument::SetLink( SCTAB nTab, ScLinkMode nMode, const OUString& rDoc, const OUString& rFilter, const OUString& rOptions, const OUString& rTabName, sal_uLong nRefreshDelay ) { @@ -564,7 +564,7 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const OUString& aDocTab, sal_uLong nRefreshDelay = 0; bool bWasThere = HasLink( aFileName, aFilterName, aOptions ); - SetLink( rTab, SC_LINK_VALUE, aFileName, aFilterName, aOptions, aTabName, nRefreshDelay ); + SetLink( rTab, ScLinkMode::VALUE, aFileName, aFilterName, aOptions, aTabName, nRefreshDelay ); if ( !bWasThere ) // Add link only once per source document { ScTableLink* pLink = new ScTableLink( pShell, aFileName, aFilterName, aOptions, nRefreshDelay ); diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 9ddf3b5..3ad5b2f 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -230,7 +230,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName, aName( rNewName ), aCodeName( rNewName ), nLinkRefreshDelay( 0 ), - nLinkMode( 0 ), + nLinkMode( ScLinkMode::NONE ), aPageStyle( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ), nRepeatStartX( SCCOL_REPEAT_NONE ), nRepeatEndX( SCCOL_REPEAT_NONE ), @@ -419,7 +419,7 @@ void ScTable::SetScenario( bool bFlag ) bScenario = bFlag; } -void ScTable::SetLink( sal_uInt8 nMode, +void ScTable::SetLink( ScLinkMode nMode, const OUString& rDoc, const OUString& rFlt, const OUString& rOpt, const OUString& rTab, sal_uLong nRefreshDelay ) { diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 8dfd0db8..3a5dd0a 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2165,7 +2165,7 @@ void ScInterpreter::ScCell() OUString aFuncResult; if( nTab < pDok->GetTableCount() ) { - if( pDok->GetLinkMode( nTab ) == SC_LINK_VALUE ) + if( pDok->GetLinkMode( nTab ) == ScLinkMode::VALUE ) pDok->GetName( nTab, aFuncResult ); else { diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index e52a185..bea1098 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -693,7 +693,7 @@ XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) : } // external sheets (skipped, but with valid Excel sheet index for ref's) - else if( rDoc.GetLinkMode( nScTab ) == SC_LINK_VALUE ) + else if( rDoc.GetLinkMode( nScTab ) == ScLinkMode::VALUE ) { SetFlag( nScTab, EXC_TABBUF_EXTERN ); } diff --git a/sc/source/filter/xml/XMLTableSourceContext.cxx b/sc/source/filter/xml/XMLTableSourceContext.cxx index 1051977..ecb6d7b 100644 --- a/sc/source/filter/xml/XMLTableSourceContext.cxx +++ b/sc/source/filter/xml/XMLTableSourceContext.cxx @@ -108,11 +108,11 @@ void ScXMLTableSourceContext::EndElement() if (sFilterName.isEmpty()) ScDocumentLoader::GetFilterName( sLink, sFilterName, sFilterOptions, false, false ); - sal_uInt8 nLinkMode = SC_LINK_NONE; + ScLinkMode nLinkMode = ScLinkMode::NONE; if ( nMode == sheet::SheetLinkMode_NORMAL ) - nLinkMode = SC_LINK_NORMAL; + nLinkMode = ScLinkMode::NORMAL; else if ( nMode == sheet::SheetLinkMode_VALUE ) - nLinkMode = SC_LINK_VALUE; + nLinkMode = ScLinkMode::VALUE; pDoc->SetLink( GetScImport().GetTables().GetCurrentSheet(), nLinkMode, sLink, sFilterName, sFilterOptions, diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index a391691..07d5c7a 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -101,7 +101,7 @@ ScTableLink::~ScTableLink() SCTAB nCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab<nCount; nTab++) if (rDoc.IsLinked(nTab) && aFileName.equals(rDoc.GetLinkDoc(nTab))) - rDoc.SetLink( nTab, SC_LINK_NONE, "", "", "", "", 0 ); + rDoc.SetLink( nTab, ScLinkMode::NONE, "", "", "", "", 0 ); delete pImpl; } @@ -230,8 +230,8 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, SCTAB nCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab<nCount; nTab++) { - sal_uInt8 nMode = rDoc.GetLinkMode(nTab); - if (nMode && aFileName.equals(rDoc.GetLinkDoc(nTab))) + ScLinkMode nMode = rDoc.GetLinkMode(nTab); + if (nMode != ScLinkMode::NONE && aFileName.equals(rDoc.GetLinkDoc(nTab))) { OUString aTabName = rDoc.GetLinkTab(nTab); @@ -254,7 +254,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, // Tabellenname einer ExtDocRef anpassen - if ( bNewUrlName && nMode == SC_LINK_VALUE ) + if ( bNewUrlName && nMode == ScLinkMode::VALUE ) { OUString aName; rDoc.GetName( nTab, aName ); @@ -285,13 +285,13 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, if (bFound) rDoc.TransferTab( &rSrcDoc, nSrcTab, nTab, false, // nicht neu einfuegen - (nMode == SC_LINK_VALUE) ); // nur Werte? + (nMode == ScLinkMode::VALUE) ); // nur Werte? else { rDoc.DeleteAreaTab( 0,0,MAXCOL,MAXROW, nTab, IDF_ALL ); bool bShowError = true; - if ( nMode == SC_LINK_VALUE ) + if ( nMode == ScLinkMode::VALUE ) { // Value link (used with external references in formulas): // Look for formulas that reference the sheet, and put errors in the referenced cells. diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx index e523496..3ffc95d 100644 --- a/sc/source/ui/inc/undotab.hxx +++ b/sc/source/ui/inc/undotab.hxx @@ -311,7 +311,7 @@ private: sal_uLong nRefreshDelay; sal_uInt16 nCount; SCTAB* pTabs; - sal_uInt8* pModes; + ScLinkMode* pModes; OUString* pTabNames; void DoChange( bool bLink ) const; diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 64dd3dd..2b20217 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -1042,13 +1042,13 @@ ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDocName ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTabCount = rDoc.GetTableCount(); pTabs = new SCTAB[nTabCount]; - pModes = new sal_uInt8[nTabCount]; + pModes = new ScLinkMode[nTabCount]; pTabNames = new OUString[nTabCount]; for (SCTAB i=0; i<nTabCount; i++) { - sal_uInt8 nMode = rDoc.GetLinkMode(i); - if (nMode) + ScLinkMode nMode = rDoc.GetLinkMode(i); + if (nMode != ScLinkMode::NONE) if (rDoc.GetLinkDoc(i) == aDocName) { if (!nCount) @@ -1090,7 +1090,7 @@ void ScUndoRemoveLink::DoChange( bool bLink ) const if (bLink) // establish link rDoc.SetLink( pTabs[i], pModes[i], aDocName, aFltName, aOptions, pTabNames[i], nRefreshDelay ); else // remove link - rDoc.SetLink( pTabs[i], SC_LINK_NONE, "", "", "", "", 0 ); + rDoc.SetLink( pTabs[i], ScLinkMode::NONE, "", "", "", "", 0 ); pDocShell->UpdateLinks(); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 527c781..c1ed4da 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -7566,10 +7566,10 @@ sheet::SheetLinkMode SAL_CALL ScTableSheetObj::getLinkMode() throw(uno::RuntimeE ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - sal_uInt8 nMode = pDocSh->GetDocument().GetLinkMode( GetTab_Impl() ); - if ( nMode == SC_LINK_NORMAL ) + ScLinkMode nMode = pDocSh->GetDocument().GetLinkMode( GetTab_Impl() ); + if ( nMode == ScLinkMode::NORMAL ) eRet = sheet::SheetLinkMode_NORMAL; - else if ( nMode == SC_LINK_VALUE ) + else if ( nMode == ScLinkMode::VALUE ) eRet = sheet::SheetLinkMode_VALUE; } return eRet; @@ -7658,11 +7658,11 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee // aren't reset when the filter name is changed in ScTableLink::DataChanged ScDocumentLoader::RemoveAppPrefix( aFilterString ); - sal_uInt8 nLinkMode = SC_LINK_NONE; + ScLinkMode nLinkMode = ScLinkMode::NONE; if ( nMode == sheet::SheetLinkMode_NORMAL ) - nLinkMode = SC_LINK_NORMAL; + nLinkMode = ScLinkMode::NORMAL; else if ( nMode == sheet::SheetLinkMode_VALUE ) - nLinkMode = SC_LINK_VALUE; + nLinkMode = ScLinkMode::VALUE; sal_uLong nRefresh = 0; rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh ); @@ -7674,7 +7674,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee //! Undo fuer Link-Daten an der Table - if ( nLinkMode != SC_LINK_NONE && rDoc.IsExecuteLinkEnabled() ) // Link updaten + if ( nLinkMode != ScLinkMode::NONE && rDoc.IsExecuteLinkEnabled() ) // Link updaten { // Update immer, auch wenn der Link schon da war //! Update nur fuer die betroffene Tabelle??? diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index bc1488f..466eec0 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2462,7 +2462,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, for (i=0; i<nInsCount; i++) { rSrcDoc.GetName( pSrcTabs[i], aTabStr ); - rDoc.SetLink( nTab+i, SC_LINK_NORMAL, + rDoc.SetLink( nTab+i, ScLinkMode::NORMAL, aFileName, aFilterName, aOptions, aTabStr, nRefresh ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits