summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-04-19 22:36:41 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-05-14 12:43:10 +0200
commit2791964914ba19b636ce49a60508bcab7af675cd (patch)
tree49acd5388689aa72fa7110fc67cd485bab95f21d
parent7dd7cb6f6c6812fc9ef56de3114d07c68e02f2b2 (diff)
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 <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/svx/annotation/Annotation.hxx18
-rw-r--r--include/svx/annotation/TextAPI.hxx (renamed from sd/inc/textapi.hxx)19
-rw-r--r--sd/Library_sd.mk1
-rw-r--r--sd/inc/Annotation.hxx14
-rw-r--r--sd/source/core/annotations/Annotation.cxx36
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx4
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx10
-rw-r--r--sd/source/ui/annotations/annotationwindow.hxx8
-rw-r--r--solenv/clang-format/excludelist2
-rw-r--r--svx/Library_svxcore.mk1
-rw-r--r--svx/source/annotation/Annotation.cxx32
-rw-r--r--svx/source/annotation/TextAPI.cxx (renamed from sd/source/core/text/textapi.cxx)115
12 files changed, 125 insertions, 135 deletions
diff --git a/include/svx/annotation/Annotation.hxx b/include/svx/annotation/Annotation.hxx
index 5ec5e2ec3c34..be378d6a61de 100644
--- a/include/svx/annotation/Annotation.hxx
+++ b/include/svx/annotation/Annotation.hxx
@@ -20,6 +20,7 @@
#include <comphelper/compbase.hxx>
#include <cppuhelper/propertysetmixin.hxx>
#include <svx/annotation/Annotation.hxx>
+#include <svx/annotation/TextAPI.hxx>
class SdrUndoAction;
class SfxViewShell;
@@ -70,6 +71,7 @@ protected:
OUString m_Author;
OUString m_Initials;
css::util::DateTime m_DateTime;
+ rtl::Reference<sdr::annotation::TextApiObject> m_TextRange;
bool m_bIsFreeText = false;
@@ -84,11 +86,11 @@ public:
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();
+ comphelper::WeakComponentImplHelper<css::office::XAnnotation>::acquire();
}
virtual void SAL_CALL release() noexcept override
{
- ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>::release();
+ comphelper::WeakComponentImplHelper<css::office::XAnnotation>::release();
}
css::geometry::RealPoint2D GetPosition() const { return m_Position; }
@@ -106,8 +108,16 @@ 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;
+
+ // 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 disposing(std::unique_lock<std::mutex>& rGuard) 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
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 643cce60ff82..de39df79b25b 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -172,7 +172,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 00a0b2a22af8..aba2d27d77b7 100644
--- a/sd/inc/Annotation.hxx
+++ b/sd/inc/Annotation.hxx
@@ -29,7 +29,6 @@
#include <svx/annotation/Annotation.hxx>
#include "sdpage.hxx"
-#include "textapi.hxx"
#include "sddllapi.h"
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -88,7 +87,6 @@ public:
virtual void SAL_CALL setInitials(const OUString & the_value) override;
SD_DLLPUBLIC virtual css::util::DateTime SAL_CALL getDateTime() override;
virtual void SAL_CALL setDateTime(const css::util::DateTime & the_value) override;
- SD_DLLPUBLIC virtual css::uno::Reference<css::text::XText> SAL_CALL getTextRange() override;
void createChangeUndo();
@@ -107,21 +105,9 @@ 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 disposing(std::unique_lock<std::mutex>& rGuard) override;
-
void createChangeUndoImpl(std::unique_lock<std::mutex>& g);
- 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 1d1786ff460c..2843333f29b4 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -76,20 +76,6 @@ Annotation::Annotation(const uno::Reference<uno::XComponentContext>& context, Sd
Annotation::~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.
-void Annotation::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
-{
- 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()
{
@@ -220,18 +206,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()
{
std::unique_lock g(m_aMutex);
@@ -259,16 +233,6 @@ void Annotation::createChangeUndoImpl(std::unique_lock<std::mutex>& g)
}
}
-uno::Reference<text::XText> SAL_CALL Annotation::getTextRange()
-{
- std::unique_lock 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 0eb3adb2e977..bc4db37332d5 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>
@@ -558,7 +558,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 fffaf70ee863..59ccc11af604 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -54,7 +54,7 @@
#include <DrawDocShell.hxx>
#include <ViewShell.hxx>
#include <drawdoc.hxx>
-#include <textapi.hxx>
+#include <svx/annotation/TextAPI.hxx>
#include <sdresid.hxx>
#include <memory>
@@ -484,12 +484,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;
}
@@ -507,7 +507,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 )
{
@@ -572,7 +572,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 8991519cf8db..8a02d8bab2d0 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -9359,7 +9359,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
@@ -9452,7 +9451,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 a3e0b3fb64a7..5218e9582b43 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -108,6 +108,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/core/extendedprimitive2dxmldump \
diff --git a/svx/source/annotation/Annotation.cxx b/svx/source/annotation/Annotation.cxx
index 332573563df4..47b486228624 100644
--- a/svx/source/annotation/Annotation.cxx
+++ b/svx/source/annotation/Annotation.cxx
@@ -163,6 +163,38 @@ 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()
+{
+ std::unique_lock g(m_aMutex);
+ if (!m_TextRange.is() && mpPage != nullptr)
+ {
+ m_TextRange = sdr::annotation::TextApiObject::create(&mpPage->getSdrModelFromSdrPage());
+ }
+ return m_TextRange;
+}
+
+void Annotation::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
+{
+ 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
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: */