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

Miklos Vajna vmiklos at collabora.co.uk
Sat Feb 3 15:53:27 UTC 2018


 sw/qa/extras/rtfexport/data/graphic-object-fliph.rtf |   41 +++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport3.cxx                |    6 ++
 sw/source/filter/ww8/rtfattributeoutput.cxx          |   16 ++++++-
 writerfilter/source/rtftok/rtfsdrimport.cxx          |    7 +++
 4 files changed, 67 insertions(+), 3 deletions(-)

New commits:
commit 949d7b670cda798c54de072ba9d8f0aabe8afd8c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Feb 3 11:21:53 2018 +0100

    RTF filter: handle horizontal flip of picture frames
    
    Only shapes were handled previously.
    
    Change-Id: Ie03947d7ae065729ef85addddb1ede32637622f2
    Reviewed-on: https://gerrit.libreoffice.org/49178
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/qa/extras/rtfexport/data/graphic-object-fliph.rtf b/sw/qa/extras/rtfexport/data/graphic-object-fliph.rtf
new file mode 100644
index 000000000000..5e6a224d96ed
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/graphic-object-fliph.rtf
@@ -0,0 +1,41 @@
+{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
+\noqfpromote
+\paperw12240\paperh15840\margl1417\margr1417\margt1417\margb1417\gutter0\ltrsect
+\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen
+\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1417\dgvorigin1417\dghshow1\dgvshow1
+\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
+\asianbrkrule\rsidroot3280893\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
+{\*\wgrffmtfilter 2450}
+\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj
+\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0
+\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033
+{\rtlch\fcs1 \af31507\alang1037 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid13307469\charrsid6361649
+{\*\shppict
+{\pict
+{\*\picprop\shplid1025
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+{\sp
+{\sn fFlipH}
+{\sv 1}
+}
+}
+\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw1806\pich1806\picwgoal1024\pichgoal1024\pngblip\bliptag133373369
+{\*\blipuid 07f31db965a497c78cd3b098b1fb8f43}
+89504e470d0a1a0a0000000d49484452000000400000004008040000000060b9550000000467414d410000b18f0bfc6105000000017352474200aece1ce90000
+00206348524d00007a26000080840000fa00000080e8000075300000ea6000003a98000017709cba513c00000002624b47440000aa8d2332000000096f464673
+0000000600000000000c7355d3000000097048597300000dd700000dd70142289b7800000009767041670000004c00000040009d31381b000001cd4944415468
+deedd93d4fc24018c0f17f89c6cdc44940e3e222be2c0e7e0417e3a8113571707632514012a320c6f84d34be2c2ec2b750f40be8e6e4a00113cfe14a5b69b108
+f4589ee71652eefafce0b9f42e3d7063822aaac3f641d173a75d3efee85b6582c0c8749c5eb7332cfb4e6f213d336ed29807304477b1c7a94db80ae9e9c934d0
+fcdd12e7ffcefcc9168f9a0059143b8cb0d2de581f609854073fbecc220f60b18722479d0d14abed8c8cb5d3293ce2949903b0d8a7047cb1c98541008cba840c
+a736e1d2200046b967567f740961d3b197008873cf74835002eaac7363100009ca0d4296121675d2dc1a0440d2256428625163ed2f42cf011e8245d621b42c44
+0400485261a699706d1000092fa100d4490713220240dc25e438b1090185880ca09f8ece5c28d9843b009e82471ca25069d5cb785529bd007fdbfb8541b65b2f
+531100947a51530d42c1d92f9829818e31ca4ce9421c70e427440e80712a7a89b7c8fb0906003046a5311df31cf501a01f4d0ee1b80f00bd4c398558ee0340ff
+0b939a30df17002459f05d330a080a0108400002108000042000010840000210800004200001f8ce0ddf798e30dd7b38e0ce7ea16d2abc25a819cbda225337c7
+f7ff69bf8eef7f0084e08d42bdf8a03e00000025744558746372656174652d6461746500323031302d31322d32305431373a30383a33362b30313a30307ae51b1c00000025744558746d6f646966792d6461746500323031302d31322d32305431373a30383a33372b30313a30308323669c0000000049454e44ae426082}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 870650ab9b88..be67a57dec2d 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -68,6 +68,12 @@ DECLARE_RTFEXPORT_TEST(testTdf104035, "tdf104035.rtf")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(450)), aTabStops[0].Position);
 }
 
+DECLARE_RTFEXPORT_TEST(testGraphicObjectFliph, "graphic-object-fliph.rtf")
+{
+    CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnEvenPages"));
+    CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnOddPages"));
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf114333, "tdf114333.rtf")
 {
     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 959881aed103..fd5df7d44011 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3767,7 +3767,7 @@ static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& r
                           const Size& rRendered, const Size& rMapped, const SwCropGrf& rCr,
                           const char* pBLIPType, const sal_uInt8* pGraphicAry, unsigned long nSize,
                           const RtfExport& rExport, SvStream* pStream = nullptr,
-                          bool bWritePicProp = true)
+                          bool bWritePicProp = true, const SwAttrSet* pAttrSet = nullptr)
 {
     OStringBuffer aRet;
     if (pBLIPType && nSize && pGraphicAry)
@@ -3786,6 +3786,15 @@ static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& r
             lcl_AppendSP(aRet, "wzDescription", sDescription, rExport);
             OUString sName = pFlyFrameFormat->GetObjTitle();
             lcl_AppendSP(aRet, "wzName", sName, rExport);
+
+            if (pAttrSet)
+            {
+                MirrorGraph eMirror = pAttrSet->Get(RES_GRFATR_MIRRORGRF).GetValue();
+                if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both)
+                    // Mirror on the vertical axis is a horizontal flip.
+                    lcl_AppendSP(aRet, "fFlipH", "1", rExport);
+            }
+
             aRet.append("}"); //"}"
         }
 
@@ -4100,9 +4109,10 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
     }
 
     bool bWritePicProp = !pFrame || pFrame->IsInline();
+    const SwAttrSet* pAttrSet = pGrfNode->GetpSwAttrSet();
     if (pBLIPType)
         ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize,
-                   m_rExport, &m_rExport.Strm(), bWritePicProp);
+                   m_rExport, &m_rExport.Strm(), bWritePicProp, pAttrSet);
     else
     {
         aStream.Seek(0);
@@ -4114,7 +4124,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
         pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
 
         ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize,
-                   m_rExport, &m_rExport.Strm(), bWritePicProp);
+                   m_rExport, &m_rExport.Strm(), bWritePicProp, pAttrSet);
     }
 
     if (!pFrame || pFrame->IsInline())
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 89b587012ff3..6f712d9a75c0 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -890,6 +890,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         {
             m_xShape = xShape; // store it for later resolvePict call
         }
+
+        // Handle horizontal flip.
+        if (obFlipH == true)
+        {
+            if (xPropertySet.is())
+                xPropertySet->setPropertyValue("IsMirrored", uno::makeAny(true));
+        }
         return;
     }
 


More information about the Libreoffice-commits mailing list