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, ScNoteData aNoteData, 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...
 
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 57 of file postit.hxx.

Constructor & Destructor Documentation

◆ ScPostIt() [1/4]

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 452 of file postit.cxx.

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

◆ ScPostIt() [2/4]

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 461 of file postit.cxx.

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

◆ ScPostIt() [3/4]

ScPostIt::ScPostIt ( ScDocument rDoc,
const ScAddress rPos,
ScNoteData  aNoteData,
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 470 of file postit.cxx.

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

◆ ~ScPostIt()

ScPostIt::~ScPostIt ( )

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

Definition at line 479 of file postit.cxx.

References RemoveCaption().

◆ ScPostIt() [4/4]

ScPostIt::ScPostIt ( const ScPostIt )
privatedelete

Member Function Documentation

◆ AutoStamp()

void ScPostIt::AutoStamp ( )

◆ Clone()

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 484 of file postit.cxx.

References CreateCaptionFromInitData(), comphelper::LibreOfficeKit::isActive(), ScDocument::IsClipboard(), maNoteData, mnPostItId, and mrDoc.

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

◆ CreateCaption()

void ScPostIt::CreateCaption ( const ScAddress rPos,
const SdrCaptionObj pCaption = nullptr 
)
private

◆ CreateCaptionFromInitData()

void ScPostIt::CreateCaptionFromInitData ( const ScAddress rPos) const
private

◆ ForgetCaption()

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 561 of file postit.cxx.

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

◆ GetAuthor()

const OUString & ScPostIt::GetAuthor ( ) const
inline

◆ GetCaption()

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 132 of file postit.hxx.

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

◆ GetDate()

const OUString & ScPostIt::GetDate ( ) const
inline

Returns the creation date of this note.

Definition at line 106 of file postit.hxx.

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

◆ GetEditTextObject()

const EditTextObject * ScPostIt::GetEditTextObject ( ) const

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

Definition at line 521 of file postit.cxx.

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

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

◆ GetId()

sal_uInt32 ScPostIt::GetId ( ) const
inline

Returns the note id.

Definition at line 100 of file postit.hxx.

Referenced by ScDocShell::LOKCommentNotify().

◆ GetNoteData()

const ScNoteData & ScPostIt::GetNoteData ( ) const
inline

Returns the data struct containing all note settings.

Definition at line 103 of file postit.hxx.

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

◆ GetOrCreateCaption()

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 555 of file postit.cxx.

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

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

◆ GetOutlinerObject()

const OutlinerParaObject * ScPostIt::GetOutlinerObject ( ) const

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

Definition at line 512 of file postit.cxx.

References maNoteData, ScNoteData::mxCaption, and ScNoteData::mxInitData.

Referenced by ForgetCaption(), and GetEditTextObject().

◆ GetText()

OUString ScPostIt::GetText ( ) const

◆ IsCaptionShown()

bool ScPostIt::IsCaptionShown ( ) const
inline

◆ operator=()

ScPostIt & ScPostIt::operator= ( const ScPostIt )
privatedelete

◆ RemoveCaption()

void ScPostIt::RemoveCaption ( )
private

◆ SetAuthor()

void ScPostIt::SetAuthor ( const OUString &  rAuthor)

Sets a new author date for this note.

Definition at line 499 of file postit.cxx.

References ScNoteData::maAuthor, and maNoteData.

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

◆ SetDate()

void ScPostIt::SetDate ( const OUString &  rDate)

Sets a new creation date for this note.

Definition at line 494 of file postit.cxx.

References ScNoteData::maDate, and maNoteData.

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

◆ SetText()

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 548 of file postit.cxx.

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

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

◆ ShowCaption()

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

Shows or hides the note caption object.

Definition at line 589 of file postit.cxx.

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

Referenced by ScDocFunc::ShowNote().

◆ ShowCaptionTemp()

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

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

Definition at line 598 of file postit.cxx.

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

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

◆ UpdateCaptionPos()

void ScPostIt::UpdateCaptionPos ( const ScAddress rPos)

Updates caption position according to position of the passed cell.

Definition at line 605 of file postit.cxx.

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

Referenced by ScColumn::CopyCellToDocument().

Member Data Documentation

◆ maNoteData

ScNoteData ScPostIt::maNoteData
mutableprivate

◆ mnLastPostItId

sal_uInt32 ScPostIt::mnLastPostItId = 1
static

Definition at line 60 of file postit.hxx.

Referenced by ScPostIt().

◆ mnPostItId

sal_uInt32 ScPostIt::mnPostItId
private

Note data with pointer to caption object.

Definition at line 172 of file postit.hxx.

Referenced by Clone(), and ScPostIt().

◆ mrDoc

ScDocument& ScPostIt::mrDoc
private

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