summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/annotation/Annotation.hxx36
-rw-r--r--include/svx/annotation/AnnotationEnumeration.hxx (renamed from sd/inc/AnnotationEnumeration.hxx)11
-rw-r--r--include/svx/svdpage.hxx13
-rw-r--r--sd/Library_sd.mk1
-rw-r--r--sd/inc/Annotation.hxx17
-rw-r--r--sd/inc/sdpage.hxx12
-rw-r--r--sd/source/core/annotations/Annotation.cxx68
-rw-r--r--sd/source/core/sdpage2.cxx50
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx7
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx80
-rw-r--r--sd/source/ui/annotations/annotationmanagerimpl.hxx20
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx23
-rw-r--r--sd/source/ui/annotations/annotationtag.hxx11
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx3
-rw-r--r--sd/source/ui/unoidl/unopage.cxx6
-rw-r--r--svx/Library_svxcore.mk1
-rw-r--r--svx/source/annotation/Annotation.cxx20
-rw-r--r--svx/source/annotation/AnnotationEnumeration.cxx (renamed from sd/source/core/annotations/AnnotationEnumeration.cxx)46
-rw-r--r--svx/source/svdraw/svdpage.cxx1
19 files changed, 228 insertions, 198 deletions
diff --git a/include/svx/annotation/Annotation.hxx b/include/svx/annotation/Annotation.hxx
index 566dd6ef52f4..5ec5e2ec3c34 100644
--- a/include/svx/annotation/Annotation.hxx
+++ b/include/svx/annotation/Annotation.hxx
@@ -13,12 +13,17 @@
#include <com/sun/star/geometry/RealSize2D.hpp>
#include <com/sun/star/util/DateTime.hpp>
-#include <svx/svdpage.hxx>
#include <svx/svdundo.hxx>
#include <svx/svxdllapi.h>
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <comphelper/compbase.hxx>
+#include <cppuhelper/propertysetmixin.hxx>
+#include <svx/annotation/Annotation.hxx>
+
class SdrUndoAction;
class SfxViewShell;
+class SdrPage;
namespace sdr::annotation
{
@@ -49,13 +54,15 @@ struct SVXCORE_DLLPUBLIC AnnotationData
};
class SVXCORE_DLLPUBLIC Annotation
+ : public ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>,
+ public ::cppu::PropertySetMixin<css::office::XAnnotation>
{
private:
static sal_uInt32 m_nLastId;
static sal_uInt32 nextID() { return m_nLastId++; }
protected:
- SdrPage* mpSdrPage;
+ SdrPage* mpPage;
sal_uInt32 m_nId;
css::geometry::RealPoint2D m_Position;
@@ -69,10 +76,19 @@ protected:
std::unique_ptr<SdrUndoAction> createUndoAnnotation();
public:
- Annotation(SdrPage* pPage)
- : mpSdrPage(pPage)
- , m_nId(nextID())
+ Annotation(const css::uno::Reference<css::uno::XComponentContext>& context, SdrPage* pPage);
+ Annotation(const Annotation&) = delete;
+ Annotation& operator=(const Annotation&) = delete;
+
+ // XInterface:
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const& type) override;
+ virtual void SAL_CALL acquire() noexcept override
+ {
+ ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>::acquire();
+ }
+ virtual void SAL_CALL release() noexcept override
{
+ ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>::release();
}
css::geometry::RealPoint2D GetPosition() const { return m_Position; }
@@ -93,11 +109,9 @@ public:
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; }
+ SdrModel* GetModel() const;
+ SdrPage const* getPage() const { return mpPage; }
+ SdrPage* getPage() { return mpPage; }
sal_uInt32 GetId() const { return m_nId; }
@@ -106,7 +120,7 @@ public:
bool isFreeText() const { return m_bIsFreeText; }
};
-//typedef std::vector<rtl::Reference<Annotation>> AnnotationVector;
+typedef std::vector<rtl::Reference<Annotation>> AnnotationVector;
} // namespace sdr::annotation
diff --git a/sd/inc/AnnotationEnumeration.hxx b/include/svx/annotation/AnnotationEnumeration.hxx
index ed35b46b4068..a7befcb26946 100644
--- a/sd/inc/AnnotationEnumeration.hxx
+++ b/include/svx/annotation/AnnotationEnumeration.hxx
@@ -20,18 +20,19 @@
#pragma once
#include <sal/config.h>
-
-#include "sdpage.hxx"
+#include <svx/svxdllapi.h>
namespace com::sun::star::office
{
class XAnnotationEnumeration;
}
-namespace sd
+namespace sdr::annotation
{
-css::uno::Reference<css::office::XAnnotationEnumeration>
-createAnnotationEnumeration(AnnotationVector&&);
+class Annotation;
+SVXCORE_DLLPUBLIC css::uno::Reference<css::office::XAnnotationEnumeration>
+createAnnotationEnumeration(
+ std::vector<rtl::Reference<sdr::annotation::Annotation>>&& xAnnotationVector);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 2afc716e8949..c8c7eecddd5c 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -36,11 +36,11 @@
#include <vector>
#include <deque>
-
// predefines
namespace model { class Theme; }
namespace reportdesign { class OSection; }
namespace sdr::contact { class ViewContact; }
+namespace sdr::annotation { class Annotation; }
class SdrPage;
class SdrModel;
class SfxItemPool;
@@ -421,6 +421,9 @@ private:
// the SdrModel this page was created with, unchanged during SdrPage lifetime
SdrModel& mrSdrModelFromSdrPage;
+protected:
+ std::vector<rtl::Reference<sdr::annotation::Annotation>> maAnnotations;
+
private:
tools::Long mnWidth; // page size
tools::Long mnHeight; // page size
@@ -515,8 +518,8 @@ public:
protected:
void TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage);
-public:
+public:
/// changing the layers does not set the modified-flag!
const SdrLayerAdmin& GetLayerAdmin() const;
SdrLayerAdmin& GetLayerAdmin();
@@ -551,6 +554,12 @@ public:
bool bEdit );
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ virtual void createAnnotation(rtl::Reference<sdr::annotation::Annotation>& /*xAnnotation*/) { assert(false); }
+ virtual void addAnnotation(rtl::Reference<sdr::annotation::Annotation> const& /*xAnnotation*/, int /*nIndex*/) { assert(false); }
+ virtual void removeAnnotation(rtl::Reference<sdr::annotation::Annotation> const& /*xAnnotation*/) { assert(false); }
+
+ std::vector<rtl::Reference<sdr::annotation::Annotation>> const& getAnnotations() const { return maAnnotations; }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 9180714846d2..dc9b38f011f3 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -158,7 +158,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/core/ThemeColorChanger \
sd/source/core/anminfo \
sd/source/core/annotations/Annotation \
- sd/source/core/annotations/AnnotationEnumeration \
sd/source/core/cusshow \
sd/source/core/drawdoc \
sd/source/core/drawdoc2 \
diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx
index 9ab11b0394f9..f19584525865 100644
--- a/sd/inc/Annotation.hxx
+++ b/sd/inc/Annotation.hxx
@@ -46,9 +46,9 @@ class SfxViewShell;
namespace sd
{
-void createAnnotation( rtl::Reference< Annotation >& xAnnotation, SdPage* pPage );
+void createAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation, SdPage* pPage);
-std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation( const rtl::Reference< sd::Annotation >& xAnnotation, bool bInsert );
+std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation, bool bInsert);
struct SD_DLLPUBLIC CustomAnnotationMarker
{
@@ -58,22 +58,14 @@ struct SD_DLLPUBLIC CustomAnnotationMarker
std::vector<basegfx::B2DPolygon> maPolygons;
};
-class SAL_DLLPUBLIC_RTTI Annotation final :
- public sdr::annotation::Annotation,
- public ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>,
- public ::cppu::PropertySetMixin<css::office::XAnnotation>
+class SAL_DLLPUBLIC_RTTI Annotation final : public sdr::annotation::Annotation
{
public:
explicit Annotation( const css::uno::Reference<css::uno::XComponentContext>& context, SdPage* pPage );
Annotation(const Annotation&) = delete;
Annotation& operator=(const Annotation&) = delete;
- SdPage* GetPage() const { return mpPage; }
-
- // XInterface:
- virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override;
- virtual void SAL_CALL acquire() noexcept override { ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>::acquire(); }
- virtual void SAL_CALL release() noexcept override { ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>::release(); }
+ virtual ~Annotation();
// css::beans::XPropertySet:
virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
@@ -129,7 +121,6 @@ private:
void createChangeUndoImpl(std::unique_lock<std::mutex>& g);
- SdPage* mpPage;
rtl::Reference<TextApiObject> m_TextRange;
std::unique_ptr<CustomAnnotationMarker> m_pCustomAnnotationMarker;
};
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index ef127ea60769..3903a59b23ed 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -79,8 +79,6 @@ namespace sd {
bool operator==( const HeaderFooterSettings& rSettings ) const;
};
-
- typedef std::vector< rtl::Reference< Annotation > > AnnotationVector;
}
namespace sd {
@@ -124,8 +122,6 @@ friend class sd::UndoAttrObject;
sal_uInt16 mnPaperBin; ///< PaperBin
SdPageLink* mpPageLink; ///< Page link (at left sides only)
- sd::AnnotationVector maAnnotations;
-
/** holds the smil animation sequences for this page */
css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode;
@@ -368,10 +364,10 @@ public:
*/
bool IsPrecious() const { return mbIsPrecious; }
- void createAnnotation( rtl::Reference< sd::Annotation >& xAnnotation );
- void addAnnotation( const rtl::Reference< sd::Annotation >& xAnnotation, int nIndex );
- void removeAnnotation( const rtl::Reference< sd::Annotation >& xAnnotation );
- const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
+ void createAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation) override;
+ void addAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, int nIndex) override;
+ void removeAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation) override;
+
bool Equals(const SdPage&) const;
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
sal_uInt16 getPageId() const { return mnPageId; }
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index 92075d53c7f5..8c3e76d6a95f 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -48,33 +48,33 @@ namespace {
class UndoInsertOrRemoveAnnotation : public SdrUndoAction
{
public:
- UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert );
+ UndoInsertOrRemoveAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation, bool bInsert);
virtual void Undo() override;
virtual void Redo() override;
protected:
- rtl::Reference< Annotation > mxAnnotation;
+ rtl::Reference<sdr::annotation::Annotation> mxAnnotation;
bool mbInsert;
- int mnIndex;
+ int mnIndex = 0;
};
}
-void createAnnotation(rtl::Reference<Annotation>& xAnnotation, SdPage* pPage )
+void createAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation, SdPage* pPage )
{
- xAnnotation.set(
- new Annotation(comphelper::getProcessComponentContext(), pPage));
+ xAnnotation.set(new Annotation(comphelper::getProcessComponentContext(), pPage));
pPage->addAnnotation(xAnnotation, -1);
}
Annotation::Annotation(const uno::Reference<uno::XComponentContext>& context, SdPage* pPage)
- : sdr::annotation::Annotation(pPage)
- , ::cppu::PropertySetMixin<office::XAnnotation>(context, IMPLEMENTS_PROPERTY_SET, uno::Sequence<OUString>())
- , mpPage(pPage)
+ : sdr::annotation::Annotation(context, pPage)
{
}
+Annotation::~Annotation()
+{}
+
// override WeakComponentImplHelperBase::disposing()
// This function is called upon disposing the component,
// if your component needs special work when it becomes
@@ -89,11 +89,6 @@ void Annotation::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
}
}
-uno::Any Annotation::queryInterface(css::uno::Type const & type)
-{
- return ::comphelper::WeakComponentImplHelper<office::XAnnotation>::queryInterface(type);
-}
-
// com.sun.star.beans.XPropertySet:
uno::Reference<beans::XPropertySetInfo> SAL_CALL Annotation::getPropertySetInfo()
{
@@ -273,11 +268,11 @@ uno::Reference<text::XText> SAL_CALL Annotation::getTextRange()
return m_TextRange;
}
-std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation( const rtl::Reference<sd::Annotation>& xAnnotation, bool bInsert )
+std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation, bool bInsert)
{
- if( xAnnotation )
+ if (xAnnotation)
{
- return std::make_unique< UndoInsertOrRemoveAnnotation >( *xAnnotation, bInsert );
+ return std::make_unique<UndoInsertOrRemoveAnnotation>(xAnnotation, bInsert);
}
else
{
@@ -285,54 +280,53 @@ std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation( const rtl::Re
}
}
-UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert )
-: SdrUndoAction( *rAnnotation.GetModel() )
-, mxAnnotation( &rAnnotation )
-, mbInsert( bInsert )
-, mnIndex( 0 )
+UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation, bool bInsert)
+ : SdrUndoAction(*xAnnotation->GetModel())
+ , mxAnnotation(xAnnotation)
+ , mbInsert(bInsert)
{
- SdPage* pPage = rAnnotation.GetPage();
- if( pPage )
+ SdrPage const* pPage = mxAnnotation->getPage();
+ if (pPage)
{
- const AnnotationVector& rVec = pPage->getAnnotations();
- auto iter = std::find(rVec.begin(), rVec.end(), &rAnnotation);
- mnIndex += std::distance(rVec.begin(), iter);
+ sdr::annotation::AnnotationVector const& rVector = pPage->getAnnotations();
+ auto iterator = std::find(rVector.begin(), rVector.end(), mxAnnotation);
+ mnIndex += std::distance(rVector.begin(), iterator);
}
}
void UndoInsertOrRemoveAnnotation::Undo()
{
- SdPage* pPage = mxAnnotation->GetPage();
+ SdrPage* pPage = mxAnnotation->getPage();
SdrModel* pModel = mxAnnotation->GetModel();
- if( !(pPage && pModel) )
+ if (!pPage || !pModel)
return;
- if( mbInsert )
+ if (mbInsert)
{
- pPage->removeAnnotation( mxAnnotation );
+ pPage->removeAnnotation(mxAnnotation);
}
else
{
- pPage->addAnnotation( mxAnnotation, mnIndex );
+ pPage->addAnnotation(mxAnnotation, mnIndex);
LOKCommentNotifyAll(sdr::annotation::CommentNotificationType::Add, *mxAnnotation);
}
}
void UndoInsertOrRemoveAnnotation::Redo()
{
- SdPage* pPage = mxAnnotation->GetPage();
+ SdrPage* pPage = mxAnnotation->getPage();
SdrModel* pModel = mxAnnotation->GetModel();
- if( !(pPage && pModel) )
+ if (!pPage || !pModel)
return;
- if( mbInsert )
+ if (mbInsert)
{
- pPage->addAnnotation( mxAnnotation, mnIndex );
+ pPage->addAnnotation(mxAnnotation, mnIndex);
LOKCommentNotifyAll(sdr::annotation::CommentNotificationType::Add, *mxAnnotation);
}
else
{
- pPage->removeAnnotation( mxAnnotation );
+ pPage->removeAnnotation(mxAnnotation);
}
}
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 0e4840afc48d..74d3dd94334f 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -377,19 +377,19 @@ void SdPage::lateInit(const SdPage& rSrcPage)
rSrcPage.cloneAnimations(*this);
// annotations
- for(const rtl::Reference< Annotation >& srcAnnotation : rSrcPage.maAnnotations)
+ for (auto const& rSourceAnnotation : rSrcPage.maAnnotations)
{
- rtl::Reference< Annotation > ref;
- createAnnotation(ref);
- ref->setPosition(srcAnnotation->getPosition());
- ref->setSize(srcAnnotation->getSize());
- ref->setAuthor(srcAnnotation->getAuthor());
- ref->setInitials(srcAnnotation->getInitials());
- ref->setDateTime(srcAnnotation->getDateTime());
- Reference< ::css::text::XTextCopy > srcRange ( srcAnnotation->getTextRange(), uno::UNO_QUERY);
- Reference< ::css::text::XTextCopy > range ( ref->getTextRange(), uno::UNO_QUERY);
- if(srcRange.is() && range.is())
- range->copyText( srcRange );
+ rtl::Reference<sdr::annotation::Annotation> aNewAnnotation;
+ createAnnotation(aNewAnnotation);
+ aNewAnnotation->setPosition(rSourceAnnotation->getPosition());
+ aNewAnnotation->setSize(rSourceAnnotation->getSize());
+ aNewAnnotation->setAuthor(rSourceAnnotation->getAuthor());
+ aNewAnnotation->setInitials(rSourceAnnotation->getInitials());
+ aNewAnnotation->setDateTime(rSourceAnnotation->getDateTime());
+ uno::Reference<css::text::XTextCopy> xSourceRange (rSourceAnnotation->getTextRange(), uno::UNO_QUERY);
+ uno::Reference<css::text::XTextCopy> xRange (aNewAnnotation->getTextRange(), uno::UNO_QUERY);
+ if(xSourceRange.is() && xRange.is())
+ xRange->copyText(xSourceRange);
}
// fix user calls for duplicated slide
@@ -552,16 +552,16 @@ bool SdPage::Equals(const SdPage& rOtherPage) const
return true;
}
-void SdPage::createAnnotation( rtl::Reference< Annotation >& xAnnotation )
+void SdPage::createAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation)
{
- sd::createAnnotation( xAnnotation, this );
+ sd::createAnnotation(xAnnotation, this);
}
-void SdPage::addAnnotation( const rtl::Reference< Annotation >& xAnnotation, int nIndex )
+void SdPage::addAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, int nIndex )
{
- if( (nIndex == -1) || (nIndex > static_cast<int>(maAnnotations.size())) )
+ if ((nIndex == -1) || (nIndex > int(maAnnotations.size())))
{
- maAnnotations.push_back( xAnnotation );
+ maAnnotations.push_back(xAnnotation);
}
else
{
@@ -570,8 +570,9 @@ void SdPage::addAnnotation( const rtl::Reference< Annotation >& xAnnotation, int
if( getSdrModelFromSdrPage().IsUndoEnabled() )
{
- std::unique_ptr<SdrUndoAction> pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true );
- if( pAction )
+ rtl::Reference<sdr::annotation::Annotation> xUnconstAnnotation(xAnnotation);
+ std::unique_ptr<SdrUndoAction> pAction = CreateUndoInsertOrRemoveAnnotation(xUnconstAnnotation, true);
+ if (pAction)
getSdrModelFromSdrPage().AddUndo( std::move(pAction) );
}
@@ -583,18 +584,19 @@ void SdPage::addAnnotation( const rtl::Reference< Annotation >& xAnnotation, int
Reference<XInterface>(static_cast<cppu::OWeakObject*>(xAnnotation.get()), UNO_QUERY));
}
-void SdPage::removeAnnotation( const rtl::Reference< Annotation >& xAnnotation )
+void SdPage::removeAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation)
{
if( getSdrModelFromSdrPage().IsUndoEnabled() )
{
- std::unique_ptr<SdrUndoAction> pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false );
+ rtl::Reference<sdr::annotation::Annotation> xUnconstAnnotation(xAnnotation);
+ std::unique_ptr<SdrUndoAction> pAction = CreateUndoInsertOrRemoveAnnotation(xUnconstAnnotation, false);
if( pAction )
getSdrModelFromSdrPage().AddUndo( std::move(pAction) );
}
- AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation );
- if( iter != maAnnotations.end() )
- maAnnotations.erase( iter );
+ sdr::annotation::AnnotationVector::iterator iterator = std::find(maAnnotations.begin(), maAnnotations.end(), xAnnotation);
+ if (iterator != maAnnotations.end())
+ maAnnotations.erase(iterator);
getSdrModelFromSdrPage().SetChanged();
NotifyDocumentEvent(
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index c0800010e16a..70ebf0634b95 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -93,7 +93,7 @@ bool SdPdfFilter::Import()
for (auto const& rPDFAnnotation : rPDFGraphicResult.GetAnnotations())
{
- rtl::Reference<sd::Annotation> xAnnotation;
+ rtl::Reference<sdr::annotation::Annotation> xAnnotation;
pPage->createAnnotation(xAnnotation);
xAnnotation->setAuthor(rPDFAnnotation.maAuthor);
@@ -111,9 +111,10 @@ bool SdPdfFilter::Import()
if (rPDFAnnotation.mpMarker)
{
- xAnnotation->createCustomAnnotationMarker();
+ auto* pAnnotation = static_cast<sd::Annotation*>(xAnnotation.get());
+ pAnnotation->createCustomAnnotationMarker();
sd::CustomAnnotationMarker& rCustomAnnotationMarker
- = xAnnotation->getCustomAnnotationMarker();
+ = pAnnotation->getCustomAnnotationMarker();
rCustomAnnotationMarker.maLineColor = rPDFAnnotation.maColor;
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 41f86dda60ee..622a1e5a2c10 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -242,7 +242,7 @@ void SAL_CALL AnnotationManagerImpl::disposing( const css::lang::EventObject& /*
{
}
-rtl::Reference<Annotation> AnnotationManagerImpl::GetAnnotationById(sal_uInt32 nAnnotationId)
+rtl::Reference<sdr::annotation::Annotation> AnnotationManagerImpl::GetAnnotationById(sal_uInt32 nAnnotationId)
{
SdPage* pPage = nullptr;
do
@@ -250,17 +250,18 @@ rtl::Reference<Annotation> AnnotationManagerImpl::GetAnnotationById(sal_uInt32 n
pPage = GetNextPage(pPage, true);
if( pPage && !pPage->getAnnotations().empty() )
{
- AnnotationVector aAnnotations(pPage->getAnnotations());
- auto iter = std::find_if(aAnnotations.begin(), aAnnotations.end(),
- [nAnnotationId](const rtl::Reference<sd::Annotation>& xAnnotation) {
- return xAnnotation->GetId() == nAnnotationId;
+ sdr::annotation::AnnotationVector aAnnotations(pPage->getAnnotations());
+ auto iterator = std::find_if(aAnnotations.begin(), aAnnotations.end(),
+ [nAnnotationId](rtl::Reference<sdr::annotation::Annotation> const& xAnnotation)
+ {
+ return xAnnotation->GetId() == nAnnotationId;
});
- if (iter != aAnnotations.end())
- return *iter;
+ if (iterator != aAnnotations.end())
+ return *iterator;
}
- } while( pPage );
+ } while(pPage);
- rtl::Reference<Annotation> xAnnotationEmpty;
+ rtl::Reference<sdr::annotation::Annotation> xAnnotationEmpty;
return xAnnotationEmpty;
}
@@ -349,7 +350,7 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq)
break;
case SID_DELETE_POSTIT:
{
- rtl::Reference< Annotation > xAnnotation;
+ rtl::Reference<sdr::annotation::Annotation> xAnnotation;
sal_uInt32 nId = 0;
if( pArgs )
{
@@ -359,7 +360,7 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq)
uno::Reference<XAnnotation> xTmpAnnotation;
if (static_cast<const SfxUnoAnyItem*>(pPoolItem)->GetValue() >>= xTmpAnnotation)
{
- xAnnotation = dynamic_cast<Annotation*>(xTmpAnnotation.get());
+ xAnnotation = dynamic_cast<sdr::annotation::Annotation*>(xTmpAnnotation.get());
assert(bool(xAnnotation) == bool(xTmpAnnotation) && "must be of concrete type sd::Annotation");
}
}
@@ -370,9 +371,9 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq)
if (nId != 0)
xAnnotation = GetAnnotationById(nId);
else if( !xAnnotation.is() )
- GetSelectedAnnotation( xAnnotation );
+ GetSelectedAnnotation(xAnnotation);
- DeleteAnnotation( xAnnotation );
+ DeleteAnnotation(xAnnotation);
}
break;
}
@@ -383,7 +384,7 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq)
void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq)
{
const SfxItemSet* pArgs = rReq.GetArgs();
- rtl::Reference< Annotation > xAnnotation;
+ rtl::Reference<sdr::annotation::Annotation> xAnnotation;
OUString sText;
sal_Int32 nPositionX = -1;
sal_Int32 nPositionY = -1;
@@ -410,7 +411,8 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq)
if (xAnnotation.is())
{
- xAnnotation->createChangeUndo();
+ auto pSdAnnotation = static_cast<sd::Annotation*>(xAnnotation.get());
+ pSdAnnotation->createChangeUndo();
if (nPositionX >= 0 && nPositionY >= 0)
{
@@ -447,7 +449,7 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText)
// find free space for new annotation
int y = 0, x = 0;
- AnnotationVector aAnnotations( pPage->getAnnotations() );
+ sdr::annotation::AnnotationVector aAnnotations(pPage->getAnnotations());
if( !aAnnotations.empty() )
{
const int page_width = pPage->GetSize().Width();
@@ -491,8 +493,8 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText)
}
}
- rtl::Reference< Annotation > xAnnotation;
- pPage->createAnnotation( xAnnotation );
+ rtl::Reference<sdr::annotation::Annotation> xAnnotation;
+ pPage->createAnnotation(xAnnotation);
OUString sAuthor;
if (comphelper::LibreOfficeKit::isActive())
@@ -531,7 +533,7 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText)
void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
{
- rtl::Reference< Annotation > xAnnotation;
+ rtl::Reference< sdr::annotation::Annotation> xAnnotation;
const SfxItemSet* pArgs = rReq.GetArgs();
OUString sReplyText;
if( pArgs )
@@ -565,7 +567,11 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
mpDoc->BegUndo(SdResId(STR_ANNOTATION_REPLY));
if (xAnnotation)
- xAnnotation->createChangeUndo();
+ {
+ auto pSdAnnotation = static_cast<sd::Annotation*>(xAnnotation.get());
+ pSdAnnotation->createChangeUndo();
+ }
+
::Outliner aOutliner( GetAnnotationPool(),OutlinerMode::TextObject );
SdDrawDocument::SetCalcFieldValueHdl( &aOutliner );
@@ -630,7 +636,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
SelectAnnotation( xAnnotation, true );
}
-void AnnotationManagerImpl::DeleteAnnotation( const rtl::Reference< Annotation >& xAnnotation )
+void AnnotationManagerImpl::DeleteAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation )
{
SdPage* pPage = GetCurrentPage();
@@ -660,7 +666,7 @@ void AnnotationManagerImpl::DeleteAnnotationsByAuthor( std::u16string_view sAuth
if( pPage )
{
- for( const rtl::Reference< Annotation >& xAnnotation : pPage->getAnnotations() )
+ for (auto const& xAnnotation : pPage->getAnnotations())
{
if( xAnnotation->getAuthor() == sAuthor )
{
@@ -689,8 +695,7 @@ void AnnotationManagerImpl::DeleteAllAnnotations()
if( pPage && !pPage->getAnnotations().empty() )
{
- AnnotationVector aAnnotations( pPage->getAnnotations() );
- for( const auto& rxAnnotation : aAnnotations )
+ for( const auto& rxAnnotation : pPage->getAnnotations())
{
pPage->removeAnnotation( rxAnnotation );
}
@@ -718,8 +723,8 @@ void AnnotationManagerImpl::GetAnnotationState(SfxItemSet& rSet)
rSet.Put(SfxBoolItem(SID_TOGGLE_NOTES, mbShowAnnotations));
- rtl::Reference< Annotation > xAnnotation;
- GetSelectedAnnotation( xAnnotation );
+ rtl::Reference<sdr::annotation::Annotation> xAnnotation;
+ GetSelectedAnnotation(xAnnotation);
// Don't disable these slot in case of LOK, as postit doesn't need to
// selected before doing an operation on it in LOK
@@ -757,13 +762,13 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForward)
{
ShowAnnotations( true );
- rtl::Reference< Annotation > xCurrent;
- GetSelectedAnnotation( xCurrent );
+ rtl::Reference<sdr::annotation::Annotation> xCurrent;
+ GetSelectedAnnotation(xCurrent);
SdPage* pPage = GetCurrentPage();
if( !pPage )
return;
- AnnotationVector aAnnotations( pPage->getAnnotations() );
+ sdr::annotation::AnnotationVector const& aAnnotations = pPage->getAnnotations();
if( bForward )
{
@@ -800,8 +805,9 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForward)
}
else if( !aAnnotations.empty() )
{
- AnnotationVector::iterator iter( aAnnotations.end() );
- SelectAnnotation( *(--iter) );
+ auto iterator = aAnnotations.end();
+ iterator--;
+ SelectAnnotation(*iterator);
return;
}
}
@@ -860,14 +866,14 @@ void AnnotationManagerImpl::onTagSelected( AnnotationTag const & rTag )
void AnnotationManagerImpl::onTagDeselected( AnnotationTag const & rTag )
{
- if( rTag.GetAnnotation() == mxSelectedAnnotation )
+ if (rTag.GetAnnotation() == mxSelectedAnnotation)
{
mxSelectedAnnotation.clear();
invalidateSlots();
}
}
-void AnnotationManagerImpl::SelectAnnotation( const rtl::Reference< Annotation >& xAnnotation, bool bEdit /* = sal_False */ )
+void AnnotationManagerImpl::SelectAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, bool bEdit)
{
mxSelectedAnnotation = xAnnotation;
@@ -881,7 +887,7 @@ void AnnotationManagerImpl::SelectAnnotation( const rtl::Reference< Annotation >
}
}
-void AnnotationManagerImpl::GetSelectedAnnotation( rtl::Reference< Annotation >& xAnnotation )
+void AnnotationManagerImpl::GetSelectedAnnotation( rtl::Reference<sdr::annotation::Annotation>& xAnnotation )
{
xAnnotation = mxSelectedAnnotation;
}
@@ -969,13 +975,13 @@ void AnnotationManagerImpl::CreateTags()
rtl::Reference< AnnotationTag > xSelectedTag;
- for (const rtl::Reference< Annotation > & xAnnotation : mxCurrentPage->getAnnotations() )
+ for (rtl::Reference<sdr::annotation::Annotation> const& xAnnotation : mxCurrentPage->getAnnotations())
{
Color aColor( GetColorLight( mpDoc->GetAnnotationAuthorIndex( xAnnotation->getAuthor() ) ) );
rtl::Reference< AnnotationTag > xTag( new AnnotationTag( *this, *xViewShell->GetView(), xAnnotation, aColor, nIndex++, maFont ) );
maTagVector.push_back(xTag);
- if( xAnnotation == mxSelectedAnnotation )
+ if (xAnnotation == mxSelectedAnnotation)
{
xSelectedTag = xTag;
}
@@ -1044,7 +1050,7 @@ IMPL_LINK(AnnotationManagerImpl,EventMultiplexerListener,
}
}
-void AnnotationManagerImpl::ExecuteAnnotationTagContextMenu(const rtl::Reference<Annotation>& xAnnotation, weld::Widget* pParent, const ::tools::Rectangle& rContextRect)
+void AnnotationManagerImpl::ExecuteAnnotationTagContextMenu(const rtl::Reference<sdr::annotation::Annotation>& xAnnotation, weld::Widget* pParent, const ::tools::Rectangle& rContextRect)
{
SfxDispatcher* pDispatcher( getDispatcher( mrBase ) );
if( !pDispatcher )
diff --git a/sd/source/ui/annotations/annotationmanagerimpl.hxx b/sd/source/ui/annotations/annotationmanagerimpl.hxx
index bbcd5a852199..1a7b60263089 100644
--- a/sd/source/ui/annotations/annotationmanagerimpl.hxx
+++ b/sd/source/ui/annotations/annotationmanagerimpl.hxx
@@ -36,14 +36,14 @@ class SdPage;
class SdDrawDocument;
struct ImplSVEvent;
+namespace sdr::annotation { class Annotation; }
+
namespace sd
{
class Annotation;
class ViewShellBase;
-namespace tools {
-class EventMultiplexerEvent;
-}
+namespace tools { class EventMultiplexerEvent; }
typedef comphelper::WeakComponentImplHelper <
css::document::XEventListener
@@ -73,15 +73,15 @@ public:
void SelectNextAnnotation(bool bForward);
- void SelectAnnotation( const rtl::Reference< Annotation >& xAnnotation, bool bEdit = false );
- void GetSelectedAnnotation( rtl::Reference< Annotation >& xAnnotation );
+ void SelectAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, bool bEdit = false);
+ void GetSelectedAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation);
void InsertAnnotation(const OUString& rText);
- void DeleteAnnotation( const rtl::Reference< Annotation >& xAnnotation );
+ void DeleteAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation);
void DeleteAnnotationsByAuthor( std::u16string_view sAuthor );
void DeleteAllAnnotations();
- void ExecuteAnnotationTagContextMenu(const rtl::Reference<Annotation>& xAnnotation, weld::Widget* pParent, const ::tools::Rectangle& rContextRect);
+ void ExecuteAnnotationTagContextMenu(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, weld::Widget* pParent, const ::tools::Rectangle& rContextRect);
static Color GetColorDark(sal_uInt16 aAuthorIndex);
static Color GetColorLight(sal_uInt16 aAuthorIndex);
@@ -120,14 +120,14 @@ private:
std::vector< rtl::Reference< AnnotationTag > > maTagVector;
css::uno::Reference< css::drawing::XDrawView > mxView;
- rtl::Reference< SdPage > mxCurrentPage;
- rtl::Reference< Annotation > mxSelectedAnnotation;
+ rtl::Reference<SdPage> mxCurrentPage;
+ rtl::Reference<sdr::annotation::Annotation> mxSelectedAnnotation;
bool mbShowAnnotations;
ImplSVEvent * mnUpdateTagsEvent;
vcl::Font maFont;
- rtl::Reference<Annotation> GetAnnotationById(sal_uInt32 nAnnotationId);
+ rtl::Reference<sdr::annotation::Annotation> GetAnnotationById(sal_uInt32 nAnnotationId);
};
OUString getAnnotationDateTimeString( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 8147cedef374..91cfcbbfbcfa 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -43,6 +43,7 @@
#include "annotationmanagerimpl.hxx"
#include "annotationwindow.hxx"
#include "annotationtag.hxx"
+#include <svx/annotation/Annotation.hxx>
#include <Annotation.hxx>
#include <ViewShell.hxx>
#include <Window.hxx>
@@ -159,22 +160,22 @@ namespace {
class AnnotationHdl : public SmartHdl
{
public:
- AnnotationHdl( const SmartTagReference& xTag, const rtl::Reference< Annotation >& xAnnotation, const Point& rPnt );
+ AnnotationHdl( const SmartTagReference& xTag, rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, const Point& rPnt );
virtual void CreateB2dIAObject() override;
virtual bool IsFocusHdl() const override;
private:
- rtl::Reference< sd::Annotation > mxAnnotation;
- rtl::Reference< AnnotationTag > mxTag;
+ rtl::Reference<sdr::annotation::Annotation> mxAnnotation;
+ rtl::Reference<AnnotationTag> mxTag;
};
}
-AnnotationHdl::AnnotationHdl( const SmartTagReference& xTag, const rtl::Reference< Annotation >& xAnnotation, const Point& rPnt )
-: SmartHdl( xTag, rPnt, SdrHdlKind::SmartTag )
-, mxAnnotation( xAnnotation )
-, mxTag( dynamic_cast< AnnotationTag* >( xTag.get() ) )
+AnnotationHdl::AnnotationHdl( const SmartTagReference& xTag, rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, const Point& rPnt )
+ : SmartHdl(xTag, rPnt, SdrHdlKind::SmartTag)
+ , mxAnnotation(xAnnotation)
+ , mxTag(dynamic_cast<AnnotationTag*>(xTag.get()))
{
}
@@ -221,10 +222,10 @@ void AnnotationHdl::CreateB2dIAObject()
if(rPaintWindow.OutputToWindow() && xManager.is() )
{
std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
-
- if (mxAnnotation && mxAnnotation->hasCustomAnnotationMarker())
+ auto pSdAnnotation = dynamic_cast<sd::Annotation*>(mxAnnotation.get());
+ if (pSdAnnotation && pSdAnnotation->hasCustomAnnotationMarker())
{
- CustomAnnotationMarker& rCustomAnnotationMarker = mxAnnotation->getCustomAnnotationMarker();
+ CustomAnnotationMarker& rCustomAnnotationMarker = pSdAnnotation->getCustomAnnotationMarker();
auto& rPolygons = rCustomAnnotationMarker.maPolygons;
if (!rPolygons.empty())
@@ -269,7 +270,7 @@ bool AnnotationHdl::IsFocusHdl() const
return true;
}
-AnnotationTag::AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const rtl::Reference< Annotation >& xAnnotation, Color const & rColor, int nIndex, const vcl::Font& rFont )
+AnnotationTag::AnnotationTag(AnnotationManagerImpl& rManager, ::sd::View& rView, rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, Color const & rColor, int nIndex, const vcl::Font& rFont)
: SmartTag( rView )
, mrManager( rManager )
, mxAnnotation( xAnnotation )
diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx
index b5807a4b08d7..afe6d134a829 100644
--- a/sd/source/ui/annotations/annotationtag.hxx
+++ b/sd/source/ui/annotations/annotationtag.hxx
@@ -26,15 +26,16 @@
namespace com::sun::star::office { class XAnnotation; }
-namespace sd {
-class Annotation;
+namespace sdr::annotation { class Annotation; }
+namespace sd
+{
class View;
class AnnotationManagerImpl;
class AnnotationTag final : public SmartTag
{
public:
- AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const rtl::Reference< Annotation >& xAnnotation, Color const & rColor, int nIndex, const vcl::Font& rFont );
+ AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, Color const & rColor, int nIndex, const vcl::Font& rFont );
virtual ~AnnotationTag() override;
/// @return true if the SmartTag handled the event.
@@ -58,7 +59,7 @@ public:
BitmapEx CreateAnnotationBitmap(bool);
- const rtl::Reference< Annotation >& GetAnnotation() const { return mxAnnotation; }
+ rtl::Reference<sdr::annotation::Annotation> const& GetAnnotation() const { return mxAnnotation; }
void OpenPopup( bool bEdit );
void ClosePopup();
@@ -74,7 +75,7 @@ private:
DECL_LINK(PopupModeEndHdl, weld::Popover&, void);
AnnotationManagerImpl& mrManager;
- rtl::Reference< Annotation > mxAnnotation;
+ rtl::Reference<sdr::annotation::Annotation> mxAnnotation;
std::unique_ptr<AnnotationWindow> mpAnnotationWindow;
Color maColor;
int mnIndex;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 52a52177a401..f5b3b2705250 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2562,9 +2562,8 @@ void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter)
for (sal_uInt16 nPage = 0; nPage < nMaxPages; ++nPage)
{
pPage = static_cast<SdPage*>(mpDoc->GetPage(nPage));
- const sd::AnnotationVector& aPageAnnotations = pPage->getAnnotations();
- for (const rtl::Reference<Annotation>& xAnnotation : aPageAnnotations)
+ for (auto const& xAnnotation : pPage->getAnnotations())
{
sal_uInt32 nID = xAnnotation->GetId();
OString nodeName = "comment" + OString::number(nID);
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 569116c96b61..aad9521b33f3 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -42,7 +42,7 @@
#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <Annotation.hxx>
-#include <AnnotationEnumeration.hxx>
+#include <svx/annotation/AnnotationEnumeration.hxx>
#include <createunopageimpl.hxx>
#include <unomodel.hxx>
#include <unopage.hxx>
@@ -2529,7 +2529,7 @@ Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation()
if( !GetPage() )
throw DisposedException();
- rtl::Reference< sd::Annotation > xRet;
+ rtl::Reference<sdr::annotation::Annotation> xRet;
GetPage()->createAnnotation(xRet);
return xRet;
}
@@ -2543,7 +2543,7 @@ void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation >
Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration()
{
- return ::sd::createAnnotationEnumeration( std::vector(GetPage()->getAnnotations()) );
+ return sdr::annotation::createAnnotationEnumeration(std::vector(GetPage()->getAnnotations()));
}
void SdDrawPage::getBackground(Any& rValue)
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 1b1e6f5c2cf1..a3e0b3fb64a7 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -107,6 +107,7 @@ endif
$(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/annotation/Annotation \
+ svx/source/annotation/AnnotationEnumeration \
svx/source/core/extedit \
svx/source/core/graphichelper \
svx/source/core/extendedprimitive2dxmldump \
diff --git a/svx/source/annotation/Annotation.cxx b/svx/source/annotation/Annotation.cxx
index afa8d0f525dd..332573563df4 100644
--- a/svx/source/annotation/Annotation.cxx
+++ b/svx/source/annotation/Annotation.cxx
@@ -8,6 +8,7 @@
*/
#include <svx/annotation/Annotation.hxx>
+#include <svx/svdpage.hxx>
#include <tools/json_writer.hxx>
#include <sfx2/viewsh.hxx>
#include <unotools/datetime.hxx>
@@ -136,8 +137,27 @@ void AnnotationData::set(Annotation& rAnnotation)
rAnnotation.SetText(m_Text);
}
+Annotation::Annotation(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ SdrPage* pPage)
+ : cppu::PropertySetMixin<office::XAnnotation>(rxContext, IMPLEMENTS_PROPERTY_SET,
+ uno::Sequence<OUString>())
+ , mpPage(pPage)
+ , m_nId(nextID())
+{
+}
+
sal_uInt32 Annotation::m_nLastId = 1;
+SdrModel* Annotation::GetModel() const
+{
+ return mpPage != nullptr ? &mpPage->getSdrModelFromSdrPage() : nullptr;
+}
+
+uno::Any Annotation::queryInterface(uno::Type const& type)
+{
+ return comphelper::WeakComponentImplHelper<office::XAnnotation>::queryInterface(type);
+}
+
std::unique_ptr<SdrUndoAction> Annotation::createUndoAnnotation()
{
return std::make_unique<UndoAnnotation>(*this);
diff --git a/sd/source/core/annotations/AnnotationEnumeration.cxx b/svx/source/annotation/AnnotationEnumeration.cxx
index c622b10383bb..443a04f8c217 100644
--- a/sd/source/core/annotations/AnnotationEnumeration.cxx
+++ b/svx/source/annotation/AnnotationEnumeration.cxx
@@ -23,29 +23,25 @@
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/office/XAnnotationEnumeration.hpp>
-#include <Annotation.hxx>
-#include <AnnotationEnumeration.hxx>
-#include <sdpage.hxx>
+#include <svx/annotation/Annotation.hxx>
+#include <svx/annotation/AnnotationEnumeration.hxx>
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::office;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
+using namespace css;
-namespace sd {
-
-namespace {
-
-class AnnotationEnumeration: public ::cppu::WeakImplHelper< css::office::XAnnotationEnumeration >
+namespace sdr::annotation
+{
+namespace
+{
+class AnnotationEnumeration : public ::cppu::WeakImplHelper<css::office::XAnnotationEnumeration>
{
public:
- explicit AnnotationEnumeration( AnnotationVector&& rAnnotations );
+ explicit AnnotationEnumeration(AnnotationVector&& rAnnotations);
AnnotationEnumeration(const AnnotationEnumeration&) = delete;
AnnotationEnumeration& operator=(const AnnotationEnumeration&) = delete;
// css::office::XAnnotationEnumeration:
virtual sal_Bool SAL_CALL hasMoreElements() override;
- virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL nextElement() override;
+ virtual css::uno::Reference<css::office::XAnnotation> SAL_CALL nextElement() override;
private:
// destructor is private and will be called indirectly by the release call virtual ~AnnotationEnumeration() {}
@@ -54,33 +50,31 @@ private:
AnnotationVector::iterator maIter;
};
-}
+} // end anonymous ns
-Reference< XAnnotationEnumeration > createAnnotationEnumeration( sd::AnnotationVector&& rAnnotations )
+uno::Reference<office::XAnnotationEnumeration>
+createAnnotationEnumeration(AnnotationVector&& rAnnotations)
{
- return new AnnotationEnumeration( std::move(rAnnotations) );
+ return new AnnotationEnumeration(std::move(rAnnotations));
}
-AnnotationEnumeration::AnnotationEnumeration( AnnotationVector&& rAnnotations )
-: maAnnotations(std::move(rAnnotations))
+AnnotationEnumeration::AnnotationEnumeration(AnnotationVector&& rAnnotations)
+ : maAnnotations(std::move(rAnnotations))
{
maIter = maAnnotations.begin();
}
// css::office::XAnnotationEnumeration:
-sal_Bool SAL_CALL AnnotationEnumeration::hasMoreElements()
-{
- return maIter != maAnnotations.end();
-}
+sal_Bool SAL_CALL AnnotationEnumeration::hasMoreElements() { return maIter != maAnnotations.end(); }
-css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationEnumeration::nextElement()
+css::uno::Reference<css::office::XAnnotation> SAL_CALL AnnotationEnumeration::nextElement()
{
- if( maIter == maAnnotations.end() )
+ if (maIter == maAnnotations.end())
throw css::container::NoSuchElementException();
return (*maIter++);
}
-} // namespace sd
+} // end sdr::annotation
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 7f3eaa85efa5..29636efca8fd 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -48,6 +48,7 @@
#include <sdr/contact/viewcontactofsdrpage.hxx>
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/annotation/Annotation.hxx>
#include <algorithm>
#include <clonelist.hxx>
#include <svl/hint.hxx>