diff options
-rw-r--r-- | sw/qa/extras/ooxmltok/data/n705956-2.docx | bin | 0 -> 9363 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmltok/ooxmltok.cxx | 27 | ||||
-rw-r--r-- | writerfilter/inc/ooxml/OOXMLDocument.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLDocumentImpl.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 2 |
6 files changed, 41 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmltok/data/n705956-2.docx b/sw/qa/extras/ooxmltok/data/n705956-2.docx Binary files differnew file mode 100644 index 000000000000..138818523a92 --- /dev/null +++ b/sw/qa/extras/ooxmltok/data/n705956-2.docx diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 2b639e0959ae..c822bf4c7283 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -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(); diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx index 1e150b41a8c9..7ce8052da2a5 100644 --- a/writerfilter/inc/ooxml/OOXMLDocument.hxx +++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx @@ -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; }; diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 18357bcb3851..acf84f9ab68f 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -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) diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx index d534b158ffc4..a20fbab52af1 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx @@ -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 diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 4a4a076cd522..0724c659f4ec 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -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()) |