[ooo-build-commit] .: 2 commits - formula/inc formula/source svx/inc svx/source

Fridrich Strba fridrich at kemper.freedesktop.org
Thu Sep 16 01:16:53 PDT 2010


 formula/inc/formula/FormulaCompiler.hxx     |    2 +
 formula/inc/formula/grammar.hxx             |   12 ++++++
 formula/source/core/api/FormulaCompiler.cxx |   21 ++++++++++++
 svx/inc/srchdlg.hxx                         |    2 +
 svx/source/dialog/srchdlg.cxx               |   49 ++++++++++++++++++++++++----
 5 files changed, 80 insertions(+), 6 deletions(-)

New commits:
commit 18c9ae89e16e620999af675d7a6abab503cf143f
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Sep 16 10:11:25 2010 +0200

    calc-find-replace-empty-cells-svx.diff: Support find and replace empty cells
    
    i#49380, n#415352

diff --git a/svx/inc/srchdlg.hxx b/svx/inc/srchdlg.hxx
index 856f3fc..fad0f4b 100644
--- a/svx/inc/srchdlg.hxx
+++ b/svx/inc/srchdlg.hxx
@@ -160,6 +160,8 @@ public:
 
     INT32			GetTransliterationFlags() const;
 
+    void            SetSaveToModule(bool b);
+
 private:
     FixedText       aSearchText;
     ComboBox        aSearchLB;
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 5a2824c..74a338f 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -659,6 +659,11 @@ INT32 SvxSearchDialog::GetTransliterationFlags() const
     return nTransliterationFlags;
 }
 
+void SvxSearchDialog::SetSaveToModule(bool b)
+{
+    pImpl->bSaveToModule = b;
+}
+
 // -----------------------------------------------------------------------
 
 void SvxSearchDialog::ApplyTransliterationFlags_Impl( INT32 nSettings )
@@ -926,9 +931,36 @@ void SvxSearchDialog::CalculateDelta_Impl()
 
 // -----------------------------------------------------------------------
 
+namespace {
+
+class ToggleSaveToModule
+{
+public:
+    ToggleSaveToModule(SvxSearchDialog& rDialog, bool bValue) :
+        mrDialog(rDialog), mbValue(bValue)
+    {
+        mrDialog.SetSaveToModule(mbValue);
+    }
+
+    ~ToggleSaveToModule()
+    {
+        mrDialog.SetSaveToModule(!mbValue);
+    }
+private:
+    SvxSearchDialog& mrDialog;
+    bool mbValue;
+};
+
+}
+
 void SvxSearchDialog::Init_Impl( int bSearchPattern )
 {
     DBG_ASSERT( pSearchItem, "SearchItem == 0" );
+
+    // We don't want to save any intermediate state to the module while the
+    // dialog is being initialized.
+    ToggleSaveToModule aNoModuleSave(*this, false);
+
     bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER );
 
     pImpl->bMultiLineEdit = FALSE;
@@ -1078,10 +1110,8 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern )
         aSimilarityBox.Check( pSearchItem->IsLevenshtein() );
     bSet = TRUE;
 
-    pImpl->bSaveToModule = FALSE;
     FlagHdl_Impl( &aSimilarityBox );
     FlagHdl_Impl( &aJapOptionsCB );
-    pImpl->bSaveToModule = TRUE;
 
     FASTBOOL bDisableSearch = FALSE;
     SfxViewShell* pViewShell = SfxViewShell::Current();
@@ -1609,16 +1639,23 @@ IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, ComboBox *, pEd )
     else
         bSet = FALSE;
 
+    // Calc allows searching for empty cells.
+    bool bAllowEmptySearch = (pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC);
+
     if ( pEd == &aSearchLB || pEd == &aReplaceLB )
     {
-        xub_StrLen nLBTxtLen = aSearchLB.GetText().Len(), nTxtLen;
+        xub_StrLen nSrchTxtLen = aSearchLB.GetText().Len();
+        xub_StrLen nReplTxtLen = 0;
+        if (bAllowEmptySearch)
+            nReplTxtLen = aReplaceLB.GetText().Len();
+        xub_StrLen nAttrTxtLen = 0;
 
         if ( !pImpl->bMultiLineEdit )
-           nTxtLen = aSearchAttrText.GetText().Len();
+           nAttrTxtLen = aSearchAttrText.GetText().Len();
         else
-            nTxtLen = pImpl->aSearchFormats.GetText().Len();
+            nAttrTxtLen = pImpl->aSearchFormats.GetText().Len();
 
-        if ( nLBTxtLen || nTxtLen )
+        if (nSrchTxtLen || nReplTxtLen || nAttrTxtLen)
         {
             EnableControl_Impl( &aSearchBtn );
             EnableControl_Impl( &aReplaceBtn );
commit fa0e57adc40e440129055f0c8ab52eaab1006896
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Sep 16 10:05:05 2010 +0200

    calc-grammar-xls-english-sc.diff: Support Excel English grammar
    
    Support Excel English grammar needed for VBA and (probably) for xlsx filter.

diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx
index d82e2c8..47fefb3 100644
--- a/formula/inc/formula/FormulaCompiler.hxx
+++ b/formula/inc/formula/FormulaCompiler.hxx
@@ -320,6 +320,7 @@ private:
     void InitSymbolsEnglish() const;   /// only SymbolsEnglish, maybe later
     void InitSymbolsPODF() const;      /// only SymbolsPODF, on demand
     void InitSymbolsODFF() const;      /// only SymbolsODFF, on demand
+    void InitSymbolsEnglishXL() const; /// only SymbolsEnglishXL, on demand
 
     void loadSymbols(USHORT _nSymbols,FormulaGrammar::Grammar _eGrammar,NonConstOpCodeMapPtr& _xMap) const;
 
@@ -373,6 +374,7 @@ private:
     mutable NonConstOpCodeMapPtr  mxSymbolsPODF;                          // ODF 1.1 symbols
     mutable NonConstOpCodeMapPtr  mxSymbolsNative;                        // native symbols
     mutable NonConstOpCodeMapPtr  mxSymbolsEnglish;                       // English symbols
+    mutable NonConstOpCodeMapPtr  mxSymbolsEnglishXL;                     // English Excel symbols (for VBA formula parsing)
 };
 // =============================================================================
 } // formula
diff --git a/formula/inc/formula/grammar.hxx b/formula/inc/formula/grammar.hxx
index 691dbcb..acaf7d8 100644
--- a/formula/inc/formula/grammar.hxx
+++ b/formula/inc/formula/grammar.hxx
@@ -127,6 +127,16 @@ public:
         GRAM_NATIVE_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE  |
                                 ((CONV_XL_R1C1       +
                                   kConventionOffset) << kConventionShift),
+        /// English with Excel A1 reference style.
+        GRAM_ENGLISH_XL_A1   = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH  |
+                                ((CONV_XL_A1         +
+                                  kConventionOffset) << kConventionShift)            |
+                                kEnglishBit,
+        /// English with Excel R1C1 reference style.
+        GRAM_ENGLISH_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH  |
+                                ((CONV_XL_R1C1       +
+                                  kConventionOffset) << kConventionShift)            |
+                                kEnglishBit,
         /// Central definition of the default grammar to be used.
         GRAM_DEFAULT        = GRAM_NATIVE_UI,
 
@@ -177,6 +187,8 @@ public:
             case GRAM_NATIVE_ODF     :
             case GRAM_NATIVE_XL_A1   :
             case GRAM_NATIVE_XL_R1C1 :
+            case GRAM_ENGLISH_XL_A1  :
+            case GRAM_ENGLISH_XL_R1C1:
                 return true;
             default:
                 return extractFormulaLanguage( eGrammar) == GRAM_EXTERNAL;
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 508d780..fed0aab 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -568,6 +568,11 @@ FormulaCompiler::OpCodeMapPtr FormulaCompiler::GetOpCodeMap( const sal_Int32 nLa
                 InitSymbolsNative();
             xMap = mxSymbolsNative;
             break;
+        case FormulaLanguage::XL_ENGLISH:
+            if (!mxSymbolsEnglishXL)
+                InitSymbolsEnglishXL();
+            xMap = mxSymbolsEnglishXL;
+            break;
         default:
             ;   // nothing, NULL map returned
     }
@@ -681,6 +686,22 @@ void FormulaCompiler::InitSymbolsODFF() const
     mxSymbolsODFF = s_sSymbol;
 }
 // -----------------------------------------------------------------------------
+void FormulaCompiler::InitSymbolsEnglishXL() const
+{
+    static NonConstOpCodeMapPtr s_sSymbol;
+    if ( !s_sSymbol.get() )
+        loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH,FormulaGrammar::GRAM_ENGLISH,s_sSymbol);
+    mxSymbolsEnglishXL = s_sSymbol;
+
+    // TODO: For now, just replace the separators to the Excel English
+    // variants. Later, if we want to properly map Excel functions with Calc
+    // functions, we'll need to do a little more work here.
+    mxSymbolsEnglishXL->putOpCode(sal_Unicode(','), ocSep);
+    mxSymbolsEnglishXL->putOpCode(sal_Unicode(','), ocArrayColSep);
+    mxSymbolsEnglishXL->putOpCode(sal_Unicode(';'), ocArrayRowSep);
+}
+
+// -----------------------------------------------------------------------------
 void FormulaCompiler::loadSymbols(USHORT _nSymbols,FormulaGrammar::Grammar _eGrammar,NonConstOpCodeMapPtr& _xMap) const
 {
     if ( !_xMap.get() )


More information about the ooo-build-commit mailing list