[ooo-build-commit] .: 2 commits - sc/inc sc/sdi sc/source sc/uiconfig

Fridrich Strba fridrich at kemper.freedesktop.org
Wed Sep 15 12:33:36 PDT 2010


 sc/inc/ViewSettingsSequenceDefines.hxx        |    3 
 sc/inc/docoptio.hxx                           |   36 ++++
 sc/inc/sc.hrc                                 |    7 
 sc/inc/scextopt.hxx                           |    1 
 sc/sdi/docsh.sdi                              |    1 
 sc/sdi/scalc.sdi                              |   27 +++
 sc/source/core/data/documen3.cxx              |    7 
 sc/source/core/tool/docoptio.cxx              |  200 +++++++++++++++++++++++++-
 sc/source/filter/excel/xeview.cxx             |    2 
 sc/source/filter/excel/xiview.cxx             |    4 
 sc/source/ui/app/scmod.cxx                    |    7 
 sc/source/ui/attrdlg/scdlgfact.cxx            |    3 
 sc/source/ui/inc/optdlg.hrc                   |   14 +
 sc/source/ui/inc/viewdata.hxx                 |    5 
 sc/source/ui/optdlg/makefile.mk               |    2 
 sc/source/ui/src/optdlg.src                   |   99 ++++++++++++
 sc/source/ui/view/gridwin4.cxx                |    3 
 sc/source/ui/view/scextopt.cxx                |    3 
 sc/source/ui/view/tabvwshf.cxx                |   16 ++
 sc/source/ui/view/viewdata.cxx                |   17 ++
 sc/uiconfig/scalc/toolbar/formatobjectbar.xml |    2 
 21 files changed, 452 insertions(+), 7 deletions(-)

New commits:
commit cb37186e710013bbb10971a8084ca7565579d6f8
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 21:19:24 2010 +0200

    calc-formula-variable-separators-sc.diff: formula separators changeable
    
    n#447164, i#92056
    
    Make the formula separators changeable per locale setting, and add new
    configuration page for formula syntax and separators.

diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index c648978..8db36bd 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -34,6 +34,8 @@
 #include "scdllapi.h"
 #include "optutil.hxx"
 
+#include "formula/grammar.hxx"
+
 class SC_DLLPUBLIC ScDocOptions
 {
     double fIterEps;				// Epsilon-Wert dazu
@@ -51,6 +53,11 @@ class SC_DLLPUBLIC ScDocOptions
     BOOL   bDoAutoSpell;			// Auto-Spelling
     BOOL   bLookUpColRowNames;		// Spalten-/Zeilenbeschriftungen automagisch suchen
     BOOL   bFormulaRegexEnabled;    // regular expressions in formulas enabled
+    ::formula::FormulaGrammar::Grammar eFormulaGrammar;  // formula grammar used to switch different formula syntax
+
+    ::rtl::OUString aFormulaSepArg;
+    ::rtl::OUString aFormulaSepArrayRow;
+    ::rtl::OUString aFormulaSepArrayCol;
 
 public:
                 ScDocOptions();
@@ -97,6 +104,20 @@ public:
 
     void    SetFormulaRegexEnabled( BOOL bVal ) { bFormulaRegexEnabled = bVal; }
     BOOL    IsFormulaRegexEnabled() const       { return bFormulaRegexEnabled; }
+
+    void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
+    ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
+
+    void SetFormulaSepArg(const ::rtl::OUString& rSep) { aFormulaSepArg = rSep; }
+    ::rtl::OUString GetFormulaSepArg() const { return aFormulaSepArg; }
+
+    void SetFormulaSepArrayRow(const ::rtl::OUString& rSep) { aFormulaSepArrayRow = rSep; }
+    ::rtl::OUString GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
+
+    void SetFormulaSepArrayCol(const ::rtl::OUString& rSep) { aFormulaSepArrayCol = rSep; }
+    ::rtl::OUString GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
+
+    const LocaleDataWrapper& GetLocaleDataWrapper() const;
 };
 
 
@@ -117,6 +138,10 @@ inline void ScDocOptions::CopyTo(ScDocOptions& rOpt)
     rOpt.bDoAutoSpell			= bDoAutoSpell;
     rOpt.bLookUpColRowNames		= bLookUpColRowNames;
     rOpt.bFormulaRegexEnabled   = bFormulaRegexEnabled;
+    rOpt.eFormulaGrammar        = eFormulaGrammar;
+    rOpt.aFormulaSepArg         = aFormulaSepArg;
+    rOpt.aFormulaSepArrayRow    = aFormulaSepArrayRow;
+    rOpt.aFormulaSepArrayCol    = aFormulaSepArrayCol;
 }
 
 inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
@@ -136,6 +161,10 @@ inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
     bDoAutoSpell		= rCpy.bDoAutoSpell;
     bLookUpColRowNames	= rCpy.bLookUpColRowNames;
     bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled;
+    eFormulaGrammar     = rCpy.eFormulaGrammar;
+    aFormulaSepArg      = rCpy.aFormulaSepArg;
+    aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow;
+    aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol;
 
     return *this;
 }
@@ -158,6 +187,10 @@ inline int ScDocOptions::operator==( const ScDocOptions& rOpt ) const
             &&	rOpt.bDoAutoSpell			== bDoAutoSpell
             &&	rOpt.bLookUpColRowNames		== bLookUpColRowNames
             &&  rOpt.bFormulaRegexEnabled   == bFormulaRegexEnabled
+            &&  rOpt.eFormulaGrammar        == eFormulaGrammar
+            &&  rOpt.aFormulaSepArg         == aFormulaSepArg
+            &&  rOpt.aFormulaSepArrayRow    == aFormulaSepArrayRow
+            &&  rOpt.aFormulaSepArrayCol    == aFormulaSepArrayCol
             );
 }
 
@@ -197,12 +230,15 @@ private:
 class ScDocCfg : public ScDocOptions
 {
     ScLinkConfigItem	aCalcItem;
+    ScLinkConfigItem    aFormulaItem;
     ScLinkConfigItem	aLayoutItem;
 
     DECL_LINK( CalcCommitHdl, void* );
+    DECL_LINK( FormulaCommitHdl, void* );
     DECL_LINK( LayoutCommitHdl, void* );
 
     com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames();
+    com::sun::star::uno::Sequence<rtl::OUString> GetFormulaPropertyNames();
     com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
 
 public:
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 70c6119..c6622a3 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1660,6 +1660,10 @@
 // Toggle sheet grid
 #define FID_TAB_TOGGLE_GRID         (SC_OOO_BUILD_START + 2)
 
+// Formula options page
+#define RID_SCPAGE_FORMULA          (SC_OOO_BUILD_START + 3)
+#define HID_SCPAGE_FORMULA          (SC_OOO_BUILD_START + 4)
+
 #endif
 
 
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index c42e816..196e6bd 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -53,6 +53,7 @@
 #include "rangelst.hxx"
 #include "chartarr.hxx"
 #include "chartlock.hxx"
+#include "compiler.hxx"
 #include "refupdat.hxx"
 #include "docoptio.hxx"
 #include "viewopti.hxx"
@@ -1858,6 +1859,12 @@ void ScDocument::SetDocOptions( const ScDocOptions& rOpt )
     *pDocOptions = rOpt;
 
     xPoolHelper->SetFormTableOpt(rOpt);
+
+    SetGrammar( rOpt.GetFormulaSyntax() );
+
+    // Update the separators.
+    ScCompiler::UpdateSeparatorsNative(
+        rOpt.GetFormulaSepArg(), rOpt.GetFormulaSepArrayCol(), rOpt.GetFormulaSepArrayRow());
 }
 
 const ScViewOptions& ScDocument::GetViewOptions() const
diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index 0768b5f..fcb9a0d 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -35,6 +35,8 @@
 
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/i18n/LocaleDataItem.hpp>
 
 #include "cfgids.hxx"
 #include "docoptio.hxx"
@@ -42,10 +44,13 @@
 #include "scresid.hxx"
 #include "sc.hrc"
 #include "miscuno.hxx"
+#include "global.hxx"
 
 using namespace utl;
 using namespace rtl;
 using namespace com::sun::star::uno;
+using ::com::sun::star::lang::Locale;
+using ::com::sun::star::i18n::LocaleDataItem;
 
 //------------------------------------------------------------------------
 
@@ -97,7 +102,11 @@ ScDocOptions::ScDocOptions( const ScDocOptions& rCpy )
             bMatchWholeCell( rCpy.bMatchWholeCell ),
             bDoAutoSpell( rCpy.bDoAutoSpell ),
             bLookUpColRowNames( rCpy.bLookUpColRowNames ),
-            bFormulaRegexEnabled( rCpy.bFormulaRegexEnabled )
+            bFormulaRegexEnabled( rCpy.bFormulaRegexEnabled ),
+            eFormulaGrammar( rCpy.eFormulaGrammar ),
+            aFormulaSepArg( rCpy.aFormulaSepArg ),
+            aFormulaSepArrayRow( rCpy.aFormulaSepArrayRow ),
+            aFormulaSepArrayCol( rCpy.aFormulaSepArrayCol )
 {
 }
 
@@ -126,6 +135,67 @@ void ScDocOptions::ResetDocOptions()
     bDoAutoSpell		= FALSE;
     bLookUpColRowNames	= TRUE;
     bFormulaRegexEnabled= TRUE;
+    eFormulaGrammar     = ::formula::FormulaGrammar::GRAM_NATIVE;
+
+    do
+    {
+        const Locale& rLocale = *ScGlobal::GetLocale();
+        const OUString& rLang = rLocale.Language;
+        if (rLang.equalsAscii("ru"))
+            // Don't do automatic guess for these languages, and fall back to
+            // the old separator set.
+            break;
+
+        const LocaleDataWrapper& rLocaleData = GetLocaleDataWrapper();
+        const OUString& rDecSep  = rLocaleData.getNumDecimalSep();
+        const OUString& rListSep = rLocaleData.getListSep();
+
+        if (!rDecSep.getLength() || !rListSep.getLength())
+            // Something is wrong.  Stick with the default separators.
+            break;
+
+        sal_Unicode cDecSep  = rDecSep.getStr()[0];
+        sal_Unicode cListSep = rListSep.getStr()[0];
+
+        // Excel by default uses system's list separator as the parameter
+        // separator, which in English locales is a comma.  However, OOo's list
+        // separator value is set to ';' for all English locales.  Because of this
+        // discrepancy, we will hardcode the separator value here, for now.
+        if (cDecSep == sal_Unicode('.'))
+            cListSep = sal_Unicode(',');
+
+        // Special case for de_CH locale.
+        if (rLocale.Language.equalsAsciiL("de", 2) && rLocale.Country.equalsAsciiL("CH", 2))
+            cListSep = sal_Unicode(';');
+
+        // by default, the parameter separator equals the locale-specific
+        // list separator.
+        aFormulaSepArg = OUString(cListSep);
+
+        if (cDecSep == cListSep && cDecSep != sal_Unicode(';'))
+            // if the decimal and list separators are equal, set the
+            // parameter separator to be ';', unless they are both
+            // semicolon in which case don't change the decimal separator.
+            aFormulaSepArg = OUString::createFromAscii(";");
+
+        aFormulaSepArrayCol = OUString::createFromAscii(",");
+        if (cDecSep == sal_Unicode(','))
+            aFormulaSepArrayCol = OUString::createFromAscii(".");
+        aFormulaSepArrayRow = OUString::createFromAscii(";");
+
+        return;
+    }
+    while (false);
+
+    // Defaults to the old separator values.
+    aFormulaSepArg      = OUString::createFromAscii(";");
+    aFormulaSepArrayCol = OUString::createFromAscii(";");
+    aFormulaSepArrayRow = OUString::createFromAscii("|");
+}
+
+const LocaleDataWrapper& ScDocOptions::GetLocaleDataWrapper() const
+{
+    return *ScGlobal::pLocaleData;
 }
 
 //========================================================================
@@ -203,6 +273,13 @@ SfxPoolItem* __EXPORT ScTpCalcItem::Clone( SfxItemPool * ) const
 #define SCCALCOPT_REGEX             11
 #define SCCALCOPT_COUNT             12
 
+#define CFGPATH_FORMULA     "Office.Calc/Formula"
+#define SCFORMULAOPT_GRAMMAR           0
+#define SCFORMULAOPT_SEP_ARG           1
+#define SCFORMULAOPT_SEP_ARRAY_ROW     2
+#define SCFORMULAOPT_SEP_ARRAY_COL     3
+#define SCFORMULAOPT_COUNT             4
+
 #define CFGPATH_DOCLAYOUT	"Office.Calc/Layout/Other"
 
 #define SCDOCLAYOUTOPT_TABSTOP		0
@@ -224,7 +301,7 @@ Sequence<OUString> ScDocCfg::GetCalcPropertyNames()
         "Other/Precision",					// SCCALCOPT_PRECISION
         "Other/SearchCriteria",				// SCCALCOPT_SEARCHCRIT
         "Other/FindLabel",                  // SCCALCOPT_FINDLABEL
-        "Other/RegularExpressions"          // SCCALCOPT_REGEX
+        "Other/RegularExpressions",         // SCCALCOPT_REGEX
     };
     Sequence<OUString> aNames(SCCALCOPT_COUNT);
     OUString* pNames = aNames.getArray();
@@ -234,6 +311,23 @@ Sequence<OUString> ScDocCfg::GetCalcPropertyNames()
     return aNames;
 }
 
+Sequence<OUString> ScDocCfg::GetFormulaPropertyNames()
+{
+    static const char* aPropNames[] =
+    {
+        "Syntax/Grammar",             // SCFORMULAOPT_GRAMMAR
+        "Syntax/SeparatorArg",        // SCFORMULAOPT_SEP_ARG
+        "Syntax/SeparatorArrayRow",   // SCFORMULAOPT_SEP_ARRAY_ROW
+        "Syntax/SeparatorArrayCol",   // SCFORMULAOPT_SEP_ARRAY_COL
+    };
+    Sequence<OUString> aNames(SCFORMULAOPT_COUNT);
+    OUString* pNames = aNames.getArray();
+    for (int i = 0; i < SCFORMULAOPT_COUNT; ++i)
+        pNames[i] = OUString::createFromAscii(aPropNames[i]);
+
+    return aNames;
+}
+
 Sequence<OUString> ScDocCfg::GetLayoutPropertyNames()
 {
     static const char* aPropNames[] =
@@ -254,6 +348,7 @@ Sequence<OUString> ScDocCfg::GetLayoutPropertyNames()
 
 ScDocCfg::ScDocCfg() :
     aCalcItem( OUString::createFromAscii( CFGPATH_CALC ) ),
+    aFormulaItem(OUString::createFromAscii(CFGPATH_FORMULA)),
     aLayoutItem( OUString::createFromAscii( CFGPATH_DOCLAYOUT ) )
 {
     sal_Int32 nIntVal = 0;
@@ -325,6 +420,69 @@ ScDocCfg::ScDocCfg() :
 
     SetDate( nDateDay, nDateMonth, nDateYear );
 
+    aNames = GetFormulaPropertyNames();
+    aValues = aFormulaItem.GetProperties(aNames);
+    aFormulaItem.EnableNotification(aNames);
+    pValues = aValues.getConstArray();
+    if (aValues.getLength() == aNames.getLength())
+    {
+        for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
+        {
+            switch (nProp)
+            {
+                case SCFORMULAOPT_GRAMMAR:
+                {
+                    ::formula::FormulaGrammar::Grammar eGram = ::formula::FormulaGrammar::GRAM_DEFAULT;
+
+                    do
+                    {
+                        if (!(pValues[nProp] >>= nIntVal))
+                            // extractino failed.
+                            break;
+
+                        switch (nIntVal)
+                        {
+                            case 0: // Calc A1
+                                eGram = ::formula::FormulaGrammar::GRAM_NATIVE;
+                            break;
+                            case 1: // Excel A1
+                                eGram = ::formula::FormulaGrammar::GRAM_NATIVE_XL_A1;
+                            break;
+                            case 2: // Excel R1C1
+                                eGram = ::formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1;
+                            break;
+                        }
+                    }
+                    while (false);
+                    SetFormulaSyntax(eGram);
+                }
+                break;
+                case SCFORMULAOPT_SEP_ARG:
+                {
+                    OUString aSep;
+                    if ((pValues[nProp] >>= aSep) && aSep.getLength())
+                        SetFormulaSepArg(aSep);
+                }
+                break;
+                case SCFORMULAOPT_SEP_ARRAY_ROW:
+                {
+                    OUString aSep;
+                    if ((pValues[nProp] >>= aSep) && aSep.getLength())
+                        SetFormulaSepArrayRow(aSep);
+                }
+                break;
+                case SCFORMULAOPT_SEP_ARRAY_COL:
+                {
+                    OUString aSep;
+                    if ((pValues[nProp] >>= aSep) && aSep.getLength())
+                        SetFormulaSepArrayCol(aSep);
+                }
+                break;
+            }
+        }
+    }
+    aFormulaItem.SetCommitLink( LINK(this, ScDocCfg, FormulaCommitHdl) );
+
     aNames = GetLayoutPropertyNames();
     aValues = aLayoutItem.GetProperties(aNames);
     aLayoutItem.EnableNotification(aNames);
@@ -407,6 +565,43 @@ IMPL_LINK( ScDocCfg, CalcCommitHdl, void *, EMPTYARG )
     return 0;
 }
 
+IMPL_LINK( ScDocCfg, FormulaCommitHdl, void *, EMPTYARG )
+{
+    Sequence<OUString> aNames = GetFormulaPropertyNames();
+    Sequence<Any> aValues(aNames.getLength());
+    Any* pValues = aValues.getArray();
+
+    for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
+    {
+        switch (nProp)
+        {
+            case SCFORMULAOPT_GRAMMAR :
+            {
+                sal_Int32 nVal = 0;
+                switch (GetFormulaSyntax())
+                {
+                    case ::formula::FormulaGrammar::GRAM_NATIVE_XL_A1:    nVal = 1; break;
+                    case ::formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1:  nVal = 2; break;
+                }
+                pValues[nProp] <<= nVal;
+            }
+            break;
+            case SCFORMULAOPT_SEP_ARG:
+                pValues[nProp] <<= GetFormulaSepArg();
+            break;
+            case SCFORMULAOPT_SEP_ARRAY_ROW:
+                pValues[nProp] <<= GetFormulaSepArrayRow();
+            break;
+            case SCFORMULAOPT_SEP_ARRAY_COL:
+                pValues[nProp] <<= GetFormulaSepArrayCol();
+            break;
+        }
+    }
+    aFormulaItem.PutProperties(aNames, aValues);
+
+    return 0;
+}
+
 IMPL_LINK( ScDocCfg, LayoutCommitHdl, void *, EMPTYARG )
 {
     Sequence<OUString> aNames = GetLayoutPropertyNames();
@@ -436,6 +631,7 @@ void ScDocCfg::SetOptions( const ScDocOptions& rNew )
     *(ScDocOptions*)this = rNew;
 
     aCalcItem.SetModified();
+    aFormulaItem.SetModified();
     aLayoutItem.SetModified();
 }
 
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 92d2617..66d9d8c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2109,6 +2109,13 @@ SfxTabPage*	 ScModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItem
                                                         pRet = (*ScTpCalcOptionsCreate)(pParent, rSet);
                                 }
                                 break;
+        case SID_SC_TP_FORMULA:
+        {
+            ::CreateTabPage ScTpFormulaOptionsCreate = pFact->GetTabPageCreatorFunc (RID_SCPAGE_FORMULA);
+            if (ScTpFormulaOptionsCreate)
+                pRet = (*ScTpFormulaOptionsCreate)(pParent, rSet);
+        }
+        break;
         case SID_SC_TP_CHANGES:
                                 {			//CHINA001 pRet = ScRedlineOptionsTabPage::Create(pParent, rSet);
                                             ::CreateTabPage ScRedlineOptionsTabPageCreate =	pFact->GetTabPageCreatorFunc( RID_SCPAGE_OPREDLINE );
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 944bd8c..3d261aa 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -79,6 +79,7 @@
 #include "tpstat.hxx" //add for ScDocStatPage
 #include "tpusrlst.hxx" //add for ScTpUserLists
 #include "tpview.hxx" //add for ScTpContentOptions
+#include "tpformula.hxx"
 
 // ause
 #include "editutil.hxx"
@@ -1554,6 +1555,8 @@ CreateTabPage ScAbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId )
         case	RID_SCPAGE_CALC :
             return ScTpCalcOptions::Create;
             //break;
+        case RID_SCPAGE_FORMULA:
+            return ScTpFormulaOptions::Create;
         case	RID_SCPAGE_PRINT :
             return ScTpPrintOptions::Create;
             //break;
diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc
index e5a7e80..7860ad3 100644
--- a/sc/source/ui/inc/optdlg.hrc
+++ b/sc/source/ui/inc/optdlg.hrc
@@ -49,6 +49,7 @@
 #define TP_LAYOUT           12
 #define TP_INPUT            13
 #define TP_CHANGES			14
+#define TP_FORMULA          15
 
 // TP_CALC:
 #define BTN_ITERATE			1
@@ -190,3 +191,16 @@
 #define CB_TEXTFMT		78
 #define CB_REPLWARN     79
 
+
+// TP_FORMULA
+#define FL_FORMULA_OPTIONS        80
+#define FT_FORMULA_SYNTAX         81
+#define LB_FORMULA_SYNTAX         82
+#define FL_FORMULA_SEPS           83
+#define FT_FORMULA_SEP_ARG        84
+#define ED_FORMULA_SEP_ARG        85
+#define FT_FORMULA_SEP_ARRAY_R    86
+#define ED_FORMULA_SEP_ARRAY_R    87
+#define FT_FORMULA_SEP_ARRAY_C    88
+#define ED_FORMULA_SEP_ARRAY_C    89
+#define BTN_FORMULA_SEP_RESET     90
diff --git a/sc/source/ui/optdlg/makefile.mk b/sc/source/ui/optdlg/makefile.mk
index 52df707..f09eb92 100644
--- a/sc/source/ui/optdlg/makefile.mk
+++ b/sc/source/ui/optdlg/makefile.mk
@@ -43,6 +43,7 @@ CXXFILES = \
         tpusrlst.cxx    \
         tpview.cxx      \
         tpcalc.cxx      \
+        tpformula.cxx   \
         tpprint.cxx     \
         opredlin.cxx
 
@@ -50,6 +51,7 @@ SLOFILES =  \
         $(SLO)$/tpusrlst.obj \
         $(SLO)$/tpview.obj   \
         $(SLO)$/tpcalc.obj	\
+        $(SLO)$/tpformula.obj	\
         $(SLO)$/tpprint.obj	\
         $(SLO)$/opredlin.obj
 
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index 959a21c..4f80ab7 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -179,6 +179,105 @@ TabPage RID_SCPAGE_CALC
 /*                                                                        */
 /**************************************************************************/
 
+TabPage RID_SCPAGE_FORMULA
+{
+    HelpId = HID_SCPAGE_FORMULA ;
+    SVLook = TRUE ;
+    Hide = TRUE ;
+    Pos = MAP_APPFONT ( 0 , 0 ) ;
+    Size = MAP_APPFONT ( 260 , 185 ) ;
+
+    FixedLine FL_FORMULA_OPTIONS
+    {
+        Pos = MAP_APPFONT ( 6 , 3 ) ;
+        Size = MAP_APPFONT ( 248 , 8 ) ;
+        Text [ en-US ] = "Formula options";
+    };
+
+    FixedText FT_FORMULA_SYNTAX
+    {
+        Pos = MAP_APPFONT ( 21, 16 ) ;
+        Size = MAP_APPFONT ( 80, 8 ) ;
+        Text [ en-US ] = "Formula ~syntax" ;
+    };
+
+    ListBox LB_FORMULA_SYNTAX
+    {
+        Border = TRUE ;
+        Pos = MAP_APPFONT ( 85, 14 ) ;
+        Size = MAP_APPFONT ( 60, 46 ) ;
+        DropDown = TRUE ;
+        StringList [ en-US ] =
+        {
+            < "Calc A1" ; Default ; > ;
+            < "Excel A1" ; Default ; > ;
+            < "Excel R1C1" ; Default ; > ;
+        };
+    };
+
+    FixedLine FL_FORMULA_SEPS
+    {
+        Pos = MAP_APPFONT ( 6 , 32 ) ;
+        Size = MAP_APPFONT ( 248 , 8 ) ;
+        Text [ en-US ] = "Separators";
+    };
+
+    FixedText FT_FORMULA_SEP_ARG
+    {
+        Pos = MAP_APPFONT ( 21, 45 );
+        Size = MAP_APPFONT ( 40, 8 );
+        Text [ en-US ] = "~Function";
+    };
+
+    Edit ED_FORMULA_SEP_ARG
+    {
+        Border = TRUE;
+        Pos = MAP_APPFONT ( 65, 43 );
+        Size = MAP_APPFONT ( 10, 12 );
+    };
+
+    FixedText FT_FORMULA_SEP_ARRAY_C
+    {
+        Pos = MAP_APPFONT ( 21, 63 );
+        Size = MAP_APPFONT ( 40, 8 );
+        Text [ en-US ] = "Array co~lumn";
+    };
+
+    Edit ED_FORMULA_SEP_ARRAY_C
+    {
+        Border = TRUE;
+        Pos = MAP_APPFONT ( 65, 61 );
+        Size = MAP_APPFONT ( 10, 12 );
+    };
+
+    FixedText FT_FORMULA_SEP_ARRAY_R
+    {
+        Pos = MAP_APPFONT ( 21, 81 );
+        Size = MAP_APPFONT ( 40, 8 );
+        Text [ en-US ] = "Array ~row";
+    };
+
+    Edit ED_FORMULA_SEP_ARRAY_R
+    {
+        Border = TRUE;
+        Pos = MAP_APPFONT ( 65, 79 );
+        Size = MAP_APPFONT ( 10, 12 );
+    };
+
+    PushButton BTN_FORMULA_SEP_RESET
+    {
+        Pos = MAP_APPFONT ( 21, 99 );
+        Size = MAP_APPFONT ( 40, 14 );
+        Text [ en-US ] = "Rese~t";
+    };
+};
+
+/**************************************************************************/
+/*                                                                        */
+/*                                                                        */
+/*                                                                        */
+/**************************************************************************/
+
 TabPage RID_SCPAGE_USERLISTS
 {
     HelpId = HID_SCPAGE_USERLISTS ;
commit 29c61288c525f692b75801547b82fd394c38fb0d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 21:15:49 2010 +0200

    sc-sheet-gridline-toggle.diff: Toggle gridline display per sheet.
    
    i#14893

diff --git a/sc/inc/ViewSettingsSequenceDefines.hxx b/sc/inc/ViewSettingsSequenceDefines.hxx
index a729620..9514514 100644
--- a/sc/inc/ViewSettingsSequenceDefines.hxx
+++ b/sc/inc/ViewSettingsSequenceDefines.hxx
@@ -61,7 +61,7 @@
 // this are the defines for the position of the settings in the
 // TableViewSettingsSequence
 
-#define SC_TABLE_VIEWSETTINGS_COUNT         15
+#define SC_TABLE_VIEWSETTINGS_COUNT         16
 
 #define SC_CURSOR_X							0
 #define SC_CURSOR_Y							1
@@ -78,6 +78,7 @@
 #define SC_TABLE_ZOOM_VALUE                 12
 #define SC_TABLE_PAGE_VIEW_ZOOM_VALUE       13
 #define SC_TABLE_TAB_BG_COLOR               14
+#define SC_TABLE_SHOWGRID                   15
 
 #define SC_CURSORPOSITIONX					"CursorPositionX"
 #define SC_CURSORPOSITIONY					"CursorPositionY"
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 8b0856d..70c6119 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1657,6 +1657,9 @@
 // Autoformat for DataPilot
 #define SID_PIVOT_AFMT              (SC_OOO_BUILD_START + 1)
 
+// Toggle sheet grid
+#define FID_TAB_TOGGLE_GRID         (SC_OOO_BUILD_START + 2)
+
 #endif
 
 
diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx
index 7ad90f0..3c60786 100644
--- a/sc/inc/scextopt.hxx
+++ b/sc/inc/scextopt.hxx
@@ -76,6 +76,7 @@ struct ScExtTabSettings
     bool                mbSelected;         /// true = Sheet is selected.
     bool                mbFrozenPanes;      /// true = Frozen panes; false = Normal splits.
     bool                mbPageMode;         /// true = Pagebreak mode; false = Normal view mode.
+    bool                mbShowGrid;         /// Whether or not to display gridlines.
 
     explicit            ScExtTabSettings();
 };
diff --git a/sc/sdi/docsh.sdi b/sc/sdi/docsh.sdi
index d0f2eac..51dd7d9 100644
--- a/sc/sdi/docsh.sdi
+++ b/sc/sdi/docsh.sdi
@@ -61,6 +61,7 @@ interface TableSelection
     FID_TAB_RENAME		[ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
     FID_TAB_RTL			[ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
     FID_TAB_SET_TAB_BG_COLOR    [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
+    FID_TAB_TOGGLE_GRID [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
 
     SID_TABLE_ACTIVATE	[ ExecMethod = Execute; ]
 }
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index fcd1a77..e3f3a51 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -7799,6 +7799,33 @@ SfxVoidItem ShareDocument SID_SHARE_DOC
 ]
 
 //--------------------------------------------------------------------------
+SfxBoolItem ToggleSheetGrid FID_TAB_TOGGLE_GRID
+
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_FORMAT;
+]
+
+
+
+//--------------------------------------------------------------------------
 SvxColorItem TabBgColor FID_TAB_SET_TAB_BG_COLOR
 
 [
diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx
index 5120b6f..a3354ce 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -313,7 +313,6 @@ XclExpTabViewSettings::XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nSc
 
     const ScViewOptions& rViewOpt = GetDoc().GetViewOptions();
     maData.mbShowFormulas   = rViewOpt.GetOption( VOPT_FORMULAS );
-    maData.mbShowGrid       = rViewOpt.GetOption( VOPT_GRID );
     maData.mbShowHeadings   = rViewOpt.GetOption( VOPT_HEADER );
     maData.mbShowZeros      = rViewOpt.GetOption( VOPT_NULLVALS );
     maData.mbShowOutline    = rViewOpt.GetOption( VOPT_OUTLINER );
@@ -388,6 +387,7 @@ XclExpTabViewSettings::XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nSc
             else
                 maData.maGridColor = rGridColor;
         }
+        maData.mbShowGrid       = rTabSett.mbShowGrid;
 
         // view mode and zoom
         maData.mbPageMode       = (GetBiff() == EXC_BIFF8) && rTabSett.mbPageMode;
diff --git a/sc/source/filter/excel/xiview.cxx b/sc/source/filter/excel/xiview.cxx
index bd47a02..5af950b 100644
--- a/sc/source/filter/excel/xiview.cxx
+++ b/sc/source/filter/excel/xiview.cxx
@@ -274,6 +274,9 @@ void XclImpTabViewSettings::Finalize()
     else
         rTabSett.maGridColor = maData.maGridColor;
 
+    // show grid option
+    rTabSett.mbShowGrid      = maData.mbShowGrid;
+
     // view mode and zoom
     if( maData.mnCurrentZoom != 0 )
         (maData.mbPageMode ? maData.mnPageZoom : maData.mnNormalZoom) = maData.mnCurrentZoom;
@@ -288,7 +291,6 @@ void XclImpTabViewSettings::Finalize()
         // set Excel sheet settings globally at Calc document, take settings from displayed sheet
         ScViewOptions aViewOpt( rDoc.GetViewOptions() );
         aViewOpt.SetOption( VOPT_FORMULAS, maData.mbShowFormulas );
-        aViewOpt.SetOption( VOPT_GRID,     maData.mbShowGrid );
         aViewOpt.SetOption( VOPT_HEADER,   maData.mbShowHeadings );
         aViewOpt.SetOption( VOPT_NULLVALS, maData.mbShowZeros );
         aViewOpt.SetOption( VOPT_OUTLINER, maData.mbShowOutline );
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 7be2b44..8df8214 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -139,6 +139,8 @@ private:
     SCCOL			nPosX[2];
     SCROW			nPosY[2];
 
+    bool            bShowGrid;                  // per-sheet show grid-lines option.
+
     BOOL			bOldCurValid;				// "virtuelle" Cursorpos. bei zusammengefassten
 
                     ScViewDataTable();
@@ -320,6 +322,9 @@ public:
     const Fraction&	GetZoomX() const        { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
     const Fraction&	GetZoomY() const        { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
 
+    void            SetShowGrid( bool bShow );
+    bool            GetShowGrid() const { return pThisTab->bShowGrid; }
+
     const MapMode&	GetLogicMode( ScSplitPos eWhich );
     const MapMode&	GetLogicMode();						// Offset 0
 
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 7669b22..94aa9dc 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -572,7 +572,8 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
     aOutputData.SetEditObject( GetEditObject() );
     aOutputData.SetViewShell( pViewData->GetViewShell() );
 
-    BOOL bGrid = rOpts.GetOption( VOPT_GRID );
+    BOOL bGrid = rOpts.GetOption( VOPT_GRID ) && pViewData->GetShowGrid();
+
     BOOL bPage = rOpts.GetOption( VOPT_PAGEBREAKS );
 
     if ( eMode == SC_UPDATE_CHANGED )
diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx
index 541f0e5..59b3230 100644
--- a/sc/source/ui/view/scextopt.cxx
+++ b/sc/source/ui/view/scextopt.cxx
@@ -57,7 +57,8 @@ ScExtTabSettings::ScExtTabSettings() :
     mnPageZoom( 0 ),
     mbSelected( false ),
     mbFrozenPanes( false ),
-    mbPageMode( false )
+    mbPageMode( false ),
+    mbShowGrid( true )
 {
 }
 
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index ee282e5..9b3d07a 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -32,6 +32,7 @@
 
 #include "scitems.hxx"
 #include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <basic/sbstar.hxx>
 #include <layout/layout.hxx>
@@ -691,6 +692,17 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
             }
             break;
 
+        case FID_TAB_TOGGLE_GRID:
+            {
+                bool bShowGrid = pViewData->GetShowGrid();
+                pViewData->SetShowGrid(!bShowGrid);
+                SfxBindings& rBindings = GetViewFrame()->GetBindings();
+                rBindings.Invalidate( FID_TAB_TOGGLE_GRID );
+                PaintGrid();
+                rReq.Done();
+            }
+            break;
+
         case FID_TAB_SET_TAB_BG_COLOR:
         case FID_TAB_MENU_SET_TAB_BG_COLOR:
             {
@@ -954,6 +966,10 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
                     rSet.Put( SvxColorItem( aColor, nWhich ) );
                 }
                 break;
+
+            case FID_TAB_TOGGLE_GRID:
+                rSet.Put( SfxBoolItem(nWhich, pViewData->GetShowGrid()) );
+                break;
         }
         nWhich = aIter.NextWhich();
     }
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 1f86f90..d435ea1 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -101,6 +101,7 @@ ScViewDataTable::ScViewDataTable() :
                 nFixPosY( 0 ),
                 nCurX( 0 ),
                 nCurY( 0 ),
+                bShowGrid( true ),
                 bOldCurValid( FALSE )
 {
     nPosX[0]=nPosX[1]=0;
@@ -160,6 +161,9 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>
         pSettings[SC_TABLE_ZOOM_VALUE].Value <<= nZoomValue;
         pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_PAGEVIEWZOOMVALUE));
         pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Value <<= nPageZoomValue;
+
+        pSettings[SC_TABLE_SHOWGRID].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWGRID));
+        pSettings[SC_TABLE_SHOWGRID].Value <<= static_cast<sal_Bool>(bShowGrid);
     }
 }
 
@@ -264,6 +268,10 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV
             aPageZoomX = aPageZoomY = aZoom;
             rHasZoom = true;
         }
+        else if (sName.compareToAscii(SC_UNO_SHOWGRID) == 0)
+        {
+            aSettings[i].Value >>= bShowGrid;
+        }
         else if (sName.compareToAscii(SC_TABLESELECTED) == 0)
         {
             bool bSelected = false;
@@ -743,6 +751,12 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAl
     SetZoom( rNewX, rNewY, vTabs );
 }
 
+void ScViewData::SetShowGrid( bool bShow )
+{
+    CreateSelectedTabData();
+    pTabData[nTabNo]->bShowGrid = bShow;
+}
+
 void ScViewData::RefreshZoom()
 {
     // recalculate zoom-dependent values (only for current sheet)
@@ -2526,6 +2540,7 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
                 if( rGridColor.GetColor() != SC_STD_GRIDCOLOR )
                     rTabSett.maGridColor = rGridColor;
             }
+            rTabSett.mbShowGrid = pViewTab->bShowGrid;
 
             // view mode and zoom
             rTabSett.mbPageMode = bPagebreak;
@@ -2658,6 +2673,8 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
             if( rTabSett.mnPageZoom )
                 rViewTab.aPageZoomX = rViewTab.aPageZoomY = Fraction( rTabSett.mnPageZoom, 100L );
 
+            rViewTab.bShowGrid = rTabSett.mbShowGrid;
+
             // get some settings from displayed Excel sheet, set at Calc document
             if( nTab == GetTabNo() )
             {
diff --git a/sc/uiconfig/scalc/toolbar/formatobjectbar.xml b/sc/uiconfig/scalc/toolbar/formatobjectbar.xml
index 49c31d7..773befc 100644
--- a/sc/uiconfig/scalc/toolbar/formatobjectbar.xml
+++ b/sc/uiconfig/scalc/toolbar/formatobjectbar.xml
@@ -50,4 +50,6 @@
  <toolbar:toolbaritem xlink:href=".uno:InsertColumns" toolbar:helpid="helpid:26268"  toolbar:visible="false" />
  <toolbar:toolbaritem xlink:href=".uno:DeleteRows" toolbar:helpid="helpid:26236"  toolbar:visible="false" />
  <toolbar:toolbaritem xlink:href=".uno:DeleteColumns" toolbar:helpid="helpid:26237"  toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ToggleSheetGrid" toolbar:helpid="helpid:26238"  toolbar:visible="true" />
 </toolbar:toolbar>


More information about the ooo-build-commit mailing list