[Libreoffice-commits] core.git: 2 commits - oox/inc writerfilter/source
Miklos Vajna
vmiklos at suse.cz
Thu Apr 11 08:41:48 PDT 2013
oox/inc/oox/vml/vmlformatting.hxx | 2 -
writerfilter/source/rtftok/rtfsdrimport.cxx | 44 +++++++++++++++++++++++++---
2 files changed, 41 insertions(+), 5 deletions(-)
New commits:
commit d795dfdffb1a8c3c50d7b4b96f55a284fc929430
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Apr 11 17:39:06 2013 +0200
RTF filter: import fShadow, shadowColor and shadowOffset shape properties
Change-Id: I862a6b59ea2c3fa00f12cb3e9dbfd672a6aa58e5
diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx
index b7b9e6a..79fa380 100644
--- a/oox/inc/oox/vml/vmlformatting.hxx
+++ b/oox/inc/oox/vml/vmlformatting.hxx
@@ -226,7 +226,7 @@ struct OOX_DLLPUBLIC FillModel
// ============================================================================
/** The shadow model structure contains all shape shadow properties. */
-struct ShadowModel
+struct OOX_DLLPUBLIC ShadowModel
{
bool mbHasShadow; ///< Is a v:shadow element seen?
OptValue<bool> moShadowOn; ///< Is the element turned on?
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 17cb1d8..0aa3656 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -153,8 +153,10 @@ void RTFSdrImport::resolve(RTFShape& rShape)
// Default line width is 0.75 pt (26 mm100) in Word, 0 in Writer.
uno::Any aLineWidth = uno::makeAny(sal_Int32(26));
text::WritingMode eWritingMode = text::WritingMode_LR_TB;
- // Used for gradients, let the VML import do the hard work.
- oox::vml::FillModel aFillModel;
+
+ // Importing these are not trivial, let the VML import do the hard work.
+ oox::vml::FillModel aFillModel; // Gradient.
+ oox::vml::ShadowModel aShadowModel; // Shadow.
for (std::vector< std::pair<OUString, OUString> >::iterator i = rShape.aProperties.begin();
i != rShape.aProperties.end(); ++i)
@@ -399,6 +401,16 @@ void RTFSdrImport::resolve(RTFShape& rShape)
}
else if (i->first == "fillFocus")
aFillModel.moFocus.set(i->second.toDouble() / 100); // percent
+ else if (i->first == "fShadow" && xPropertySet.is())
+ {
+ if (i->second.toInt32() == 1)
+ aShadowModel.mbHasShadow = true;
+ }
+ else if (i->first == "shadowColor")
+ aShadowModel.moColor.set(OUString("#") + OStringToOUString(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(i->second.toInt32())), RTL_TEXTENCODING_UTF8));
+ else if (i->first == "shadowOffsetX")
+ // EMUs to points
+ aShadowModel.moOffset.set(OUString::number(i->second.toDouble() / 12700) + "pt");
else
SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'");
}
@@ -493,14 +505,22 @@ void RTFSdrImport::resolve(RTFShape& rShape)
xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation));
if (rShape.nWrap != -1)
xPropertySet->setPropertyValue("Surround", uno::makeAny(text::WrapTextMode(rShape.nWrap)));
+ oox::ModelObjectHelper aModelObjectHelper(m_rImport.getModelFactory());
if (aFillModel.moType.has())
{
- oox::ModelObjectHelper aModelObjectHelper(m_rImport.getModelFactory());
oox::drawingml::ShapePropertyMap aPropMap(aModelObjectHelper);
aFillModel.pushToPropMap(aPropMap, m_rImport.getGraphicHelper());
// Sets the FillStyle and FillGradient UNO properties.
oox::PropertySet(xShape).setProperties(aPropMap);
}
+
+ if (aShadowModel.mbHasShadow)
+ {
+ oox::drawingml::ShapePropertyMap aPropMap(aModelObjectHelper);
+ aShadowModel.pushToPropMap(aPropMap, m_rImport.getGraphicHelper());
+ // Sets the ShadowFormat UNO property.
+ oox::PropertySet(xShape).setProperties(aPropMap);
+ }
}
// Send it to dmapper
commit bc3c05f816fbe21c251e4749097914e40d373ddd
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Apr 11 15:41:14 2013 +0200
RTF import of new-style frames: implement line color/width
Change-Id: Ice40f1a9532e661ab6f4e3f476e638f2f8f82b72
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 90b8b9e..17cb1d8 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/SizeType.hpp>
@@ -405,8 +406,23 @@ void RTFSdrImport::resolve(RTFShape& rShape)
if (xPropertySet.is())
{
if (!bTextFrame)
+ {
xPropertySet->setPropertyValue("LineColor", aLineColor);
- xPropertySet->setPropertyValue("LineWidth", aLineWidth);
+ xPropertySet->setPropertyValue("LineWidth", aLineWidth);
+ }
+ else
+ {
+ static OUString aBorders[] = {
+ OUString("TopBorder"), OUString("LeftBorder"), OUString("BottomBorder"), OUString("RightBorder")
+ };
+ for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
+ {
+ table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(aBorders[i]).get<table::BorderLine2>();
+ aBorderLine.Color = aLineColor.get<sal_Int32>();
+ aBorderLine.LineWidth = aLineWidth.get<sal_Int32>();
+ xPropertySet->setPropertyValue(aBorders[i], uno::makeAny(aBorderLine));
+ }
+ }
if (rShape.oZ)
resolveDhgt(xPropertySet, *rShape.oZ);
if (bTextFrame)
More information about the Libreoffice-commits
mailing list