Kaydet (Commit) 5e994d52 authored tarafından Miklos Vajna's avatar Miklos Vajna

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

üst 0d9132c5
...@@ -58,4 +58,16 @@ ...@@ -58,4 +58,16 @@
\b\f1\fs33\cf1\insrsid15426039 Booking Advice} \b\f1\fs33\cf1\insrsid15426039 Booking Advice}
{\rtlch\fcs1 \af1 \ltrch\fcs0 \f1\insrsid15426039 {\rtlch\fcs1 \af1 \ltrch\fcs0 \f1\insrsid15426039
\par } \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 }
} }
...@@ -418,6 +418,11 @@ void RtfModelTest::testFdo47036() ...@@ -418,6 +418,11 @@ void RtfModelTest::testFdo47036()
} }
// The image at the document start was ignored. // The image at the document start was ignored.
CPPUNIT_ASSERT_EQUAL(1, nAtCharacter); 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); CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
......
...@@ -3460,6 +3460,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState) ...@@ -3460,6 +3460,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState)
nHoriAnchor(0), nHoriAnchor(0),
nVertAlign(0), nVertAlign(0),
nVertAnchor(0), nVertAnchor(0),
nHRule(NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto),
nAnchorType(0) nAnchorType(0)
{ {
} }
...@@ -3547,7 +3548,12 @@ RTFSprms RTFFrame::getSprms() ...@@ -3547,7 +3548,12 @@ RTFSprms RTFFrame::getSprms()
break; break;
case NS_sprm::LN_PWHeightAbs: case NS_sprm::LN_PWHeightAbs:
if ( nH != 0 ) 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; break;
case NS_sprm::LN_PDxaWidth: case NS_sprm::LN_PDxaWidth:
if ( nW != 0 ) if ( nW != 0 )
...@@ -3577,12 +3583,8 @@ RTFSprms RTFFrame::getSprms() ...@@ -3577,12 +3583,8 @@ RTFSprms RTFFrame::getSprms()
break; break;
case NS_ooxml::LN_CT_FramePr_hRule: case NS_ooxml::LN_CT_FramePr_hRule:
{ {
sal_Int32 nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto;
if ( nH < 0 ) if ( nH < 0 )
{
nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact; nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact;
nH = -nH; // The negative value just sets nHRule
}
else if ( nH > 0 ) else if ( nH > 0 )
nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast; nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
pValue.reset(new RTFValue(nHRule)); pValue.reset(new RTFValue(nHRule));
......
...@@ -214,6 +214,7 @@ namespace writerfilter { ...@@ -214,6 +214,7 @@ namespace writerfilter {
sal_Int32 nX, nY, nW, nH; sal_Int32 nX, nY, nW, nH;
sal_Int32 nHoriPadding, nVertPadding; sal_Int32 nHoriPadding, nVertPadding;
sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor; sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
Id nHRule;
public: public:
RTFFrame(RTFParserState* pParserState); RTFFrame(RTFParserState* pParserState);
sal_Int16 nAnchorType; sal_Int16 nAnchorType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment