include/oox/drawingml/shape.hxx | 4 include/oox/drawingml/textliststyle.hxx | 3 include/oox/ppt/pptshapegroupcontext.hxx | 3 oox/source/drawingml/diagram/diagram.cxx | 39 ++-- oox/source/drawingml/diagram/diagramfragmenthandler.cxx | 49 ++--- oox/source/drawingml/textliststyle.cxx | 28 +++ oox/source/ppt/pptshapegroupcontext.cxx | 13 + sc/source/core/tool/address.cxx | 21 +- sd/qa/unit/data/pptx/bnc870233_1.pptx |binary sd/qa/unit/data/pptx/bnc870233_2.pptx |binary sd/qa/unit/import-tests.cxx | 144 ++++++++++++++++ 11 files changed, 257 insertions(+), 47 deletions(-)
New commits: commit 0a2ce4a24fadd2fa6358a83e7f6107c2f95a7260 Author: Eike Rathke <er...@redhat.com> Date: Tue May 27 23:19:36 2014 +0200 resolved fdo#70455 B1:SOMENAME is not a valid singleton reference (cherry picked from commit ac8532ce26e79453b3a969b956ebb7823c455131) Conflicts: sc/source/core/tool/address.cxx Change-Id: Iac80d74a9ec6382a232fdc2f4b798e57dc643ad3 (cherry picked from commit e5931aa5aa2180e0587b93cb94ba1405cfe96f83) diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 3ed6213..23bca38 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -876,6 +876,14 @@ lcl_a1_get_row( const sal_Unicode* p, ScAddress* pAddr, sal_uInt16* nFlags ) return pEnd; } +/// B:B or 2:2, but not B:2 or 2:B or B2:B or B:B2 or ... +static bool isValidSingleton( sal_uInt16 nFlags, sal_uInt16 nFlags2 ) +{ + bool bCols = (nFlags & SCA_VALID_COL) && ((nFlags & SCA_VALID_COL2) || (nFlags2 & SCA_VALID_COL)); + bool bRows = (nFlags & SCA_VALID_ROW) && ((nFlags & SCA_VALID_ROW2) || (nFlags2 & SCA_VALID_ROW)); + return (bCols && !bRows) || (!bCols && bRows); +} + static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, const sal_Unicode* p, @@ -982,7 +990,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r, } p = tmp2; - p = lcl_eatWhiteSpace( p+1 ); + p = lcl_eatWhiteSpace( p+1 ); // after ':' tmp1 = lcl_a1_get_col( p, &r.aEnd, &nFlags2 ); if( !tmp1 && aEndTabName.isEmpty() ) // Probably the aEndTabName was specified after the first range { @@ -995,16 +1003,17 @@ lcl_ScRange_Parse_XL_A1( ScRange& r, r.aEnd.SetTab( nTab ); nFlags |= SCA_VALID_TAB2 | SCA_TAB2_3D | SCA_TAB2_ABSOLUTE; } - p = lcl_eatWhiteSpace( p+1 ); + if (*p == '!' || *p == ':') + p = lcl_eatWhiteSpace( p+1 ); tmp1 = lcl_a1_get_col( p, &r.aEnd, &nFlags2 ); } } - if( !tmp1 ) // strange, but valid singleton - return nFlags; + if( !tmp1 ) // strange, but maybe valid singleton + return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~SCA_VALID); tmp2 = lcl_a1_get_row( tmp1, &r.aEnd, &nFlags2 ); - if( !tmp2 ) // strange, but valid singleton - return nFlags; + if( !tmp2 ) // strange, but maybe valid singleton + return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~SCA_VALID); if ( *tmp2 != 0 ) { commit 16101e748e353520a5a08c3736bad6a1599a1a19 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Fri Jun 6 10:16:39 2014 +0200 2nd part of bnc#870233: import font color from color fragment for SmartArts SmartArt import ignores some fragments during import if drawing fragment exists, which seems to be not complete. In this case font style is blank (white) in data (and drawing) fragment and the real value is defined in the ignored color fragment. So first make color fragment parsing work, then apply font color of "node0" style on nodes of the SmartArt. Actually, it's a workaround, because "node0" style label is hardcoded, for a proper solution layout fragment should be parsed too to get the right style label, but it interferes with the drawing fragment by now. (cherry picked from commit 639571d52b1b7e4cf912803642ca245c5dd86839) Signed-off-by: Andras Timar <andras.ti...@collabora.com> Conflicts: oox/source/drawingml/diagram/diagram.cxx oox/source/drawingml/diagram/diagramfragmenthandler.cxx Change-Id: I7db89176a07eee928563d42d3896fbd02190dfa8 Reviewed-on: https://gerrit.libreoffice.org/9662 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit bef657e6e2a545eea54d3288a2cd7df9c1a126fa) Signed-off-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit e5a0ca1e12674a6da47a93ea29ea2d764eade5e3) diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 9c8faa9c..dd0daa9 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -171,6 +171,9 @@ public: const ::std::vector<OUString>& getExtDrawings() { return maExtDrawings; } void addExtDrawingRelId( const OUString &rRelId ) { maExtDrawings.push_back( rRelId ); } + // Set font color only for extdrawings. + void setFontRefColorForNodes(const Color& rColor) { maFontRefColorForNodes = rColor; } + const Color& getFontRefColorForNodes() const { return maFontRefColorForNodes; } void setLockedCanvas(bool bLockedCanvas); bool getLockedCanvas(); const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & @@ -246,6 +249,7 @@ protected: com::sun::star::awt::Size maSize; com::sun::star::awt::Point maPosition; ::std::vector<OUString> maExtDrawings; + Color maFontRefColorForNodes; private: enum FrameType diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx index f4e1d7a..847d9b6 100644 --- a/include/oox/ppt/pptshapegroupcontext.hxx +++ b/include/oox/ppt/pptshapegroupcontext.hxx @@ -21,6 +21,7 @@ #define INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX #include <oox/drawingml/shapegroupcontext.hxx> +#include <oox/drawingml/color.hxx> #include <oox/ppt/slidepersist.hxx> namespace oox { namespace ppt { @@ -30,7 +31,9 @@ class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext SlidePersistPtr mpSlidePersistPtr; ShapeLocation meShapeLocation; oox::drawingml::ShapePtr pGraphicShape; + void importExtDrawings(); + void applyFontRefColor(oox::drawingml::ShapePtr pShape, const oox::drawingml::Color& rFontRefColor); public: PPTShapeGroupContext( diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 93f5850..5cc8fe0 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -320,7 +320,6 @@ void Diagram::build( ) #endif } - void Diagram::addTo( const ShapePtr & pParentShape ) { // collect data, init maps @@ -417,7 +416,7 @@ void loadDiagram( ShapePtr& pShape, } // extLst is present, lets bet on that and ignore the rest of the data from here - if( !pData->getExtDrawings().size() ) + if( pData->getExtDrawings().empty() ) { // layout if( !rLayoutPath.isEmpty() ) @@ -444,25 +443,33 @@ void loadDiagram( ShapePtr& pShape, pDiagram, xRefQStyle); } - - // colors - if( !rColorStylePath.isEmpty() ) - { - rtl::Reference< core::FragmentHandler > xRefColorStyle( - new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() )); - - importFragment(rFilter, - loadFragment(rFilter,xRefColorStyle), - "OOXColor", - pDiagram, - xRefColorStyle); - } } else { // We still want to add the XDocuments to the DiagramDomMap DiagramDomMap& rMainDomMap = pDiagram->getDomMap(); rMainDomMap[OUString::createFromAscii("OOXLayout")] = loadFragment(rFilter,rLayoutPath); rMainDomMap[OUString::createFromAscii("OOXStyle")] = loadFragment(rFilter,rQStylePath); - rMainDomMap[OUString::createFromAscii("OOXColor")] = loadFragment(rFilter,rColorStylePath); + } + + // colors + if( !rColorStylePath.isEmpty() ) + { + rtl::Reference< core::FragmentHandler > xRefColorStyle( + new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() )); + + importFragment(rFilter, + loadFragment(rFilter,xRefColorStyle), + "OOXColor", + pDiagram, + xRefColorStyle); + } + + if( !pData->getExtDrawings().empty() ) + { + const DiagramColorMap::const_iterator aColor = pDiagram->getColors().find("node0"); + if( aColor != pDiagram->getColors().end() ) + { + pShape->setFontRefColorForNodes(aColor->second.maTextFillColor); + } } // diagram loaded. now lump together & attach to shape diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx index f003fb1..2bba55c 100644 --- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx +++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx @@ -166,7 +166,7 @@ DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFi void DiagramQStylesFragmentHandler::onStartElement( const AttributeList& rAttribs ) { - if( getCurrentElement() == DGM_TOKEN( styleDef ) ) + if( getCurrentElement() == DGM_TOKEN( styleLbl ) ) { maStyleName = rAttribs.getString( XML_name, OUString() ); maStyleEntry = mrStylesMap[maStyleName]; @@ -203,30 +203,29 @@ ColorFragmentHandler::ColorFragmentHandler( ::oox::core::XmlFilterBase& rFilter, case DGM_TOKEN(colorsDef): return nElement == DGM_TOKEN(styleLbl) ? this : NULL; case DGM_TOKEN(styleLbl): - return ((nElement == DGM_TOKEN(fillClrLst)) || - (nElement == DGM_TOKEN(linClrLst)) || - (nElement == DGM_TOKEN(effectClrLst)) || - (nElement == DGM_TOKEN(txLinClrLst)) || - (nElement == DGM_TOKEN(txFillClrLst)) || - (nElement == DGM_TOKEN(txEffectClrLst))) ? this : NULL; - - // the actual colors - defer to color fragment handlers. - - // TODO(F1): well, actually, there might be *several* color - // definitions in it, after all it's called list. but - // apparently colorChoiceContext doesn't handle that anyway... - case DGM_TOKEN(fillClrLst): - return new ColorContext( *this, maColorEntry.maFillColor ); - case DGM_TOKEN(linClrLst): - return new ColorContext( *this, maColorEntry.maLineColor ); - case DGM_TOKEN(effectClrLst): - return new ColorContext( *this, maColorEntry.maEffectColor ); - case DGM_TOKEN(txFillClrLst): - return new ColorContext( *this, maColorEntry.maTextFillColor ); - case DGM_TOKEN(txLinClrLst): - return new ColorContext( *this, maColorEntry.maTextLineColor ); - case DGM_TOKEN(txEffectClrLst): - return new ColorContext( *this, maColorEntry.maTextEffectColor ); + { + switch( nElement ) + { + // the actual colors - defer to color fragment handlers. + + // TODO(F1): well, actually, there might be *several* color + // definitions in it, after all its called list. but + // apparently ColorContext doesn't handle that anyway... + case DGM_TOKEN(fillClrLst): + return new ColorContext( *this, maColorEntry.maFillColor ); + case DGM_TOKEN(linClrLst): + return new ColorContext( *this, maColorEntry.maLineColor ); + case DGM_TOKEN(effectClrLst): + return new ColorContext( *this, maColorEntry.maEffectColor ); + case DGM_TOKEN(txFillClrLst): + return new ColorContext( *this, maColorEntry.maTextFillColor ); + case DGM_TOKEN(txLinClrLst): + return new ColorContext( *this, maColorEntry.maTextLineColor ); + case DGM_TOKEN(txEffectClrLst): + return new ColorContext( *this, maColorEntry.maTextEffectColor ); + } + break; + } } return 0; diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index e25bf65..0fd517f 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -132,11 +132,24 @@ void PPTShapeGroupContext::importExtDrawings( ) mpMasterShapePtr, mpGroupShapePtr, pGraphicShape ) ); + // Apply font color imported from color fragment + if( pGraphicShape->getFontRefColorForNodes().isUsed() ) + applyFontRefColor(mpGroupShapePtr, pGraphicShape->getFontRefColorForNodes()); } pGraphicShape = oox::drawingml::ShapePtr( (PPTShape *)NULL ); } } +void PPTShapeGroupContext::applyFontRefColor(oox::drawingml::ShapePtr pShape, const oox::drawingml::Color& rFontRefColor) +{ + pShape->getShapeStyleRefs()[XML_fontRef].maPhClr = rFontRefColor; + std::vector< oox::drawingml::ShapePtr >& vChildren = pShape->getChildren(); + for( std::vector< oox::drawingml::ShapePtr >::iterator aIter = vChildren.begin(); aIter != vChildren.end(); ++aIter ) + { + applyFontRefColor( *aIter ,rFontRefColor); + } +} + void PPTShapeGroupContext::onEndElement() { importExtDrawings(); diff --git a/sd/qa/unit/data/pptx/bnc870233_2.pptx b/sd/qa/unit/data/pptx/bnc870233_2.pptx new file mode 100644 index 0000000..7f4fc71 Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc870233_2.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index cf72ab7..deeb994 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -60,6 +60,7 @@ public: void testFdo71961(); void testBnc870237(); void testBnc870233_1(); + void testBnc870233_2(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -73,6 +74,7 @@ public: CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST(testBnc870237); CPPUNIT_TEST(testBnc870233_1); + CPPUNIT_TEST(testBnc870233_2); CPPUNIT_TEST_SUITE_END(); }; @@ -497,6 +499,72 @@ void SdFiltersTest::testBnc870233_1() xDocShRef->DoClose(); } +void SdFiltersTest::testBnc870233_2() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.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 in some SmartArts font color was wrong + + // First smart art has blue font color (direct formatting) + { + 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(0x0000ff), pCharColor->GetValue().GetColor()); + } + } + } + + // Second smart art has "dk2" font color (style) + { + 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(0x1F497D), pCharColor->GetValue().GetColor()); + } + } + } + + // Third smart art has white font color (style) + { + const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 2 ) ); + 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(0xffffff), pCharColor->GetValue().GetColor()); + } + } + } + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); commit 47873e46dfbc077a4566795626ce9b4fa0182654 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Fri Jun 6 11:40:38 2014 +0200 1st part of bnc#870233: wrong list style in shapes Text list styles were copied, without proper copy constructor and operator. It lad to mix up list styles and so text font. (cherry picked from commit 31650d5b4255c484faec11d570cb98a80f0120cc) Signed-off-by: Andras Timar <andras.ti...@collabora.com> Conflicts: sd/qa/unit/import-tests.cxx Change-Id: Iee7a6c0c1f74322fd7b80e41a262849f948e463a Reviewed-on: https://gerrit.libreoffice.org/9661 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 0d2ff84ef183262ad826a7d4a161aa317ccfa847) Signed-off-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 544198cb82e036f5b2eadfb36023c652cbd4fa1a) diff --git a/include/oox/drawingml/textliststyle.hxx b/include/oox/drawingml/textliststyle.hxx index 09d341e..d73734f 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 466edf2..3a92b12 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 new file mode 100644 index 0000000..0659e30 Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc870233_1.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 8e81c7d..cf72ab7 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -15,6 +15,10 @@ #include <editeng/ulspitem.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/escapementitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/postitem.hxx> + #include <svx/svdotext.hxx> #include <svx/svdoashp.hxx> @@ -55,6 +59,7 @@ public: void testN828390(); void testFdo71961(); void testBnc870237(); + void testBnc870233_1(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -67,6 +72,7 @@ public: CPPUNIT_TEST(testN828390); CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST(testBnc870237); + CPPUNIT_TEST(testBnc870233_1); CPPUNIT_TEST_SUITE_END(); }; @@ -422,6 +428,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( WEIGHT_BOLD, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( 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( WEIGHT_NORMAL, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( ITALIC_NORMAL, pPosture->GetPosture()); + } + } + } + + xDocShRef->DoClose(); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits