[ooo-build-commit] .: 5 commits - patches/dev300

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


 patches/dev300/apply                                  |   12 
 patches/dev300/calc-filter-dbf-precision.diff         |  141 ------
 patches/dev300/calc-find-replace-empty-cells-sc.diff  |  381 ------------------
 patches/dev300/calc-find-replace-empty-cells-svx.diff |  113 -----
 patches/dev300/calc-grammar-xls-english-offapi.diff   |   22 -
 patches/dev300/calc-grammar-xls-english-sc.diff       |   98 ----
 6 files changed, 767 deletions(-)

New commits:
commit 9b72e7779517fdab5634867129faf28e20b1c066
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu Sep 16 10:15:31 2010 +0200

    calc-filter-dbf-precision.diff: Migrated to git

diff --git a/patches/dev300/apply b/patches/dev300/apply
index f18a41d..c9f3915 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -528,9 +528,6 @@ sw-ww8-styles-import-fix.diff, i#21939, cbosdo
 calc-enhanced-merge-cells-sc.diff,        n#213205, i#67243, i#101042, jholesov/kohei
 calc-enhanced-merge-cells-officecfg.diff, n#213205, i#67243, i#101042, jholesov/kohei
 
-# import/export precision of value cells correctly.
-calc-filter-dbf-precision.diff, n#479025, i#101045, kohei
-
 # don't do useless case matching on autoinput.
 calc-autoinput-case-insensitive-matching.diff, n#472395, i#101046, kohei
 
diff --git a/patches/dev300/calc-filter-dbf-precision.diff b/patches/dev300/calc-filter-dbf-precision.diff
deleted file mode 100644
index d45cf35..0000000
--- a/patches/dev300/calc-filter-dbf-precision.diff
+++ /dev/null
@@ -1,141 +0,0 @@
----
- sc/source/core/data/column3.cxx  |   14 +++++++-
- sc/source/ui/docshell/docsh8.cxx |   60 +++++++++++++++++++++++++++++++++++++-
- 2 files changed, 71 insertions(+), 3 deletions(-)
-
-diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
-index 19a59d7..4c062a6 100644
---- sc/source/core/data/column3.cxx
-+++ sc/source/core/data/column3.cxx
-@@ -1968,8 +1968,18 @@ xub_StrLen ScColumn::GetMaxNumberStringLen(
-                 if ( nLen )
-                 {
-                     if ( nFormat )
--                    {   // more decimals than standard?
--                        sal_uInt16 nPrec = pNumFmt->GetFormatPrecision( nFormat );
-+                    {
-+                        const SvNumberformat* pEntry = pNumFmt->GetEntry( nFormat );
-+                        sal_uInt16 nPrec;
-+                        if (pEntry)
-+                        {
-+                            BOOL bThousand, bNegRed;
-+                            USHORT nLeading;
-+                            pEntry->GetFormatSpecialInfo(bThousand, bNegRed, nPrec, nLeading);
-+                        }
-+                        else
-+                            nPrec = pNumFmt->GetFormatPrecision( nFormat );
-+
-                         if ( nPrec != SvNumberFormatter::UNLIMITED_PRECISION && nPrec > nPrecision )
-                             nPrecision = nPrec;
-                     }
-diff --git sc/source/ui/docshell/docsh8.cxx sc/source/ui/docshell/docsh8.cxx
-index 589b0c6..75a0756 100644
---- sc/source/ui/docshell/docsh8.cxx
-+++ sc/source/ui/docshell/docsh8.cxx
-@@ -78,8 +78,16 @@
- #include "dbdocutl.hxx"
- #include "dociter.hxx"
- #include "globstr.hrc"
-+#include "svl/zformat.hxx"
-+#include "svl/intitem.hxx"
-+#include "patattr.hxx"
-+#include "scitems.hxx"
-+#include "docpool.hxx"
-+
-+#include <vector>
- 
- using namespace com::sun::star;
-+using ::std::vector;
- 
- // -----------------------------------------------------------------------
- 
-@@ -246,6 +254,53 @@ BOOL ScDocShell::IsDocument( const INetURLObject& rURL )
- 
- // -----------------------------------------------------------------------
- 
-+static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales)
-+{
-+    SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-+    if (!pFormatter)
-+        return;
-+
-+    SCCOL nColCount = static_cast<SCCOL>(rScales.size());
-+    for (SCCOL i = 0; i < nColCount; ++i)
-+    {
-+        if (rScales[i] < 0)
-+            continue;
-+
-+        sal_uInt32 nOldFormat;
-+        rDoc.GetNumberFormat(static_cast<SCCOL>(i), 0, 0, nOldFormat);
-+        const SvNumberformat* pOldEntry = pFormatter->GetEntry(nOldFormat);
-+        if (!pOldEntry)
-+            continue;
-+
-+        LanguageType eLang = pOldEntry->GetLanguage();
-+        BOOL bThousand, bNegRed;
-+        USHORT nPrecision, nLeading;
-+        pOldEntry->GetFormatSpecialInfo(bThousand, bNegRed, nPrecision, nLeading);
-+
-+        nPrecision = static_cast<USHORT>(rScales[i]);
-+        String aNewPicture;
-+        pFormatter->GenerateFormat(aNewPicture, nOldFormat, eLang,
-+                                   bThousand, bNegRed, nPrecision, nLeading);
-+
-+        sal_uInt32 nNewFormat = pFormatter->GetEntryKey(aNewPicture, eLang);
-+        if (nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
-+        {
-+            xub_StrLen nErrPos = 0;
-+            short nNewType = 0;
-+            bool bOk = pFormatter->PutEntry(
-+                aNewPicture, nErrPos, nNewType, nNewFormat, eLang);
-+
-+            if (!bOk)
-+                continue;
-+        }
-+
-+        ScPatternAttr aNewAttrs( rDoc.GetPool() );
-+        SfxItemSet& rSet = aNewAttrs.GetItemSet();
-+        rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat) );
-+        rDoc.ApplyPatternAreaTab(static_cast<SCCOL>(i), 0, static_cast<SCCOL>(i), MAXROW, 0, aNewAttrs);
-+    }
-+}
-+
- ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
-                                 BOOL bSimpleColWidth[MAXCOLCOUNT] )
- {
-@@ -327,6 +382,7 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
-         //	read column names
-         //!	add type descriptions
- 
-+        vector<long> aScales(nColCount, -1);
-         for (i=0; i<nColCount; i++)
-         {
-             String aHeader = xMeta->getColumnLabel( i+1 );
-@@ -356,6 +412,7 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
-                                         nPrec, nScale ) );
-                         aHeader += ',';
-                         aHeader += String::CreateFromInt32( nScale );
-+                        aScales[i] = nScale;
-                     }
-                     break;
-             }
-@@ -363,6 +420,8 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
-             aDocument.SetString( static_cast<SCCOL>(i), 0, 0, aHeader );
-         }
- 
-+        lcl_setScalesToColumns(aDocument, aScales);
-+
-         SCROW nRow = 1;		// 0 is column titles
-         BOOL bEnd = FALSE;
-         while ( !bEnd && xRowSet->next() )
-@@ -486,7 +545,6 @@ void lcl_GetColumnTypes( ScDocShell& rDocShell,
-                         break;
-                     case 'N' :
-                         nDbType = sdbc::DataType::DECIMAL;
--                        bTypeDefined = TRUE;
-                         break;
-                 }
-                 if ( bTypeDefined && !nFieldLen && nToken > 2 )
--- 
-1.7.0.1
-
commit 6589a92bb6bb874b44a45df6ce083d9f0530dc4d
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu Sep 16 10:12:47 2010 +0200

    calc-find-replace-empty-cells-svx.diff: Migrated to git

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 39f1044..f18a41d 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -524,9 +524,6 @@ sw-ww8-styles-import-fix.diff, i#21939, cbosdo
 
 [ CalcFixes ]
 
-# Support finding and replacing empty cells.
-calc-find-replace-empty-cells-svx.diff i#49380, n#415352, kohei
-
 # Merging/unmerging of cells on multiple sheets & merge center icon.
 calc-enhanced-merge-cells-sc.diff,        n#213205, i#67243, i#101042, jholesov/kohei
 calc-enhanced-merge-cells-officecfg.diff, n#213205, i#67243, i#101042, jholesov/kohei
diff --git a/patches/dev300/calc-find-replace-empty-cells-svx.diff b/patches/dev300/calc-find-replace-empty-cells-svx.diff
deleted file mode 100644
index a6d899d..0000000
--- a/patches/dev300/calc-find-replace-empty-cells-svx.diff
+++ /dev/null
@@ -1,113 +0,0 @@
----
- svx/inc/srchdlg.hxx           |    2 +
- svx/source/dialog/srchdlg.cxx |   49 ++++++++++++++++++++++++++++++++++++-----
- 2 files changed, 45 insertions(+), 6 deletions(-)
-
-diff --git svx/inc/srchdlg.hxx svx/inc/srchdlg.hxx
-index 856f3fc..fad0f4b 100644
---- svx/inc/srchdlg.hxx
-+++ svx/inc/srchdlg.hxx
-@@ -160,6 +160,8 @@ public:
- 
-     INT32			GetTransliterationFlags() const;
- 
-+    void            SetSaveToModule(bool b);
-+
- private:
-     FixedText       aSearchText;
-     ComboBox        aSearchLB;
-diff --git svx/source/dialog/srchdlg.cxx svx/source/dialog/srchdlg.cxx
-index 5a2824c..74a338f 100644
---- svx/source/dialog/srchdlg.cxx
-+++ 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 );
--- 
-1.7.0.1
-
commit 00672a92196ea84e58d81680de1940955824c6c3
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu Sep 16 10:10:44 2010 +0200

    calc-find-replace-empty-cells-sc.diff: Migrated to git

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 508ed9e..39f1044 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -525,7 +525,6 @@ sw-ww8-styles-import-fix.diff, i#21939, cbosdo
 [ CalcFixes ]
 
 # Support finding and replacing empty cells.
-calc-find-replace-empty-cells-sc.diff  i#49380, n#415352, kohei
 calc-find-replace-empty-cells-svx.diff i#49380, n#415352, kohei
 
 # Merging/unmerging of cells on multiple sheets & merge center icon.
diff --git a/patches/dev300/calc-find-replace-empty-cells-sc.diff b/patches/dev300/calc-find-replace-empty-cells-sc.diff
deleted file mode 100644
index f88d9ca..0000000
--- a/patches/dev300/calc-find-replace-empty-cells-sc.diff
+++ /dev/null
@@ -1,381 +0,0 @@
----
- sc/inc/table.hxx               |   10 ++
- sc/source/core/data/column.cxx |   19 +++-
- sc/source/core/data/table6.cxx |  276 ++++++++++++++++++++++++++++++++++++++++
- sc/source/ui/view/tabvwsha.cxx |    7 +-
- 4 files changed, 310 insertions(+), 2 deletions(-)
-
-diff --git sc/inc/table.hxx sc/inc/table.hxx
-index f20edc2..114f71e 100644
---- sc/inc/table.hxx
-+++ sc/inc/table.hxx
-@@ -808,6 +808,16 @@ private:
-     BOOL		SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark);
-     BOOL		ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
-                                 ScDocument* pUndoDoc);
-+    bool        SearchAndReplaceEmptyCells(
-+                    const SvxSearchItem& rSearchItem,
-+                    SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
-+                    String& rUndoStr, ScDocument* pUndoDoc);
-+    bool        SearchRangeForEmptyCell(const ScRange& rRange,
-+                    const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
-+                    String& rUndoStr, ScDocument* pUndoDoc);
-+    bool        SearchRangeForAllEmptyCells(const ScRange& rRange,
-+                    const SvxSearchItem& rSearchItem, ScMarkData& rMark,
-+                    String& rUndoStr, ScDocument* pUndoDoc);
- 
-                                 // benutzen globalen SortParam:
-     BOOL		IsSorted(SCCOLROW nStart, SCCOLROW nEnd);
-diff --git sc/source/core/data/column.cxx sc/source/core/data/column.cxx
-index 0f3e43d..8645a15 100644
---- sc/source/core/data/column.cxx
-+++ sc/source/core/data/column.cxx
-@@ -1354,7 +1354,24 @@ void ScColumn::CopyToColumn(SCROW nRow1, SCROW nRow2, USHORT nFlags, BOOL bMarke
-                     CloneCell( i, nFlags, *rColumn.pDocument, aDestPos );
- 
-                 if (pNew)
--                    rColumn.Insert(pItems[i].nRow, pNew);
-+                {
-+                    // Special case to allow removing of cell instances.  A
-+                    // string cell with empty content is used to indicate an
-+                    // empty cell.
-+                    if (pNew->GetCellType() == CELLTYPE_STRING)
-+                    {
-+                        String aStr;
-+                        static_cast<ScStringCell*>(pNew)->GetString(aStr);
-+                        if (aStr.Len() == 0)
-+                            // A string cell with empty string.  Delete the cell itself.
-+                            rColumn.Delete(pItems[i].nRow);
-+                        else
-+                            // non-empty string cell
-+                            rColumn.Insert(pItems[i].nRow, pNew);
-+                    }
-+                    else
-+                        rColumn.Insert(pItems[i].nRow, pNew);
-+                }
-             }
-         }
-     }
-diff --git sc/source/core/data/table6.cxx sc/source/core/data/table6.cxx
-index 381cd9c..0194b44 100644
---- sc/source/core/data/table6.cxx
-+++ sc/source/core/data/table6.cxx
-@@ -49,6 +49,8 @@
- //--------------------------------------------------------------------------
- 
- 
-+using ::com::sun::star::util::SearchOptions;
-+
- BOOL lcl_GetTextWithBreaks( const ScEditCell& rCell, ScDocument* pDoc, String& rVal )
- {
-     //	TRUE = more than 1 paragraph
-@@ -657,6 +659,12 @@ BOOL ScTable::SearchAndReplace(const SvxSearchItem& rSearchItem,
-             com::sun::star::util::SearchOptions aSearchOptions = rSearchItem.GetSearchOptions();
-             aSearchOptions.Locale = *ScGlobal::GetLocale();
- 
-+            if (!aSearchOptions.searchString.getLength())
-+            {
-+                // Search for empty cells.
-+                return SearchAndReplaceEmptyCells(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc);
-+            }
-+
-             //	#107259# reflect UseAsianOptions flag in SearchOptions
-             //	(use only ignore case and width if asian options are disabled).
-             //	This is also done in SvxSearchDialog CommandHdl, but not in API object.
-@@ -683,6 +691,274 @@ BOOL ScTable::SearchAndReplace(const SvxSearchItem& rSearchItem,
-     return bFound;
- }
- 
-+bool ScTable::SearchAndReplaceEmptyCells(
-+    const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
-+    String& rUndoStr, ScDocument* pUndoDoc)
-+{
-+    SCCOL nColStart, nColEnd;
-+    SCROW nRowStart, nRowEnd;
-+    GetFirstDataPos(nColStart, nRowStart);
-+    GetLastDataPos(nColEnd, nRowEnd);
-+
-+    ScRangeList aRanges;
-+    aRanges.Append(ScRange(nColStart, nRowStart, nTab, nColEnd, nRowEnd, nTab));
-+
-+    if (rSearchItem.GetSelection())
-+    {
-+        // current selection only.
-+        if (!rMark.IsMarked() && !rMark.IsMultiMarked())
-+            // There is no selection.  Bail out.
-+            return false;
-+
-+        ScRangeList aMarkedRanges, aNewRanges;
-+        rMark.FillRangeListWithMarks(&aMarkedRanges, true);
-+        for (ScRangePtr p = aMarkedRanges.First(); p; p = aMarkedRanges.Next())
-+        {
-+            if (p->aStart.Col() > nColEnd || p->aStart.Row() > nRowEnd)
-+                // This range is outside the data area.  Skip it.
-+                continue;
-+
-+            // Shrink the range into data area only.
-+            if (p->aStart.Col() < nColStart)
-+                p->aStart.SetCol(rCol);
-+            if (p->aStart.Row() < nRowStart)
-+                p->aStart.SetRow(rRow);
-+
-+            if (p->aEnd.Col() > nColEnd)
-+                p->aEnd.SetCol(nColEnd);
-+            if (p->aEnd.Row() > nRowEnd)
-+                p->aEnd.SetRow(nRowEnd);
-+
-+            aNewRanges.Append(*p);
-+        }
-+        aRanges = aNewRanges;
-+    }
-+
-+    sal_uInt16 nCommand = rSearchItem.GetCommand();
-+    if (nCommand == SVX_SEARCHCMD_FIND || nCommand == SVX_SEARCHCMD_REPLACE)
-+    {
-+        if (rSearchItem.GetBackward())
-+        {
-+            for (ScRangePtr p = aRanges.Last(); p; p = aRanges.Prev())
-+            {
-+                if (SearchRangeForEmptyCell(*p, rSearchItem, rCol, rRow, rUndoStr, pUndoDoc))
-+                    return true;
-+            }
-+        }
-+        else
-+        {
-+            for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next())
-+            {
-+                if (SearchRangeForEmptyCell(*p, rSearchItem, rCol, rRow, rUndoStr, pUndoDoc))
-+                    return true;
-+            }
-+        }
-+    }
-+    else if (nCommand == SVX_SEARCHCMD_FIND_ALL || nCommand == SVX_SEARCHCMD_REPLACE_ALL)
-+    {
-+        bool bFound = false;
-+        ScMarkData aNewMark(rMark);
-+        aNewMark.ResetMark();
-+        for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next())
-+            bFound |= SearchRangeForAllEmptyCells(*p, rSearchItem, aNewMark, rUndoStr, pUndoDoc);
-+        rMark = aNewMark;
-+        return bFound;
-+    }
-+    return false;
-+}
-+
-+bool ScTable::SearchRangeForEmptyCell(
-+    const ScRange& rRange, const SvxSearchItem& rSearchItem,
-+    SCCOL& rCol, SCROW& rRow, String& rUndoStr, ScDocument* /*pUndoDoc*/)
-+{
-+    sal_uInt16 nCmd = rSearchItem.GetCommand();
-+    if (rSearchItem.GetBackward())
-+    {
-+        // backward search
-+        if (rSearchItem.GetRowDirection())
-+        {
-+            // row direction.
-+            SCROW nBeginRow = rRange.aEnd.Row() > rRow ? rRow : rRange.aEnd.Row();
-+            for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow)
-+            {
-+                SCCOL nBeginCol = rRange.aEnd.Col();
-+                if (nRow == rRow && nBeginCol >= rCol)
-+                    // always start from one cell before the cursor.
-+                    nBeginCol = rCol - (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
-+
-+                for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol)
-+                {
-+                    ScBaseCell* pCell = aCol[nCol].GetCell(nRow);
-+                    if (!pCell)
-+                    {
-+                        // empty cell found.
-+                        rCol = nCol;
-+                        rRow = nRow;
-+                        if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE &&
-+                            rSearchItem.GetReplaceString().Len())
-+                        {
-+                            aCol[nCol].Insert(nRow, new ScStringCell(rSearchItem.GetReplaceString()));
-+                            rUndoStr = String();
-+                        }
-+                        return true;
-+                    }
-+                }
-+            }
-+        }
-+        else
-+        {
-+            // column direction.
-+            SCCOL nBeginCol = rRange.aEnd.Col() > rCol ? rCol : rRange.aEnd.Col();
-+            for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol)
-+            {
-+                SCROW nBeginRow = rRange.aEnd.Row();
-+                if (nCol == rCol && nBeginRow >= rRow)
-+                    // always start from one cell before the cursor.
-+                    nBeginRow = rRow - (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
-+                for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow)
-+                {
-+                    ScBaseCell* pCell = aCol[nCol].GetCell(nRow);
-+                    if (!pCell)
-+                    {
-+                        // empty cell found.
-+                        rCol = nCol;
-+                        rRow = nRow;
-+                        if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE &&
-+                            rSearchItem.GetReplaceString().Len())
-+                        {
-+                            aCol[nCol].Insert(nRow, new ScStringCell(rSearchItem.GetReplaceString()));
-+                            rUndoStr = String();
-+                        }
-+                        return true;
-+                    }
-+                }
-+            }
-+        }
-+    }
-+    else
-+    {
-+        // forward search
-+        if (rSearchItem.GetRowDirection())
-+        {
-+            // row direction.
-+            SCROW nBeginRow = rRange.aStart.Row() < rRow ? rRow : rRange.aStart.Row();
-+            for (SCROW nRow = nBeginRow; nRow <= rRange.aEnd.Row(); ++nRow)
-+            {
-+                SCCOL nBeginCol = rRange.aStart.Col();
-+                if (nRow == rRow && nBeginCol <= rCol)
-+                    // always start from one cell past the cursor.
-+                    nBeginCol = rCol + (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
-+                for (SCCOL nCol = nBeginCol; nCol <= rRange.aEnd.Col(); ++nCol)
-+                {
-+                    ScBaseCell* pCell = aCol[nCol].GetCell(nRow);
-+                    if (!pCell)
-+                    {
-+                        // empty cell found.
-+                        rCol = nCol;
-+                        rRow = nRow;
-+                        if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE &&
-+                            rSearchItem.GetReplaceString().Len())
-+                        {
-+                            aCol[nCol].Insert(nRow, new ScStringCell(rSearchItem.GetReplaceString()));
-+                            rUndoStr = String();
-+                        }
-+                        return true;
-+                    }
-+                }
-+            }
-+        }
-+        else
-+        {
-+            // column direction.
-+            SCCOL nBeginCol = rRange.aStart.Col() < rCol ? rCol : rRange.aStart.Col();
-+            for (SCCOL nCol = nBeginCol; nCol <= rRange.aEnd.Col(); ++nCol)
-+            {
-+                SCROW nBeginRow = rRange.aStart.Row();
-+                if (nCol == rCol && nBeginRow <= rRow)
-+                    // always start from one cell past the cursor.
-+                    nBeginRow = rRow + (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
-+                for (SCROW nRow = nBeginRow; nRow <= rRange.aEnd.Row(); ++nRow)
-+                {
-+                    ScBaseCell* pCell = aCol[nCol].GetCell(nRow);
-+                    if (!pCell)
-+                    {
-+                        // empty cell found.
-+                        rCol = nCol;
-+                        rRow = nRow;
-+                        if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE &&
-+                            rSearchItem.GetReplaceString().Len())
-+                        {
-+                            aCol[nCol].Insert(nRow, new ScStringCell(rSearchItem.GetReplaceString()));
-+                            rUndoStr = String();
-+                        }
-+                        return true;
-+                    }
-+                }
-+            }
-+        }
-+    }
-+    return false;
-+}
-+
-+bool ScTable::SearchRangeForAllEmptyCells(
-+    const ScRange& rRange, const SvxSearchItem& rSearchItem, ScMarkData& rMark,
-+    String& rUndoStr, ScDocument* pUndoDoc)
-+{
-+    bool bFound = false;
-+    bool bReplace = (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) &&
-+                    (rSearchItem.GetReplaceString().Len() > 0);
-+
-+    for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol)
-+    {
-+        if (aCol[nCol].IsEmptyData())
-+        {
-+            // The entire column is empty.  Add the whole column and move on.
-+            rMark.SetMultiMarkArea(
-+                ScRange(nCol, rRange.aStart.Row(), nTab, nCol, rRange.aEnd.Row(), nTab));
-+            bFound = true;
-+
-+            if (bReplace)
-+            {
-+                const String& rNewStr = rSearchItem.GetReplaceString();
-+                for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
-+                {
-+                    aCol[nCol].Insert(nRow, new ScStringCell(rNewStr));
-+                    if (pUndoDoc)
-+                        // TODO: I'm using a string cell with empty content to
-+                        // trigger deletion of cell instance on undo.  Maybe I
-+                        // should create a new cell type for this?
-+                        pUndoDoc->PutCell(nCol, nRow, nTab, new ScStringCell(String()));
-+                }
-+                rUndoStr = String();
-+            }
-+            continue;
-+        }
-+
-+        for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
-+        {
-+            ScBaseCell* pCell = aCol[nCol].GetCell(nRow);
-+            if (!pCell)
-+            {
-+                // empty cell found
-+                rMark.SetMultiMarkArea(ScRange(nCol, nRow, nTab));
-+                bFound = true;
-+
-+                if (bReplace)
-+                {
-+                    aCol[nCol].Insert(nRow, new ScStringCell(rSearchItem.GetReplaceString()));
-+                    if (pUndoDoc)
-+                        // TODO: I'm using a string cell with empty content to
-+                        // trigger deletion of cell instance on undo.  Maybe I
-+                        // should create a new cell type for this?
-+                        pUndoDoc->PutCell(nCol, nRow, nTab, new ScStringCell(String()));
-+                }
-+            }
-+        }
-+    }
-+    return bFound;
-+}
-+
-+
- 
- 
- 
-diff --git sc/source/ui/view/tabvwsha.cxx sc/source/ui/view/tabvwsha.cxx
-index 436fe7e..9d12665 100644
---- sc/source/ui/view/tabvwsha.cxx
-+++ sc/source/ui/view/tabvwsha.cxx
-@@ -230,8 +230,13 @@ void __EXPORT ScTabViewShell::GetState( SfxItemSet& rSet )
-                 break;
- 
-             case SID_SEARCH_ITEM:
--                rSet.Put( ScGlobal::GetSearchItem() );
-+            {
-+                SvxSearchItem aItem(ScGlobal::GetSearchItem()); // make a copy.
-+                // Search on current selection if a range is marked.
-+                aItem.SetSelection(rMark.IsMarked());
-+                rSet.Put(aItem);
-                 break;
-+            }
- 
-             case SID_SEARCH_OPTIONS:
-                 {
--- 
-1.7.0.1
-
commit 32a958abb86e9e8f393fd0fd64963bc20ed63e27
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu Sep 16 10:06:26 2010 +0200

    calc-grammar-xls-english-sc.diff: Migrated to git

diff --git a/patches/dev300/apply b/patches/dev300/apply
index bfda6d9..508ed9e 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -524,9 +524,6 @@ sw-ww8-styles-import-fix.diff, i#21939, cbosdo
 
 [ CalcFixes ]
 
-# Support Excel English grammar needed for VBA and (probably) for xlsx filter.
-calc-grammar-xls-english-sc.diff, kohei
-
 # Support finding and replacing empty cells.
 calc-find-replace-empty-cells-sc.diff  i#49380, n#415352, kohei
 calc-find-replace-empty-cells-svx.diff i#49380, n#415352, kohei
diff --git a/patches/dev300/calc-grammar-xls-english-sc.diff b/patches/dev300/calc-grammar-xls-english-sc.diff
deleted file mode 100644
index c1ccb73..0000000
--- a/patches/dev300/calc-grammar-xls-english-sc.diff
+++ /dev/null
@@ -1,98 +0,0 @@
----
- formula/inc/formula/FormulaCompiler.hxx     |    2 ++
- formula/inc/formula/grammar.hxx             |   12 ++++++++++++
- formula/source/core/api/FormulaCompiler.cxx |   21 +++++++++++++++++++++
- 3 files changed, 35 insertions(+), 0 deletions(-)
-
-diff --git formula/inc/formula/FormulaCompiler.hxx formula/inc/formula/FormulaCompiler.hxx
-index d82e2c8..47fefb3 100644
---- formula/inc/formula/FormulaCompiler.hxx
-+++ 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 formula/inc/formula/grammar.hxx formula/inc/formula/grammar.hxx
-index 691dbcb..acaf7d8 100644
---- formula/inc/formula/grammar.hxx
-+++ 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 formula/source/core/api/FormulaCompiler.cxx formula/source/core/api/FormulaCompiler.cxx
-index 2639515..e54ac6a 100644
---- formula/source/core/api/FormulaCompiler.cxx
-+++ 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() )
--- 
-1.7.0.1
-
commit 73ee634ba52eb9a6a1f574e7bc564cdcdfed77b0
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu Sep 16 09:34:05 2010 +0200

    calc-grammar-xls-english-offapi.diff: Migrated to git

diff --git a/patches/dev300/apply b/patches/dev300/apply
index d1731fe..bfda6d9 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -525,8 +525,6 @@ sw-ww8-styles-import-fix.diff, i#21939, cbosdo
 [ CalcFixes ]
 
 # Support Excel English grammar needed for VBA and (probably) for xlsx filter.
-calc-grammar-xls-english-offapi.diff, kohei
-
 calc-grammar-xls-english-sc.diff, kohei
 
 # Support finding and replacing empty cells.
diff --git a/patches/dev300/calc-grammar-xls-english-offapi.diff b/patches/dev300/calc-grammar-xls-english-offapi.diff
deleted file mode 100644
index 2e0aef2..0000000
--- a/patches/dev300/calc-grammar-xls-english-offapi.diff
+++ /dev/null
@@ -1,22 +0,0 @@
----
- offapi/com/sun/star/sheet/FormulaLanguage.idl |    4 ++++
- 1 files changed, 4 insertions(+), 0 deletions(-)
-
-diff --git offapi/com/sun/star/sheet/FormulaLanguage.idl offapi/com/sun/star/sheet/FormulaLanguage.idl
-index c1fa4c1..d222373 100644
---- offapi/com/sun/star/sheet/FormulaLanguage.idl
-+++ offapi/com/sun/star/sheet/FormulaLanguage.idl
-@@ -60,6 +60,10 @@ constants FormulaLanguage
-      */
-     const long NATIVE   = 3;
- 
-+    /** Function names and operators as used in the English version of
-+        Excel.
-+     */
-+    const long XL_ENGLISH = 4;
- };
- 
- //=============================================================================
--- 
-1.7.0.1
-


More information about the ooo-build-commit mailing list