summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-03-24 14:55:09 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-03-24 16:49:28 +0100
commit5e994d528c67e4db1e0ef7ba01349a51acbdacb3 (patch)
tree71daa08106110393c8505261099812dd5a5376b9
parent0d9132c5046e15540abc20e45d64080708626441 (diff)
fdo#47036 fix RTF import of multi-paragraph exact height textboxes
-rw-r--r--sw/qa/extras/rtftok/data/fdo47036.rtf12
-rw-r--r--sw/qa/extras/rtftok/rtftok.cxx5
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx12
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx1
4 files changed, 25 insertions, 5 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo47036.rtf b/sw/qa/extras/rtftok/data/fdo47036.rtf
index 0b5602f2bca4..cc988f1eac0d 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 a47ca3618d7a..0628268b9267 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 5daec329cc9c..e4d4e5055bd5 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 bd2a7016a3db..54459e74ce85 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;