[PATCH feature/gsoc-calc-enhanced-db-range] Adds get ans set methods in ScDBData for setting table forma...

Akash Shetye (via Code Review) gerrit at gerrit.libreoffice.org
Thu Jun 6 10:57:05 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4179

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/79/4179/1

Adds get ans set methods in ScDBData for setting table formatting.

Some changes made in ScDBDataFormatting like adding a copy constructor, changes to the constructor etc. as well.

Change-Id: Ia9799a0cf4b449bfa04092772bea7f28cce1d7cb
---
M sc/Library_sc.mk
M sc/inc/dbdata.hxx
M sc/inc/dbdataformatting.hxx
M sc/source/core/tool/dbdata.cxx
M sc/source/core/tool/dbdataformatting.cxx
5 files changed, 38 insertions(+), 7 deletions(-)



diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 373ba8a..7a9e142 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -190,6 +190,7 @@
 	sc/source/core/tool/compiler \
 	sc/source/core/tool/consoli  \
 	sc/source/core/tool/dbdata \
+    sc/source/core/tool/dbdataformatting \
 	sc/source/core/tool/ddelink \
 	sc/source/core/tool/defaultsoptions \
 	sc/source/core/tool/detdata  \
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index fcd5d49..a16e11f 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -24,6 +24,7 @@
 #include "refreshtimer.hxx"
 #include "address.hxx"
 #include "global.hxx"
+#include "dbdataformatting.hxx"
 
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/ptr_container/ptr_set.hpp>
@@ -42,6 +43,7 @@
     boost::scoped_ptr<ScQueryParam> mpQueryParam;
     boost::scoped_ptr<ScSubTotalParam> mpSubTotal;
     boost::scoped_ptr<ScImportParam> mpImportParam;
+    boost::scoped_ptr<ScDBDataFormatting> mpTableFormatData;
 
     // DBParam
     const OUString aName;
@@ -123,6 +125,11 @@
     void        GetImportParam(ScImportParam& rImportParam) const;
     void        SetImportParam(const ScImportParam& rImportParam);
 
+    //The getter and setter methods for mpTableFormatData will be called
+    //From the alternating coloring dialog hence SC_DLLPUBLIC.
+    SC_DLLPUBLIC void        SetTableFormatting( const ScDBDataFormatting& rTableFormatData );
+    SC_DLLPUBLIC void        GetTableFormatting( ScDBDataFormatting& rTableFormatData ) const;
+
     bool        IsDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const;
     bool        IsDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
 
diff --git a/sc/inc/dbdataformatting.hxx b/sc/inc/dbdataformatting.hxx
index d1897ad..aa3bd65 100644
--- a/sc/inc/dbdataformatting.hxx
+++ b/sc/inc/dbdataformatting.hxx
@@ -23,7 +23,6 @@
 
 class ScDBDataFormatting
 {
-    private:
         OUString maFirstRowStripeStyle;
         OUString maSecondRowStripeStyle;
         OUString maFirstColStripeStyle;
@@ -31,7 +30,8 @@
         bool bBandedRows;
         bool bBandedColumns;
     public:
-        ScDBDataFormatting(const OUString& rFirstRowStripeStyle, const OUString& rSecondRowStripeStyle, const OUString& rFirstColStripeStyle, const OUString& rSecondColStripeStyle);
+        ScDBDataFormatting(const OUString& rFirstRowStripeStyle, const OUString& rSecondRowStripeStyle, const OUString& rFirstColStripeStyle, const OUString& rSecondColStripeStyle, bool bBRows, bool bBCols);
+        ScDBDataFormatting( const ScDBDataFormatting& rTableFormatData );
         void SetBandedRows( bool bBRows );
         bool GetBandedRows();
         void SetBandedColumns( bool bBCols );
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 163e6fe..33aece7 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -407,6 +407,17 @@
     mpImportParam.reset(new ScImportParam(rImportParam));
 }
 
+//Methods to get and set ScDBDataFormatting instance
+void ScDBData::SetTableFormatting( const ScDBDataFormatting& rTableFormatData )
+{
+    mpTableFormatData.reset( new ScDBDataFormatting( rTableFormatData ) );
+}
+
+void ScDBData::GetTableFormatting( ScDBDataFormatting& rTableFormatData ) const
+{
+    rTableFormatData = *mpTableFormatData;
+}
+
 bool ScDBData::IsDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const
 {
     if (nTab == nTable)
diff --git a/sc/source/core/tool/dbdataformatting.cxx b/sc/source/core/tool/dbdataformatting.cxx
index 1a84eb0..c398883 100644
--- a/sc/source/core/tool/dbdataformatting.cxx
+++ b/sc/source/core/tool/dbdataformatting.cxx
@@ -20,11 +20,23 @@
 #include "dbdataformatting.hxx"
 #include "rtl/ustring.hxx"
 
-ScDBDataFormatting::ScDBDataFormatting(const OUString& rFirstRowStripeStyle, const OUString& rSecondRowStripeStyle, const OUString& rFirstColStripeStyle, const OUString& rSecondColStripeStyle) :
-maFirstRowStripeStyle    ( rFirstRowStripeStyle),
-maSecondRowStripeStyle   ( rSecondRowStripeStyle ),
-maFirstColStripeStyle    ( rFirstColStripeStyle ),
-maSecondColStripeStyle   ( rSecondColStripeStyle )
+ScDBDataFormatting::ScDBDataFormatting(const OUString& rFirstRowStripeStyle, const OUString& rSecondRowStripeStyle, const OUString& rFirstColStripeStyle, const OUString& rSecondColStripeStyle, bool bBRows, bool bBCols) :
+    maFirstRowStripeStyle   ( rFirstRowStripeStyle),
+    maSecondRowStripeStyle  ( rSecondRowStripeStyle ),
+    maFirstColStripeStyle   ( rFirstColStripeStyle ),
+    maSecondColStripeStyle  ( rSecondColStripeStyle ),
+    bBandedRows             ( bBRows ),
+    bBandedColumns          ( bBCols )
+{
+}
+
+ScDBDataFormatting::ScDBDataFormatting( const ScDBDataFormatting& rTableFormatData ):
+    maFirstRowStripeStyle   ( rTableFormatData.maFirstRowStripeStyle ),
+    maSecondRowStripeStyle  ( rTableFormatData.maSecondRowStripeStyle ),
+    maFirstColStripeStyle   ( rTableFormatData.maFirstColStripeStyle ),
+    maSecondColStripeStyle  ( rTableFormatData.maSecondColStripeStyle ),
+    bBandedRows             ( rTableFormatData.bBandedRows ),
+    bBandedColumns          ( rTableFormatData.bBandedColumns )
 {
 }
 

-- 
To view, visit https://gerrit.libreoffice.org/4179
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9799a0cf4b449bfa04092772bea7f28cce1d7cb
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: feature/gsoc-calc-enhanced-db-range
Gerrit-Owner: Akash Shetye <shetyeakash at gmail.com>



More information about the LibreOffice mailing list