[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/inc sc/source

Akash Shetye shetyeakash at gmail.com
Sat Jul 6 23:10:25 PDT 2013


 sc/inc/datauno.hxx                      |    2 --
 sc/inc/dbdata.hxx                       |    1 +
 sc/source/core/tool/dbdata.cxx          |    5 +++++
 sc/source/filter/oox/tablebuffer.cxx    |    5 -----
 sc/source/filter/oox/workbookhelper.cxx |    8 ++++----
 sc/source/ui/unoobj/datauno.cxx         |   12 ------------
 6 files changed, 10 insertions(+), 23 deletions(-)

New commits:
commit 3ad12487ae6b2552cca9bd510a8457e68f79ae90
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Sun Jul 7 11:39:06 2013 +0530

    Done with adding the formatting information to ScDBData objects
    
    Change-Id: I6cf025ce11cbb3be6a45f7a637bc919c0485c9dc

diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index 0613c79..2acde18 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -23,7 +23,6 @@
 #include "global.hxx"
 #include "queryparam.hxx"
 #include "subtotalparam.hxx"
-#include "dbdataformatting.hxx"
 
 #include <com/sun/star/sheet/TableFilterField.hpp>
 #include <com/sun/star/sheet/GeneralFunction.hpp>
@@ -626,7 +625,6 @@ public:
     virtual void SAL_CALL   addNewByName( const OUString& aName,
                                 const ::com::sun::star::table::CellRangeAddress& aRange )
                                     throw(::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL   addDatabaseRangeFormatting( const OUString& aName, const ScDBDataFormatting& rTableFormatData ) throw (::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL   removeByName( const OUString& aName )
                                 throw(::com::sun::star::uno::RuntimeException);
 
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index a16e11f..4c410bb 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -237,6 +237,7 @@ public:
     const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
     ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
     ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab );
+    ScDBData* GetDBByName( const OUString& rName );
 
     void    DeleteOnTab( SCTAB nTab );
     void    UpdateReference(UpdateRefMode eUpdateRefMode,
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 33aece7..0190237 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -923,6 +923,11 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO
     return NULL;
 }
 
+ScDBData* ScDBCollection::GetDBByName( const OUString& rName )
+{
+   return maNamedDBs.findByUpperName( rName );
+}
+
 void ScDBCollection::DeleteOnTab( SCTAB nTab )
 {
     FindByTable func(nTab);
diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx
index b1b930d..0fa9e03 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -116,11 +116,6 @@ void Table::finalizeImport()
         aTableFormatting.SetBandedRows( maModel.mbShowRowStripes );
         aTableFormatting.SetBandedColumns( maModel.mbShowColumnStripes );
         addDatabaseFormatting( maDBRangeName, aTableFormatting );
-        //Add this table formatting information to the ScDBData instance.
-        //xDatabaseRange->SetTableFormatting( aTableFormatting );
-        //Still figuring how to have an ScDBData object out of this
-        //xDatabaseRange of type XDatabaseRange... all that needs to be
-        //done is call the SetTableFormatting on that ScDBData object
     }
     catch( Exception& )
     {
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index ade4821..2091329 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -465,10 +465,10 @@ Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString
 
 void WorkbookGlobals::addDatabaseFormatting( const OUString& rName, const ScDBDataFormatting& rDBDataFormatting )
 {
-    PropertySet aDocProps( mxDoc );
-    Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
-    //xDatabaseRanges->addDatabaseRangeFormatting( rName, rDBDataFormatting );
-    //Need some way to add the formatting information. Stuck here major.
+    //Is such smartness allowed? Or should catch objects and then call for each method call?
+    ScDBData* pDBRange = getScDocument().GetDBCollection()->GetDBByName( rName );
+    if( pDBRange != NULL )
+        pDBRange->SetTableFormatting( rDBDataFormatting );
 }
 
 Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 8412b75..079e97b 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -2314,18 +2314,6 @@ void SAL_CALL ScDatabaseRangesObj::addNewByName( const OUString& aName,
         throw uno::RuntimeException();      // no other exceptions specified
 }
 
-void SAL_CALL ScDatabaseRangesObj::addDatabaseRangeFormatting( const OUString& rName, const ScDBDataFormatting& rTableFormatData ) throw (uno::RuntimeException)
-{
-    bool bDone = false;
-    if( pDocShell )
-    {
-        ScDBDocFunc aFunc( *pDocShell );
-        bDone = (aFunc.AddDBFormatting( rName, rTableFormatData ));
-    }
-    if( !bDone )
-        throw uno::RuntimeException();
-}
-
 void SAL_CALL ScDatabaseRangesObj::removeByName( const OUString& aName )
                                         throw(uno::RuntimeException)
 {


More information about the Libreoffice-commits mailing list