do reuse shape context
This is pretty much a revert of 60cb70b945
.
Turns out e.g. <v:shapetype> is not local only to its <w:pict>.
Added a testcase.
Change-Id: Ibbb9fe01bc2fc77dd67151bf4ca0905443eebf63
This commit is contained in:
parent
e5d589bb3c
commit
476316bfc9
6 changed files with 41 additions and 3 deletions
BIN
sw/qa/extras/ooxmltok/data/n705956-2.docx
Normal file
BIN
sw/qa/extras/ooxmltok/data/n705956-2.docx
Normal file
Binary file not shown.
|
@ -56,7 +56,8 @@ public:
|
|||
void testN757890();
|
||||
void testFdo49940();
|
||||
void testN751077();
|
||||
void testN705956();
|
||||
void testN705956_1();
|
||||
void testN705956_2();
|
||||
|
||||
CPPUNIT_TEST_SUITE(Test);
|
||||
#if !defined(MACOSX) && !defined(WNT)
|
||||
|
@ -67,7 +68,8 @@ public:
|
|||
CPPUNIT_TEST(testN757890);
|
||||
CPPUNIT_TEST(testFdo49940);
|
||||
CPPUNIT_TEST(testN751077);
|
||||
CPPUNIT_TEST(testN705956);
|
||||
CPPUNIT_TEST(testN705956_1);
|
||||
CPPUNIT_TEST(testN705956_2);
|
||||
#endif
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
|
@ -241,7 +243,7 @@ xray para.PageStyleName
|
|||
CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), value );
|
||||
}
|
||||
|
||||
void Test::testN705956()
|
||||
void Test::testN705956_1()
|
||||
{
|
||||
load( "n705956-1.docx" );
|
||||
/*
|
||||
|
@ -263,6 +265,25 @@ xray graphic.Size
|
|||
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(106), bitmap->getSize().Height );
|
||||
}
|
||||
|
||||
void Test::testN705956_2()
|
||||
{
|
||||
load( "n705956-2.docx" );
|
||||
/*
|
||||
<v:shapetype> must be global, reachable even from <v:shape> inside another <w:pict>
|
||||
image = ThisComponent.DrawPage.getByIndex(0)
|
||||
xray image.FillColor
|
||||
*/
|
||||
uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
|
||||
uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
|
||||
uno::Reference<drawing::XShape> image;
|
||||
drawPage->getByIndex(0) >>= image;
|
||||
uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
|
||||
sal_Int32 fillColor;
|
||||
imageProperties->getPropertyValue( "FillColor" ) >>= fillColor;
|
||||
CPPUNIT_ASSERT_EQUAL( 0xc0504d, fillColor );
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
|
|
@ -246,6 +246,8 @@ public:
|
|||
virtual void setXNoteType(const Id & nId) = 0;
|
||||
virtual const Id & getXNoteType() const = 0;
|
||||
virtual const ::rtl::OUString & getTarget() const = 0;
|
||||
virtual uno::Reference<xml::sax::XFastShapeContextHandler> getShapeContext( ) = 0;
|
||||
virtual void setShapeContext( uno::Reference<xml::sax::XFastShapeContextHandler> xContext ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -401,6 +401,16 @@ uno::Reference<io::XInputStream> OOXMLDocumentImpl::getStorageStream()
|
|||
return mpStream->getStorageStream();
|
||||
}
|
||||
|
||||
void OOXMLDocumentImpl::setShapeContext( uno::Reference<xml::sax::XFastShapeContextHandler> xContext )
|
||||
{
|
||||
mxShapeContext = xContext;
|
||||
}
|
||||
|
||||
uno::Reference<xml::sax::XFastShapeContextHandler> OOXMLDocumentImpl::getShapeContext( )
|
||||
{
|
||||
return mxShapeContext;
|
||||
}
|
||||
|
||||
OOXMLDocument *
|
||||
OOXMLDocumentFactory::createDocument
|
||||
(OOXMLStream::Pointer_t pStream)
|
||||
|
|
|
@ -48,6 +48,7 @@ class OOXMLDocumentImpl : public OOXMLDocument
|
|||
|
||||
uno::Reference<frame::XModel> mxModel;
|
||||
uno::Reference<drawing::XDrawPage> mxDrawPage;
|
||||
uno::Reference<xml::sax::XFastShapeContextHandler> mxShapeContext;
|
||||
|
||||
bool mbIsSubstream;
|
||||
|
||||
|
@ -110,6 +111,8 @@ public:
|
|||
virtual void setXNoteType(const Id & rId);
|
||||
virtual const Id & getXNoteType() const;
|
||||
virtual const ::rtl::OUString & getTarget() const;
|
||||
virtual uno::Reference<xml::sax::XFastShapeContextHandler> getShapeContext( );
|
||||
virtual void setShapeContext( uno::Reference<xml::sax::XFastShapeContextHandler> xContext );
|
||||
};
|
||||
}}
|
||||
#endif // OOXML_DOCUMENT_IMPL_HXX
|
||||
|
|
|
@ -1918,6 +1918,7 @@ OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
|
|||
uno::Reference<XMultiComponentFactory> rServiceManager
|
||||
(xContext->getServiceManager());
|
||||
|
||||
mrShapeContext.set( getDocument( )->getShapeContext( ) );
|
||||
if ( !mrShapeContext.is( ) )
|
||||
{
|
||||
// Define the shape context for the whole document
|
||||
|
@ -1928,6 +1929,7 @@ OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
|
|||
(RTL_CONSTASCII_USTRINGPARAM
|
||||
("com.sun.star.xml.sax.FastShapeContextHandler")), xContext),
|
||||
uno::UNO_QUERY);
|
||||
getDocument()->setShapeContext( mrShapeContext );
|
||||
}
|
||||
|
||||
if (mrShapeContext.is())
|
||||
|
|
Loading…
Reference in a new issue