sc/inc/stlsheet.hxx              |    6 +---
 sc/qa/unit/ucalc.cxx             |   55 +++++++++++++++++++++++++++++++++++++++
 sc/qa/unit/ucalc.hxx             |    4 ++
 sc/source/core/data/documen2.cxx |    6 ----
 4 files changed, 61 insertions(+), 10 deletions(-)

New commits:
commit 8da96df8bfb225aa71a9c9fc6b11a63ec5a4dc28
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sun Sep 7 19:16:13 2014 +0200

    add test for cond format copy&paste whole sheet
    
    Conflicts:
        sc/qa/unit/ucalc.cxx
        sc/qa/unit/ucalc.hxx
    
    Change-Id: I6e15bec2e1a2593b965df4c105758dc4bf22061f

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 73745e0..8386612 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4968,6 +4968,39 @@ void Test::testCondCopyPasteSheetBetweenDoc()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testCondCopyPasteSheet()
+{
+    m_pDoc->InsertTab(0, "Test");
+
+    ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+    ScRange aCondFormatRange(0,0,0,3,3,0);
+    ScRangeList aRangeList(aCondFormatRange);
+    pFormat->AddRange(aRangeList);
+
+    ScCondFormatEntry* pEntry = new 
ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT));
+    pFormat->AddEntry(pEntry);
+    m_pDoc->AddCondFormat(pFormat, 0);
+
+    m_pDoc->CopyTab(0, SC_TAB_APPEND);
+
+    ScConditionalFormatList* pList = m_pDoc->GetCondFormList(1);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+
+    ScConditionalFormat& rFormat = *pList->begin();
+    const ScRangeList& rRange = rFormat.GetRange();
+    CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,1,3,3,1)), rRange);
+    sal_uInt32 nKey = rFormat.GetKey();
+    const SfxPoolItem* pItem = m_pDoc->GetAttr( 2, 2, 1, ATTR_CONDITIONAL );
+    const ScCondFormatItem* pCondFormatItem = static_cast<const 
ScCondFormatItem*>(pItem);
+
+    CPPUNIT_ASSERT(pCondFormatItem);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), 
pCondFormatItem->GetCondFormatData().size());
+    CPPUNIT_ASSERT( nKey == pCondFormatItem->GetCondFormatData().at(0) );
+
+    m_pDoc->DeleteTab(1);
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testMixData()
 {
     m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index f2a2ba8..f6ede82 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -302,6 +302,7 @@ public:
     void testCondFormatInsertRow();
     void testCondFormatInsertCol();
     void testCondCopyPasteSheetBetweenDoc();
+    void testCondCopyPasteSheet();
 
     CPPUNIT_TEST_SUITE(Test);
 #if CALC_TEST_PERF
@@ -414,6 +415,7 @@ public:
     CPPUNIT_TEST(testEditTextIterator);
     CPPUNIT_TEST(testCondFormatINSDEL);
     CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc);
+    CPPUNIT_TEST(testCondCopyPasteSheet);
     CPPUNIT_TEST_SUITE_END();
 
 private:
commit 824ee35a3d4ed022ee1d7a181241934ab7b32993
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sun Sep 7 13:47:43 2014 +0200

    rename the test
    
    Conflicts:
        sc/qa/unit/ucalc.hxx
    
    Change-Id: I5c72782d90dbdaf1320f1685b530aed49ad80f18

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 63787d8..73745e0 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4946,7 +4946,7 @@ void Test::testCondFormatInsertRow()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testCopySheetCondFormat()
+void Test::testCondCopyPasteSheetBetweenDoc()
 {
     m_pDoc->InsertTab(0, "Test");
 
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index f4a83e5..f2a2ba8 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -301,7 +301,7 @@ public:
     void testCondFormatINSDEL();
     void testCondFormatInsertRow();
     void testCondFormatInsertCol();
-    void testCopySheetCondFormat();
+    void testCondCopyPasteSheetBetweenDoc();
 
     CPPUNIT_TEST_SUITE(Test);
 #if CALC_TEST_PERF
@@ -413,7 +413,7 @@ public:
     CPPUNIT_TEST(testCellTextWidth);
     CPPUNIT_TEST(testEditTextIterator);
     CPPUNIT_TEST(testCondFormatINSDEL);
-    CPPUNIT_TEST(testCopySheetCondFormat);
+    CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc);
     CPPUNIT_TEST_SUITE_END();
 
 private:
commit 5ec1c2ab3590ffae6f7c63d538c3da33e822be5b
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sun Sep 7 13:43:33 2014 +0200

    fix copy&paste of conditional format between sheets
    
    Change-Id: I8856bff376f0f6e366062eddbc68a9eee098be5b

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index f77452c..94b61df 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -914,10 +914,6 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, 
const ScMarkData* pOnlyM
         maTabs[nOldPos]->StartAllListeners();
         maTabs[nNewPos]->StartAllListeners();
 
-        ScConditionalFormatList* pNewList = new 
ScConditionalFormatList(*maTabs[nOldPos]->GetCondFormList());
-        pNewList->UpdateReference(aRefCxt);
-        maTabs[nNewPos]->SetCondFormList( pNewList );
-
         sc::SetFormulaDirtyContext aFormulaDirtyCxt;
         SetAllFormulasDirty(aFormulaDirtyCxt);
 
commit 8d3c6cd85813530dd6b8dffbd2a6dd07c3355f6a
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sun Sep 7 13:19:14 2014 +0200

    add test for duplicated conditional formats
    
    Conflicts:
        sc/qa/unit/ucalc.cxx
        sc/qa/unit/ucalc.hxx
    
    Change-Id: If6d24cba87eebf6ddbb0d5392d653890ff99ef04

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index fbc2919..63787d8 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4946,6 +4946,28 @@ void Test::testCondFormatInsertRow()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testCopySheetCondFormat()
+{
+    m_pDoc->InsertTab(0, "Test");
+
+    ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+    ScRange aCondFormatRange(0,0,0,3,3,0);
+    ScRangeList aRangeList(aCondFormatRange);
+    pFormat->AddRange(aRangeList);
+
+    ScCondFormatEntry* pEntry = new 
ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT));
+    pFormat->AddEntry(pEntry);
+    m_pDoc->AddCondFormat(pFormat, 0);
+
+    ScDocument aDoc;
+    aDoc.TransferTab(m_pDoc, 0, 0, true);
+
+    ScConditionalFormatList* pList = aDoc.GetCondFormList(0);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testMixData()
 {
     m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index f73189d..f4a83e5 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -301,6 +301,7 @@ public:
     void testCondFormatINSDEL();
     void testCondFormatInsertRow();
     void testCondFormatInsertCol();
+    void testCopySheetCondFormat();
 
     CPPUNIT_TEST_SUITE(Test);
 #if CALC_TEST_PERF
@@ -412,6 +413,7 @@ public:
     CPPUNIT_TEST(testCellTextWidth);
     CPPUNIT_TEST(testEditTextIterator);
     CPPUNIT_TEST(testCondFormatINSDEL);
+    CPPUNIT_TEST(testCopySheetCondFormat);
     CPPUNIT_TEST_SUITE_END();
 
 private:
commit 0e26ab0a55f9a23eb04e0a2e9083cf18d59981ad
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sun Sep 7 12:22:54 2014 +0200

    prevent duplicated conditional formatting during copying of sheeets
    
    Change-Id: I866c0c4c05830af0070767aec36375a846a2bf84

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 42aacf9..f77452c 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1007,8 +1007,6 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, 
SCTAB nSrcPos,
                 pSrcDoc->maTabs[nSrcPos]->CopyToTable(aCxt, 0, 0, MAXCOL, 
MAXROW,
                         ( bResultsOnly ? IDF_ALL & ~IDF_FORMULA : IDF_ALL),
                         false, maTabs[nDestPos] );
-                maTabs[nDestPos]->CopyConditionalFormat(0, 0, MAXCOL, MAXROW,
-                            0, 0, pSrcDoc->maTabs[nSrcPos]);
             }
         }
         maTabs[nDestPos]->SetTabNo(nDestPos);
commit 1ab5ee5a3c9af182609f7b3bf826dbc6e24a988a
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sat Sep 6 15:50:20 2014 +0200

    fix indentation
    
    Change-Id: I0ca8c236fe1f9ede0a3fea6de0a76aaf712e3ff1

diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx
index 20fba26..4fe0ddd 100644
--- a/sc/inc/stlsheet.hxx
+++ b/sc/inc/stlsheet.hxx
@@ -59,10 +59,8 @@ public:
 
     virtual bool SetName( const OUString& );
 
-            void                SetUsage( ScStyleSheet::Usage eUse ) const
-                                    { eUsage = eUse; }
-            ScStyleSheet::Usage GetUsage() const
-                                    { return eUsage; }
+    void                SetUsage( ScStyleSheet::Usage eUse ) const { eUsage = 
eUse; }
+    ScStyleSheet::Usage GetUsage() const { return eUsage; }
 
 protected:
     virtual             ~ScStyleSheet();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to