diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-13 10:32:46 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-13 10:58:17 +0200 |
commit | da22fb668d21d20432232034cd54af509ded1bbf (patch) | |
tree | 650820c33ff621f1d32cc16be4f504fb8a0d9582 /sw | |
parent | SwDoc::CopyFlyInFlyImpl: factor out textbox code into SwTextBoxHelper (diff) | |
download | core-da22fb668d21d20432232034cd54af509ded1bbf.tar.gz core-da22fb668d21d20432232034cd54af509ded1bbf.zip |
SwTextBoxHelper::syncProperty: handle FN_TEXT_RANGE
The TextRange property of a shape is its anchor position: if that's
adjusted, then also set the textbox's RES_ANCHOR to the new position.
Without this, e.g. shapes anchored in headers have their textboxes
anchored in the body text, CppunitTest_sw_ooxmlexport's testfdo78420 is
a reproducer.
Change-Id: I83ed09875c3f0360c581c331507ad2b9d05ffb3a
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index eac7e57799e0..06bc0e031257 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -10,6 +10,7 @@ #include <textboxhelper.hxx> #include <frmfmt.hxx> #include <fmtcntnt.hxx> +#include <fmtanchr.hxx> #include <doc.hxx> #include <docsh.hxx> #include <docary.hxx> @@ -19,6 +20,7 @@ #include <unotextbodyhf.hxx> #include <unotextrange.hxx> #include <unomid.h> +#include <cmdid.h> #include <unoprnms.hxx> #include <dflyobj.hxx> #include <mvsave.hxx> @@ -336,6 +338,19 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 break; } break; + case FN_TEXT_RANGE: + { + uno::Reference<text::XTextRange> xRange; + rValue >>= xRange; + SwUnoInternalPaM aInternalPaM(*pFmt->GetDoc()); + if (sw::XTextRangeToSwPaM(aInternalPaM, xRange)) + { + SwFmtAnchor aAnchor(pFmt->GetAnchor()); + aAnchor.SetAnchor(aInternalPaM.Start()); + pFmt->SetFmtAttr(aAnchor); + } + } + break; } if (!aPropertyName.isEmpty()) |