include/svx/annotation/Annotation.hxx          |   16 +++
 include/svx/annotation/TextAPI.hxx             |   19 ++--
 sd/Library_sd.mk                               |    1 
 sd/inc/Annotation.hxx                          |   14 ---
 sd/source/core/annotations/Annotation.cxx      |   36 -------
 sd/source/ui/annotations/annotationmanager.cxx |    4 
 sd/source/ui/annotations/annotationwindow.cxx  |   10 +-
 sd/source/ui/annotations/annotationwindow.hxx  |    8 -
 solenv/clang-format/excludelist                |    2 
 svx/Library_svxcore.mk                         |    1 
 svx/source/annotation/Annotation.cxx           |   35 +++++++
 svx/source/annotation/TextAPI.cxx              |  115 ++++++++++++-------------
 12 files changed, 128 insertions(+), 133 deletions(-)

New commits:
commit 36e4c8287ed4451364634e441c7893ae9da0a8c4
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Apr 19 22:36:41 2024 +0900
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jun 12 09:43:19 2024 +0200

    annot: move TextAPI to svx and adapt the code
    
    TextApiObject is derived from SvxUnoText and holds and handles the
    text in the annotation. This functionality is changed to get rid
    of sd module specifics and moved to svx module. This now allows to
    move the most improtant parts of the Annotation object to svx.
    
    Change-Id: I34e238616e7fac973e75e79bb60a8d093c493258
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166497
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit 2791964914ba19b636ce49a60508bcab7af675cd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168559
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/include/svx/annotation/Annotation.hxx 
b/include/svx/annotation/Annotation.hxx
index a2d1ef371676..9d71a1121c88 100644
--- a/include/svx/annotation/Annotation.hxx
+++ b/include/svx/annotation/Annotation.hxx
@@ -21,6 +21,7 @@
 #include <cppuhelper/propertysetmixin.hxx>
 #include <cppuhelper/basemutex.hxx>
 #include <svx/annotation/Annotation.hxx>
+#include <svx/annotation/TextAPI.hxx>
 
 class SdrUndoAction;
 class SfxViewShell;
@@ -72,6 +73,7 @@ protected:
     OUString m_Author;
     OUString m_Initials;
     css::util::DateTime m_DateTime;
+    rtl::Reference<sdr::annotation::TextApiObject> m_TextRange;
 
     bool m_bIsFreeText = false;
 
@@ -108,8 +110,18 @@ public:
     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;
+    virtual css::uno::Reference<css::text::XText> SAL_CALL getTextRange() 
override;
+
+    // destructor is private and will be called indirectly by the release call 
   virtual ~Annotation() {}
+
+    // override WeakComponentImplHelperBase::disposing()
+    // This function is called upon disposing the component,
+    // if your component needs special work when it becomes
+    // disposed, do it here.
+    virtual void SAL_CALL disposing() override;
+
+    OUString GetText();
+    void SetText(OUString const& rText);
 
     SdrModel* GetModel() const;
     SdrPage const* getPage() const { return mpPage; }
diff --git a/sd/inc/textapi.hxx b/include/svx/annotation/TextAPI.hxx
similarity index 75%
rename from sd/inc/textapi.hxx
rename to include/svx/annotation/TextAPI.hxx
index 5491382e0564..c227b4a803c5 100644
--- a/sd/inc/textapi.hxx
+++ b/include/svx/annotation/TextAPI.hxx
@@ -22,14 +22,15 @@
 #include <editeng/unotext.hxx>
 #include <rtl/ref.hxx>
 #include <editeng/outliner.hxx>
+#include <svx/svxdllapi.h>
 
 class SdrModel;
 
-namespace sd {
-
+namespace sdr::annotation
+{
 class TextAPIEditSource;
 
-class TextApiObject final : public SvxUnoText
+class SVXCORE_DLLPUBLIC TextApiObject final : public SvxUnoText
 {
 public:
     static rtl::Reference<TextApiObject> create(SdrModel* pModel);
@@ -40,16 +41,16 @@ public:
     void dispose();
 
     std::optional<OutlinerParaObject> CreateText();
-    void                SetText( OutlinerParaObject const & rText );
-    OUString            GetText() const;
+    void SetText(OutlinerParaObject const& rText);
+    OUString GetText() const;
 
-    static TextApiObject* getImplementation( const css::uno::Reference< 
css::text::XText >& );
+    static TextApiObject* getImplementation(const 
css::uno::Reference<css::text::XText>&);
 
 private:
-    std::unique_ptr<TextAPIEditSource>  mpSource;
-    TextApiObject( std::unique_ptr<TextAPIEditSource> pEditSource );
+    std::unique_ptr<TextAPIEditSource> mpSource;
+    TextApiObject(std::unique_ptr<TextAPIEditSource> pEditSource);
 };
 
-} // namespace sd
+} // namespace sdr::annotation
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 8c3cc747e102..c31367ebe821 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -173,7 +173,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
        sd/source/core/stlfamily \
        sd/source/core/stlpool \
        sd/source/core/stlsheet \
-       sd/source/core/text/textapi \
        sd/source/core/typemap \
        sd/source/core/undo/undofactory \
        sd/source/core/undo/undomanager \
diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx
index 9e4374de8049..c43e324aa684 100644
--- a/sd/inc/Annotation.hxx
+++ b/sd/inc/Annotation.hxx
@@ -28,7 +28,6 @@
 #include <svx/annotation/Annotation.hxx>
 
 #include "sdpage.hxx"
-#include "textapi.hxx"
 #include "sddllapi.h"
 
 #include <basegfx/polygon/b2dpolygon.hxx>
@@ -85,7 +84,6 @@ public:
     virtual void SAL_CALL setInitials(const OUString & the_value) override;
     virtual css::util::DateTime SAL_CALL getDateTime() override;
     virtual void SAL_CALL setDateTime(const css::util::DateTime & the_value) 
override;
-    virtual css::uno::Reference<css::text::XText> SAL_CALL getTextRange() 
override;
 
     void createChangeUndo();
 
@@ -104,19 +102,7 @@ public:
         return bool(m_pCustomAnnotationMarker);
     }
 
-    OUString GetText() override;
-    void SetText(OUString const& rText) override;
-
 private:
-    // destructor is private and will be called indirectly by the release call 
   virtual ~Annotation() {}
-
-    // override WeakComponentImplHelperBase::disposing()
-    // This function is called upon disposing the component,
-    // if your component needs special work when it becomes
-    // disposed, do it here.
-    virtual void SAL_CALL disposing() override;
-
-    rtl::Reference<TextApiObject> m_TextRange;
     std::unique_ptr<CustomAnnotationMarker> m_pCustomAnnotationMarker;
 };
 
diff --git a/sd/source/core/annotations/Annotation.cxx 
b/sd/source/core/annotations/Annotation.cxx
index ef42f85924a2..2bbb3342be0f 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -72,20 +72,6 @@ Annotation::Annotation(const 
uno::Reference<uno::XComponentContext>& context, Sd
 {
 }
 
-// override WeakComponentImplHelperBase::disposing()
-// This function is called upon disposing the component,
-// if your component needs special work when it becomes
-// disposed, do it here.
-void SAL_CALL Annotation::disposing()
-{
-    mpPage = nullptr;
-    if( m_TextRange.is() )
-    {
-        m_TextRange->dispose();
-        m_TextRange.clear();
-    }
-}
-
 // com.sun.star.beans.XPropertySet:
 uno::Reference<beans::XPropertySetInfo> SAL_CALL 
Annotation::getPropertySetInfo()
 {
@@ -216,18 +202,6 @@ 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
@@ -245,16 +219,6 @@ void Annotation::createChangeUndo()
     }
 }
 
-uno::Reference<text::XText> SAL_CALL Annotation::getTextRange()
-{
-    osl::MutexGuard g(m_aMutex);
-    if( !m_TextRange.is() && (mpPage != nullptr) )
-    {
-        m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( 
&mpPage->getSdrModelFromSdrPage() ) );
-    }
-    return m_TextRange;
-}
-
 std::unique_ptr<SdrUndoAction> 
CreateUndoInsertOrRemoveAnnotation(rtl::Reference<sdr::annotation::Annotation>& 
xAnnotation, bool bInsert)
 {
     if (xAnnotation)
diff --git a/sd/source/ui/annotations/annotationmanager.cxx 
b/sd/source/ui/annotations/annotationmanager.cxx
index 984773b7b9a9..3366713f5043 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -69,7 +69,7 @@
 #include <ViewShellBase.hxx>
 #include <sdpage.hxx>
 #include <drawdoc.hxx>
-#include <textapi.hxx>
+#include <svx/annotation/TextAPI.hxx>
 #include <optsitem.hxx>
 #include <sdmod.hxx>
 
@@ -563,7 +563,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( 
SfxRequest const & rReq )
             sReplyText = static_cast<const SvxPostItTextItem*>( pPoolItem 
)->GetValue();
     }
 
-    TextApiObject* pTextApi = getTextApiObject( xAnnotation );
+    auto* pTextApi = getTextApiObject( xAnnotation );
     if( !pTextApi )
         return;
 
diff --git a/sd/source/ui/annotations/annotationwindow.cxx 
b/sd/source/ui/annotations/annotationwindow.cxx
index 02495794aefa..0b98f606498a 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -53,7 +53,7 @@
 #include <DrawDocShell.hxx>
 #include <ViewShell.hxx>
 #include <drawdoc.hxx>
-#include <textapi.hxx>
+#include <svx/annotation/TextAPI.hxx>
 #include <sdresid.hxx>
 
 #include <memory>
@@ -483,12 +483,12 @@ IMPL_LINK(AnnotationWindow, ScrollHdl, 
weld::ScrolledWindow&, rScrolledWindow, v
     GetOutlinerView()->Scroll( 0, nDiff );
 }
 
-TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation )
+sdr::annotation::TextApiObject* getTextApiObject( const Reference< XAnnotation 
>& xAnnotation )
 {
     if( xAnnotation.is() )
     {
         Reference< XText > xText( xAnnotation->getTextRange() );
-        return TextApiObject::getImplementation( xText );
+        return sdr::annotation::TextApiObject::getImplementation(xText);
     }
     return nullptr;
 }
@@ -506,7 +506,7 @@ void AnnotationWindow::setAnnotation( const Reference< 
XAnnotation >& xAnnotatio
     mbProtected = aUserOptions.GetFullName() != xAnnotation->getAuthor();
 
     mpOutliner->Clear();
-    TextApiObject* pTextApi = getTextApiObject( mxAnnotation );
+    auto* pTextApi = getTextApiObject( mxAnnotation );
 
     if( pTextApi )
     {
@@ -571,7 +571,7 @@ void AnnotationWindow::SaveToDocument()
     // write changed text back to annotation
     if (mpOutliner->IsModified())
     {
-        TextApiObject* pTextApi = getTextApiObject( xAnnotation );
+        auto* pTextApi = getTextApiObject( xAnnotation );
 
         if( pTextApi )
         {
diff --git a/sd/source/ui/annotations/annotationwindow.hxx 
b/sd/source/ui/annotations/annotationwindow.hxx
index a150ebf1c8cd..fd5919b40d06 100644
--- a/sd/source/ui/annotations/annotationwindow.hxx
+++ b/sd/source/ui/annotations/annotationwindow.hxx
@@ -29,13 +29,13 @@ class OutlinerView;
 class Outliner;
 class SvxLanguageItem;
 class SdDrawDocument;
+namespace sdr::annotation { class TextApiObject; }
 
-namespace sd {
+namespace sd
+{
 
 class AnnotationManagerImpl;
 class DrawDocShell;
-class TextApiObject;
-
 class AnnotationWindow;
 
 class AnnotationTextWindow : public WeldEditView
@@ -135,7 +135,7 @@ public:
     void SetColor();
 };
 
-TextApiObject* getTextApiObject( const css::uno::Reference< 
css::office::XAnnotation >& xAnnotation );
+sdr::annotation::TextApiObject* getTextApiObject( const css::uno::Reference< 
css::office::XAnnotation >& xAnnotation );
 
 
 } // namespace sd
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index bc0365ba6fd6..a944060b0329 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -9364,7 +9364,6 @@ sd/inc/stlfamily.hxx
 sd/inc/stlpool.hxx
 sd/inc/stlsheet.hxx
 sd/inc/strings.hxx
-sd/inc/textapi.hxx
 sd/inc/undo/undofactory.hxx
 sd/inc/undo/undomanager.hxx
 sd/qa/unit/SVGExportTests.cxx
@@ -9458,7 +9457,6 @@ sd/source/core/shapelist.cxx
 sd/source/core/stlfamily.cxx
 sd/source/core/stlpool.cxx
 sd/source/core/stlsheet.cxx
-sd/source/core/text/textapi.cxx
 sd/source/core/undo/undofactory.cxx
 sd/source/core/undo/undomanager.cxx
 sd/source/core/undo/undoobjects.cxx
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 33bca46f698d..b21abae3ae66 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/annotation/TextAPI \
     svx/source/core/extedit \
     svx/source/core/graphichelper \
     svx/source/customshapes/EnhancedCustomShape2d \
diff --git a/svx/source/annotation/Annotation.cxx 
b/svx/source/annotation/Annotation.cxx
index 7654d047f4a1..92660c74c82b 100644
--- a/svx/source/annotation/Annotation.cxx
+++ b/svx/source/annotation/Annotation.cxx
@@ -164,6 +164,41 @@ std::unique_ptr<SdrUndoAction> 
Annotation::createUndoAnnotation()
     return std::make_unique<UndoAnnotation>(*this);
 }
 
+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);
+}
+
+uno::Reference<text::XText> SAL_CALL Annotation::getTextRange()
+{
+    osl::MutexGuard g(m_aMutex);
+    if (!m_TextRange.is() && mpPage != nullptr)
+        m_TextRange = 
sdr::annotation::TextApiObject::create(&mpPage->getSdrModelFromSdrPage());
+
+    return m_TextRange;
+}
+
+// override WeakComponentImplHelperBase::disposing()
+// This function is called upon disposing the component,
+// if your component needs special work when it becomes
+// disposed, do it here.
+void SAL_CALL Annotation::disposing()
+{
+    mpPage = nullptr;
+    if (m_TextRange.is())
+    {
+        m_TextRange->dispose();
+        m_TextRange.clear();
+    }
+}
+
 } // namespace sdr::annotation
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/text/textapi.cxx b/svx/source/annotation/TextAPI.cxx
similarity index 65%
rename from sd/source/core/text/textapi.cxx
rename to svx/source/annotation/TextAPI.cxx
index c5f9ab631bff..cd13acd76d3b 100644
--- a/sd/source/core/text/textapi.cxx
+++ b/svx/source/annotation/TextAPI.cxx
@@ -21,33 +21,37 @@
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/text/XTextField.hpp>
 
-#include <textapi.hxx>
-#include <drawdoc.hxx>
+#include <svx/annotation/TextAPI.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/editeng.hxx>
 #include <editeng/outlobj.hxx>
 #include <editeng/unoforou.hxx>
 #include <editeng/unoprnms.hxx>
 #include <editeng/unoipset.hxx>
-#include <Outliner.hxx>
 #include <svx/svdpool.hxx>
 #include <svx/svdundo.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoutl.hxx>
 
-namespace com::sun::star::container { class XNameContainer; }
+namespace com::sun::star::container
+{
+class XNameContainer;
+}
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::text;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::container;
 
-namespace sd {
-
-namespace {
-
+namespace sdr::annotation
+{
+namespace
+{
 class UndoTextAPIChanged : public SdrUndoAction
 {
 public:
-    UndoTextAPIChanged( SdrModel& rModel, TextApiObject* pTextObj );
+    UndoTextAPIChanged(SdrModel& rModel, TextApiObject* pTextObj);
 
     virtual void Undo() override;
     virtual void Redo() override;
@@ -55,44 +59,41 @@ public:
 protected:
     std::optional<OutlinerParaObject> mpOldText;
     std::optional<OutlinerParaObject> mpNewText;
-    rtl::Reference< TextApiObject > mxTextObj;
+    rtl::Reference<TextApiObject> mxTextObj;
 };
-
 }
 
-UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* 
pTextObj )
-: SdrUndoAction( rModel )
-, mpOldText( pTextObj->CreateText() )
-, mxTextObj( pTextObj )
+UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* 
pTextObj)
+    : SdrUndoAction(rModel)
+    , mpOldText(pTextObj->CreateText())
+    , mxTextObj(pTextObj)
 {
 }
 
 void UndoTextAPIChanged::Undo()
 {
-    if( !mpNewText )
+    if (!mpNewText)
         mpNewText = mxTextObj->CreateText();
 
-    mxTextObj->SetText( *mpOldText );
+    mxTextObj->SetText(*mpOldText);
 }
 
 void UndoTextAPIChanged::Redo()
 {
-    if( mpNewText )
+    if (mpNewText)
     {
-        mxTextObj->SetText( *mpNewText );
+        mxTextObj->SetText(*mpNewText);
     }
 }
 
 namespace
 {
-
 struct OutlinerHolder
 {
-    SdrModel* mpModel;
+    SdrModel* mpModel = nullptr;
     std::unique_ptr<Outliner> mpOutliner;
     std::unique_ptr<SvxOutlinerForwarder> mpTextForwarder;
 };
-
 }
 
 class TextAPIEditSource : public SvxEditSource
@@ -108,7 +109,7 @@ class TextAPIEditSource : public SvxEditSource
 public:
     explicit TextAPIEditSource(SdrModel* pModel);
 
-    void SetText(OutlinerParaObject const & rText);
+    void SetText(OutlinerParaObject const& rText);
     std::optional<OutlinerParaObject> CreateText();
     OUString GetText() const;
     SdrModel* getModel() { return mpHolder->mpModel; }
@@ -116,36 +117,38 @@ public:
 
 static const SvxItemPropertySet* ImplGetSdTextPortionPropertyMap()
 {
-    static const SfxItemPropertyMapEntry aSdTextPortionPropertyEntries[] =
-    {
+    static const SfxItemPropertyMapEntry aSdTextPortionPropertyEntries[] = {
         SVX_UNOEDIT_CHAR_PROPERTIES,
         SVX_UNOEDIT_FONT_PROPERTIES,
         SVX_UNOEDIT_OUTLINER_PROPERTIES,
         SVX_UNOEDIT_PARA_PROPERTIES,
-        {u"TextField"_ustr,                     EE_FEATURE_FIELD,   
cppu::UnoType<XTextField>::get(),  PropertyAttribute::READONLY, 0 },
-        {u"TextPortionType"_ustr,               WID_PORTIONTYPE,    
::cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0 },
-        {u"TextUserDefinedAttributes"_ustr,     EE_CHAR_XMLATTRIBS,     
cppu::UnoType<XNameContainer>::get(),        0,     0},
-        {u"ParaUserDefinedAttributes"_ustr,     EE_PARA_XMLATTRIBS,     
cppu::UnoType<XNameContainer>::get(),        0,     0},
+        { u"TextField"_ustr, EE_FEATURE_FIELD, 
cppu::UnoType<XTextField>::get(),
+          PropertyAttribute::READONLY, 0 },
+        { u"TextPortionType"_ustr, WID_PORTIONTYPE, 
::cppu::UnoType<OUString>::get(),
+          PropertyAttribute::READONLY, 0 },
+        { u"TextUserDefinedAttributes"_ustr, EE_CHAR_XMLATTRIBS,
+          cppu::UnoType<XNameContainer>::get(), 0, 0 },
+        { u"ParaUserDefinedAttributes"_ustr, EE_PARA_XMLATTRIBS,
+          cppu::UnoType<XNameContainer>::get(), 0, 0 },
     };
-    static SvxItemPropertySet aSdTextPortionPropertyMap( 
aSdTextPortionPropertyEntries, SdrObject::GetGlobalDrawObjectItemPool() );
+    static SvxItemPropertySet 
aSdTextPortionPropertyMap(aSdTextPortionPropertyEntries,
+                                                        
SdrObject::GetGlobalDrawObjectItemPool());
 
     return &aSdTextPortionPropertyMap;
 }
 
-TextApiObject::TextApiObject( std::unique_ptr<TextAPIEditSource> pEditSource )
-: SvxUnoText( pEditSource.get(), ImplGetSdTextPortionPropertyMap(), Reference 
< XText >() )
-, mpSource(std::move(pEditSource))
+TextApiObject::TextApiObject(std::unique_ptr<TextAPIEditSource> pEditSource)
+    : SvxUnoText(pEditSource.get(), ImplGetSdTextPortionPropertyMap(), 
Reference<XText>())
+    , mpSource(std::move(pEditSource))
 {
 }
 
-TextApiObject::~TextApiObject() noexcept
-{
-    dispose();
-}
+TextApiObject::~TextApiObject() noexcept { dispose(); }
 
 rtl::Reference<TextApiObject> TextApiObject::create(SdrModel* pModel)
 {
-    rtl::Reference<TextApiObject> xRet(new 
TextApiObject(std::make_unique<TextAPIEditSource>(pModel)));
+    rtl::Reference<TextApiObject> xRet(
+        new TextApiObject(std::make_unique<TextAPIEditSource>(pModel)));
     return xRet;
 }
 
@@ -155,32 +158,26 @@ void TextApiObject::dispose()
         mpSource.reset();
 }
 
-std::optional<OutlinerParaObject> TextApiObject::CreateText()
-{
-    return mpSource->CreateText();
-}
+std::optional<OutlinerParaObject> TextApiObject::CreateText() { return 
mpSource->CreateText(); }
 
-void TextApiObject::SetText( OutlinerParaObject const & rText )
+void TextApiObject::SetText(OutlinerParaObject const& rText)
 {
     SdrModel* pModel = mpSource->getModel();
-    if( pModel && pModel->IsUndoEnabled() )
-        pModel->AddUndo( std::make_unique<UndoTextAPIChanged>( *pModel, this ) 
);
+    if (pModel && pModel->IsUndoEnabled())
+        pModel->AddUndo(std::make_unique<UndoTextAPIChanged>(*pModel, this));
 
-    mpSource->SetText( rText );
+    mpSource->SetText(rText);
     maSelection.nStartPara = EE_PARA_MAX_COUNT;
 }
 
-OUString TextApiObject::GetText() const
-{
-    return mpSource->GetText();
-}
+OUString TextApiObject::GetText() const { return mpSource->GetText(); }
 
-TextApiObject* TextApiObject::getImplementation( const css::uno::Reference< 
css::text::XText >& xText )
+TextApiObject* TextApiObject::getImplementation(const 
css::uno::Reference<css::text::XText>& xText)
 {
-    TextApiObject* pImpl = dynamic_cast< TextApiObject* >( xText.get() );
+    TextApiObject* pImpl = dynamic_cast<TextApiObject*>(xText.get());
 
-    if( !pImpl )
-        pImpl = dynamic_cast< TextApiObject* >(  
comphelper::getFromUnoTunnel<SvxUnoTextBase>( xText ) );
+    if (!pImpl)
+        pImpl = 
dynamic_cast<TextApiObject*>(comphelper::getFromUnoTunnel<SvxUnoTextBase>(xText));
 
     return pImpl;
 }
@@ -217,7 +214,8 @@ SvxTextForwarder* TextAPIEditSource::GetTextForwarder()
         //init draw model first
         SfxItemPool* pPool = &mpHolder->mpModel->GetItemPool();
         mpHolder->mpOutliner.reset(new SdrOutliner(pPool, 
OutlinerMode::TextObject));
-        SdDrawDocument::SetCalcFieldValueHdl(mpHolder->mpOutliner.get());
+        // TODO - we need a way to register this to the current module
+        // SdDrawDocument::SetCalcFieldValueHdl(mpHolder->mpOutliner.get());
     }
 
     if (!mpHolder->mpTextForwarder)
@@ -226,7 +224,7 @@ SvxTextForwarder* TextAPIEditSource::GetTextForwarder()
     return mpHolder->mpTextForwarder.get();
 }
 
-void TextAPIEditSource::SetText( OutlinerParaObject const & rText )
+void TextAPIEditSource::SetText(OutlinerParaObject const& rText)
 {
     if (mpHolder->mpModel)
     {
@@ -235,7 +233,8 @@ void TextAPIEditSource::SetText( OutlinerParaObject const & 
rText )
             //init draw model first
             SfxItemPool* pPool = &mpHolder->mpModel->GetItemPool();
             mpHolder->mpOutliner.reset(new SdrOutliner(pPool, 
OutlinerMode::TextObject));
-            SdDrawDocument::SetCalcFieldValueHdl(mpHolder->mpOutliner.get());
+            // TODO - we need a way to register this to the current module
+            //SdDrawDocument::SetCalcFieldValueHdl(mpHolder->mpOutliner.get());
         }
 
         mpHolder->mpOutliner->SetText(rText);
@@ -258,6 +257,6 @@ OUString TextAPIEditSource::GetText() const
         return OUString();
 }
 
-} // namespace sd
+} // namespace sdr::annotation
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to