summaryrefslogtreecommitdiff
path: root/sc/inc/postit.hxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-03-02 14:19:13 +0000
committerOliver Bolte <obo@openoffice.org>2009-03-02 14:19:13 +0000
commit07b0c01857137de7e4bd02375e7c892d622d270e (patch)
treeca4599cb8c96535139e3e0ee07acb37bcb5ad636 /sc/inc/postit.hxx
parent74e4b152bbe46cf55cec4da21b9365363ec2fa8d (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/postit.hxx')
-rw-r--r--sc/inc/postit.hxx195
1 files changed, 116 insertions, 79 deletions
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 );
+};
// ============================================================================