1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SC_EXTERNALREFMGR_HXX 29*cdf0e10cSrcweir #define SC_EXTERNALREFMGR_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "global.hxx" 32*cdf0e10cSrcweir #include "address.hxx" 33*cdf0e10cSrcweir #include "sfx2/objsh.hxx" 34*cdf0e10cSrcweir #include "sfx2/lnkbase.hxx" 35*cdf0e10cSrcweir #include "tools/time.hxx" 36*cdf0e10cSrcweir #include "vcl/timer.hxx" 37*cdf0e10cSrcweir #include "svl/zforlist.hxx" 38*cdf0e10cSrcweir #include "scmatrix.hxx" 39*cdf0e10cSrcweir #include "rangelst.hxx" 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include <hash_map> 42*cdf0e10cSrcweir #include <hash_set> 43*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 44*cdf0e10cSrcweir #include <vector> 45*cdf0e10cSrcweir #include <list> 46*cdf0e10cSrcweir #include <set> 47*cdf0e10cSrcweir #include <formula/ExternalReferenceHelper.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir class ScDocument; 50*cdf0e10cSrcweir namespace formula 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir class FormulaToken; 53*cdf0e10cSrcweir } 54*cdf0e10cSrcweir class ScToken; 55*cdf0e10cSrcweir class ScMatrix; 56*cdf0e10cSrcweir class ScTokenArray; 57*cdf0e10cSrcweir class String; 58*cdf0e10cSrcweir class SfxObjectShellRef; 59*cdf0e10cSrcweir class Window; 60*cdf0e10cSrcweir class ScFormulaCell; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir class ScExternalRefCache; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir class ScExternalRefLink : public ::sfx2::SvBaseLink 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir public: 67*cdf0e10cSrcweir ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId, const String& rFilter); 68*cdf0e10cSrcweir virtual ~ScExternalRefLink(); 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir virtual void Closed(); 71*cdf0e10cSrcweir virtual void DataChanged(const String& rMimeType, const ::com::sun::star::uno::Any & rValue); 72*cdf0e10cSrcweir virtual void Edit(Window* pParent, const Link& rEndEditHdl); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir void SetDoReferesh(bool b); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir private: 77*cdf0e10cSrcweir ScExternalRefLink(); // disabled 78*cdf0e10cSrcweir ScExternalRefLink(const ScExternalRefLink&); // disabled 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir DECL_LINK( ExternalRefEndEditHdl, ::sfx2::SvBaseLink* ); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir sal_uInt16 mnFileId; 83*cdf0e10cSrcweir String maFilterName; 84*cdf0e10cSrcweir ScDocument* mpDoc; 85*cdf0e10cSrcweir bool mbDoRefresh; 86*cdf0e10cSrcweir }; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir // ============================================================================ 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir /** 91*cdf0e10cSrcweir * Cache table for external reference data. 92*cdf0e10cSrcweir */ 93*cdf0e10cSrcweir class ScExternalRefCache 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir public: 96*cdf0e10cSrcweir typedef ::boost::shared_ptr< formula::FormulaToken> TokenRef; 97*cdf0e10cSrcweir typedef ::boost::shared_ptr<ScTokenArray> TokenArrayRef; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir struct TableName 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir String maUpperName; 102*cdf0e10cSrcweir String maRealName; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir explicit TableName(const String& rUppper, const String& rReal); 105*cdf0e10cSrcweir }; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir struct CellFormat 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir bool mbIsSet; 110*cdf0e10cSrcweir short mnType; 111*cdf0e10cSrcweir sal_uInt32 mnIndex; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir explicit CellFormat(); 114*cdf0e10cSrcweir }; 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir private: 117*cdf0e10cSrcweir /** individual cell within cached external ref table. */ 118*cdf0e10cSrcweir struct Cell 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir TokenRef mxToken; 121*cdf0e10cSrcweir sal_uInt32 mnFmtIndex; 122*cdf0e10cSrcweir }; 123*cdf0e10cSrcweir typedef ::std::hash_map<SCCOL, Cell> RowDataType; 124*cdf0e10cSrcweir typedef ::std::hash_map<SCROW, RowDataType> RowsDataType; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir public: 127*cdf0e10cSrcweir // SUNWS needs a forward declared friend, otherwise types and members 128*cdf0e10cSrcweir // of the outer class are not accessible. 129*cdf0e10cSrcweir class Table; 130*cdf0e10cSrcweir friend class ScExternalRefCache::Table; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir /** 133*cdf0e10cSrcweir * Represents a single cached table in an external document. It only 134*cdf0e10cSrcweir * stores non-empty cells; empty cells should never be stored in the data 135*cdf0e10cSrcweir * cache. Instead, cached ranges should be used to determine whether or 136*cdf0e10cSrcweir * not a cell is empty or needs fetching from the source document. If a 137*cdf0e10cSrcweir * cell's value is not stored but its address is within the cached ranges, 138*cdf0e10cSrcweir * that cell is already queried in the source document and we know it's 139*cdf0e10cSrcweir * empty. 140*cdf0e10cSrcweir */ 141*cdf0e10cSrcweir class Table 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir public: 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir enum ReferencedFlag 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir UNREFERENCED, 148*cdf0e10cSrcweir REFERENCED_MARKED, // marked as referenced during store to file 149*cdf0e10cSrcweir REFERENCED_PERMANENT // permanently marked, e.g. from within interpreter 150*cdf0e10cSrcweir }; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir Table(); 153*cdf0e10cSrcweir ~Table(); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir /** 156*cdf0e10cSrcweir * Add cell value to the cache. 157*cdf0e10cSrcweir * 158*cdf0e10cSrcweir * @param bSetCacheRange if true, mark this cell 'cached'. This is 159*cdf0e10cSrcweir * false _only when_ adding a range of cell 160*cdf0e10cSrcweir * values, for performance reasons. 161*cdf0e10cSrcweir */ 162*cdf0e10cSrcweir SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex = 0, bool bSetCacheRange = true); 163*cdf0e10cSrcweir SC_DLLPUBLIC TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = NULL) const; 164*cdf0e10cSrcweir bool hasRow( SCROW nRow ) const; 165*cdf0e10cSrcweir /** Set/clear referenced status flag only if current status is not 166*cdf0e10cSrcweir REFERENCED_PERMANENT. */ 167*cdf0e10cSrcweir void setReferenced( bool bReferenced ); 168*cdf0e10cSrcweir /// Unconditionally set the reference status flag. 169*cdf0e10cSrcweir void setReferencedFlag( ReferencedFlag eFlag ); 170*cdf0e10cSrcweir ReferencedFlag getReferencedFlag() const; 171*cdf0e10cSrcweir bool isReferenced() const; 172*cdf0e10cSrcweir /// Obtain a sorted vector of rows. 173*cdf0e10cSrcweir void getAllRows(::std::vector<SCROW>& rRows, SCROW nLow = 0, SCROW nHigh = MAXROW) const; 174*cdf0e10cSrcweir /// Returns the half-open range of used rows in this table. Returns [0,0) if table is empty. 175*cdf0e10cSrcweir SC_DLLPUBLIC ::std::pair< SCROW, SCROW > getRowRange() const; 176*cdf0e10cSrcweir /// Obtain a sorted vector of columns. 177*cdf0e10cSrcweir void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols, SCCOL nLow = 0, SCCOL nHigh = MAXCOL) const; 178*cdf0e10cSrcweir /// Returns the half-open range of used columns in the specified row. Returns [0,0) if row is empty. 179*cdf0e10cSrcweir SC_DLLPUBLIC ::std::pair< SCCOL, SCCOL > getColRange( SCROW nRow ) const; 180*cdf0e10cSrcweir void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; 181*cdf0e10cSrcweir const ScRangeList& getCachedRanges() const; 182*cdf0e10cSrcweir bool isRangeCached(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir void setCachedCell(SCCOL nCol, SCROW nRow); 185*cdf0e10cSrcweir void setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir /** 188*cdf0e10cSrcweir * Call this to mark the entire table "cached". This will prevent all 189*cdf0e10cSrcweir * future attempts to access the source document even when non-cached 190*cdf0e10cSrcweir * cells are queried. In such case, non-cached cells are treated as 191*cdf0e10cSrcweir * empty cells. Useful when loading a document with own external data 192*cdf0e10cSrcweir * cache. 193*cdf0e10cSrcweir */ 194*cdf0e10cSrcweir SC_DLLPUBLIC void setWholeTableCached(); 195*cdf0e10cSrcweir private: 196*cdf0e10cSrcweir bool isInCachedRanges(SCCOL nCol, SCROW nRow) const; 197*cdf0e10cSrcweir TokenRef getEmptyOrNullToken(SCCOL nCol, SCROW nRow) const; 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir private: 200*cdf0e10cSrcweir /** Data cache */ 201*cdf0e10cSrcweir RowsDataType maRows; 202*cdf0e10cSrcweir /** Collection of individual cached ranges. The table ranges are 203*cdf0e10cSrcweir * not used & always zero. */ 204*cdf0e10cSrcweir ScRangeList maCachedRanges; 205*cdf0e10cSrcweir ReferencedFlag meReferenced; 206*cdf0e10cSrcweir }; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir typedef ::boost::shared_ptr<Table> TableTypeRef; 209*cdf0e10cSrcweir typedef ::std::hash_map<String, size_t, ScStringHashCode> TableNameIndexMap; 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir ScExternalRefCache(); 212*cdf0e10cSrcweir ~ScExternalRefCache(); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir const String* getRealTableName(sal_uInt16 nFileId, const String& rTabName) const; 215*cdf0e10cSrcweir const String* getRealRangeName(sal_uInt16 nFileId, const String& rRangeName) const; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir /** 218*cdf0e10cSrcweir * Get a cached cell data at specified cell location. 219*cdf0e10cSrcweir * 220*cdf0e10cSrcweir * @param nFileId file ID of an external document 221*cdf0e10cSrcweir * @param rTabName sheet name 222*cdf0e10cSrcweir * @param nCol 223*cdf0e10cSrcweir * @param nRow 224*cdf0e10cSrcweir * 225*cdf0e10cSrcweir * @return pointer to the token instance in the cache. 226*cdf0e10cSrcweir */ 227*cdf0e10cSrcweir ScExternalRefCache::TokenRef getCellData( 228*cdf0e10cSrcweir sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir /** 231*cdf0e10cSrcweir * Get a cached cell range data. 232*cdf0e10cSrcweir * 233*cdf0e10cSrcweir * @return a new token array instance. Note that <i>the caller must 234*cdf0e10cSrcweir * manage the life cycle of the returned instance</i>, which is 235*cdf0e10cSrcweir * guaranteed if the TokenArrayRef is properly used.. 236*cdf0e10cSrcweir */ 237*cdf0e10cSrcweir ScExternalRefCache::TokenArrayRef getCellRangeData( 238*cdf0e10cSrcweir sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir ScExternalRefCache::TokenArrayRef getRangeNameTokens(sal_uInt16 nFileId, const String& rName); 241*cdf0e10cSrcweir void setRangeNameTokens(sal_uInt16 nFileId, const String& rName, TokenArrayRef pArray); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir void setCellData(sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir struct SingleRangeData 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir /** This name must be in upper-case. */ 248*cdf0e10cSrcweir String maTableName; 249*cdf0e10cSrcweir ScMatrixRef mpRangeData; 250*cdf0e10cSrcweir }; 251*cdf0e10cSrcweir void setCellRangeData(sal_uInt16 nFileId, const ScRange& rRange, const ::std::vector<SingleRangeData>& rData, 252*cdf0e10cSrcweir TokenArrayRef pArray); 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir bool isDocInitialized(sal_uInt16 nFileId); 255*cdf0e10cSrcweir void initializeDoc(sal_uInt16 nFileId, const ::std::vector<String>& rTabNames); 256*cdf0e10cSrcweir String getTableName(sal_uInt16 nFileId, size_t nCacheId) const; 257*cdf0e10cSrcweir void getAllTableNames(sal_uInt16 nFileId, ::std::vector<String>& rTabNames) const; 258*cdf0e10cSrcweir SCsTAB getTabSpan( sal_uInt16 nFileId, const String& rStartTabName, const String& rEndTabName ) const; 259*cdf0e10cSrcweir void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir /** 262*cdf0e10cSrcweir * Set all tables of a document as referenced, used only during 263*cdf0e10cSrcweir * store-to-file. 264*cdf0e10cSrcweir * @returns <TRUE/> if ALL tables of ALL documents are marked. 265*cdf0e10cSrcweir */ 266*cdf0e10cSrcweir bool setCacheDocReferenced( sal_uInt16 nFileId ); 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir /** 269*cdf0e10cSrcweir * Set a table as referenced, used only during store-to-file. 270*cdf0e10cSrcweir * @returns <TRUE/> if ALL tables of ALL documents are marked. 271*cdf0e10cSrcweir */ 272*cdf0e10cSrcweir bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets, bool bPermanent ); 273*cdf0e10cSrcweir void setAllCacheTableReferencedStati( bool bReferenced ); 274*cdf0e10cSrcweir bool areAllCacheTablesReferenced() const; 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir /** 277*cdf0e10cSrcweir * Set a table as permanently referenced, to be called if not in 278*cdf0e10cSrcweir * mark-during-store-to-file cycle. 279*cdf0e10cSrcweir */ 280*cdf0e10cSrcweir void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets ); 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir private: 283*cdf0e10cSrcweir struct ReferencedStatus 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir struct DocReferenced 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir ::std::vector<bool> maTables; 288*cdf0e10cSrcweir bool mbAllTablesReferenced; 289*cdf0e10cSrcweir // Initially, documents have no tables but all referenced. 290*cdf0e10cSrcweir DocReferenced() : mbAllTablesReferenced(true) {} 291*cdf0e10cSrcweir }; 292*cdf0e10cSrcweir typedef ::std::vector<DocReferenced> DocReferencedVec; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir DocReferencedVec maDocs; 295*cdf0e10cSrcweir bool mbAllReferenced; 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir ReferencedStatus(); 298*cdf0e10cSrcweir explicit ReferencedStatus( size_t nDocs ); 299*cdf0e10cSrcweir void reset( size_t nDocs ); 300*cdf0e10cSrcweir void checkAllDocs(); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir } maReferenced; 303*cdf0e10cSrcweir void addCacheTableToReferenced( sal_uInt16 nFileId, size_t nIndex ); 304*cdf0e10cSrcweir void addCacheDocToReferenced( sal_uInt16 nFileId ); 305*cdf0e10cSrcweir public: 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const; 308*cdf0e10cSrcweir ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir void clearCache(sal_uInt16 nFileId); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir private: 313*cdf0e10cSrcweir struct RangeHash 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir size_t operator()(const ScRange& rRange) const 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir const ScAddress& s = rRange.aStart; 318*cdf0e10cSrcweir const ScAddress& e = rRange.aEnd; 319*cdf0e10cSrcweir return s.Tab() + s.Col() + s.Row() + e.Tab() + e.Col() + e.Row(); 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir }; 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir typedef ::std::hash_map<String, TokenArrayRef, ScStringHashCode> RangeNameMap; 324*cdf0e10cSrcweir typedef ::std::hash_map<ScRange, TokenArrayRef, RangeHash> RangeArrayMap; 325*cdf0e10cSrcweir typedef ::std::hash_map<String, String, ScStringHashCode> NamePairMap; 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir // SUNWS needs a forward declared friend, otherwise types and members 328*cdf0e10cSrcweir // of the outer class are not accessible. 329*cdf0e10cSrcweir struct DocItem; 330*cdf0e10cSrcweir friend struct ScExternalRefCache::DocItem; 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir /** Represents data cached for a single external document. */ 333*cdf0e10cSrcweir struct DocItem 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir /** The raw cache tables. */ 336*cdf0e10cSrcweir ::std::vector<TableTypeRef> maTables; 337*cdf0e10cSrcweir /** Table name list in correct order, in both upper- and real-case. */ 338*cdf0e10cSrcweir ::std::vector<TableName> maTableNames; 339*cdf0e10cSrcweir /** Table name to index map. The names must be stored upper-case. */ 340*cdf0e10cSrcweir TableNameIndexMap maTableNameIndex; 341*cdf0e10cSrcweir /** Range name cache. */ 342*cdf0e10cSrcweir RangeNameMap maRangeNames; 343*cdf0e10cSrcweir /** Token array cache for cell ranges. */ 344*cdf0e10cSrcweir RangeArrayMap maRangeArrays; 345*cdf0e10cSrcweir /** Upper- to real-case mapping for range names. */ 346*cdf0e10cSrcweir NamePairMap maRealRangeNameMap; 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir bool mbInitFromSource; 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir DocItem() : mbInitFromSource(false) {} 351*cdf0e10cSrcweir }; 352*cdf0e10cSrcweir typedef ::std::hash_map<sal_uInt16, DocItem> DocDataType; 353*cdf0e10cSrcweir DocItem* getDocItem(sal_uInt16 nFileId) const; 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir private: 356*cdf0e10cSrcweir mutable DocDataType maDocs; 357*cdf0e10cSrcweir }; 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir // ============================================================================ 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir class SC_DLLPUBLIC ScExternalRefManager : public formula::ExternalReferenceHelper 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir public: 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir typedef ::std::set<ScFormulaCell*> RefCellSet; 366*cdf0e10cSrcweir typedef ::std::hash_map<sal_uInt16, RefCellSet> RefCellMap; 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir enum LinkUpdateType { LINK_MODIFIED, LINK_BROKEN }; 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir /** 371*cdf0e10cSrcweir * Base class for objects that need to listen to link updates. When a 372*cdf0e10cSrcweir * link to a certain external file is updated, the notify() method gets 373*cdf0e10cSrcweir * called. 374*cdf0e10cSrcweir */ 375*cdf0e10cSrcweir class LinkListener 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir public: 378*cdf0e10cSrcweir LinkListener(); 379*cdf0e10cSrcweir virtual ~LinkListener() = 0; 380*cdf0e10cSrcweir virtual void notify(sal_uInt16 nFileId, LinkUpdateType eType) = 0; 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir struct Hash 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir size_t operator() (const LinkListener* p) const 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir return reinterpret_cast<size_t>(p); 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir }; 389*cdf0e10cSrcweir }; 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir /** 392*cdf0e10cSrcweir * Use this guard when performing something from the API that might query 393*cdf0e10cSrcweir * values from external references. Interpreting formula strings is one 394*cdf0e10cSrcweir * such example. 395*cdf0e10cSrcweir */ 396*cdf0e10cSrcweir class ApiGuard 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir public: 399*cdf0e10cSrcweir ApiGuard(ScDocument* pDoc); 400*cdf0e10cSrcweir ~ApiGuard(); 401*cdf0e10cSrcweir private: 402*cdf0e10cSrcweir ScExternalRefManager* mpMgr; 403*cdf0e10cSrcweir bool mbOldInteractionEnabled; 404*cdf0e10cSrcweir }; 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir private: 407*cdf0e10cSrcweir /** Shell instance for a source document. */ 408*cdf0e10cSrcweir struct SrcShell 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir SfxObjectShellRef maShell; 411*cdf0e10cSrcweir Time maLastAccess; 412*cdf0e10cSrcweir }; 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir typedef ::std::hash_map<sal_uInt16, SrcShell> DocShellMap; 415*cdf0e10cSrcweir typedef ::std::hash_map<sal_uInt16, bool> LinkedDocMap; 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir typedef ::std::hash_map<sal_uInt16, SvNumberFormatterMergeMap> NumFmtMap; 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir typedef ::std::hash_set<LinkListener*, LinkListener::Hash> LinkListeners; 421*cdf0e10cSrcweir typedef ::std::hash_map<sal_uInt16, LinkListeners> LinkListenerMap; 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir public: 424*cdf0e10cSrcweir /** Source document meta-data container. */ 425*cdf0e10cSrcweir struct SrcFileData 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir String maFileName; /// original file name as loaded from the file. 428*cdf0e10cSrcweir String maRealFileName; /// file name created from the relative name. 429*cdf0e10cSrcweir String maRelativeName; 430*cdf0e10cSrcweir String maFilterName; 431*cdf0e10cSrcweir String maFilterOptions; 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir void maybeCreateRealFileName(const String& rOwnDocName); 434*cdf0e10cSrcweir }; 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir public: 437*cdf0e10cSrcweir explicit ScExternalRefManager(ScDocument* pDoc); 438*cdf0e10cSrcweir virtual ~ScExternalRefManager(); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir virtual String getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const; 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir /** 443*cdf0e10cSrcweir * Get a cache table instance for specified table and table index. Unlike 444*cdf0e10cSrcweir * the other method that takes a table name, this method does not create a 445*cdf0e10cSrcweir * new table when a table is not available for specified index. 446*cdf0e10cSrcweir * 447*cdf0e10cSrcweir * @param nFileId file ID 448*cdf0e10cSrcweir * @param nTabIndex cache table index 449*cdf0e10cSrcweir * 450*cdf0e10cSrcweir * @return shared_ptr to the cache table instance 451*cdf0e10cSrcweir */ 452*cdf0e10cSrcweir ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const; 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir /** 455*cdf0e10cSrcweir * Get a cache table instance for specified file and table name. If the 456*cdf0e10cSrcweir * table instance is not already present, it'll instantiate a new one and 457*cdf0e10cSrcweir * append it to the end of the table array. <I>It's important to be 458*cdf0e10cSrcweir * aware of this fact especially for multi-table ranges for which 459*cdf0e10cSrcweir * table orders are critical.</I> 460*cdf0e10cSrcweir * 461*cdf0e10cSrcweir * Excel filter calls this method to populate the cache table from the 462*cdf0e10cSrcweir * XCT/CRN records. 463*cdf0e10cSrcweir * 464*cdf0e10cSrcweir * @param nFileId file ID 465*cdf0e10cSrcweir * @param rTabName table name 466*cdf0e10cSrcweir * @param bCreateNew if true, create a new table instance if it's not 467*cdf0e10cSrcweir * already present. If false, it returns NULL if the 468*cdf0e10cSrcweir * specified table's cache doesn't exist. 469*cdf0e10cSrcweir * @param pnIndex if non-NULL pointer is passed, it stores the internal 470*cdf0e10cSrcweir * index of a cache table instance. 471*cdf0e10cSrcweir * 472*cdf0e10cSrcweir * @return shared_ptr to the cache table instance 473*cdf0e10cSrcweir */ 474*cdf0e10cSrcweir ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex = 0); 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir /** Returns a vector containing all (real) table names and cache tables of 477*cdf0e10cSrcweir the specified file. 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir The index in the returned vector corresponds to the table index used to 480*cdf0e10cSrcweir access the cache table, e.g. in getCacheTable(). 481*cdf0e10cSrcweir */ 482*cdf0e10cSrcweir void getAllCachedTableNames(sal_uInt16 nFileId, ::std::vector<String>& rTabNames) const; 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir /** 485*cdf0e10cSrcweir * Get the span (distance+sign(distance)) of two sheets of a specified 486*cdf0e10cSrcweir * file. 487*cdf0e10cSrcweir * 488*cdf0e10cSrcweir * @param nFileId file ID 489*cdf0e10cSrcweir * @param rStartTabName name of first sheet (sheet1) 490*cdf0e10cSrcweir * @param rEndTabName name of second sheet (sheet2) 491*cdf0e10cSrcweir * 492*cdf0e10cSrcweir * @return span 493*cdf0e10cSrcweir * 1 if sheet2 == sheet1 494*cdf0e10cSrcweir * > 1 if sheet2 > sheet1 495*cdf0e10cSrcweir * < -1 if sheet2 < sheet1 496*cdf0e10cSrcweir * -1 if nFileId or rStartTabName not found 497*cdf0e10cSrcweir * 0 if rEndTabName not found 498*cdf0e10cSrcweir */ 499*cdf0e10cSrcweir SCsTAB getCachedTabSpan( sal_uInt16 nFileId, const String& rStartTabName, const String& rEndTabName ) const; 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir /** 502*cdf0e10cSrcweir * Get all unique number format indices that are used in the cache tables. 503*cdf0e10cSrcweir * The retrieved indices are sorted in ascending order. 504*cdf0e10cSrcweir * 505*cdf0e10cSrcweir * @param rNumFmts (reference) all unique number format indices. 506*cdf0e10cSrcweir */ 507*cdf0e10cSrcweir void getAllCachedNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir sal_uInt16 getExternalFileCount() const; 510*cdf0e10cSrcweir 511*cdf0e10cSrcweir /** 512*cdf0e10cSrcweir * Mark all tables as referenced that are used by any LinkListener, used 513*cdf0e10cSrcweir * only during store-to-file. 514*cdf0e10cSrcweir * @returns <TRUE/> if ALL tables of ALL external documents are marked. 515*cdf0e10cSrcweir */ 516*cdf0e10cSrcweir bool markUsedByLinkListeners(); 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir bool markUsedExternalRefCells(); 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir /** 521*cdf0e10cSrcweir * Set a table as referenced, used only during store-to-file. 522*cdf0e10cSrcweir * @returns <TRUE/> if ALL tables of ALL external documents are marked. 523*cdf0e10cSrcweir */ 524*cdf0e10cSrcweir bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets ); 525*cdf0e10cSrcweir void setAllCacheTableReferencedStati( bool bReferenced ); 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir /** 528*cdf0e10cSrcweir * Set a table as permanently referenced, to be called if not in 529*cdf0e10cSrcweir * mark-during-store-to-file cycle. 530*cdf0e10cSrcweir */ 531*cdf0e10cSrcweir void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets ); 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir /** 534*cdf0e10cSrcweir * @returns <TRUE/> if setAllCacheTableReferencedStati(false) was called, 535*cdf0e10cSrcweir * <FALSE/> if setAllCacheTableReferencedStati(true) was called. 536*cdf0e10cSrcweir */ 537*cdf0e10cSrcweir bool isInReferenceMarking() const { return mbInReferenceMarking; } 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir void storeRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScTokenArray& rArray); 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir ScExternalRefCache::TokenRef getSingleRefToken( 542*cdf0e10cSrcweir sal_uInt16 nFileId, const String& rTabName, const ScAddress& rCell, 543*cdf0e10cSrcweir const ScAddress* pCurPos, SCTAB* pTab, ScExternalRefCache::CellFormat* pFmt = NULL); 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir /** 546*cdf0e10cSrcweir * Get an array of tokens that consist of the specified external cell 547*cdf0e10cSrcweir * range. 548*cdf0e10cSrcweir * 549*cdf0e10cSrcweir * @param nFileId file ID for an external document 550*cdf0e10cSrcweir * @param rTabName referenced sheet name 551*cdf0e10cSrcweir * @param rRange referenced cell range 552*cdf0e10cSrcweir * @param pCurPos current cursor position to keep track of cells that 553*cdf0e10cSrcweir * reference an external data. 554*cdf0e10cSrcweir * 555*cdf0e10cSrcweir * @return shared_ptr to a token array instance. <i>The caller must not 556*cdf0e10cSrcweir * delete the instance returned by this method.</i> 557*cdf0e10cSrcweir */ 558*cdf0e10cSrcweir ScExternalRefCache::TokenArrayRef getDoubleRefTokens( 559*cdf0e10cSrcweir sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos); 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir /** 562*cdf0e10cSrcweir * Get an array of tokens corresponding with a specified name in a 563*cdf0e10cSrcweir * specified file. 564*cdf0e10cSrcweir * 565*cdf0e10cSrcweir * @param pCurPos currnet cell address where this name token is used. 566*cdf0e10cSrcweir * This is purely to keep track of all cells containing 567*cdf0e10cSrcweir * external names for refreshing purposes. If this is 568*cdf0e10cSrcweir * NULL, then the cell will not be added to the list. 569*cdf0e10cSrcweir * 570*cdf0e10cSrcweir * @return shared_ptr to array of tokens composing the name 571*cdf0e10cSrcweir */ 572*cdf0e10cSrcweir ScExternalRefCache::TokenArrayRef getRangeNameTokens( 573*cdf0e10cSrcweir sal_uInt16 nFileId, const String& rName, const ScAddress* pCurPos = NULL); 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir const String& getOwnDocumentName() const; 576*cdf0e10cSrcweir bool isOwnDocument(const String& rFile) const; 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir /** 579*cdf0e10cSrcweir * Takes a flat file name, and convert it to an absolute URL path. An 580*cdf0e10cSrcweir * absolute URL path begines with 'file:///. 581*cdf0e10cSrcweir * 582*cdf0e10cSrcweir * @param rFile file name to convert 583*cdf0e10cSrcweir */ 584*cdf0e10cSrcweir void convertToAbsName(String& rFile) const; 585*cdf0e10cSrcweir sal_uInt16 getExternalFileId(const String& rFile); 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir /** 588*cdf0e10cSrcweir * It returns a pointer to the name of the URI associated with a given 589*cdf0e10cSrcweir * external file ID. In case the original document has moved, it returns 590*cdf0e10cSrcweir * an URI adjusted for the relocation. 591*cdf0e10cSrcweir * 592*cdf0e10cSrcweir * @param nFileId file ID for an external document 593*cdf0e10cSrcweir * @param bForceOriginal If true, it always returns the original document 594*cdf0e10cSrcweir * URI even if the referring document has relocated. 595*cdf0e10cSrcweir * If false, it returns an URI adjusted for 596*cdf0e10cSrcweir * relocated document. 597*cdf0e10cSrcweir * 598*cdf0e10cSrcweir * @return const String* external document URI. 599*cdf0e10cSrcweir */ 600*cdf0e10cSrcweir const String* getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal = false); 601*cdf0e10cSrcweir bool hasExternalFile(sal_uInt16 nFileId) const; 602*cdf0e10cSrcweir bool hasExternalFile(const String& rFile) const; 603*cdf0e10cSrcweir const SrcFileData* getExternalFileData(sal_uInt16 nFileId) const; 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir const String* getRealTableName(sal_uInt16 nFileId, const String& rTabName) const; 606*cdf0e10cSrcweir const String* getRealRangeName(sal_uInt16 nFileId, const String& rRangeName) const; 607*cdf0e10cSrcweir void refreshNames(sal_uInt16 nFileId); 608*cdf0e10cSrcweir void breakLink(sal_uInt16 nFileId); 609*cdf0e10cSrcweir void switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter); 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir /** 612*cdf0e10cSrcweir * Set a relative file path for the specified file ID. Note that the 613*cdf0e10cSrcweir * caller must ensure that the passed URL is a valid relative URL. 614*cdf0e10cSrcweir * 615*cdf0e10cSrcweir * @param nFileId file ID for an external document 616*cdf0e10cSrcweir * @param rRelUrl relative URL 617*cdf0e10cSrcweir */ 618*cdf0e10cSrcweir void setRelativeFileName(sal_uInt16 nFileId, const String& rRelUrl); 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir /** 621*cdf0e10cSrcweir * Set the filter name and options if any for a given source document. 622*cdf0e10cSrcweir * These values get reset when the source document ever gets reloaded. 623*cdf0e10cSrcweir * 624*cdf0e10cSrcweir * @param nFileId 625*cdf0e10cSrcweir * @param rFilterName 626*cdf0e10cSrcweir * @param rOptions 627*cdf0e10cSrcweir */ 628*cdf0e10cSrcweir void setFilterData(sal_uInt16 nFileId, const String& rFilterName, const String& rOptions); 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir void clear(); 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir bool hasExternalData() const; 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir /** 635*cdf0e10cSrcweir * Re-generates relative names for all stored source files. This is 636*cdf0e10cSrcweir * necessary when exporting to an ods document, to ensure that all source 637*cdf0e10cSrcweir * files have their respective relative names for xlink:href export. 638*cdf0e10cSrcweir * 639*cdf0e10cSrcweir * @param rBaseFileUrl Absolute URL of the content.xml fragment of the 640*cdf0e10cSrcweir * document being exported. 641*cdf0e10cSrcweir */ 642*cdf0e10cSrcweir void resetSrcFileData(const String& rBaseFileUrl); 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir /** 645*cdf0e10cSrcweir * Replace the original URL wirh the real URL that was generated from the relative URL. 646*cdf0e10cSrcweir */ 647*cdf0e10cSrcweir void updateAbsAfterLoad(); 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir /** 650*cdf0e10cSrcweir * Stop tracking a specific formula cell. 651*cdf0e10cSrcweir * 652*cdf0e10cSrcweir * @param pCell pointer to cell that formerly contained external 653*cdf0e10cSrcweir * reference. 654*cdf0e10cSrcweir */ 655*cdf0e10cSrcweir void removeRefCell(ScFormulaCell* pCell); 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir /** 658*cdf0e10cSrcweir * Register a new link listener to a specified external document. Note 659*cdf0e10cSrcweir * that the caller is responsible for managing the life cycle of the 660*cdf0e10cSrcweir * listener object. 661*cdf0e10cSrcweir */ 662*cdf0e10cSrcweir void addLinkListener(sal_uInt16 nFileId, LinkListener* pListener); 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir /** 665*cdf0e10cSrcweir * Remove an existing link listener. Note that removing a listener 666*cdf0e10cSrcweir * pointer here does not delete the listener object instance. 667*cdf0e10cSrcweir */ 668*cdf0e10cSrcweir void removeLinkListener(sal_uInt16 nFileId, LinkListener* pListener); 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir void removeLinkListener(LinkListener* pListener); 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir /** 673*cdf0e10cSrcweir * Notify all listeners that are listening to a specified external 674*cdf0e10cSrcweir * document. 675*cdf0e10cSrcweir * 676*cdf0e10cSrcweir * @param nFileId file ID for an external document. 677*cdf0e10cSrcweir */ 678*cdf0e10cSrcweir void notifyAllLinkListeners(sal_uInt16 nFileId, LinkUpdateType eType); 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir private: 681*cdf0e10cSrcweir ScExternalRefManager(); 682*cdf0e10cSrcweir ScExternalRefManager(const ScExternalRefManager&); 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir void refreshAllRefCells(sal_uInt16 nFileId); 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir void insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell); 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir ScDocument* getSrcDocument(sal_uInt16 nFileId); 689*cdf0e10cSrcweir SfxObjectShellRef loadSrcDocument(sal_uInt16 nFileId, String& rFilter); 690*cdf0e10cSrcweir bool isFileLoadable(const String& rFile) const; 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir void maybeLinkExternalFile(sal_uInt16 nFileId); 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir /** 695*cdf0e10cSrcweir * Try to create a "real" file name from the relative path. The original 696*cdf0e10cSrcweir * file name may not point to the real document when the referencing and 697*cdf0e10cSrcweir * referenced documents have been moved. 698*cdf0e10cSrcweir * 699*cdf0e10cSrcweir * For the real file name to be created, the relative name should not be 700*cdf0e10cSrcweir * empty before calling this method, or the real file name will not be 701*cdf0e10cSrcweir * created. 702*cdf0e10cSrcweir * 703*cdf0e10cSrcweir * @param nFileId file ID for an external document 704*cdf0e10cSrcweir */ 705*cdf0e10cSrcweir void maybeCreateRealFileName(sal_uInt16 nFileId); 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir /** 708*cdf0e10cSrcweir * Purge those source document instances that have not been accessed for 709*cdf0e10cSrcweir * the specified duration. 710*cdf0e10cSrcweir * 711*cdf0e10cSrcweir * @param nTimeOut time out value in 100th of a second 712*cdf0e10cSrcweir */ 713*cdf0e10cSrcweir void purgeStaleSrcDocument(sal_Int32 nTimeOut); 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir sal_uInt32 getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, ScDocument* pSrcDoc); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir private: 718*cdf0e10cSrcweir /** cache of referenced ranges and names from source documents. */ 719*cdf0e10cSrcweir ScExternalRefCache maRefCache; 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir ScDocument* mpDoc; 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir /** 724*cdf0e10cSrcweir * Source document cache. This stores the original source document shell 725*cdf0e10cSrcweir * instances. They get purged after a certain period of time. 726*cdf0e10cSrcweir */ 727*cdf0e10cSrcweir DocShellMap maDocShells; 728*cdf0e10cSrcweir 729*cdf0e10cSrcweir /** list of source documents that are managed by the link manager. */ 730*cdf0e10cSrcweir LinkedDocMap maLinkedDocs; 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir /** 733*cdf0e10cSrcweir * List of referencing cells that may contain external names. There is 734*cdf0e10cSrcweir * one list per source document. 735*cdf0e10cSrcweir */ 736*cdf0e10cSrcweir RefCellMap maRefCells; 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir LinkListenerMap maLinkListeners; 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir NumFmtMap maNumFormatMap; 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir /** original source file index. */ 743*cdf0e10cSrcweir ::std::vector<SrcFileData> maSrcFiles; 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir /** Status whether in reference marking state. See isInReferenceMarking(). */ 746*cdf0e10cSrcweir bool mbInReferenceMarking:1; 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir /** 749*cdf0e10cSrcweir * Controls whether or not to allow user interaction. We don't want any 750*cdf0e10cSrcweir * user interaction when calling from the API. 751*cdf0e10cSrcweir */ 752*cdf0e10cSrcweir bool mbUserInteractionEnabled:1; 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir AutoTimer maSrcDocTimer; 755*cdf0e10cSrcweir DECL_LINK(TimeOutHdl, AutoTimer*); 756*cdf0e10cSrcweir }; 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir #endif 760