Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,
This patch removes the duplicate Get/Set methods in appoptio.hxx which
the vba api uses. There was a long discussion back in the day about
this:

http://lists.freedesktop.org/archives/libreoffice/2011-June/013114.html

I CC:ing Noel Power if he as some opinion regarding this.

Now to the problem with this patch:

This patch makes the build fail in when linking vbaobj.uno.so:

/home/thuswa/work/libo2/workdir/unxlngi6.pro/CxxObject/sc/source/ui/vba/vbaapplication.o:
In function `ScVbaApplication::getSheetsInNewWorkbook()':
/home/thuswa/work/libo2/sc/source/ui/vba/vbaapplication.cxx:942:
undefined reference to `ScModule::GetDefaultsOptions()'
/home/thuswa/work/libo2/workdir/unxlngi6.pro/CxxObject/sc/source/ui/vba/vbaapplication.o:
In function `ScVbaApplication::setSheetsInNewWorkbook(long)':
/home/thuswa/work/libo2/sc/source/ui/vba/vbaapplication.cxx:955:
undefined reference to `ScModule::GetDefaultsOptions()'
collect2: ld returned 1 exit status
make[1]: *** [/home/thuswa/work/libo2/workdir/unxlngi6.pro/LinkTarget/Library/vbaobj.uno.so]
Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [sc] Error 2

I cant find a logical reason why this fails. The "scmod.hxx" which
defines the symbol is included as before, also considering the minimal
changes that I have made to the file:

diff --git a/sc/source/ui/vba/vbaapplication.cxx
b/sc/source/ui/vba/vbaapplication.cxx
index d0201a4..478e8f4 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -79,7 +79,7 @@
 #include "global.hxx"
 #include "scmod.hxx"
 #include "docoptio.hxx"
-#include "appoptio.hxx"
+#include "defaultsoptions.hxx"

 #include <osl/file.hxx>
 #include <rtl/instance.hxx>
@@ -939,8 +939,8 @@ ScVbaApplication::setEnableCancelKey(sal_Int32
/*lEnableCancelKey*/) throw (uno:

 sal_Int32 SAL_CALL ScVbaApplication::getSheetsInNewWorkbook() throw
(uno::RuntimeException)
 {
-    const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-    return rAppOpt.GetTabCountInNewSpreadsheet();
+    const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
+    return rOpt.GetInitTabCount();
 }

 void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32
SheetsInNewWorkbook ) throw (script::BasicErrorException,
uno::RuntimeException)
@@ -952,8 +952,8 @@ void SAL_CALL
ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 SheetsInNewWor
     }
     else
     {
-        ScAppOptions& rAppOpt = const_cast< ScAppOptions&
(SC_MOD()->GetAppOptions());
-        rAppOpt.SetTabCountInNewSpreadsheet( SheetsInNewWorkbook );
+        ScDefaultsOptions& rOpt = const_cast< ScDefaultsOptions&
(SC_MOD()->GetDefaultsOptions());
+        rOpt.SetInitTabCount( SheetsInNewWorkbook );
     }
 }


Is the vba part of the code treated in some special way? Wild guess:
all symbols are not automatically exported to here (don't know if that
is even possible)? Or what might be the problem?

Thanks for your help.
/Albert
From 8bac82d6ae0aea9d20c0ab90a0f608c5dd0f9bb1 Mon Sep 17 00:00:00 2001
From: Albert Thuswaldner <albert.thuswaldner@gmail.com>
Date: Tue, 17 Apr 2012 20:25:53 +0200
Subject: [PATCH] Removed duplicate set/get methods for initial tab count

---
 sc/inc/appoptio.hxx                 |    5 -----
 sc/source/core/tool/appoptio.cxx    |    4 ----
 sc/source/ui/vba/vbaapplication.cxx |   10 +++++-----
 sc/source/ui/view/tabvwsh4.cxx      |   11 +----------
 4 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx
index b7f5fe8..d4cc424 100644
--- a/sc/inc/appoptio.hxx
+++ b/sc/inc/appoptio.hxx
@@ -46,10 +46,6 @@ public:
 
     void        SetDefaults();
 
-    // Set or get the initial tab count for new spreadsheet, it is used by VBA API currently.
-    void    SetTabCountInNewSpreadsheet( SCTAB nCount )  { nTabCountInNewSpreadsheet = nCount; }
-    SCTAB   GetTabCountInNewSpreadsheet() const              { return nTabCountInNewSpreadsheet;   
}
-
     void        SetAppMetric( FieldUnit eUnit ) { eMetric = eUnit;      }
     FieldUnit   GetAppMetric() const            { return eMetric;       }
     void        SetZoom( sal_uInt16 nNew )          { nZoom = nNew;         }
@@ -94,7 +90,6 @@ public:
     const ScAppOptions& operator=   ( const ScAppOptions& rOpt );
 
 private:
-    SCTAB   nTabCountInNewSpreadsheet;
     FieldUnit   eMetric;
     sal_uInt16      nLRUFuncCount;
     sal_uInt16*     pLRUList;
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 9b352b8..b864804 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -78,9 +78,6 @@ ScAppOptions::~ScAppOptions()
 
 void ScAppOptions::SetDefaults()
 {
-    // Set default tab count for new spreadsheet.
-    nTabCountInNewSpreadsheet = 0;
-
     if ( ScOptionsUtil::IsMetricSystem() )
         eMetric     = FUNIT_CM;             // default for countries with metric system
     else
@@ -118,7 +115,6 @@ void ScAppOptions::SetDefaults()
 
 const ScAppOptions& ScAppOptions::operator=( const ScAppOptions& rCpy )
 {
-    nTabCountInNewSpreadsheet = rCpy.nTabCountInNewSpreadsheet;
     eMetric         = rCpy.eMetric;
     eZoomType       = rCpy.eZoomType;
     bSynchronizeZoom = rCpy.bSynchronizeZoom;
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index d0201a4..478e8f4 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -79,7 +79,7 @@
 #include "global.hxx"
 #include "scmod.hxx"
 #include "docoptio.hxx"
-#include "appoptio.hxx"
+#include "defaultsoptions.hxx"
 
 #include <osl/file.hxx>
 #include <rtl/instance.hxx>
@@ -939,8 +939,8 @@ ScVbaApplication::setEnableCancelKey(sal_Int32 /*lEnableCancelKey*/) throw (uno:
 
 sal_Int32 SAL_CALL ScVbaApplication::getSheetsInNewWorkbook() throw (uno::RuntimeException)
 {
-    const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-    return rAppOpt.GetTabCountInNewSpreadsheet();
+    const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
+    return rOpt.GetInitTabCount();
 }
 
 void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw 
(script::BasicErrorException, uno::RuntimeException)
@@ -952,8 +952,8 @@ void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 SheetsInNewWor
     }
     else
     {
-        ScAppOptions& rAppOpt = const_cast< ScAppOptions& >(SC_MOD()->GetAppOptions());
-        rAppOpt.SetTabCountInNewSpreadsheet( SheetsInNewWorkbook );
+        ScDefaultsOptions& rOpt = const_cast< ScDefaultsOptions& >(SC_MOD()->GetDefaultsOptions());
+        rOpt.SetInitTabCount( SheetsInNewWorkbook );
     }
 }
 
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 4cf2624..238d124 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1605,19 +1605,10 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode )
             // append additional sheets (not for OLE object)
             if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
             {
-                // Get the customized initial tab count...
-
-                // ... from option dialog.
+                // Get the customized initial tab count
                 const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
                 SCTAB nInitTabCount = rOpt.GetInitTabCount();
 
-                // ... by VBA API.
-                const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-                SCTAB nNewTabCount = rAppOpt.GetTabCountInNewSpreadsheet();
-                if ( nNewTabCount >= 1 && nNewTabCount <= MAXTAB )
-                {
-                    nInitTabCount = nNewTabCount;
-                }
                 for (SCTAB i=1; i<nInitTabCount; i++)
                     pDoc->MakeTable(i,false);
             }
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.