fdo#47495 fix RTF import of multiple shapes inside textframes
Change-Id: Iee8541ff9e88139648d45f08968476f2b1d4e1b3
This commit is contained in:
parent
462907d48f
commit
ad72a47dbd
164
sw/qa/extras/rtfimport/data/fdo47495.rtf
Normal file
164
sw/qa/extras/rtfimport/data/fdo47495.rtf
Normal file
@ -0,0 +1,164 @@
|
||||
{\rtf1\adeflang1025\ansi\ansicpg1251\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1049\deflangfe1049\themelang1049\themelangfe0\themelangcs0
|
||||
\pard \ltrpar\qc \li0\ri0\nowidctlpar\pvpg\phpg\posx632\posy2159\absh-139\absw10653\wrapdefault\faauto\rin0\lin0\itap0
|
||||
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid2168934
|
||||
{\shp
|
||||
{\*\shpinst\shpleft420\shptop16200\shpright11460\shpbottom16200\shpfhdr0\shpbxpage\shpbxignore\shpbypage\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz0\shplid1026
|
||||
{\sp
|
||||
{\sn shapeType}
|
||||
{\sv 20}
|
||||
}
|
||||
{\sp
|
||||
{\sn fFlipH}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fFlipV}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn lineWidth}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fShadow}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn posrelh}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn posrelv}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn fLayoutInCell}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fBehindDocument}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn fPseudoInline}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fLayoutInCell}
|
||||
{\sv 0}
|
||||
}
|
||||
}
|
||||
{\shprslt
|
||||
{\*\do\dobxpage\dobypage\dodhgt0\dpline\dpptx0\dppty0\dpptx11040\dppty0\dpx420\dpy16200\dpxsize11040\dpysize0\dplinew0\dplinecor0\dplinecog0\dplinecob0}
|
||||
}
|
||||
}
|
||||
{\shp
|
||||
{\*\shpinst\shpleft476\shptop4742\shpright11298\shpbottom4952\shpfhdr0\shpbxpage\shpbxignore\shpbypage\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz1\shplid1027
|
||||
{\sp
|
||||
{\sn shapeType}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn fFlipH}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fFlipV}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fFilled}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn lineWidth}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fShadow}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn posrelh}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn posrelv}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn fLayoutInCell}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fBehindDocument}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn fPseudoInline}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fLayoutInCell}
|
||||
{\sv 0}
|
||||
}
|
||||
}
|
||||
{\shprslt
|
||||
{\*\do\dobxpage\dobypage\dodhgt1\dprect\dpx476\dpy4742\dpxsize10822\dpysize210
|
||||
\dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr255\dpfillbgcg255\dpfillbgcb255\dpfillpat0\dplinew0\dplinecor0\dplinecog0\dplinecob0}
|
||||
}
|
||||
}
|
||||
{\shp
|
||||
{\*\shpinst\shpleft8626\shptop4742\shpright8626\shpbottom4953\shpfhdr0\shpbxpage\shpbxignore\shpbypage\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz2\shplid1028
|
||||
{\sp
|
||||
{\sn shapeType}
|
||||
{\sv 20}
|
||||
}
|
||||
{\sp
|
||||
{\sn fFlipH}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fFlipV}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn lineWidth}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fShadow}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn posrelh}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn posrelv}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn fLayoutInCell}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fBehindDocument}
|
||||
{\sv 1}
|
||||
}
|
||||
{\sp
|
||||
{\sn fPseudoInline}
|
||||
{\sv 0}
|
||||
}
|
||||
{\sp
|
||||
{\sn fLayoutInCell}
|
||||
{\sv 0}
|
||||
}
|
||||
}
|
||||
{\shprslt
|
||||
{\*\do\dobxpage\dobypage\dodhgt2\dpline\dpptx0\dppty0\dpptx0\dppty211\dpx8626\dpy4742\dpxsize0\dpysize211\dplinew0\dplinecor0\dplinecog0\dplinecob0}
|
||||
}
|
||||
}
|
||||
}
|
||||
\pard \par
|
||||
}
|
@ -103,6 +103,7 @@ public:
|
||||
void testFdo36089();
|
||||
void testFdo49892();
|
||||
void testFdo48446();
|
||||
void testFdo47495();
|
||||
|
||||
CPPUNIT_TEST_SUITE(Test);
|
||||
#if !defined(MACOSX) && !defined(WNT)
|
||||
@ -148,6 +149,7 @@ public:
|
||||
CPPUNIT_TEST(testFdo36089);
|
||||
CPPUNIT_TEST(testFdo49892);
|
||||
CPPUNIT_TEST(testFdo48446);
|
||||
CPPUNIT_TEST(testFdo47495);
|
||||
#endif
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
@ -896,6 +898,13 @@ void Test::testFdo48446()
|
||||
getParagraph(1, aExpected);
|
||||
}
|
||||
|
||||
void Test::testFdo47495()
|
||||
{
|
||||
load("fdo47495.rtf");
|
||||
// Used to have 4 paragraphs, as a result the original bugdoc had 2 pages instead of 1.
|
||||
CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
@ -162,6 +162,21 @@ protected:
|
||||
return data;
|
||||
}
|
||||
|
||||
/// Get number of paragraphs of the document.
|
||||
int getParagraphs()
|
||||
{
|
||||
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
||||
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
||||
int nRet = 0;
|
||||
while (xParaEnum->hasMoreElements())
|
||||
{
|
||||
xParaEnum->nextElement();
|
||||
nRet++;
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
// Get paragraph (counted from 1), optionally check it contains the given text.
|
||||
uno::Reference< text::XTextRange > getParagraph( int number, OUString content = OUString() ) const
|
||||
{
|
||||
|
@ -3621,6 +3621,8 @@ int RTFDocumentImpl::popState()
|
||||
{
|
||||
m_aStates.top().resetFrame();
|
||||
parBreak();
|
||||
// Save this state for later use, so we only reset frame status only for the first shape inside a frame.
|
||||
aState = m_aStates.top();
|
||||
m_bNeedPap = true;
|
||||
}
|
||||
break;
|
||||
@ -3863,7 +3865,8 @@ int RTFDocumentImpl::popState()
|
||||
m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes;
|
||||
}
|
||||
else if (aState.nDestinationState == DESTINATION_FLYMAINCONTENT ||
|
||||
aState.nDestinationState == DESTINATION_SHPPICT)
|
||||
aState.nDestinationState == DESTINATION_SHPPICT ||
|
||||
aState.nDestinationState == DESTINATION_SHAPE)
|
||||
m_aStates.top().aFrame = aState.aFrame;
|
||||
if (m_pCurrentBuffer == &m_aSuperBuffer)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user