summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-06-06 11:40:38 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2014-06-12 10:19:21 +0200
commit47873e46dfbc077a4566795626ce9b4fa0182654 (patch)
tree5ee679015f73f204fe2af654e23d128c670917fd
parent47817b8223e971f9dd446d304a209b19173c96b0 (diff)
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.timar@collabora.com> Conflicts: sd/qa/unit/import-tests.cxx Change-Id: Iee7a6c0c1f74322fd7b80e41a262849f948e463a Reviewed-on: https://gerrit.libreoffice.org/9661 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit 0d2ff84ef183262ad826a7d4a161aa317ccfa847) Signed-off-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit 544198cb82e036f5b2eadfb36023c652cbd4fa1a)
-rw-r--r--include/oox/drawingml/textliststyle.hxx3
-rw-r--r--oox/source/drawingml/textliststyle.cxx28
-rw-r--r--sd/qa/unit/data/pptx/bnc870233_1.pptxbin0 -> 34111 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx76
4 files changed, 107 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
new file mode 100644
index 000000000000..0659e30b3840
--- /dev/null
+++ b/sd/qa/unit/data/pptx/bnc870233_1.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8e81c7d2089c..cf72ab7fb238 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();