~ubuntu-branches/ubuntu/karmic/openoffice.org-l10n/karmic

« back to all changes in this revision

Viewing changes to ooo-build/scratch/sc-vba/vbarange.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Chris Cheney
  • Date: 2008-01-08 23:17:08 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080108231708-7f5yc4h021ikwgyz
Tags: 1:2.3.1-3ubuntu1
* Copy of the openoffice.org source.
  - debian/changelog: Change source name.
  - debian/control.in: Change source name.
  - debian/control: Regenerate control file.

* Resynchronise with Debian (r989). Remaining changes:
  - debian/broffice.org.postrm.in:
    . Change diversions to ubuntu bitmap filenames.
  - debian/broffice.org.preinst.in:
    . Change diversions to ubuntu bitmap filenames.
  - debian/control.2.in:
    . Add file for Ubuntu.
  - debian/control.in:
    . Change maintainer line.
    . Use imagemagick instead of graphicsmagick.
    . Change bzr repo location.
    . Use java-runtime-depends variable for java dependencies.
    . Make openoffice.org-core Depends on openoffice.org-hyphenation.
    . Add package openoffice.org-style-human.
    . Various other minor Ubuntu changes.
  - debian/control.l10n.in:
    . Add file for Ubuntu.
  - debian/control.lang.in:
    . Add L10N_COMMON to Depends.
  - debian/control.mozilla.in:
    . Add Xb-Npp-xxx tags according to "firefox distro add-on suport" spec.
  - debian/control.ubuntu.in:
    . Add file for Ubuntu.
  - debian/deppackage.postinst.in:
    . Add file for Ubuntu.
  - debian/module-po.map:
    . Add file for Ubuntu.
  - debian/ooo-build-ubuntu.diff:
    . Various Ubuntu specific changes to ooo-build.
  - debian/rules:
    . Add USE_LZMA_COMPRESS option.
    . Add USE_COMMON_DOCDIR option.
    . Add support to build on lpia.
    . Add support to build l10n as a separate source.
    . Add java-runtime-depends variable for java dependencies.
    . Add support to chmod +x programs in debian dir.
    . Add support to uuencode binary files in ubuntu dir.
    . Add support to Ubuntu specific bitmaps.
    . Use imagemagick instead of graphicsmagick.
    . Add support for openoffice.org-style-human package.
    . Add support for launchpad translations.
    . Various Ubuntu specific changes.
  - debian/scripts/convert2po:
    . Add file for Ubuntu.
  - debian/scripts/fix_image_rgb:
    . Use imagemagick instead of graphicsmagick.
  - debian/scripts/gsifilter.py:
    . Add file for Ubuntu.
  - debian/scripts/splitgsi:
    . Add file for Ubuntu.
  - debian/template.desktop.in:
    . Add NoDisplay=true.
  - ooo-build/configure.in:
    . Added support for Hardy.
  - ooo-build/distro-configs/UbuntuHardy.conf.in:
    . Added support for Hardy.
  - ooo-build/distro-configs/UbuntuHardy64.conf.in:
    . Added support for Hardy.
  - ooo-build/patches/src680/apply:
    . Added support for Hardy.
  - ooo-build/patches/src680/ubuntu-lpi.diff:
    . Updated patch.
  - ubuntu/*
    . Various Ubuntu specific changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 *
5
5
 *  $RCSfile: vbarange.cxx,v $
6
6
 *
7
 
 *  $Revision: 10297 $
 
7
 *  $Revision: 10757 $
8
8
 *
9
 
 *  last change: $Author: noelpwer $ $Date: 2007-09-14 10:15:55 -0500 (Fri, 14 Sep 2007) $
 
9
 *  last change: $Author: noelpwer $ $Date: 2007-11-07 05:19:30 -0600 (Wed, 07 Nov 2007) $
10
10
 *
11
11
 *  The Contents of this file are made available subject to
12
12
 *  the terms of GNU Lesser General Public License Version 2.1.
424
424
public:
425
425
        NumFormatHelper( const uno::Reference< table::XCellRange >& xRange )
426
426
        {
427
 
                mxSupplier.set( getCurrentDocument(), uno::UNO_QUERY_THROW );
 
427
                mxSupplier.set( getModelFromRange( xRange ), uno::UNO_QUERY_THROW );
428
428
                mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
429
429
                mxFormats = mxSupplier->getNumberFormats();
430
430
        }
625
625
        {
626
626
                case  uno::TypeClass_BOOLEAN:
627
627
                {
628
 
                        sal_Bool bState;
 
628
                        sal_Bool bState = sal_False;
629
629
                        if ( aValue >>= bState   )
630
630
                        {
631
631
                                uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
652
652
                }
653
653
                default:
654
654
                {
655
 
                        double nDouble;
 
655
                        double nDouble = 0.0;
656
656
                        if ( aValue >>= nDouble )
657
657
                                xCell->setValue( nDouble );
658
658
                        else
1000
1000
        
1001
1001
};
1002
1002
 
1003
 
static table::CellRangeAddress getCellRangeAddress( const uno::Any& aParam,
1004
 
const uno::Reference< sheet::XSpreadsheet >& xDoc )
1005
 
{
1006
 
        uno::Reference< table::XCellRange > xRangeParam;
1007
 
        switch ( aParam.getValueTypeClass() )
1008
 
        {
1009
 
                case uno::TypeClass_STRING:
1010
 
                {
1011
 
                        rtl::OUString rString;
1012
 
                        aParam >>= rString;
1013
 
                        xRangeParam = ScVbaRange::getCellRangeForName( rString, xDoc );
1014
 
                        break;
1015
 
                }
1016
 
                case uno::TypeClass_INTERFACE:
1017
 
                {
1018
 
                        uno::Reference< excel::XRange > xRange;
1019
 
                        aParam >>= xRange;
1020
 
                        if ( xRange.is() )
1021
 
                                xRange->getCellRange() >>= xRangeParam;
1022
 
                        break;
1023
 
                }
1024
 
                default:
1025
 
                        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't extact CellRangeAddress from type" ) ), uno::Reference< uno::XInterface >() );
1026
 
        }
1027
 
        uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRangeParam, uno::UNO_QUERY_THROW );
1028
 
        return xAddressable->getRangeAddress();
1029
 
}
1030
 
 
1031
1003
bool
1032
1004
getCellRangesForAddress( USHORT& rResFlags, const rtl::OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, ScAddress::Convention& eConv )
1033
1005
{
1048
1020
        return false;
1049
1021
1050
1022
 
1051
 
ScVbaRange*
1052
 
getRangeForName( const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, ScDocShell* pDocSh, table::CellRangeAddress& pAddr ) throw ( uno::RuntimeException )
 
1023
bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, ScRange& refRange, ScRangeList& aCellRanges, ScAddress::Convention aConv = ScAddress::CONV_XL_A1 ) throw ( uno::RuntimeException )
1053
1024
{
1054
 
        ScAddress::Convention eConv = ScAddress::CONV_XL_A1; 
1055
1025
        // see if there is a match with a named range
1056
1026
        uno::Reference< beans::XPropertySet > xProps( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
1057
1027
        uno::Reference< container::XNameAccess > xNameAccess( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NamedRanges") ) ), uno::UNO_QUERY_THROW );
1058
1028
        // Strangly enough you can have Range( "namedRange1, namedRange2, etc," )       
1059
 
        ScRangeList aCellRanges;
1060
1029
        // loop around each ',' seperated name
1061
1030
        std::vector< rtl::OUString > vNames;
1062
1031
        sal_Int32 nIndex = 0;
1073
1042
        std::vector< rtl::OUString >::iterator it_end = vNames.end(); 
1074
1043
        for ( ; it != it_end; ++it )
1075
1044
        {
 
1045
                
 
1046
                ScAddress::Convention eConv = aConv; 
1076
1047
                // spaces are illegal ( but the user of course can enter them )
1077
1048
                rtl::OUString sAddress = (*it).trim();
1078
1049
                if ( xNameAccess->hasByName( sAddress ) )
1083
1054
                        // style is may not be XL_A1
1084
1055
                        eConv = pDocSh->GetDocument()->GetAddressConvention();
1085
1056
                }       
1086
 
                ScRange refRange;       
1087
 
                ScUnoConversion::FillScRange( refRange, pAddr );
 
1057
 
1088
1058
                USHORT nFlags = 0;
1089
1059
                if ( !getCellRangesForAddress( nFlags, sAddress, pDocSh, aCellRanges, eConv ) )
1090
 
                        throw uno::RuntimeException();
 
1060
                        return false;
1091
1061
        
1092
1062
                bool bTabFromReferrer = !( nFlags & SCA_TAB_3D );
1093
1063
 
1101
1071
                        pRange->aEnd.SetTab( bTabFromReferrer ? refRange.aEnd.Tab()  : pRange->aEnd.Tab() );
1102
1072
                }
1103
1073
        }
1104
 
 
 
1074
        return true;
 
1075
}
 
1076
 
 
1077
 
 
1078
ScVbaRange*
 
1079
getRangeForName( const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, ScDocShell* pDocSh, table::CellRangeAddress& pAddr, ScAddress::Convention eConv = ScAddress::CONV_XL_A1 ) throw ( uno::RuntimeException )
 
1080
{
 
1081
        ScRangeList aCellRanges;
 
1082
        ScRange refRange;
 
1083
        ScUnoConversion::FillScRange( refRange, pAddr );
 
1084
        if ( !getScRangeListForAddress ( sName, pDocSh, refRange, aCellRanges, eConv ) ) 
 
1085
                throw uno::RuntimeException();
1105
1086
        // Single range
1106
1087
        if ( aCellRanges.First() == aCellRanges.Last() )
1107
1088
        {
1113
1094
        
1114
1095
        // #FIXME need proper (WorkSheet) parent
1115
1096
        return new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xRanges );
1116
 
        
 
1097
}
 
1098
 
 
1099
css::uno::Reference< excel::XRange >
 
1100
ScVbaRange::getRangeObjectForName( const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sRangeName, ScDocShell* pDocSh, ScAddress::Convention eConv ) throw ( uno::RuntimeException )
 
1101
{
 
1102
        table::CellRangeAddress refAddr;
 
1103
        return getRangeForName( xContext, sRangeName, pDocSh, refAddr, eConv );
 
1104
}
 
1105
 
 
1106
 
 
1107
table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam, ScDocShell* pDocSh,  ScAddress::Convention aConv = ScAddress::CONV_XL_A1) throw ( uno::RuntimeException )
 
1108
{
 
1109
        uno::Reference< table::XCellRange > xRangeParam;
 
1110
        switch ( aParam.getValueTypeClass() )
 
1111
        {
 
1112
                case uno::TypeClass_STRING:
 
1113
                {
 
1114
                        rtl::OUString rString;
 
1115
                        aParam >>= rString;
 
1116
                        ScRangeList aCellRanges;
 
1117
                        ScRange refRange;
 
1118
                        if ( getScRangeListForAddress ( rString, pDocSh, refRange, aCellRanges, aConv ) )                       
 
1119
                        {
 
1120
                                if ( aCellRanges.First() == aCellRanges.Last() )
 
1121
                                {
 
1122
                                        table::CellRangeAddress aRangeAddress;
 
1123
                                        ScUnoConversion::FillApiRange( aRangeAddress, *aCellRanges.First() );
 
1124
                                        return aRangeAddress;
 
1125
                                }
 
1126
                        }
 
1127
                }
 
1128
                case uno::TypeClass_INTERFACE:
 
1129
                {
 
1130
                        uno::Reference< excel::XRange > xRange;
 
1131
                        aParam >>= xRange;
 
1132
                        if ( xRange.is() )
 
1133
                                xRange->getCellRange() >>= xRangeParam;
 
1134
                        break;
 
1135
                }
 
1136
                default:
 
1137
                        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't extact CellRangeAddress from type" ) ), uno::Reference< uno::XInterface >() );
 
1138
        }
 
1139
        uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRangeParam, uno::UNO_QUERY_THROW );
 
1140
        return xAddressable->getRangeAddress();
 
1141
 
1117
1142
}
1118
1143
 
1119
1144
uno::Reference< vba::XCollection >
1128
1153
        return borders;
1129
1154
}
1130
1155
 
1131
 
 
1132
 
uno::Reference< beans::XPropertySet >
1133
 
lcl_getPropertiesFromArgs( uno::Sequence< uno::Any > const & args ) throw ( lang::IllegalArgumentException )
1134
 
{
1135
 
        boost::optional< uno::Reference< vba::XHelperInterface >  >xParent;
1136
 
        uno::Reference< table::XCellRange > xRange;
1137
 
        comphelper::unwrapArgs( args, xParent, xRange ); 
1138
 
        uno::Reference< beans::XPropertySet > xProps( xRange, uno::UNO_QUERY );
1139
 
        if ( !xProps.is() )
1140
 
                throw lang::IllegalArgumentException();
1141
 
        return xProps;
1142
 
}
1143
 
 
1144
 
uno::Reference< frame::XModel > 
1145
 
lcl_getModelFromArgs( uno::Sequence< uno::Any > const& args ) throw ( lang::IllegalArgumentException )
1146
 
{
1147
 
        boost::optional< uno::Reference< vba::XHelperInterface >  >xParent;
1148
 
        uno::Reference< table::XCellRange > xRange;
1149
 
        comphelper::unwrapArgs( args, xParent, xRange ); 
1150
 
        return getModelFromRange( xRange );     
1151
 
}
1152
 
 
1153
 
uno::Reference< vba::XHelperInterface > 
1154
 
lcl_getParentFromArgs( uno::Sequence< uno::Any > const& args ) throw ( lang::IllegalArgumentException )
1155
 
{
1156
 
        boost::optional< uno::Reference< vba::XHelperInterface >  >xParent;
1157
 
        uno::Reference< table::XCellRange > xRange;
1158
 
        comphelper::unwrapArgs( args, xParent, xRange ); 
1159
 
        return *xParent;
1160
 
}
1161
 
 
1162
1156
ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
1163
 
    uno::Reference< uno::XComponentContext> const & xContext )  throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( lcl_getParentFromArgs( args ), xContext, lcl_getPropertiesFromArgs( args ), lcl_getModelFromArgs( args ), true ), mbIsRows( sal_False ), mbIsColumns( sal_False )
 
1157
    uno::Reference< uno::XComponentContext> const & xContext )  throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< vba::XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), getModelFromRange( getXSomethingFromArgs< table::XCellRange >( args, 1 ) ), true ), mbIsRows( sal_False ), mbIsColumns( sal_False )
1164
1158
{
1165
1159
        mxRange.set( mxPropertySet, uno::UNO_QUERY_THROW );
1166
1160
        uno::Reference< container::XIndexAccess > xIndex( new SingleRangeIndexAccess( mxContext, mxRange ) );
1763
1757
                        dDetails = ScAddress::Details( ScAddress::CONV_XL_R1C1, 0, 0 );
1764
1758
        }
1765
1759
        USHORT nFlags = SCA_VALID;
1766
 
        ScDocument* pDoc =  getDocumentFromRange( mxRange );
 
1760
        ScDocShell* pDocShell =  getScDocShell();
 
1761
        ScDocument* pDoc =  pDocShell->GetDocument();
 
1762
 
1767
1763
        RangeHelper thisRange( mxRange );       
1768
1764
        table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
1769
1765
        ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) );
1797
1793
        {
1798
1794
                // #TODO should I throw an error if R1C1 is not set?
1799
1795
                
1800
 
                table::CellRangeAddress refAddress = getCellRangeAddress( RelativeTo, thisRange.getSpreadSheet() );
 
1796
                table::CellRangeAddress refAddress = getCellRangeAddressForVBARange( RelativeTo, pDocShell );
1801
1797
                dDetails = ScAddress::Details( ScAddress::CONV_XL_R1C1, static_cast< SCROW >( refAddress.StartRow ), static_cast< SCCOL >( refAddress.StartColumn ) );
1802
1798
        }
1803
1799
        aRange.Format( sRange,  nFlags, pDoc, dDetails ); 
1966
1962
        SCROW nStartRow = 0;
1967
1963
        SCROW nEndRow = 0;
1968
1964
 
1969
 
        sal_Int32 nValue;
 
1965
        sal_Int32 nValue = 0;
1970
1966
        rtl::OUString sAddress;
1971
1967
 
1972
1968
        if ( aIndex.hasValue() )
2022
2018
        ScRange aRange = *aCellRanges.First();
2023
2019
        if ( aIndex.hasValue() )
2024
2020
        {
2025
 
                if( aIndex >>= nValue )
 
2021
                if ( aIndex >>= nValue )
2026
2022
                {
2027
 
                        aRange.aStart.SetCol( aRange.aStart.Col() + --nValue );
 
2023
                        aRange.aStart.SetCol( aRange.aStart.Col() + static_cast< SCCOL > ( --nValue ) );
2028
2024
                        aRange.aEnd.SetCol( aRange.aStart.Col() );
2029
2025
                }
2030
2026
                
2315
2311
        else
2316
2312
        {
2317
2313
                table::CellRangeAddress  cell1, cell2;
2318
 
                cell1 = getCellRangeAddress( Cell1, thisRange.getSpreadSheet() );       
 
2314
                cell1 = getCellRangeAddressForVBARange( Cell1, getScDocShell() );       
2319
2315
                // Cell1 & Cell2 defined
2320
2316
                // Excel seems to combine the range as the range defined by
2321
2317
                // the combination of Cell1 & Cell2
2322
2318
        
2323
 
                cell2 = getCellRangeAddress( Cell2, thisRange.getSpreadSheet() );       
 
2319
                cell2 = getCellRangeAddressForVBARange( Cell2, getScDocShell() );       
2324
2320
 
2325
2321
                resultAddress.StartColumn = ( cell1.StartColumn <  cell2.StartColumn ) ? cell1.StartColumn : cell2.StartColumn;
2326
2322
                resultAddress.StartRow = ( cell1.StartRow <  cell2.StartRow ) ? cell1.StartRow : cell2.StartRow;
2695
2691
        return sal_True; // always
2696
2692
}
2697
2693
 
2698
 
uno::Reference< table::XCellRange > 
2699
 
ScVbaRange::getCellRangeForName(  const rtl::OUString& sRangeName, const uno::Reference< sheet::XSpreadsheet >& xDoc, ScAddress::Convention aConv )
2700
 
{
2701
 
        uno::Reference< uno::XInterface > xRanges( xDoc, uno::UNO_QUERY_THROW );
2702
 
        ScCellRangeObj* pRanges = dynamic_cast< ScCellRangeObj* >( xRanges.get() );
2703
 
    ScAddress::Convention eConv = aConv;//ScAddress::CONV_XL_A1;   the default. 
2704
 
 
2705
 
        ScAddress::Details dDetails( eConv, 0, 0 );
2706
 
                
2707
 
        uno::Reference< table::XCellRange > xRange;
2708
 
        if ( pRanges )
2709
 
                xRange = pRanges->getCellRangeByName( sRangeName, dDetails );
2710
 
        return xRange;  
2711
 
}
2712
 
 
2713
 
uno::Reference< table::XCellRange > processKey( const uno::Any& Key, uno::Reference< table::XCellRange >& xRange )
2714
 
{
2715
 
        uno::Reference< table::XCellRange > xKey;
 
2694
uno::Reference< table::XCellRange > processKey( const uno::Any& Key, uno::Reference<  uno::XComponentContext >& xContext, ScDocShell* pDocSh )
 
2695
{
 
2696
        uno::Reference< excel::XRange > xKeyRange;
2716
2697
        if ( Key.getValueType() == excel::XRange::static_type() )
2717
2698
        {
2718
 
                uno::Reference< excel::XRange > xKeyRange( Key, uno::UNO_QUERY_THROW );
2719
 
                xKey.set( xKeyRange->getCellRange(), uno::UNO_QUERY_THROW );
 
2699
                xKeyRange.set( Key, uno::UNO_QUERY_THROW );
2720
2700
        }
2721
2701
        else if ( Key.getValueType() == ::getCppuType( static_cast< const rtl::OUString* >(0) )  )
2722
2702
                        
2723
2703
        {
2724
2704
                rtl::OUString sRangeName = ::comphelper::getString( Key );
2725
 
                RangeHelper dRange( xRange );
2726
 
                xKey = ScVbaRange::getCellRangeForName( sRangeName,  dRange.getSpreadSheet() );
 
2705
                table::CellRangeAddress  aRefAddr;
 
2706
                if ( !pDocSh )
 
2707
                        throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Range::Sort no docshell to calculate key param")), uno::Reference< uno::XInterface >() );
 
2708
                xKeyRange = getRangeForName( xContext, sRangeName, pDocSh, aRefAddr ); 
2727
2709
        }
2728
2710
        else
2729
2711
                throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Range::Sort illegal type value for key param")), uno::Reference< uno::XInterface >() );
 
2712
        uno::Reference< table::XCellRange > xKey;
 
2713
        xKey.set( xKeyRange->getCellRange(), uno::UNO_QUERY_THROW );
2730
2714
        return xKey;
2731
2715
}
2732
2716
 
2801
2785
        RangeHelper thisRange( mxRange );
2802
2786
        table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
2803
2787
        ScSortParam aSortParam;
2804
 
#ifdef VBA_OOBUILD_HACK
2805
2788
        SCTAB nTab = thisRangeAddress.Sheet;
2806
2789
        pDoc->GetSortParam( aSortParam, nTab );
2807
 
#endif
2808
2790
 
2809
2791
        if ( DataOption1.hasValue() )
2810
2792
                DataOption1 >>= nDataOption1;
2934
2916
        uno::Reference< table::XCellRange > xKey1;      
2935
2917
        uno::Reference< table::XCellRange > xKey2;      
2936
2918
        uno::Reference< table::XCellRange > xKey3;      
2937
 
 
2938
 
        xKey1 = processKey( Key1, mxRange );
 
2919
        ScDocShell* pDocShell = getScDocShell();
 
2920
        xKey1 = processKey( Key1, mxContext, pDocShell );
2939
2921
        if ( !xKey1.is() )
2940
2922
                throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Range::Sort needs a key1 param")), uno::Reference< uno::XInterface >() );
2941
2923
 
2942
2924
        if ( Key2.hasValue() )
2943
 
                xKey2 = processKey( Key2, mxRange );
 
2925
                xKey2 = processKey( Key2, mxContext, pDocShell );
2944
2926
        if ( Key3.hasValue() )
2945
 
                xKey3 = processKey( Key3, mxRange );
 
2927
                xKey3 = processKey( Key3, mxContext, pDocShell );
2946
2928
 
2947
2929
        uno::Reference< util::XSortable > xSort( mxRange, uno::UNO_QUERY_THROW );
2948
2930
        uno::Sequence< beans::PropertyValue > sortDescriptor = xSort->createSortDescriptor();
2970
2952
        nIndex =        findSortPropertyIndex( sortDescriptor, CONTS_HEADER );
2971
2953
        sortDescriptor[ nIndex ].Value <<= bContainsHeader;
2972
2954
 
2973
 
#ifdef VBA_OOBUILD_HACK
2974
2955
        pDoc->SetSortParam( aSortParam, nTab );
2975
 
#endif
2976
2956
        xSort->sort( sortDescriptor );
2977
2957
 
2978
2958
        // #FIXME #TODO
3726
3706
 
3727
3707
void lcl_SelectAll( ScDocShell* pDocShell, ScQueryParam& aParam )
3728
3708
{
3729
 
        ScViewData* pViewData = pDocShell->GetViewData();
3730
 
        if ( pViewData )
3731
 
        {
3732
 
                OSL_TRACE("Pushing out SelectAll query");
3733
 
                pViewData->GetView()->Query( aParam, NULL, TRUE );
 
3709
        if ( pDocShell )
 
3710
        {       
 
3711
                ScViewData* pViewData = pDocShell->GetViewData();
 
3712
                if ( pViewData )
 
3713
                {
 
3714
                        OSL_TRACE("Pushing out SelectAll query");
 
3715
                        pViewData->GetView()->Query( aParam, NULL, TRUE );
 
3716
                }
3734
3717
        }
3735
3718
}
3736
3719
 
3745
3728
        return aParam;
3746
3729
}
3747
3730
 
3748
 
void lcl_SetAllQueryForField( ScQueryParam& aParam, sal_Int32 nField )
 
3731
void lcl_SetAllQueryForField( ScQueryParam& aParam, SCCOLROW nField )
3749
3732
{
3750
3733
        bool bFound = false;
3751
3734
        SCSIZE i = 0;
3766
3749
}
3767
3750
 
3768
3751
 
3769
 
void lcl_SetAllQueryForField( ScDocShell* pDocShell, sal_Int16 nField, sal_Int16 nSheet )
 
3752
void lcl_SetAllQueryForField( ScDocShell* pDocShell, SCCOLROW nField, sal_Int16 nSheet )
3770
3753
{
3771
3754
        ScQueryParam aParam = lcl_GetQueryParam( pDocShell, nSheet );
3772
3755
        lcl_SetAllQueryForField( aParam, nField );
4893
4876
                        xRange = lcl_makeXRangeFromSheetCellRanges( getParent(), mxContext, xLocSheetCellRanges, getScDocShell() );
4894
4877
                }
4895
4878
        }
4896
 
        catch (uno::Exception& e)
 
4879
        catch (uno::Exception& )
4897
4880
        {
4898
4881
                DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_NOCELLSWEREFOUND);                    
4899
4882
        }
4972
4955
                xSubDesc->addNew(aColumns, _nGroupBy - 1);
4973
4956
                xSub->applySubTotals(xSubDesc, bDoReplace);
4974
4957
        }
4975
 
        catch (uno::Exception& e)
 
4958
        catch (uno::Exception& )
4976
4959
        {
4977
4960
                DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
4978
4961
        }
4992
4975
 
4993
4976
                                        
4994
4977
        }       
4995
 
        catch( uno::Exception& e )
 
4978
        catch( uno::Exception& )
4996
4979
        {
4997
4980
                DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
4998
4981
        }