tdf#49893: final fix for blank rectangle problem
removed artifacts from invalid shape: nested shape instruction destination now is not drawn on its own. instead it is merged with outer shape instruction. this helps to avoid drawing semi-ready shapes. Change-Id: I45589cc1b742d878e5914dd3f66a8184ecfd044c Reviewed-on: https://gerrit.libreoffice.org/14584 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
committed by
Thorsten Behrens
parent
cc58fe6559
commit
611d8ee6fe
15
sw/qa/extras/rtfimport/data/fdo49893-3.rtf
Normal file
15
sw/qa/extras/rtfimport/data/fdo49893-3.rtf
Normal file
@@ -0,0 +1,15 @@
|
||||
{\rtf1
|
||||
{\shp{\*\shpinst{\shplid1{\sp{\sn ShapeType}{\sv 75}}\shpleft0\shptop144
|
||||
\shpbottom576\shpright1296\shpbxcolumn\shpbypara\shpwr3\shpwrk0{\sp{\sn dxWrapDistLeft}{\sv 0}}{\sp{\sn dxWrapDistRight}{\sv 0}}
|
||||
{\sp{\sn dxWrapDistTop}{\sv 0}}{\sp{\sn dxWrapDistBottom}{\sv 0}}{\sp{\sn fFilled}{\sv 1}}{\sp{\sn fillType}{\sv 3}}{\sp{\sn fillType}
|
||||
{\sv 3}}{\sp{\sn fillColor}{\sv 0}}{\sp{\sn fillBackColor}{\sv 0}}{\sp{\sn fillToTop}{\sv 65536}}{\sp{\sn fillToLeft}{\sv 65536}
|
||||
}{\sp{\sn fillToRight}{\sv 0}}{\sp{\sn fillToBottom}{\sv 0}}{\sp{\sn pib}{\sv
|
||||
{\pict\pngblip
|
||||
47494638396110001000d5ff00000000ffffffc0c0c0555f00ffffaafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a8888888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b18181810101009090906060603030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021f90401000002002c0000000010001000000684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a00001e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b}}}
|
||||
{\sp{\sn lTxid}{\sv 1}}{\sp{\sn dxTextLeft}{\sv 91440}}{\sp{\sn dxTextRight}
|
||||
{\sv 91440}}{\sp{\sn dxTextTop}{\sv 45720}}{\sp{\sn dxTextBottom}{\sv 45720}}{\sp{\sn txflTextFlow}{\sv 0}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -2227,6 +2227,23 @@ DECLARE_RTFIMPORT_TEST(testFdo49893_2, "fdo49893-2.rtf")
|
||||
CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), parseDump("/root/page[3]/header/txt/text()"));
|
||||
}
|
||||
|
||||
DECLARE_RTFIMPORT_TEST(testFdo49893_3, "fdo49893-3.rtf")
|
||||
{
|
||||
// No artifacts (black lines in left top corner) as shape #3 are expected
|
||||
try
|
||||
{
|
||||
uno::Reference<drawing::XShape> xShape2(getShape(3), uno::UNO_QUERY);
|
||||
CPPUNIT_FAIL("exception expected: no shape #3 in document");
|
||||
}
|
||||
catch (lang::IndexOutOfBoundsException const&)
|
||||
{
|
||||
/* expected */
|
||||
}
|
||||
|
||||
// Correct wrapping for shape
|
||||
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(getShape(2), "Surround"));
|
||||
}
|
||||
|
||||
DECLARE_RTFIMPORT_TEST(testFdo89496, "fdo89496.rtf")
|
||||
{
|
||||
// Just ensure that document is loaded and shape exists
|
||||
|
@@ -5173,9 +5173,13 @@ RTFError RTFDocumentImpl::popState()
|
||||
break;
|
||||
case Destination::PICPROP:
|
||||
case Destination::SHAPEINSTRUCTION:
|
||||
// Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself.
|
||||
if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape))
|
||||
if (m_aStates.size() > 1 && m_aStates[m_aStates.size() - 2].eDestination == Destination::SHAPEINSTRUCTION)
|
||||
{
|
||||
// Do not resolve shape if shape instruction destination is inside other shape instruction
|
||||
}
|
||||
else if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape))
|
||||
{
|
||||
// Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself.
|
||||
RTFSdrImport::ShapeOrPict eType = (aState.eDestination == Destination::SHAPEINSTRUCTION) ? RTFSdrImport::SHAPE : RTFSdrImport::PICT;
|
||||
m_pSdrImport->resolve(m_aStates.top().aShape, true, eType);
|
||||
}
|
||||
@@ -5976,6 +5980,17 @@ RTFError RTFDocumentImpl::popState()
|
||||
m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes;
|
||||
}
|
||||
break;
|
||||
case Destination::SHAPEINSTRUCTION:
|
||||
if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::SHAPEINSTRUCTION)
|
||||
{
|
||||
// Shape instruction inside other shape instruction: just copy new shape settings:
|
||||
// it will be resolved on end of topmost shape instruction destination
|
||||
m_aStates.top().aShape = aState.aShape;
|
||||
m_aStates.top().aPicture = aState.aPicture;
|
||||
m_aStates.top().aCharacterSprms = aState.aCharacterSprms;
|
||||
m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes;
|
||||
}
|
||||
break;
|
||||
case Destination::FLYMAINCONTENT:
|
||||
case Destination::SHPPICT:
|
||||
case Destination::SHAPE:
|
||||
|
Reference in New Issue
Block a user