[Libreoffice-commits] .: 7 commits - sc/qa sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 25 15:48:06 PST 2013


 sc/qa/unit/subsequent_filters-test.cxx         |    2 -
 sc/source/filter/xml/XMLStylesExportHelper.cxx |   26 +++++++------------------
 sc/source/filter/xml/XMLStylesExportHelper.hxx |   10 +++------
 sc/source/filter/xml/xmlcelli.cxx              |   10 +++++----
 sc/source/filter/xml/xmlcelli.hxx              |    9 --------
 sc/source/ui/condformat/condformatdlgentry.cxx |   10 ++++++---
 sc/source/ui/inc/condformatdlgentry.hxx        |    4 +--
 7 files changed, 28 insertions(+), 43 deletions(-)

New commits:
commit 2b17d6c14d226b1973c87ff161586c39899e403f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 26 00:40:28 2013 +0100

    remove some data members from the class
    
    Change-Id: I69df18c7b613673834613d49ab0d58bbee9cc0df

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index ba67212..b0cd059 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -78,6 +78,8 @@
 #include <com/sun/star/util/Date.hpp>
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/document/XActionLockable.hpp>
 
 #include <com/sun/star/sheet/ValidationType.hpp>
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
@@ -310,10 +312,10 @@ void ScXMLTableRowCellContext::SetCursorOnTextImport(const rtl::OUString& rOUTem
         uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange());
         if (xCellRange.is())
         {
-            xBaseCell.set( xCellRange->getCellByPosition(nCol, nRow) );
+            com::sun::star::uno::Reference<com::sun::star::table::XCell> xBaseCell( xCellRange->getCellByPosition(nCol, nRow) );
             if (xBaseCell.is())
             {
-                xLockable.set(xBaseCell, uno::UNO_QUERY);
+                com::sun::star::uno::Reference<com::sun::star::document::XActionLockable> xLockable(xBaseCell, uno::UNO_QUERY);
                 if (xLockable.is())
                     xLockable->addActionLock();
                 uno::Reference<text::XText> xText(xBaseCell, uno::UNO_QUERY);
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 2bf8b8c..44d2733 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -24,13 +24,6 @@
 #include "XMLCellRangeSourceContext.hxx"
 #include <xmloff/xmlictxt.hxx>
 #include <xmloff/xmlimp.hxx>
-#include <com/sun/star/table/XCell.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/document/XActionLockable.hpp>
 
 #include "formula/grammar.hxx"
 #include <boost/optional.hpp>
@@ -42,8 +35,6 @@ struct ScXMLAnnotationData;
 class ScXMLTableRowCellContext : public SvXMLImportContext
 {
     typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > FormulaWithNamespace;
-    com::sun::star::uno::Reference<com::sun::star::table::XCell> xBaseCell;
-    com::sun::star::uno::Reference<com::sun::star::document::XActionLockable> xLockable;
     ::boost::optional< rtl::OUString > pOUTextValue;
     ::boost::optional< rtl::OUString > pOUTextContent;
     ::boost::optional< FormulaWithNamespace > pOUFormula;
commit ee715db9dbeb3a02c254e375eab57d6a5fc51a13
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 26 00:20:22 2013 +0100

    this test case must be changed a bit
    
    The old way was just plain wrong. Just test if the string is empty.
    
    Change-Id: I4eba5e6941da5904c8ff99ab48ae5bef0d02e14e

diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 6182bf3..ca1d4e4 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -517,7 +517,7 @@ void ScFiltersTest::testCachedMatrixFormulaResultsODS()
     //Import works around this by setting these cells as text cells so that
     //the blank text is used for display instead of the number 0.
     //If this is working properly, the following cell should NOT have value data.
-    // CPPUNIT_ASSERT(!pDoc->GetCell(ScAddress(3,0,2))->HasValueData());
+    CPPUNIT_ASSERT_EQUAL(pDoc->GetString(3,0,2), OUString());
 
     // fdo#59293 with cached value import error formulas require special
     // treatment
commit 0367a2679b480cbe03c41b02990f11f9aaf816e9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 25 23:09:44 2013 +0100

    fix typo
    
    Change-Id: I9ec827e0c4000844c495f788e6fc166d41bdb944

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index ed24961..66c7f26 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1398,7 +1398,7 @@ void ScIconSetFrmtEntry::SetActive()
 {
     maLbColorFormat.Show();
     maLbIconSetType.Show();
-    for(ScIconSetFrmtDateEntriesType::iterator itr = maEntries.begin(),
+    for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(),
             itrEnd = maEntries.end(); itr != itrEnd; ++itr)
     {
         itr->Show();
@@ -1411,7 +1411,7 @@ void ScIconSetFrmtEntry::SetInactive()
 {
     maLbColorFormat.Hide();
     maLbIconSetType.Hide();
-    for(ScIconSetFrmtDateEntriesType::iterator itr = maEntries.begin(),
+    for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(),
             itrEnd = maEntries.end(); itr != itrEnd; ++itr)
     {
         itr->Hide();
@@ -1426,7 +1426,7 @@ ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const
 
     ScIconSetFormatData* pData = new ScIconSetFormatData;
     pData->eIconSetType = static_cast<ScIconSetType>(maLbIconSetType.GetSelectEntryPos());
-    for(ScIconSetFrmtDateEntriesType::const_iterator itr = maEntries.begin(),
+    for(ScIconSetFrmtDataEntriesType::const_iterator itr = maEntries.begin(),
             itrEnd = maEntries.end(); itr != itrEnd; ++itr)
     {
         pData->maEntries.push_back(itr->CreateEntry(mpDoc, maPos));
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx
index a80c7d7..bd8b0e6 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -250,8 +250,8 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry
     // icon set ui elements
     ListBox maLbIconSetType;
 
-    typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDateEntriesType;
-    ScIconSetFrmtDateEntriesType maEntries;
+    typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDataEntriesType;
+    ScIconSetFrmtDataEntriesType maEntries;
 
     virtual rtl::OUString GetExpressionString();
 
commit 7ea45e67c29b22b2c94375be3935f1343306a25c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 25 23:08:47 2013 +0100

    show style when dialog is created with existing cond format, fdo#59778
    
    Change-Id: Ic1218179cd9c87ec15826adc861d505339a05f2d

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index adb0f27e..ed24961 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -516,6 +516,8 @@ ScFormulaFrmtEntry::ScFormulaFrmtEntry( Window* pParent, ScDocument* pDoc, const
     {
         maLbStyle.SelectEntryPos(1);
     }
+
+    StyleSelectHdl(NULL);
 }
 
 void ScFormulaFrmtEntry::Init()
@@ -1173,6 +1175,8 @@ ScDateFrmtEntry::ScDateFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCon
         rtl::OUString aStyleName = pFormat->GetStyleName();
         maLbStyle.SelectEntry(aStyleName);
     }
+
+    StyleSelectHdl(NULL);
 }
 
 void ScDateFrmtEntry::Init()
commit ab121cf8540dc26b4877022b11e2ea50a4fd9b5e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 25 21:19:20 2013 +0100

    don't use a pointer here
    
    Change-Id: If7e7785e032d7d95764e8325870655e276cfda8f

diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 6e80aa8..5e5c216 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -477,12 +477,12 @@ void ScMyDefaultStyles::FillDefaultStyles(const sal_Int32 nTable,
         ScMyDefaultStyleList* pDefaults;
         if (bRow)
         {
-            pDefaults = pRowDefaults;
+            pDefaults = &maRowDefaults;
             nLast = nLastRow;
         }
         else
         {
-            pDefaults = pColDefaults;
+            pDefaults = &maColDefaults;
             nLast = nLastCol;
         }
         bool bPrevAutoStyle(false);
@@ -561,22 +561,14 @@ void ScMyDefaultStyles::FillDefaultStyles(const sal_Int32 nTable,
     const sal_Int32 nLastRow, const sal_Int32 nLastCol,
     const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc)
 {
-    delete pRowDefaults;
-    pRowDefaults = new ScMyDefaultStyleList(nLastRow + 1);
+    maRowDefaults.clear();
+    maRowDefaults.resize(nLastRow + 1);
     FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, true);
-    delete pColDefaults;
-    pColDefaults = new ScMyDefaultStyleList(nLastCol + 1);
+    maColDefaults.clear();
+    maColDefaults.resize(nLastCol + 1);
     FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, false);
 }
 
-ScMyDefaultStyles::~ScMyDefaultStyles()
-{
-    if (pRowDefaults)
-        delete pRowDefaults;
-    if (pColDefaults)
-        delete pColDefaults;
-}
-
 ScMyRowFormatRange::ScMyRowFormatRange()
     : nStartColumn(0),
     nRepeatColumns(0),
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx b/sc/source/filter/xml/XMLStylesExportHelper.hxx
index d9a2fd5..2159c84 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx
@@ -115,8 +115,8 @@ class ScFormatRangeStyles;
 
 class ScMyDefaultStyles
 {
-    ScMyDefaultStyleList* pRowDefaults;
-    ScMyDefaultStyleList* pColDefaults;
+    ScMyDefaultStyleList maRowDefaults;
+    ScMyDefaultStyleList maColDefaults;
 
     sal_Int32 GetStyleNameIndex(const ScFormatRangeStyles* pCellStyles,
         const sal_Int32 nTable, const sal_Int32 nPos,
@@ -126,15 +126,13 @@ class ScMyDefaultStyles
         const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc,
         const bool bRow);
 public:
-    ScMyDefaultStyles() : pRowDefaults(NULL), pColDefaults(NULL) {}
-    ~ScMyDefaultStyles();
 
     void FillDefaultStyles(const sal_Int32 nTable,
         const sal_Int32 nLastRow, const sal_Int32 nLastCol,
         const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc);
 
-    const ScMyDefaultStyleList* GetRowDefaults() const { return pRowDefaults; }
-    const ScMyDefaultStyleList* GetColDefaults() const { return pColDefaults; }
+    const ScMyDefaultStyleList* GetRowDefaults() const { return &maRowDefaults; }
+    const ScMyDefaultStyleList* GetColDefaults() const { return &maColDefaults; }
 };
 
 struct ScMyRowFormatRange
commit afc4864e2677b66182785f873d838081b2e331a4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 25 21:02:26 2013 +0100

    stylistic clean-up
    
    Change-Id: I7663001236707eb4324b6d39d27b309e02f5af6e

diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 830140a..6e80aa8 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -561,14 +561,12 @@ void ScMyDefaultStyles::FillDefaultStyles(const sal_Int32 nTable,
     const sal_Int32 nLastRow, const sal_Int32 nLastCol,
     const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc)
 {
-    if (pRowDefaults)
-        delete pRowDefaults;
+    delete pRowDefaults;
     pRowDefaults = new ScMyDefaultStyleList(nLastRow + 1);
-     FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, true);
-    if (pColDefaults)
-        delete pColDefaults;
+    FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, true);
+    delete pColDefaults;
     pColDefaults = new ScMyDefaultStyleList(nLastCol + 1);
-     FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, false);
+    FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, false);
 }
 
 ScMyDefaultStyles::~ScMyDefaultStyles()
commit 0f6570453722e9fc3a9bb28b32b64cee7d4bbdbb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 25 20:14:08 2013 +0100

    startsWith is much better than indexOf for this
    
    Change-Id: I8d4fd1054352cdc67aae9b0ea92ddafc0291d211

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 0eeeecb..ba67212 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1165,9 +1165,9 @@ void ScXMLTableRowCellContext::HasSpecialCaseFormulaText()
 {
     if(  pOUTextContent )
     {
-        if ( pOUTextContent->isEmpty()  || (pOUTextContent->indexOf("Err:")  > -1) )
+        if ( pOUTextContent->isEmpty() || pOUTextContent->startsWith("Err:") )
             mbPossibleErrorCell = true;
-        else if (pOUTextContent->indexOf("#") > -1)
+        else if (pOUTextContent->startsWith("#"))
             mbCheckWithCompilerForError = true;
     }
 }


More information about the Libreoffice-commits mailing list