[Libreoffice-commits] core.git: Branch 'distro/suse/suse-3.6' - 2 commits - writerfilter/source

Miklos Vajna vmiklos at suse.cz
Mon Jun 24 08:25:24 PDT 2013


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   22 ++++++++++++++++++++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |    1 +
 writerfilter/source/rtftok/rtfsdrimport.cxx    |   17 ++++++++++-------
 3 files changed, 31 insertions(+), 9 deletions(-)

New commits:
commit 90aaecc1b4c62afcd41d988e4561c615403121a5
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jun 24 14:13:39 2013 +0200

    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

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 0258fe3..ebcd21f 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++;
                 }
             }
commit 4869de23a6cc8d1f21041f856bac6822bbe963b1
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Wed Sep 19 09:45:49 2012 +0100

    bnc#823655 Import RTF shape wrap property.
    
    Property \shpwrN, where N can be
    1: Wrap at top and bottom (no wrap at sides)
    2: Wrap around shape
    3: None (wrap as though shape isn't there)
    4: Wrap tightly around shape
    5: Wrap text through shape
    
    Reviewed-on: https://gerrit.libreoffice.org/647
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>
    (cherry picked from commit d56e7c9011e662b39f0e9775e654f62cea8765c2)
    
    Change-Id: Ic700e06bf9ef894a6efa7e8d033888ed80a7082f
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a89b3c0..67a26e3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/VertOrientation.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
 #include <rtl/tencinfo.h>
 #include <svl/lngmisc.hxx>
 #include <unotools/ucbstreamhelper.hxx>
@@ -617,7 +618,6 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 {
     SvMemoryStream aStream;
     SvStream *pStream = 0;
-
     if (!m_pBinaryData.get())
     {
         pStream = &aStream;
@@ -2692,6 +2692,23 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                 m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_WrapSquare_wrapText, pValue);
             }
             break;
+        case RTF_SHPWR:
+            {
+                switch (nParam)
+                {
+                case 1:
+                    m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_NONE; break;
+                case 2:
+                    m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL; break;
+                case 3:
+                    m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT; break;
+                case 4:
+                    m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL; break;
+                case 5:
+                    m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT; break;
+                }
+            }
+            break;
         case RTF_CELLX:
             {
                 int nCellX = nParam - m_aStates.top().nCellX;
@@ -3878,7 +3895,8 @@ RTFShape::RTFShape()
     nRight(0),
     nBottom(0),
     nHoriOrientRelation(0),
-    nVertOrientRelation(0)
+    nVertOrientRelation(0),
+    nWrap(-1)
 {
 }
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 5a4b519..5aa7ba3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -199,6 +199,7 @@ namespace writerfilter {
                 int nBottom;
                 sal_Int16 nHoriOrientRelation;
                 sal_Int16 nVertOrientRelation;
+                int nWrap;
         };
 
         /// Stores the properties of a drawing object.
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 701780d..0258fe3 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -325,6 +325,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
             xPropertySet->setPropertyValue("HoriOrientRelation", uno::makeAny(rShape.nHoriOrientRelation));
         if (rShape.nVertOrientRelation != 0)
             xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation));
+        if (rShape.nWrap != -1)
+            xPropertySet->setPropertyValue("Surround", uno::makeAny(rShape.nWrap));
     }
 
     // Send it to dmapper


More information about the Libreoffice-commits mailing list