[PATCH 3/3] fdo#47036 fix RTF import of multi-paragraph exact height textboxes

Miklos Vajna vmiklos at suse.cz
Sat Mar 24 06:55:09 PDT 2012


---
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   12 +++++++-----
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |    1 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 16d5c75..2d82e28 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3493,6 +3493,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState)
     nHoriAnchor(0),
     nVertAlign(0),
     nVertAnchor(0),
+    nHRule(NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto),
     nAnchorType(0)
 {
 }
@@ -3580,7 +3581,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 )
@@ -3610,12 +3616,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 3a148f5..9626063 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;
-- 
1.7.7


--C7zPtVaVf+AK4Oqc--


More information about the LibreOffice mailing list