diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-26 14:51:39 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-26 15:06:01 +0200 |
commit | ff4698da491f8d1d910559c53bd7bba49e8499d3 (patch) | |
tree | 8e81058336f33c288ea377006fcc77eb2db84d0c /sw | |
parent | 9fbdb02c9a1da28b4dd51b053d39cb254631e535 (diff) |
SwTextBoxHelper::syncProperty: handle TextPreRotateAngle
For now only the most problematic -270 case, for which we don't have a
native writing direction: rotate the characters on a textportion level
instead.
CppunitTest_sw_ooxmlsdrexport's testFdo69636 is a reproducer for this,
the document model was fine already, but with this, the layout has the
rotation as well, as expected.
Change-Id: Iefc56f3adcea614566aaefd41d832d9b0cdb730b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 2c905301cb22..e0fbd5d979dd 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -15,6 +15,7 @@ #include <fmtornt.hxx> #include <fmtfsize.hxx> #include <doc.hxx> +#include <ndtxt.hxx> #include <docsh.hxx> #include <docary.hxx> #include <unocoll.hxx> @@ -29,10 +30,12 @@ #include <mvsave.hxx> #include <editeng/unoprnms.hxx> +#include <editeng/charrotateitem.hxx> #include <svx/svdoashp.hxx> #include <svx/unopage.hxx> #include <svx/svdpage.hxx> #include <svl/itemiter.hxx> +#include <comphelper/sequenceashashmap.hxx> #include <com/sun/star/document/XActionLockable.hpp> #include <com/sun/star/table/BorderLine2.hpp> @@ -293,6 +296,27 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, const OUString& rPropertyNa syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Left())))); syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top())))); } + + if (SwFrmFmt* pFmt = findTextBox(pShape)) + { + comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue); + // That would be the btLr text direction which we don't support at a frame level, so do it at a character level. + if (aCustomShapeGeometry.find("TextPreRotateAngle") != aCustomShapeGeometry.end() && aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>() == -270) + { + if (const SwNodeIndex* pNodeIndex = pFmt->GetCntnt().GetCntntIdx()) + { + SwPaM aPaM(*pFmt->GetDoc()->GetNodes()[pNodeIndex->GetIndex() + 1], 0); + aPaM.SetMark(); + if (SwTxtNode* pMark = pFmt->GetDoc()->GetNodes()[pNodeIndex->GetNode().EndOfSectionIndex() - 1]->GetTxtNode()) + { + aPaM.GetMark()->nNode = *pMark; + aPaM.GetMark()->nContent.Assign(pMark, pMark->GetTxt().getLength()); + SvxCharRotateItem aItem(900, false, RES_CHRATR_ROTATE); + pFmt->GetDoc()->InsertPoolItem(aPaM, aItem, 0); + } + } + } + } } else if (rPropertyName == UNO_NAME_TEXT_VERT_ADJUST) syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, rValue); |