diff options
-rw-r--r-- | include/oox/drawingml/graphicshapecontext.hxx | 2 | ||||
-rw-r--r-- | include/oox/ppt/pptshapegroupcontext.hxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/graphicshapecontext.cxx | 14 | ||||
-rw-r--r-- | oox/source/ppt/pptshapegroupcontext.cxx | 7 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/bnc880763.pptx | bin | 0 -> 45631 bytes | |||
-rw-r--r-- | sd/qa/unit/data/xml/n819614_0.xml | 16 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 32 |
7 files changed, 52 insertions, 22 deletions
diff --git a/include/oox/drawingml/graphicshapecontext.hxx b/include/oox/drawingml/graphicshapecontext.hxx index 72881fe4a1c9..fe4b216bc7a7 100644 --- a/include/oox/drawingml/graphicshapecontext.hxx +++ b/include/oox/drawingml/graphicshapecontext.hxx @@ -44,9 +44,11 @@ public: GraphicalObjectFrameContext( ::oox::core::ContextHandler2Helper& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart ); virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; + virtual void onEndElement() SAL_OVERRIDE; private: bool mbEmbedShapesInChart; + ::oox::core::ContextHandler2Helper* mpParent; }; diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx index 847d9b6479ee..5cae54d241a9 100644 --- a/include/oox/ppt/pptshapegroupcontext.hxx +++ b/include/oox/ppt/pptshapegroupcontext.hxx @@ -32,7 +32,6 @@ class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext ShapeLocation meShapeLocation; oox::drawingml::ShapePtr pGraphicShape; - void importExtDrawings(); void applyFontRefColor(oox::drawingml::ShapePtr pShape, const oox::drawingml::Color& rFontRefColor); public: @@ -46,7 +45,7 @@ public: virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; - virtual void onEndElement() SAL_OVERRIDE; + void importExtDrawings(); protected: diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index ebd2028f6ad6..db04d5ce9310 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -36,6 +36,7 @@ #include "oox/drawingml/transform2dcontext.hxx" #include "oox/helper/binaryinputstream.hxx" #include "oox/helper/binaryoutputstream.hxx" +#include "oox/ppt/pptshapegroupcontext.hxx" #include <comphelper/processfactory.hxx> using namespace ::com::sun::star; @@ -103,7 +104,8 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, GraphicalObjectFrameContext::GraphicalObjectFrameContext( ContextHandler2Helper& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart ) : ShapeContext( rParent, pMasterShapePtr, pShapePtr ), - mbEmbedShapesInChart( bEmbedShapesInChart ) + mbEmbedShapesInChart( bEmbedShapesInChart ), + mpParent(&rParent) { } @@ -146,7 +148,15 @@ ContextHandlerRef GraphicalObjectFrameContext::onCreateContext( sal_Int32 aEleme return ShapeContext::onCreateContext( aElementToken, rAttribs ); } - +void GraphicalObjectFrameContext::onEndElement() +{ + if( getCurrentElement() == PPT_TOKEN( graphicFrame ) && mpParent ) + { + oox::ppt::PPTShapeGroupContext* pParent = dynamic_cast<oox::ppt::PPTShapeGroupContext*>(mpParent); + if( pParent ) + pParent->importExtDrawings(); + } +} OleObjectGraphicDataContext::OleObjectGraphicDataContext( ContextHandler2Helper& rParent, ShapePtr xShape ) : ShapeContext( rParent, ShapePtr(), xShape ), diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 0fd517f0c14c..9bf3d2bd5383 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -109,8 +109,6 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken return new PPTGraphicShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GraphicObjectShape" ) ) ); case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame { - if( pGraphicShape ) - importExtDrawings(); pGraphicShape = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) ); return new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, pGraphicShape, true ); } @@ -150,11 +148,6 @@ void PPTShapeGroupContext::applyFontRefColor(oox::drawingml::ShapePtr pShape, co } } -void PPTShapeGroupContext::onEndElement() -{ - importExtDrawings(); -} - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/data/pptx/bnc880763.pptx b/sd/qa/unit/data/pptx/bnc880763.pptx Binary files differnew file mode 100644 index 000000000000..f45eb13ec308 --- /dev/null +++ b/sd/qa/unit/data/pptx/bnc880763.pptx diff --git a/sd/qa/unit/data/xml/n819614_0.xml b/sd/qa/unit/data/xml/n819614_0.xml index fb879cd1e579..22543cf588a5 100644 --- a/sd/qa/unit/data/xml/n819614_0.xml +++ b/sd/qa/unit/data/xml/n819614_0.xml @@ -14,14 +14,6 @@ <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> - <XShape positionX="0" positionY="0" sizeX="100" sizeY="100" type="com.sun.star.drawing.GroupShape" name="Content Placeholder 4"> - <XShapes/> - <Transformation> - <Line1 column1="101.000000" column2="0.000000" column3="0.000000"/> - <Line2 column1="0.000000" column2="101.000000" column3="0.000000"/> - <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> - </Transformation> - </XShape> <XShape positionX="182" positionY="2544" sizeX="25125" sizeY="16293" type="com.sun.star.drawing.GroupShape"> <XShapes> <XShape positionX="10751" positionY="3496" sizeX="1563" sizeY="253" type="com.sun.star.drawing.CustomShape" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName=""> @@ -6888,4 +6880,12 @@ <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> + <XShape positionX="0" positionY="0" sizeX="100" sizeY="100" type="com.sun.star.drawing.GroupShape" name="Content Placeholder 4"> + <XShapes/> + <Transformation> + <Line1 column1="101.000000" column2="0.000000" column3="0.000000"/> + <Line2 column1="0.000000" column2="101.000000" column3="0.000000"/> + <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> + </Transformation> + </XShape> </XShapes> diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 0b032c1295be..1c36673ae932 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -77,6 +77,7 @@ public: void testBnc870237(); void testBnc870233_1(); void testBnc870233_2(); + void testBnc880763(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -104,6 +105,7 @@ public: CPPUNIT_TEST(testBnc870237); CPPUNIT_TEST(testBnc870233_1); CPPUNIT_TEST(testBnc870233_2); + CPPUNIT_TEST(testBnc880763); CPPUNIT_TEST_SUITE_END(); }; @@ -293,7 +295,7 @@ void SdFiltersTest::testN862510_2() const SdrPage *pPage = pDoc->GetPage(1); CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); { - SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 1 ) ); + SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 0 ) ); CPPUNIT_ASSERT( pGrpObj ); SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 0 ) ); CPPUNIT_ASSERT( pObj ); @@ -312,7 +314,7 @@ void SdFiltersTest::testN862510_3() const SdrPage *pPage = pDoc->GetPage( 1 ); CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); { - SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 1 ) ); + SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 0 ) ); CPPUNIT_ASSERT( pGrpObj ); SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 0 ) ); CPPUNIT_ASSERT( pObj ); @@ -755,7 +757,7 @@ void SdFiltersTest::testBnc870237() CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); // Simulate a:ext inside dsp:txXfrm with changing the lower distance - const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 1 ) ); + const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 0 ) ); CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrTextUpperDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST))).GetValue()); CPPUNIT_ASSERT_EQUAL( sal_Int32(9919), (static_cast< const SdrTextLowerDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST))).GetValue()); @@ -900,6 +902,30 @@ void SdFiltersTest::testBnc870233_2() xDocShRef->DoClose(); } +void SdFiltersTest::testBnc880763() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx")); + xDocShRef = saveAndReload( xDocShRef, PPTX ); + + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + const SdrPage *pPage = pDoc->GetPage (1); + CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); + + // Check z-order of the two shapes, use background color to identify them + // First object in the background has blue background color + const SdrObject *pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 0 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor()); + + // Second object at the front has green background color + pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 1 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x00ff00),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor()); + + + xDocShRef->DoClose(); +} CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); |