[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - include/oox oox/source sd/qa
Zolnai Tamás
tamas.zolnai at collabora.com
Fri Jun 6 03:28:43 PDT 2014
include/oox/drawingml/textliststyle.hxx | 3 +
oox/source/drawingml/textliststyle.cxx | 28 +++++++++++
sd/qa/unit/data/pptx/bnc870233_1.pptx |binary
sd/qa/unit/import-tests.cxx | 76 ++++++++++++++++++++++++++++++++
4 files changed, 107 insertions(+)
New commits:
commit 0d2ff84ef183262ad826a7d4a161aa317ccfa847
Author: Zolnai Tamás <tamas.zolnai at 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)
Conflicts:
sd/qa/unit/import-tests.cxx
Change-Id: Iee7a6c0c1f74322fd7b80e41a262849f948e463a
Reviewed-on: https://gerrit.libreoffice.org/9661
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
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();
More information about the Libreoffice-commits
mailing list