include/svx/annotation/Annotation.hxx | 56 ++++++++ sd/inc/Annotation.hxx | 26 --- sd/source/core/annotations/Annotation.cxx | 172 ++----------------------- sd/source/ui/annotations/annotationmanager.cxx | 21 +-- sd/source/ui/unoidl/unomodel.cxx | 2 svx/source/annotation/Annotation.cxx | 130 ++++++++++++++++++ 6 files changed, 217 insertions(+), 190 deletions(-)
New commits: commit ec5c4b572b1744a50c7dc94aeb472174c736069a Author: Tomaž Vajngerl <[email protected]> AuthorDate: Thu Apr 18 22:41:04 2024 +0900 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Jun 10 09:02:47 2024 +0200 annot: move UndoAnnotation and deps. to svx, adapt svx Annotation This moves UndoAnnotation and dependent classes to svx, refactor the code to in sdr::annotaion::Annotation so annotations in sd module still work as they have before. Change-Id: I3769069a636c30c55bc1fcf2406d990f1b44baa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166493 Reviewed-by: Tomaž Vajngerl <[email protected]> Tested-by: Tomaž Vajngerl <[email protected]> (cherry picked from commit d126f57fd4bbba7ac0e4218ed30524cb9bbb5859) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168527 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/include/svx/annotation/Annotation.hxx b/include/svx/annotation/Annotation.hxx index 13881a58d070..566dd6ef52f4 100644 --- a/include/svx/annotation/Annotation.hxx +++ b/include/svx/annotation/Annotation.hxx @@ -14,10 +14,40 @@ #include <com/sun/star/util/DateTime.hpp> #include <svx/svdpage.hxx> +#include <svx/svdundo.hxx> #include <svx/svxdllapi.h> +class SdrUndoAction; +class SfxViewShell; + namespace sdr::annotation { +class Annotation; + +enum class CommentNotificationType +{ + Add, + Modify, + Remove +}; + +SVXCORE_DLLPUBLIC void LOKCommentNotify(CommentNotificationType nType, + const SfxViewShell* pViewShell, Annotation& rAnnotation); +SVXCORE_DLLPUBLIC void LOKCommentNotifyAll(CommentNotificationType nType, Annotation& rAnnotation); + +struct SVXCORE_DLLPUBLIC AnnotationData +{ + css::geometry::RealPoint2D m_Position; + css::geometry::RealSize2D m_Size; + OUString m_Author; + OUString m_Initials; + css::util::DateTime m_DateTime; + OUString m_Text; + + void get(Annotation& rAnnotation); + void set(Annotation& rAnnotation); +}; + class SVXCORE_DLLPUBLIC Annotation { private: @@ -33,8 +63,11 @@ protected: OUString m_Author; OUString m_Initials; css::util::DateTime m_DateTime; + bool m_bIsFreeText = false; + std::unique_ptr<SdrUndoAction> createUndoAnnotation(); + public: Annotation(SdrPage* pPage) : mpSdrPage(pPage) @@ -42,12 +75,35 @@ public: { } + css::geometry::RealPoint2D GetPosition() const { return m_Position; } + void SetPosition(const css::geometry::RealPoint2D& rValue) { m_Position = rValue; } + + css::geometry::RealSize2D GetSize() const { return m_Size; } + void SetSize(const css::geometry::RealSize2D& rValue) { m_Size = rValue; } + + OUString GetAuthor() const { return m_Author; } + void SetAuthor(const OUString& rValue) { m_Author = rValue; } + + OUString GetInitials() const { return m_Initials; } + void SetInitials(const OUString& rValue) { m_Initials = rValue; } + + css::util::DateTime GetDateTime() const { return m_DateTime; } + void SetDateTime(const css::util::DateTime& rValue) { m_DateTime = rValue; } + + virtual OUString GetText() = 0; + virtual void SetText(OUString const& rText) = 0; + SdrModel* GetModel() { return mpSdrPage != nullptr ? &mpSdrPage->getSdrModelFromSdrPage() : nullptr; } + SdrPage const* getPage() const { return mpSdrPage; } sal_uInt32 GetId() const { return m_nId; } + + void setIsFreeText(bool value) { m_bIsFreeText = value; } + + bool isFreeText() const { return m_bIsFreeText; } }; //typedef std::vector<rtl::Reference<Annotation>> AnnotationVector; diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 9bdbc31033f1..7d63cd54bea9 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -38,34 +38,19 @@ class SdrUndoAction; -namespace com::sun::star::office { - class XAnnotation; -} +namespace com::sun::star::office { class XAnnotation; } namespace com::sun::star::uno { template <typename > class Reference; } class SfxViewShell; -namespace sd { - -enum class CommentNotificationType { Add, Modify, Remove }; +namespace sd +{ void createAnnotation( rtl::Reference< Annotation >& xAnnotation, SdPage* pPage ); std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation, bool bInsert ); -void CreateChangeUndo(const css::uno::Reference< css::office::XAnnotation >& xAnnotation); - -sal_uInt32 getAnnotationId(const css::uno::Reference <css::office::XAnnotation>& xAnnotation); - -const SdPage* getAnnotationPage(const css::uno::Reference<css::office::XAnnotation>& xAnnotation); - -void LOKCommentNotify(CommentNotificationType nType, const SfxViewShell* pViewShell, - css::uno::Reference<css::office::XAnnotation> const & rxAnnotation); - -void LOKCommentNotifyAll(CommentNotificationType nType, - css::uno::Reference<css::office::XAnnotation> const & rxAnnotation); - struct SD_DLLPUBLIC CustomAnnotationMarker { Color maLineColor; @@ -131,9 +116,8 @@ public: return bool(m_pCustomAnnotationMarker); } - void setIsFreeText(bool value) { m_bIsFreeText = value; } - - bool isFreeText() const { return m_bIsFreeText; } + OUString GetText() override; + void SetText(OUString const& rText) override; private: // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index a75669694f3b..f33d9b61e809 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -36,7 +36,6 @@ #include <notifydocumentevent.hxx> -#include <tools/json_writer.hxx> using namespace css; @@ -60,52 +59,6 @@ protected: int mnIndex; }; -struct AnnotationData -{ - geometry::RealPoint2D m_Position; - geometry::RealSize2D m_Size; - OUString m_Author; - OUString m_Initials; - util::DateTime m_DateTime; - OUString m_Text; - - void get( const rtl::Reference< Annotation >& xAnnotation ) - { - m_Position = xAnnotation->getPosition(); - m_Size = xAnnotation->getSize(); - m_Author = xAnnotation->getAuthor(); - m_Initials = xAnnotation->getInitials(); - m_DateTime = xAnnotation->getDateTime(); - uno::Reference<text::XText> xText(xAnnotation->getTextRange()); - m_Text = xText->getString(); - } - - void set( const rtl::Reference< Annotation >& xAnnotation ) - { - xAnnotation->setPosition(m_Position); - xAnnotation->setSize(m_Size); - xAnnotation->setAuthor(m_Author); - xAnnotation->setInitials(m_Initials); - xAnnotation->setDateTime(m_DateTime); - uno::Reference<text::XText> xText(xAnnotation->getTextRange()); - xText->setString(m_Text); - } -}; - -class UndoAnnotation : public SdrUndoAction -{ -public: - explicit UndoAnnotation( Annotation& rAnnotation ); - - virtual void Undo() override; - virtual void Redo() override; - -protected: - rtl::Reference< Annotation > mxAnnotation; - AnnotationData maUndoData; - AnnotationData maRedoData; -}; - } void createAnnotation(rtl::Reference<Annotation>& xAnnotation, SdPage* pPage ) @@ -272,11 +225,23 @@ void SAL_CALL Annotation::setDateTime(const util::DateTime & the_value) } } +OUString Annotation::GetText() +{ + uno::Reference<text::XText> xText(getTextRange()); + return xText->getString(); +} + +void Annotation::SetText(OUString const& rText) +{ + uno::Reference<text::XText> xText(getTextRange()); + return xText->setString(rText); +} + void Annotation::createChangeUndo() { SdrModel* pModel = GetModel(); // TTTT should use reference if( pModel && pModel->IsUndoEnabled() ) - pModel->AddUndo( std::make_unique<UndoAnnotation>( *this ) ); + pModel->AddUndo(createUndoAnnotation()); if( pModel ) { @@ -312,90 +277,6 @@ std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation( const uno::Re } } -void CreateChangeUndo(const uno::Reference<office::XAnnotation>& xAnnotation) -{ - Annotation* pAnnotation = dynamic_cast<Annotation*>(xAnnotation.get()); - if (pAnnotation) - pAnnotation->createChangeUndo(); -} - -sal_uInt32 getAnnotationId(const uno::Reference<office::XAnnotation>& xAnnotation) -{ - Annotation* pAnnotation = dynamic_cast<Annotation*>(xAnnotation.get()); - sal_uInt32 nId = 0; - if (pAnnotation) - nId = pAnnotation->GetId(); - return nId; -} - -const SdPage* getAnnotationPage(const uno::Reference<office::XAnnotation>& xAnnotation) -{ - Annotation* pAnnotation = dynamic_cast<Annotation*>(xAnnotation.get()); - if (pAnnotation) - return pAnnotation->GetPage(); - return nullptr; -} - -namespace -{ -OString lcl_LOKGetCommentPayload(CommentNotificationType nType, uno::Reference<office::XAnnotation> const & rxAnnotation) -{ - ::tools::JsonWriter aJsonWriter; - { - auto aCommentNode = aJsonWriter.startNode("comment"); - - aJsonWriter.put("action", (nType == CommentNotificationType::Add ? "Add" : - (nType == CommentNotificationType::Remove ? "Remove" : - (nType == CommentNotificationType::Modify ? "Modify" : "???")))); - aJsonWriter.put("id", sd::getAnnotationId(rxAnnotation)); - - if (nType != CommentNotificationType::Remove && rxAnnotation.is()) - { - aJsonWriter.put("id", sd::getAnnotationId(rxAnnotation)); - aJsonWriter.put("author", rxAnnotation->getAuthor()); - aJsonWriter.put("dateTime", utl::toISO8601(rxAnnotation->getDateTime())); - uno::Reference<text::XText> xText(rxAnnotation->getTextRange()); - aJsonWriter.put("text", xText->getString()); - const SdPage* pPage = sd::getAnnotationPage(rxAnnotation); - aJsonWriter.put("parthash", pPage ? OString::number(pPage->GetHashCode()) : OString()); - geometry::RealPoint2D const & rPoint = rxAnnotation->getPosition(); - geometry::RealSize2D const & rSize = rxAnnotation->getSize(); - ::tools::Rectangle aRectangle(Point(rPoint.X * 100.0, rPoint.Y * 100.0), Size(rSize.Width * 100.0, rSize.Height * 100.0)); - aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip)); - OString sRectangle = aRectangle.toString(); - aJsonWriter.put("rectangle", sRectangle.getStr()); - } - } - return aJsonWriter.finishAndGetAsOString(); -} -} // anonymous ns - -void LOKCommentNotify(CommentNotificationType nType, const SfxViewShell* pViewShell, uno::Reference<office::XAnnotation> const & rxAnnotation) -{ - // callbacks only if tiled annotations are explicitly turned off by LOK client - if (!comphelper::LibreOfficeKit::isActive() || comphelper::LibreOfficeKit::isTiledAnnotations()) - return ; - - OString aPayload = lcl_LOKGetCommentPayload(nType, rxAnnotation); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, aPayload); -} - -void LOKCommentNotifyAll(CommentNotificationType nType, uno::Reference<office::XAnnotation> const & rxAnnotation) -{ - // callbacks only if tiled annotations are explicitly turned off by LOK client - if (!comphelper::LibreOfficeKit::isActive() || comphelper::LibreOfficeKit::isTiledAnnotations()) - return ; - - OString aPayload = lcl_LOKGetCommentPayload(nType, rxAnnotation); - - const SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, aPayload); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } -} - UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert ) : SdrUndoAction( *rAnnotation.GetModel() ) , mxAnnotation( &rAnnotation ) @@ -425,8 +306,7 @@ void UndoInsertOrRemoveAnnotation::Undo() else { pPage->addAnnotation( mxAnnotation, mnIndex ); - uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation ); - LOKCommentNotifyAll( CommentNotificationType::Add, xAnnotation ); + LOKCommentNotifyAll(sdr::annotation::CommentNotificationType::Add, *mxAnnotation); } } @@ -440,8 +320,7 @@ void UndoInsertOrRemoveAnnotation::Redo() if( mbInsert ) { pPage->addAnnotation( mxAnnotation, mnIndex ); - uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation ); - LOKCommentNotifyAll( CommentNotificationType::Add, xAnnotation ); + LOKCommentNotifyAll(sdr::annotation::CommentNotificationType::Add, *mxAnnotation); } else { @@ -449,27 +328,6 @@ void UndoInsertOrRemoveAnnotation::Redo() } } -UndoAnnotation::UndoAnnotation( Annotation& rAnnotation ) -: SdrUndoAction( *rAnnotation.GetModel() ) -, mxAnnotation( &rAnnotation ) -{ - maUndoData.get( mxAnnotation ); -} - -void UndoAnnotation::Undo() -{ - maRedoData.get( mxAnnotation ); - maUndoData.set( mxAnnotation ); - LOKCommentNotifyAll( CommentNotificationType::Modify, mxAnnotation ); -} - -void UndoAnnotation::Redo() -{ - maUndoData.get( mxAnnotation ); - maRedoData.set( mxAnnotation ); - LOKCommentNotifyAll( CommentNotificationType::Modify, mxAnnotation ); -} - } // namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index ac79f2e15724..02b46a324908 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -235,9 +235,9 @@ void SAL_CALL AnnotationManagerImpl::notifyEvent( const css::document::EventObje if ( aEvent.EventName == "OnAnnotationRemoved" ) { Reference< XAnnotation > xAnnotation( aEvent.Source, uno::UNO_QUERY ); - if ( xAnnotation.is() ) + if (auto pAnnotation = dynamic_cast<sd::Annotation*>(xAnnotation.get()) ) { - LOKCommentNotify(CommentNotificationType::Remove, &mrBase, xAnnotation); + LOKCommentNotify(sdr::annotation::CommentNotificationType::Remove, &mrBase, *pAnnotation); } } @@ -258,8 +258,8 @@ rtl::Reference<Annotation> AnnotationManagerImpl::GetAnnotationById(sal_uInt32 n { AnnotationVector aAnnotations(pPage->getAnnotations()); auto iter = std::find_if(aAnnotations.begin(), aAnnotations.end(), - [nAnnotationId](const Reference<XAnnotation>& xAnnotation) { - return sd::getAnnotationId(xAnnotation) == nAnnotationId; + [nAnnotationId](rtl::Reference<sd::Annotation>& xAnnotation) { + return xAnnotation->GetId() == nAnnotationId; }); if (iter != aAnnotations.end()) return *iter; @@ -389,7 +389,7 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq) void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq) { const SfxItemSet* pArgs = rReq.GetArgs(); - Reference< XAnnotation > xAnnotation; + rtl::Reference<sd::Annotation> xAnnotation; OUString sText; sal_Int32 nPositionX = -1; sal_Int32 nPositionY = -1; @@ -416,7 +416,7 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq) if (xAnnotation.is()) { - CreateChangeUndo(xAnnotation); + xAnnotation->createChangeUndo(); if (nPositionX >= 0 && nPositionY >= 0) { @@ -431,8 +431,7 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq) Reference<XText> xText(xAnnotation->getTextRange()); xText->setString(sText); } - - LOKCommentNotifyAll(CommentNotificationType::Modify, xAnnotation); + LOKCommentNotifyAll(sdr::annotation::CommentNotificationType::Modify, *xAnnotation); } if (mpDoc->IsUndoEnabled()) @@ -529,7 +528,7 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText) mpDoc->EndUndo(); // Tell our LOK clients about new comment added - LOKCommentNotifyAll(CommentNotificationType::Add, xAnnotation); + LOKCommentNotifyAll(sdr::annotation::CommentNotificationType::Add, *xAnnotation); UpdateTags(true); SelectAnnotation( xAnnotation, true ); @@ -570,7 +569,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq ) if (mpDoc->IsUndoEnabled()) mpDoc->BegUndo(SdResId(STR_ANNOTATION_REPLY)); - CreateChangeUndo(xAnnotation); + xAnnotation->createChangeUndo(); ::Outliner aOutliner( GetAnnotationPool(),OutlinerMode::TextObject ); SdDrawDocument::SetCalcFieldValueHdl( &aOutliner ); @@ -626,7 +625,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq ) xAnnotation->setDateTime( getCurrentDateTime() ); // Tell our LOK clients about this (comment modification) - LOKCommentNotifyAll(CommentNotificationType::Modify, xAnnotation); + LOKCommentNotifyAll(sdr::annotation::CommentNotificationType::Modify, *xAnnotation); if( mpDoc->IsUndoEnabled() ) mpDoc->EndUndo(); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 0fc6bcbcfdeb..bd97913ade5c 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2556,7 +2556,7 @@ void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter) for (const rtl::Reference<Annotation>& xAnnotation : aPageAnnotations) { - sal_uInt32 nID = sd::getAnnotationId(xAnnotation); + sal_uInt32 nID = xAnnotation->GetId(); OString nodeName = "comment" + OString::number(nID); auto commentNode = rJsonWriter.startNode(nodeName); rJsonWriter.put("id", nID); diff --git a/svx/source/annotation/Annotation.cxx b/svx/source/annotation/Annotation.cxx index df6e2175cef6..afa8d0f525dd 100644 --- a/svx/source/annotation/Annotation.cxx +++ b/svx/source/annotation/Annotation.cxx @@ -8,11 +8,141 @@ */ #include <svx/annotation/Annotation.hxx> +#include <tools/json_writer.hxx> +#include <sfx2/viewsh.hxx> +#include <unotools/datetime.hxx> +#include <comphelper/lok.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> + +using namespace css; namespace sdr::annotation { +namespace +{ +OString lcl_LOKGetCommentPayload(CommentNotificationType nType, Annotation& rAnnotation) +{ + tools::JsonWriter aJsonWriter; + { + auto aCommentNode = aJsonWriter.startNode("comment"); + + aJsonWriter.put( + "action", + (nType == CommentNotificationType::Add + ? "Add" + : (nType == CommentNotificationType::Remove + ? "Remove" + : (nType == CommentNotificationType::Modify ? "Modify" : "???")))); + aJsonWriter.put("id", rAnnotation.GetId()); + + if (nType != CommentNotificationType::Remove) + { + aJsonWriter.put("id", rAnnotation.GetId()); + aJsonWriter.put("author", rAnnotation.GetAuthor()); + aJsonWriter.put("dateTime", utl::toISO8601(rAnnotation.GetDateTime())); + aJsonWriter.put("text", rAnnotation.GetText()); + SdrPage const* pPage = rAnnotation.getPage(); + sal_Int64 nHash = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pPage)); + aJsonWriter.put("parthash", pPage ? OString::number(nHash) : OString()); + geometry::RealPoint2D const& rPoint = rAnnotation.GetPosition(); + geometry::RealSize2D const& rSize = rAnnotation.GetSize(); + tools::Rectangle aRectangle( + Point(std::round(o3tl::toTwips(rPoint.X, o3tl::Length::mm)), + std::round(o3tl::toTwips(rPoint.Y, o3tl::Length::mm))), + Size(std::round(o3tl::toTwips(rSize.Width, o3tl::Length::mm)), + std::round(o3tl::toTwips(rSize.Height, o3tl::Length::mm)))); + aJsonWriter.put("rectangle", aRectangle.toString()); + } + } + return aJsonWriter.finishAndGetAsOString(); +} + +class UndoAnnotation : public SdrUndoAction +{ +public: + explicit UndoAnnotation(Annotation& rAnnotation) + : SdrUndoAction(*rAnnotation.GetModel()) + , mrAnnotation(rAnnotation) + { + maUndoData.get(mrAnnotation); + } + + void Undo() override + { + maRedoData.get(mrAnnotation); + maUndoData.set(mrAnnotation); + LOKCommentNotifyAll(CommentNotificationType::Modify, mrAnnotation); + } + + void Redo() override + { + maUndoData.get(mrAnnotation); + maRedoData.set(mrAnnotation); + LOKCommentNotifyAll(CommentNotificationType::Modify, mrAnnotation); + } + +protected: + Annotation& mrAnnotation; + AnnotationData maUndoData; + AnnotationData maRedoData; +}; + +} // anonymous ns + +void LOKCommentNotify(CommentNotificationType nType, const SfxViewShell* pViewShell, + Annotation& rAnnotation) +{ + // callbacks only if tiled annotations are explicitly turned off by LOK client + if (!comphelper::LibreOfficeKit::isActive() || comphelper::LibreOfficeKit::isTiledAnnotations()) + return; + + OString aPayload = lcl_LOKGetCommentPayload(nType, rAnnotation); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, aPayload); +} + +void LOKCommentNotifyAll(CommentNotificationType nType, Annotation& rAnnotation) +{ + // callbacks only if tiled annotations are explicitly turned off by LOK client + if (!comphelper::LibreOfficeKit::isActive() || comphelper::LibreOfficeKit::isTiledAnnotations()) + return; + + OString aPayload = lcl_LOKGetCommentPayload(nType, rAnnotation); + + const SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, aPayload); + pViewShell = SfxViewShell::GetNext(*pViewShell); + } +} + +void AnnotationData::get(Annotation& rAnnotation) +{ + m_Position = rAnnotation.GetPosition(); + m_Size = rAnnotation.GetSize(); + m_Author = rAnnotation.GetAuthor(); + m_Initials = rAnnotation.GetInitials(); + m_DateTime = rAnnotation.GetDateTime(); + m_Text = rAnnotation.GetText(); +} + +void AnnotationData::set(Annotation& rAnnotation) +{ + rAnnotation.SetPosition(m_Position); + rAnnotation.SetSize(m_Size); + rAnnotation.SetAuthor(m_Author); + rAnnotation.SetInitials(m_Initials); + rAnnotation.SetDateTime(m_DateTime); + rAnnotation.SetText(m_Text); +} + sal_uInt32 Annotation::m_nLastId = 1; +std::unique_ptr<SdrUndoAction> Annotation::createUndoAnnotation() +{ + return std::make_unique<UndoAnnotation>(*this); +} + } // namespace sdr::annotation /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
