138d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 338d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 438d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 538d50f7bSAndrew Rist * distributed with this work for additional information 638d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 738d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 838d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 938d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 1138d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 1338d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 1438d50f7bSAndrew Rist * software distributed under the License is distributed on an 1538d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1638d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 1738d50f7bSAndrew Rist * specific language governing permissions and limitations 1838d50f7bSAndrew Rist * under the License. 19cdf0e10cSrcweir * 2038d50f7bSAndrew Rist *************************************************************/ 2138d50f7bSAndrew Rist 2238d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_CHGTRACK_HXX 25cdf0e10cSrcweir #define SC_CHGTRACK_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <tools/string.hxx> 29cdf0e10cSrcweir #include <tools/datetime.hxx> 30cdf0e10cSrcweir #include <tools/table.hxx> 31cdf0e10cSrcweir #include <tools/stack.hxx> 32cdf0e10cSrcweir #include <tools/queue.hxx> 33cdf0e10cSrcweir #include <tools/mempool.hxx> 34cdf0e10cSrcweir #include <tools/link.hxx> 35cdf0e10cSrcweir #include <unotools/options.hxx> 36cdf0e10cSrcweir #include "global.hxx" 37cdf0e10cSrcweir #include "bigrange.hxx" 38cdf0e10cSrcweir #include "collect.hxx" 39cdf0e10cSrcweir #include "scdllapi.h" 40cdf0e10cSrcweir 41cdf0e10cSrcweir #ifdef SC_CHGTRACK_CXX 42cdf0e10cSrcweir // core/inc 43cdf0e10cSrcweir #include "refupdat.hxx" 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir 46cdf0e10cSrcweir #define DEBUG_CHANGETRACK 0 47*0deba7fbSSteve Yin class ScChangeAction; 48*0deba7fbSSteve Yin class ScAppOptions; 49*0deba7fbSSteve Yin class ScActionColorChanger 50*0deba7fbSSteve Yin { 51*0deba7fbSSteve Yin private: 52*0deba7fbSSteve Yin const ScAppOptions& rOpt; 53*0deba7fbSSteve Yin const ScStrCollection& rUsers; 54*0deba7fbSSteve Yin String aLastUserName; 55*0deba7fbSSteve Yin sal_uInt16 nLastUserIndex; 56*0deba7fbSSteve Yin ColorData nColor; 57cdf0e10cSrcweir 58*0deba7fbSSteve Yin public: 59*0deba7fbSSteve Yin ScActionColorChanger( const ScChangeTrack& rTrack ); ~ScActionColorChanger()60*0deba7fbSSteve Yin ~ScActionColorChanger() {} 61*0deba7fbSSteve Yin void Update( const ScChangeAction& rAction ); GetColor() const62*0deba7fbSSteve Yin ColorData GetColor() const { return nColor; } 63*0deba7fbSSteve Yin }; 64cdf0e10cSrcweir class ScBaseCell; 65cdf0e10cSrcweir class ScDocument; 66cdf0e10cSrcweir 67cdf0e10cSrcweir 68cdf0e10cSrcweir enum ScChangeActionType 69cdf0e10cSrcweir { 70cdf0e10cSrcweir SC_CAT_NONE, 71cdf0e10cSrcweir SC_CAT_INSERT_COLS, 72cdf0e10cSrcweir SC_CAT_INSERT_ROWS, 73cdf0e10cSrcweir SC_CAT_INSERT_TABS, 74cdf0e10cSrcweir SC_CAT_DELETE_COLS, 75cdf0e10cSrcweir SC_CAT_DELETE_ROWS, 76cdf0e10cSrcweir SC_CAT_DELETE_TABS, 77cdf0e10cSrcweir SC_CAT_MOVE, 78cdf0e10cSrcweir SC_CAT_CONTENT, 79cdf0e10cSrcweir SC_CAT_REJECT 80cdf0e10cSrcweir }; 81cdf0e10cSrcweir 82cdf0e10cSrcweir 83cdf0e10cSrcweir enum ScChangeActionState 84cdf0e10cSrcweir { 85cdf0e10cSrcweir SC_CAS_VIRGIN, 86cdf0e10cSrcweir SC_CAS_ACCEPTED, 87cdf0e10cSrcweir SC_CAS_REJECTED 88cdf0e10cSrcweir }; 89cdf0e10cSrcweir 90cdf0e10cSrcweir 91cdf0e10cSrcweir enum ScChangeActionClipMode 92cdf0e10cSrcweir { 93cdf0e10cSrcweir SC_CACM_NONE, 94cdf0e10cSrcweir SC_CACM_CUT, 95cdf0e10cSrcweir SC_CACM_COPY, 96cdf0e10cSrcweir SC_CACM_PASTE 97cdf0e10cSrcweir }; 98cdf0e10cSrcweir 99cdf0e10cSrcweir class SvStream; 100cdf0e10cSrcweir 101cdf0e10cSrcweir // --- ScChangeActionLinkEntry --------------------------------------------- 102cdf0e10cSrcweir 103cdf0e10cSrcweir // Fuegt sich selbst am Beginn einer Kette ein, bzw. vor einem anderen 104cdf0e10cSrcweir // LinkEntry, on delete selbstaendiges ausklinken auch des gelinkten. 105cdf0e10cSrcweir // ppPrev == &previous->pNext oder Adresse des Pointers auf Beginn der Kette, 106cdf0e10cSrcweir // *ppPrev == this 107cdf0e10cSrcweir 108cdf0e10cSrcweir class ScChangeAction; 109cdf0e10cSrcweir 110cdf0e10cSrcweir class ScChangeActionLinkEntry 111cdf0e10cSrcweir { 112cdf0e10cSrcweir // not implemented, prevent usage 113cdf0e10cSrcweir ScChangeActionLinkEntry( 114cdf0e10cSrcweir const ScChangeActionLinkEntry& ); 115cdf0e10cSrcweir ScChangeActionLinkEntry& operator=( const ScChangeActionLinkEntry& ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir protected: 118cdf0e10cSrcweir 119cdf0e10cSrcweir ScChangeActionLinkEntry* pNext; 120cdf0e10cSrcweir ScChangeActionLinkEntry** ppPrev; 121cdf0e10cSrcweir ScChangeAction* pAction; 122cdf0e10cSrcweir ScChangeActionLinkEntry* pLink; 123cdf0e10cSrcweir 124cdf0e10cSrcweir public: 125cdf0e10cSrcweir 126cdf0e10cSrcweir DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionLinkEntry ) 127cdf0e10cSrcweir ScChangeActionLinkEntry(ScChangeActionLinkEntry ** ppPrevP,ScChangeAction * pActionP)128cdf0e10cSrcweir ScChangeActionLinkEntry( 129cdf0e10cSrcweir ScChangeActionLinkEntry** ppPrevP, 130cdf0e10cSrcweir ScChangeAction* pActionP ) 131cdf0e10cSrcweir : pNext( *ppPrevP ), 132cdf0e10cSrcweir ppPrev( ppPrevP ), 133cdf0e10cSrcweir pAction( pActionP ), 134cdf0e10cSrcweir pLink( NULL ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir if ( pNext ) 137cdf0e10cSrcweir pNext->ppPrev = &pNext; 138cdf0e10cSrcweir *ppPrevP = this; 139cdf0e10cSrcweir } 140cdf0e10cSrcweir ~ScChangeActionLinkEntry()141cdf0e10cSrcweir virtual ~ScChangeActionLinkEntry() 142cdf0e10cSrcweir { 143cdf0e10cSrcweir ScChangeActionLinkEntry* p = pLink; 144cdf0e10cSrcweir UnLink(); 145cdf0e10cSrcweir Remove(); 146cdf0e10cSrcweir if ( p ) 147cdf0e10cSrcweir delete p; 148cdf0e10cSrcweir } 149cdf0e10cSrcweir SetLink(ScChangeActionLinkEntry * pLinkP)150cdf0e10cSrcweir void SetLink( ScChangeActionLinkEntry* pLinkP ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir UnLink(); 153cdf0e10cSrcweir if ( pLinkP ) 154cdf0e10cSrcweir { 155cdf0e10cSrcweir pLink = pLinkP; 156cdf0e10cSrcweir pLinkP->pLink = this; 157cdf0e10cSrcweir } 158cdf0e10cSrcweir } 159cdf0e10cSrcweir UnLink()160cdf0e10cSrcweir void UnLink() 161cdf0e10cSrcweir { 162cdf0e10cSrcweir if ( pLink ) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir pLink->pLink = NULL; 165cdf0e10cSrcweir pLink = NULL; 166cdf0e10cSrcweir } 167cdf0e10cSrcweir } 168cdf0e10cSrcweir Remove()169cdf0e10cSrcweir void Remove() 170cdf0e10cSrcweir { 171cdf0e10cSrcweir if ( ppPrev ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir if ( ( *ppPrev = pNext ) != NULL ) 174cdf0e10cSrcweir pNext->ppPrev = ppPrev; 175cdf0e10cSrcweir ppPrev = NULL; // not inserted 176cdf0e10cSrcweir } 177cdf0e10cSrcweir } 178cdf0e10cSrcweir Insert(ScChangeActionLinkEntry ** ppPrevP)179cdf0e10cSrcweir void Insert( ScChangeActionLinkEntry** ppPrevP ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir if ( !ppPrev ) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir ppPrev = ppPrevP; 184cdf0e10cSrcweir if ( (pNext = *ppPrevP) ) 185cdf0e10cSrcweir pNext->ppPrev = &pNext; 186cdf0e10cSrcweir *ppPrevP = this; 187cdf0e10cSrcweir } 188cdf0e10cSrcweir } 189cdf0e10cSrcweir GetLink() const190cdf0e10cSrcweir const ScChangeActionLinkEntry* GetLink() const { return pLink; } GetLink()191cdf0e10cSrcweir ScChangeActionLinkEntry* GetLink() { return pLink; } GetNext() const192cdf0e10cSrcweir const ScChangeActionLinkEntry* GetNext() const { return pNext; } GetNext()193cdf0e10cSrcweir ScChangeActionLinkEntry* GetNext() { return pNext; } GetAction() const194cdf0e10cSrcweir const ScChangeAction* GetAction() const { return pAction; } GetAction()195cdf0e10cSrcweir ScChangeAction* GetAction() { return pAction; } 196cdf0e10cSrcweir #if DEBUG_CHANGETRACK 197cdf0e10cSrcweir String ToString() const; 198cdf0e10cSrcweir #endif // DEBUG_CHANGETRACK 199cdf0e10cSrcweir }; 200cdf0e10cSrcweir 201cdf0e10cSrcweir // --- ScChangeActionCellListEntry ----------------------------------------- 202cdf0e10cSrcweir // this is only for the XML Export in the hxx 203cdf0e10cSrcweir class ScChangeActionContent; 204cdf0e10cSrcweir 205cdf0e10cSrcweir class ScChangeActionCellListEntry 206cdf0e10cSrcweir { 207cdf0e10cSrcweir friend class ScChangeAction; 208cdf0e10cSrcweir friend class ScChangeActionDel; 209cdf0e10cSrcweir friend class ScChangeActionMove; 210cdf0e10cSrcweir friend class ScChangeTrack; 211cdf0e10cSrcweir 212cdf0e10cSrcweir ScChangeActionCellListEntry* pNext; 213cdf0e10cSrcweir ScChangeActionContent* pContent; 214cdf0e10cSrcweir ScChangeActionCellListEntry(ScChangeActionContent * pContentP,ScChangeActionCellListEntry * pNextP)215cdf0e10cSrcweir ScChangeActionCellListEntry( 216cdf0e10cSrcweir ScChangeActionContent* pContentP, 217cdf0e10cSrcweir ScChangeActionCellListEntry* pNextP ) 218cdf0e10cSrcweir : pNext( pNextP ), 219cdf0e10cSrcweir pContent( pContentP ) 220cdf0e10cSrcweir {} 221cdf0e10cSrcweir 222cdf0e10cSrcweir public: GetNext() const223cdf0e10cSrcweir const ScChangeActionCellListEntry* GetNext() const { return pNext; } // this is only for the XML Export public GetContent() const224cdf0e10cSrcweir const ScChangeActionContent* GetContent() const { return pContent; } // this is only for the XML Export public 225cdf0e10cSrcweir 226cdf0e10cSrcweir DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionCellListEntry ) 227cdf0e10cSrcweir }; 228cdf0e10cSrcweir 229cdf0e10cSrcweir // --- ScChangeAction ------------------------------------------------------- 230cdf0e10cSrcweir 231cdf0e10cSrcweir class ScChangeTrack; 232cdf0e10cSrcweir class ScChangeActionIns; 233cdf0e10cSrcweir class ScChangeActionDel; 234cdf0e10cSrcweir class ScChangeActionContent; 235cdf0e10cSrcweir 236cdf0e10cSrcweir class ScChangeAction 237cdf0e10cSrcweir { 238cdf0e10cSrcweir friend class ScChangeTrack; 239cdf0e10cSrcweir friend class ScChangeActionIns; 240cdf0e10cSrcweir friend class ScChangeActionDel; 241cdf0e10cSrcweir friend class ScChangeActionMove; 242cdf0e10cSrcweir friend class ScChangeActionContent; 243cdf0e10cSrcweir 244cdf0e10cSrcweir // not implemented, prevent usage 245cdf0e10cSrcweir ScChangeAction( const ScChangeAction& ); 246cdf0e10cSrcweir ScChangeAction& operator=( const ScChangeAction& ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir protected: 249cdf0e10cSrcweir 250cdf0e10cSrcweir ScBigRange aBigRange; // Ins/Del/MoveTo/ContentPos 251cdf0e10cSrcweir DateTime aDateTime; //! UTC 252cdf0e10cSrcweir String aUser; // wer war's 253cdf0e10cSrcweir String aComment; // Benutzerkommentar 254cdf0e10cSrcweir ScChangeAction* pNext; // naechster in Kette 255cdf0e10cSrcweir ScChangeAction* pPrev; // vorheriger in Kette 256cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkAny; // irgendwelche Links 257cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkDeletedIn; // Zuordnung zu 258cdf0e10cSrcweir // geloeschten oder 259cdf0e10cSrcweir // druebergemoveten oder 260cdf0e10cSrcweir // rejecteten Insert 261cdf0e10cSrcweir // Bereichen 262cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkDeleted; // Links zu geloeschten 263cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkDependent; // Links zu abhaengigen 264cdf0e10cSrcweir sal_uLong nAction; 265cdf0e10cSrcweir sal_uLong nRejectAction; 266cdf0e10cSrcweir ScChangeActionType eType; 267cdf0e10cSrcweir ScChangeActionState eState; 268cdf0e10cSrcweir 269cdf0e10cSrcweir 270cdf0e10cSrcweir ScChangeAction( ScChangeActionType, 271cdf0e10cSrcweir const ScRange& ); 272cdf0e10cSrcweir 273cdf0e10cSrcweir // only to be used in the XML import 274cdf0e10cSrcweir ScChangeAction( ScChangeActionType, 275cdf0e10cSrcweir const ScBigRange&, 276cdf0e10cSrcweir const sal_uLong nAction, 277cdf0e10cSrcweir const sal_uLong nRejectAction, 278cdf0e10cSrcweir const ScChangeActionState eState, 279cdf0e10cSrcweir const DateTime& aDateTime, 280cdf0e10cSrcweir const String& aUser, 281cdf0e10cSrcweir const String& aComment ); 282cdf0e10cSrcweir // only to be used in the XML import 283cdf0e10cSrcweir ScChangeAction( ScChangeActionType, 284cdf0e10cSrcweir const ScBigRange&, 285cdf0e10cSrcweir const sal_uLong nAction); 286cdf0e10cSrcweir 287cdf0e10cSrcweir virtual ~ScChangeAction(); 288cdf0e10cSrcweir 289cdf0e10cSrcweir String GetRefString( const ScBigRange&, 290cdf0e10cSrcweir ScDocument*, sal_Bool bFlag3D = sal_False ) const; 291cdf0e10cSrcweir SetActionNumber(sal_uLong n)292cdf0e10cSrcweir void SetActionNumber( sal_uLong n ) { nAction = n; } SetRejectAction(sal_uLong n)293cdf0e10cSrcweir void SetRejectAction( sal_uLong n ) { nRejectAction = n; } SetUser(const String & r)294cdf0e10cSrcweir void SetUser( const String& r ) { aUser = r; } SetType(ScChangeActionType e)295cdf0e10cSrcweir void SetType( ScChangeActionType e ) { eType = e; } SetState(ScChangeActionState e)296cdf0e10cSrcweir void SetState( ScChangeActionState e ) { eState = e; } 297cdf0e10cSrcweir void SetRejected(); 298cdf0e10cSrcweir GetBigRange()299cdf0e10cSrcweir ScBigRange& GetBigRange() { return aBigRange; } 300cdf0e10cSrcweir AddLink(ScChangeAction * p,ScChangeActionLinkEntry * pL)301cdf0e10cSrcweir ScChangeActionLinkEntry* AddLink( ScChangeAction* p, 302cdf0e10cSrcweir ScChangeActionLinkEntry* pL ) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir ScChangeActionLinkEntry* pLnk = 305cdf0e10cSrcweir new ScChangeActionLinkEntry( 306cdf0e10cSrcweir &pLinkAny, p ); 307cdf0e10cSrcweir pLnk->SetLink( pL ); 308cdf0e10cSrcweir return pLnk; 309cdf0e10cSrcweir } 310cdf0e10cSrcweir void RemoveAllAnyLinks(); 311cdf0e10cSrcweir GetDeletedIn() const312cdf0e10cSrcweir virtual ScChangeActionLinkEntry* GetDeletedIn() const 313cdf0e10cSrcweir { return pLinkDeletedIn; } GetDeletedInAddress()314cdf0e10cSrcweir virtual ScChangeActionLinkEntry** GetDeletedInAddress() 315cdf0e10cSrcweir { return &pLinkDeletedIn; } AddDeletedIn(ScChangeAction * p)316cdf0e10cSrcweir ScChangeActionLinkEntry* AddDeletedIn( ScChangeAction* p ) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir return new ScChangeActionLinkEntry( 319cdf0e10cSrcweir GetDeletedInAddress(), p ); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir sal_Bool RemoveDeletedIn( const ScChangeAction* ); 322cdf0e10cSrcweir void SetDeletedIn( ScChangeAction* ); 323cdf0e10cSrcweir AddDeleted(ScChangeAction * p)324cdf0e10cSrcweir ScChangeActionLinkEntry* AddDeleted( ScChangeAction* p ) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir return new ScChangeActionLinkEntry( 327cdf0e10cSrcweir &pLinkDeleted, p ); 328cdf0e10cSrcweir } 329cdf0e10cSrcweir void RemoveAllDeleted(); 330cdf0e10cSrcweir AddDependent(ScChangeAction * p)331cdf0e10cSrcweir ScChangeActionLinkEntry* AddDependent( ScChangeAction* p ) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir return new ScChangeActionLinkEntry( 334cdf0e10cSrcweir &pLinkDependent, p ); 335cdf0e10cSrcweir } 336cdf0e10cSrcweir void RemoveAllDependent(); 337cdf0e10cSrcweir 338cdf0e10cSrcweir void RemoveAllLinks(); 339cdf0e10cSrcweir 340cdf0e10cSrcweir virtual void AddContent( ScChangeActionContent* ) = 0; 341cdf0e10cSrcweir virtual void DeleteCellEntries() = 0; 342cdf0e10cSrcweir 343cdf0e10cSrcweir virtual void UpdateReference( const ScChangeTrack*, 344cdf0e10cSrcweir UpdateRefMode, const ScBigRange&, 345cdf0e10cSrcweir sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); 346cdf0e10cSrcweir 347cdf0e10cSrcweir void Accept(); 348cdf0e10cSrcweir virtual sal_Bool Reject( ScDocument* ) = 0; 349cdf0e10cSrcweir void RejectRestoreContents( ScChangeTrack*, 350cdf0e10cSrcweir SCsCOL nDx, SCsROW nDy ); 351cdf0e10cSrcweir 352cdf0e10cSrcweir // used in Reject() instead of IsRejectable() 353cdf0e10cSrcweir sal_Bool IsInternalRejectable() const; 354cdf0e10cSrcweir 355cdf0e10cSrcweir // Derived classes that hold a pointer to the 356cdf0e10cSrcweir // ChangeTrack must return that. Otherwise NULL. 357cdf0e10cSrcweir virtual const ScChangeTrack* GetChangeTrack() const = 0; 358cdf0e10cSrcweir 359cdf0e10cSrcweir public: 360cdf0e10cSrcweir IsInsertType() const361cdf0e10cSrcweir sal_Bool IsInsertType() const 362cdf0e10cSrcweir { 363cdf0e10cSrcweir return eType == SC_CAT_INSERT_COLS || 364cdf0e10cSrcweir eType == SC_CAT_INSERT_ROWS || 365cdf0e10cSrcweir eType == SC_CAT_INSERT_TABS; 366cdf0e10cSrcweir } IsDeleteType() const367cdf0e10cSrcweir sal_Bool IsDeleteType() const 368cdf0e10cSrcweir { 369cdf0e10cSrcweir return eType == SC_CAT_DELETE_COLS || 370cdf0e10cSrcweir eType == SC_CAT_DELETE_ROWS || 371cdf0e10cSrcweir eType == SC_CAT_DELETE_TABS; 372cdf0e10cSrcweir } IsVirgin() const373cdf0e10cSrcweir sal_Bool IsVirgin() const 374cdf0e10cSrcweir { return eState == SC_CAS_VIRGIN; } IsAccepted() const375cdf0e10cSrcweir sal_Bool IsAccepted() const 376cdf0e10cSrcweir { return eState == SC_CAS_ACCEPTED; } IsRejected() const377cdf0e10cSrcweir sal_Bool IsRejected() const 378cdf0e10cSrcweir { return eState == SC_CAS_REJECTED; } 379cdf0e10cSrcweir 380cdf0e10cSrcweir // Action rejects another Action IsRejecting() const381cdf0e10cSrcweir sal_Bool IsRejecting() const 382cdf0e10cSrcweir { return nRejectAction != 0; } 383cdf0e10cSrcweir 384cdf0e10cSrcweir // ob Action im Dokument sichtbar ist 385cdf0e10cSrcweir sal_Bool IsVisible() const; 386cdf0e10cSrcweir 387cdf0e10cSrcweir // ob Action anfassbar ist 388cdf0e10cSrcweir sal_Bool IsTouchable() const; 389cdf0e10cSrcweir 390cdf0e10cSrcweir // ob Action ein Eintrag in Dialog-Root ist 391cdf0e10cSrcweir sal_Bool IsDialogRoot() const; 392cdf0e10cSrcweir 393cdf0e10cSrcweir // ob ein Eintrag im Dialog aufklappbar sein soll 394cdf0e10cSrcweir sal_Bool IsDialogParent() const; 395cdf0e10cSrcweir 396cdf0e10cSrcweir // ob Action ein Delete ist, unter dem 397cdf0e10cSrcweir // aufgeklappt mehrere einzelne Deletes sind 398cdf0e10cSrcweir sal_Bool IsMasterDelete() const; 399cdf0e10cSrcweir 400cdf0e10cSrcweir // ob Action akzeptiert/selektiert/abgelehnt 401cdf0e10cSrcweir // werden kann 402cdf0e10cSrcweir sal_Bool IsClickable() const; 403cdf0e10cSrcweir 404cdf0e10cSrcweir // ob Action abgelehnt werden kann 405cdf0e10cSrcweir sal_Bool IsRejectable() const; 406cdf0e10cSrcweir GetBigRange() const407cdf0e10cSrcweir const ScBigRange& GetBigRange() const { return aBigRange; } 408cdf0e10cSrcweir SC_DLLPUBLIC DateTime GetDateTime() const; // local time GetDateTimeUTC() const409cdf0e10cSrcweir const DateTime& GetDateTimeUTC() const // UTC time 410cdf0e10cSrcweir { return aDateTime; } GetUser() const411cdf0e10cSrcweir const String& GetUser() const { return aUser; } GetComment() const412cdf0e10cSrcweir const String& GetComment() const { return aComment; } GetType() const413cdf0e10cSrcweir ScChangeActionType GetType() const { return eType; } GetState() const414cdf0e10cSrcweir ScChangeActionState GetState() const { return eState; } GetActionNumber() const415cdf0e10cSrcweir sal_uLong GetActionNumber() const { return nAction; } GetRejectAction() const416cdf0e10cSrcweir sal_uLong GetRejectAction() const { return nRejectAction; } 417cdf0e10cSrcweir GetNext() const418cdf0e10cSrcweir ScChangeAction* GetNext() const { return pNext; } GetPrev() const419cdf0e10cSrcweir ScChangeAction* GetPrev() const { return pPrev; } 420cdf0e10cSrcweir IsDeletedIn() const421cdf0e10cSrcweir sal_Bool IsDeletedIn() const 422cdf0e10cSrcweir { return GetDeletedIn() != NULL; } IsDeleted() const423cdf0e10cSrcweir sal_Bool IsDeleted() const 424cdf0e10cSrcweir { return IsDeleteType() || IsDeletedIn(); } 425cdf0e10cSrcweir sal_Bool IsDeletedIn( const ScChangeAction* ) const; 426cdf0e10cSrcweir sal_Bool IsDeletedInDelType( ScChangeActionType ) const; 427cdf0e10cSrcweir void RemoveAllDeletedIn(); 428cdf0e10cSrcweir GetFirstDeletedEntry() const429cdf0e10cSrcweir const ScChangeActionLinkEntry* GetFirstDeletedEntry() const 430cdf0e10cSrcweir { return pLinkDeleted; } GetFirstDependentEntry() const431cdf0e10cSrcweir const ScChangeActionLinkEntry* GetFirstDependentEntry() const 432cdf0e10cSrcweir { return pLinkDependent; } HasDependent() const433cdf0e10cSrcweir sal_Bool HasDependent() const 434cdf0e10cSrcweir { return pLinkDependent != NULL; } HasDeleted() const435cdf0e10cSrcweir sal_Bool HasDeleted() const 436cdf0e10cSrcweir { return pLinkDeleted != NULL; } 437cdf0e10cSrcweir 438cdf0e10cSrcweir // Description wird an String angehaengt. 439cdf0e10cSrcweir // Mit bSplitRange wird bei Delete nur 440cdf0e10cSrcweir // eine Spalte/Zeile beruecksichtigt (fuer 441cdf0e10cSrcweir // Auflistung der einzelnen Eintraege). 442cdf0e10cSrcweir virtual void GetDescription( String&, ScDocument*, 443cdf0e10cSrcweir sal_Bool bSplitRange = sal_False, bool bWarning = true ) const; 444cdf0e10cSrcweir 445cdf0e10cSrcweir virtual void GetRefString( String&, ScDocument*, 446cdf0e10cSrcweir sal_Bool bFlag3D = sal_False ) const; 447cdf0e10cSrcweir 448cdf0e10cSrcweir // fuer DocumentMerge altes Datum einer anderen 449cdf0e10cSrcweir // Action setzen, mit GetDateTimeUTC geholt SetDateTimeUTC(const DateTime & rDT)450cdf0e10cSrcweir void SetDateTimeUTC( const DateTime& rDT ) 451cdf0e10cSrcweir { aDateTime = rDT; } 452cdf0e10cSrcweir 453cdf0e10cSrcweir // Benutzerkommentar setzen SetComment(const String & rStr)454cdf0e10cSrcweir void SetComment( const String& rStr ) 455cdf0e10cSrcweir { aComment = rStr; } 456cdf0e10cSrcweir 457cdf0e10cSrcweir // only to be used in the XML import 458cdf0e10cSrcweir void SetDeletedInThis( sal_uLong nActionNumber, 459cdf0e10cSrcweir const ScChangeTrack* pTrack ); 460cdf0e10cSrcweir // only to be used in the XML import 461cdf0e10cSrcweir void AddDependent( sal_uLong nActionNumber, 462cdf0e10cSrcweir const ScChangeTrack* pTrack ); 463cdf0e10cSrcweir #if DEBUG_CHANGETRACK 464cdf0e10cSrcweir String ToString( ScDocument* pDoc ) const; 465cdf0e10cSrcweir #endif // DEBUG_CHANGETRACK 466cdf0e10cSrcweir }; 467cdf0e10cSrcweir 468cdf0e10cSrcweir 469cdf0e10cSrcweir // --- ScChangeActionIns ---------------------------------------------------- 470cdf0e10cSrcweir 471cdf0e10cSrcweir class ScChangeActionIns : public ScChangeAction 472cdf0e10cSrcweir { 473cdf0e10cSrcweir friend class ScChangeTrack; 474cdf0e10cSrcweir 475cdf0e10cSrcweir ScChangeActionIns( const ScRange& rRange ); 476cdf0e10cSrcweir virtual ~ScChangeActionIns(); 477cdf0e10cSrcweir AddContent(ScChangeActionContent *)478cdf0e10cSrcweir virtual void AddContent( ScChangeActionContent* ) {} DeleteCellEntries()479cdf0e10cSrcweir virtual void DeleteCellEntries() {} 480cdf0e10cSrcweir 481cdf0e10cSrcweir virtual sal_Bool Reject( ScDocument* ); 482cdf0e10cSrcweir GetChangeTrack() const483cdf0e10cSrcweir virtual const ScChangeTrack* GetChangeTrack() const { return 0; } 484cdf0e10cSrcweir 485cdf0e10cSrcweir public: 486cdf0e10cSrcweir ScChangeActionIns(const sal_uLong nActionNumber, 487cdf0e10cSrcweir const ScChangeActionState eState, 488cdf0e10cSrcweir const sal_uLong nRejectingNumber, 489cdf0e10cSrcweir const ScBigRange& aBigRange, 490cdf0e10cSrcweir const String& aUser, 491cdf0e10cSrcweir const DateTime& aDateTime, 492cdf0e10cSrcweir const String &sComment, 493cdf0e10cSrcweir const ScChangeActionType eType); // only to use in the XML import 494cdf0e10cSrcweir 495cdf0e10cSrcweir virtual void GetDescription( String&, ScDocument*, 496cdf0e10cSrcweir sal_Bool bSplitRange = sal_False, bool bWarning = true ) const; 497cdf0e10cSrcweir }; 498cdf0e10cSrcweir 499cdf0e10cSrcweir 500cdf0e10cSrcweir // --- ScChangeActionDel ---------------------------------------------------- 501cdf0e10cSrcweir 502cdf0e10cSrcweir class ScChangeActionMove; 503cdf0e10cSrcweir 504cdf0e10cSrcweir class ScChangeActionDelMoveEntry : public ScChangeActionLinkEntry 505cdf0e10cSrcweir { 506cdf0e10cSrcweir friend class ScChangeActionDel; 507cdf0e10cSrcweir friend class ScChangeTrack; 508cdf0e10cSrcweir 509cdf0e10cSrcweir short nCutOffFrom; 510cdf0e10cSrcweir short nCutOffTo; 511cdf0e10cSrcweir 512cdf0e10cSrcweir ScChangeActionDelMoveEntry(ScChangeActionDelMoveEntry ** ppPrevP,ScChangeActionMove * pMove,short nFrom,short nTo)513cdf0e10cSrcweir ScChangeActionDelMoveEntry( 514cdf0e10cSrcweir ScChangeActionDelMoveEntry** ppPrevP, 515cdf0e10cSrcweir ScChangeActionMove* pMove, 516cdf0e10cSrcweir short nFrom, short nTo ) 517cdf0e10cSrcweir : ScChangeActionLinkEntry( 518cdf0e10cSrcweir (ScChangeActionLinkEntry**) 519cdf0e10cSrcweir ppPrevP, 520cdf0e10cSrcweir (ScChangeAction*) pMove ), 521cdf0e10cSrcweir nCutOffFrom( nFrom ), 522cdf0e10cSrcweir nCutOffTo( nTo ) 523cdf0e10cSrcweir {} 524cdf0e10cSrcweir GetNext()525cdf0e10cSrcweir ScChangeActionDelMoveEntry* GetNext() 526cdf0e10cSrcweir { 527cdf0e10cSrcweir return (ScChangeActionDelMoveEntry*) 528cdf0e10cSrcweir ScChangeActionLinkEntry::GetNext(); 529cdf0e10cSrcweir } GetMove()530cdf0e10cSrcweir ScChangeActionMove* GetMove() 531cdf0e10cSrcweir { 532cdf0e10cSrcweir return (ScChangeActionMove*) 533cdf0e10cSrcweir ScChangeActionLinkEntry::GetAction(); 534cdf0e10cSrcweir } 535cdf0e10cSrcweir 536cdf0e10cSrcweir public: GetNext() const537cdf0e10cSrcweir const ScChangeActionDelMoveEntry* GetNext() const 538cdf0e10cSrcweir { 539cdf0e10cSrcweir return (const ScChangeActionDelMoveEntry*) 540cdf0e10cSrcweir ScChangeActionLinkEntry::GetNext(); 541cdf0e10cSrcweir } GetMove() const542cdf0e10cSrcweir const ScChangeActionMove* GetMove() const 543cdf0e10cSrcweir { 544cdf0e10cSrcweir return (const ScChangeActionMove*) 545cdf0e10cSrcweir ScChangeActionLinkEntry::GetAction(); 546cdf0e10cSrcweir } GetCutOffFrom() const547cdf0e10cSrcweir short GetCutOffFrom() const { return nCutOffFrom; } GetCutOffTo() const548cdf0e10cSrcweir short GetCutOffTo() const { return nCutOffTo; } 549cdf0e10cSrcweir }; 550cdf0e10cSrcweir 551cdf0e10cSrcweir 552cdf0e10cSrcweir class ScChangeActionDel : public ScChangeAction 553cdf0e10cSrcweir { 554cdf0e10cSrcweir friend class ScChangeTrack; 555cdf0e10cSrcweir friend void ScChangeAction::Accept(); 556cdf0e10cSrcweir 557cdf0e10cSrcweir ScChangeTrack* pTrack; 558cdf0e10cSrcweir ScChangeActionCellListEntry* pFirstCell; 559cdf0e10cSrcweir ScChangeActionIns* pCutOff; // abgeschnittener Insert 560cdf0e10cSrcweir short nCutOff; // +: Start -: End 561cdf0e10cSrcweir ScChangeActionDelMoveEntry* pLinkMove; 562cdf0e10cSrcweir SCsCOL nDx; 563cdf0e10cSrcweir SCsROW nDy; 564cdf0e10cSrcweir 565cdf0e10cSrcweir ScChangeActionDel( const ScRange& rRange, 566cdf0e10cSrcweir SCsCOL nDx, SCsROW nDy, ScChangeTrack* ); 567cdf0e10cSrcweir virtual ~ScChangeActionDel(); 568cdf0e10cSrcweir GetCutOffInsert()569cdf0e10cSrcweir ScChangeActionIns* GetCutOffInsert() { return pCutOff; } 570cdf0e10cSrcweir 571cdf0e10cSrcweir virtual void AddContent( ScChangeActionContent* ); 572cdf0e10cSrcweir virtual void DeleteCellEntries(); 573cdf0e10cSrcweir 574cdf0e10cSrcweir void UndoCutOffMoves(); 575cdf0e10cSrcweir void UndoCutOffInsert(); 576cdf0e10cSrcweir 577cdf0e10cSrcweir virtual void UpdateReference( const ScChangeTrack*, 578cdf0e10cSrcweir UpdateRefMode, const ScBigRange&, 579cdf0e10cSrcweir sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); 580cdf0e10cSrcweir 581cdf0e10cSrcweir virtual sal_Bool Reject( ScDocument* ); 582cdf0e10cSrcweir GetChangeTrack() const583cdf0e10cSrcweir virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } 584cdf0e10cSrcweir 585cdf0e10cSrcweir public: 586cdf0e10cSrcweir ScChangeActionDel(const sal_uLong nActionNumber, 587cdf0e10cSrcweir const ScChangeActionState eState, 588cdf0e10cSrcweir const sal_uLong nRejectingNumber, 589cdf0e10cSrcweir const ScBigRange& aBigRange, 590cdf0e10cSrcweir const String& aUser, 591cdf0e10cSrcweir const DateTime& aDateTime, 592cdf0e10cSrcweir const String &sComment, 593cdf0e10cSrcweir const ScChangeActionType eType, 594cdf0e10cSrcweir const SCsCOLROW nD, 595cdf0e10cSrcweir ScChangeTrack* pTrack); // only to use in the XML import 596cdf0e10cSrcweir // wich of nDx and nDy is set is depend on the type 597cdf0e10cSrcweir 598cdf0e10cSrcweir // ob dieses das unterste einer Reihe (oder 599cdf0e10cSrcweir // auch einzeln) ist 600cdf0e10cSrcweir sal_Bool IsBaseDelete() const; 601cdf0e10cSrcweir 602cdf0e10cSrcweir // ob dieses das oberste einer Reihe (oder 603cdf0e10cSrcweir // auch einzeln) ist 604cdf0e10cSrcweir sal_Bool IsTopDelete() const; 605cdf0e10cSrcweir 606cdf0e10cSrcweir // ob dieses ein Teil einer Reihe ist 607cdf0e10cSrcweir sal_Bool IsMultiDelete() const; 608cdf0e10cSrcweir 609cdf0e10cSrcweir // ob es eine Col ist, die zu einem TabDelete gehoert 610cdf0e10cSrcweir sal_Bool IsTabDeleteCol() const; 611cdf0e10cSrcweir GetDx() const612cdf0e10cSrcweir SCsCOL GetDx() const { return nDx; } GetDy() const613cdf0e10cSrcweir SCsROW GetDy() const { return nDy; } 614cdf0e10cSrcweir ScBigRange GetOverAllRange() const; // BigRange + (nDx, nDy) 615cdf0e10cSrcweir GetFirstCellEntry() const616cdf0e10cSrcweir const ScChangeActionCellListEntry* GetFirstCellEntry() const 617cdf0e10cSrcweir { return pFirstCell; } GetFirstMoveEntry() const618cdf0e10cSrcweir const ScChangeActionDelMoveEntry* GetFirstMoveEntry() const 619cdf0e10cSrcweir { return pLinkMove; } GetCutOffInsert() const620cdf0e10cSrcweir const ScChangeActionIns* GetCutOffInsert() const { return pCutOff; } GetCutOffCount() const621cdf0e10cSrcweir short GetCutOffCount() const { return nCutOff; } 622cdf0e10cSrcweir 623cdf0e10cSrcweir virtual void GetDescription( String&, ScDocument*, 624cdf0e10cSrcweir sal_Bool bSplitRange = sal_False, bool bWarning = true ) const; SetCutOffInsert(ScChangeActionIns * p,short n)625cdf0e10cSrcweir void SetCutOffInsert( ScChangeActionIns* p, short n ) 626cdf0e10cSrcweir { pCutOff = p; nCutOff = n; } // only to use in the XML import 627cdf0e10cSrcweir // this should be protected, but for the XML import it is public 628cdf0e10cSrcweir // only to use in the XML import 629cdf0e10cSrcweir // this should be protected, but for the XML import it is public AddCutOffMove(ScChangeActionMove * pMove,short nFrom,short nTo)630cdf0e10cSrcweir ScChangeActionDelMoveEntry* AddCutOffMove( ScChangeActionMove* pMove, 631cdf0e10cSrcweir short nFrom, short nTo ) 632cdf0e10cSrcweir { 633cdf0e10cSrcweir return new ScChangeActionDelMoveEntry( 634cdf0e10cSrcweir &pLinkMove, pMove, nFrom, nTo ); 635cdf0e10cSrcweir } 636cdf0e10cSrcweir }; 637cdf0e10cSrcweir 638cdf0e10cSrcweir 639cdf0e10cSrcweir // --- ScChangeActionMove --------------------------------------------------- 640cdf0e10cSrcweir 641cdf0e10cSrcweir class ScChangeActionMove : public ScChangeAction 642cdf0e10cSrcweir { 643cdf0e10cSrcweir friend class ScChangeTrack; 644cdf0e10cSrcweir friend class ScChangeActionDel; 645cdf0e10cSrcweir 646cdf0e10cSrcweir ScBigRange aFromRange; 647cdf0e10cSrcweir ScChangeTrack* pTrack; 648cdf0e10cSrcweir ScChangeActionCellListEntry* pFirstCell; 649cdf0e10cSrcweir sal_uLong nStartLastCut; // fuer PasteCut Undo 650cdf0e10cSrcweir sal_uLong nEndLastCut; 651cdf0e10cSrcweir ScChangeActionMove(const ScRange & rFromRange,const ScRange & rToRange,ScChangeTrack * pTrackP)652cdf0e10cSrcweir ScChangeActionMove( const ScRange& rFromRange, 653cdf0e10cSrcweir const ScRange& rToRange, 654cdf0e10cSrcweir ScChangeTrack* pTrackP ) 655cdf0e10cSrcweir : ScChangeAction( SC_CAT_MOVE, rToRange ), 656cdf0e10cSrcweir aFromRange( rFromRange ), 657cdf0e10cSrcweir pTrack( pTrackP ), 658cdf0e10cSrcweir pFirstCell( NULL ), 659cdf0e10cSrcweir nStartLastCut(0), 660cdf0e10cSrcweir nEndLastCut(0) 661cdf0e10cSrcweir {} 662cdf0e10cSrcweir virtual ~ScChangeActionMove(); 663cdf0e10cSrcweir 664cdf0e10cSrcweir virtual void AddContent( ScChangeActionContent* ); 665cdf0e10cSrcweir virtual void DeleteCellEntries(); 666cdf0e10cSrcweir GetFromRange()667cdf0e10cSrcweir ScBigRange& GetFromRange() { return aFromRange; } 668cdf0e10cSrcweir SetStartLastCut(sal_uLong nVal)669cdf0e10cSrcweir void SetStartLastCut( sal_uLong nVal ) { nStartLastCut = nVal; } GetStartLastCut() const670cdf0e10cSrcweir sal_uLong GetStartLastCut() const { return nStartLastCut; } SetEndLastCut(sal_uLong nVal)671cdf0e10cSrcweir void SetEndLastCut( sal_uLong nVal ) { nEndLastCut = nVal; } GetEndLastCut() const672cdf0e10cSrcweir sal_uLong GetEndLastCut() const { return nEndLastCut; } 673cdf0e10cSrcweir 674cdf0e10cSrcweir virtual void UpdateReference( const ScChangeTrack*, 675cdf0e10cSrcweir UpdateRefMode, const ScBigRange&, 676cdf0e10cSrcweir sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); 677cdf0e10cSrcweir 678cdf0e10cSrcweir virtual sal_Bool Reject( ScDocument* ); 679cdf0e10cSrcweir GetChangeTrack() const680cdf0e10cSrcweir virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } 681cdf0e10cSrcweir 682cdf0e10cSrcweir protected: 683cdf0e10cSrcweir using ScChangeAction::GetRefString; 684cdf0e10cSrcweir 685cdf0e10cSrcweir public: 686cdf0e10cSrcweir ScChangeActionMove(const sal_uLong nActionNumber, 687cdf0e10cSrcweir const ScChangeActionState eState, 688cdf0e10cSrcweir const sal_uLong nRejectingNumber, 689cdf0e10cSrcweir const ScBigRange& aToBigRange, 690cdf0e10cSrcweir const String& aUser, 691cdf0e10cSrcweir const DateTime& aDateTime, 692cdf0e10cSrcweir const String &sComment, 693cdf0e10cSrcweir const ScBigRange& aFromBigRange, 694cdf0e10cSrcweir ScChangeTrack* pTrack); // only to use in the XML import GetFirstCellEntry() const695cdf0e10cSrcweir const ScChangeActionCellListEntry* GetFirstCellEntry() const 696cdf0e10cSrcweir { return pFirstCell; } // only to use in the XML export 697cdf0e10cSrcweir GetFromRange() const698cdf0e10cSrcweir const ScBigRange& GetFromRange() const { return aFromRange; } 699cdf0e10cSrcweir SC_DLLPUBLIC void GetDelta( sal_Int32& nDx, sal_Int32& nDy, sal_Int32& nDz ) const; 700cdf0e10cSrcweir 701cdf0e10cSrcweir virtual void GetDescription( String&, ScDocument*, 702cdf0e10cSrcweir sal_Bool bSplitRange = sal_False, bool bWarning = true ) const; 703cdf0e10cSrcweir 704cdf0e10cSrcweir virtual void GetRefString( String&, ScDocument*, 705cdf0e10cSrcweir sal_Bool bFlag3D = sal_False ) const; 706cdf0e10cSrcweir }; 707cdf0e10cSrcweir 708cdf0e10cSrcweir 709cdf0e10cSrcweir // --- ScChangeActionContent ------------------------------------------------ 710cdf0e10cSrcweir 711cdf0e10cSrcweir enum ScChangeActionContentCellType 712cdf0e10cSrcweir { 713cdf0e10cSrcweir SC_CACCT_NONE = 0, 714cdf0e10cSrcweir SC_CACCT_NORMAL, 715cdf0e10cSrcweir SC_CACCT_MATORG, 716cdf0e10cSrcweir SC_CACCT_MATREF 717cdf0e10cSrcweir }; 718cdf0e10cSrcweir 719cdf0e10cSrcweir class Stack; 720cdf0e10cSrcweir 721cdf0e10cSrcweir class ScChangeActionContent : public ScChangeAction 722cdf0e10cSrcweir { 723cdf0e10cSrcweir friend class ScChangeTrack; 724cdf0e10cSrcweir 725cdf0e10cSrcweir String aOldValue; 726cdf0e10cSrcweir String aNewValue; 727cdf0e10cSrcweir ScBaseCell* pOldCell; 728cdf0e10cSrcweir ScBaseCell* pNewCell; 729cdf0e10cSrcweir ScChangeActionContent* pNextContent; // an gleicher Position 730cdf0e10cSrcweir ScChangeActionContent* pPrevContent; 731cdf0e10cSrcweir ScChangeActionContent* pNextInSlot; // in gleichem Slot 732cdf0e10cSrcweir ScChangeActionContent** ppPrevInSlot; 733cdf0e10cSrcweir InsertInSlot(ScChangeActionContent ** pp)734cdf0e10cSrcweir void InsertInSlot( ScChangeActionContent** pp ) 735cdf0e10cSrcweir { 736cdf0e10cSrcweir if ( !ppPrevInSlot ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir ppPrevInSlot = pp; 739cdf0e10cSrcweir if ( ( pNextInSlot = *pp ) != NULL ) 740cdf0e10cSrcweir pNextInSlot->ppPrevInSlot = &pNextInSlot; 741cdf0e10cSrcweir *pp = this; 742cdf0e10cSrcweir } 743cdf0e10cSrcweir } RemoveFromSlot()744cdf0e10cSrcweir void RemoveFromSlot() 745cdf0e10cSrcweir { 746cdf0e10cSrcweir if ( ppPrevInSlot ) 747cdf0e10cSrcweir { 748cdf0e10cSrcweir if ( ( *ppPrevInSlot = pNextInSlot ) != NULL ) 749cdf0e10cSrcweir pNextInSlot->ppPrevInSlot = ppPrevInSlot; 750cdf0e10cSrcweir ppPrevInSlot = NULL; // not inserted 751cdf0e10cSrcweir } 752cdf0e10cSrcweir } GetNextInSlot()753cdf0e10cSrcweir ScChangeActionContent* GetNextInSlot() { return pNextInSlot; } 754cdf0e10cSrcweir 755cdf0e10cSrcweir void ClearTrack(); 756cdf0e10cSrcweir 757cdf0e10cSrcweir static void GetStringOfCell( String& rStr, 758cdf0e10cSrcweir const ScBaseCell* pCell, 759cdf0e10cSrcweir const ScDocument* pDoc, 760cdf0e10cSrcweir const ScAddress& rPos ); 761cdf0e10cSrcweir 762cdf0e10cSrcweir static void GetStringOfCell( String& rStr, 763cdf0e10cSrcweir const ScBaseCell* pCell, 764cdf0e10cSrcweir const ScDocument* pDoc, 765cdf0e10cSrcweir sal_uLong nFormat ); 766cdf0e10cSrcweir 767cdf0e10cSrcweir static void SetValue( String& rStr, ScBaseCell*& pCell, 768cdf0e10cSrcweir const ScAddress& rPos, 769cdf0e10cSrcweir const ScBaseCell* pOrgCell, 770cdf0e10cSrcweir const ScDocument* pFromDoc, 771cdf0e10cSrcweir ScDocument* pToDoc ); 772cdf0e10cSrcweir 773cdf0e10cSrcweir static void SetValue( String& rStr, ScBaseCell*& pCell, 774cdf0e10cSrcweir sal_uLong nFormat, 775cdf0e10cSrcweir const ScBaseCell* pOrgCell, 776cdf0e10cSrcweir const ScDocument* pFromDoc, 777cdf0e10cSrcweir ScDocument* pToDoc ); 778cdf0e10cSrcweir 779cdf0e10cSrcweir static void SetCell( String& rStr, ScBaseCell* pCell, 780cdf0e10cSrcweir sal_uLong nFormat, const ScDocument* pDoc ); 781cdf0e10cSrcweir 782cdf0e10cSrcweir static sal_Bool NeedsNumberFormat( const ScBaseCell* ); 783cdf0e10cSrcweir 784cdf0e10cSrcweir void SetValueString( String& rValue, 785cdf0e10cSrcweir ScBaseCell*& pCell, const String& rStr, 786cdf0e10cSrcweir ScDocument* pDoc ); 787cdf0e10cSrcweir 788cdf0e10cSrcweir void GetValueString( String& rStr, 789cdf0e10cSrcweir const String& rValue, 790cdf0e10cSrcweir const ScBaseCell* pCell ) const; 791cdf0e10cSrcweir 792cdf0e10cSrcweir void GetFormulaString( String& rStr, 793cdf0e10cSrcweir const ScFormulaCell* pCell ) const; 794cdf0e10cSrcweir AddContent(ScChangeActionContent *)795cdf0e10cSrcweir virtual void AddContent( ScChangeActionContent* ) {} DeleteCellEntries()796cdf0e10cSrcweir virtual void DeleteCellEntries() {} 797cdf0e10cSrcweir 798cdf0e10cSrcweir virtual void UpdateReference( const ScChangeTrack*, 799cdf0e10cSrcweir UpdateRefMode, const ScBigRange&, 800cdf0e10cSrcweir sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); 801cdf0e10cSrcweir 802cdf0e10cSrcweir virtual sal_Bool Reject( ScDocument* ); 803cdf0e10cSrcweir GetChangeTrack() const804cdf0e10cSrcweir virtual const ScChangeTrack* GetChangeTrack() const { return 0; } 805cdf0e10cSrcweir 806cdf0e10cSrcweir // pRejectActions!=NULL: reject actions get 807cdf0e10cSrcweir // stacked, no SetNewValue, no Append 808cdf0e10cSrcweir sal_Bool Select( ScDocument*, ScChangeTrack*, 809cdf0e10cSrcweir sal_Bool bOldest, Stack* pRejectActions ); 810cdf0e10cSrcweir 811cdf0e10cSrcweir void PutValueToDoc( ScBaseCell*, const String&, 812cdf0e10cSrcweir ScDocument*, SCsCOL nDx, SCsROW nDy ) const; 813cdf0e10cSrcweir 814cdf0e10cSrcweir protected: 815cdf0e10cSrcweir using ScChangeAction::GetRefString; 816cdf0e10cSrcweir 817cdf0e10cSrcweir public: 818cdf0e10cSrcweir 819cdf0e10cSrcweir DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionContent ) 820cdf0e10cSrcweir ScChangeActionContent(const ScRange & rRange)821cdf0e10cSrcweir ScChangeActionContent( const ScRange& rRange ) 822cdf0e10cSrcweir : ScChangeAction( SC_CAT_CONTENT, rRange ), 823cdf0e10cSrcweir pOldCell( NULL ), 824cdf0e10cSrcweir pNewCell( NULL ), 825cdf0e10cSrcweir pNextContent( NULL ), 826cdf0e10cSrcweir pPrevContent( NULL ), 827cdf0e10cSrcweir pNextInSlot( NULL ), 828cdf0e10cSrcweir ppPrevInSlot( NULL ) 829cdf0e10cSrcweir {} 830cdf0e10cSrcweir ScChangeActionContent(const sal_uLong nActionNumber, 831cdf0e10cSrcweir const ScChangeActionState eState, 832cdf0e10cSrcweir const sal_uLong nRejectingNumber, 833cdf0e10cSrcweir const ScBigRange& aBigRange, 834cdf0e10cSrcweir const String& aUser, 835cdf0e10cSrcweir const DateTime& aDateTime, 836cdf0e10cSrcweir const String &sComment, 837cdf0e10cSrcweir ScBaseCell* pOldCell, 838cdf0e10cSrcweir ScDocument* pDoc, 839cdf0e10cSrcweir const String& sOldValue); // to use for XML Import 840cdf0e10cSrcweir ScChangeActionContent(const sal_uLong nActionNumber, 841cdf0e10cSrcweir ScBaseCell* pNewCell, 842cdf0e10cSrcweir const ScBigRange& aBigRange, 843cdf0e10cSrcweir ScDocument* pDoc, 844cdf0e10cSrcweir const String& sNewValue); // to use for XML Import of Generated Actions 845cdf0e10cSrcweir virtual ~ScChangeActionContent(); 846cdf0e10cSrcweir GetNextContent() const847cdf0e10cSrcweir ScChangeActionContent* GetNextContent() const { return pNextContent; } GetPrevContent() const848cdf0e10cSrcweir ScChangeActionContent* GetPrevContent() const { return pPrevContent; } 849cdf0e10cSrcweir ScChangeActionContent* GetTopContent() const; IsTopContent() const850cdf0e10cSrcweir sal_Bool IsTopContent() const 851cdf0e10cSrcweir { return pNextContent == NULL; } 852cdf0e10cSrcweir 853cdf0e10cSrcweir virtual ScChangeActionLinkEntry* GetDeletedIn() const; 854cdf0e10cSrcweir virtual ScChangeActionLinkEntry** GetDeletedInAddress(); 855cdf0e10cSrcweir 856cdf0e10cSrcweir void PutOldValueToDoc( ScDocument*, 857cdf0e10cSrcweir SCsCOL nDx, SCsROW nDy ) const; 858cdf0e10cSrcweir void PutNewValueToDoc( ScDocument*, 859cdf0e10cSrcweir SCsCOL nDx, SCsROW nDy ) const; 860cdf0e10cSrcweir 861cdf0e10cSrcweir void SetOldValue( const ScBaseCell*, 862cdf0e10cSrcweir const ScDocument* pFromDoc, 863cdf0e10cSrcweir ScDocument* pToDoc, 864cdf0e10cSrcweir sal_uLong nFormat ); 865cdf0e10cSrcweir void SetOldValue( const ScBaseCell*, 866cdf0e10cSrcweir const ScDocument* pFromDoc, 867cdf0e10cSrcweir ScDocument* pToDoc ); 868cdf0e10cSrcweir void SetNewValue( const ScBaseCell*, ScDocument* ); 869cdf0e10cSrcweir 870cdf0e10cSrcweir // Used in import filter AppendContentOnTheFly, 871cdf0e10cSrcweir // takes ownership of cells. 872cdf0e10cSrcweir void SetOldNewCells( ScBaseCell* pOldCell, 873cdf0e10cSrcweir sal_uLong nOldFormat, ScBaseCell* pNewCell, 874cdf0e10cSrcweir sal_uLong nNewFormat, ScDocument* pDoc ); 875cdf0e10cSrcweir 876cdf0e10cSrcweir // Use this only in the XML import, 877cdf0e10cSrcweir // takes ownership of cell. 878cdf0e10cSrcweir void SetNewCell( ScBaseCell* pCell, ScDocument* pDoc, const String& rFormatted ); 879cdf0e10cSrcweir 880cdf0e10cSrcweir // These functions should be protected but for 881cdf0e10cSrcweir // the XML import they are public. SetNextContent(ScChangeActionContent * p)882cdf0e10cSrcweir void SetNextContent( ScChangeActionContent* p ) 883cdf0e10cSrcweir { pNextContent = p; } SetPrevContent(ScChangeActionContent * p)884cdf0e10cSrcweir void SetPrevContent( ScChangeActionContent* p ) 885cdf0e10cSrcweir { pPrevContent = p; } 886cdf0e10cSrcweir 887cdf0e10cSrcweir // moeglichst nicht verwenden, 888cdf0e10cSrcweir // setzt nur String bzw. generiert Formelzelle 889cdf0e10cSrcweir void SetOldValue( const String& rOld, ScDocument* ); 890cdf0e10cSrcweir void SetNewValue( const String& rNew, ScDocument* ); 891cdf0e10cSrcweir 892cdf0e10cSrcweir void GetOldString( String& ) const; 893cdf0e10cSrcweir void GetNewString( String& ) const; GetOldCell() const894cdf0e10cSrcweir const ScBaseCell* GetOldCell() const { return pOldCell; } GetNewCell() const895cdf0e10cSrcweir const ScBaseCell* GetNewCell() const { return pNewCell; } 896cdf0e10cSrcweir virtual void GetDescription( String&, ScDocument*, 897cdf0e10cSrcweir sal_Bool bSplitRange = sal_False, bool bWarning = true ) const; 898cdf0e10cSrcweir virtual void GetRefString( String&, ScDocument*, 899cdf0e10cSrcweir sal_Bool bFlag3D = sal_False ) const; 900cdf0e10cSrcweir 901cdf0e10cSrcweir static ScChangeActionContentCellType GetContentCellType( const ScBaseCell* ); 902cdf0e10cSrcweir 903cdf0e10cSrcweir // NewCell IsMatrixOrigin() const904cdf0e10cSrcweir sal_Bool IsMatrixOrigin() const 905cdf0e10cSrcweir { 906cdf0e10cSrcweir return GetContentCellType( GetNewCell() ) 907cdf0e10cSrcweir == SC_CACCT_MATORG; 908cdf0e10cSrcweir } IsMatrixReference() const909cdf0e10cSrcweir sal_Bool IsMatrixReference() const 910cdf0e10cSrcweir { 911cdf0e10cSrcweir return GetContentCellType( GetNewCell() ) 912cdf0e10cSrcweir == SC_CACCT_MATREF; 913cdf0e10cSrcweir } 914cdf0e10cSrcweir // OldCell IsOldMatrixOrigin() const915cdf0e10cSrcweir sal_Bool IsOldMatrixOrigin() const 916cdf0e10cSrcweir { 917cdf0e10cSrcweir return GetContentCellType( GetOldCell() ) 918cdf0e10cSrcweir == SC_CACCT_MATORG; 919cdf0e10cSrcweir } IsOldMatrixReference() const920cdf0e10cSrcweir sal_Bool IsOldMatrixReference() const 921cdf0e10cSrcweir { 922cdf0e10cSrcweir return GetContentCellType( GetOldCell() ) 923cdf0e10cSrcweir == SC_CACCT_MATREF; 924cdf0e10cSrcweir } 925cdf0e10cSrcweir 926cdf0e10cSrcweir }; 927cdf0e10cSrcweir 928cdf0e10cSrcweir 929cdf0e10cSrcweir // --- ScChangeActionReject ------------------------------------------------- 930cdf0e10cSrcweir 931cdf0e10cSrcweir class Stack; 932cdf0e10cSrcweir 933cdf0e10cSrcweir class ScChangeActionReject : public ScChangeAction 934cdf0e10cSrcweir { 935cdf0e10cSrcweir friend class ScChangeTrack; 936cdf0e10cSrcweir friend class ScChangeActionContent; 937cdf0e10cSrcweir ScChangeActionReject(sal_uLong nReject)938cdf0e10cSrcweir ScChangeActionReject( sal_uLong nReject ) 939cdf0e10cSrcweir : ScChangeAction( SC_CAT_REJECT, ScRange() ) 940cdf0e10cSrcweir { 941cdf0e10cSrcweir SetRejectAction( nReject ); 942cdf0e10cSrcweir SetState( SC_CAS_ACCEPTED ); 943cdf0e10cSrcweir } 944cdf0e10cSrcweir AddContent(ScChangeActionContent *)945cdf0e10cSrcweir virtual void AddContent( ScChangeActionContent* ) {} DeleteCellEntries()946cdf0e10cSrcweir virtual void DeleteCellEntries() {} 947cdf0e10cSrcweir Reject(ScDocument *)948cdf0e10cSrcweir virtual sal_Bool Reject( ScDocument* ) { return sal_False; } 949cdf0e10cSrcweir GetChangeTrack() const950cdf0e10cSrcweir virtual const ScChangeTrack* GetChangeTrack() const { return 0; } 951cdf0e10cSrcweir 952cdf0e10cSrcweir public: 953cdf0e10cSrcweir ScChangeActionReject(const sal_uLong nActionNumber, 954cdf0e10cSrcweir const ScChangeActionState eState, 955cdf0e10cSrcweir const sal_uLong nRejectingNumber, 956cdf0e10cSrcweir const ScBigRange& aBigRange, 957cdf0e10cSrcweir const String& aUser, 958cdf0e10cSrcweir const DateTime& aDateTime, 959cdf0e10cSrcweir const String &sComment); // only to use in the XML import 960cdf0e10cSrcweir }; 961cdf0e10cSrcweir 962cdf0e10cSrcweir 963cdf0e10cSrcweir // --- ScChangeTrack -------------------------------------------------------- 964cdf0e10cSrcweir 965cdf0e10cSrcweir enum ScChangeTrackMsgType 966cdf0e10cSrcweir { 967cdf0e10cSrcweir SC_CTM_NONE, 968cdf0e10cSrcweir SC_CTM_APPEND, // Actions angehaengt 969cdf0e10cSrcweir SC_CTM_REMOVE, // Actions weggenommen 970cdf0e10cSrcweir SC_CTM_CHANGE, // Actions geaendert 971cdf0e10cSrcweir SC_CTM_PARENT // war kein Parent und ist jetzt einer 972cdf0e10cSrcweir }; 973cdf0e10cSrcweir 974cdf0e10cSrcweir struct ScChangeTrackMsgInfo 975cdf0e10cSrcweir { 976cdf0e10cSrcweir DECL_FIXEDMEMPOOL_NEWDEL( ScChangeTrackMsgInfo ) 977cdf0e10cSrcweir 978cdf0e10cSrcweir ScChangeTrackMsgType eMsgType; 979cdf0e10cSrcweir sal_uLong nStartAction; 980cdf0e10cSrcweir sal_uLong nEndAction; 981cdf0e10cSrcweir }; 982cdf0e10cSrcweir 983cdf0e10cSrcweir // MsgQueue fuer Benachrichtigung via ModifiedLink 984cdf0e10cSrcweir DECLARE_QUEUE( ScChangeTrackMsgQueue, ScChangeTrackMsgInfo* ) 985cdf0e10cSrcweir DECLARE_STACK( ScChangeTrackMsgStack, ScChangeTrackMsgInfo* ) 986cdf0e10cSrcweir 987cdf0e10cSrcweir enum ScChangeTrackMergeState 988cdf0e10cSrcweir { 989cdf0e10cSrcweir SC_CTMS_NONE, 990cdf0e10cSrcweir SC_CTMS_PREPARE, 991cdf0e10cSrcweir SC_CTMS_OWN, 992cdf0e10cSrcweir SC_CTMS_UNDO, 993cdf0e10cSrcweir SC_CTMS_OTHER 994cdf0e10cSrcweir }; 995cdf0e10cSrcweir 996cdf0e10cSrcweir // zusaetzlich zu pFirst/pNext/pLast/pPrev eine Table, um schnell sowohl 997cdf0e10cSrcweir // per ActionNumber als auch ueber Liste zugreifen zu koennen 998cdf0e10cSrcweir DECLARE_TABLE( ScChangeActionTable, ScChangeAction* ) 999cdf0e10cSrcweir 1000cdf0e10cSrcweir // Intern generierte Actions beginnen bei diesem Wert (fast alle Bits gesetzt) 1001cdf0e10cSrcweir // und werden runtergezaehlt, um sich in einer Table wertemaessig nicht mit den 1002cdf0e10cSrcweir // "normalen" Actions in die Quere zu kommen. 1003cdf0e10cSrcweir #define SC_CHGTRACK_GENERATED_START ((sal_uInt32) 0xfffffff0) 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir class ScChangeTrack : public utl::ConfigurationListener 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir friend void ScChangeAction::RejectRestoreContents( ScChangeTrack*, SCsCOL, SCsROW ); 1008cdf0e10cSrcweir friend sal_Bool ScChangeActionDel::Reject( ScDocument* pDoc ); 1009cdf0e10cSrcweir friend void ScChangeActionDel::DeleteCellEntries(); 1010cdf0e10cSrcweir friend void ScChangeActionMove::DeleteCellEntries(); 1011cdf0e10cSrcweir friend sal_Bool ScChangeActionMove::Reject( ScDocument* pDoc ); 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir static const SCROW nContentRowsPerSlot; 1014cdf0e10cSrcweir static const SCSIZE nContentSlots; 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir com::sun::star::uno::Sequence< sal_Int8 > aProtectPass; 1017cdf0e10cSrcweir ScChangeActionTable aTable; 1018cdf0e10cSrcweir ScChangeActionTable aGeneratedTable; 1019cdf0e10cSrcweir ScChangeActionTable aPasteCutTable; 1020cdf0e10cSrcweir ScChangeTrackMsgQueue aMsgQueue; 1021cdf0e10cSrcweir ScChangeTrackMsgStack aMsgStackTmp; 1022cdf0e10cSrcweir ScChangeTrackMsgStack aMsgStackFinal; 1023cdf0e10cSrcweir ScStrCollection aUserCollection; 1024cdf0e10cSrcweir String aUser; 1025cdf0e10cSrcweir Link aModifiedLink; 1026cdf0e10cSrcweir ScRange aInDeleteRange; 1027cdf0e10cSrcweir DateTime aFixDateTime; 1028cdf0e10cSrcweir ScChangeAction* pFirst; 1029cdf0e10cSrcweir ScChangeAction* pLast; 1030cdf0e10cSrcweir ScChangeActionContent* pFirstGeneratedDelContent; 1031cdf0e10cSrcweir ScChangeActionContent** ppContentSlots; 1032cdf0e10cSrcweir ScChangeActionMove* pLastCutMove; 1033cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkInsertCol; 1034cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkInsertRow; 1035cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkInsertTab; 1036cdf0e10cSrcweir ScChangeActionLinkEntry* pLinkMove; 1037cdf0e10cSrcweir ScChangeTrackMsgInfo* pBlockModifyMsg; 1038cdf0e10cSrcweir ScDocument* pDoc; 1039cdf0e10cSrcweir sal_uLong nActionMax; 1040cdf0e10cSrcweir sal_uLong nGeneratedMin; 1041cdf0e10cSrcweir sal_uLong nMarkLastSaved; 1042cdf0e10cSrcweir sal_uLong nStartLastCut; 1043cdf0e10cSrcweir sal_uLong nEndLastCut; 1044cdf0e10cSrcweir sal_uLong nLastMerge; 1045cdf0e10cSrcweir ScChangeTrackMergeState eMergeState; 1046cdf0e10cSrcweir sal_uInt16 nLoadedFileFormatVersion; 1047cdf0e10cSrcweir sal_Bool bLoadSave; 1048cdf0e10cSrcweir sal_Bool bInDelete; 1049cdf0e10cSrcweir sal_Bool bInDeleteUndo; 1050cdf0e10cSrcweir sal_Bool bInDeleteTop; 1051cdf0e10cSrcweir sal_Bool bInPasteCut; 1052cdf0e10cSrcweir sal_Bool bUseFixDateTime; 1053cdf0e10cSrcweir sal_Bool bTime100thSeconds; 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir // not implemented, prevent usage 1056cdf0e10cSrcweir ScChangeTrack( const ScChangeTrack& ); 1057cdf0e10cSrcweir ScChangeTrack& operator=( const ScChangeTrack& ); 1058cdf0e10cSrcweir 1059cdf0e10cSrcweir #ifdef SC_CHGTRACK_CXX 1060cdf0e10cSrcweir static SCROW InitContentRowsPerSlot(); 1061cdf0e10cSrcweir 1062cdf0e10cSrcweir // sal_True if one is MM_FORMULA and the other is 1063cdf0e10cSrcweir // not, or if both are and range differs 1064cdf0e10cSrcweir static sal_Bool IsMatrixFormulaRangeDifferent( 1065cdf0e10cSrcweir const ScBaseCell* pOldCell, 1066cdf0e10cSrcweir const ScBaseCell* pNewCell ); 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir void Init(); 1069cdf0e10cSrcweir void DtorClear(); SetLoadSave(sal_Bool bVal)1070cdf0e10cSrcweir void SetLoadSave( sal_Bool bVal ) { bLoadSave = bVal; } SetInDeleteRange(const ScRange & rRange)1071cdf0e10cSrcweir void SetInDeleteRange( const ScRange& rRange ) 1072cdf0e10cSrcweir { aInDeleteRange = rRange; } SetInDelete(sal_Bool bVal)1073cdf0e10cSrcweir void SetInDelete( sal_Bool bVal ) 1074cdf0e10cSrcweir { bInDelete = bVal; } SetInDeleteTop(sal_Bool bVal)1075cdf0e10cSrcweir void SetInDeleteTop( sal_Bool bVal ) 1076cdf0e10cSrcweir { bInDeleteTop = bVal; } SetInDeleteUndo(sal_Bool bVal)1077cdf0e10cSrcweir void SetInDeleteUndo( sal_Bool bVal ) 1078cdf0e10cSrcweir { bInDeleteUndo = bVal; } SetInPasteCut(sal_Bool bVal)1079cdf0e10cSrcweir void SetInPasteCut( sal_Bool bVal ) 1080cdf0e10cSrcweir { bInPasteCut = bVal; } SetMergeState(ScChangeTrackMergeState eState)1081cdf0e10cSrcweir void SetMergeState( ScChangeTrackMergeState eState ) 1082cdf0e10cSrcweir { eMergeState = eState; } GetMergeState() const1083cdf0e10cSrcweir ScChangeTrackMergeState GetMergeState() const { return eMergeState; } SetLastMerge(sal_uLong nVal)1084cdf0e10cSrcweir void SetLastMerge( sal_uLong nVal ) { nLastMerge = nVal; } GetLastMerge() const1085cdf0e10cSrcweir sal_uLong GetLastMerge() const { return nLastMerge; } 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir void SetLastCutMoveRange( const ScRange&, ScDocument* ); 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir // ModifyMsg blockweise und nicht einzeln erzeugen 1090cdf0e10cSrcweir void StartBlockModify( ScChangeTrackMsgType, 1091cdf0e10cSrcweir sal_uLong nStartAction ); 1092cdf0e10cSrcweir void EndBlockModify( sal_uLong nEndAction ); 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir void AddDependentWithNotify( ScChangeAction* pParent, 1095cdf0e10cSrcweir ScChangeAction* pDependent ); 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir void Dependencies( ScChangeAction* ); 1098cdf0e10cSrcweir void UpdateReference( ScChangeAction*, sal_Bool bUndo ); 1099cdf0e10cSrcweir void UpdateReference( ScChangeAction** ppFirstAction, 1100cdf0e10cSrcweir ScChangeAction* pAct, sal_Bool bUndo ); 1101cdf0e10cSrcweir void Append( ScChangeAction* pAppend, sal_uLong nAction ); 1102cdf0e10cSrcweir SC_DLLPUBLIC void AppendDeleteRange( const ScRange&, 1103cdf0e10cSrcweir ScDocument* pRefDoc, SCsTAB nDz, 1104cdf0e10cSrcweir sal_uLong nRejectingInsert ); 1105cdf0e10cSrcweir void AppendOneDeleteRange( const ScRange& rOrgRange, 1106cdf0e10cSrcweir ScDocument* pRefDoc, 1107cdf0e10cSrcweir SCsCOL nDx, SCsROW nDy, SCsTAB nDz, 1108cdf0e10cSrcweir sal_uLong nRejectingInsert ); 1109cdf0e10cSrcweir void LookUpContents( const ScRange& rOrgRange, 1110cdf0e10cSrcweir ScDocument* pRefDoc, 1111cdf0e10cSrcweir SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); 1112cdf0e10cSrcweir void Remove( ScChangeAction* ); 1113cdf0e10cSrcweir void MasterLinks( ScChangeAction* ); 1114cdf0e10cSrcweir 1115cdf0e10cSrcweir // Content on top an Position 1116cdf0e10cSrcweir ScChangeActionContent* SearchContentAt( const ScBigAddress&, 1117cdf0e10cSrcweir ScChangeAction* pButNotThis ) const; 1118cdf0e10cSrcweir void DeleteGeneratedDelContent( 1119cdf0e10cSrcweir ScChangeActionContent* ); 1120cdf0e10cSrcweir ScChangeActionContent* GenerateDelContent( const ScAddress&, 1121cdf0e10cSrcweir const ScBaseCell*, 1122cdf0e10cSrcweir const ScDocument* pFromDoc ); 1123cdf0e10cSrcweir void DeleteCellEntries( 1124cdf0e10cSrcweir ScChangeActionCellListEntry*&, 1125cdf0e10cSrcweir ScChangeAction* pDeletor ); 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir // Action und alle abhaengigen rejecten, 1128cdf0e10cSrcweir // Table stammt aus vorherigem GetDependents, 1129cdf0e10cSrcweir // ist nur bei Insert und Move (MasterType) 1130cdf0e10cSrcweir // noetig, kann ansonsten NULL sein. 1131cdf0e10cSrcweir // bRecursion == Aufruf aus Reject mit Table 1132cdf0e10cSrcweir sal_Bool Reject( ScChangeAction*, 1133cdf0e10cSrcweir ScChangeActionTable*, sal_Bool bRecursion ); 1134cdf0e10cSrcweir 1135cdf0e10cSrcweir #endif // SC_CHGTRACK_CXX 1136cdf0e10cSrcweir 1137cdf0e10cSrcweir void ClearMsgQueue(); 1138cdf0e10cSrcweir virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir public: 1141cdf0e10cSrcweir ComputeContentSlot(sal_Int32 nRow)1142cdf0e10cSrcweir static SCSIZE ComputeContentSlot( sal_Int32 nRow ) 1143cdf0e10cSrcweir { 1144cdf0e10cSrcweir if ( nRow < 0 || nRow > MAXROW ) 1145cdf0e10cSrcweir return nContentSlots - 1; 1146cdf0e10cSrcweir return static_cast< SCSIZE >( nRow / nContentRowsPerSlot ); 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir SC_DLLPUBLIC ScChangeTrack( ScDocument* ); 1150cdf0e10cSrcweir ScChangeTrack( ScDocument*, 1151cdf0e10cSrcweir const ScStrCollection& ); // only to use in the XML import 1152cdf0e10cSrcweir SC_DLLPUBLIC virtual ~ScChangeTrack(); 1153cdf0e10cSrcweir void Clear(); 1154cdf0e10cSrcweir GetFirstGenerated() const1155cdf0e10cSrcweir ScChangeActionContent* GetFirstGenerated() const { return pFirstGeneratedDelContent; } GetFirst() const1156cdf0e10cSrcweir ScChangeAction* GetFirst() const { return pFirst; } GetLast() const1157cdf0e10cSrcweir ScChangeAction* GetLast() const { return pLast; } GetActionMax() const1158cdf0e10cSrcweir sal_uLong GetActionMax() const { return nActionMax; } IsGenerated(sal_uLong nAction) const1159cdf0e10cSrcweir sal_Bool IsGenerated( sal_uLong nAction ) const 1160cdf0e10cSrcweir { return nAction >= nGeneratedMin; } GetAction(sal_uLong nAction) const1161cdf0e10cSrcweir ScChangeAction* GetAction( sal_uLong nAction ) const 1162cdf0e10cSrcweir { return aTable.Get( nAction ); } GetGenerated(sal_uLong nGenerated) const1163cdf0e10cSrcweir ScChangeAction* GetGenerated( sal_uLong nGenerated ) const 1164cdf0e10cSrcweir { return aGeneratedTable.Get( nGenerated ); } GetActionOrGenerated(sal_uLong nAction) const1165cdf0e10cSrcweir ScChangeAction* GetActionOrGenerated( sal_uLong nAction ) const 1166cdf0e10cSrcweir { 1167cdf0e10cSrcweir return IsGenerated( nAction ) ? 1168cdf0e10cSrcweir GetGenerated( nAction ) : 1169cdf0e10cSrcweir GetAction( nAction ); 1170cdf0e10cSrcweir } GetLastSavedActionNumber() const1171cdf0e10cSrcweir sal_uLong GetLastSavedActionNumber() const 1172cdf0e10cSrcweir { return nMarkLastSaved; } SetLastSavedActionNumber(sal_uLong nNew)1173cdf0e10cSrcweir void SetLastSavedActionNumber(sal_uLong nNew) 1174cdf0e10cSrcweir { nMarkLastSaved = nNew; } GetLastSaved() const1175cdf0e10cSrcweir ScChangeAction* GetLastSaved() const 1176cdf0e10cSrcweir { return aTable.Get( nMarkLastSaved ); } GetContentSlots() const1177cdf0e10cSrcweir ScChangeActionContent** GetContentSlots() const { return ppContentSlots; } 1178cdf0e10cSrcweir IsLoadSave() const1179cdf0e10cSrcweir sal_Bool IsLoadSave() const { return bLoadSave; } GetInDeleteRange() const1180cdf0e10cSrcweir const ScRange& GetInDeleteRange() const 1181cdf0e10cSrcweir { return aInDeleteRange; } IsInDelete() const1182cdf0e10cSrcweir sal_Bool IsInDelete() const { return bInDelete; } IsInDeleteTop() const1183cdf0e10cSrcweir sal_Bool IsInDeleteTop() const { return bInDeleteTop; } IsInDeleteUndo() const1184cdf0e10cSrcweir sal_Bool IsInDeleteUndo() const { return bInDeleteUndo; } IsInPasteCut() const1185cdf0e10cSrcweir sal_Bool IsInPasteCut() const { return bInPasteCut; } 1186cdf0e10cSrcweir SC_DLLPUBLIC void SetUser( const String& ); GetUser() const1187cdf0e10cSrcweir const String& GetUser() const { return aUser; } GetUserCollection() const1188cdf0e10cSrcweir const ScStrCollection& GetUserCollection() const 1189cdf0e10cSrcweir { return aUserCollection; } GetDocument() const1190cdf0e10cSrcweir ScDocument* GetDocument() const { return pDoc; } 1191cdf0e10cSrcweir // for import filter GetFixDateTime() const1192cdf0e10cSrcweir const DateTime& GetFixDateTime() const { return aFixDateTime; } 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir // set this if the date/time set with 1195cdf0e10cSrcweir // SetFixDateTime...() shall be applied to 1196cdf0e10cSrcweir // appended actions SetUseFixDateTime(sal_Bool bVal)1197cdf0e10cSrcweir void SetUseFixDateTime( sal_Bool bVal ) 1198cdf0e10cSrcweir { bUseFixDateTime = bVal; } 1199cdf0e10cSrcweir // for MergeDocument, apply original date/time as UTC SetFixDateTimeUTC(const DateTime & rDT)1200cdf0e10cSrcweir void SetFixDateTimeUTC( const DateTime& rDT ) 1201cdf0e10cSrcweir { aFixDateTime = rDT; } 1202cdf0e10cSrcweir // for import filter, apply original date/time as local time SetFixDateTimeLocal(const DateTime & rDT)1203cdf0e10cSrcweir void SetFixDateTimeLocal( const DateTime& rDT ) 1204cdf0e10cSrcweir { aFixDateTime = rDT; aFixDateTime.ConvertToUTC(); } 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir void Append( ScChangeAction* ); 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir // pRefDoc may be NULL => no lookup of contents 1209cdf0e10cSrcweir // => no generation of deleted contents 1210cdf0e10cSrcweir SC_DLLPUBLIC void AppendDeleteRange( const ScRange&, 1211cdf0e10cSrcweir ScDocument* pRefDoc, 1212cdf0e10cSrcweir sal_uLong& nStartAction, sal_uLong& nEndAction, 1213cdf0e10cSrcweir SCsTAB nDz = 0 ); 1214cdf0e10cSrcweir // nDz: Multi-TabDel, LookUpContent ist 1215cdf0e10cSrcweir // um -nDz verschoben zu suchen 1216cdf0e10cSrcweir 1217cdf0e10cSrcweir // nachdem neuer Wert im Dokument gesetzt wurde, 1218cdf0e10cSrcweir // alter Wert aus RefDoc/UndoDoc 1219cdf0e10cSrcweir void AppendContent( const ScAddress& rPos, 1220cdf0e10cSrcweir ScDocument* pRefDoc ); 1221cdf0e10cSrcweir // nachdem neue Werte im Dokument gesetzt wurden, 1222cdf0e10cSrcweir // alte Werte aus RefDoc/UndoDoc 1223cdf0e10cSrcweir void AppendContentRange( const ScRange& rRange, 1224cdf0e10cSrcweir ScDocument* pRefDoc, 1225cdf0e10cSrcweir sal_uLong& nStartAction, sal_uLong& nEndAction, 1226cdf0e10cSrcweir ScChangeActionClipMode eMode = SC_CACM_NONE ); 1227cdf0e10cSrcweir // nachdem neuer Wert im Dokument gesetzt wurde, 1228cdf0e10cSrcweir // alter Wert aus pOldCell, nOldFormat, 1229cdf0e10cSrcweir // RefDoc==NULL => Doc 1230cdf0e10cSrcweir void AppendContent( const ScAddress& rPos, 1231cdf0e10cSrcweir const ScBaseCell* pOldCell, 1232cdf0e10cSrcweir sal_uLong nOldFormat, ScDocument* pRefDoc = NULL ); 1233cdf0e10cSrcweir // nachdem neuer Wert im Dokument gesetzt wurde, 1234cdf0e10cSrcweir // alter Wert aus pOldCell, Format aus Doc 1235cdf0e10cSrcweir void AppendContent( const ScAddress& rPos, 1236cdf0e10cSrcweir const ScBaseCell* pOldCell ); 1237cdf0e10cSrcweir // nachdem neue Werte im Dokument gesetzt wurden, 1238cdf0e10cSrcweir // alte Werte aus RefDoc/UndoDoc. 1239cdf0e10cSrcweir // Alle Contents, wo im RefDoc eine Zelle steht. 1240cdf0e10cSrcweir void AppendContentsIfInRefDoc( ScDocument* pRefDoc, 1241cdf0e10cSrcweir sal_uLong& nStartAction, sal_uLong& nEndAction ); 1242cdf0e10cSrcweir 1243cdf0e10cSrcweir // Meant for import filter, creates and inserts 1244cdf0e10cSrcweir // an unconditional content action of the two 1245cdf0e10cSrcweir // cells without querying the document, not 1246cdf0e10cSrcweir // even for number formats (though the number 1247cdf0e10cSrcweir // formatter of the document may be used). 1248cdf0e10cSrcweir // The action is returned and may be used to 1249cdf0e10cSrcweir // set user name, description, date/time et al. 1250cdf0e10cSrcweir // Takes ownership of the cells! 1251cdf0e10cSrcweir SC_DLLPUBLIC ScChangeActionContent* AppendContentOnTheFly( const ScAddress& rPos, 1252cdf0e10cSrcweir ScBaseCell* pOldCell, 1253cdf0e10cSrcweir ScBaseCell* pNewCell, 1254cdf0e10cSrcweir sal_uLong nOldFormat = 0, 1255cdf0e10cSrcweir sal_uLong nNewFormat = 0 ); 1256cdf0e10cSrcweir 1257cdf0e10cSrcweir // die folgenden beiden nur benutzen wenn's 1258cdf0e10cSrcweir // nicht anders geht (setzen nur String fuer 1259cdf0e10cSrcweir // NewValue bzw. Formelerzeugung) 1260cdf0e10cSrcweir 1261cdf0e10cSrcweir // bevor neuer Wert im Dokument gesetzt wird 1262cdf0e10cSrcweir void AppendContent( const ScAddress& rPos, 1263cdf0e10cSrcweir const String& rNewValue, 1264cdf0e10cSrcweir ScBaseCell* pOldCell ); 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir SC_DLLPUBLIC void AppendInsert( const ScRange& ); 1267cdf0e10cSrcweir 1268cdf0e10cSrcweir // pRefDoc may be NULL => no lookup of contents 1269cdf0e10cSrcweir // => no generation of deleted contents 1270cdf0e10cSrcweir SC_DLLPUBLIC void AppendMove( const ScRange& rFromRange, 1271cdf0e10cSrcweir const ScRange& rToRange, 1272cdf0e10cSrcweir ScDocument* pRefDoc ); 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir // Cut to Clipboard ResetLastCut()1275cdf0e10cSrcweir void ResetLastCut() 1276cdf0e10cSrcweir { 1277cdf0e10cSrcweir nStartLastCut = nEndLastCut = 0; 1278cdf0e10cSrcweir if ( pLastCutMove ) 1279cdf0e10cSrcweir { 1280cdf0e10cSrcweir delete pLastCutMove; 1281cdf0e10cSrcweir pLastCutMove = NULL; 1282cdf0e10cSrcweir } 1283cdf0e10cSrcweir } HasLastCut() const1284cdf0e10cSrcweir sal_Bool HasLastCut() const 1285cdf0e10cSrcweir { 1286cdf0e10cSrcweir return nEndLastCut > 0 && 1287cdf0e10cSrcweir nStartLastCut <= nEndLastCut && 1288cdf0e10cSrcweir pLastCutMove; 1289cdf0e10cSrcweir } 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir SC_DLLPUBLIC void Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge = false ); 1292cdf0e10cSrcweir 1293cdf0e10cSrcweir // fuer MergeDocument, Referenzen anpassen, 1294cdf0e10cSrcweir //! darf nur in einem temporaer geoeffneten 1295cdf0e10cSrcweir //! Dokument verwendet werden, der Track 1296cdf0e10cSrcweir //! ist danach verhunzt 1297cdf0e10cSrcweir void MergePrepare( ScChangeAction* pFirstMerge, bool bShared = false ); 1298cdf0e10cSrcweir void MergeOwn( ScChangeAction* pAct, sal_uLong nFirstMerge, bool bShared = false ); 1299cdf0e10cSrcweir static sal_Bool MergeIgnore( const ScChangeAction&, sal_uLong nFirstMerge ); 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir // Abhaengige in Table einfuegen. 1302cdf0e10cSrcweir // Bei Insert sind es echte Abhaengige, 1303cdf0e10cSrcweir // bei Move abhaengige Contents im FromRange 1304cdf0e10cSrcweir // und geloeschte im ToRange bzw. Inserts in 1305cdf0e10cSrcweir // FromRange oder ToRange, 1306cdf0e10cSrcweir // bei Delete eine Liste der geloeschten, 1307cdf0e10cSrcweir // bei Content andere Contents an gleicher 1308cdf0e10cSrcweir // Position oder MatrixReferences zu MatrixOrigin. 1309cdf0e10cSrcweir // Mit bListMasterDelete werden unter einem 1310cdf0e10cSrcweir // MasterDelete alle zu diesem Delete gehoerenden 1311cdf0e10cSrcweir // Deletes einer Reihe gelistet. 1312cdf0e10cSrcweir // Mit bAllFlat werden auch alle Abhaengigen 1313cdf0e10cSrcweir // der Abhaengigen flach eingefuegt. 1314cdf0e10cSrcweir SC_DLLPUBLIC void GetDependents( ScChangeAction*, 1315cdf0e10cSrcweir ScChangeActionTable&, 1316cdf0e10cSrcweir sal_Bool bListMasterDelete = sal_False, 1317cdf0e10cSrcweir sal_Bool bAllFlat = sal_False ) const; 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir // Reject visible Action (und abhaengige) 1320cdf0e10cSrcweir sal_Bool Reject( ScChangeAction*, bool bShared = false ); 1321cdf0e10cSrcweir 1322cdf0e10cSrcweir // Accept visible Action (und abhaengige) 1323cdf0e10cSrcweir SC_DLLPUBLIC sal_Bool Accept( ScChangeAction* ); 1324cdf0e10cSrcweir 1325cdf0e10cSrcweir void AcceptAll(); // alle Virgins 1326cdf0e10cSrcweir sal_Bool RejectAll(); // alle Virgins 1327cdf0e10cSrcweir 1328cdf0e10cSrcweir // Selektiert einen Content von mehreren an 1329cdf0e10cSrcweir // gleicher Position und akzeptiert diesen und 1330cdf0e10cSrcweir // die aelteren, rejected die neueren. 1331cdf0e10cSrcweir // Mit bOldest==sal_True wird der erste OldValue 1332cdf0e10cSrcweir // einer Virgin-Content-Kette restauriert. 1333cdf0e10cSrcweir sal_Bool SelectContent( ScChangeAction*, 1334cdf0e10cSrcweir sal_Bool bOldest = sal_False ); 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir // wenn ModifiedLink gesetzt, landen 1337cdf0e10cSrcweir // Aenderungen in ScChangeTrackMsgQueue SetModifiedLink(const Link & r)1338cdf0e10cSrcweir void SetModifiedLink( const Link& r ) 1339cdf0e10cSrcweir { aModifiedLink = r; ClearMsgQueue(); } GetModifiedLink() const1340cdf0e10cSrcweir const Link& GetModifiedLink() const { return aModifiedLink; } GetMsgQueue()1341cdf0e10cSrcweir ScChangeTrackMsgQueue& GetMsgQueue() { return aMsgQueue; } 1342cdf0e10cSrcweir 1343cdf0e10cSrcweir void NotifyModified( ScChangeTrackMsgType eMsgType, 1344cdf0e10cSrcweir sal_uLong nStartAction, sal_uLong nEndAction ); 1345cdf0e10cSrcweir GetLoadedFileFormatVersion() const1346cdf0e10cSrcweir sal_uInt16 GetLoadedFileFormatVersion() const 1347cdf0e10cSrcweir { return nLoadedFileFormatVersion; } 1348cdf0e10cSrcweir 1349cdf0e10cSrcweir sal_uLong AddLoadedGenerated(ScBaseCell* pOldCell, 1350cdf0e10cSrcweir const ScBigRange& aBigRange, const String& sNewValue ); // only to use in the XML import 1351cdf0e10cSrcweir void AppendLoaded( ScChangeAction* pAppend ); // this is only for the XML import public, it should be protected SetActionMax(sal_uLong nTempActionMax)1352cdf0e10cSrcweir void SetActionMax(sal_uLong nTempActionMax) 1353cdf0e10cSrcweir { nActionMax = nTempActionMax; } // only to use in the XML import 1354cdf0e10cSrcweir SetProtection(const com::sun::star::uno::Sequence<sal_Int8> & rPass)1355cdf0e10cSrcweir void SetProtection( const com::sun::star::uno::Sequence< sal_Int8 >& rPass ) 1356cdf0e10cSrcweir { aProtectPass = rPass; } GetProtection() const1357cdf0e10cSrcweir com::sun::star::uno::Sequence< sal_Int8 > GetProtection() const 1358cdf0e10cSrcweir { return aProtectPass; } IsProtected() const1359cdf0e10cSrcweir sal_Bool IsProtected() const 1360cdf0e10cSrcweir { return aProtectPass.getLength() != 0; } 1361cdf0e10cSrcweir 1362cdf0e10cSrcweir // If time stamps of actions of this 1363cdf0e10cSrcweir // ChangeTrack and a second one are to be 1364cdf0e10cSrcweir // compared including 100th seconds. SetTime100thSeconds(sal_Bool bVal)1365cdf0e10cSrcweir void SetTime100thSeconds( sal_Bool bVal ) 1366cdf0e10cSrcweir { bTime100thSeconds = bVal; } IsTime100thSeconds() const1367cdf0e10cSrcweir sal_Bool IsTime100thSeconds() const 1368cdf0e10cSrcweir { return bTime100thSeconds; } 1369cdf0e10cSrcweir 1370cdf0e10cSrcweir void AppendCloned( ScChangeAction* pAppend ); 1371cdf0e10cSrcweir SC_DLLPUBLIC ScChangeTrack* Clone( ScDocument* pDocument ) const; 1372cdf0e10cSrcweir void MergeActionState( ScChangeAction* pAct, const ScChangeAction* pOtherAct ); 1373cdf0e10cSrcweir #if DEBUG_CHANGETRACK 1374cdf0e10cSrcweir String ToString() const; 1375cdf0e10cSrcweir #endif // DEBUG_CHANGETRACK 1376cdf0e10cSrcweir }; 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir 1379cdf0e10cSrcweir #endif 1380cdf0e10cSrcweir 1381cdf0e10cSrcweir 1382