User: timar Date: 06/03/02 05:14:11 Removed: /hu/src/2.0.2/Patches/ SRC680_m106_sc_naturalsort.diff
Added: /hu/src/2.0.2/Patches/ i26565-sc-naturalsort.diff Log: with help and extended tip File Changes: Directory: /hu/src/2.0.2/Patches/ ================================= File [removed]: SRC680_m106_sc_naturalsort.diff File [added]: i26565-sc-naturalsort.diff Url: http://hu.openoffice.org/source/browse/hu/src/2.0.2/Patches/i26565-sc-naturalsort.diff?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 736 ---------------- 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; Index: helpcontent2/source/text/scalc/01/12030200.xhp =================================================================== RCS file: /cvs/documentation/helpcontent2/source/text/scalc/01/12030200.xhp,v retrieving revision 1.5 diff -u -r1.5 12030200.xhp --- helpcontent2/source/text/scalc/01/12030200.xhp 5 Oct 2005 12:00:43 -0000 1.5 +++ helpcontent2/source/text/scalc/01/12030200.xhp 2 Mar 2006 12:55:35 -0000 @@ -54,6 +54,7 @@ <bookmark_value>sorting;Asian languages</bookmark_value> <bookmark_value>Asian languages;sorting</bookmark_value> <bookmark_value>phonebook sorting rules</bookmark_value> +<bookmark_value>natural sort algorithm</bookmark_value> </bookmark> <bookmark xml-lang="en-US" branch="hid/HID_SCPAGE_SORT_OPTIONS" id="bm_id3151044" localize="false"/> <paragraph role="heading" id="hd_id3147228" xml-lang="en-US" level="1" l10n="U" oldref="1"><link href="text/scalc/01/12030200.xhp" name="Options">Options</link></paragraph> @@ -70,6 +71,9 @@ <bookmark xml-lang="en-US" branch="hid/SC:CHECKBOX:RID_SCPAGE_SORT_OPTIONS:BTN_FORMATS" id="bm_id3149410" localize="false"/> <paragraph role="heading" id="hd_id3147436" xml-lang="en-US" level="2" l10n="U" oldref="7">Include formats</paragraph> <paragraph role="paragraph" id="par_id3149377" xml-lang="en-US" l10n="U" oldref="8"><ahelp hid="SC:CHECKBOX:RID_SCPAGE_SORT_OPTIONS:BTN_FORMATS">Preserves the current cell formatting.</ahelp></paragraph> +<bookmark xml-lang="en-US" branch="hid/SC:CHECKBOX:RID_SCPAGE_SORT_OPTIONS:BTN_NATURALSORT" id="bm_id3149412" localize="false"/> +<paragraph role="heading" id="hd_id3147438" xml-lang="en-US" level="2" l10n="U">Enable natural sort</paragraph> +<paragraph role="paragraph" id="par_id3149378" xml-lang="en-US" l10n="U"><ahelp hid="SC:CHECKBOX:RID_SCPAGE_SORT_OPTIONS:BTN_NATURALSORT">Natural sort is a sort algorithm that sorts string-prefixed numbers based on the value of the numerical element in each sorted number, instead of the traditional way of sorting them as ordinary strings.</ahelp> For instance, let's assume you have a series of values such as, A1, A2, A3, A4, A5, A6, ..., A19, A20, A21. When you put these values into a range of cells and run the sort, it will become A1, A11, A12, A13, ..., A19, A2, A20, A21, A3, A4, A5, ..., A9. While this sorting behavior may make sense to those who understand the underlying sorting mechanism, to the rest of the population it seems completely bizarre, if not outright inconvenient. With the natural sort feature enabled, values such as the ones in the above example get sorted "properly", which improves the convenience of sorting operations in general.</paragraph> <bookmark xml-lang="en-US" branch="hid/SC:CHECKBOX:RID_SCPAGE_SORT_OPTIONS:BTN_COPYRESULT" id="bm_id3147124" localize="false"/> <paragraph role="heading" id="hd_id3153878" xml-lang="en-US" level="2" l10n="U" oldref="10">Copy sort results to:</paragraph> <paragraph role="paragraph" id="par_id3156286" xml-lang="en-US" l10n="U" oldref="11"><ahelp hid="SC:CHECKBOX:RID_SCPAGE_SORT_OPTIONS:BTN_COPYRESULT">Copies the sorted list to the cell range that you specify.</ahelp></paragraph> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
