LibreOffice Module sc (master)
1
|
Additional class containing cell annotation data. More...
#include <postit.hxx>
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< ScPostIt > | Clone (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 ScNoteData & | GetNoteData () 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 OutlinerParaObject * | GetOutlinerObject () const |
Returns the pointer to the current outliner object, or null. More... | |
const EditTextObject * | GetEditTextObject () 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... | |
SdrCaptionObj * | GetCaption () const |
Returns an existing note caption object. More... | |
SdrCaptionObj * | GetOrCreateCaption (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 | |
ScPostIt & | operator= (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 | |
ScDocument & | mrDoc |
ScNoteData | maNoteData |
Parent document containing the note. More... | |
sal_uInt32 | mnPostItId |
Note data with pointer to caption object. More... | |
Additional class containing cell annotation data.
Definition at line 160 of file postit.hxx.
|
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.
|
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().
|
explicit |
Creates a note from the passed note data with existing caption object.
bAlwaysCreateCaption | Instead 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().
|
privatedelete |
void ScPostIt::AutoStamp | ( | ) |
Sets date and author from system settings.
Definition at line 892 of file postit.cxx.
References LocaleDataWrapper::getDate(), ScGlobal::getLocaleDataPtr(), ScNoteData::maAuthor, ScNoteData::maDate, maNoteData, and Date::SYSTEM.
Referenced by ScNoteUtil::CreateNoteFromCaption(), ScNoteUtil::CreateNoteFromObjectData(), ScNoteUtil::CreateNoteFromString(), ScPostIt(), and FuText::StopEditMode().
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.
bCloneCaption | If 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().
|
private |
Creates a new caption object at the passed cell position, clones passed existing caption.
Definition at line 1087 of file postit.cxx.
References ScDrawLayer::AddCalcUndo(), ScDocument::GetDrawLayer(), SdrCaptionObj::GetLogicRect(), SdrObject::GetMergedItemSet(), SdrTextObj::GetOutlinerParaObject(), SdrCaptionObj::GetTailPos(), ScDocument::InitDrawLayer(), ScDocument::IsClipboard(), ScDrawLayer::IsRecording(), ScDocument::IsUndo(), maNoteData, tools::Rectangle::Move(), mrDoc, ScNoteData::mxCaption, Point, ScCaptionPtr::reset(), SdrObject::SetLogicRect(), SdrObject::SetMergedItemSetAndBroadcast(), and SdrObject::SetOutlinerParaObject().
Referenced by ScPostIt().
Creates the caption object from initial caption data if existing.
Definition at line 1012 of file postit.cxx.
References SdrTextObj::AdjustTextFrameWidthAndHeight(), assert(), SdrObject::BroadcastObjectChange(), ScDrawLayer::GetCellRect(), SdrObject::getSdrModelFromSdrObject(), ScDocument::InitDrawLayer(), ScDocument::IsClipboard(), SdrModel::isLocked(), ScDocument::IsNegativePage(), ScDocument::IsUndo(), tools::Rectangle::Left(), makeSdrTextMaxFrameWidthItem(), makeSdrTextMinFrameWidthItem(), maNoteData, mrDoc, ScNoteData::mxCaption, ScNoteData::mxInitData, Point, tools::Rectangle::Right(), SdrModel::setLock(), SdrObject::SetLogicRect(), SdrObject::SetMergedItem(), SdrObject::SetOutlinerParaObject(), SdrTextObj::SetText(), ScAddress::Tab(), and tools::Rectangle::Top().
Referenced by Clone(), GetOrCreateCaption(), ScPostIt(), SetText(), ShowCaption(), ShowCaptionTemp(), and UpdateCaptionPos().
void ScPostIt::ForgetCaption | ( | bool | bPreserveData = false | ) |
Forgets the pointer to the note caption object.
bPreserveData | If 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.
|
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().
|
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().
|
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().
|
inline |
Returns the note id.
Definition at line 203 of file postit.hxx.
Referenced by ScDocShell::LOKCommentNotify().
|
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 |
Returns the caption text of this note.
Definition at line 913 of file postit.cxx.
References aBuffer, GetEditTextObject(), ScDocument::GetNoteEngine(), EditEngine::GetParagraphCount(), EditEngine::GetText(), maNoteData, mrDoc, ScNoteData::mxInitData, and ScEditEngineDefaulter::SetTextCurrentDefaults().
Referenced by ScOutputData::AddPDFNotes(), ScNoteUtil::CreateTempCaption(), sc::SearchResultsDlg::FillResults(), ForgetCaption(), ScGridWinUIObject::get_state(), lcl_NoteString(), ScDocShell::LOKCommentNotify(), ScTable::SearchCell(), and XclExpNote::XclExpNote().
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().
|
inline |
Returns true, if the caption object is visible.
Definition at line 255 of file postit.hxx.
Referenced by ScNoteUtil::CreateTempCaption(), ScAnnotationObj::getIsVisible(), ScCellShell::GetState(), ScDocFunc::ShowNote(), ScGridWindow::ShowNoteMarker(), and ScXMLExport::WriteAnnotation().
|
private |
Removes the caption object from the drawing layer, if this note is its owner.
Definition at line 1135 of file postit.cxx.
References ScCaptionPtr::forget(), ScDocument::GetDrawLayer(), ScCaptionPtr::getRefs(), SdrObject::getSdrModelFromSdrObject(), ScDocument::IsClipboard(), ScDocument::IsInDtorClear(), ScDocument::IsUndo(), maNoteData, mrDoc, ScNoteData::mxCaption, ScCaptionPtr::removeFromDrawPageAndFree(), and SAL_INFO.
Referenced by ~ScPostIt().
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().
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().
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().
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().
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().
|
mutableprivate |
Parent document containing the note.
Definition at line 276 of file postit.hxx.
Referenced by AutoStamp(), Clone(), CreateCaption(), CreateCaptionFromInitData(), ForgetCaption(), GetOrCreateCaption(), GetOutlinerObject(), GetText(), HasMultiLineText(), RemoveCaption(), ScPostIt(), SetAuthor(), SetDate(), SetText(), ShowCaption(), ShowCaptionTemp(), and UpdateCaptionPos().
|
static |
Definition at line 163 of file postit.hxx.
Referenced by ScPostIt().
|
private |
Note data with pointer to caption object.
Definition at line 277 of file postit.hxx.
Referenced by Clone(), and ScPostIt().
|
private |
Definition at line 275 of file postit.hxx.
Referenced by CreateCaption(), CreateCaptionFromInitData(), GetText(), RemoveCaption(), and UpdateCaptionPos().