diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-03-02 14:19:13 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-03-02 14:19:13 +0000 |
commit | 07b0c01857137de7e4bd02375e7c892d622d270e (patch) | |
tree | ca4599cb8c96535139e3e0ee07acb37bcb5ad636 /sc/inc | |
parent | 74e4b152bbe46cf55cec4da21b9365363ec2fa8d (diff) |
CWS-TOOLING: integrate CWS dr66
2009-01-22 15:51:40 +0100 dr r266730 : #i98028# moved to CWS dr66
2009-01-22 15:50:28 +0100 dr r266729 : #i98028# moved to CWS dr66
2009-01-20 16:25:49 +0100 dr r266595 : #i98282# resolve palette colors while loading chart gradients (convert back to unx lineends...)
2009-01-20 16:23:19 +0100 dr r266594 : #i98282# resolve palette colors while loading chart gradients
2009-01-19 15:43:57 +0100 dr r266507 : #i97900# move fix to CWS dr66
2009-01-19 15:40:28 +0100 dr r266506 : #i97900# move fix to CWS dr66
2009-01-19 15:20:14 +0100 dr r266505 : #i98141# correctly update note position while switching LTR/RTL mode of sheet
2009-01-06 10:28:02 +0100 dr r265899 : CWS-TOOLING: rebase CWS dr66 to trunk@265758 (milestone: DEV300:m38)
2008-11-13 13:59:02 +0100 dr r263644 : #i10000# merge problems
2008-11-13 13:25:15 +0100 dr r263639 : #i10000# merge problems
2008-11-13 13:22:58 +0100 dr r263638 : #i10000# merge problems
2008-11-13 13:22:25 +0100 dr r263637 : #i10000# merge problems
2008-11-12 13:40:46 +0100 dr r263595 : #i10000# merge problem
2008-11-12 11:34:51 +0100 dr r263583 : CWS-TOOLING: rebase CWS dr66 to trunk@263288 (milestone: DEV300:m35)
2008-11-11 16:58:11 +0100 dr r263568 : CWS-TOOLING: rebase CWS dr66 to trunk@262087 (milestone: DEV300:m33)
2008-10-27 14:38:34 +0100 dr r262675 : migrate CWS dr66 to SVN
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/cell.hxx | 345 | ||||
-rw-r--r-- | sc/inc/column.hxx | 20 | ||||
-rw-r--r-- | sc/inc/detfunc.hxx | 37 | ||||
-rw-r--r-- | sc/inc/dociter.hxx | 9 | ||||
-rw-r--r-- | sc/inc/document.hxx | 27 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 6 | ||||
-rw-r--r-- | sc/inc/drwlayer.hxx | 49 | ||||
-rw-r--r-- | sc/inc/global.hxx | 41 | ||||
-rw-r--r-- | sc/inc/globstr.hrc | 2 | ||||
-rw-r--r-- | sc/inc/notesuno.hxx | 23 | ||||
-rw-r--r-- | sc/inc/postit.hxx | 195 | ||||
-rw-r--r-- | sc/inc/table.hxx | 18 | ||||
-rw-r--r-- | sc/inc/userdat.hxx | 17 |
13 files changed, 414 insertions, 375 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index d0ec651c41ed..708ddbe31ef0 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: cell.hxx,v $ - * $Revision: 1.29.32.5 $ + * $Revision: 1.30.38.4 $ * * This file is part of OpenOffice.org. * @@ -62,42 +62,88 @@ class ScPostIt; class ScMultipleReadHeader; class ScMultipleWriteHeader; -class SC_DLLPUBLIC ScBaseCell -{ -protected: - ScPostIt* pNote; - SvtBroadcaster* pBroadcaster; - USHORT nTextWidth; - BYTE eCellType; // enum CellType - BYTE spart Speicher - BYTE nScriptType; +// ============================================================================ + +/** Default cell clone flags: do not start listening, do not adjust 3D refs to + old position, clone note captions of cell notes. */ +const int SC_CLONECELL_DEFAULT = 0x0000; + +/** If set, cloned formula cells will start to listen to the document. */ +const int SC_CLONECELL_STARTLISTENING = 0x0001; -public: // fuer Idle-Berechnung - USHORT GetTextWidth() const { return nTextWidth; } - void SetTextWidth( USHORT nNew ) { nTextWidth = nNew; } +/** If set, relative 3D references of cloned formula cells will be adjusted to + old position (used while swapping cells for sorting a cell range). */ +const int SC_CLONECELL_ADJUST3DREL = 0x0002; - BYTE GetScriptType() const { return nScriptType; } - void SetScriptType( BYTE nNew ) { nScriptType = nNew; } +/** If set, the caption object of a cell note will not be cloned (used while + copying cells to undo document, where captions are handled in drawing undo). */ +const int SC_CLONECELL_NOCAPTION = 0x0004; +// ============================================================================ + +class SC_DLLPUBLIC ScBaseCell +{ protected: ~ScBaseCell(); // nicht virtuell -> darf nicht direkt aufgerufen werden public: explicit ScBaseCell( CellType eNewType ); - ScBaseCell( const ScBaseCell& rBaseCell, ScDocument* pDoc ); - - ScBaseCell* Clone(ScDocument* pDoc) const; - void Delete(); // simulierter virtueller Destructor - CellType GetCellType() const; - void SetNote( const ScPostIt& rNote ); - BOOL GetNote( ScPostIt& rNote ) const; - inline const ScPostIt* GetNotePtr() const { return pNote; } + /** Base copy constructor. Does NOT clone cell note or broadcaster! */ + ScBaseCell( const ScBaseCell& rCell ); + + /** Returns a clone of this cell at the same position, cell note and + broadcaster will not be cloned. */ + ScBaseCell* CloneWithoutNote( ScDocument& rDestDoc, int nCloneFlags = SC_CLONECELL_DEFAULT ) const; + + /** Returns a clone of this cell for the passed document position, cell + note and broadcaster will not be cloned. */ + ScBaseCell* CloneWithoutNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const; + + /** Returns a clone of this cell, clones cell note and caption object too + (unless SC_CLONECELL_NOCAPTION flag is set). Broadcaster will not be cloned. */ + ScBaseCell* CloneWithNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const; + + /** Due to the fact that ScBaseCell does not have a vtable, this function + deletes the cell by calling the appropriate d'tor of the derived class. */ + void Delete(); + + inline CellType GetCellType() const { return (CellType)eCellType; } + + /** Returns true, if the cell is empty (neither value nor formula nor cell note). + Returns false for formula cells returning nothing, use HasEmptyData() for that. */ + bool IsBlank( bool bIgnoreNotes = false ) const; + +// fuer Idle-Berechnung + inline USHORT GetTextWidth() const { return nTextWidth; } + inline void SetTextWidth( USHORT nNew ) { nTextWidth = nNew; } + + inline BYTE GetScriptType() const { return nScriptType; } + inline void SetScriptType( BYTE nNew ) { nScriptType = nNew; } + + /** Returns true, if the cell contains a note. */ + inline bool HasNote() const { return mpNote != 0; } + /** Returns the pointer to a cell note object (read-only). */ + inline const ScPostIt* GetNote() const { return mpNote; } + /** Returns the pointer to a cell note object. */ + inline ScPostIt* GetNote() { return mpNote; } + /** Takes ownership of the passed cell note object. */ + void TakeNote( ScPostIt* pNote ); + /** Returns and forgets the own cell note object. Caller takes ownership! */ + ScPostIt* ReleaseNote(); + /** Deletes the own cell note object. */ void DeleteNote(); - inline SvtBroadcaster* GetBroadcaster() const; - void SetBroadcaster(SvtBroadcaster* pNew); - inline void ForgetBroadcaster(); - inline void SwapBroadcaster(ScBaseCell& rOther); // zum Sortieren + /** Returns true, if the cell contains a broadcaster. */ + inline bool HasBroadcaster() const { return mpBroadcaster != 0; } + /** Returns the pointer to the cell broadcaster. */ + inline SvtBroadcaster* GetBroadcaster() const { return mpBroadcaster; } + /** Takes ownership of the passed cell broadcaster. */ + void TakeBroadcaster( SvtBroadcaster* pBroadcaster ); + /** Returns and forgets the own cell broadcaster. Caller takes ownership! */ + SvtBroadcaster* ReleaseBroadcaster(); + /** Deletes the own cell broadcaster. */ + void DeleteBroadcaster(); // String- oder EditCell static ScBaseCell* CreateTextCell( const String& rString, ScDocument* ); @@ -118,55 +164,93 @@ public: String GetStringData() const; // nur echte Strings static BOOL CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 ); -}; +private: + ScBaseCell& operator=( const ScBaseCell& ); +private: + ScPostIt* mpNote; /// The cell note. Cell takes ownership! + SvtBroadcaster* mpBroadcaster; /// Broadcaster for changed values. Cell takes ownership! -class SC_DLLPUBLIC ScValueCell : public ScBaseCell +protected: + USHORT nTextWidth; + BYTE eCellType; // enum CellType - BYTE spart Speicher + BYTE nScriptType; +}; + +// ============================================================================ + +class SC_DLLPUBLIC ScNoteCell : public ScBaseCell { +public: +#ifdef USE_MEMPOOL + DECL_FIXEDMEMPOOL_NEWDEL( ScNoteCell ) +#endif + + /** Cell takes ownership of the passed broadcaster. */ + explicit ScNoteCell( SvtBroadcaster* pBC = 0 ); + /** Cell takes ownership of the passed note and broadcaster. */ + explicit ScNoteCell( ScPostIt* pNote, SvtBroadcaster* pBC = 0 ); + +#ifdef DBG_UTIL + ~ScNoteCell(); +#endif + + ScNoteCell( SvStream& rStream, USHORT nVer ); + + void Save( SvStream& rStream ) const; + private: - double aValue; + ScNoteCell( const ScNoteCell& ); +}; -public: +// ============================================================================ +class SC_DLLPUBLIC ScValueCell : public ScBaseCell +{ +public: #ifdef USE_MEMPOOL DECL_FIXEDMEMPOOL_NEWDEL( ScValueCell ) #endif + ScValueCell(); + explicit ScValueCell( double fValue ); + +#ifdef DBG_UTIL ~ScValueCell(); +#endif - ScValueCell(); - ScValueCell( const double& rValue ); - ScValueCell( const ScValueCell& rScValueCell, ScDocument* pDoc ); - ScBaseCell* Clone(ScDocument* pDoc) const; + inline void SetValue( double fValue ) { mfValue = fValue; } + inline double GetValue() const { return mfValue; } - void SetValue( const double& rValue ); - double GetValue() const; +private: + double mfValue; }; +// ============================================================================ class SC_DLLPUBLIC ScStringCell : public ScBaseCell { -private: - String aString; - public: - #ifdef USE_MEMPOOL DECL_FIXEDMEMPOOL_NEWDEL( ScStringCell ) #endif + + ScStringCell(); + explicit ScStringCell( const String& rString ); + #ifdef DBG_UTIL ~ScStringCell(); #endif - ScStringCell(); - ScStringCell( const String& rString ); - ScStringCell( const ScStringCell& rScStringCell, ScDocument* pDoc ); - ScBaseCell* Clone(ScDocument* pDoc) const; + inline void SetString( const String& rString ) { maString = rString; } + inline void GetString( String& rString ) const { rString = maString; } + inline const String& GetString() const { return maString; } - void SetString( const String& rString ); - void GetString( String& rString ) const; +private: + String maString; }; +// ============================================================================ class SC_DLLPUBLIC ScEditCell : public ScBaseCell { @@ -180,7 +264,6 @@ private: // not implemented ScEditCell( const ScEditCell& ); - ScEditCell& operator=( const ScEditCell& ); public: @@ -192,10 +275,9 @@ public: ScEditCell( const EditTextObject* pObject, ScDocument*, const SfxItemPool* pFromPool /* = NULL */ ); - ScEditCell( const ScEditCell& rEditCell, ScDocument* ); + ScEditCell( const ScEditCell& rCell, ScDocument& rDoc ); // fuer Zeilenumbrueche ScEditCell( const String& rString, ScDocument* ); - ScBaseCell* Clone( ScDocument* ) const; void SetData( const EditTextObject* pObject, const SfxItemPool* pFromPool /* = NULL */ ); @@ -205,6 +287,8 @@ public: const EditTextObject* GetData() const { return pData; } }; +// ============================================================================ + enum ScMatrixMode { MM_NONE = 0, // No matrix formula MM_FORMULA = 1, // Upper left matrix formula cell @@ -212,7 +296,6 @@ enum ScMatrixMode { MM_FAKE = 3 // Interpret "as-if" matrix formula (legacy) }; - class ScIndexMap; class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener @@ -248,6 +331,8 @@ private: }; void InterpretTail( ScInterpretTailParameter ); + ScFormulaCell( const ScFormulaCell& ); + public: #ifdef USE_MEMPOOL @@ -273,15 +358,7 @@ public: const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT, BYTE cMatInd = MM_NONE ); - // copy-ctor - // nCopyFlags: 0 := nothing special - // 0x0001 := readjust 3D references to point to old position even if relative - ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, - const ScFormulaCell& rScFormulaCell, USHORT nCopyFlags = 0 ); - - using ScBaseCell::Clone; - ScBaseCell* Clone(ScDocument* pDoc, const ScAddress&, - BOOL bNoListening = FALSE ) const; + ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, int nCloneFlags = SC_CLONECELL_DEFAULT ); void GetFormula( String& rFormula, const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; @@ -420,155 +497,7 @@ public: BOOL GetNextRef( ScRange& rRange ); }; -class ScNoteCell : public ScBaseCell -{ -public: - -#ifdef USE_MEMPOOL - DECL_FIXEDMEMPOOL_NEWDEL( ScNoteCell ) -#endif -#ifdef DBG_UTIL - ~ScNoteCell(); -#endif - - ScNoteCell(); - ScNoteCell( const ScPostIt& rNote ); - ScNoteCell( const ScNoteCell& rScNoteCell, ScDocument* pDoc ); - ScBaseCell* Clone(ScDocument* pDoc) const; -}; - - -// ScBaseCell - -inline CellType ScBaseCell::GetCellType() const -{ - return (CellType)eCellType; -} - -inline SvtBroadcaster* ScBaseCell::GetBroadcaster() const -{ - return pBroadcaster; -} - -inline void ScBaseCell::ForgetBroadcaster() -{ - pBroadcaster = NULL; -} - -inline void ScBaseCell::SwapBroadcaster(ScBaseCell& rOther) -{ - SvtBroadcaster* pTemp = pBroadcaster; - pBroadcaster = rOther.pBroadcaster; - rOther.pBroadcaster = pTemp; -} - -// ScValueCell - -inline ScValueCell::ScValueCell() : - ScBaseCell( CELLTYPE_VALUE ) -{ - aValue = 0.0; -} - -inline ScValueCell::ScValueCell( const double& rValue ) : - ScBaseCell( CELLTYPE_VALUE ) -{ - aValue = rValue; -} - -inline ScValueCell::ScValueCell(const ScValueCell& rScValueCell, ScDocument* pDoc) : - ScBaseCell( rScValueCell, pDoc ), - aValue( rScValueCell.aValue ) -{ -} - -inline ScBaseCell* ScValueCell::Clone(ScDocument* pDoc) const -{ - return new ScValueCell(*this, pDoc); -} - -inline void ScValueCell::SetValue( const double& rValue ) -{ - aValue = rValue; -} - -inline double ScValueCell::GetValue() const -{ - return aValue; -} - - - -// ScStringCell - -inline ScStringCell::ScStringCell() : - ScBaseCell( CELLTYPE_STRING ) -{ -} - -inline ScStringCell::ScStringCell( const ScStringCell& rScStringCell, ScDocument* pDoc ) : - ScBaseCell( rScStringCell, pDoc ), - aString( rScStringCell.aString ) -{ -} - -inline ScStringCell::ScStringCell( const String& rString ) : - ScBaseCell( CELLTYPE_STRING ), - aString( rString.intern() ) -{ -} - -inline ScBaseCell* ScStringCell::Clone(ScDocument* pDoc) const -{ - return new ScStringCell(*this, pDoc); -} - -inline void ScStringCell::GetString( String& rString ) const -{ - rString = aString; -} - -inline void ScStringCell::SetString( const String& rString ) -{ - aString = rString; -} - - -/* - -// ScFormulaCell - -inline ScBaseCell* ScFormulaCell::Clone(ScDocument* pDoc) const -{ - return new ScFormulaCell(pDoc, *this); -} -*/ - - - -// ScNoteCell - -inline ScNoteCell::ScNoteCell() : - ScBaseCell( CELLTYPE_NOTE ) -{ -} - -inline ScNoteCell::ScNoteCell( const ScNoteCell& rScNoteCell, ScDocument* pDoc ) : - ScBaseCell( rScNoteCell, pDoc ) -{ -} - -inline ScNoteCell::ScNoteCell( const ScPostIt& rNote ) : - ScBaseCell( CELLTYPE_NOTE ) -{ - ScBaseCell::SetNote(rNote); -} - -inline ScBaseCell* ScNoteCell::Clone(ScDocument* pDoc) const -{ - return new ScNoteCell(*this, pDoc); -} - +// ============================================================================ #endif diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 6f613943c2ba..fc73c858c69f 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: column.hxx,v $ - * $Revision: 1.21.32.4 $ + * $Revision: 1.21.128.6 $ * * This file is part of OpenOffice.org. * @@ -160,7 +160,7 @@ public: BOOL IsEmpty() const; // nur Daten: - BOOL IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; + BOOL IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes = false) const; SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; BOOL HasDataAt(SCROW nRow) const; BOOL HasVisibleDataAt(SCROW nRow) const; @@ -191,7 +191,7 @@ public: void DeleteRow( SCROW nStartRow, SCSIZE nSize ); void DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, USHORT nDelFlag ); void DeleteArea(SCROW nStartRow, SCROW nEndRow, USHORT nDelFlag ); - void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, BOOL bKeepScenarioFlags); + void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions); void CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy, USHORT nInsFlag, BOOL bAsLink, BOOL bSkipAttrForEmpty, ScColumn& rColumn); void StartListeningInArea( SCROW nRow1, SCROW nRow2 ); @@ -243,7 +243,6 @@ public: BOOL SetString( SCROW nRow, SCTAB nTab, const String& rString, formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO ); void SetValue( SCROW nRow, const double& rVal); - void SetNote( SCROW nRow, const ScPostIt& rNote ); void SetError( SCROW nRow, const USHORT nError); void GetString( SCROW nRow, String& rString ) const; @@ -251,7 +250,6 @@ public: double GetValue( SCROW nRow ) const; void GetFormula( SCROW nRow, String& rFormula, BOOL bAsciiExport = FALSE ) const; - BOOL GetNote( SCROW nRow, ScPostIt& rNote ) const; CellType GetCellType( SCROW nRow ) const; SCSIZE GetCellCount() const { return nCount; } ULONG GetWeightedCount() const; @@ -263,6 +261,15 @@ public: USHORT GetErrorData( SCROW nRow) const; BOOL HasStringCells( SCROW nStartRow, SCROW nEndRow ) const; + /** Returns the pointer to a cell note object at the passed row. */ + ScPostIt* GetNote( SCROW nRow ); + /** Sets the passed cell note object at the passed row. Takes ownership! */ + void TakeNote( SCROW nRow, ScPostIt* pNote ); + /** Returns and forgets a cell note object at the passed row. */ + ScPostIt* ReleaseNote( SCROW nRow ); + /** Deletes the note at the passed row. */ + void DeleteNote( SCROW nRow ); + void SetDirty(); void SetDirty( const ScRange& ); void SetDirtyVar(); @@ -397,8 +404,7 @@ public: SCROW nRowStart, SCROW nRowEnd ) const; private: - ScBaseCell* CloneCell(SCSIZE nIndex, USHORT nFlags, - ScDocument* pDestDoc, const ScAddress& rDestPos); + ScBaseCell* CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos); //UNUSED2008-05 void CorrectSymbolCells( CharSet eStreamCharSet ); }; diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index 4fda448c49c0..edfff3c8dc7c 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: detfunc.hxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.128.6 $ * * This file is part of OpenOffice.org. * @@ -40,6 +40,7 @@ class SdrObject; class SdrPage; class String; +class ScPostIt; class ScCommentData; class ScDetectiveData; class ScDocument; @@ -48,7 +49,7 @@ class ScRange; #define SC_DET_MAXCIRCLE 1000 -enum ScDetectiveDelete { SC_DET_ALL, SC_DET_DETECTIVE, SC_DET_CIRCLES, SC_DET_COMMENTS, SC_DET_ARROWS }; +enum ScDetectiveDelete { SC_DET_ALL, SC_DET_DETECTIVE, SC_DET_CIRCLES, SC_DET_ARROWS }; enum ScDetectiveObjType { @@ -69,6 +70,24 @@ class SC_DLLPUBLIC ScDetectiveFunc ScDocument* pDoc; SCTAB nTab; + enum DrawPosMode + { + DRAWPOS_TOPLEFT, /// Top-left edge of the cell. + DRAWPOS_BOTTOMRIGHT, /// Bottom-right edge of the cell. + DRAWPOS_DETARROW, /// Position inside cell for detective arrows. + DRAWPOS_CAPTIONLEFT, /// Top-left edge of the cell for captions. + DRAWPOS_CAPTIONRIGHT /// Top-right edge of the cell for captions (incl. merged cells). + }; + + /** Returns a drawing layer position for the passed cell address. */ + Point GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const; + + /** Returns the drawing layer rectangle for the passed cell range. */ + Rectangle GetDrawRect( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; + + /** Returns the drawing layer rectangle for the passed cell address. */ + Rectangle GetDrawRect( SCCOL nCol, SCROW nRow ) const; + BOOL HasArrow( const ScAddress& rStart, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab ); @@ -97,11 +116,6 @@ class SC_DLLPUBLIC ScDetectiveFunc void DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData ); - SdrObject* DrawCaption( SCCOL nCol, SCROW nRow, const String& rText, - ScCommentData& rData, SdrPage* pDestPage, - BOOL bHasUserText, BOOL bLeft, - const Rectangle& rVisible ); - USHORT InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, USHORT nLevel ); USHORT InsertPredLevelArea( const ScRange& rRef, ScDetectiveData& rData, USHORT nLevel ); @@ -122,7 +136,6 @@ class SC_DLLPUBLIC ScDetectiveFunc public: ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {} - Point GetDrawPos( SCCOL nCol, SCROW nRow, BOOL bArrow ); BOOL ShowSucc( SCCOL nCol, SCROW nRow ); BOOL ShowPred( SCCOL nCol, SCROW nRow ); BOOL ShowError( SCCOL nCol, SCROW nRow ); @@ -133,13 +146,7 @@ public: BOOL MarkInvalid(BOOL& rOverflow); - SdrObject* ShowComment( SCCOL nCol, SCROW nRow, BOOL bForce, SdrPage* pDestPage = NULL ); - SdrObject* ShowCommentUser( SCCOL nCol, SCROW nRow, const String& rUserText, - const Rectangle& rVisible, BOOL bLeft, - BOOL bForce, SdrPage* pDestPage ); - BOOL HideComment( SCCOL nCol, SCROW nRow ); - - void UpdateAllComments(); // on all tables + static void UpdateAllComments( ScDocument& rDoc ); // on all tables void UpdateAllArrowColors(); // on all tables static BOOL IsNonAlienArrow( SdrObject* pObject ); diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index aaef77ca2ef6..3f9e77a82378 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dociter.hxx,v $ - * $Revision: 1.9.32.2 $ + * $Revision: 1.9.128.1 $ * * This file is part of OpenOffice.org. * @@ -181,9 +181,10 @@ public: const ScRange& rRange, BOOL bSTotal = FALSE); ScBaseCell* GetFirst(); ScBaseCell* GetNext(); - SCCOL GetCol() { return nCol; } - SCROW GetRow() { return nRow; } - SCTAB GetTab() { return nTab; } + SCCOL GetCol() const { return nCol; } + SCROW GetRow() const { return nRow; } + SCTAB GetTab() const { return nTab; } + ScAddress GetPos() const { return ScAddress( nCol, nRow, nTab ); } }; class ScQueryCellIterator // alle nichtleeren Zellen in einem Bereich diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6acd5d630159..78bc75e318dd 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: document.hxx,v $ - * $Revision: 1.111.20.7 $ + * $Revision: 1.115.36.9 $ * * This file is part of OpenOffice.org. * @@ -712,7 +712,6 @@ public: // return TRUE = Zahlformat gesetzt SC_DLLPUBLIC BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ); SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal ); - SC_DLLPUBLIC void SetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPostIt& rNote ); void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError); SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, @@ -741,14 +740,12 @@ public: const ScAddress& rPos, const ScBaseCell* pCell ) const; void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula, BOOL bAsciiExport = FALSE ) const; - BOOL GetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt& rNote); SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const; SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const; SC_DLLPUBLIC void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const; SC_DLLPUBLIC ScBaseCell* GetCell( const ScAddress& rPos ) const; //UNUSED2008-05 void RefreshNoteFlags(); - BOOL HasNoteObject( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; SC_DLLPUBLIC BOOL HasData( SCCOL nCol, SCROW nRow, SCTAB nTab ); SC_DLLPUBLIC BOOL HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; @@ -758,6 +755,17 @@ public: /** Returns true, if there is any data to create a selection list for rPos. */ BOOL HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + /** Returns the pointer to a cell note object at the passed cell address. */ + ScPostIt* GetNote( const ScAddress& rPos ); + /** Sets the passed note at the cell with the passed cell address. */ + void TakeNote( const ScAddress& rPos, ScPostIt*& rpNote ); + /** Returns and forgets the cell note object at the passed cell address. */ + ScPostIt* ReleaseNote( const ScAddress& rPos ); + /** Returns the pointer to an existing or created cell note object at the passed cell address. */ + SC_DLLPUBLIC ScPostIt* GetOrCreateNote( const ScAddress& rPos ); + /** Deletes the note at the passed cell address. */ + void DeleteNote( const ScAddress& rPos ); + BOOL ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark, BOOL bRefresh = FALSE, BOOL bAttrs = FALSE ); @@ -777,11 +785,11 @@ public: SCCOL nEndCol, SCROW nEndRow ); // ohne Ueberpruefung: SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, - SCCOL nEndCol, SCROW nEndRow ); + SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true ); void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab ); BOOL IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, - SCCOL nEndCol, SCROW nEndRow ) const; + SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const; BOOL IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, BOOL bLeftIsEmpty = FALSE, @@ -935,7 +943,9 @@ public: void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, BOOL bCut, ScDocument* pClipDoc, BOOL bAllTabs, const ScMarkData* pMarks = NULL, - BOOL bKeepScenarioFlags = FALSE, BOOL bIncludeObjects = FALSE); + BOOL bKeepScenarioFlags = FALSE, + BOOL bIncludeObjects = FALSE, + BOOL bCloneNoteCaptions = TRUE); void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, ScDocument* pClipDoc = NULL); void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, @@ -1327,9 +1337,6 @@ public: void SetSrcCharSet( CharSet eNew ) { eSrcSet = eNew; } void UpdateFontCharSet(); - SC_DLLPUBLIC friend SvStream& operator>>( SvStream& rStream, ScDocument& rDocument ); - SC_DLLPUBLIC friend SvStream& operator<<( SvStream& rStream, const ScDocument& rDocument ); - void FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, SCTAB nTab, double nScaleX, double nScaleY, BOOL bPageMode, BOOL bFormulaMode, diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index e8048a5b9618..36a152943782 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: docuno.hxx,v $ - * $Revision: 1.27.32.2 $ + * $Revision: 1.27.128.1 $ * * This file is part of OpenOffice.org. * @@ -741,8 +741,8 @@ private: ScDocShell* pDocShell; SCTAB nTab; // Collection haengt am Sheet - BOOL GetAddressByIndex_Impl( ULONG nIndex, ScAddress& rPos ) const; - ScAnnotationObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const; + bool GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos ) const; + ScAnnotationObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const; public: ScAnnotationsObj(ScDocShell* pDocSh, SCTAB nT); diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index 1174571a400c..cf1c151fa05d 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: drwlayer.hxx,v $ - * $Revision: 1.21.32.1 $ + * $Revision: 1.21.128.6 $ * * This file is part of OpenOffice.org. * @@ -32,9 +32,8 @@ #define SC_DRWLAYER_HXX #include <vcl/graph.hxx> -#ifndef _FM_FMMODEL_HXX #include <svx/fmmodel.hxx> -#endif +#include <svx/svdundo.hxx> #include "global.hxx" class ScDocument; @@ -76,9 +75,30 @@ public: }; // ----------------------------------------------------------------------- +// +// Das Anpassen der Detektiv-UserData muss zusammen mit den Draw-Undo's +// in der SdrUndoGroup liegen, darum von SdrUndoAction abgeleitet: +class ScUndoObjData : public SdrUndoObj +{ +private: + ScAddress aOldStt; + ScAddress aOldEnd; + ScAddress aNewStt; + ScAddress aNewEnd; + BOOL bHasNew; +public: + ScUndoObjData( SdrObject* pObj, const ScAddress& rOS, const ScAddress& rOE, + const ScAddress& rNS, const ScAddress& rNE ); + ~ScUndoObjData(); -class SC_DLLPUBLIC ScDrawLayer: public FmFormModel + virtual void Undo(); + virtual void Redo(); +}; + +// ----------------------------------------------------------------------- + +class SC_DLLPUBLIC ScDrawLayer : public FmFormModel { private: //REMOVE SotStorageRef xPictureStorage; @@ -94,7 +114,12 @@ private: const Point& rTopLeft ); void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, SCsCOL nDx,SCsROW nDy ); - void RecalcPos( SdrObject* pObj, ScDrawObjData* pData, BOOL bNegativePage ); + + void RecalcPos( SdrObject* pObj, + const ScDrawObjData& rData, + const ScAddress& rOldStart, + const ScAddress& rOldEnd, + bool bNegativePage ); public: ScDrawLayer( ScDocument* pDocument, const String& rName ); @@ -133,7 +158,7 @@ public: void BeginCalcUndo(); SdrUndoGroup* GetCalcUndo(); - BOOL IsRecording() { return bRecording; } + BOOL IsRecording() const { return bRecording; } void AddCalcUndo( SdrUndoAction* pUndo ); void MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, @@ -146,7 +171,9 @@ public: void DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2 ); void DeleteObjectsInSelection( const ScMarkData& rMark ); +#if 0 void DeleteObjects( SCTAB nTab ); +#endif void CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const Rectangle& rRange ); void CopyFromClip( ScDrawLayer* pClipModel, @@ -159,6 +186,10 @@ public: void MirrorRTL( SdrObject* pObj ); static void MirrorRectRTL( Rectangle& rRect ); // for bounding rectangles etc. + /** Returns the rectangle for the passed cell address in 1/100 mm. + @param bMergedCell True = regards merged cells. False = use single column/row size. */ + static Rectangle GetCellRect( ScDocument& rDoc, const ScAddress& rPos, bool bMergedCell ); + // GetVisibleName: name for navigator etc: GetPersistName or GetName // (ChartListenerCollection etc. must use GetPersistName directly) static String GetVisibleName( SdrObject* pObj ); @@ -181,6 +212,12 @@ public: // sheet on which the object is inserted). static ScDrawObjData* GetObjDataTab( SdrObject* pObj, SCTAB nTab ); + /** Returns true, if the passed object is the caption of a cell note. */ + static bool IsNoteCaption( SdrObject* pObj ); + + /** Returns the object data, if the passed object is a cell note caption. */ + static ScDrawObjData* GetNoteCaptionData( SdrObject* pObj, SCTAB nTab ); + // Image-Map static ScIMapInfo* GetIMapInfo( SdrObject* pObj ); diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 63296c93b96d..45df07deaf6c 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: global.hxx,v $ - * $Revision: 1.53.32.8 $ + * $Revision: 1.53.128.4 $ * * This file is part of OpenOffice.org. * @@ -223,20 +223,24 @@ const BYTE CR_MANUALSIZE = 32; // was davon kommt in die Datei: #define CR_SAVEMASK ( ~CR_PAGEBREAK ) - // Insert-/Delete-Flags -#define IDF_VALUE 0x0001 -#define IDF_DATETIME 0x0002 -#define IDF_STRING 0x0004 -#define IDF_NOTE 0x0008 -#define IDF_FORMULA 0x0010 -#define IDF_HARDATTR 0x0020 -#define IDF_STYLES 0x0040 -#define IDF_OBJECTS 0x0080 -#define IDF_EDITATTR 0x0100 -#define IDF_ATTRIB ( IDF_HARDATTR | IDF_STYLES ) -#define IDF_CONTENTS ( IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA ) -#define IDF_ALL ( IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS ) -#define IDF_NONE 0x0000 +// Insert-/Delete-Flags +const USHORT IDF_NONE = 0x0000; +const USHORT IDF_VALUE = 0x0001; /// Numeric values (and numeric results if IDF_FORMULA is not set). +const USHORT IDF_DATETIME = 0x0002; /// Dates, times, datetime values. +const USHORT IDF_STRING = 0x0004; /// Strings (and string results if IDF_FORMULA is not set). +const USHORT IDF_NOTE = 0x0008; /// Cell notes. +const USHORT IDF_FORMULA = 0x0010; /// Formula cells. +const USHORT IDF_HARDATTR = 0x0020; /// Hard cell attributes. +const USHORT IDF_STYLES = 0x0040; /// Cell styles. +const USHORT IDF_OBJECTS = 0x0080; /// Drawing objects. +const USHORT IDF_EDITATTR = 0x0100; /// Rich-text attributes. +const USHORT IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES; +const USHORT IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA; +const USHORT IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS; +const USHORT IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes. + +/// Copy flags for auto/series fill functions: do not touch notes and drawing objects. +const USHORT IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS); #define PASTE_NOFUNC 0 #define PASTE_ADD 1 @@ -318,9 +322,10 @@ enum CellType CELLTYPE_FORMULA, CELLTYPE_NOTE, CELLTYPE_EDIT, - CELLTYPE_SYMBOLS, // fuer Laden/Speichern - - CELLTYPE_DESTROYED + CELLTYPE_SYMBOLS // fuer Laden/Speichern +#if DBG_UTIL + ,CELLTYPE_DESTROYED +#endif }; enum DelCellCmd diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 08125d494d12..db35cb50969e 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: globstr.hrc,v $ - * $Revision: 1.22 $ + * $Revision: 1.22.128.1 $ * * This file is part of OpenOffice.org. * diff --git a/sc/inc/notesuno.hxx b/sc/inc/notesuno.hxx index 8d155823e955..3907f3d20967 100644 --- a/sc/inc/notesuno.hxx +++ b/sc/inc/notesuno.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: notesuno.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.128.2 $ * * This file is part of OpenOffice.org. * @@ -46,6 +46,7 @@ class ScDocShell; class SvxUnoText; +class ScPostIt; class ScAnnotationObj : public cppu::WeakImplHelper5< @@ -56,14 +57,6 @@ class ScAnnotationObj : public cppu::WeakImplHelper5< com::sun::star::lang::XServiceInfo >, public SfxListener { -private: - ScDocShell* pDocShell; - ScAddress aCellPos; - SvxUnoText* pUnoText; - -private: - SvxUnoText& GetUnoText(); - public: ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos); virtual ~ScAnnotationObj(); @@ -127,6 +120,16 @@ public: throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + +private: + SvxUnoText& GetUnoText(); + + const ScPostIt* ImplGetNote() const; + +private: + ScDocShell* pDocShell; + ScAddress aCellPos; + SvxUnoText* pUnoText; }; class ScAnnotationShapeObj : public cppu::WeakImplHelper10< @@ -151,8 +154,6 @@ private: private: SvxUnoText& GetUnoText(); com::sun::star::uno::Reference < com::sun::star::drawing::XShape > GetXShape(); - SdrObject* GetCaptionObj(); - void UpdateData(); public: ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos); diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 4997a456d223..979fea65264f 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: postit.hxx,v $ - * $Revision: 1.7.32.1 $ + * $Revision: 1.7.128.9 $ * * This file is part of OpenOffice.org. * @@ -28,102 +28,139 @@ * ************************************************************************/ -// ============================================================================ - #ifndef SC_POSTIT_HXX #define SC_POSTIT_HXX -#include <boost/shared_ptr.hpp> - -#include <svtools/pathoptions.hxx> -#include <svtools/useroptions.hxx> -#include <svtools/syslocale.hxx> #include <tools/gen.hxx> -#include <svx/editobj.hxx> -#include <svx/svddef.hxx> -#include <svx/svdpage.hxx> -#include <svx/svdocapt.hxx> -#include "global.hxx" -#include <com/sun/star/drawing/XShape.hpp> +#include "address.hxx" #include "scdllapi.h" -// indicative text length for a note object -#define SC_NOTE_SMALLTEXT 100 - class EditTextObject; +class SdrCaptionObj; +class SdrPage; +class SfxItemSet; class ScDocument; -//================================================================== -// Notes -//================================================================== +// ============================================================================ + +struct SC_DLLPUBLIC ScNoteData +{ + String maDate; /// Creation date of the note. + String maAuthor; /// Author of the note. + SdrCaptionObj* mpCaption; /// Drawing object representing the cell note. + bool mbShown; /// True = note is visible. + + explicit ScNoteData( bool bShown = false ); +}; + +// ============================================================================ class SC_DLLPUBLIC ScPostIt { +public: + /** Creates an empty note and its caption object and places it according to + the passed cell position. */ + explicit ScPostIt( ScDocument& rDoc, const ScAddress& rPos, bool bShown ); + + /** Copy constructor. Clones the note and its caption to a new document. */ + explicit ScPostIt( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNote ); + + /** Creates a note from the passed note data with existing caption object. */ + explicit ScPostIt( ScDocument& rDoc, const ScNoteData& rNoteData ); + + /** Removes the caption object from drawing layer, if this note is its owner. */ + ~ScPostIt(); + + /** Returns the data struct containing note settings. */ + inline const ScNoteData& GetNoteData() const { return maNoteData; } + + /** Returns the creation date of this note. */ + inline const String& GetDate() const { return maNoteData.maDate; } + /** Sets a new creation date for this note. */ + inline void SetDate( const String& rDate ) { maNoteData.maDate = rDate; } + + /** Returns the author date of this note. */ + inline const String& GetAuthor() const { return maNoteData.maAuthor; } + /** Sets a new author date for this note. */ + inline void SetAuthor( const String& rAuthor ) { maNoteData.maAuthor = rAuthor; } + + /** Sets date and author from system settings. */ + void AutoStamp(); + + /** Returns the pointer to the current edit text object, or null. */ + const EditTextObject* GetEditTextObject() const; + /** Returns the caption text of this note. */ + String GetText() const; + /** Returns true, if the caption text of this note contains line breaks. */ + bool HasMultiLineText() const; + /** Changes the caption text of this note. All text formatting will be lost. */ + void SetText( const String& rText ); + + /** Returns the note caption object. */ + inline SdrCaptionObj* GetCaption() const { return maNoteData.mpCaption; } + /** Returns and forgets the note caption object. */ + inline SdrCaptionObj* ForgetCaption() { SdrCaptionObj* pCapt = maNoteData.mpCaption; maNoteData.mpCaption = 0; return pCapt; } + + /** Shows or hides the note caption object. */ + void ShowCaption( bool bShow = true ); + /** Hides the note caption object. */ + inline void HideCaption() { ShowCaption( false ); } + /** Returns true, if the caption object is visible. */ + inline bool IsCaptionShown() const { return maNoteData.mbShown; } + + /** Shows or hides the caption temporarily (does not change internal visibility state). */ + void ShowCaptionTemp( bool bShow = true ); + /** Hides caption if it has been shown temporarily (does not change internal visibility state). */ + inline void HideCaptionTemp() { ShowCaptionTemp( false ); } + + /** Updates caption position according to position of the passed cell. */ + void UpdateCaptionPos( const ScAddress& rPos ); + + /** Sets caption itemset to default items. */ + void SetCaptionDefaultItems(); + /** Updates caption itemset according to the passed item set while removing shadow items. */ + void SetCaptionItems( const SfxItemSet& rItemSet ); + private: - typedef ::boost::shared_ptr< EditTextObject > EditObjPtr; - EditObjPtr mpEditObj; - ScDocument* mpDoc; - String maStrDate; - String maStrAuthor; - BOOL mbShown; - Rectangle maRectangle; - SfxItemSet maItemSet; + ScPostIt( const ScPostIt& ); + ScPostIt& operator=( const ScPostIt& ); -public: - explicit ScPostIt( ScDocument* pDoc ); - ScPostIt( const String& rText, ScDocument* pDoc ); - ScPostIt( const EditTextObject* pTextObj, ScDocument* pDoc ); - ScPostIt( const ScPostIt& rNote, ScDocument* pDoc ); - - ~ScPostIt(); - - inline const EditTextObject* GetEditTextObject() const { return mpEditObj.get(); } - - String GetText() const; - const String& GetDate() const { return maStrDate; } - const String& GetAuthor() const { return maStrAuthor; } - BOOL IsShown() const { return mbShown; } - - void SetEditTextObject( const EditTextObject* pTextObj); - void SetText( const String& rText ); - void SetDate( const String& rNew ) { maStrDate = rNew; } - void SetAuthor( const String& rNew ) { maStrAuthor = rNew; } - void SetShown( BOOL bNew ) { mbShown = bNew; } - - void Clear() { mpEditObj.reset(); maStrDate.Erase(); maStrAuthor.Erase(); mbShown = FALSE; } - void AutoStamp(); - - BOOL IsEmpty() const; - Rectangle DefaultRectangle(const ScAddress& rPos) const ; - Rectangle MimicOldRectangle(const ScAddress& rPos) const ; - SfxItemSet DefaultItemSet() const ; - inline const Rectangle& GetRectangle() const {return maRectangle;} - void SetRectangle(const Rectangle& aRect); - inline const SfxItemSet& GetItemSet() const {return maItemSet;} - void SetItemSet(const SfxItemSet& aItemSet); - void SetAndApplyItemSet(const SfxItemSet& aItemSet); - - void InsertObject( SdrCaptionObj* pObj, ScDocument& rDoc, SCTAB nTab, sal_Bool bVisible) const; - void RemoveObject( SdrCaptionObj* pObj, ScDocument& rDoc, SCTAB nTab) const; - - const ScPostIt& operator= ( const ScPostIt& rCpy ); - inline int operator==( const ScPostIt& rPostIt ) const; - int operator!=( const ScPostIt& rPostIt ) const { return !(operator==(rPostIt)); } - - friend inline SvStream& operator>>( SvStream& rStream, ScPostIt& rPostIt ); - friend inline SvStream& operator<<( SvStream& rStream, const ScPostIt& rPostIt ); + /** Creates a new caption object at the passed cell position, clones passed existing caption. */ + void CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCaption = 0 ); + /** Removes the caption object from the drawing layer, if this note is its owner. */ + void RemoveCaption(); + /** Updates caption visibility. */ + void UpdateCaptionLayer( bool bShow ); + +private: + ScDocument& mrDoc; /// Parent document containing the note. + ScNoteData maNoteData; /// Note data with pointer to caption object. }; +// ============================================================================ -inline int ScPostIt::operator==( const ScPostIt& rPostIt ) const +class SC_DLLPUBLIC ScNoteUtil { - return ( ScGlobal::EETextObjEqual (mpEditObj.get(), rPostIt.mpEditObj.get()) - && maStrDate == rPostIt.maStrDate - && maStrAuthor == rPostIt.maStrAuthor - && mbShown == rPostIt.mbShown - && maRectangle == rPostIt.maRectangle - && maItemSet == rPostIt.maItemSet ); -} +public: + /** Clones the note and its caption object, if specified. + @param bCloneCaption True = clones the caption object and inserts it + into the drawing layer of the destination document. False = the + cloned note will refer to the old caption object. */ + static ScPostIt* CloneNote( ScDocument& rDoc, const ScAddress& rPos, + const ScPostIt& rNote, bool bCloneCaption ); + + /** Tries to update the position of note caption objects in the specified range. */ + static void UpdateCaptionPositions( ScDocument& rDoc, const ScRange& rRange ); + + /** Creates and returns a caption object for a temporary caption. */ + static SdrCaptionObj* CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos, + SdrPage& rPage, const String& rUserText, + const Rectangle& rVisRect, bool bTailFront ); + + /** Creates a cell note based on the passed string and inserts it into the document. */ + static ScPostIt* CreateNoteFromString( ScDocument& rDoc, const ScAddress& rPos, + const String& rNoteText, bool bShown ); +}; // ============================================================================ diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 59decdf2364f..9a3b1746055d 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: table.hxx,v $ - * $Revision: 1.35.30.6 $ + * $Revision: 1.35.126.6 $ * * This file is part of OpenOffice.org. * @@ -240,7 +240,7 @@ public: BOOL HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; BOOL HasSelectionMatrixFragment( const ScMarkData& rMark ) const; - BOOL IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; + BOOL IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const; void PutCell( const ScAddress&, ScBaseCell* pCell ); void PutCell( const ScAddress&, ULONG nFormatIndex, ScBaseCell* pCell); @@ -249,7 +249,6 @@ public: // TRUE = Zahlformat gesetzt BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ); void SetValue( SCCOL nCol, SCROW nRow, const double& rVal ); - void SetNote( SCCOL nCol, SCROW nRow, const ScPostIt& rNote); void SetError( SCCOL nCol, SCROW nRow, USHORT nError); void GetString( SCCOL nCol, SCROW nRow, String& rString ); @@ -259,7 +258,6 @@ public: double GetValue( SCCOL nCol, SCROW nRow ); void GetFormula( SCCOL nCol, SCROW nRow, String& rFormula, BOOL bAsciiExport = FALSE ); - BOOL GetNote( SCCOL nCol, SCROW nRow, ScPostIt& rNote); CellType GetCellType( const ScAddress& rPos ) const { return aCol[rPos.Col()].GetCellType( rPos.Row() ); } @@ -270,6 +268,15 @@ public: void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const; + /** Returns the pointer to a cell note object at the passed cell address. */ + ScPostIt* GetNote( SCCOL nCol, SCROW nRow ); + /** Sets the passed cell note object at the passed cell address. Takes ownership! */ + void TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote ); + /** Returns and forgets the cell note object at the passed cell address. */ + ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow ); + /** Deletes the note at the passed cell address. */ + void DeleteNote( SCCOL nCol, SCROW nRow ); + BOOL TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ); void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ); void DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize, @@ -282,7 +289,7 @@ public: void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nDelFlag); void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable, - BOOL bKeepScenarioFlags); + BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions); void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, USHORT nInsFlag, BOOL bAsLink, BOOL bSkipAttrForEmpty, ScTable* pTable); void StartListeningInArea( SCCOL nCol1, SCROW nRow1, @@ -578,6 +585,7 @@ public: void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); + void Sort(const ScSortParam& rSortParam, BOOL bKeepQuery); BOOL ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam, BOOL* pSpecial = NULL, ScBaseCell* pCell = NULL, diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx index 78c7e0926acc..f49dd2d7fea0 100644 --- a/sc/inc/userdat.hxx +++ b/sc/inc/userdat.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: userdat.hxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.128.1 $ * * This file is part of OpenOffice.org. * @@ -60,14 +60,15 @@ public: class ScDrawObjData : public SdrObjUserData { - virtual SdrObjUserData* Clone(SdrObject* pObj) const; - public: - ScAddress aStt, aEnd; - BOOL bValidStart, bValidEnd; - ScDrawObjData(); - ScDrawObjData( const ScDrawObjData& ); - virtual ~ScDrawObjData(); + ScAddress maStart; + ScAddress maEnd; + bool mbNote; + + explicit ScDrawObjData(); + +private: + virtual ScDrawObjData* Clone( SdrObject* pObj ) const; }; //------------------------------------------------------------------------- |