[Libreoffice-commits] core.git: 2 commits - editeng/source sd/qa sd/source

Michael Stahl mstahl at redhat.com
Fri Aug 29 10:24:28 PDT 2014


 editeng/source/editeng/eerdll.cxx               |    2 -
 sd/qa/unit/data/odp/masterpage_style_parent.odp |binary
 sd/qa/unit/import-tests.cxx                     |   43 ++++++++++++++++++++++++
 sd/source/core/stlsheet.cxx                     |   13 ++++++-
 4 files changed, 55 insertions(+), 3 deletions(-)

New commits:
commit 5b63c12ace2aec9a659e4b9125f6aa9ff204ed09
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 29 19:09:29 2014 +0200

    n#708518: sd: check that master page matches when setting parent style
    
    In ODF import it happened that the parent style of "outline2" etc.
    was always set to the "outline1" style of the first master page in
    the document, but it should be the "outline1" style of the same master
    page as the "outline2".
    
    (regression from e955433c3574cb602dedba96bc645898f97858bf)
    
    Change-Id: Ie563d5ee5c2040aeb6ca5c8bb25b195e15ea964e

diff --git a/sd/qa/unit/data/odp/masterpage_style_parent.odp b/sd/qa/unit/data/odp/masterpage_style_parent.odp
new file mode 100644
index 0000000..e9f6378
Binary files /dev/null and b/sd/qa/unit/data/odp/masterpage_style_parent.odp differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3131937..33c5239 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -50,6 +50,8 @@
 #include <com/sun/star/chart2/data/XDataSequence.hpp>
 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
 
+#include <stlpool.hxx>
+
 using namespace ::com::sun::star;
 
 /// Impress import filters tests.
@@ -60,6 +62,7 @@ public:
     void testSmoketest();
     void testN759180();
     void testN778859();
+    void testMasterPageStyleParent();
     void testFdo64512();
     void testFdo71075();
     void testN828390_2();
@@ -80,6 +83,7 @@ public:
     CPPUNIT_TEST(testSmoketest);
     CPPUNIT_TEST(testN759180);
     CPPUNIT_TEST(testN778859);
+    CPPUNIT_TEST(testMasterPageStyleParent);
     CPPUNIT_TEST(testFdo64512);
     CPPUNIT_TEST(testFdo71075);
     CPPUNIT_TEST(testN828390_2);
@@ -344,6 +348,45 @@ void SdFiltersTest::testN828390_3()
     xDocShRef->DoClose();
 }
 
+void SdFiltersTest::testMasterPageStyleParent()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/masterpage_style_parent.odp"), ODP );
+
+    SdDrawDocument *pDoc = xDocShRef->GetDoc();
+    CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+    const SdrPage *pPage = pDoc->GetPage(1);
+    CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+    SdStyleSheetPool *const pPool(pDoc->GetSdStyleSheetPool());
+
+    int parents(0);
+    SfxStyleSheetIterator iter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
+    for (SfxStyleSheetBase * pStyle = iter.First(); pStyle; pStyle = iter.Next())
+    {
+        OUString const name(pStyle->GetName());
+        OUString const parent(pStyle->GetParent());
+        if (!parent.isEmpty())
+        {
+            ++parents;
+            // check that parent exists
+            SfxStyleSheetBase *const pParentStyle(
+                    pPool->Find(parent, SD_STYLE_FAMILY_MASTERPAGE));
+            CPPUNIT_ASSERT(pParentStyle);
+            CPPUNIT_ASSERT_EQUAL(pParentStyle->GetName(), parent);
+            // check that parent has the same master page as pStyle
+            CPPUNIT_ASSERT(parent.indexOf(SD_LT_SEPARATOR) != -1);
+            CPPUNIT_ASSERT(name.indexOf(SD_LT_SEPARATOR) != -1);
+            CPPUNIT_ASSERT_EQUAL(
+                    parent.copy(0, parent.indexOf(SD_LT_SEPARATOR)),
+                    name.copy(0, name.indexOf(SD_LT_SEPARATOR)));
+        }
+    }
+    // check that there are actually parents...
+    CPPUNIT_ASSERT_EQUAL(16, parents);
+
+    xDocShRef->DoClose();
+}
+
 void SdFiltersTest::testN778859()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"), PPTX);
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 4246e31..68075de 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -921,16 +921,25 @@ void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName  ) throw
 
     if( !rParentName.isEmpty() )
     {
+        OUString const name(GetName());
+        sal_Int32 const sep(name.indexOf(SD_LT_SEPARATOR));
+        OUString const master((sep == -1) ? OUString() : name.copy(0, sep));
         boost::shared_ptr<SfxStyleSheetIterator> aSSSI = boost::make_shared<SfxStyleSheetIterator>(mxPool.get(), nFamily);
         for (SfxStyleSheetBase *pStyle = aSSSI->First(); pStyle; pStyle = aSSSI->Next())
         {
             // we hope that we have only sd style sheets
             SdStyleSheet* pSdStyleSheet = static_cast<SdStyleSheet*>(pStyle);
-            if (pSdStyleSheet->msApiName == rParentName)
+            OUString const curName(pStyle->GetName());
+            sal_Int32 const curSep(curName.indexOf(SD_LT_SEPARATOR));
+            OUString const curMaster((curSep == -1)
+                    ? OUString() : curName.copy(0, sep));
+            // check that the master matches, as msApiName exists once per
+            // master page
+            if (pSdStyleSheet->msApiName == rParentName && master == curMaster)
             {
                 if( pStyle != this )
                 {
-                    SetParent( pStyle->GetName() );
+                    SetParent(curName);
                 }
                 return;
             }
commit f582d9789c15934a65abff36e3c4af107dacc347
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 29 14:03:52 2014 +0200

    editeng: deploy an assert for the default items
    
    Change-Id: Ifc85d682377bb1a3a34e6d49767cbfbe6521c388

diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index b317064..781e6c8 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -163,7 +163,7 @@ SfxPoolItem** GlobalEditData::GetDefItems()
         ppDefItems[53] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV );
         ppDefItems[54] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD );
 
-        DBG_ASSERT( EDITITEMCOUNT == 55, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
+        assert(EDITITEMCOUNT == 55 && "ITEMCOUNT changed, adjust DefItems!");
 
         // Init DefFonts:
         GetDefaultFonts( *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START],


More information about the Libreoffice-commits mailing list