[ooo-build-commit] patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Jul 30 06:59:34 PDT 2009
patches/dev300/apply | 6
patches/dev300/sc-standard-filter-options-m16.diff | 416 +++++++++++++++++++++
patches/dev300/sc-standard-filter-options.diff | 245 ++++++------
3 files changed, 556 insertions(+), 111 deletions(-)
New commits:
commit f5cc2c326dccffe7c5009dadf9af0c8e1eeed06f
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Jul 30 09:58:00 2009 -0400
Adjusted a patch for ooo310-m17.
* patches/dev300/apply:
* patches/dev300/sc-standard-filter-options-m16.diff: old patch.
* patches/dev300/sc-standard-filter-options.diff: adjusted patch for
> ooo310-m16. But I haven't verified it to build yet.
diff --git a/patches/dev300/apply b/patches/dev300/apply
index f44dbdf..737080a 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -652,9 +652,15 @@ gcc4-visibility-sc.diff, i#53261, pmladek
# adds to Autofilter Empty-NonEmpty options bxc #62165
sc-autofilter-empty-nonempty.diff, i#35578, jody
+[ CalcFixes <= ooo310-m16 ]
+# Improves the standard filter options and menu. bxc #62187 #62495
+sc-standard-filter-options-m16.diff, i#35579, michael
+
+[ CalcFixes > ooo310-m16 ]
# Improves the standard filter options and menu. bxc #62187 #62495
sc-standard-filter-options.diff, i#35579, michael
+[ CalcFixes ]
# Saves and loads the standard filters in ods
sc-standard-filter-options-ods-hack.diff, i#35579, jonp
diff --git a/patches/dev300/sc-standard-filter-options-m16.diff b/patches/dev300/sc-standard-filter-options-m16.diff
new file mode 100644
index 0000000..7315a5b
--- /dev/null
+++ b/patches/dev300/sc-standard-filter-options-m16.diff
@@ -0,0 +1,416 @@
+--- sc/inc/global.hxx.old 2009-04-02 10:45:43.000000000 +0000
++++ sc/inc/global.hxx 2009-04-06 16:41:48.000000000 +0000
+@@ -727,7 +727,11 @@ enum ScQueryOp
+ SC_TOPVAL,
+ SC_BOTVAL,
+ SC_TOPPERC,
+- SC_BOTPERC
++ SC_BOTPERC,
++ SC_CONTAINS,
++ SC_DOES_NOT_CONTAIN,
++ SC_BEGINS_WITH,
++ SC_ENDS_WITH
+ };
+
+ // -----------------------------------------------------------------------
+--- sc/source/core/data/table3.cxx.old 2009-04-02 10:45:01.000000000 +0000
++++ sc/source/core/data/table3.cxx 2009-04-06 16:41:48.000000000 +0000
+@@ -31,6 +31,7 @@
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_sc.hxx"
+
++#include <i18nutil/unicode.hxx>
+ #include <rtl/math.hxx>
+ #include <unotools/textsearch.hxx>
+ #include <svtools/zforlist.hxx>
+@@ -928,6 +929,28 @@ BOOL ScTable::DoSubTotals( ScSubTotalPar
+ return bSpaceLeft;
+ }
+
++static BOOL HasNonWSInRange (const String& s, int start, int end)
++{
++ for (int i = start; i < end; ++i) {
++ if (!unicode::isSpace(s.GetChar(i)))
++ return TRUE;
++ }
++ return FALSE;
++}
++
++static BOOL IsMatch (BOOL bMatchWholeCell, ScQueryOp eOp, const String& s, int nMatchStart, int nMatchEnd)
++{
++ BOOL bBegin = HasNonWSInRange(s, 0, nMatchStart);
++ BOOL bEnd = HasNonWSInRange(s, nMatchEnd, s.Len());
++
++ if (bMatchWholeCell && (bBegin || bEnd))
++ return FALSE;
++ else if (eOp == SC_BEGINS_WITH && bBegin)
++ return FALSE;
++ else if (eOp == SC_ENDS_WITH && bEnd)
++ return FALSE;
++ return TRUE;
++}
+
+ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
+ BOOL* pSpecial /* =NULL */ , ScBaseCell* pCell /* =NULL */ ,
+@@ -1021,13 +1044,22 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+ }
+ }
+ }
+- else if ( (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) ||
++ else if ( (rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN ||
++ rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH ||
++ rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) ||
+ (rEntry.bQueryByString && (pCell ? pCell->HasStringData() :
+ HasStringData(
+ static_cast<SCCOL>(rEntry.nField),
+ nRow))))
+ { // by String
+ String aCellStr;
++
++ // Contains and Does not contain is similar to EQUAL and NOT EQUAL
++ // but with bMatchWholeCell set to false
++ if( rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN ||
++ rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH )
++ bMatchWholeCell = FALSE;
++
+ if ( pCell )
+ {
+ if (pCell->GetCellType() != CELLTYPE_NOTE)
+@@ -1040,7 +1072,9 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+ GetInputString( static_cast<SCCOL>(rEntry.nField), nRow, aCellStr );
+
+ BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
+- || (rEntry.eOp == SC_NOT_EQUAL)));
++ || (rEntry.eOp == SC_NOT_EQUAL) || (rEntry.eOp == SC_CONTAINS)
++ || (rEntry.eOp == SC_DOES_NOT_CONTAIN) || (rEntry.eOp == SC_BEGINS_WITH)
++ || (rEntry.eOp == SC_ENDS_WITH)));
+ BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp
+ && ((rEntry.eOp == SC_LESS_EQUAL)
+ || (rEntry.eOp == SC_GREATER_EQUAL)));
+@@ -1051,17 +1085,21 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+ BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
+ ->SearchFrwrd( aCellStr, &nStart, &nEnd );
+ // from 614 on, nEnd is behind the found text
+- if ( bMatch && bMatchWholeCell
+- && (nStart != 0 || nEnd != aCellStr.Len()) )
+- bMatch = FALSE; // RegExp must match entire cell string
++ if ( bMatch )
++ {
++ bMatch = IsMatch(bMatchWholeCell, rEntry.eOp, aCellStr, nStart, nEnd);
++ }
+ if ( bRealRegExp )
+- bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
++ bOk = ( ( rEntry.eOp == SC_NOT_EQUAL ||
++ rEntry.eOp == SC_DOES_NOT_CONTAIN ) ? !bMatch : bMatch );
+ else
+ bTestEqual = bMatch;
+ }
+ if ( !bRealRegExp )
+ {
+- if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL )
++ if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL ||
++ rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN ||
++ rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH )
+ {
+ if ( !rEntry.bQueryByString && rEntry.pStr->Len() == 0 )
+ {
+@@ -1070,8 +1108,6 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+ // don't find any string (isEqual would find empty string results in formula cells).
+ bOk = FALSE;
+ }
+- else if ( bMatchWholeCell )
+- bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
+ else
+ {
+ ::com::sun::star::uno::Sequence< sal_Int32 > xOff;
+@@ -1081,9 +1117,14 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+ String aQuer( pTransliteration->transliterate(
+ *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(),
+ &xOff ) );
+- bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
++ xub_StrLen nPos = aCell.Search( aQuer );
++ bOk = ( nPos != STRING_NOTFOUND );
++ if ( bOk ) {
++ bOk = IsMatch(bMatchWholeCell, rEntry.eOp, aCell, nPos, nPos+aQuer.Len());
++ }
+ }
+- if ( rEntry.eOp == SC_NOT_EQUAL )
++ if ( rEntry.eOp == SC_NOT_EQUAL ||
++ rEntry.eOp == SC_DOES_NOT_CONTAIN )
+ bOk = !bOk;
+ }
+ else
+--- sc/source/filter/excel/excimp8.cxx.old 2009-04-02 10:44:55.000000000 +0000
++++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:41:48.000000000 +0000
+@@ -426,6 +426,66 @@ void XclImpAutoFilterData::InsertQueryPa
+ }
+ }
+
++static void ExcelQueryToOooQuery( ScQueryEntry& rEntry, ScQueryParam& rParam )
++{
++ if( rEntry.pStr == NULL )
++ return;
++ if( rEntry.eOp != SC_EQUAL && rEntry.eOp != SC_NOT_EQUAL )
++ return;
++ xub_StrLen nLen = rEntry.pStr->Len();
++ if( nLen == 0 )
++ return;
++ BOOL bRegExp = FALSE;
++ for( int i = 0; i < nLen; ++i ) {
++ sal_Unicode c = rEntry.pStr->GetChar( i );
++ if( c == '*' ) {
++ if( rEntry.eOp == SC_NOT_EQUAL ) {
++ bRegExp = TRUE;
++ rEntry.eOp = SC_DOES_NOT_CONTAIN;
++ }
++ else if( rEntry.eOp == SC_DOES_NOT_CONTAIN )
++ ; // ignore
++ else if( i == 0 )
++ rEntry.eOp = SC_ENDS_WITH;
++ else if( i == nLen-1 )
++ rEntry.eOp = rEntry.eOp == SC_ENDS_WITH ? SC_CONTAINS : SC_BEGINS_WITH;
++ else
++ bRegExp = TRUE;
++ }
++ else if( c == '?' )
++ bRegExp = TRUE;
++ }
++ if( rEntry.pStr->GetChar( 0 ) == '*' )
++ rEntry.pStr->Erase( 0, 1 );
++ nLen = rEntry.pStr->Len();
++ if( nLen > 0 && rEntry.pStr->GetChar( nLen-1 ) == '*' ) {
++ rEntry.pStr->Erase( nLen-1, 1 );
++ --nLen;
++ }
++ if( bRegExp ) {
++ rParam.bRegExp = TRUE;
++ for( int i = 0; i < nLen; ++i ) {
++ sal_Unicode c = rEntry.pStr->GetChar( i );
++ switch( c ) {
++ case '*':
++ rEntry.pStr->ReplaceAscii( i, 1, ".*" );
++ ++i;
++ ++nLen;
++ break;
++ case '.':
++ rEntry.pStr->InsertAscii( "\\", i );
++ ++i;
++ ++nLen;
++ break;
++ case '?':
++ rEntry.pStr->ReplaceAscii( i, 1, "." );
++ break;
++ default: break;
++ }
++ }
++ }
++}
++
+ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
+ {
+ UINT16 nCol, nFlags;
+@@ -463,14 +523,14 @@ void XclImpAutoFilterData::ReadAutoFilte
+ BOOL bIgnore;
+
+ UINT8 nStrLen[ 2 ] = { 0, 0 };
+- String* pEntryStr[ 2 ] = { NULL, NULL };
++ ScQueryEntry *pQueryEntries[ 2 ] = { NULL, NULL };
+
+ for( nE = 0; nE < 2; nE++ )
+ {
+ if( nFirstEmpty < nCount )
+ {
+ ScQueryEntry& aEntry = aParam.GetEntry( nFirstEmpty );
+- pEntryStr[ nE ] = aEntry.pStr;
++ pQueryEntries[ nE ] = &aEntry;
+ bIgnore = FALSE;
+
+ rStrm >> nType >> nOper;
+@@ -558,8 +618,10 @@ void XclImpAutoFilterData::ReadAutoFilte
+ }
+
+ for( nE = 0; nE < 2; nE++ )
+- if( nStrLen[ nE ] && pEntryStr[ nE ] )
+- pEntryStr[ nE ]->Assign( rStrm.ReadUniString( nStrLen[ nE ] ) );
++ if( nStrLen[ nE ] && pQueryEntries[ nE ] ) {
++ pQueryEntries[ nE ]->pStr->Assign ( rStrm.ReadUniString( nStrLen[ nE ] ) );
++ ExcelQueryToOooQuery( *pQueryEntries[ nE ], aParam );
++ }
+ }
+ }
+
+--- sc/source/filter/excel/excrecds.cxx.old 2009-04-02 10:44:55.000000000 +0000
++++ sc/source/filter/excel/excrecds.cxx 2009-04-06 16:41:48.000000000 +0000
+@@ -693,13 +693,50 @@ BOOL XclExpAutofilter::AddCondition( ScQ
+ return TRUE;
+ }
+
+-BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry )
++static String OooQueryToExcelQuery( const ScQueryEntry& rEntry, const ScQueryParam& rParam )
++{
++ String aStr (*rEntry.pStr);
++ BOOL bHaveRegex = rParam.bRegExp;
++ if( bHaveRegex ) {
++ xub_StrLen nLen = aStr.Len();
++ for( int i = 0; i < nLen; ++i ) {
++ sal_Unicode c = aStr.GetChar( i );
++ if( c == '.' ) {
++ if( i+1 < nLen && aStr.GetChar( i+1 ) == '*' ) {
++ aStr.ReplaceAscii( i, 2, "*" );
++ --nLen;
++ }
++ else
++ aStr.ReplaceAscii( i, 1, "?" );
++ }
++ else if( c == '\\' ) {
++ aStr.Erase( i, 1 );
++ --nLen;
++ }
++ }
++ }
++ if( rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN )
++ aStr.InsertAscii( "*" , 0 );
++ if( rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN )
++ aStr.AppendAscii( "*" );
++ return aStr;
++}
++
++BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry, const ScQueryParam& rParam )
+ {
+ BOOL bConflict = FALSE;
+ String sText;
+
+- if( rEntry.pStr )
+- sText.Assign( *rEntry.pStr );
++ ScQueryOp eOp = rEntry.eOp;
++ if( rEntry.pStr ) {
++ if (eOp != SC_BEGINS_WITH && eOp != SC_ENDS_WITH &&
++ eOp != SC_CONTAINS && eOp != SC_DOES_NOT_CONTAIN)
++ sText.Assign( *rEntry.pStr );
++ else {
++ sText.Assign( OooQueryToExcelQuery( rEntry, rParam ) );
++ eOp = eOp == SC_DOES_NOT_CONTAIN ? SC_NOT_EQUAL : SC_EQUAL;
++ }
++ }
+
+ BOOL bLen = sText.Len() > 0;
+
+@@ -718,7 +755,7 @@ BOOL XclExpAutofilter::AddEntry( const S
+
+ // top10 flags
+ UINT16 nNewFlags = 0x0000;
+- switch( rEntry.eOp )
++ switch( eOp )
+ {
+ case SC_TOPVAL:
+ nNewFlags = (EXC_AFFLAG_TOP10 | EXC_AFFLAG_TOP10TOP);
+@@ -751,7 +788,7 @@ BOOL XclExpAutofilter::AddEntry( const S
+ UINT8 nType = bIsNum ? EXC_AFTYPE_DOUBLE : EXC_AFTYPE_STRING;
+ UINT8 nOper = EXC_AFOPER_NONE;
+
+- switch( rEntry.eOp )
++ switch( eOp )
+ {
+ case SC_EQUAL: nOper = EXC_AFOPER_EQUAL; break;
+ case SC_LESS: nOper = EXC_AFOPER_LESS; break;
+@@ -900,7 +937,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( co
+ bConflict = (nEntry == 1) && (rEntry.eConnect == SC_OR) &&
+ (nFirstField != rEntry.nField);
+ if( !bConflict )
+- bConflict = pFilter->AddEntry( rEntry );
++ bConflict = pFilter->AddEntry( rEntry, aParam );
+ }
+ }
+
+--- sc/source/filter/inc/excrecds.hxx.old 2009-04-02 10:44:58.000000000 +0000
++++ sc/source/filter/inc/excrecds.hxx 2009-04-06 16:41:48.000000000 +0000
+@@ -442,7 +442,7 @@ public:
+ inline BOOL HasCondition() const { return !aCond[ 0 ].IsEmpty(); }
+ inline BOOL HasTop10() const { return ::get_flag( nFlags, EXC_AFFLAG_TOP10 ); }
+
+- BOOL AddEntry( const ScQueryEntry& rEntry );
++ BOOL AddEntry( const ScQueryEntry& rEntry, const ScQueryParam& rParam );
+
+ virtual void SaveXml( XclExpXmlStream& rStrm );
+ };
+--- sc/source/ui/src/filter.src.old 2009-04-02 10:45:23.000000000 +0000
++++ sc/source/ui/src/filter.src 2009-04-06 16:41:48.000000000 +0000
+@@ -121,16 +121,20 @@ ModelessDialog RID_SCDLG_FILTER
+ DropDown = TRUE ;
+ stringlist [ en-US ] =
+ {
+- < "=" ; Default ; > ;
++ < "Equals" ; Default ; > ;
+ < "<" ; Default ; > ;
+ < ">" ; Default ; > ;
+ < "<=" ; Default ; > ;
+ < ">=" ; Default ; > ;
+- < "<>" ; Default ; > ;
++ < "Not equals" ; Default ; > ;
+ < "Largest" ; Default ; > ;
+ < "Smallest" ; Default ; > ;
+ < "Largest %" ; Default ; > ;
+ < "Smallest %" ; Default ; > ;
++ < "Contains" ; Default ; > ;
++ < "Does not Contain" ; Default ; > ;
++ < "Begins with" ; Default ; > ;
++ < "Ends with" ; Default ; > ;
+ };
+ };
+ ListBox LB_COND2
+@@ -142,16 +146,20 @@ ModelessDialog RID_SCDLG_FILTER
+ DropDown = TRUE ;
+ stringlist [ en-US ] =
+ {
+- < "=" ; Default ; > ;
++ < "Equals" ; Default ; > ;
+ < "<" ; Default ; > ;
+ < ">" ; Default ; > ;
+ < "<=" ; Default ; > ;
+ < ">=" ; Default ; > ;
+- < "<>" ; Default ; > ;
++ < "Not equals" ; Default ; > ;
+ < "Largest" ; Default ; > ;
+ < "Smallest" ; Default ; > ;
+ < "Largest %" ; Default ; > ;
+ < "Smallest %" ; Default ; > ;
++ < "Contains" ; Default ; > ;
++ < "Does not Contain" ; Default ; > ;
++ < "Begins with" ; Default ; > ;
++ < "Ends with" ; Default ; > ;
+ };
+ };
+ ListBox LB_COND3
+@@ -163,16 +171,20 @@ ModelessDialog RID_SCDLG_FILTER
+ DropDown = TRUE ;
+ stringlist [ en-US ] =
+ {
+- < "=" ; Default ; > ;
++ < "Equals" ; Default ; > ;
+ < "<" ; Default ; > ;
+ < ">" ; Default ; > ;
+ < "<=" ; Default ; > ;
+ < ">=" ; Default ; > ;
+- < "<>" ; Default ; > ;
++ < "Not equals" ; Default ; > ;
+ < "Largest" ; Default ; > ;
+ < "Smallest" ; Default ; > ;
+ < "Largest %" ; Default ; > ;
+ < "Smallest %" ; Default ; > ;
++ < "Contains" ; Default ; > ;
++ < "Does not Contain" ; Default ; > ;
++ < "Begins with" ; Default ; > ;
++ < "Ends with" ; Default ; > ;
+ };
+ };
+ ComboBox ED_VAL1
+--- sc/util/makefile.mk.old 2009-04-06 16:41:39.000000000 +0000
++++ sc/util/makefile.mk 2009-04-06 16:41:48.000000000 +0000
+@@ -94,6 +94,7 @@ SHL1STDLIBS= \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
++ $(I18NUTILLIB) \
+ $(I18NISOLANGLIB) \
+ $(UNOTOOLSLIB) \
+ $(SOTLIB) \
diff --git a/patches/dev300/sc-standard-filter-options.diff b/patches/dev300/sc-standard-filter-options.diff
index 7315a5b..10e08c6 100644
--- a/patches/dev300/sc-standard-filter-options.diff
+++ b/patches/dev300/sc-standard-filter-options.diff
@@ -1,6 +1,8 @@
---- sc/inc/global.hxx.old 2009-04-02 10:45:43.000000000 +0000
-+++ sc/inc/global.hxx 2009-04-06 16:41:48.000000000 +0000
-@@ -727,7 +727,11 @@ enum ScQueryOp
+diff --git sc/inc/global.hxx sc/inc/global.hxx
+index f084b61..c6ab232 100644
+--- sc/inc/global.hxx
++++ sc/inc/global.hxx
+@@ -728,7 +728,11 @@ enum ScQueryOp
SC_TOPVAL,
SC_BOTVAL,
SC_TOPPERC,
@@ -13,8 +15,10 @@
};
// -----------------------------------------------------------------------
---- sc/source/core/data/table3.cxx.old 2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/table3.cxx 2009-04-06 16:41:48.000000000 +0000
+diff --git sc/source/core/data/table3.cxx sc/source/core/data/table3.cxx
+index eb3640a..c690b3e 100644
+--- sc/source/core/data/table3.cxx
++++ sc/source/core/data/table3.cxx
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
@@ -23,36 +27,37 @@
#include <rtl/math.hxx>
#include <unotools/textsearch.hxx>
#include <svtools/zforlist.hxx>
-@@ -928,6 +929,28 @@ BOOL ScTable::DoSubTotals( ScSubTotalPar
+@@ -928,6 +929,29 @@ BOOL ScTable::DoSubTotals( ScSubTotalParam& rParam )
return bSpaceLeft;
}
+static BOOL HasNonWSInRange (const String& s, int start, int end)
+{
-+ for (int i = start; i < end; ++i) {
-+ if (!unicode::isSpace(s.GetChar(i)))
-+ return TRUE;
-+ }
-+ return FALSE;
++ for (int i = start; i < end; ++i)
++ {
++ if (!unicode::isSpace(s.GetChar(i)))
++ return TRUE;
++ }
++ return FALSE;
+}
+
+static BOOL IsMatch (BOOL bMatchWholeCell, ScQueryOp eOp, const String& s, int nMatchStart, int nMatchEnd)
+{
-+ BOOL bBegin = HasNonWSInRange(s, 0, nMatchStart);
-+ BOOL bEnd = HasNonWSInRange(s, nMatchEnd, s.Len());
++ BOOL bBegin = HasNonWSInRange(s, 0, nMatchStart);
++ BOOL bEnd = HasNonWSInRange(s, nMatchEnd, s.Len());
+
-+ if (bMatchWholeCell && (bBegin || bEnd))
-+ return FALSE;
-+ else if (eOp == SC_BEGINS_WITH && bBegin)
-+ return FALSE;
-+ else if (eOp == SC_ENDS_WITH && bEnd)
-+ return FALSE;
-+ return TRUE;
++ if (bMatchWholeCell && (bBegin || bEnd))
++ return FALSE;
++ else if (eOp == SC_BEGINS_WITH && bBegin)
++ return FALSE;
++ else if (eOp == SC_ENDS_WITH && bEnd)
++ return FALSE;
++ return TRUE;
+}
BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
BOOL* pSpecial /* =NULL */ , ScBaseCell* pCell /* =NULL */ ,
-@@ -1021,13 +1044,22 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+@@ -1021,13 +1045,22 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
}
}
}
@@ -76,7 +81,7 @@
if ( pCell )
{
if (pCell->GetCellType() != CELLTYPE_NOTE)
-@@ -1040,7 +1072,9 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+@@ -1040,7 +1073,9 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
GetInputString( static_cast<SCCOL>(rEntry.nField), nRow, aCellStr );
BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
@@ -87,7 +92,7 @@
BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp
&& ((rEntry.eOp == SC_LESS_EQUAL)
|| (rEntry.eOp == SC_GREATER_EQUAL)));
-@@ -1051,17 +1085,21 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+@@ -1051,17 +1086,21 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
->SearchFrwrd( aCellStr, &nStart, &nEnd );
// from 614 on, nEnd is behind the found text
@@ -114,7 +119,7 @@
{
if ( !rEntry.bQueryByString && rEntry.pStr->Len() == 0 )
{
-@@ -1070,8 +1108,6 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+@@ -1070,8 +1109,6 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
// don't find any string (isEqual would find empty string results in formula cells).
bOk = FALSE;
}
@@ -122,94 +127,102 @@
- bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
else
{
- ::com::sun::star::uno::Sequence< sal_Int32 > xOff;
-@@ -1081,9 +1117,14 @@ BOOL ScTable::ValidQuery(SCROW nRow, con
+ String aCell( pTransliteration->transliterate(
+@@ -1080,9 +1117,14 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
String aQuer( pTransliteration->transliterate(
*rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(),
- &xOff ) );
+ NULL ) );
- bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
-+ xub_StrLen nPos = aCell.Search( aQuer );
++ xub_StrLen nPos = aCell.Search( aQuer );
+ bOk = ( nPos != STRING_NOTFOUND );
-+ if ( bOk ) {
-+ bOk = IsMatch(bMatchWholeCell, rEntry.eOp, aCell, nPos, nPos+aQuer.Len());
-+ }
++ if ( bOk )
++ {
++ bOk = IsMatch(bMatchWholeCell, rEntry.eOp, aCell, nPos, nPos+aQuer.Len());
++ }
}
- if ( rEntry.eOp == SC_NOT_EQUAL )
-+ if ( rEntry.eOp == SC_NOT_EQUAL ||
-+ rEntry.eOp == SC_DOES_NOT_CONTAIN )
++ if ( rEntry.eOp == SC_NOT_EQUAL || rEntry.eOp == SC_DOES_NOT_CONTAIN )
bOk = !bOk;
}
else
---- sc/source/filter/excel/excimp8.cxx.old 2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:41:48.000000000 +0000
-@@ -426,6 +426,66 @@ void XclImpAutoFilterData::InsertQueryPa
+diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
+index d0d132c..a23eb24 100644
+--- sc/source/filter/excel/excimp8.cxx
++++ sc/source/filter/excel/excimp8.cxx
+@@ -426,6 +426,72 @@ void XclImpAutoFilterData::InsertQueryParam()
}
}
+static void ExcelQueryToOooQuery( ScQueryEntry& rEntry, ScQueryParam& rParam )
+{
-+ if( rEntry.pStr == NULL )
-+ return;
-+ if( rEntry.eOp != SC_EQUAL && rEntry.eOp != SC_NOT_EQUAL )
-+ return;
-+ xub_StrLen nLen = rEntry.pStr->Len();
-+ if( nLen == 0 )
-+ return;
-+ BOOL bRegExp = FALSE;
-+ for( int i = 0; i < nLen; ++i ) {
-+ sal_Unicode c = rEntry.pStr->GetChar( i );
-+ if( c == '*' ) {
-+ if( rEntry.eOp == SC_NOT_EQUAL ) {
-+ bRegExp = TRUE;
-+ rEntry.eOp = SC_DOES_NOT_CONTAIN;
-+ }
-+ else if( rEntry.eOp == SC_DOES_NOT_CONTAIN )
-+ ; // ignore
-+ else if( i == 0 )
-+ rEntry.eOp = SC_ENDS_WITH;
-+ else if( i == nLen-1 )
-+ rEntry.eOp = rEntry.eOp == SC_ENDS_WITH ? SC_CONTAINS : SC_BEGINS_WITH;
-+ else
-+ bRegExp = TRUE;
-+ }
-+ else if( c == '?' )
-+ bRegExp = TRUE;
-+ }
-+ if( rEntry.pStr->GetChar( 0 ) == '*' )
-+ rEntry.pStr->Erase( 0, 1 );
-+ nLen = rEntry.pStr->Len();
-+ if( nLen > 0 && rEntry.pStr->GetChar( nLen-1 ) == '*' ) {
-+ rEntry.pStr->Erase( nLen-1, 1 );
-+ --nLen;
-+ }
-+ if( bRegExp ) {
-+ rParam.bRegExp = TRUE;
-+ for( int i = 0; i < nLen; ++i ) {
-+ sal_Unicode c = rEntry.pStr->GetChar( i );
-+ switch( c ) {
-+ case '*':
-+ rEntry.pStr->ReplaceAscii( i, 1, ".*" );
-+ ++i;
-+ ++nLen;
-+ break;
-+ case '.':
-+ rEntry.pStr->InsertAscii( "\\", i );
-+ ++i;
-+ ++nLen;
-+ break;
-+ case '?':
-+ rEntry.pStr->ReplaceAscii( i, 1, "." );
-+ break;
-+ default: break;
-+ }
-+ }
-+ }
++ if( rEntry.pStr == NULL )
++ return;
++ if( rEntry.eOp != SC_EQUAL && rEntry.eOp != SC_NOT_EQUAL )
++ return;
++ xub_StrLen nLen = rEntry.pStr->Len();
++ if( nLen == 0 )
++ return;
++ BOOL bRegExp = FALSE;
++ for( int i = 0; i < nLen; ++i )
++ {
++ sal_Unicode c = rEntry.pStr->GetChar( i );
++ if( c == '*' )
++ {
++ if( rEntry.eOp == SC_NOT_EQUAL )
++ {
++ bRegExp = TRUE;
++ rEntry.eOp = SC_DOES_NOT_CONTAIN;
++ }
++ else if( rEntry.eOp == SC_DOES_NOT_CONTAIN )
++ ; // ignore
++ else if( i == 0 )
++ rEntry.eOp = SC_ENDS_WITH;
++ else if( i == nLen-1 )
++ rEntry.eOp = rEntry.eOp == SC_ENDS_WITH ? SC_CONTAINS : SC_BEGINS_WITH;
++ else
++ bRegExp = TRUE;
++ }
++ else if( c == '?' )
++ bRegExp = TRUE;
++ }
++ if( rEntry.pStr->GetChar( 0 ) == '*' )
++ rEntry.pStr->Erase( 0, 1 );
++ nLen = rEntry.pStr->Len();
++ if( nLen > 0 && rEntry.pStr->GetChar( nLen-1 ) == '*' )
++ {
++ rEntry.pStr->Erase( nLen-1, 1 );
++ --nLen;
++ }
++ if( bRegExp )
++ {
++ rParam.bRegExp = TRUE;
++ for( int i = 0; i < nLen; ++i )
++ {
++ sal_Unicode c = rEntry.pStr->GetChar( i );
++ switch( c ) {
++ case '*':
++ rEntry.pStr->ReplaceAscii( i, 1, ".*" );
++ ++i;
++ ++nLen;
++ break;
++ case '.':
++ rEntry.pStr->InsertAscii( "\\", i );
++ ++i;
++ ++nLen;
++ break;
++ case '?':
++ rEntry.pStr->ReplaceAscii( i, 1, "." );
++ break;
++ default: break;
++ }
++ }
++ }
+}
+
void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
{
UINT16 nCol, nFlags;
-@@ -463,14 +523,14 @@ void XclImpAutoFilterData::ReadAutoFilte
+@@ -463,14 +529,14 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
BOOL bIgnore;
UINT8 nStrLen[ 2 ] = { 0, 0 };
@@ -226,22 +239,25 @@
bIgnore = FALSE;
rStrm >> nType >> nOper;
-@@ -558,8 +618,10 @@ void XclImpAutoFilterData::ReadAutoFilte
+@@ -558,8 +624,11 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
}
for( nE = 0; nE < 2; nE++ )
- if( nStrLen[ nE ] && pEntryStr[ nE ] )
- pEntryStr[ nE ]->Assign( rStrm.ReadUniString( nStrLen[ nE ] ) );
-+ if( nStrLen[ nE ] && pQueryEntries[ nE ] ) {
++ if( nStrLen[ nE ] && pQueryEntries[ nE ] )
++ {
+ pQueryEntries[ nE ]->pStr->Assign ( rStrm.ReadUniString( nStrLen[ nE ] ) );
+ ExcelQueryToOooQuery( *pQueryEntries[ nE ], aParam );
+ }
}
}
---- sc/source/filter/excel/excrecds.cxx.old 2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/excrecds.cxx 2009-04-06 16:41:48.000000000 +0000
-@@ -693,13 +693,50 @@ BOOL XclExpAutofilter::AddCondition( ScQ
+diff --git sc/source/filter/excel/excrecds.cxx sc/source/filter/excel/excrecds.cxx
+index 1a4e746..6868f7b 100644
+--- sc/source/filter/excel/excrecds.cxx
++++ sc/source/filter/excel/excrecds.cxx
+@@ -693,13 +693,52 @@ BOOL XclExpAutofilter::AddCondition( ScQueryConnect eConn, UINT8 nType, UINT8 nO
return TRUE;
}
@@ -280,14 +296,15 @@
BOOL bConflict = FALSE;
String sText;
-- if( rEntry.pStr )
-- sText.Assign( *rEntry.pStr );
+ ScQueryOp eOp = rEntry.eOp;
-+ if( rEntry.pStr ) {
+ if( rEntry.pStr )
+- sText.Assign( *rEntry.pStr );
++ {
+ if (eOp != SC_BEGINS_WITH && eOp != SC_ENDS_WITH &&
+ eOp != SC_CONTAINS && eOp != SC_DOES_NOT_CONTAIN)
+ sText.Assign( *rEntry.pStr );
-+ else {
++ else
++ {
+ sText.Assign( OooQueryToExcelQuery( rEntry, rParam ) );
+ eOp = eOp == SC_DOES_NOT_CONTAIN ? SC_NOT_EQUAL : SC_EQUAL;
+ }
@@ -295,7 +312,7 @@
BOOL bLen = sText.Len() > 0;
-@@ -718,7 +755,7 @@ BOOL XclExpAutofilter::AddEntry( const S
+@@ -718,7 +757,7 @@ BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry )
// top10 flags
UINT16 nNewFlags = 0x0000;
@@ -304,7 +321,7 @@
{
case SC_TOPVAL:
nNewFlags = (EXC_AFFLAG_TOP10 | EXC_AFFLAG_TOP10TOP);
-@@ -751,7 +788,7 @@ BOOL XclExpAutofilter::AddEntry( const S
+@@ -751,7 +790,7 @@ BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry )
UINT8 nType = bIsNum ? EXC_AFTYPE_DOUBLE : EXC_AFTYPE_STRING;
UINT8 nOper = EXC_AFOPER_NONE;
@@ -313,7 +330,7 @@
{
case SC_EQUAL: nOper = EXC_AFOPER_EQUAL; break;
case SC_LESS: nOper = EXC_AFOPER_LESS; break;
-@@ -900,7 +937,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( co
+@@ -900,7 +939,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) :
bConflict = (nEntry == 1) && (rEntry.eConnect == SC_OR) &&
(nFirstField != rEntry.nField);
if( !bConflict )
@@ -322,8 +339,10 @@
}
}
---- sc/source/filter/inc/excrecds.hxx.old 2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/excrecds.hxx 2009-04-06 16:41:48.000000000 +0000
+diff --git sc/source/filter/inc/excrecds.hxx sc/source/filter/inc/excrecds.hxx
+index 217c30c..048a910 100644
+--- sc/source/filter/inc/excrecds.hxx
++++ sc/source/filter/inc/excrecds.hxx
@@ -442,7 +442,7 @@ public:
inline BOOL HasCondition() const { return !aCond[ 0 ].IsEmpty(); }
inline BOOL HasTop10() const { return ::get_flag( nFlags, EXC_AFFLAG_TOP10 ); }
@@ -333,8 +352,10 @@
virtual void SaveXml( XclExpXmlStream& rStrm );
};
---- sc/source/ui/src/filter.src.old 2009-04-02 10:45:23.000000000 +0000
-+++ sc/source/ui/src/filter.src 2009-04-06 16:41:48.000000000 +0000
+diff --git sc/source/ui/src/filter.src sc/source/ui/src/filter.src
+index 5eedbb7..d9f1fe1 100644
+--- sc/source/ui/src/filter.src
++++ sc/source/ui/src/filter.src
@@ -121,16 +121,20 @@ ModelessDialog RID_SCDLG_FILTER
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -404,8 +425,10 @@
};
};
ComboBox ED_VAL1
---- sc/util/makefile.mk.old 2009-04-06 16:41:39.000000000 +0000
-+++ sc/util/makefile.mk 2009-04-06 16:41:48.000000000 +0000
+diff --git sc/util/makefile.mk sc/util/makefile.mk
+index 9d2706a..b420951 100644
+--- sc/util/makefile.mk
++++ sc/util/makefile.mk
@@ -94,6 +94,7 @@ SHL1STDLIBS= \
$(VOSLIB) \
$(SALLIB) \
More information about the ooo-build-commit
mailing list