diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-03-06 11:45:15 +0100 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-03-07 08:30:50 +0000 |
commit | a6f8721768eb3318245893eced3b89522fc87383 (patch) | |
tree | 36e3661accce6934854b986408dc784ffc9503ee /writerfilter | |
parent | 202d4d32d481ce7e2d1f9933186b30f9ae77497a (diff) |
fdo#60722 RTF filter: shape import fixes
- fix line color default
- fix line width default
- fix z-order of shapes
(cherry picked from commits 9c7dbd9e1d2a131402a80e377630fe1ab5381a47,
cf2a1277acd4a29492f056a626b13e903d391027,
1eaab77c718ffa254068ae6032862dfb5a03db67 and
ea66024d4da38a619f44c941b65e6a28b74214b9)
Change-Id: Ib6097c844b2bc929c6ece31bcec62f27bfbf386c
Reviewed-on: https://gerrit.libreoffice.org/2569
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/GraphicHelpers.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 27 |
4 files changed, 23 insertions, 12 deletions
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index 4d190e54a912..4564f3aede14 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -251,7 +251,8 @@ sal_Int32 GraphicZOrderHelper::findZOrder( sal_Int32 relativeHeight ) while( it != items.end()) { // std::map is iterated sorted by key - if( it->first > relativeHeight ) + // if there is an item that has the same z-order, we belong under it + if( it->first >= relativeHeight ) break; // this is the first one higher, we belong right before it else ++it; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index c35b0d90e185..401ebb783f9e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3186,6 +3186,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_SHPBOTTOM: m_aStates.top().aShape.nBottom = TWIP_TO_MM100(nParam); break; + case RTF_SHPZ: + m_aStates.top().aShape.oZ.reset(nParam); + break; case RTF_FFTYPE: switch (nParam) { diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index c7affd7fe032..5ced0196b916 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -31,6 +31,7 @@ #include <stack> #include <queue> +#include <boost/optional.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -259,6 +260,7 @@ namespace writerfilter { sal_Int32 nTop; sal_Int32 nRight; sal_Int32 nBottom; + boost::optional<sal_Int32> oZ; ///< Z-Order of the shape. sal_Int16 nHoriOrientRelation; sal_Int16 nVertOrientRelation; int nWrap; diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 641fa973e39b..864a8bda7962 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -100,6 +100,10 @@ void RTFSdrImport::resolve(RTFShape& rShape) beans::PropertyValue aPropertyValue; awt::Rectangle aViewBox; std::vector<beans::PropertyValue> aPathPropVec; + // Default line color is black in Word, blue in Writer. + uno::Any aLineColor = uno::makeAny(COL_BLACK); + // Default line width is 0.75 pt (26 mm100) in Word, 0 in Writer. + uno::Any aLineWidth = uno::makeAny(sal_Int32(26)); for (std::vector< std::pair<rtl::OUString, rtl::OUString> >::iterator i = rShape.aProperties.begin(); i != rShape.aProperties.end(); ++i) @@ -138,11 +142,8 @@ void RTFSdrImport::resolve(RTFShape& rShape) } else if ( i->first == "fillBackColor" ) ; // Ignore: complementer of fillColor - else if (i->first == "lineColor" && xPropertySet.is()) - { - aAny <<= msfilter::util::BGRToRGB(i->second.toInt32()); - xPropertySet->setPropertyValue("LineColor", aAny); - } + else if (i->first == "lineColor") + aLineColor <<= msfilter::util::BGRToRGB(i->second.toInt32()); else if ( i->first == "lineBackColor" ) ; // Ignore: complementer of lineColor else if (i->first == "txflTextFlow" && xPropertySet.is()) @@ -166,12 +167,8 @@ void RTFSdrImport::resolve(RTFShape& rShape) aAny <<= i->second.toInt32()*100/65536; xPropertySet->setPropertyValue("RotateAngle", aAny); } - else if (i->first == "lineWidth" && xPropertySet.is()) - { - - aAny <<= i->second.toInt32()/360; - xPropertySet->setPropertyValue("LineWidth", aAny); - } + else if (i->first == "lineWidth") + aLineWidth <<= i->second.toInt32()/360; else if ( i->first == "pVerticies" ) { uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates; @@ -297,6 +294,14 @@ void RTFSdrImport::resolve(RTFShape& rShape) OUStringToOString( i->second, RTL_TEXTENCODING_UTF8 ).getStr() << "'"); } + if (xPropertySet.is()) + { + xPropertySet->setPropertyValue("LineColor", aLineColor); + xPropertySet->setPropertyValue("LineWidth", aLineWidth); + if (rShape.oZ) + resolveDhgt(xPropertySet, *rShape.oZ); + } + if (nType == ESCHER_ShpInst_PictureFrame) // picture frame { if (bPib) |