diff options
-rw-r--r-- | include/oox/drawingml/textliststyle.hxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/textliststyle.cxx | 28 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/bnc870233_1.pptx | bin | 0 -> 34111 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 73 |
4 files changed, 104 insertions, 0 deletions
diff --git a/include/oox/drawingml/textliststyle.hxx b/include/oox/drawingml/textliststyle.hxx index 09d341e497a3..d73734fde27c 100644 --- a/include/oox/drawingml/textliststyle.hxx +++ b/include/oox/drawingml/textliststyle.hxx @@ -34,6 +34,9 @@ public: TextListStyle(); ~TextListStyle(); + TextListStyle(const TextListStyle& rStyle); + TextListStyle& operator=(const TextListStyle& rStyle); + void apply( const TextListStyle& rTextListStyle ); const TextParagraphPropertiesVector& getListStyle() const { return maListStyle; }; diff --git a/oox/source/drawingml/textliststyle.cxx b/oox/source/drawingml/textliststyle.cxx index 466edf257c65..3a92b120ab64 100644 --- a/oox/source/drawingml/textliststyle.cxx +++ b/oox/source/drawingml/textliststyle.cxx @@ -34,6 +34,34 @@ TextListStyle::~TextListStyle() { } +TextListStyle::TextListStyle(const TextListStyle& rStyle) +{ + assert(rStyle.maListStyle.size() == 9); + assert(rStyle.maAggregationListStyle.size() == 9); + for ( size_t i = 0; i < 9; i++ ) + { + maListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties(*rStyle.maListStyle[i]) ) ); + maAggregationListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties(*rStyle.maAggregationListStyle[i]) ) ); + } +} + +TextListStyle& TextListStyle::operator=(const TextListStyle& rStyle) +{ + if(this != &rStyle) + { + assert(rStyle.maListStyle.size() == 9); + assert(rStyle.maAggregationListStyle.size() == 9); + assert(maListStyle.size() == 9); + assert(maAggregationListStyle.size() == 9); + for ( size_t i = 0; i < 9; i++ ) + { + *maListStyle[i] = *rStyle.maListStyle[i]; + *maAggregationListStyle[i] = *rStyle.maAggregationListStyle[i]; + } + } + return *this; +} + void applyStyleList( const TextParagraphPropertiesVector& rSourceListStyle, TextParagraphPropertiesVector& rDestListStyle ) { TextParagraphPropertiesVector::const_iterator aSourceListStyleIter( rSourceListStyle.begin() ); diff --git a/sd/qa/unit/data/pptx/bnc870233_1.pptx b/sd/qa/unit/data/pptx/bnc870233_1.pptx Binary files differnew file mode 100644 index 000000000000..0659e30b3840 --- /dev/null +++ b/sd/qa/unit/data/pptx/bnc870233_1.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index ae5cdafb2bcd..b9418b4d99ca 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -20,6 +20,7 @@ #include <editeng/wghtitem.hxx> #include <editeng/numitem.hxx> #include <editeng/lrspitem.hxx> +#include <editeng/postitem.hxx> #include <rsc/rscsfx.hxx> #include <svx/svdotext.hxx> @@ -74,6 +75,7 @@ public: void testFdo71961(); void testMediaEmbedding(); void testBnc870237(); + void testBnc870233_1(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -99,6 +101,7 @@ public: CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST(testMediaEmbedding); CPPUNIT_TEST(testBnc870237); + CPPUNIT_TEST(testBnc870233_1); CPPUNIT_TEST_SUITE_END(); }; @@ -760,6 +763,76 @@ void SdFiltersTest::testBnc870237() xDocShRef->DoClose(); } +void SdFiltersTest::testBnc870233_1() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.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 ); + + // The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones) + + // First shape has red, bold font + { + const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); + std::vector<EECharAttrib> rLst; + aEdit.GetCharAttribs(0, rLst); + for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) + { + const SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr); + if( pCharColor ) + { + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0xff0000), pCharColor->GetValue().GetColor()); + } + const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr); + if( pWeight ) + { + CPPUNIT_ASSERT_EQUAL( FontWeight::WEIGHT_BOLD, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( FontItalic::ITALIC_NONE, pPosture->GetPosture()); + } + } + } + + // Second shape has blue, italic font + { + const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); + std::vector<EECharAttrib> rLst; + aEdit.GetCharAttribs(0, rLst); + for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) + { + const SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr); + if( pCharColor ) + { + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff), pCharColor->GetValue().GetColor()); + } + const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr); + if( pWeight ) + { + CPPUNIT_ASSERT_EQUAL( FontWeight::WEIGHT_NORMAL, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( FontItalic::ITALIC_NORMAL, pPosture->GetPosture()); + } + } + } + + xDocShRef->DoClose(); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); |