summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/annotation/Annotation.hxx1
-rw-r--r--include/svx/annotation/ObjectAnnotationData.hxx1
-rw-r--r--svx/source/svdraw/svdobj.cxx41
-rw-r--r--svx/source/svdraw/svdotxed.cxx9
4 files changed, 41 insertions, 11 deletions
diff --git a/include/svx/annotation/Annotation.hxx b/include/svx/annotation/Annotation.hxx
index 4001d97f406f..8ea57af4d88f 100644
--- a/include/svx/annotation/Annotation.hxx
+++ b/include/svx/annotation/Annotation.hxx
@@ -146,6 +146,7 @@ public:
OUString GetText();
void SetText(OUString const& rText);
+ rtl::Reference<sdr::annotation::TextApiObject> getTextApiObject() { return m_TextRange; }
SdrModel* GetModel() const;
SdrPage const* getPage() const { return mpPage; }
diff --git a/include/svx/annotation/ObjectAnnotationData.hxx b/include/svx/annotation/ObjectAnnotationData.hxx
index bdba8ab5a5b9..44776638e64f 100644
--- a/include/svx/annotation/ObjectAnnotationData.hxx
+++ b/include/svx/annotation/ObjectAnnotationData.hxx
@@ -10,6 +10,7 @@
#pragma once
#include <svx/svxdllapi.h>
+#include <svx/annotation/Annotation.hxx>
namespace sdr::annotation
{
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 9da8c5662f12..34101b755ea7 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1533,15 +1533,24 @@ void SdrObject::NbcShear(const Point& rRef, Degree100 /*nAngle*/, double tn, boo
SetGlueReallyAbsolute(false);
}
-void SdrObject::Move(const Size& rSiz)
+void SdrObject::Move(const Size& rSize)
{
- if (rSiz.Width()!=0 || rSiz.Height()!=0) {
- tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
- NbcMove(rSiz);
- SetChanged();
- BroadcastObjectChange();
- SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0);
+ if (rSize.Width() == 0 && rSize.Height() == 0)
+ return;
+
+ tools::Rectangle aBoundRect0;
+ if (m_pUserCall != nullptr)
+ aBoundRect0 = GetLastBoundRect();
+ NbcMove(rSize);
+ if (isAnnotationObject())
+ {
+ auto& rRect = GetCurrentBoundRect();
+ css::geometry::RealPoint2D aNewPosition(rRect.Left() / 100.0, rRect.Top() / 100.0);
+ getAnnotationData()->mxAnnotation->SetPosition(aNewPosition);
}
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SdrUserCallType::MoveOnly, aBoundRect0);
}
void SdrObject::NbcCrop(const basegfx::B2DPoint& /*aRef*/, double /*fxFact*/, double /*fyFact*/)
@@ -1562,11 +1571,23 @@ void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction&
mpImpl->meRelativeHeightRelation = text::RelOrientation::PAGE_FRAME;
mpImpl->mnRelativeHeight.reset();
}
- tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
- NbcResize(rRef,xFact,yFact);
+ tools::Rectangle aBoundRect0;
+
+ if (m_pUserCall != nullptr)
+ aBoundRect0 = GetLastBoundRect();
+
+ NbcResize(rRef, xFact, yFact);
+
+ if (isAnnotationObject())
+ {
+ auto& rRect = GetCurrentBoundRect();
+ css::geometry::RealSize2D aNewSize(rRect.GetWidth() / 100.0, rRect.GetHeight() / 100.0);
+ getAnnotationData()->mxAnnotation->SetSize(aNewSize);
+ }
+
SetChanged();
BroadcastObjectChange();
- SendUserCall(SdrUserCallType::Resize,aBoundRect0);
+ SendUserCall(SdrUserCallType::Resize, aBoundRect0);
}
void SdrObject::Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact)
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 4ecca10951e9..adcdb6a578a1 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -29,7 +29,7 @@
#include <editeng/eeitem.hxx>
#include <svx/sdtfchim.hxx>
#include <textchain.hxx>
-
+#include <svx/annotation/ObjectAnnotationData.hxx>
bool SdrTextObj::HasTextEdit() const
{
@@ -286,6 +286,13 @@ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
} else { // If we are not doing in-chaining switching just set the ParaObject
SetOutlinerParaObject(std::move(pNewText));
}
+
+ if (isAnnotationObject())
+ {
+ auto xTextAPI(getAnnotationData()->mxAnnotation->getTextApiObject());
+ std::optional<OutlinerParaObject> pAnnotationText = rOutl.CreateParaObject(0, rOutl.GetParagraphCount());
+ xTextAPI->SetText(*pAnnotationText);
+ }
}
/* Chaining-related code */