[Libreoffice-commits] .: sw/qa writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Sat Mar 24 08:49:30 PDT 2012


 sw/qa/extras/rtftok/data/fdo47036.rtf          |   12 ++++++++++++
 sw/qa/extras/rtftok/rtftok.cxx                 |    5 +++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   12 +++++++-----
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |    1 +
 4 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 5e994d528c67e4db1e0ef7ba01349a51acbdacb3
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Mar 24 14:55:09 2012 +0100

    fdo#47036 fix RTF import of multi-paragraph exact height textboxes

diff --git a/sw/qa/extras/rtftok/data/fdo47036.rtf b/sw/qa/extras/rtftok/data/fdo47036.rtf
index 0b5602f..cc988f1 100644
--- a/sw/qa/extras/rtftok/data/fdo47036.rtf
+++ b/sw/qa/extras/rtftok/data/fdo47036.rtf
@@ -58,4 +58,16 @@
 \b\f1\fs33\cf1\insrsid15426039 Booking Advice}
 {\rtlch\fcs1 \af1 \ltrch\fcs0 \f1\insrsid15426039 
 \par }
+\pard \pvpg\phpg\posx1914\posy4761\absh-2400\absw7674\wrapdefault
+\faauto\rin0\lin0\itap0
+{\rtlch\fcs1 \af1\afs19 \ltrch\fcs0 \f1\fs19\cf1\insrsid15426039 foo \tab \tab \tab \tab \tab \tab }
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f1\insrsid15426039
+\par }
+{\rtlch\fcs1 \af1\afs19 \ltrch\fcs0 \f1\fs19\cf1\insrsid15426039 x\tab                                                           
+\par
+\par }
+{\rtlch\fcs1 \af1\afs19 \ltrch\fcs0 \f1\fs19\cf6\insrsid16139741 y}
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\f1\cf6\insrsid15426039\charrsid15426039
+\par }
 }
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index a47ca36..0628268 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -418,6 +418,11 @@ void RtfModelTest::testFdo47036()
     }
     // The image at the document start was ignored.
     CPPUNIT_ASSERT_EQUAL(1, nAtCharacter);
+
+    // There should be 2 textboxes, not 4
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5daec32..e4d4e50 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3460,6 +3460,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState)
     nHoriAnchor(0),
     nVertAlign(0),
     nVertAnchor(0),
+    nHRule(NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto),
     nAnchorType(0)
 {
 }
@@ -3547,7 +3548,12 @@ RTFSprms RTFFrame::getSprms()
                 break;
             case NS_sprm::LN_PWHeightAbs:
                 if ( nH != 0 )
-                    pValue.reset(new RTFValue(nH));
+                {
+                    if (nHRule == NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact)
+                        pValue.reset(new RTFValue(-nH)); // The negative value just sets nHRule
+                    else
+                        pValue.reset(new RTFValue(nH));
+                }
                 break;
             case NS_sprm::LN_PDxaWidth:
                 if ( nW != 0 )
@@ -3577,12 +3583,8 @@ RTFSprms RTFFrame::getSprms()
                 break;
             case NS_ooxml::LN_CT_FramePr_hRule:
                 {
-                    sal_Int32 nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto;
                     if ( nH < 0 )
-                    {
                         nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact;
-                        nH = -nH; // The negative value just sets nHRule
-                    }
                     else if ( nH > 0 )
                         nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
                     pValue.reset(new RTFValue(nHRule));
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index bd2a701..54459e7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -214,6 +214,7 @@ namespace writerfilter {
                 sal_Int32 nX, nY, nW, nH;
                 sal_Int32 nHoriPadding, nVertPadding;
                 sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
+                Id nHRule;
             public:
                 RTFFrame(RTFParserState* pParserState);
                 sal_Int16 nAnchorType;


More information about the Libreoffice-commits mailing list