LibreOffice Module sc (master)  1
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
ScPostIt Class Reference

Additional class containing cell annotation data. More...

#include <postit.hxx>

Collaboration diagram for ScPostIt:
[legend]

Public Member Functions

 ScPostIt (ScDocument &rDoc, const ScAddress &rPos, sal_uInt32 nPostItId=0)
 Creates an empty note and its caption object and places it according to the passed cell position. More...
 
 ScPostIt (ScDocument &rDoc, const ScAddress &rPos, const ScPostIt &rNote, sal_uInt32 nPostItId=0)
 Copy constructor. More...
 
 ScPostIt (ScDocument &rDoc, const ScAddress &rPos, const ScNoteData &rNoteData, bool bAlwaysCreateCaption, sal_uInt32 nPostItId=0)
 Creates a note from the passed note data with existing caption object. More...
 
 ~ScPostIt ()
 Removes the caption object from drawing layer, if this note is its owner. More...
 
std::unique_ptr< ScPostItClone (const ScAddress &rOwnPos, ScDocument &rDestDoc, const ScAddress &rDestPos, bool bCloneCaption) const
 Clones this note and its caption object, if specified. More...
 
sal_uInt32 GetId () const
 Returns the note id. More...
 
const ScNoteDataGetNoteData () const
 Returns the data struct containing all note settings. More...
 
const OUString & GetDate () const
 Returns the creation date of this note. More...
 
void SetDate (const OUString &rDate)
 Sets a new creation date for this note. More...
 
const OUString & GetAuthor () const
 Returns the author date of this note. More...
 
void SetAuthor (const OUString &rAuthor)
 Sets a new author date for this note. More...
 
void AutoStamp ()
 Sets date and author from system settings. More...
 
const OutlinerParaObjectGetOutlinerObject () const
 Returns the pointer to the current outliner object, or null. More...
 
const EditTextObjectGetEditTextObject () const
 Returns the pointer to the current edit text object, or null. More...
 
OUString GetText () const
 Returns the caption text of this note. More...
 
bool HasMultiLineText () const
 Returns true, if the caption text of this note contains line breaks. More...
 
void SetText (const ScAddress &rPos, const OUString &rText)
 Changes the caption text of this note. More...
 
SdrCaptionObjGetCaption () const
 Returns an existing note caption object. More...
 
SdrCaptionObjGetOrCreateCaption (const ScAddress &rPos) const
 Returns the caption object of this note. More...
 
void ForgetCaption (bool bPreserveData=false)
 Forgets the pointer to the note caption object. More...
 
void ShowCaption (const ScAddress &rPos, bool bShow)
 Shows or hides the note caption object. More...
 
bool IsCaptionShown () const
 Returns true, if the caption object is visible. More...
 
void ShowCaptionTemp (const ScAddress &rPos, bool bShow=true)
 Shows or hides the caption temporarily (does not change internal visibility state). More...
 
void UpdateCaptionPos (const ScAddress &rPos)
 Updates caption position according to position of the passed cell. More...
 

Static Public Attributes

static sal_uInt32 mnLastPostItId = 1
 

Private Member Functions

 ScPostIt (const ScPostIt &)=delete
 
ScPostItoperator= (const ScPostIt &)=delete
 
void CreateCaptionFromInitData (const ScAddress &rPos) const
 Creates the caption object from initial caption data if existing. More...
 
void CreateCaption (const ScAddress &rPos, const SdrCaptionObj *pCaption=nullptr)
 Creates a new caption object at the passed cell position, clones passed existing caption. More...
 
void RemoveCaption ()
 Removes the caption object from the drawing layer, if this note is its owner. More...
 

Private Attributes

ScDocumentmrDoc
 
ScNoteData maNoteData
 Parent document containing the note. More...
 
sal_uInt32 mnPostItId
 Note data with pointer to caption object. More...
 

Detailed Description

Additional class containing cell annotation data.

Definition at line 160 of file postit.hxx.

Constructor & Destructor Documentation

ScPostIt::ScPostIt ( ScDocument rDoc,
const ScAddress rPos,
sal_uInt32  nPostItId = 0 
)
explicit

Creates an empty note and its caption object and places it according to the passed cell position.

Definition at line 844 of file postit.cxx.

References AutoStamp(), CreateCaption(), mnLastPostItId, and mnPostItId.

ScPostIt::ScPostIt ( ScDocument rDoc,
const ScAddress rPos,
const ScPostIt rNote,
sal_uInt32  nPostItId = 0 
)
explicit

Copy constructor.

Clones the note and its caption to a new document.

Definition at line 853 of file postit.cxx.

References CreateCaption(), ScCaptionPtr::get(), maNoteData, mnLastPostItId, mnPostItId, ScNoteData::mxCaption, and ScCaptionPtr::reset().

ScPostIt::ScPostIt ( ScDocument rDoc,
const ScAddress rPos,
const ScNoteData rNoteData,
bool  bAlwaysCreateCaption,
sal_uInt32  nPostItId = 0 
)
explicit

Creates a note from the passed note data with existing caption object.

Parameters
bAlwaysCreateCaptionInstead of a pointer to an existing caption object, the passed note data structure may contain a reference to an ScCaptionInitData structure containing information about how to construct a missing caption object. If sal_True is passed, the caption drawing object will be created immediately from that data. If sal_False is passed and the note is not visible, it will continue to cache that data until the caption object is requested.

Definition at line 862 of file postit.cxx.

References CreateCaptionFromInitData(), maNoteData, ScNoteData::mbShown, mnLastPostItId, and mnPostItId.

ScPostIt::~ScPostIt ( )

Removes the caption object from drawing layer, if this note is its owner.

Definition at line 871 of file postit.cxx.

References RemoveCaption().

ScPostIt::ScPostIt ( const ScPostIt )
privatedelete

Member Function Documentation

void ScPostIt::AutoStamp ( )
std::unique_ptr< ScPostIt > ScPostIt::Clone ( const ScAddress rOwnPos,
ScDocument rDestDoc,
const ScAddress rDestPos,
bool  bCloneCaption 
) const

Clones this note and its caption object, if specified.

Parameters
bCloneCaptionIf sal_True is passed, clones the caption object and inserts it into the drawing layer of the destination document. If sal_False is passed, the cloned note will refer to the old caption object (used e.g. in Undo documents to restore the pointer to the existing caption object).

Definition at line 876 of file postit.cxx.

References CreateCaptionFromInitData(), maNoteData, and mnPostItId.

Referenced by ScColumn::CopyCellToDocument(), ScColumn::CopyOneCellFromClip(), and ScTable::TransposeColNotes().

void ScPostIt::CreateCaption ( const ScAddress rPos,
const SdrCaptionObj pCaption = nullptr 
)
private
void ScPostIt::CreateCaptionFromInitData ( const ScAddress rPos) const
private
void ScPostIt::ForgetCaption ( bool  bPreserveData = false)

Forgets the pointer to the note caption object.

Parameters
bPreserveDataIf true then the note text is remembered in maNoteData to be able to later reconstruct a caption from it.

Definition at line 956 of file postit.cxx.

References ScCaptionPtr::forget(), GetOutlinerObject(), GetText(), maNoteData, ScCaptionInitData::maSimpleText, ScNoteData::mxCaption, ScNoteData::mxInitData, and ScCaptionInitData::mxOutlinerObj.

const OUString& ScPostIt::GetAuthor ( ) const
inline

Returns the author date of this note.

Definition at line 214 of file postit.hxx.

Referenced by ScXMLExport::exportAnnotationMeta(), ScAnnotationObj::getAuthor(), ScDocShell::LOKCommentNotify(), and XclExpNote::XclExpNote().

SdrCaptionObj* ScPostIt::GetCaption ( ) const
inline

Returns an existing note caption object.

returns null, if the note contains initial caption data needed to construct a caption object. The SdrCaptionObj* returned is still managed by the underlying ScNoteData::ScCaptionPtr and must not be stored elsewhere.

Definition at line 237 of file postit.hxx.

Referenced by ScViewFunc::EditNote(), ScTabView::OnLOKNoteStateChanged(), ScDocFunc::ShowNote(), FuText::StopEditMode(), and ScDetectiveFunc::UpdateAllComments().

const OUString& ScPostIt::GetDate ( ) const
inline

Returns the creation date of this note.

Definition at line 209 of file postit.hxx.

Referenced by ScXMLExport::exportAnnotationMeta(), ScAnnotationObj::getDate(), and ScDocShell::LOKCommentNotify().

const EditTextObject * ScPostIt::GetEditTextObject ( ) const

Returns the pointer to the current edit text object, or null.

Definition at line 907 of file postit.cxx.

References GetOutlinerObject(), and OutlinerParaObject::GetTextObject().

Referenced by GetText(), HasMultiLineText(), and XclExpNote::XclExpNote().

sal_uInt32 ScPostIt::GetId ( ) const
inline

Returns the note id.

Definition at line 203 of file postit.hxx.

Referenced by ScDocShell::LOKCommentNotify().

const ScNoteData& ScPostIt::GetNoteData ( ) const
inline

Returns the data struct containing all note settings.

Definition at line 206 of file postit.hxx.

Referenced by ScDocFunc::ReplaceNote(), and FuText::StopEditMode().

SdrCaptionObj * ScPostIt::GetOrCreateCaption ( const ScAddress rPos) const

Returns the caption object of this note.

Creates the caption object, if the note contains initial caption data instead of the caption. The SdrCaptionObj* returned is still managed by the underlying ScNoteData::ScCaptionPtr and must not be stored elsewhere.

Definition at line 950 of file postit.cxx.

References CreateCaptionFromInitData(), ScCaptionPtr::get(), maNoteData, and ScNoteData::mxCaption.

Referenced by ScXMLExport::collectAutoStyles(), ScNoteUtil::CreateTempCaption(), ScXMLExport::exportAnnotationMeta(), oox::xls::Comment::finalizeImport(), ScAnnotationEditSource::GetCaptionObj(), ScXMLExport::WriteAnnotation(), and XclExpNote::XclExpNote().

const OutlinerParaObject * ScPostIt::GetOutlinerObject ( ) const

Returns the pointer to the current outliner object, or null.

Definition at line 898 of file postit.cxx.

References SdrTextObj::GetOutlinerParaObject(), maNoteData, ScNoteData::mxCaption, and ScNoteData::mxInitData.

Referenced by ForgetCaption(), and GetEditTextObject().

OUString ScPostIt::GetText ( ) const
bool ScPostIt::HasMultiLineText ( ) const

Returns true, if the caption text of this note contains line breaks.

Definition at line 934 of file postit.cxx.

References GetEditTextObject(), maNoteData, and ScNoteData::mxInitData.

Referenced by ScTable::SearchCell().

bool ScPostIt::IsCaptionShown ( ) const
inline
ScPostIt& ScPostIt::operator= ( const ScPostIt )
privatedelete
void ScPostIt::RemoveCaption ( )
private
void ScPostIt::SetAuthor ( const OUString &  rAuthor)

Sets a new author date for this note.

Definition at line 887 of file postit.cxx.

References ScNoteData::maAuthor, and maNoteData.

Referenced by ScDocFunc::ReplaceNote(), and ScXMLTableRowCellContext::SetAnnotation().

void ScPostIt::SetDate ( const OUString &  rDate)

Sets a new creation date for this note.

Definition at line 882 of file postit.cxx.

References ScNoteData::maDate, and maNoteData.

Referenced by ScDocFunc::ReplaceNote(), and ScXMLTableRowCellContext::SetAnnotation().

void ScPostIt::SetText ( const ScAddress rPos,
const OUString &  rText 
)

Changes the caption text of this note.

All text formatting will be lost.

Definition at line 943 of file postit.cxx.

References CreateCaptionFromInitData(), maNoteData, ScNoteData::mxCaption, and SdrTextObj::SetText().

Referenced by ScGridWinUIObject::execute(), ScTable::SearchCell(), and ScUndoReplace::Undo().

void ScPostIt::ShowCaption ( const ScAddress rPos,
bool  bShow 
)

Shows or hides the note caption object.

Definition at line 984 of file postit.cxx.

References CreateCaptionFromInitData(), maNoteData, ScNoteData::mbShown, and ScNoteData::mxCaption.

Referenced by ScDocFunc::ShowNote().

void ScPostIt::ShowCaptionTemp ( const ScAddress rPos,
bool  bShow = true 
)

Shows or hides the caption temporarily (does not change internal visibility state).

Definition at line 993 of file postit.cxx.

References CreateCaptionFromInitData(), maNoteData, ScNoteData::mbShown, and ScNoteData::mxCaption.

Referenced by ScViewFunc::EditNote(), and FuText::StopEditMode().

void ScPostIt::UpdateCaptionPos ( const ScAddress rPos)

Updates caption position according to position of the passed cell.

Definition at line 1000 of file postit.cxx.

References CreateCaptionFromInitData(), maNoteData, mrDoc, and ScNoteData::mxCaption.

Referenced by ScColumn::CopyCellToDocument().

Member Data Documentation

ScNoteData ScPostIt::maNoteData
mutableprivate
sal_uInt32 ScPostIt::mnLastPostItId = 1
static

Definition at line 163 of file postit.hxx.

Referenced by ScPostIt().

sal_uInt32 ScPostIt::mnPostItId
private

Note data with pointer to caption object.

Definition at line 277 of file postit.hxx.

Referenced by Clone(), and ScPostIt().

ScDocument& ScPostIt::mrDoc
private

The documentation for this class was generated from the following files: