diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-06-24 14:13:39 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-06-24 17:24:51 +0200 |
commit | 90aaecc1b4c62afcd41d988e4561c615403121a5 (patch) | |
tree | eb44cc9f86243d0da177f2061d8e2289e9c71aff | |
parent | 4869de23a6cc8d1f21041f856bac6822bbe963b1 (diff) |
bnc#823655 fix RTF import of freeform shape coordinates
E.g. 0,1 was imported as 1,0, as we did not differentiate between not
having the coordinate yet and having it as zero.
(cherry picked from commit ddddfe8d6ffa05c467bddb3480e43d7043a3d3c9)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
Change-Id: Ia5fbbcc791dc9c6866ffd4c146793690661d81b4
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 0258fe3acdc4..ebcd21f030f0 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -40,6 +40,7 @@ #include <dmapper/DomainMapper.hxx> #include "../dmapper/GraphicHelpers.hxx" #include <rtfsdrimport.hxx> +#include <boost/optional.hpp> using rtl::OString; using rtl::OStringBuffer; @@ -173,19 +174,19 @@ void RTFSdrImport::resolve(RTFShape& rShape) // The coordinates are in an (x,y) form. aToken = aToken.copy(1, aToken.getLength() - 2); sal_Int32 nI = 0; - sal_Int32 nX = 0; - sal_Int32 nY = 0; + boost::optional<sal_Int32> oX; + boost::optional<sal_Int32> oY; do { OUString aPoint = aToken.getToken(0, ',', nI); - if (!nX) - nX = aPoint.toInt32(); + if (!oX) + oX.reset(aPoint.toInt32()); else - nY = aPoint.toInt32(); + oY.reset(aPoint.toInt32()); } while (nI >= 0); - aCoordinates[nIndex].First.Value <<= nX; - aCoordinates[nIndex].Second.Value <<= nY; + aCoordinates[nIndex].First.Value <<= *oX; + aCoordinates[nIndex].Second.Value <<= *oY; nIndex++; } } |