Files
libreoffice/sc/source/core/tool/rangelst.cxx

794 lines
23 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 23:16:46 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 23:16:46 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:16:46 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 23:16:46 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 23:16:46 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
2000-09-18 23:16:46 +00:00
//------------------------------------------------------------------------
#define SC_RANGELST_CXX //fuer ICC
#include <tools/debug.hxx>
#include <stdlib.h> // qsort
#include <unotools/collatorwrapper.hxx>
2000-09-18 23:16:46 +00:00
#include "rangelst.hxx"
#include "document.hxx"
#include "refupdat.hxx"
#include "rechead.hxx"
#include "compiler.hxx"
2000-09-18 23:16:46 +00:00
using ::std::vector;
using ::std::advance;
2000-09-18 23:16:46 +00:00
// === ScRangeList ====================================================
ScRangeList::~ScRangeList()
{
std::vector<ScRangePtr>::iterator itr = maRanges.begin(), itrEnd = maRanges.end();
for (; itr != itrEnd; ++itr)
delete *itr;
clear();
2000-09-18 23:16:46 +00:00
}
USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask,
CWS-TOOLING: integrate CWS frmdlg 2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05 2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative' parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and ODFF if omitted, for backwards compatibility. 2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37) 2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula 2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula 2008-12-12 13:22:00 +0100 msc r265413 : #i97089# 2008-12-12 13:20:25 +0100 msc r265412 : #i97089# 2008-12-12 12:35:12 +0100 msc r265406 : #i97089# 2008-12-12 12:34:16 +0100 msc r265405 : #i97089# 2008-12-12 12:33:05 +0100 msc r265404 : #i97089# 2008-12-12 12:31:11 +0100 msc r265403 : #i97089# 2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG 2008-12-08 11:50:17 +0100 oj r264980 : some small changes 2008-12-05 12:57:57 +0100 oj r264902 : eof changed 2008-12-05 12:56:46 +0100 oj r264901 : eof changed 2008-12-05 12:28:47 +0100 oj r264899 : wrong var used 2008-12-05 10:08:57 +0100 oj r264890 : token order reversed 2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage 2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id 2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button 2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button 2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends 2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends 2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends 2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set 2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category 2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids 2008-12-01 14:36:43 +0100 oj r264604 : use temp var 2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula 2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula 2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc 2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select 2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void 2008-11-28 11:16:48 +0100 oj r264532 : add help ids 2008-11-28 10:16:56 +0100 oj r264529 : set help id 2008-11-28 10:16:43 +0100 oj r264528 : set help id 2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes 2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug 2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them 2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code 2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code 2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline 2008-11-21 12:35:27 +0100 oj r264124 : hold symbols 2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost 2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove 2008-11-19 20:37:41 +0100 oj r264021 : removed unused var 2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token 2008-11-19 10:59:47 +0100 oj r263967 : deleted 2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files 2008-11-18 15:27:36 +0100 oj r263777 : unused para removed 2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg 2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting 2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef 2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling 2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file 2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula 2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction 2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35 2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35 2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35 2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35 2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35 2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35 2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35 2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35 2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35 2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35 2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved 2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target 2008-10-07 10:08:39 +0200 oj r262077 : copy 2008-10-07 09:45:31 +0200 oj r262076 : #i94535# 2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class 2008-10-07 09:43:21 +0200 oj r262074 : moved to formula 2008-10-07 09:41:51 +0200 oj r262073 : new images 2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula 2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula 2008-10-02 08:08:54 +0200 oj r262023 : #i94535# 2008-10-02 08:06:28 +0200 oj r262022 : #i94535# 2008-10-02 08:05:52 +0200 oj r262021 : #i94535# 2008-10-01 17:15:29 +0200 oj r262014 : #i94535# 2008-10-01 17:12:40 +0200 oj r262013 : new module formula 2008-10-01 17:04:55 +0200 oj r262012 : #i94535# 2008-10-01 16:49:03 +0200 oj r262010 : #i94535# 2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
formula::FormulaGrammar::AddressConvention eConv,
sal_Unicode cDelimiter )
2000-09-18 23:16:46 +00:00
{
if ( rStr.Len() )
{
if (!cDelimiter)
cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
2000-09-18 23:16:46 +00:00
nMask |= SCA_VALID; // falls das jemand vergessen sollte
USHORT nResult = (USHORT)~0; // alle Bits setzen
ScRange aRange;
String aOne;
SCTAB nTab = 0;
2000-09-18 23:16:46 +00:00
if ( pDoc )
{
//! erste markierte Tabelle gibts nicht mehr am Dokument
//! -> uebergeben? oder spaeter an den Ranges setzen
}
else
nTab = 0;
USHORT nTCount = rStr.GetTokenCount( cDelimiter );
2000-09-18 23:16:46 +00:00
for ( USHORT i=0; i<nTCount; i++ )
{
aOne = rStr.GetToken( i, cDelimiter );
2000-09-18 23:16:46 +00:00
aRange.aStart.SetTab( nTab ); // Default Tab wenn nicht angegeben
USHORT nRes = aRange.ParseAny( aOne, pDoc, eConv );
USHORT nEndRangeBits = SCA_VALID_COL2 | SCA_VALID_ROW2 |
SCA_VALID_TAB2;
USHORT nTmp1 = ( nRes & SCA_BITS );
USHORT nTmp2 = ( nRes & nEndRangeBits );
// If we have a valid single range with
// any of the address bits we are interested in
// set - set the equiv end range bits
if ( (nRes & SCA_VALID ) && nTmp1 && ( nTmp2 != nEndRangeBits ) )
nRes |= ( nTmp1 << 4 );
2000-09-18 23:16:46 +00:00
if ( (nRes & nMask) == nMask )
Append( aRange );
nResult &= nRes; // alle gemeinsamen Bits bleiben erhalten
}
return nResult; // SCA_VALID gesetzt wenn alle ok
}
else
return 0;
}
void ScRangeList::Format( String& rStr, USHORT nFlags, ScDocument* pDoc,
CWS-TOOLING: integrate CWS frmdlg 2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05 2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative' parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and ODFF if omitted, for backwards compatibility. 2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37) 2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula 2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula 2008-12-12 13:22:00 +0100 msc r265413 : #i97089# 2008-12-12 13:20:25 +0100 msc r265412 : #i97089# 2008-12-12 12:35:12 +0100 msc r265406 : #i97089# 2008-12-12 12:34:16 +0100 msc r265405 : #i97089# 2008-12-12 12:33:05 +0100 msc r265404 : #i97089# 2008-12-12 12:31:11 +0100 msc r265403 : #i97089# 2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG 2008-12-08 11:50:17 +0100 oj r264980 : some small changes 2008-12-05 12:57:57 +0100 oj r264902 : eof changed 2008-12-05 12:56:46 +0100 oj r264901 : eof changed 2008-12-05 12:28:47 +0100 oj r264899 : wrong var used 2008-12-05 10:08:57 +0100 oj r264890 : token order reversed 2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage 2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id 2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button 2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button 2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends 2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends 2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends 2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set 2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category 2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids 2008-12-01 14:36:43 +0100 oj r264604 : use temp var 2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula 2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula 2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc 2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select 2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void 2008-11-28 11:16:48 +0100 oj r264532 : add help ids 2008-11-28 10:16:56 +0100 oj r264529 : set help id 2008-11-28 10:16:43 +0100 oj r264528 : set help id 2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes 2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug 2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them 2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code 2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code 2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline 2008-11-21 12:35:27 +0100 oj r264124 : hold symbols 2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost 2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove 2008-11-19 20:37:41 +0100 oj r264021 : removed unused var 2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token 2008-11-19 10:59:47 +0100 oj r263967 : deleted 2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files 2008-11-18 15:27:36 +0100 oj r263777 : unused para removed 2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg 2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting 2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef 2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling 2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file 2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula 2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction 2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35 2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35 2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35 2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35 2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35 2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35 2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35 2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35 2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35 2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35 2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved 2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target 2008-10-07 10:08:39 +0200 oj r262077 : copy 2008-10-07 09:45:31 +0200 oj r262076 : #i94535# 2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class 2008-10-07 09:43:21 +0200 oj r262074 : moved to formula 2008-10-07 09:41:51 +0200 oj r262073 : new images 2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula 2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula 2008-10-02 08:08:54 +0200 oj r262023 : #i94535# 2008-10-02 08:06:28 +0200 oj r262022 : #i94535# 2008-10-02 08:05:52 +0200 oj r262021 : #i94535# 2008-10-01 17:15:29 +0200 oj r262014 : #i94535# 2008-10-01 17:12:40 +0200 oj r262013 : new module formula 2008-10-01 17:04:55 +0200 oj r262012 : #i94535# 2008-10-01 16:49:03 +0200 oj r262010 : #i94535# 2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
formula::FormulaGrammar::AddressConvention eConv,
sal_Unicode cDelimiter ) const
2000-09-18 23:16:46 +00:00
{
rStr.Erase();
if (!cDelimiter)
cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
2010-12-09 20:11:32 -05:00
for ( size_t nIdx = 0, nCnt = maRanges.size(); nIdx < nCnt; ++nIdx )
2000-09-18 23:16:46 +00:00
{
String aStr;
at( nIdx )->Format( aStr, nFlags, pDoc, eConv );
2000-09-18 23:16:46 +00:00
if ( nIdx )
rStr += cDelimiter;
2000-09-18 23:16:46 +00:00
rStr += aStr;
}
}
void ScRangeList::Join( const ScRange& r, bool bIsInList )
2000-09-18 23:16:46 +00:00
{
if ( maRanges.empty() )
2000-09-18 23:16:46 +00:00
{
Append( r );
return ;
}
SCCOL nCol1 = r.aStart.Col();
SCROW nRow1 = r.aStart.Row();
SCTAB nTab1 = r.aStart.Tab();
SCCOL nCol2 = r.aEnd.Col();
SCROW nRow2 = r.aEnd.Row();
SCTAB nTab2 = r.aEnd.Tab();
ScRange* pOver = (ScRange*) &r; // fies aber wahr wenn bInList
size_t nOldPos = 0;
2000-09-18 23:16:46 +00:00
if ( bIsInList )
{
// Find the current position of this range.
for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges; ++i )
{
if ( maRanges[i] == pOver )
{
nOldPos = i;
break;
}
}
2000-09-18 23:16:46 +00:00
}
bool bJoinedInput = false;
for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges && pOver; ++i )
2000-09-18 23:16:46 +00:00
{
ScRange* p = maRanges[i];
2000-09-18 23:16:46 +00:00
if ( p == pOver )
continue; // derselbe, weiter mit dem naechsten
bool bJoined = false;
2000-09-18 23:16:46 +00:00
if ( p->In( r ) )
{ // Range r in Range p enthalten oder identisch
if ( bIsInList )
bJoined = true; // weg mit Range r
2000-09-18 23:16:46 +00:00
else
{ // das war's dann
bJoinedInput = true; // nicht anhaengen
2000-09-18 23:16:46 +00:00
break; // for
}
}
else if ( r.In( *p ) )
{ // Range p in Range r enthalten, r zum neuen Range machen
*p = r;
bJoined = true;
2000-09-18 23:16:46 +00:00
}
if ( !bJoined && p->aStart.Tab() == nTab1 && p->aEnd.Tab() == nTab2 )
{ // 2D
if ( p->aStart.Col() == nCol1 && p->aEnd.Col() == nCol2 )
{
if ( p->aStart.Row() == nRow2+1 )
{ // oben
p->aStart.SetRow( nRow1 );
bJoined = true;
2000-09-18 23:16:46 +00:00
}
else if ( p->aEnd.Row() == nRow1-1 )
{ // unten
p->aEnd.SetRow( nRow2 );
bJoined = true;
2000-09-18 23:16:46 +00:00
}
}
else if ( p->aStart.Row() == nRow1 && p->aEnd.Row() == nRow2 )
{
if ( p->aStart.Col() == nCol2+1 )
{ // links
p->aStart.SetCol( nCol1 );
bJoined = true;
2000-09-18 23:16:46 +00:00
}
else if ( p->aEnd.Col() == nCol1-1 )
{ // rechts
p->aEnd.SetCol( nCol2 );
bJoined = true;
2000-09-18 23:16:46 +00:00
}
}
}
if ( bJoined )
{
if ( bIsInList )
{ // innerhalb der Liste Range loeschen
Remove(nOldPos);
delete pOver;
2000-09-18 23:16:46 +00:00
pOver = NULL;
if ( nOldPos )
nOldPos--; // Seek richtig aufsetzen
}
bJoinedInput = true;
Join( *p, true ); // rekursiv!
2000-09-18 23:16:46 +00:00
}
}
if ( !bIsInList && !bJoinedInput )
2000-09-18 23:16:46 +00:00
Append( r );
}
bool ScRangeList::operator==( const ScRangeList& r ) const
2000-09-18 23:16:46 +00:00
{
if ( this == &r )
return true; // identische Referenz
2010-12-09 20:11:32 -05:00
size_t nCnt = maRanges.size();
if ( nCnt != r.maRanges.size() )
return false;
for ( size_t nIdx = 0; nIdx < nCnt; nIdx++ )
2000-09-18 23:16:46 +00:00
{
2010-12-09 20:11:32 -05:00
if ( *maRanges.at( nIdx ) != *r.maRanges.at( nIdx ) )
return false; // auch andere Reihenfolge ist ungleich
2000-09-18 23:16:46 +00:00
}
return true;
2000-09-18 23:16:46 +00:00
}
bool ScRangeList::operator!=( const ScRangeList& r ) const
2010-01-15 12:00:39 +01:00
{
return !operator==( r );
}
bool ScRangeList::UpdateReference(
UpdateRefMode eUpdateRefMode,
ScDocument* pDoc,
const ScRange& rWhere,
SCsCOL nDx,
SCsROW nDy,
SCsTAB nDz
)
2000-09-18 23:16:46 +00:00
{
bool bChanged = FALSE;
2010-12-09 20:11:32 -05:00
if ( !maRanges.empty() )
2000-09-18 23:16:46 +00:00
{
SCCOL nCol1;
SCROW nRow1;
SCTAB nTab1;
SCCOL nCol2;
SCROW nRow2;
SCTAB nTab2;
2000-09-18 23:16:46 +00:00
rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
2010-12-09 20:11:32 -05:00
for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges; ++i )
2000-09-18 23:16:46 +00:00
{
ScRangePtr pR = at( i );
SCCOL theCol1;
SCROW theRow1;
SCTAB theTab1;
SCCOL theCol2;
SCROW theRow2;
SCTAB theTab2;
2000-09-18 23:16:46 +00:00
pR->GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 );
if ( ScRefUpdate::Update( pDoc, eUpdateRefMode,
nCol1, nRow1, nTab1, nCol2, nRow2, nTab2,
nDx, nDy, nDz,
theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 )
!= UR_NOTHING )
{
bChanged = TRUE;
pR->aStart.Set( theCol1, theRow1, theTab1 );
pR->aEnd.Set( theCol2, theRow2, theTab2 );
}
}
}
return bChanged;
}
const ScRange* ScRangeList::Find( const ScAddress& rAdr ) const
2000-09-18 23:16:46 +00:00
{
2010-12-09 20:11:32 -05:00
for ( size_t j = 0, nListCount = maRanges.size(); j < nListCount; j++ )
2000-09-18 23:16:46 +00:00
{
const ScRange* pR = maRanges[j];
if ( pR->In( rAdr ) )
return pR;
}
return NULL;
}
ScRange* ScRangeList::Find( const ScAddress& rAdr )
{
2010-12-09 20:11:32 -05:00
for ( size_t j = 0, nListCount = maRanges.size(); j < nListCount; j++ )
{
ScRange* pR = maRanges[j];
2000-09-18 23:16:46 +00:00
if ( pR->In( rAdr ) )
return pR;
}
return NULL;
}
ScRangeList::ScRangeList( const ScRangeList& rList ) :
SvRefBase()
2000-09-18 23:16:46 +00:00
{
2010-12-09 20:11:32 -05:00
for ( size_t j = 0, nListCount = rList.maRanges.size(); j < nListCount; j++ )
Append( *rList[ j ] );
2000-09-18 23:16:46 +00:00
}
ScRangeList& ScRangeList::operator=(const ScRangeList& rList)
{
clear();
2010-12-09 20:11:32 -05:00
for ( size_t j = 0, nListCount = rList.maRanges.size(); j < nListCount; j++ )
Append( *rList[ j ] );
2000-09-18 23:16:46 +00:00
return *this;
}
bool ScRangeList::Intersects( const ScRange& rRange ) const
2000-09-18 23:16:46 +00:00
{
2010-12-09 20:11:32 -05:00
for ( size_t j = 0, nListCount = maRanges.size(); j < nListCount; j++ )
if ( at( j )->Intersects( rRange ) )
return true;
2000-09-18 23:16:46 +00:00
return false;
2000-09-18 23:16:46 +00:00
}
bool ScRangeList::In( const ScRange& rRange ) const
2001-04-24 13:44:36 +00:00
{
2010-12-09 20:11:32 -05:00
for ( size_t j = 0, nListCount = maRanges.size(); j < nListCount; j++ )
if ( at( j )->In( rRange ) )
return true;
2001-04-24 13:44:36 +00:00
return false;
2001-04-24 13:44:36 +00:00
}
size_t ScRangeList::GetCellCount() const
2000-09-18 23:16:46 +00:00
{
size_t nCellCount = 0;
2010-12-09 20:11:32 -05:00
for ( size_t j = 0, nListCount = maRanges.size(); j < nListCount; j++ )
2000-09-18 23:16:46 +00:00
{
const ScRange* pR = maRanges[j];
nCellCount += size_t(pR->aEnd.Col() - pR->aStart.Col() + 1)
* size_t(pR->aEnd.Row() - pR->aStart.Row() + 1)
* size_t(pR->aEnd.Tab() - pR->aStart.Tab() + 1);
2000-09-18 23:16:46 +00:00
}
return nCellCount;
}
ScRange* ScRangeList::Remove(size_t nPos)
{
if (maRanges.size() <= nPos)
// Out-of-bound condition. Bail out.
return NULL;
vector<ScRange*>::iterator itr = maRanges.begin();
advance(itr, nPos);
ScRange* p = *itr;
maRanges.erase(itr);
return p;
}
bool ScRangeList::empty() const
{
return maRanges.empty();
}
size_t ScRangeList::size() const
{
return maRanges.size();
}
ScRange* ScRangeList::at(size_t idx)
{
return maRanges.at(idx);
}
const ScRange* ScRangeList::at(size_t idx) const
{
return maRanges.at(idx);
}
ScRange* ScRangeList::operator [](size_t idx)
{
return maRanges[idx];
}
const ScRange* ScRangeList::operator [](size_t idx) const
{
return maRanges[idx];
}
ScRange* ScRangeList::front()
{
return maRanges.front();
}
const ScRange* ScRangeList::front() const
{
return maRanges.front();
}
ScRange* ScRangeList::back()
{
return maRanges.back();
}
const ScRange* ScRangeList::back() const
{
return maRanges.back();
}
void ScRangeList::push_back(ScRange* p)
{
maRanges.push_back(p);
}
void ScRangeList::clear()
{
maRanges.clear();
}
2000-09-18 23:16:46 +00:00
// === ScRangePairList ====================================================
ScRangePairList::~ScRangePairList()
{
for ( ScRangePair* pR = First(); pR; pR = Next() )
delete pR;
}
void ScRangePairList::Join( const ScRangePair& r, BOOL bIsInList )
{
if ( !Count() )
{
Append( r );
return ;
}
const ScRange& r1 = r.GetRange(0);
const ScRange& r2 = r.GetRange(1);
SCCOL nCol1 = r1.aStart.Col();
SCROW nRow1 = r1.aStart.Row();
SCTAB nTab1 = r1.aStart.Tab();
SCCOL nCol2 = r1.aEnd.Col();
SCROW nRow2 = r1.aEnd.Row();
SCTAB nTab2 = r1.aEnd.Tab();
2000-09-18 23:16:46 +00:00
ScRangePair* pOver = (ScRangePair*) &r; // fies aber wahr wenn bInList
ULONG nOldPos = 0;
2000-09-18 23:16:46 +00:00
if ( bIsInList )
{ // merken um ggbf. zu loeschen bzw. wiederherzustellen
nOldPos = GetPos( pOver );
}
BOOL bJoinedInput = FALSE;
for ( ScRangePair* p = First(); p && pOver; p = Next() )
{
if ( p == pOver )
continue; // derselbe, weiter mit dem naechsten
BOOL bJoined = FALSE;
ScRange& rp1 = p->GetRange(0);
ScRange& rp2 = p->GetRange(1);
if ( rp2 == r2 )
{ // nur wenn Range2 gleich ist
if ( rp1.In( r1 ) )
{ // RangePair r in RangePair p enthalten oder identisch
if ( bIsInList )
bJoined = TRUE; // weg mit RangePair r
else
{ // das war's dann
bJoinedInput = TRUE; // nicht anhaengen
break; // for
}
}
else if ( r1.In( rp1 ) )
{ // RangePair p in RangePair r enthalten, r zum neuen RangePair machen
*p = r;
bJoined = TRUE;
}
}
if ( !bJoined && rp1.aStart.Tab() == nTab1 && rp1.aEnd.Tab() == nTab2
&& rp2.aStart.Tab() == r2.aStart.Tab()
&& rp2.aEnd.Tab() == r2.aEnd.Tab() )
{ // 2D, Range2 muss genauso nebeneinander liegen wie Range1
if ( rp1.aStart.Col() == nCol1 && rp1.aEnd.Col() == nCol2
&& rp2.aStart.Col() == r2.aStart.Col()
&& rp2.aEnd.Col() == r2.aEnd.Col() )
{
if ( rp1.aStart.Row() == nRow2+1
&& rp2.aStart.Row() == r2.aEnd.Row()+1 )
{ // oben
rp1.aStart.SetRow( nRow1 );
rp2.aStart.SetRow( r2.aStart.Row() );
bJoined = TRUE;
}
else if ( rp1.aEnd.Row() == nRow1-1
&& rp2.aEnd.Row() == r2.aStart.Row()-1 )
{ // unten
rp1.aEnd.SetRow( nRow2 );
rp2.aEnd.SetRow( r2.aEnd.Row() );
bJoined = TRUE;
}
}
else if ( rp1.aStart.Row() == nRow1 && rp1.aEnd.Row() == nRow2
&& rp2.aStart.Row() == r2.aStart.Row()
&& rp2.aEnd.Row() == r2.aEnd.Row() )
{
if ( rp1.aStart.Col() == nCol2+1
&& rp2.aStart.Col() == r2.aEnd.Col()+1 )
{ // links
rp1.aStart.SetCol( nCol1 );
rp2.aStart.SetCol( r2.aStart.Col() );
bJoined = TRUE;
}
else if ( rp1.aEnd.Col() == nCol1-1
&& rp2.aEnd.Col() == r2.aEnd.Col()-1 )
{ // rechts
rp1.aEnd.SetCol( nCol2 );
rp2.aEnd.SetCol( r2.aEnd.Col() );
bJoined = TRUE;
}
}
}
if ( bJoined )
{
if ( bIsInList )
{ // innerhalb der Liste RangePair loeschen
Remove( nOldPos );
delete pOver;
pOver = NULL;
if ( nOldPos )
nOldPos--; // Seek richtig aufsetzen
}
bJoinedInput = TRUE;
Join( *p, TRUE ); // rekursiv!
}
}
if ( bIsInList )
Seek( nOldPos );
else if ( !bJoinedInput )
Append( r );
}
BOOL ScRangePairList::operator==( const ScRangePairList& r ) const
{
if ( this == &r )
return TRUE; // identische Referenz
if ( Count() != r.Count() )
return FALSE;
ULONG nCnt = Count();
for ( ULONG nIdx = 0; nIdx < nCnt; nIdx++ )
{
if ( *GetObject( nIdx ) != *r.GetObject( nIdx ) )
return FALSE; // auch andere Reihenfolge ist ungleich
}
return TRUE;
}
BOOL ScRangePairList::UpdateReference( UpdateRefMode eUpdateRefMode,
ScDocument* pDoc, const ScRange& rWhere,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
2000-09-18 23:16:46 +00:00
{
BOOL bChanged = FALSE;
if ( Count() )
{
SCCOL nCol1;
SCROW nRow1;
SCTAB nTab1;
SCCOL nCol2;
SCROW nRow2;
SCTAB nTab2;
2000-09-18 23:16:46 +00:00
rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
for ( ScRangePair* pR = First(); pR; pR = Next() )
{
for ( USHORT j=0; j<2; j++ )
{
ScRange& rRange = pR->GetRange(j);
SCCOL theCol1;
SCROW theRow1;
SCTAB theTab1;
SCCOL theCol2;
SCROW theRow2;
SCTAB theTab2;
2000-09-18 23:16:46 +00:00
rRange.GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 );
if ( ScRefUpdate::Update( pDoc, eUpdateRefMode,
nCol1, nRow1, nTab1, nCol2, nRow2, nTab2,
nDx, nDy, nDz,
theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 )
!= UR_NOTHING )
{
bChanged = TRUE;
rRange.aStart.Set( theCol1, theRow1, theTab1 );
rRange.aEnd.Set( theCol2, theRow2, theTab2 );
}
}
}
}
return bChanged;
}
void ScRangePairList::DeleteOnTab( SCTAB nTab )
{
// Delete entries that have the labels (first range) on nTab
ULONG nListCount = Count();
ULONG nPos = 0;
while ( nPos < nListCount )
{
ScRangePair* pR = GetObject( nPos );
ScRange aRange = pR->GetRange(0);
if ( aRange.aStart.Tab() == nTab && aRange.aEnd.Tab() == nTab )
{
Remove( nPos );
delete pR;
nListCount = Count();
}
else
++nPos;
}
}
2000-09-18 23:16:46 +00:00
ScRangePair* ScRangePairList::Find( const ScAddress& rAdr ) const
{
ULONG nListCount = Count();
for ( ULONG j = 0; j < nListCount; j++ )
2000-09-18 23:16:46 +00:00
{
ScRangePair* pR = GetObject( j );
if ( pR->GetRange(0).In( rAdr ) )
return pR;
}
return NULL;
}
ScRangePair* ScRangePairList::Find( const ScRange& rRange ) const
{
ULONG nListCount = Count();
for ( ULONG j = 0; j < nListCount; j++ )
2000-09-18 23:16:46 +00:00
{
ScRangePair* pR = GetObject( j );
if ( pR->GetRange(0) == rRange )
return pR;
}
return NULL;
}
ScRangePairList* ScRangePairList::Clone() const
{
ScRangePairList* pNew = new ScRangePairList;
ULONG nListCount = Count();
for ( ULONG j = 0; j < nListCount; j++ )
2000-09-18 23:16:46 +00:00
{
pNew->Append( *GetObject( j ) );
}
return pNew;
}
struct ScRangePairNameSort
{
ScRangePair* pPair;
ScDocument* pDoc;
};
extern "C" int
2000-09-18 23:16:46 +00:00
#ifdef WNT
__cdecl
#endif
ScRangePairList_QsortNameCompare( const void* p1, const void* p2 )
2000-09-18 23:16:46 +00:00
{
const ScRangePairNameSort* ps1 = (const ScRangePairNameSort*)p1;
const ScRangePairNameSort* ps2 = (const ScRangePairNameSort*)p2;
const ScAddress& rStartPos1 = ps1->pPair->GetRange(0).aStart;
const ScAddress& rStartPos2 = ps2->pPair->GetRange(0).aStart;
2000-09-18 23:16:46 +00:00
String aStr1, aStr2;
sal_Int32 nComp;
if ( rStartPos1.Tab() == rStartPos2.Tab() )
nComp = COMPARE_EQUAL;
2000-09-18 23:16:46 +00:00
else
{
ps1->pDoc->GetName( rStartPos1.Tab(), aStr1 );
ps2->pDoc->GetName( rStartPos2.Tab(), aStr2 );
CWS-TOOLING: integrate CWS oj18 2009-08-21 15:08:49 +0200 oj r275263 : wrong check 2009-08-21 08:56:01 +0200 oj r275215 : missing not 2009-08-20 07:27:13 +0200 oj r275164 : use new method from global 2009-08-19 10:22:35 +0200 oj r275138 : call GetLocale instead of pLocale 2009-08-18 10:39:32 +0200 oj r275082 : missing header include 2009-08-18 10:09:44 +0200 oj r275081 : new methods at global 2009-08-18 10:09:00 +0200 oj r275080 : unused var 2009-08-18 08:59:04 +0200 oj r275078 : move files from classes to xml 2009-08-17 14:58:16 +0200 oj r275056 : CWS-TOOLING: rebase CWS oj18 to trunk@275001 (milestone: DEV300:m55) 2009-08-17 13:29:44 +0200 oj r275047 : compile error 2009-08-17 13:27:47 +0200 oj r275045 : compile error 2009-08-17 11:44:54 +0200 oj r275040 : add dep 2009-07-22 14:26:05 +0200 oj r274240 : move unused services into fwl 2009-07-22 14:25:35 +0200 oj r274239 : move unused services into fwl 2009-07-22 13:47:45 +0200 oj r274233 : remove some unused code 2009-07-22 09:06:20 +0200 oj r274219 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 08:48:58 +0200 oj r274218 : create NumberFormatter on demand 2009-07-22 08:39:23 +0200 oj r274217 : change char to sal_Char 2009-07-22 07:33:34 +0200 oj r274214 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 07:30:04 +0200 oj r274213 : late init of numberformatter and breakiterator 2009-07-22 07:28:55 +0200 oj r274212 : export dbtoolsclient dbcharsethelper for sc 2009-07-21 13:43:28 +0200 oj r274196 : check if quick start is enbaled 2009-07-21 13:40:09 +0200 oj r274195 : check config entry for UiEventsLogger 2009-07-21 13:37:40 +0200 oj r274194 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:35:38 +0200 oj r274193 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:33:41 +0200 oj r274192 : doc meta data will now be created on demand 2009-07-21 13:13:40 +0200 oj r274187 : load ldap functions on demand 2009-07-21 13:03:17 +0200 oj r274183 : late init of TransliterationImpl 2009-07-21 12:36:10 +0200 oj r274180 : late init of charClass
2009-09-08 04:57:32 +00:00
nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 );
2000-09-18 23:16:46 +00:00
}
switch ( nComp )
2000-09-18 23:16:46 +00:00
{
case COMPARE_LESS:
return -1;
//break;
2000-09-18 23:16:46 +00:00
case COMPARE_GREATER:
return 1;
//break;
2000-09-18 23:16:46 +00:00
default:
// gleiche Tabs
if ( rStartPos1.Col() < rStartPos2.Col() )
2000-09-18 23:16:46 +00:00
return -1;
if ( rStartPos1.Col() > rStartPos2.Col() )
2000-09-18 23:16:46 +00:00
return 1;
// gleiche Cols
if ( rStartPos1.Row() < rStartPos2.Row() )
2000-09-18 23:16:46 +00:00
return -1;
if ( rStartPos1.Row() > rStartPos2.Row() )
2000-09-18 23:16:46 +00:00
return 1;
// erste Ecke gleich, zweite Ecke
{
const ScAddress& rEndPos1 = ps1->pPair->GetRange(0).aEnd;
const ScAddress& rEndPos2 = ps2->pPair->GetRange(0).aEnd;
if ( rEndPos1.Tab() == rEndPos2.Tab() )
nComp = COMPARE_EQUAL;
2000-09-18 23:16:46 +00:00
else
{
ps1->pDoc->GetName( rEndPos1.Tab(), aStr1 );
ps2->pDoc->GetName( rEndPos2.Tab(), aStr2 );
CWS-TOOLING: integrate CWS oj18 2009-08-21 15:08:49 +0200 oj r275263 : wrong check 2009-08-21 08:56:01 +0200 oj r275215 : missing not 2009-08-20 07:27:13 +0200 oj r275164 : use new method from global 2009-08-19 10:22:35 +0200 oj r275138 : call GetLocale instead of pLocale 2009-08-18 10:39:32 +0200 oj r275082 : missing header include 2009-08-18 10:09:44 +0200 oj r275081 : new methods at global 2009-08-18 10:09:00 +0200 oj r275080 : unused var 2009-08-18 08:59:04 +0200 oj r275078 : move files from classes to xml 2009-08-17 14:58:16 +0200 oj r275056 : CWS-TOOLING: rebase CWS oj18 to trunk@275001 (milestone: DEV300:m55) 2009-08-17 13:29:44 +0200 oj r275047 : compile error 2009-08-17 13:27:47 +0200 oj r275045 : compile error 2009-08-17 11:44:54 +0200 oj r275040 : add dep 2009-07-22 14:26:05 +0200 oj r274240 : move unused services into fwl 2009-07-22 14:25:35 +0200 oj r274239 : move unused services into fwl 2009-07-22 13:47:45 +0200 oj r274233 : remove some unused code 2009-07-22 09:06:20 +0200 oj r274219 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 08:48:58 +0200 oj r274218 : create NumberFormatter on demand 2009-07-22 08:39:23 +0200 oj r274217 : change char to sal_Char 2009-07-22 07:33:34 +0200 oj r274214 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 07:30:04 +0200 oj r274213 : late init of numberformatter and breakiterator 2009-07-22 07:28:55 +0200 oj r274212 : export dbtoolsclient dbcharsethelper for sc 2009-07-21 13:43:28 +0200 oj r274196 : check if quick start is enbaled 2009-07-21 13:40:09 +0200 oj r274195 : check config entry for UiEventsLogger 2009-07-21 13:37:40 +0200 oj r274194 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:35:38 +0200 oj r274193 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:33:41 +0200 oj r274192 : doc meta data will now be created on demand 2009-07-21 13:13:40 +0200 oj r274187 : load ldap functions on demand 2009-07-21 13:03:17 +0200 oj r274183 : late init of TransliterationImpl 2009-07-21 12:36:10 +0200 oj r274180 : late init of charClass
2009-09-08 04:57:32 +00:00
nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 );
2000-09-18 23:16:46 +00:00
}
switch ( nComp )
2000-09-18 23:16:46 +00:00
{
case COMPARE_LESS:
return -1;
//break;
2000-09-18 23:16:46 +00:00
case COMPARE_GREATER:
return 1;
//break;
2000-09-18 23:16:46 +00:00
default:
// gleiche Tabs
if ( rEndPos1.Col() < rEndPos2.Col() )
2000-09-18 23:16:46 +00:00
return -1;
if ( rEndPos1.Col() > rEndPos2.Col() )
2000-09-18 23:16:46 +00:00
return 1;
// gleiche Cols
if ( rEndPos1.Row() < rEndPos2.Row() )
2000-09-18 23:16:46 +00:00
return -1;
if ( rEndPos1.Row() > rEndPos2.Row() )
2000-09-18 23:16:46 +00:00
return 1;
return 0;
}
}
return 0;
}
return 0; // just in case
2000-09-18 23:16:46 +00:00
}
ScRangePair** ScRangePairList::CreateNameSortedArray( ULONG& nListCount,
2000-09-18 23:16:46 +00:00
ScDocument* pDoc ) const
{
nListCount = Count();
DBG_ASSERT( nListCount * sizeof(ScRangePairNameSort) <= (size_t)~0x1F,
"ScRangePairList::CreateNameSortedArray nListCount * sizeof(ScRangePairNameSort) > (size_t)~0x1F" );
2000-09-18 23:16:46 +00:00
ScRangePairNameSort* pSortArray = (ScRangePairNameSort*)
new BYTE [ nListCount * sizeof(ScRangePairNameSort) ];
2000-09-18 23:16:46 +00:00
ULONG j;
for ( j=0; j < nListCount; j++ )
2000-09-18 23:16:46 +00:00
{
pSortArray[j].pPair = GetObject( j );
pSortArray[j].pDoc = pDoc;
}
#if !(defined(ICC ) && defined(OS2))
qsort( (void*)pSortArray, nListCount, sizeof(ScRangePairNameSort), &ScRangePairList_QsortNameCompare );
2000-09-18 23:16:46 +00:00
#else
qsort( (void*)pSortArray, nListCount, sizeof(ScRangePairNameSort), ICCQsortRPairCompare );
2000-09-18 23:16:46 +00:00
#endif
// ScRangePair Pointer aufruecken
ScRangePair** ppSortArray = (ScRangePair**)pSortArray;
for ( j=0; j < nListCount; j++ )
2000-09-18 23:16:46 +00:00
{
ppSortArray[j] = pSortArray[j].pPair;
}
return ppSortArray;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */