[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jun 26 06:08:02 PDT 2014


 sw/source/core/doc/textboxhelper.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit ff4698da491f8d1d910559c53bd7bba49e8499d3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 26 14:51:39 2014 +0200

    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

diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 2c90530..e0fbd5d 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);


More information about the Libreoffice-commits mailing list