[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - writerfilter/source

Michael Stahl mstahl at redhat.com
Fri Jul 25 02:30:32 PDT 2014


 writerfilter/source/rtftok/rtfsdrimport.cxx |   48 ++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

New commits:
commit 2ed95c9f8507d711f46360317e546683c7f0b8c2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jul 17 15:09:39 2014 +0200

    fdo#79319: writerfilter: RTF import: support horizontal rule
    
    There are special properties to create a "horizontal rule" shape
    that apparently set some specific defaults; this prevents the
    shape being imported as a big fat rectangle over the document.
    
    Change-Id: I402376d7306e870ad895beaa657750cbf3290d98
    (cherry picked from commit 589ca2a5e88a976bb10e60fcb1e3e75f4aa2504e)
    Reviewed-on: https://gerrit.libreoffice.org/10388
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 22e257b..19353fb 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -659,6 +659,54 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
                 }
             }
         }
+        else if (i->first == "fHorizRule") // TODO: what does "fStandardHR" do?
+        {   // horizontal rule: relative width defaults to 100% of paragraph
+            // TODO: does it have a default height?
+            if (!oRelativeWidth)
+            {
+                oRelativeWidth = 100;
+            }
+            nRelativeWidthRelation = text::RelOrientation::FRAME;
+            sal_Int16 const nVertOrient = text::VertOrientation::CENTER;
+            if (xPropertySet.is())
+            {
+                xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
+            }
+        }
+        else if (i->first == "pctHR")
+        {   // horizontal rule relative width in permille
+            oRelativeWidth = i->second.toInt32() / 10;
+        }
+        else if (i->first == "dxHeightHR")
+        {   // horizontal rule height
+            sal_uInt32 const nHeight(convertTwipToMm100(i->second.toInt32()));
+            rShape.nBottom = rShape.nTop + nHeight;
+        }
+        else if (i->first == "dxWidthHR")
+        {   // horizontal rule width
+            sal_uInt32 const nWidth(convertTwipToMm100(i->second.toInt32()));
+            rShape.nRight = rShape.nLeft + nWidth;
+        }
+        else if (i->first == "alignHR")
+        {   // horizontal orientation *for horizontal rule*
+            sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
+            switch (i->second.toInt32())
+            {
+                case 0:
+                    nHoriOrient = text::HoriOrientation::LEFT;
+                    break;
+                case 1:
+                    nHoriOrient = text::HoriOrientation::CENTER;
+                    break;
+                case 2:
+                    nHoriOrient = text::HoriOrientation::RIGHT;
+                    break;
+            }
+            if (xPropertySet.is() && text::HoriOrientation::NONE != nHoriOrient)
+            {
+                xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
+            }
+        }
         else
             SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'");
     }


More information about the Libreoffice-commits mailing list