[ooo-build-commit] Branch 'ooo/master' - sc/inc sc/source

Jan Holesovsky kendy at kemper.freedesktop.org
Wed Jul 15 17:14:14 PDT 2009


 sc/inc/sc.hrc                            |    2 
 sc/inc/scabstdlg.hxx                     |    1 
 sc/source/filter/excel/excdoc.cxx        |    2 
 sc/source/filter/excel/excel.cxx         |    7 
 sc/source/filter/excel/xestream.cxx      |    8 
 sc/source/filter/excel/xichart.cxx       |   96 ++++----
 sc/source/filter/excel/xlstyle.cxx       |    1 
 sc/source/filter/inc/xestream.hxx        |   14 -
 sc/source/filter/inc/xichart.hxx         |    8 
 sc/source/ui/attrdlg/scdlgfact.cxx       |   18 +
 sc/source/ui/attrdlg/scdlgfact.hxx       |    4 
 sc/source/ui/dbgui/sortdlg.cxx           |   41 +++
 sc/source/ui/docshell/externalrefmgr.cxx |   17 -
 sc/source/ui/inc/scui_def.hxx            |    2 
 sc/source/ui/inc/sortdlg.hrc             |    8 
 sc/source/ui/inc/sortdlg.hxx             |   20 +
 sc/source/ui/src/sortdlg.src             |   44 +++
 sc/source/ui/view/cellsh2.cxx            |  358 +++++++++++++++++++------------
 sc/source/ui/view/cellsh3.cxx            |   10 
 sc/source/ui/view/tabvwsh3.cxx           |    8 
 20 files changed, 442 insertions(+), 227 deletions(-)

New commits:
commit 24c746b9949f2dfed633a0b6b3b7da7a34545675
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date:   Wed Jul 15 14:57:49 2009 +0000

    CWS-TOOLING: integrate CWS dr68
    2009-06-19 17:43:48 +0200 oc  r273175 : #i102946# some lines for new dialog added
    2009-06-19 14:17:45 +0200 oc  r273158 : #i102946# three lines added
    2009-05-19 11:56:14 +0200 dr  r272065 : #i99677# wrong attribute name
    2009-05-18 18:37:05 +0200 dr  r272045 : #i10000# suncc warning
    2009-05-05 16:46:13 +0200 dr  r271536 : #i10000# adoptions after rebase to master containing dr67
    2009-05-05 16:01:19 +0200 dr  r271530 : #i10000# adoptions after rebase to master containing dr67
    2009-05-04 14:20:39 +0200 dr  r271453 : CWS-TOOLING: rebase CWS dr68 to trunk at 271427 (milestone: DEV300:m47)
    2009-04-28 17:01:14 +0200 dr  r271332 : CWS-TOOLING: rebase CWS dr68 to trunk at 270723 (milestone: DEV300:m46)
    2009-04-23 12:21:40 +0200 dr  r271149 : #i100688# missing checkins
    2009-04-23 12:18:16 +0200 dr  r271147 : #i100978# relations path handling
    2009-04-22 19:25:45 +0200 nn  r271136 : #i49491# show navigator for double click on document position status bar control
    2009-04-22 11:28:36 +0200 nn  r271085 : #i60401# small text change
    2009-04-21 16:53:23 +0200 dr  r271044 : #i10000# missing dtor
    2009-04-20 13:39:25 +0200 nn  r270977 : #i60401# add dialog to extend sort range (patch from maoyg)
    2009-04-08 12:11:08 +0200 dr  r270630 : #i100943# prevent assertion when loading chart with empty category ranges
    2009-04-07 19:03:00 +0200 dr  r270609 : #i100688# missing bits for OLE
    2009-04-07 17:14:06 +0200 dr  r270605 : ported fix for #i100710#
    2009-04-07 17:12:50 +0200 dr  r270604 : #i10000# wae
    2009-04-07 15:31:55 +0200 dr  r270598 : import system colors moved to FilterBase class, more rework on fill and color contexts
    2009-04-06 15:00:03 +0200 dr  r270552 : #i99677# prevent recursive loading of the current document
    2009-04-03 18:28:42 +0200 dr  r270515 : added import of brightness/contrast and mono/grayscale color effects for image shapes
    2009-04-03 17:36:03 +0200 dr  r270509 : cache already imported embedded graphics
    2009-04-03 16:46:34 +0200 dr  r270500 : more rework on bitmap fill and graphic object handling
    2009-03-31 12:28:10 +0200 dr  r270271 : #i10000# unxlngi6 wae
    2009-03-31 09:04:10 +0200 dr  r270261 : CWS-TOOLING: rebase CWS dr68 to trunk at 270033 (milestone: DEV300:m45)
    2009-03-30 17:42:05 +0200 dr  r270249 : #i91122# add missing doc
    2009-03-30 17:37:08 +0200 dr  r270248 : #i91122# add missing doc
    2009-03-30 16:59:15 +0200 dr  r270241 : #i99677# add import of ActiveX scrollbar controls
    2009-03-30 14:30:36 +0200 dr  r270230 : #i91122# missing/wrong documentation
    2009-03-30 13:03:38 +0200 dr  r270220 : #i99677# add import of ActiveX combobox and spinbutton controls
    2009-03-27 11:46:59 +0100 dr  r270144 : #i99677# import ActiveX listbox controls (Forms.ListBox.1)
    2009-03-26 19:58:00 +0100 dr  r270104 : #i99677# move more OLE import code into ole submodule
    2009-03-26 15:15:02 +0100 dr  r270082 : #i100546# add import of chart bitmap fills, add import of X/Y offset in tiled bitmap fills of all shapes
    2009-03-25 12:54:59 +0100 dr  r270018 : #i99677# import ActiveX edit text control (Forms.TextBox.1)
    2009-03-24 10:59:29 +0100 dr  r269921 : #i99677# moved import of OLE StdHlink to 'ole' submodule, added string import helpers to BinaryStreamBase class, removed implementation of ST_XString import from docprop in favour of the implementation in class AttributeList
    2009-03-24 10:40:18 +0100 dr  r269919 : #i100502# implicit precedence of '&&' was intended
    2009-03-24 10:18:29 +0100 dr  r269917 : #i100502# missing parentheses
    2009-03-23 15:17:48 +0100 dr  r269876 : #i99677# more code reorg, added graphic helper and OLE helper object per filter, added OLE/control import to PPTX/XLSX filter, moved helpers from XmlFilterBase to FilterBase
    2009-03-19 12:45:20 +0100 dr  r269740 : #i99677# interface changes in oox
    2009-03-18 15:51:50 +0100 dr  r269683 : #i99677# improved relation handling (internal/external), added preprocessor for VML streams to eat MS specific instructions, added OCX ToggleButton/OptionButton import, added DIB import for BIFF (page background picture, lots of other minor improvements
    2009-03-16 15:25:30 +0100 dr  r269551 : #i99677# import excel form control client data (printable, cell link)
    2009-03-13 18:37:17 +0100 dr  r269494 : #i99677# import image controls and check boxes
    2009-03-12 15:08:18 +0100 dr  r269420 : #i10000# rebase problems
    2009-03-12 14:43:09 +0100 dr  r269418 : #i10000# rebase problems
    2009-03-12 14:42:41 +0100 dr  r269417 : #i10000# missing delivered header
    2009-03-12 13:57:06 +0100 dr  r269405 : #i10000# typos
    2009-03-12 12:58:52 +0100 dr  r269391 : CWS-TOOLING: rebase CWS dr68 to trunk at 269297 (milestone: DEV300:m43)
    2009-03-12 11:11:46 +0100 dr  r269374 : #i99677# first step to import BIFF8 page background
    2009-03-12 10:21:53 +0100 dr  r269364 : #i99677# rework of graphic import in entire filter, added import of AX Label controls
    2009-03-09 16:44:50 +0100 dr  r269202 : #i99677# import some formatting attributes of command buttons
    2009-03-05 15:31:46 +0100 dr  r268911 : #i99677# use VML shape client data to import excel VML shape positions
    2009-03-05 11:39:48 +0100 dr  r268888 : #i99677# create UNO control shapes from VML control shapes
    2009-03-05 11:38:59 +0100 dr  r268886 : #i99677# change attribute Shapes to DrawPage for import of embedded form controls
    2009-03-05 11:30:40 +0100 dr  r268885 : #i99677# change attribute Shapes to DrawPage for import of embedded form controls
    2009-03-04 18:46:05 +0100 dr  r268860 : adapt namespace ids according to oox
    2009-03-04 18:43:49 +0100 dr  r268859 : #i99677# more VML import rework
    2009-03-03 13:38:36 +0100 dr  r268721 : #i99677# more cleanup for VML filter
    2009-03-03 13:13:15 +0100 dr  r268719 : #i99807# do not iterate beyond end of std::list
    2009-03-02 11:55:49 +0100 dr  r268644 : add ST_XString support (encoded characters in attribute values)
    2009-02-26 17:07:18 +0100 dr  r268542 : #i99677# first steps of ax control import: dummy AX base classes, reimplement VML import (hopefully without breaking anything), register embedded AX controls at VML drawing
    2009-02-23 17:43:50 +0100 dr  r268365 : #i99426# remaining work on scenario import
    2009-02-19 16:56:25 +0100 dr  r268295 : #i99426# base implementations for scenarios import

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 554d96f..a764d20 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1630,7 +1630,7 @@
 
 #define RID_SCDLG_CONFLICTS             (SC_DIALOGS_START + 145)
 #define RID_SCDLG_SHAREDOCUMENT         (SC_DIALOGS_START + 146)
-
+#define RID_SCDLG_SORT_WARNING          (SC_DIALOGS_START + 147)
 #define RID_SCDLG_TABPROTECTION         (SC_DIALOGS_START + 147)
 #define RID_SCDLG_DOCPROTECTION         (SC_DIALOGS_START + 148)
 #define RID_SCDLG_RETYPEPASS            (SC_DIALOGS_START + 149)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index a27eccb..21e8742 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -314,6 +314,7 @@ public:
                                                     const String&	rStrLabel,
                                                     int nId,
                                                     BOOL				bColDefault = TRUE ) = 0;
+    virtual VclAbstractDialog * CreateScSortWarningDlg ( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId ) = 0;  //add for ScSortWarningDlg
     virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ) = 0; //add for ScDataPilotDatabaseDlg
 
     virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg ( Window* pParent, BOOL bEnableExternal, int nId ) = 0; //add for ScDataPilotSourceTypeDlg
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index bbc8cb4..07dfe83 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -814,7 +814,7 @@ void ExcDocument::WriteXml( SvStream& rStrm )
 
         rWorkbook->endElement( XML_workbook );
         rWorkbook.reset();
-        aStrm.commit();
+        aStrm.commitStorage();
     }
 #if 0
     if( pExpChangeTrack )
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 7072785..3965d0a 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -39,6 +39,7 @@
 #include <tools/globname.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <comphelper/processfactory.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/document/XImporter.hpp>
 #include "scitems.hxx"
@@ -86,9 +87,13 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument
     {
         uno::Reference< lang::XComponent > xComponent( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
 
+        uno::Sequence< beans::NamedValue > aArgSeq( 1 );
+        aArgSeq[ 0 ].Name = CREATE_OUSTRING( "UseBiffFilter" );
+        aArgSeq[ 0 ].Value <<= bUseOoxFilter;
+
         uno::Sequence< uno::Any > aArgs( 2 );
         aArgs[ 0 ] <<= getProcessServiceFactory();
-        aArgs[ 1 ] <<= !bUseOoxFilter;
+        aArgs[ 1 ] <<= aArgSeq;
         uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs(
             CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW );
         xImporter->setTargetDocument( xComponent );
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 82221b6..6b2f53c 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -973,7 +973,7 @@ sax_fastparser::FSHelperPtr XclExpXmlStream::CreateOutputStream (
     if( pRelationshipId )
         *pRelationshipId = sRelationshipId;
 
-    sax_fastparser::FSHelperPtr p = openOutputStreamWithSerializer( sFullStream, OUString::createFromAscii( sContentType ) );
+    sax_fastparser::FSHelperPtr p = openFragmentStreamWithSerializer( sFullStream, OUString::createFromAscii( sContentType ) );
 
     maOpenedStreamMap[ sFullStream ] = std::make_pair( sRelationshipId, p );
 
@@ -990,14 +990,14 @@ sal_Int32 XclExpXmlStream::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
     return -1;
 }
 
-const oox::vml::DrawingPtr XclExpXmlStream::getDrawings()
+oox::vml::Drawing* XclExpXmlStream::getVmlDrawing()
 {
-    return oox::vml::DrawingPtr();
+    return 0;
 }
 
 const oox::drawingml::Theme* XclExpXmlStream::getCurrentTheme() const
 {
-    return NULL;
+    return 0;
 }
 
 const oox::drawingml::table::TableStyleListPtr XclExpXmlStream::getTableStyles()
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index c0a0610..2d920b0 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -69,6 +69,9 @@
 #include "document.hxx"
 #include "drwlayer.hxx"
 #include "rangeutl.hxx"
+#include "tokenarray.hxx"
+#include "token.hxx"
+#include "compiler.hxx"
 #include "fprogressbar.hxx"
 #include "xltracer.hxx"
 #include "xistream.hxx"
@@ -77,9 +80,6 @@
 #include "xipage.hxx"
 #include "xiview.hxx"
 #include "xiescher.hxx"
-#include "tokenarray.hxx"
-#include "token.hxx"
-#include "compiler.hxx"
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -638,8 +638,11 @@ Reference< XLabeledDataSequence > lclCreateLabeledDataSequence(
 // ----------------------------------------------------------------------------
 
 XclImpChSourceLink::XclImpChSourceLink( const XclImpChRoot& rRoot ) :
-    XclImpChRoot( rRoot ),
-    mpTokenArray(static_cast<ScTokenArray*>(NULL))
+    XclImpChRoot( rRoot )
+{
+}
+
+XclImpChSourceLink::~XclImpChSourceLink()
 {
 }
 
@@ -650,18 +653,16 @@ void XclImpChSourceLink::ReadChSourceLink( XclImpStream& rStrm )
             >> maData.mnFlags
             >> maData.mnNumFmtIdx;
 
+    mxTokenArray.reset();
     if( GetLinkType() == EXC_CHSRCLINK_WORKSHEET )
     {
         // read token array
         XclTokenArray aXclTokArr;
         rStrm >> aXclTokArr;
 
-        // convert xcl formula tokens to Calc's.
-        const ScTokenArray* pTokenArray =
-            GetFormulaCompiler().CreateFormula(EXC_FMLATYPE_CHART, aXclTokArr);
-
-        if (pTokenArray)
-            mpTokenArray.reset(pTokenArray->Clone());
+        // convert BIFF formula tokens to Calc token array
+        if( const ScTokenArray* pTokens = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_CHART, aXclTokArr ) )
+            mxTokenArray.reset( pTokens->Clone() );
     }
 
     // try to read a following CHSTRING record
@@ -688,38 +689,37 @@ void XclImpChSourceLink::SetTextFormats( const XclFormatRunVec& rFormats )
 
 sal_uInt16 XclImpChSourceLink::GetCellCount() const
 {
-    using namespace ::formula;
-
     sal_uInt32 nCellCount = 0;
-    mpTokenArray->Reset();
-    for (const FormulaToken* p = mpTokenArray->First(); p; p = mpTokenArray->Next())
+    if( mxTokenArray.is() )
     {
-        switch (p->GetType())
+        mxTokenArray->Reset();
+        for( const FormulaToken* pToken = mxTokenArray->First(); pToken; pToken = mxTokenArray->Next() )
         {
-            case svSingleRef:
-            case svExternalSingleRef:
-                // single cell
-                ++nCellCount;
-            break;
-            case svDoubleRef:
-            case svExternalDoubleRef:
+            switch( pToken->GetType() )
             {
-                // cell range
-                const ScComplexRefData& rData = static_cast<const ScToken*>(p)->GetDoubleRef();
-                const ScSingleRefData& s = rData.Ref1;
-                const ScSingleRefData& e = rData.Ref2;
-                SCsTAB nTab = e.nTab - s.nTab;
-                SCsCOL nCol = e.nCol - s.nCol;
-                SCsROW nRow = e.nRow - s.nRow;
-                nCellCount += static_cast<sal_uInt32>(nCol+1) *
-                              static_cast<sal_uInt32>(nRow+1) *
-                              static_cast<sal_uInt32>(nTab+1);
+                case ::formula::svSingleRef:
+                case ::formula::svExternalSingleRef:
+                    // single cell
+                    ++nCellCount;
+                break;
+                case ::formula::svDoubleRef:
+                case ::formula::svExternalDoubleRef:
+                {
+                    // cell range
+                    const ScComplexRefData& rComplexRef = static_cast< const ScToken* >( pToken )->GetDoubleRef();
+                    const ScSingleRefData& rRef1 = rComplexRef.Ref1;
+                    const ScSingleRefData& rRef2 = rComplexRef.Ref2;
+                    sal_uInt32 nTabs = static_cast< sal_uInt32 >( rRef2.nTab - rRef1.nTab + 1 );
+                    sal_uInt32 nCols = static_cast< sal_uInt32 >( rRef2.nCol - rRef1.nCol + 1 );
+                    sal_uInt32 nRows = static_cast< sal_uInt32 >( rRef2.nRow - rRef1.nRow + 1 );
+                    nCellCount += nCols * nRows * nTabs;
+                }
+                break;
+                default: ;
             }
-            break;
-            default: ;
         }
     }
-    return limit_cast<sal_uInt16>(nCellCount);
+    return limit_cast< sal_uInt16 >( nCellCount );
 }
 
 void XclImpChSourceLink::ConvertNumFmt( ScfPropertySet& rPropSet, bool bPercent ) const
@@ -738,25 +738,23 @@ Reference< XDataSequence > XclImpChSourceLink::CreateDataSequence( const OUStrin
 {
     Reference< XDataSequence > xDataSeq;
     Reference< XDataProvider > xDataProv = GetDataProvider();
-    if( xDataProv.is() )
+    if( xDataProv.is() && mxTokenArray.is() )
     {
-        if (mpTokenArray)
+        ScCompiler aComp( GetDocPtr(), ScAddress(), *mxTokenArray );
+        aComp.SetGrammar( ::formula::FormulaGrammar::GRAM_ENGLISH );
+        OUStringBuffer aRangeRep;
+        aComp.CreateStringFromTokenArray( aRangeRep );
+        try
         {
-            ScCompiler aComp(GetDocPtr(), ScAddress(), *mpTokenArray);
-            aComp.SetGrammar(::formula::FormulaGrammar::GRAM_ENGLISH);
-            OUStringBuffer aBuf;
-            aComp.CreateStringFromTokenArray(aBuf);
-            xDataSeq = xDataProv->createDataSequenceByRangeRepresentation(
-                aBuf.makeStringAndClear());
+            xDataSeq = xDataProv->createDataSequenceByRangeRepresentation( aRangeRep.makeStringAndClear() );
+            // set sequence role
+            ScfPropertySet aSeqProp( xDataSeq );
+            aSeqProp.SetProperty( EXC_CHPROP_ROLE, rRole );
         }
-        else
+        catch( Exception& )
         {
 //            DBG_ERRORFILE( "XclImpChSourceLink::CreateDataSequence - cannot create data sequence" );
         }
-
-        // set sequence role
-        ScfPropertySet aSeqProp( xDataSeq );
-        aSeqProp.SetProperty( EXC_CHPROP_ROLE, rRole );
     }
     return xDataSeq;
 }
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index 182cd86..4e5bf9b 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -665,6 +665,7 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
             sal_Int8 nApiEscHeight = 0;
             maHlpChEscapement.ReadFromPropertySet( rPropSet );
             maHlpChEscapement.ReadFromPropertySet( rPropSet );
+            maHlpChEscapement.ReadFromPropertySet( rPropSet );
             maHlpChEscapement >> nApiEscapement >> nApiEscHeight;
             rFontData.SetApiEscapement( nApiEscapement );
         }
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 1267e0e..7bbb004 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -1,7 +1,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -326,9 +326,9 @@ public:
     sax_fastparser::FSHelperPtr     CreateOutputStream (
                                         const ::rtl::OUString& sFullStream,
                                         const ::rtl::OUString& sRelativeStream,
-                                        const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation, 
-                                        const char* sContentType, 
-                                        const char* sRelationshipType, 
+                                        const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
+                                        const char* sContentType,
+                                        const char* sRelationshipType,
                                         ::rtl::OUString* pRelationshipId = NULL );
 
     // ignore
@@ -337,7 +337,7 @@ public:
     // only needed for import; ignore
     virtual bool importDocument() throw();
     virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
-    virtual const oox::vml::DrawingPtr getDrawings();
+    virtual oox::vml::Drawing* getVmlDrawing();
     virtual const oox::drawingml::Theme* getCurrentTheme() const;
     virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
     virtual oox::drawingml::chart::ChartConverter& getChartConverter();
@@ -346,8 +346,8 @@ public:
 private:
     virtual ::rtl::OUString implGetImplementationName() const;
 
-    typedef std::map< ::rtl::OUString, 
-        std::pair< ::rtl::OUString, 
+    typedef std::map< ::rtl::OUString,
+        std::pair< ::rtl::OUString,
             sax_fastparser::FSHelperPtr > >     XclExpXmlPathToStateMap;
 
     const XclExpRoot&                           mrRoot;         /// Filter root data.
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index 8383f58..1798242 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -44,8 +44,6 @@
 #include "xistring.hxx"
 #include "xiroot.hxx"
 
-#include <boost/shared_ptr.hpp>
-
 namespace com { namespace sun { namespace star {
     namespace frame
     {
@@ -375,6 +373,7 @@ public:
 
 public:
     explicit            XclImpChSourceLink( const XclImpChRoot& rRoot );
+    virtual             ~XclImpChSourceLink();
 
     /** Reads the CHSOURCELINK record (link to source data). */
     void                ReadChSourceLink( XclImpStream& rStrm );
@@ -407,10 +406,7 @@ public:
 private:
     XclChSourceLink     maData;             /// Contents of the CHSOURCELINK record.
     XclImpStringRef     mxString;           /// Text data (CHSTRING record).
-
-    // Tokens representing data ranges.  This must be ref-counted to allow the
-    // parent class to be stored in a STL container.
-    ::boost::shared_ptr<ScTokenArray> mpTokenArray;
+    ScfRef< ScTokenArray> mxTokenArray;     /// Token array representing the data ranges.
 };
 
 typedef ScfRef< XclImpChSourceLink > XclImpChSourceLinkRef;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 154a26e..b0e645a 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -714,6 +714,24 @@ VclAbstractDialog *  ScAbstractDialogFactory_Impl::CreateScColOrRowDlg(Window*
 }
 //add for ScColOrRowDlg end
 
+//add for ScSortWarningDlg begin
+VclAbstractDialog * ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( Window* pParent, const String& rExtendText, 
+                                                                          const String& rCurrentText, int nId )
+{
+    Dialog * pDlg=NULL;
+    switch ( nId )
+    {
+    case RID_SCDLG_SORT_WARNING:
+        pDlg = new ScSortWarningDlg( pParent, rExtendText, rCurrentText );
+        break;
+    default:
+        break;
+    }
+    if( pDlg )
+        return new VclAbstractDialog_Impl( pDlg );
+    return 0;
+}
+//add for ScSortWarningDlg end
 
 //add for ScDataPilotDatabaseDlg begin
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 839176d..5f28022 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -63,6 +63,7 @@ class ScShowTabDlg;
 class ScStringInputDlg;
 class ScImportOptionsDlg;
 class SfxTabDialog;
+class ScSortWarningDlg;
 
 #define DECL_ABSTDLG_BASE(Class,DialogClass)		\
     DialogClass* 		pDlg;                   	\
@@ -398,6 +399,9 @@ public:
                                                     const String&	rStrLabel,
                                                     int nId,
                                                     BOOL				bColDefault = TRUE );
+
+    virtual VclAbstractDialog * CreateScSortWarningDlg( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId );
+
     virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ); //add for ScDataPilotDatabaseDlg
 
     virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg (  Window* pParent, BOOL bEnableExternal, int nId ) ; //add for ScDataPilotSourceTypeDlg
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index c47eaba..e2fb90b 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -34,7 +34,7 @@
 #undef SC_DLLIMPLEMENTATION
 
 
-
+#include <vcl/msgbox.hxx>
 #include "tpsort.hxx"
 #include "sortdlg.hxx"
 #include "scresid.hxx"
@@ -69,3 +69,42 @@ __EXPORT ScSortDlg::~ScSortDlg()
 {
 }
 
+//==================================================================
+ScSortWarningDlg::ScSortWarningDlg( Window* pParent, 
+                                   const String& rExtendText,
+                                   const String& rCurrentText ):
+        ModalDialog     ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
+        aFtText         ( this, ScResId( FT_TEXT ) ),
+        aFtTip          ( this, ScResId( FT_TIP ) ),
+        aBtnExtSort     ( this, ScResId( BTN_EXTSORT ) ),
+        aBtnCurSort     ( this, ScResId( BTN_CURSORT ) ),
+        aBtnCancel      ( this, ScResId( BTN_CANCEL ) )
+{
+    String sTextName = aFtText.GetText();
+    sTextName.SearchAndReplaceAscii("%1", rExtendText);
+    sTextName.SearchAndReplaceAscii("%2", rCurrentText);
+    aFtText.SetText( sTextName );
+
+    aBtnExtSort	.SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+    aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+
+    FreeResource();
+}
+
+ScSortWarningDlg::~ScSortWarningDlg()
+{
+}
+
+IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
+{
+    if ( pBtn == &aBtnExtSort )
+    {
+        EndDialog( BTN_EXTEND_RANGE );
+    }
+    else if( pBtn == &aBtnCurSort )
+    {
+        EndDialog( BTN_CURRENT_SELECTION );
+    }
+    return 0;
+}
+//========================================================================//
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 7032b2d..eceb4c4 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -481,7 +481,7 @@ void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const String& rN
     pDoc->maRealRangeNameMap.insert(NamePairMap::value_type(aUpperName, rName));
 }
 
-void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol, 
+void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol,
                                      TokenRef pToken, sal_uInt32 nFmtIndex)
 {
     if (!isDocInitialized(nFileId))
@@ -659,12 +659,12 @@ SCsTAB ScExternalRefCache::getTabSpan( sal_uInt16 nFileId, const String& rStartT
     vector<TableName>::const_iterator itrBeg = pDoc->maTableNames.begin();
     vector<TableName>::const_iterator itrEnd = pDoc->maTableNames.end();
 
-    vector<TableName>::const_iterator itrStartTab = ::std::find_if( itrBeg, itrEnd, 
+    vector<TableName>::const_iterator itrStartTab = ::std::find_if( itrBeg, itrEnd,
             TabNameSearchPredicate( rStartTabName));
     if (itrStartTab == itrEnd)
         return -1;
 
-    vector<TableName>::const_iterator itrEndTab = ::std::find_if( itrBeg, itrEnd, 
+    vector<TableName>::const_iterator itrEndTab = ::std::find_if( itrBeg, itrEnd,
             TabNameSearchPredicate( rEndTabName));
     if (itrEndTab == itrEnd)
         return 0;
@@ -1309,7 +1309,7 @@ void ScExternalRefManager::RefCells::moveTable(SCTAB nOldTab, SCTAB nNewTab, boo
     list<TabItemRef>::iterator itrNew = getTabPos(nNewTab);
     if (bCopy)
     {
-        // Simply make a duplicate of the original table, insert it at the 
+        // Simply make a duplicate of the original table, insert it at the
         // new tab position, and increment the table index for all tables
         // that come after that inserted table.
 
@@ -1317,8 +1317,9 @@ void ScExternalRefManager::RefCells::moveTable(SCTAB nOldTab, SCTAB nNewTab, boo
         xNewTab->mnIndex = nNewTab;
         maTables.insert(itrNew, xNewTab);
         list<TabItemRef>::iterator itr = itrNew, itrEnd = maTables.end();
-        for (++itr; itr != itrEnd; ++itr)
-            (*itr)->mnIndex += 1;
+        if (itr != itrEnd)  // #i99807# check that itr is not at end already
+            for (++itr; itr != itrEnd; ++itr)
+                (*itr)->mnIndex += 1;
     }
     else
     {
@@ -1396,7 +1397,7 @@ void ScExternalRefManager::RefCells::refreshAllCells(ScExternalRefManager& rRefM
     {
         SCTAB nTab = (*itrTab)->mnIndex;
         ColSet& rCols = (*itrTab)->maCols;
-        for (ColSet::iterator itrCol = rCols.begin(), itrColEnd = rCols.end(); 
+        for (ColSet::iterator itrCol = rCols.begin(), itrColEnd = rCols.end();
               itrCol != itrColEnd; ++itrCol)
         {
             SCCOL nCol = itrCol->first;
@@ -1411,7 +1412,7 @@ void ScExternalRefManager::RefCells::refreshAllCells(ScExternalRefManager& rRefM
                     // This cell still contains an external refernce.
                     aNewRows.insert(nRow);
             }
-            // Update the rows so that cells with no external references are 
+            // Update the rows so that cells with no external references are
             // no longer tracked.
             rRows.swap(aNewRows);
         }
diff --git a/sc/source/ui/inc/scui_def.hxx b/sc/source/ui/inc/scui_def.hxx
index e6df743..f44e800 100644
--- a/sc/source/ui/inc/scui_def.hxx
+++ b/sc/source/ui/inc/scui_def.hxx
@@ -53,6 +53,8 @@
 #define BTN_PASTE_NAME	100  // from namepast.hxx
 #define BTN_PASTE_LIST	101  // from namepast.hxx
 
+#define BTN_EXTEND_RANGE       150
+#define BTN_CURRENT_SELECTION  151
 #define SCRET_REMOVE	0x42 //from subtdlg.hxx
 #endif
 
diff --git a/sc/source/ui/inc/sortdlg.hrc b/sc/source/ui/inc/sortdlg.hrc
index 2c0fbf4..f67927c 100644
--- a/sc/source/ui/inc/sortdlg.hrc
+++ b/sc/source/ui/inc/sortdlg.hrc
@@ -32,6 +32,7 @@
 #include "sc.hrc"   // -> RID_SCDLG_SORT
                     // -> RID_SCPAGE_SORT_FIELDS
                     // -> RID_SCPAGE_SORT_OPTIONS
+                    // -> RID_SCDLG_SORT_WARNING
                     // -> SCSTR_NONAME
                     // -> SCSTR_UNDEFINED
                     // -> SCSTR_FIELD
@@ -40,6 +41,7 @@
 #define RID_SCDLG_SORT			256
 #define RID_SCPAGE_SORT_FIELDS	257
 #define RID_SCPAGE_SORT_OPTIONS	258
+#define RID_SCDLG_SORT_WARNING
 */
 
 #define TP_FIELDS			1
@@ -80,6 +82,12 @@
 #define FT_ALGORITHM        18
 #define LB_ALGORITHM        19
 
+//#define RID_SCDLG_SORT_WARNING
+#define FT_TEXT             1
+#define FT_TIP              2
+#define BTN_EXTSORT         3
+#define BTN_CURSORT         4
+#define BTN_CANCEL          5
 
 
 
diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx
index be15a8b..32a711b 100644
--- a/sc/source/ui/inc/sortdlg.hxx
+++ b/sc/source/ui/inc/sortdlg.hxx
@@ -1,7 +1,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -32,6 +32,10 @@
 #define SC_SORTDLG_HXX
 
 #include <sfx2/tabdlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include "scui_def.hxx" //CHINA001
 
 #ifndef LAYOUT_SFX_TABDIALOG_BROKEN
 #define LAYOUT_SFX_TABDIALOG_BROKEN 1
@@ -65,6 +69,20 @@ inline void ScSortDlg::SetByRows ( BOOL bByRows  )	{ bIsByRows = bByRows; }
 inline BOOL ScSortDlg::GetHeaders() const 			{ return bIsHeaders; }
 inline BOOL ScSortDlg::GetByRows () const 			{ return bIsByRows; }
 
+class ScSortWarningDlg : public ModalDialog
+{
+public:
+    ScSortWarningDlg( Window* pParent, const String& rExtendText,const String& rCurrentText );
+            ~ScSortWarningDlg();
+    DECL_LINK( BtnHdl, PushButton* );
+private:
+    FixedText       aFtText;
+    FixedText       aFtTip;
+    PushButton      aBtnExtSort;
+    PushButton      aBtnCurSort;
+    CancelButton    aBtnCancel;
+};
+
 #if !LAYOUT_SFX_TABDIALOG_BROKEN
 #include <layout/layout-post.hxx>
 #endif
diff --git a/sc/source/ui/src/sortdlg.src b/sc/source/ui/src/sortdlg.src
index 8fcae60..a068f0e 100644
--- a/sc/source/ui/src/sortdlg.src
+++ b/sc/source/ui/src/sortdlg.src
@@ -304,4 +304,48 @@ TabDialog RID_SCDLG_SORT
     };
 };
 
+ModalDialog RID_SCDLG_SORT_WARNING
+{
+    OutputSize = TRUE ;
+    SVLook = TRUE ; 
+    Size = MAP_APPFONT ( 180 , 91 ) ;
+    Text [ en-US ] = "Sort Range" ;
+    Moveable = TRUE ;
+    Closeable = FALSE ;
+    FixedText FT_TEXT
+    {    
+        Pos = MAP_APPFONT ( 8 , 3 ) ;
+        Size = MAP_APPFONT ( 170 , 33 ) ;
+        WordBreak = TRUE;
+        Text [ en-US ] = "The cells next to the current selection also contain data. Do you want to extend the sort range to %1, or sort the currently selected range, %2?";
+    };
+    FixedText FT_TIP
+    {
+        Pos = MAP_APPFONT ( 8 , 55 ) ;
+        Size = MAP_APPFONT ( 170 , 33 ) ;
+        WordBreak = TRUE ;
+        Text [ en-US ] = "Tip: The sort range can be detected automatically. Place the cell cursor inside a list and execute sort. The whole range of neighboring non-empty cells will then be sorted.";
+    };
+    PushButton BTN_EXTSORT
+    {
+        Pos = MAP_APPFONT ( 6 , 39 ) ;
+        Size = MAP_APPFONT ( 60 , 14 ) ;
+        TabStop = TRUE ;
+        DefButton = TRUE ;
+        Text [ en-US ] = "Extend selection";
+    };
+    PushButton BTN_CURSORT
+    {
+        Pos = MAP_APPFONT ( 70 , 39 ) ;
+        Size = MAP_APPFONT ( 60 , 14 ) ;
+        TabStop = TRUE ;
+        Text [ en-US ] = "Current selection";
+    };
+    CancelButton BTN_CANCEL
+    {
+        Pos = MAP_APPFONT ( 134 , 39 ) ;
+        Size = MAP_APPFONT ( 40 , 14 ) ;
+        TabStop = TRUE ;
+    };
+};
 
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index e3748ab..2e41ac4 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -138,6 +138,77 @@ bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange )
     return bRet;
 }
 
+BOOL lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
+{
+    ScTabViewShell* pTabViewShell   = pData->GetViewShell();
+    ScDBData*	pDBData             = pTabViewShell->GetDBData();
+    ScDocument* pDoc                = pData->GetDocument();
+    SCTAB nTab                      = pData->GetTabNo();
+    ScDirection eFillDir            = DIR_TOP;
+    BOOL  bSort                     = TRUE;
+    ScRange aExternalRange;
+
+    if( rSortParam.nCol1 != rSortParam.nCol2 )
+        eFillDir = DIR_LEFT;
+    if( rSortParam.nRow1 != rSortParam.nRow2 )
+        eFillDir = DIR_TOP;
+
+    SCSIZE nCount = pDoc->GetEmptyLinesInBlock( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab, eFillDir );
+
+    if( rSortParam.nRow2 == MAXROW )
+        aExternalRange = ScRange( rSortParam.nCol1,sal::static_int_cast<SCROW>( nCount ), nTab );
+    else
+        aExternalRange = ScRange( pData->GetCurX(), pData->GetCurY(), nTab );
+
+    SCROW nStartRow = aExternalRange.aStart.Row();
+    SCCOL nStartCol = aExternalRange.aStart.Col();
+    SCROW nEndRow   = aExternalRange.aEnd.Row();
+    SCCOL nEndCol   = aExternalRange.aEnd.Col();
+    pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, FALSE );
+    aExternalRange.aStart.SetRow( nStartRow );
+    aExternalRange.aStart.SetCol( nStartCol );
+    aExternalRange.aEnd.SetRow( nEndRow );
+    aExternalRange.aEnd.SetCol( nEndCol );
+
+    if(( rSortParam.nCol1 == rSortParam.nCol2 && aExternalRange.aStart.Col() != aExternalRange.aEnd.Col() ) ||
+        ( rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row() ) )
+    {
+        USHORT nFmt = SCA_VALID;
+        String aExtendStr,aCurrentStr;
+
+        pTabViewShell->AddHighlightRange( aExternalRange,Color( COL_LIGHTBLUE ) );
+        ScRange rExtendRange( aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), nTab, aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row(), nTab );
+        rExtendRange.Format( aExtendStr, nFmt, pDoc );
+
+        ScRange rCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab );
+        rCurrentRange.Format( aCurrentStr, nFmt, pDoc );
+
+        ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+        DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
+
+        VclAbstractDialog* pWarningDlg = pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(),aExtendStr,aCurrentStr,RID_SCDLG_SORT_WARNING );
+        DBG_ASSERT(pWarningDlg, "Dialog create fail!");//CHINA001
+        short bResult = pWarningDlg->Execute();
+        if( bResult == BTN_EXTEND_RANGE || bResult == BTN_CURRENT_SELECTION )
+        {
+            if( bResult == BTN_EXTEND_RANGE )
+            {
+                pTabViewShell->MarkRange( aExternalRange, FALSE );
+                pDBData->SetArea( nTab, aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row() );
+            }
+        }
+        else
+        {
+            bSort = FALSE;
+            pData->GetDocShell()->CancelAutoDBRange();
+        }
+
+        delete pWarningDlg;
+        pTabViewShell->ClearHighlightRanges();
+    }
+    return bSort;
+}
+
 void ScCellShell::ExecuteDB( SfxRequest& rReq )
 {
     ScTabViewShell*	pTabViewShell  	= GetViewData()->GetViewShell();
@@ -332,182 +403,203 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
         case SID_SORT_DESCENDING:
         case SID_SORT_ASCENDING:
             {
-                SfxItemSet	aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+                //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
+                //the patch comes from maoyg
                 ScSortParam aSortParam;
                 ScDBData*	pDBData = pTabViewShell->GetDBData();
-                SCCOL nCol          = GetViewData()->GetCurX();
-                SCCOL nTab          = GetViewData()->GetTabNo();
-                ScDocument* pDoc    = GetViewData()->GetDocument();
-                BOOL  bHasHeader    = FALSE;
+                ScViewData* pData   = GetViewData();
 
                 pDBData->GetSortParam( aSortParam );
 
-                bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
-              
-                if( nCol < aSortParam.nCol1 )
-                    nCol = aSortParam.nCol1;
-                else if( nCol > aSortParam.nCol2 )
-                    nCol = aSortParam.nCol2;
+                if( lcl_GetSortParam( pData, aSortParam ) )
+                {
+                    SfxItemSet  aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+                    SCCOL nCol  = GetViewData()->GetCurX();
+                    SCCOL nTab  = GetViewData()->GetTabNo();
+                    ScDocument* pDoc    = GetViewData()->GetDocument();
 
-                aSortParam.bHasHeader		= bHasHeader;
-                aSortParam.bByRow			= TRUE;
-                aSortParam.bCaseSens		= FALSE;
-                aSortParam.bIncludePattern  = TRUE;
-                aSortParam.bInplace 		= TRUE;
-                aSortParam.bDoSort[0]		= TRUE;
-                aSortParam.nField[0]		= nCol;
-                aSortParam.bAscending[0]	= (nSlotId == SID_SORT_ASCENDING);
+                    pDBData->GetSortParam( aSortParam );
+                    BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
 
-                for ( USHORT i=1; i<MAXSORT; i++ )
-                    aSortParam.bDoSort[i] = FALSE;
+                    if( nCol < aSortParam.nCol1 )
+                        nCol = aSortParam.nCol1;
+                    else if( nCol > aSortParam.nCol2 )
+                        nCol = aSortParam.nCol2;
 
-                aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
+                    aSortParam.bHasHeader		= bHasHeader;
+                    aSortParam.bByRow			= TRUE;
+                    aSortParam.bCaseSens		= FALSE;
+                    aSortParam.bIncludePattern	= TRUE;
+                    aSortParam.bInplace 		= TRUE;
+                    aSortParam.bDoSort[0]		= TRUE;
+                    aSortParam.nField[0]		= nCol;
+                    aSortParam.bAscending[0]	= (nSlotId == SID_SORT_ASCENDING);
 
-                pTabViewShell->UISort( aSortParam );		// Teilergebnisse bei Bedarf neu
+                    for ( USHORT i=1; i<MAXSORT; i++ )
+                        aSortParam.bDoSort[i] = FALSE;
 
-                rReq.Done();
+                    aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
+
+                    pTabViewShell->UISort( aSortParam );		// Teilergebnisse bei Bedarf neu
+
+                    rReq.Done();
+                }
             }
             break;
-
+        
         case SID_SORT:
             {
                 const SfxItemSet* pArgs = rReq.GetArgs();
 
+                //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
+                //the patch comes from maoyg
+
                 if ( pArgs )		// Basic
                 {
                     ScSortParam aSortParam;
-                    ScDBData* pDBData = pTabViewShell->GetDBData();
+                    ScDBData*	pDBData = pTabViewShell->GetDBData();
+                    ScViewData* pData   = GetViewData();
+
                     pDBData->GetSortParam( aSortParam );
-                    aSortParam.bInplace = TRUE;				// von Basic immer
-
-                    const SfxPoolItem* pItem;
-                    if ( pArgs->GetItemState( SID_SORT_BYROW, TRUE, &pItem ) == SFX_ITEM_SET )
-                        aSortParam.bByRow = ((const SfxBoolItem*)pItem)->GetValue();
-                    if ( pArgs->GetItemState( SID_SORT_HASHEADER, TRUE, &pItem ) == SFX_ITEM_SET )
-                        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_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
-                        aSortParam.bIncludePattern = ((const SfxBoolItem*)pItem)->GetValue();
-                    if ( pArgs->GetItemState( SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
+
+                    if( lcl_GetSortParam( pData, aSortParam ) )
                     {
-                        USHORT nUserIndex = ((const SfxUInt16Item*)pItem)->GetValue();
-                        aSortParam.bUserDef = ( nUserIndex != 0 );
-                        if ( nUserIndex )
-                            aSortParam.nUserIndex = nUserIndex - 1;		// Basic: 1-basiert
-                    }
+                        ScDocument* pDoc = GetViewData()->GetDocument();
+
+                        pDBData->GetSortParam( aSortParam );
+                        BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+                        if( bHasHeader )
+                            aSortParam.bHasHeader = bHasHeader;
+
+                        aSortParam.bInplace = TRUE;				// von Basic immer
+
+                        const SfxPoolItem* pItem;
+                        if ( pArgs->GetItemState( SID_SORT_BYROW, TRUE, &pItem ) == SFX_ITEM_SET )
+                            aSortParam.bByRow = ((const SfxBoolItem*)pItem)->GetValue();
+                        if ( pArgs->GetItemState( SID_SORT_HASHEADER, TRUE, &pItem ) == SFX_ITEM_SET )
+                            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_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
+                            aSortParam.bIncludePattern = ((const SfxBoolItem*)pItem)->GetValue();
+                        if ( pArgs->GetItemState( SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
+                        {
+                            USHORT nUserIndex = ((const SfxUInt16Item*)pItem)->GetValue();
+                            aSortParam.bUserDef = ( nUserIndex != 0 );
+                            if ( nUserIndex )
+                                aSortParam.nUserIndex = nUserIndex - 1;		// Basic: 1-basiert
+                        }
 
-                    SCCOLROW nField0 = 0;
-                    if ( pArgs->GetItemState( FN_PARAM_1, TRUE, &pItem ) == SFX_ITEM_SET )
-                        nField0 = ((const SfxInt32Item*)pItem)->GetValue();
-                    aSortParam.bDoSort[0] = ( nField0 != 0 );
-                    aSortParam.nField[0] = nField0 > 0 ? (nField0-1) : 0;
-                    if ( pArgs->GetItemState( FN_PARAM_2, TRUE, &pItem ) == SFX_ITEM_SET )
-                        aSortParam.bAscending[0] = ((const SfxBoolItem*)pItem)->GetValue();
-                    SCCOLROW nField1 = 0;
-                    if ( pArgs->GetItemState( FN_PARAM_3, TRUE, &pItem ) == SFX_ITEM_SET )
-                        nField1 = ((const SfxInt32Item*)pItem)->GetValue();
-                    aSortParam.bDoSort[1] = ( nField1 != 0 );
-                    aSortParam.nField[1] = nField1 > 0 ? (nField1-1) : 0;
-                    if ( pArgs->GetItemState( FN_PARAM_4, TRUE, &pItem ) == SFX_ITEM_SET )
-                        aSortParam.bAscending[1] = ((const SfxBoolItem*)pItem)->GetValue();
-                    SCCOLROW nField2 = 0;
-                    if ( pArgs->GetItemState( FN_PARAM_5, TRUE, &pItem ) == SFX_ITEM_SET )
-                        nField2 = ((const SfxInt32Item*)pItem)->GetValue();
-                    aSortParam.bDoSort[2] = ( nField2 != 0 );
-                    aSortParam.nField[2] = nField2 > 0 ? (nField2-1) : 0;
-                    if ( pArgs->GetItemState( FN_PARAM_6, TRUE, &pItem ) == SFX_ITEM_SET )
-                        aSortParam.bAscending[2] = ((const SfxBoolItem*)pItem)->GetValue();
-
-                    // Teilergebnisse bei Bedarf neu
-                    pTabViewShell->UISort( aSortParam );
-                    rReq.Done();
+                        SCCOLROW nField0 = 0;
+                        if ( pArgs->GetItemState( FN_PARAM_1, TRUE, &pItem ) == SFX_ITEM_SET )
+                            nField0 = ((const SfxInt32Item*)pItem)->GetValue();
+                        aSortParam.bDoSort[0] = ( nField0 != 0 );
+                        aSortParam.nField[0] = nField0 > 0 ? (nField0-1) : 0;
+                        if ( pArgs->GetItemState( FN_PARAM_2, TRUE, &pItem ) == SFX_ITEM_SET )
+                            aSortParam.bAscending[0] = ((const SfxBoolItem*)pItem)->GetValue();
+                        SCCOLROW nField1 = 0;
+                        if ( pArgs->GetItemState( FN_PARAM_3, TRUE, &pItem ) == SFX_ITEM_SET )
+                            nField1 = ((const SfxInt32Item*)pItem)->GetValue();
+                        aSortParam.bDoSort[1] = ( nField1 != 0 );
+                        aSortParam.nField[1] = nField1 > 0 ? (nField1-1) : 0;
+                        if ( pArgs->GetItemState( FN_PARAM_4, TRUE, &pItem ) == SFX_ITEM_SET )
+                            aSortParam.bAscending[1] = ((const SfxBoolItem*)pItem)->GetValue();
+                        SCCOLROW nField2 = 0;
+                        if ( pArgs->GetItemState( FN_PARAM_5, TRUE, &pItem ) == SFX_ITEM_SET )
+                            nField2 = ((const SfxInt32Item*)pItem)->GetValue();
+                        aSortParam.bDoSort[2] = ( nField2 != 0 );
+                        aSortParam.nField[2] = nField2 > 0 ? (nField2-1) : 0;
+                        if ( pArgs->GetItemState( FN_PARAM_6, TRUE, &pItem ) == SFX_ITEM_SET )
+                            aSortParam.bAscending[2] = ((const SfxBoolItem*)pItem)->GetValue();
+
+                        // Teilergebnisse bei Bedarf neu
+                        pTabViewShell->UISort( aSortParam );
+                        rReq.Done();
+                    }
                 }
                 else
                 {
-                    //CHINA001 ScSortDlg*	pDlg = NULL;
-                    SfxAbstractTabDialog* pDlg = NULL;
                     ScSortParam aSortParam;
-                    SfxItemSet	aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+                    ScDBData*	pDBData = pTabViewShell->GetDBData();
+                    ScViewData* pData   = GetViewData();
 
-                    ScDBData* pDBData = pTabViewShell->GetDBData();
                     pDBData->GetSortParam( aSortParam );
 
-                    aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
-                    //CHINA001 pDlg = new ScSortDlg( pTabViewShell->GetDialogParent(), &aArgSet );
-                    ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
-                    DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
+                    if( lcl_GetSortParam( pData, aSortParam ) )
+                    {
+                        SfxAbstractTabDialog* pDlg = NULL;
+                        ScDocument* pDoc = GetViewData()->GetDocument();
+                        SfxItemSet	aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
 
-                    pDlg = pFact->CreateScSortDlg( pTabViewShell->GetDialogParent(),  &aArgSet, RID_SCDLG_SORT );
-                    DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
-                    pDlg->SetCurPageId(1);
+                        pDBData->GetSortParam( aSortParam );
+                        BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+                        if( bHasHeader )
+                            aSortParam.bHasHeader = bHasHeader;
 
-                    if ( pDlg->Execute() == RET_OK )
-                    {
-                        const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
-                        const ScSortParam& rOutParam = ((const ScSortItem&)
-                                       pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
+                        aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
 
-                        // Teilergebnisse bei Bedarf neu
-                        pTabViewShell->UISort( rOutParam );
+                        ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+                        DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
 
-                        if ( rOutParam.bInplace )
+                        pDlg = pFact->CreateScSortDlg( pTabViewShell->GetDialogParent(),  &aArgSet, RID_SCDLG_SORT );
+                        DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
+                        pDlg->SetCurPageId(1);
+
+                        if ( pDlg->Execute() == RET_OK )
                         {
-                            rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
-                                                rOutParam.bByRow ) );
-                            rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
-                                                rOutParam.bHasHeader ) );
-                            rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
-                                                rOutParam.bCaseSens ) );
-                            rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
-                                                rOutParam.bIncludePattern ) );
-                            USHORT nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
-                            rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
-                            if ( rOutParam.bDoSort[0] )
-                            {
-                                rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
-                                                    rOutParam.nField[0] + 1 ) );
-                                rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
-                                                    rOutParam.bAscending[0] ) );
-                            }
-                            if ( rOutParam.bDoSort[1] )
-                            {
-                                rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
-                                                    rOutParam.nField[1] + 1 ) );
-                                rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
-                                                    rOutParam.bAscending[1] ) );
-                            }
-                            if ( rOutParam.bDoSort[2] )
+                            const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+                            const ScSortParam& rOutParam = ((const ScSortItem&)
+                                pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
+
+                            // Teilergebnisse bei Bedarf neu
+                            pTabViewShell->UISort( rOutParam );
+
+                            if ( rOutParam.bInplace )
                             {
-                                rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
-                                                    rOutParam.nField[2] + 1 ) );
-                                rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
-                                                    rOutParam.bAscending[2] ) );
+                                rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
+                                    rOutParam.bByRow ) );
+                                rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
+                                    rOutParam.bHasHeader ) );
+                                rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
+                                    rOutParam.bCaseSens ) );
+                                rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
+                                    rOutParam.bIncludePattern ) );
+                                USHORT nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
+                                rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
+                                if ( rOutParam.bDoSort[0] )
+                                {
+                                    rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
+                                        rOutParam.nField[0] + 1 ) );
+                                    rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
+                                        rOutParam.bAscending[0] ) );
+                                }
+                                if ( rOutParam.bDoSort[1] )
+                                {
+                                    rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
+                                        rOutParam.nField[1] + 1 ) );
+                                    rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
+                                        rOutParam.bAscending[1] ) );
+                                }
+                                if ( rOutParam.bDoSort[2] )
+                                {
+                                    rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
+                                        rOutParam.nField[2] + 1 ) );
+                                    rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
+                                        rOutParam.bAscending[2] ) );
+                                }
                             }
+
+                            rReq.Done();
                         }
+                        else
+                            GetViewData()->GetDocShell()->CancelAutoDBRange();
 
-                        rReq.Done();
+                        delete pDlg;
                     }
-                    else
-                        GetViewData()->GetDocShell()->CancelAutoDBRange();
-
-                    delete pDlg;
                 }
             }
             break;
 
-/*
-            {
-
-                USHORT			nId  = ScPivotLayoutWrapper::GetChildWindowId();
-                SfxChildWindow* pWnd = pSfxApp->GetChildWindow( nId );
-
-                pScMod->SetRefDialog( nId, pWnd ? FALSE : TRUE );
-
-            }
-            break;
-*/
-
         case SID_FILTER:
             {
                 const SfxItemSet* pArgs = rReq.GetArgs();
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 72bf6cc..93a9b3e 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -950,16 +950,12 @@ void ScCellShell::Execute( SfxRequest& rReq )
             DBG_ERROR("Execute von InputLine-Status");
             break;
 
-
         case SID_STATUS_DOCPOS:
-            {
-                //!	Navigator an-/ausschalten (wie im Writer) ???
-                //!pViewData->GetDispatcher().Execute( SID_NAVIGATOR,
-                //!						  SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
-            }
+            // Launch navigator.
+            GetViewData()->GetDispatcher().Execute( 
+                SID_NAVIGATOR, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
             break;
 
-
         case SID_MARKAREA:
             // called from Basic at the hidden view to select a range in the visible view
             DBG_ERROR("old slot SID_MARKAREA");
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index d6b06c4..e106539 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -991,14 +991,6 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
             }
             break;
 
-        case SID_STATUS_DOCPOS:
-            {
-                //!	Navigator an-/ausschalten (wie im Writer) ???
-                //!GetViewData()->GetDispatcher().Execute( SID_NAVIGATOR,
-                //!						  SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
-            }
-            break;
-
         case FID_PROTECT_DOC:
             {
                 ScDocument* 		pDoc = GetViewData()->GetDocument();


More information about the ooo-build-commit mailing list