User: timar   
Date: 06/02/28 13:25:06

Added:
 /hu/src/2.0.2/Patches/
  i59853-dejavu.diff, SRC680_m106_sc_naturalsort.diff

Modified:
 /hu/src/2.0.2/Patches/
  i53055-ww8scan-m154.diff

Log:
 updated patches

File Changes:

Directory: /hu/src/2.0.2/Patches/
=================================

File [changed]: i53055-ww8scan-m154.diff
Url: 
http://hu.openoffice.org/source/browse/hu/src/2.0.2/Patches/i53055-ww8scan-m154.diff?r1=1.1&r2=1.2
Delta lines:  +85 -86
---------------------
--- i53055-ww8scan-m154.diff    11 Feb 2006 22:25:34 -0000      1.1
+++ i53055-ww8scan-m154.diff    28 Feb 2006 21:25:03 -0000      1.2
@@ -1,86 +1,5 @@
---- sw/source/filter/ww8/ww8scan.hxx.orig      2006-02-03 13:26:03.000000000 
-0800
-+++ sw/source/filter/ww8/ww8scan.hxx   2006-02-02 23:46:15.000000000 -0800
-@@ -63,6 +63,10 @@
- #include <errhdl.hxx>       // ASSERT()
- #endif
- 
-+#ifndef WW_HASH_WRAP_HXX
-+#include "hash_wrap.hxx"
-+#endif
-+
- #ifndef WW_SORTEDARRAY_HXX
- #include "sortedarray.hxx"
- #endif
-@@ -124,10 +128,10 @@
-     unsigned int nVari : 2;
- };
- 
--//a managed sorted sequence of sprminfos
--typedef ww::SortedArray<SprmInfo> wwSprmSearcher;
--//a managed sorted sequence of sprms
--typedef ww::SortedArray<sal_uInt16> wwSprmSequence;
-+inline bool operator==(const SprmInfo &rFirst, const SprmInfo &rSecond);
-+
-+typedef ww::WrappedHash<SprmInfo> wwSprmSearcher;
-+typedef ww::WrappedHash<sal_uInt16> wwSprmSequence;
- 
- //wwSprmParser knows how to take a sequence of bytes and split it up into
- //sprms and their arguments
---- sw/source/filter/ww8/ww8scan.cxx.orig      2006-02-03 13:26:12.000000000 
-0800
-+++ sw/source/filter/ww8/ww8scan.cxx   2006-02-02 23:46:15.000000000 -0800
-@@ -121,11 +121,22 @@
-     return bRet;
- }
- 
--bool operator==(const SprmInfo &rFirst, const SprmInfo &rSecond)
-+inline bool operator==(const SprmInfo &rFirst, const SprmInfo &rSecond)
- {
-     return (rFirst.nId == rSecond.nId);
- }
- 
-+namespace std
-+{
-+      template<> struct hash<SprmInfo> 
-+      {
-+              size_t operator()(const SprmInfo &a) const  
-+                      { 
-+                              return a.nId;  
-+                      }
-+      };
-+}
-+
- bool operator<(const SprmInfo &rFirst, const SprmInfo &rSecond)
- {
-     return (rFirst.nId < rSecond.nId);
-@@ -135,7 +146,7 @@
- {
-     //double lock me
-     // WW7- Sprms
--    static SprmInfo aSprms[] =
-+    static const SprmInfo aSprms[] =
-     {
-         {  0, 0, L_FIX}, // "Default-sprm",  wird uebersprungen
-         {  2, 1, L_FIX}, // "sprmPIstd",  pap.istd (style code)
-@@ -287,7 +298,7 @@
- {
-     //double lock me
-     // WW7- Sprms
--    static SprmInfo aSprms[] =
-+    static const SprmInfo aSprms[] =
-     {
-         {  0, 0, L_FIX}, // "Default-sprm",  wird uebersprungen
-         {  2, 2, L_FIX}, // "sprmPIstd",  pap.istd (style code)
-@@ -469,7 +480,7 @@
- {
-     //double lock me
-     //WW8+ Sprms
--    static SprmInfo aSprms[] =
-+    static const SprmInfo aSprms[] =
-     {
-         {     0, 0, L_FIX}, // "Default-sprm"/ wird uebersprungen
-         {0x4600, 2, L_FIX}, // "sprmPIstd" pap.istd;istd (style code);short;
---- /dev/null  2006-01-30 08:23:25.064242500 -0800
-+++ sw/source/filter/ww8/hash_wrap.hxx 2006-02-03 13:11:27.000000000 -0800
+--- /dev/null  2006-02-17 12:27:48.516083250 -0800
++++ sw/source/filter/ww8/hash_wrap.hxx 2006-02-16 16:07:51.000000000 -0800
 @@ -0,0 +1,136 @@
 +/*************************************************************************
 + *
@@ -88,9 +7,9 @@
 + *
 + *  $RCSfile: i53055-ww8scan-m154.diff,v $
 + *
-+ *  $Revision: 1.1 $
++ *  $Revision: 1.2 $
 + *
-+ *  last change: $Author: timar $ $Date: 2006/02/11 22:25:34 $
++ *  last change: $Author: timar $ $Date: 2006/02/28 21:25:03 $
 + *
 + *  The Contents of this file are made available subject to
 + *  the terms of GNU Lesser General Public License Version 2.1.
@@ -143,10 +62,10 @@
 +        @author
 +        <a href="mailto:[EMAIL PROTECTED]">Michael Leibowitz</a>
 +    */
-+    template<class C> class WrappedHash
++    template<class C, class HashFcn = std::hash<C> > class WrappedHash
 +    {
 +    private:
-+        std::hash_set<C> mHashSet;
++        std::hash_set<C, HashFcn> mHashSet;
 +
 +        //No copying
 +        WrappedHash(const WrappedHash&);
@@ -155,7 +74,7 @@
 +        //Find an entry, return its address if found and 0 if not
 +        const C* search(C aSrch) const
 +        {
-+            typename std::hash_set<C>::const_iterator it;
++            typename std::hash_set<C, HashFcn>::const_iterator it;
 +            it= mHashSet.find(aSrch);
 +            if (it != mHashSet.end())
 +                return &(*it);
@@ -218,3 +137,83 @@
 +#endif
 +
 +/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+--- sw/source/filter/ww8/ww8scan.hxx.orig      2006-02-17 14:19:52.000000000 
-0800
++++ sw/source/filter/ww8/ww8scan.hxx   2006-02-17 13:39:08.000000000 -0800
+@@ -63,6 +63,10 @@
+ #include <errhdl.hxx>       // ASSERT()
+ #endif
+ 
++#ifndef WW_HASH_WRAP_HXX
++#include "hash_wrap.hxx"
++#endif
++
+ #ifndef WW_SORTEDARRAY_HXX
+ #include "sortedarray.hxx"
+ #endif
+@@ -124,10 +128,18 @@
+     unsigned int nVari : 2;
+ };
+ 
+-//a managed sorted sequence of sprminfos
+-typedef ww::SortedArray<SprmInfo> wwSprmSearcher;
+-//a managed sorted sequence of sprms
+-typedef ww::SortedArray<sal_uInt16> wwSprmSequence;
++struct SprmInfoHash
++{
++    size_t operator()(const SprmInfo &a) const
++        {
++            return a.nId;
++        }
++};
++
++inline bool operator==(const SprmInfo &rFirst, const SprmInfo &rSecond);
++
++typedef ww::WrappedHash<SprmInfo, SprmInfoHash> wwSprmSearcher;
++typedef ww::WrappedHash<sal_uInt16> wwSprmSequence;
+ 
+ //wwSprmParser knows how to take a sequence of bytes and split it up into
+ //sprms and their arguments
+--- sw/source/filter/ww8/ww8scan.cxx.orig      2006-02-17 14:19:48.000000000 
-0800
++++ sw/source/filter/ww8/ww8scan.cxx   2006-02-16 16:32:46.000000000 -0800
+@@ -121,21 +121,16 @@
+     return bRet;
+ }
+ 
+-bool operator==(const SprmInfo &rFirst, const SprmInfo &rSecond)
++inline bool operator==(const SprmInfo &rFirst, const SprmInfo &rSecond)
+ {
+     return (rFirst.nId == rSecond.nId);
+ }
+ 
+-bool operator<(const SprmInfo &rFirst, const SprmInfo &rSecond)
+-{
+-    return (rFirst.nId < rSecond.nId);
+-}
+-
+ const wwSprmSearcher *wwSprmParser::GetWW2SprmSearcher()
+ {
+     //double lock me
+     // WW7- Sprms
+-    static SprmInfo aSprms[] =
++    static const SprmInfo aSprms[] =
+     {
+         {  0, 0, L_FIX}, // "Default-sprm",  wird uebersprungen
+         {  2, 1, L_FIX}, // "sprmPIstd",  pap.istd (style code)
+@@ -287,7 +282,7 @@
+ {
+     //double lock me
+     // WW7- Sprms
+-    static SprmInfo aSprms[] =
++    static const SprmInfo aSprms[] =
+     {
+         {  0, 0, L_FIX}, // "Default-sprm",  wird uebersprungen
+         {  2, 2, L_FIX}, // "sprmPIstd",  pap.istd (style code)
+@@ -469,7 +464,7 @@
+ {
+     //double lock me
+     //WW8+ Sprms
+-    static SprmInfo aSprms[] =
++    static const SprmInfo aSprms[] =
+     {
+         {     0, 0, L_FIX}, // "Default-sprm"/ wird uebersprungen
+         {0x4600, 2, L_FIX}, // "sprmPIstd" pap.istd;istd (style code);short;

File [added]: i59853-dejavu.diff
Url: 
http://hu.openoffice.org/source/browse/hu/src/2.0.2/Patches/i59853-dejavu.diff?rev=1.1&content-type=text/vnd.viewcvs-markup
Added lines: 0
--------------

File [added]: SRC680_m106_sc_naturalsort.diff
Url: 
http://hu.openoffice.org/source/browse/hu/src/2.0.2/Patches/SRC680_m106_sc_naturalsort.diff?rev=1.1&content-type=text/vnd.viewcvs-markup
Added lines: 711
----------------
Index: sc/inc/dbcolect.hxx
===================================================================
RCS file: /cvs/sc/sc/inc/dbcolect.hxx,v
retrieving revision 1.8
diff -u -r1.8 dbcolect.hxx
--- sc/inc/dbcolect.hxx 14 Jan 2005 11:58:41 -0000      1.8
+++ sc/inc/dbcolect.hxx 13 Jul 2005 04:33:46 -0000
@@ -112,6 +112,7 @@
        BOOL                    bStripData;
        // SortParam
        BOOL                    bSortCaseSens;
+       BOOL                    bSortNaturalSort;
        BOOL                    bIncludePattern;
        BOOL                    bSortInplace;
        BOOL                    bSortUserDef;
Index: sc/inc/global.hxx
===================================================================
RCS file: /cvs/sc/sc/inc/global.hxx,v
retrieving revision 1.42
diff -u -r1.42 global.hxx
--- sc/inc/global.hxx   13 Jan 2005 17:21:00 -0000      1.42
+++ sc/inc/global.hxx   13 Jul 2005 04:33:46 -0000
@@ -918,6 +918,7 @@
        BOOL                    bByRow;
        BOOL                    bInplace;
        BOOL                    bCaseSens;
+       BOOL                    bNaturalSort;
        BOOL                    bRegExp;
     BOOL            bMixedComparison;   // whether numbers are smaller than 
strings
        BOOL                    bDuplicate;
Index: sc/inc/sc.hrc
===================================================================
RCS file: /cvs/sc/sc/inc/sc.hrc,v
retrieving revision 1.48
diff -u -r1.48 sc.hrc
--- sc/inc/sc.hrc       17 Feb 2005 11:17:32 -0000      1.48
+++ sc/inc/sc.hrc       13 Jul 2005 04:33:47 -0000
@@ -1116,6 +1116,7 @@
 #define SID_SORT_CASESENS              (SC_PARAM_START+2)
 #define SID_SORT_ATTRIBS               (SC_PARAM_START+3)
 #define SID_SORT_USERDEF               (SC_PARAM_START+4)
+#define SID_SORT_NATURALSORT   (SC_PARAM_START+5)
 
 // Resourcen -------------------------------------------------------------
 
Index: sc/inc/sortparam.hxx
===================================================================
RCS file: /cvs/sc/sc/inc/sortparam.hxx,v
retrieving revision 1.3
diff -u -r1.3 sortparam.hxx
--- sc/inc/sortparam.hxx        23 Aug 2004 09:26:33 -0000      1.3
+++ sc/inc/sortparam.hxx        13 Jul 2005 04:33:47 -0000
@@ -94,6 +94,7 @@
        BOOL            bHasHeader;
        BOOL            bByRow;
        BOOL            bCaseSens;
+       BOOL            bNaturalSort;
        BOOL            bUserDef;
        USHORT          nUserIndex;
        BOOL            bIncludePattern;
Index: sc/sdi/scalc.sdi
===================================================================
RCS file: /cvs/sc/sc/sdi/scalc.sdi,v
retrieving revision 1.30
diff -u -r1.30 scalc.sdi
--- sc/sdi/scalc.sdi    2 Aug 2004 12:56:50 -0000       1.30
+++ sc/sdi/scalc.sdi    13 Jul 2005 04:33:47 -0000
@@ -1608,7 +1608,7 @@
 
 //--------------------------------------------------------------------------
 SfxVoidItem DataSort SID_SORT
-(SfxBoolItem ByRows SID_SORT_BYROW,SfxBoolItem HasHeader 
SID_SORT_HASHEADER,SfxBoolItem CaseSensitive SID_SORT_CASESENS,SfxBoolItem 
IncludeAttribs SID_SORT_ATTRIBS,SfxUInt16Item UserDefIndex 
SID_SORT_USERDEF,SfxInt32Item Col1 FN_PARAM_1,SfxBoolItem Ascending1 
FN_PARAM_2,SfxInt32Item Col2 FN_PARAM_3,SfxBoolItem Ascending2 
FN_PARAM_4,SfxInt32Item Col3 FN_PARAM_5,SfxBoolItem Ascending3 FN_PARAM_6)
+(SfxBoolItem ByRows SID_SORT_BYROW,SfxBoolItem HasHeader 
SID_SORT_HASHEADER,SfxBoolItem CaseSensitive SID_SORT_CASESENS,SfxBoolItem 
NaturalSort SID_SORT_NATURALSORT,SfxBoolItem IncludeAttribs 
SID_SORT_ATTRIBS,SfxUInt16Item UserDefIndex SID_SORT_USERDEF,SfxInt32Item Col1 
FN_PARAM_1,SfxBoolItem Ascending1 FN_PARAM_2,SfxInt32Item Col2 
FN_PARAM_3,SfxBoolItem Ascending2 FN_PARAM_4,SfxInt32Item Col3 
FN_PARAM_5,SfxBoolItem Ascending3 FN_PARAM_6)
 [
        /* flags: */
        AutoUpdate = FALSE,
Index: sc/source/core/data/sortparam.cxx
===================================================================
RCS file: /cvs/sc/sc/source/core/data/sortparam.cxx,v
retrieving revision 1.2
diff -u -r1.2 sortparam.cxx
--- sc/source/core/data/sortparam.cxx   4 Jun 2004 10:27:42 -0000       1.2
+++ sc/source/core/data/sortparam.cxx   13 Jul 2005 04:33:47 -0000
@@ -85,7 +85,7 @@
 
 ScSortParam::ScSortParam( const ScSortParam& r ) :
                nCol1(r.nCol1),nRow1(r.nRow1),nCol2(r.nCol2),nRow2(r.nRow2),
-               bHasHeader(r.bHasHeader),bCaseSens(r.bCaseSens),
+               
bHasHeader(r.bHasHeader),bCaseSens(r.bCaseSens),bNaturalSort(r.bNaturalSort),
                
bByRow(r.bByRow),bUserDef(r.bUserDef),nUserIndex(r.nUserIndex),bIncludePattern(r.bIncludePattern),
                bInplace(r.bInplace),
                nDestTab(r.nDestTab),nDestCol(r.nDestCol),nDestRow(r.nDestRow),
@@ -107,7 +107,7 @@
        nRow1=nRow2=nDestRow = 0;
        nDestTab = 0;
        nUserIndex = 0;
-       bHasHeader=bCaseSens=bUserDef = FALSE;
+       bHasHeader=bCaseSens=bUserDef=bNaturalSort = FALSE;
        bByRow=bIncludePattern=bInplace = TRUE;
        aCollatorLocale = ::com::sun::star::lang::Locale();
        aCollatorAlgorithm.Erase();
@@ -130,6 +130,7 @@
        nRow2                   = r.nRow2;
        bHasHeader              = r.bHasHeader;
        bCaseSens               = r.bCaseSens;
+       bNaturalSort    = r.bNaturalSort;
        bByRow                  = r.bByRow;
        bUserDef                = r.bUserDef;
        nUserIndex              = r.nUserIndex;
@@ -171,6 +172,7 @@
                && (bHasHeader          == rOther.bHasHeader)
                && (bByRow                      == rOther.bByRow)
                && (bCaseSens           == rOther.bCaseSens)
+               && (bNaturalSort        == rOther.bNaturalSort)
                && (bUserDef            == rOther.bUserDef)
                && (nUserIndex          == rOther.nUserIndex)
                && (bIncludePattern == rOther.bIncludePattern)
Index: sc/source/core/data/table3.cxx
===================================================================
RCS file: /cvs/sc/sc/source/core/data/table3.cxx,v
retrieving revision 1.20
diff -u -r1.20 table3.cxx
--- sc/source/core/data/table3.cxx      15 Nov 2004 16:34:51 -0000      1.20
+++ sc/source/core/data/table3.cxx      13 Jul 2005 04:33:48 -0000
@@ -100,6 +100,182 @@
 
 #include <vector>
 
+using namespace ::com::sun::star;
+
+namespace naturalsort {
+
+using namespace ::com::sun::star::i18n;
+
+BOOL empty( const rtl::OUString& ou )
+{
+       return ou.getLength() == 0;
+}
+
+/** Splits a given string into three parts: the prefix, number string, and 
+       the suffix.
+
+       @param sWhole
+       Original string to be split into pieces
+
+       @param sPrefix
+       Prefix string that consists of the part before the first number token
+
+       @param sSuffix
+       String after the last number token.  This may still contain number 
strings.
+
+       @param fNum
+       Number converted from the middle number string
+       
+       @param bRealNumber
+       Indicates whether or not the numbers must be treated as real numbers
+
+       @return Returns TRUE if a numeral element is found in a given string, 
or 
+       FALSE if no numeral element is found.
+*/
+BOOL SplitString( const rtl::OUString &sWhole, 
+               rtl::OUString &sPrefix, rtl::OUString &sSuffix, double &fNum, 
+               BOOL bRealNumber )
+{
+       sal_Int32 nParseType, nTokens;
+       
+       // Get prefix element
+       rtl::OUString sEmpty = rtl::OUString::createFromAscii( "" );
+       rtl::OUString sUser  = rtl::OUString::createFromAscii( "-()/\\[]{}" );
+
+       ParseResult aPRPre = ScGlobal::pCharClass->parsePredefinedToken( 
+               KParseType::IDENTNAME, sWhole, 0, 
+               KParseTokens::ANY_LETTER, sUser, KParseTokens::ANY_LETTER, 
sUser );
+       sPrefix = sWhole.copy( 0, aPRPre.EndPos );
+       
+       // Return FALSE if no numeral element is found
+       if ( aPRPre.EndPos == sWhole.getLength() )
+               return FALSE;
+       
+       // Get numeral element
+       if ( bRealNumber )
+       {
+               nParseType = KParseType::ANY_NUMBER;
+               nTokens = KParseTokens::ANY_NUMBER;
+       }
+       else
+       {
+               nParseType = KParseType::IDENTNAME;
+               nTokens = KParseTokens::ANY_NUMBER;
+       }
+       ParseResult aPRNum = ScGlobal::pCharClass->parsePredefinedToken(
+               nParseType, sWhole, aPRPre.EndPos, nTokens, sEmpty, nTokens, 
sEmpty );
+       
+       if ( aPRNum.EndPos == aPRPre.EndPos )
+               return FALSE;
+       
+       if ( bRealNumber )
+               fNum = aPRNum.Value;
+       else
+       {
+               rtl::OUString sNum = sWhole.copy( aPRPre.EndPos, aPRNum.EndPos 
- aPRPre.EndPos );
+               fNum = sNum.toDouble();
+       }
+       sSuffix = sWhole.copy( aPRNum.EndPos );
+       
+       return TRUE;
+}
+
+/** Naturally compares two given strings.
+
+       This is the main function that should be called externally.  It returns 
+       either 1, 0, or -1 depending on the comparison result of given two 
strings.
+
+       @param sStr1
+       Input string 1
+
+       @param sStr2
+       Input string 2
+
+       @param bCaseSens
+       Boolean value for case sensitivity
+
+       @param pData
+       Pointer to user defined sort list
+
+       @param pCW
+       Pointer to collator wrapper for normal string comparison
+       
+       @param bNaturalSort
+       This reference parameter indicates whether a natural sort has occurred. 
 If
+       set to false, caller of this function must perform a normal compare 
after 
+       this funtion returns.
+       
+       @return Returns 1 if sInput1 is greater, 0 if sInput1 == sInput2, and 
-1 if 
+       sInput2 is greater.
+*/
+short Compare( rtl::OUString sStr1, rtl::OUString sStr2, 
+                          const BOOL bCaseSens, const ScUserListData* pData, 
const CollatorWrapper *pCW, 
+                          BOOL& bNaturalSort )
+{
+       rtl::OUString sPre1, sSuf1, sPre2, sSuf2;
+
+       if ( empty( sStr1 ) || empty( sStr2 ) )
+       {
+               bNaturalSort = FALSE;
+               return 0;
+       }
+
+       do
+       {
+               double nNum1, nNum2;
+               BOOL bReal = TRUE;
+               BOOL bNumFound1 = SplitString( sStr1, sPre1, sSuf1, nNum1, 
bReal );
+               BOOL bNumFound2 = SplitString( sStr2, sPre2, sSuf2, nNum2, 
bReal );
+
+               short nPreRes; // Prefix comparison result
+               if ( pData )
+               {
+                       if ( bCaseSens )
+                       {
+                               if ( !bNumFound1 || !bNumFound2 )
+                                       return 
static_cast<short>(pData->Compare( sStr1, sStr2 ));
+                               else
+                                       nPreRes = pData->Compare( sPre1, sPre2 
);
+                       }
+                       else
+                       {
+                               if ( !bNumFound1 || !bNumFound2 )
+                                       return 
static_cast<short>(pData->ICompare( sStr1, sStr2 ));
+                               else
+                                       nPreRes = pData->ICompare( sPre1, sPre2 
);
+                       }
+               } 
+               else
+               {
+                       if ( !bNumFound1 || !bNumFound2 )
+                               return static_cast<short>(pCW->compareString( 
sStr1, sStr2 ));
+                       else
+                               nPreRes = 
static_cast<short>(pCW->compareString( sPre1, sPre2 ));
+               }
+               
+               // Prefix strings differ.  Return immediately.
+               if ( nPreRes != 0 )
+                       return nPreRes;
+                       
+               if ( nNum1 != nNum2 )
+               {
+                       if ( nNum1 < nNum2 ) return -1;
+                       return static_cast<short>( nNum1 > nNum2 );
+               }
+
+               // The prefix and the first numerical elements are equal, but 
the suffix
+               // strings may still differ.  Stay in the loop.
+
+               sStr1 = sSuf1;
+               sStr2 = sSuf2;
+
+       } while ( true );
+
+       return 0;
+}
+
+}
+
 // STATIC DATA -----------------------------------------------------------
 
 const USHORT nMaxSorts = 3;            // maximale Anzahl Sortierkriterien in 
aSortParam
@@ -321,25 +497,43 @@
                                        
((ScStringCell*)pCell2)->GetString(aStr2);
                                else
                                        GetString(nCell2Col, nCell2Row, aStr2);
-                               BOOL bUserDef = aSortParam.bUserDef;
+
+                               BOOL bUserDef     = aSortParam.bUserDef;        
        // custom sort order
+                               BOOL bNaturalSort = aSortParam.bNaturalSort;    
// natural sort
+                               BOOL bCaseSens    = aSortParam.bCaseSens;       
        // case sensitivity
+                               
                                if (bUserDef)
                                {
                                        ScUserListData* pData =
-                                               
(ScUserListData*)(ScGlobal::GetUserList()->At(
-                                               aSortParam.nUserIndex));
+                                               static_cast<ScUserListData*>( 
(ScGlobal::GetUserList()->At(
+                                               aSortParam.nUserIndex)) );
+                                               
                                        if (pData)
                                        {
-                                               if ( aSortParam.bCaseSens )
-                                                       nRes = 
pData->Compare(aStr1, aStr2);
-                                               else
-                                                       nRes = 
pData->ICompare(aStr1, aStr2);
+                                               if ( bNaturalSort )
+                                                       nRes = 
naturalsort::Compare( aStr1, aStr2, bCaseSens, pData, pSortCollator,
+                                                                       
bNaturalSort );
+
+                                               if ( !bNaturalSort )
+                                               {
+                                                       if ( bCaseSens )
+                                                               nRes = 
pData->Compare(aStr1, aStr2);
+                                                       else
+                                                               nRes = 
pData->ICompare(aStr1, aStr2);
+                                               }
                                        }
                                        else
                                                bUserDef = FALSE;
 
                                }
                                if (!bUserDef)
-                                       nRes = (short) 
pSortCollator->compareString( aStr1, aStr2 );
+                               {
+                                       if ( bNaturalSort )
+                                               nRes = naturalsort::Compare( 
aStr1, aStr2, bCaseSens, NULL, pSortCollator,
+                                                               bNaturalSort );
+                                       if ( !bNaturalSort )
+                                               nRes = static_cast<short>( 
pSortCollator->compareString( aStr1, aStr2 ) );
+                               }
                        }
                        else if ( bStr1 )                               // 
String <-> Zahl
                                nRes = 1;                                       
// Zahl vorne
Index: sc/source/core/tool/dbcolect.cxx
===================================================================
RCS file: /cvs/sc/sc/source/core/tool/dbcolect.cxx,v
retrieving revision 1.12
diff -u -r1.12 dbcolect.cxx
--- sc/source/core/tool/dbcolect.cxx    14 Jan 2005 11:59:07 -0000      1.12
+++ sc/source/core/tool/dbcolect.cxx    13 Jul 2005 04:33:48 -0000
@@ -427,6 +427,7 @@
        bKeepFmt                        (rData.bKeepFmt),
        bStripData                      (rData.bStripData),
        bSortCaseSens           (rData.bSortCaseSens),
+       bSortNaturalSort        (rData.bSortNaturalSort),
        bIncludePattern         (rData.bIncludePattern),
        bSortInplace            (rData.bSortInplace),
        nSortDestTab            (rData.nSortDestTab),
@@ -520,6 +521,7 @@
        bKeepFmt                        = rData.bKeepFmt;
        bStripData                      = rData.bStripData;
        bSortCaseSens           = rData.bSortCaseSens;
+       bSortNaturalSort        = rData.bSortNaturalSort;
        bIncludePattern         = rData.bIncludePattern;
        bSortInplace            = rData.bSortInplace;
        nSortDestTab            = rData.nSortDestTab;
@@ -771,6 +773,7 @@
        rSortParam.bByRow = bByRow;
        rSortParam.bHasHeader = bHasHeader;
        rSortParam.bCaseSens = bSortCaseSens;
+       rSortParam.bNaturalSort = bSortNaturalSort;
        rSortParam.bInplace = bSortInplace;
        rSortParam.nDestTab = nSortDestTab;
        rSortParam.nDestCol = nSortDestCol;
@@ -791,6 +794,7 @@
 void ScDBData::SetSortParam( const ScSortParam& rSortParam )
 {
        bSortCaseSens = rSortParam.bCaseSens;
+       bSortNaturalSort = rSortParam.bNaturalSort;
        bIncludePattern = rSortParam.bIncludePattern;
        bSortInplace = rSortParam.bInplace;
        nSortDestTab = rSortParam.nDestTab;
Index: sc/source/ui/dbgui/tpsort.cxx
===================================================================
RCS file: /cvs/sc/sc/source/ui/dbgui/tpsort.cxx,v
retrieving revision 1.8
diff -u -r1.8 tpsort.cxx
--- sc/source/ui/dbgui/tpsort.cxx       23 Aug 2004 09:32:01 -0000      1.8
+++ sc/source/ui/dbgui/tpsort.cxx       13 Jul 2005 04:33:49 -0000
@@ -579,6 +579,7 @@
                aBtnHeader              ( this, ScResId( BTN_LABEL ) ),
                aBtnFormats     ( this, ScResId( BTN_FORMATS ) ),
                aBtnCopyResult  ( this, ScResId( BTN_COPYRESULT ) ),
+               aBtnNaturalSort ( this, ScResId( BTN_NATURALSORT ) ),
                aLbOutPos               ( this, ScResId( LB_OUTAREA ) ),
                aEdOutPos               ( this, ScResId( ED_OUTAREA ) ),
                aBtnSortUser    ( this, ScResId( BTN_SORT_USER ) ),
@@ -590,7 +591,7 @@
                aLineDirection  ( this, ScResId( FL_DIRECTION ) ),
                aBtnTopDown     ( this, ScResId( BTN_TOP_DOWN ) ),
                aBtnLeftRight   ( this, ScResId( BTN_LEFT_RIGHT ) ),
-               aFtAreaLabel    ( this, ScResId( FT_AREA_LABEL ) ),
+//             aFtAreaLabel    ( this, ScResId( FT_AREA_LABEL ) ),
 //             aFtArea                 ( this, ScResId( FT_AREA ) ),
                //
                aStrColLabel    ( ScResId( STR_COL_LABEL ) ),
@@ -629,8 +630,8 @@
 
 void ScTabPageSortOptions::Init()
 {
-       aStrAreaLabel = aFtAreaLabel.GetText();
-       aStrAreaLabel.Append( (sal_Unicode) ' ' );
+//     aStrAreaLabel = aFtAreaLabel.GetText();
+//     aStrAreaLabel.Append( (sal_Unicode) ' ' );
 
        //      CollatorRessource has user-visible names for sort algorithms
        pColRes = new CollatorRessource();
@@ -708,8 +709,8 @@
                theArea += ')';
 
                //aFtArea.SetText( theArea );
-               theArea.Insert( aStrAreaLabel, 0 );
-               aFtAreaLabel.SetText( theArea );
+               //theArea.Insert( aStrAreaLabel, 0 );
+               //aFtAreaLabel.SetText( theArea );
 
                aBtnHeader.SetText( aStrColLabel );
        }
@@ -755,9 +756,10 @@
                aLbSortUser.SelectEntryPos( 0 );
        }
 
-       aBtnCase.Check          ( rSortData.bCaseSens );
-       aBtnFormats.Check       ( rSortData.bIncludePattern );
-       aBtnHeader.Check        ( rSortData.bHasHeader );
+       aBtnCase.Check                  ( rSortData.bCaseSens );
+       aBtnFormats.Check               ( rSortData.bIncludePattern );
+       aBtnHeader.Check                ( rSortData.bHasHeader );
+       aBtnNaturalSort.Check   ( rSortData.bNaturalSort );
 
        if ( rSortData.bByRow )
        {
@@ -825,6 +827,7 @@
        theSortData.bByRow                      = aBtnTopDown.IsChecked();
        theSortData.bHasHeader          = aBtnHeader.IsChecked();
        theSortData.bCaseSens           = aBtnCase.IsChecked();
+       theSortData.bNaturalSort        = aBtnNaturalSort.IsChecked();
        theSortData.bIncludePattern = aBtnFormats.IsChecked();
        theSortData.bInplace            = !aBtnCopyResult.IsChecked();
        theSortData.nDestCol            = theOutPos.Col();
Index: sc/source/ui/inc/sortdlg.hrc
===================================================================
RCS file: /cvs/sc/sc/source/ui/inc/sortdlg.hrc,v
retrieving revision 1.3
diff -u -r1.3 sortdlg.hrc
--- sc/source/ui/inc/sortdlg.hrc        18 May 2001 09:16:28 -0000      1.3
+++ sc/source/ui/inc/sortdlg.hrc        13 Jul 2005 04:33:49 -0000
@@ -95,7 +95,7 @@
 #define LB_SORT_USER           2
 #define LB_OUTAREA                     3
 #define ED_OUTAREA          4
-#define FT_AREA_LABEL       5
+//#define FT_AREA_LABEL       5
 //#define FT_AREA             6
 #define BTN_SORT_USER       7
 #define BTN_CASESENSITIVE   8
@@ -110,6 +110,7 @@
 #define LB_LANGUAGE         17
 #define FT_ALGORITHM        18
 #define LB_ALGORITHM        19
+#define        BTN_NATURALSORT         20
 
 
 
Index: sc/source/ui/inc/tpsort.hxx
===================================================================
RCS file: /cvs/sc/sc/source/ui/inc/tpsort.hxx,v
retrieving revision 1.5
diff -u -r1.5 tpsort.hxx
--- sc/source/ui/inc/tpsort.hxx 4 Jun 2004 11:42:38 -0000       1.5
+++ sc/source/ui/inc/tpsort.hxx 13 Jul 2005 04:33:49 -0000
@@ -105,7 +105,7 @@
 struct ScSortParam;
 
 //========================================================================
-// Kriterien
+// Kriterien (Sort Criteria)
 
 class ScTabPageSortFields : public SfxTabPage
 {
@@ -175,7 +175,7 @@
 };
 
 //========================================================================
-// Sortieroptionen:
+// Sortieroptionen (Sort Options)
 
 class ScDocument;
 class ScRangeData;
@@ -206,6 +206,7 @@
     CheckBox            aBtnCase;
     CheckBox            aBtnHeader;
     CheckBox            aBtnFormats;
+       CheckBox                        aBtnNaturalSort;
 
     CheckBox            aBtnCopyResult;
     ListBox             aLbOutPos;
@@ -223,7 +224,7 @@
     RadioButton         aBtnTopDown;
     RadioButton         aBtnLeftRight;
 
-    FixedText           aFtAreaLabel;
+//     FixedText           aFtAreaLabel;
 //  FixedInfo           aFtArea;
     String              aStrRowLabel;
     String              aStrColLabel;
Index: sc/source/ui/src/sortdlg.src
===================================================================
RCS file: /cvs/sc/sc/source/ui/src/sortdlg.src,v
retrieving revision 1.37
diff -u -r1.37 sortdlg.src
--- sc/source/ui/src/sortdlg.src        26 Jun 2004 20:10:37 -0000      1.37
+++ sc/source/ui/src/sortdlg.src        13 Jul 2005 04:33:49 -0000
@@ -209,9 +209,18 @@
                TabStop = TRUE ;
                Text [ x-comment ] = " ";
        };
+       CheckBox BTN_NATURALSORT
+       {
+               Pos = MAP_APPFONT ( 12 , 48 ) ;
+               Size = MAP_APPFONT ( 242 , 10 ) ;
+               Text [ de ] = "Enable ~natural sort" ;
+               Text [ en-US ] = "Enable ~natural sort" ;
+               TabStop = TRUE ;
+               Text [ x-comment ] = " " ;
+       };
        CheckBox BTN_COPYRESULT
        {
-        Pos = MAP_APPFONT ( 12 , 48 ) ;
+        Pos = MAP_APPFONT ( 12 , 62 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
                Text [ de ] = "Sortierergebnis ~ausgeben nach" ;
                Text [ en-US ] = "~Copy sort results to:" ;
@@ -221,7 +230,7 @@
        ListBox LB_OUTAREA
        {
                Border = TRUE ;
-        Pos = MAP_APPFONT ( 20 , 59 ) ;
+        Pos = MAP_APPFONT ( 20 , 73 ) ;
         Size = MAP_APPFONT ( 93 , 90 ) ;
                TabStop = TRUE ;
                DropDown = TRUE ;
@@ -230,13 +239,13 @@
        {
                Disable = TRUE ;
                Border = TRUE ;
-        Pos = MAP_APPFONT ( 119 , 59 ) ;
+        Pos = MAP_APPFONT ( 119 , 73 ) ;
         Size = MAP_APPFONT ( 132 , 12 ) ;
                TabStop = TRUE ;
        };
        CheckBox BTN_SORT_USER
        {
-        Pos = MAP_APPFONT ( 12 , 75 ) ;
+        Pos = MAP_APPFONT ( 12 , 89 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
                Text [ de ] = "~Benutzerdefinierte Sortierreihenfolge" ;
                Text [ en-US ] = "Custom sort ~order" ;
@@ -247,14 +256,14 @@
        {
                Disable = TRUE ;
                Border = TRUE ;
-        Pos = MAP_APPFONT ( 20 , 86 ) ;
+        Pos = MAP_APPFONT ( 20 , 100 ) ;
         Size = MAP_APPFONT ( 231 , 90 ) ;
                TabStop = TRUE ;
                DropDown = TRUE ;
        };
     FixedText FT_LANGUAGE
        {
-        Pos = MAP_APPFONT ( 12 , 104 ) ;
+        Pos = MAP_APPFONT ( 12 , 118 ) ;
         Size = MAP_APPFONT ( 101 , 8 ) ;
                Text [ de ] = "S~prache" ;
                Text [ en-US ] = "~Language";
@@ -262,7 +271,7 @@
        ListBox LB_LANGUAGE
        {
                Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 , 115 ) ;
+        Pos = MAP_APPFONT ( 12 , 129 ) ;
         Size = MAP_APPFONT ( 101 , 90 ) ;
                TabStop = TRUE ;
                DropDown = TRUE ;
@@ -270,7 +279,7 @@
        };
     FixedText FT_ALGORITHM
        {
-        Pos = MAP_APPFONT ( 119 , 104 ) ;
+        Pos = MAP_APPFONT ( 119 , 118 ) ;
         Size = MAP_APPFONT ( 132 , 8 ) ;
         Text [ de ] = "Op~tionen" ;
                Text [ en-US ] = "O~ptions";
@@ -278,14 +287,14 @@
        ListBox LB_ALGORITHM
        {
                Border = TRUE ;
-        Pos = MAP_APPFONT ( 119 , 115 ) ;
+        Pos = MAP_APPFONT ( 119 , 129 ) ;
         Size = MAP_APPFONT ( 132 , 90 ) ;
                TabStop = TRUE ;
                DropDown = TRUE ;
        };
        FixedLine FL_DIRECTION
        {
-        Pos = MAP_APPFONT ( 6 , 133 ) ;
+        Pos = MAP_APPFONT ( 6 , 147 ) ;
         Size = MAP_APPFONT ( 248 , 8 ) ;
                Text [ de ] = "Richtung" ;
                Text [ en-US ] = "Direction" ;
@@ -293,7 +302,7 @@
        };
        RadioButton BTN_TOP_DOWN
        {
-        Pos = MAP_APPFONT ( 12 , 144 ) ;
+        Pos = MAP_APPFONT ( 12 , 158 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
                Text [ de ] = "Von ~oben nach unten (Zeilen sortieren)" ;
                Text [ en-US ] = "~Top to bottom (sort rows)" ;
@@ -302,13 +311,14 @@
        };
        RadioButton BTN_LEFT_RIGHT
        {
-        Pos = MAP_APPFONT ( 12 , 158 ) ;
+        Pos = MAP_APPFONT ( 12 , 172 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
         Text [ de ] = "Von ~links nach rechts (Spalten sortieren)" ;
                Text [ en-US ] = "L~eft to right (sort columns)" ;
                TabStop = TRUE ;
                Text [ x-comment ] = " ";
        };
+/*
        FixedText FT_AREA_LABEL
        {
         Pos = MAP_APPFONT ( 6 , 171 ) ;
@@ -317,6 +327,7 @@
                Text [ en-US ] = "Data area:" ;
                Text [ x-comment ] = " ";
        };
+*/
 };
 TabDialog RID_SCDLG_SORT
 {
Index: sc/source/ui/view/cellsh2.cxx
===================================================================
RCS file: /cvs/sc/sc/source/ui/view/cellsh2.cxx,v
retrieving revision 1.23
diff -u -r1.23 cellsh2.cxx
--- sc/source/ui/view/cellsh2.cxx       13 Apr 2005 12:20:34 -0000      1.23
+++ sc/source/ui/view/cellsh2.cxx       13 Jul 2005 04:33:49 -0000
@@ -329,6 +329,7 @@
                                aSortParam.bHasHeader           = FALSE;
                                aSortParam.bByRow                       = TRUE;
                                aSortParam.bCaseSens            = FALSE;
+                               aSortParam.bNaturalSort         = FALSE;
                                aSortParam.bIncludePattern      = FALSE;
                                aSortParam.bInplace             = TRUE;
                                aSortParam.bDoSort[0]           = TRUE;
@@ -364,6 +365,8 @@
                                                aSortParam.bHasHeader = ((const 
SfxBoolItem*)pItem)->GetValue();
                                        if ( pArgs->GetItemState( 
SID_SORT_CASESENS, TRUE, &pItem ) == SFX_ITEM_SET )
                                                aSortParam.bCaseSens = ((const 
SfxBoolItem*)pItem)->GetValue();
+                                       if ( pArgs->GetItemState( 
SID_SORT_NATURALSORT, TRUE, &pItem ) == SFX_ITEM_SET )
+                                               aSortParam.bNaturalSort = 
((const SfxBoolItem*)pItem)->GetValue();
                                        if ( pArgs->GetItemState( 
SID_SORT_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
                                                aSortParam.bIncludePattern = 
((const SfxBoolItem*)pItem)->GetValue();
                                        if ( pArgs->GetItemState( 
SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
@@ -417,7 +420,7 @@
 
                                        pDlg = pFact->CreateScSortDlg( 
pTabViewShell->GetDialogParent(),  &aArgSet, ResId(RID_SCDLG_SORT) );
                                        DBG_ASSERT(pDlg, "Dialog create 
fail!");//CHINA001
-                                       pDlg->SetCurPageId(1);
+                                       pDlg->SetCurPageId(1);  // 1=sort field 
tab  2=sort options tab
 
                                        if ( pDlg->Execute() == RET_OK )
                                        {
@@ -436,6 +439,8 @@
                                                                                
                rOutParam.bHasHeader ) );
                                                        rReq.AppendItem( 
SfxBoolItem( SID_SORT_CASESENS,
                                                                                
                rOutParam.bCaseSens ) );
+                                                       rReq.AppendItem( 
SfxBoolItem( SID_SORT_NATURALSORT,
+                                                                               
                rOutParam.bNaturalSort ) );
                                                        rReq.AppendItem( 
SfxBoolItem( SID_SORT_ATTRIBS,
                                                                                
                rOutParam.bIncludePattern ) );
                                                        USHORT nUser = 
rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to