summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-07-17 15:09:39 +0200
committerMichael Stahl <mstahl@redhat.com>2014-07-18 12:42:26 +0200
commit589ca2a5e88a976bb10e60fcb1e3e75f4aa2504e (patch)
treedb0d6300f9222770e945f0959fb008e596890e1e
parent2b9e782497cb962d9ca74a851a1389b0e29df49c (diff)
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
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx48
1 files changed, 48 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 5f8a3914a7fc..399c0088f1f8 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 << "'");
}