diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-08-11 13:08:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-08-11 18:14:15 +0200 |
commit | ac40c3923580e4ec0e738d57ff8b885da93301ef (patch) | |
tree | ed18293772a078ca48a2a0e0dd9028f12ff3057c /sc/source | |
parent | 5ae486eea7a381403a9f81e5aa8ef1a0a57b95b6 (diff) |
split out a common CreateNoteData
Change-Id: Ieeaf50f3a086d01b5492eb3ab9b211f132f045ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155611
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/postit.cxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 8fa13927d3d9..378323338eb1 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -929,17 +929,13 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption( return pNote; } -ScPostIt* ScNoteUtil::CreateNoteFromObjectData( - ScDocument& rDoc, const ScAddress& rPos, SfxItemSet&& rItemSet, const OUString& rStyleName, - const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& rCaptionRect, - bool bShown ) +ScNoteData ScNoteUtil::CreateNoteData(ScDocument& rDoc, const ScAddress& rPos, const OutlinerParaObject& rOutlinerObj, + const tools::Rectangle& rCaptionRect, bool bShown) { ScNoteData aNoteData( bShown ); aNoteData.mxInitData = std::make_shared<ScCaptionInitData>(); ScCaptionInitData& rInitData = *aNoteData.mxInitData; - rInitData.moItemSet.emplace(std::move(rItemSet)); rInitData.mxOutlinerObj = rOutlinerObj; - rInitData.maStyleName = ScStyleNameConversion::ProgrammaticToDisplayName(rStyleName, SfxStyleFamily::Frame); // convert absolute caption position to relative position rInitData.mbDefaultPosSize = rCaptionRect.IsEmpty(); @@ -952,6 +948,19 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData( rInitData.maCaptionSize = rCaptionRect.GetSize(); } + return aNoteData; +} + +ScPostIt* ScNoteUtil::CreateNoteFromObjectData( + ScDocument& rDoc, const ScAddress& rPos, SfxItemSet&& rItemSet, const OUString& rStyleName, + const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& rCaptionRect, + bool bShown ) +{ + ScNoteData aNoteData(CreateNoteData(rDoc, rPos, rOutlinerObj, rCaptionRect, bShown)); + ScCaptionInitData& rInitData = *aNoteData.mxInitData; + rInitData.moItemSet.emplace(std::move(rItemSet)); + rInitData.maStyleName = ScStyleNameConversion::ProgrammaticToDisplayName(rStyleName, SfxStyleFamily::Frame); + return InsertNote(rDoc, rPos, std::move(aNoteData), /*bAlwaysCreateCaption*/false, 0/*nPostItId*/); } |