Files
libreoffice/sc/source/ui/unoobj/datauno.cxx

2530 lines
91 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Herbert Duerr i#118735 prevent endless loop if vlookup/hlookup doesn't find anything http://svn.apache.org/viewvc?view=revision&revision=1239673 Patches contributed by Andre Fischer remove lp_solver http://svn.apache.org/viewvc?view=revision&revision=1199180 i#118160: Added external CoinMP library. http://svn.apache.org/viewvc?view=revision&revision=1233909 Patches contributed by Armin Le-Grand i#118485 - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 i#118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 Patches contributed by lihuiibm i#108860 - Fix range validation. http://svn.apache.org/viewvc?view=revision&revision=1242846 i#118954 Chart data will lost after copy to different file http://svn.apache.org/viewvc?view=revision&revision=1301345 Patches contributed by Ariel Constenla-Haile Fix Linux build breaker: extra qualification on member http://svn.apache.org/viewvc?view=revision&revision=1301591 i#118696 - i#118697 - Fix some Sheet Tab Color API issues http://svn.apache.org/viewvc?view=revision&revision=1225428 i#118697 - Fix uninitialized variable http://svn.apache.org/viewvc?view=revision&revision=1225859 i#118771 - ScUndoImportTab should preserve tab background color http://svn.apache.org/viewvc?view=revision&revision=1230356 i#118921 - Repaint linked sheet tab background color after updating link http://svn.apache.org/viewvc?view=revision&revision=1245177 i#118927 - Undo/Redo "Update Link" does not reset sheet tab color http://svn.apache.org/viewvc?view=revision&revision=1245241 i#118747 - Copy tab color when transferring sheets across documents http://svn.apache.org/viewvc?view=revision&revision=1230355 Patch contributed by Oliver Rainer-Wittman i#118012 - methods <ScBroadcastAreaSlot::AreaBroadcast(..)> and <ScBroadcastAreaSlot::AreaBroadcastInRange(..)> adapt stl-container iteration in order to avoid destroyed iterators during iteration. http://svn.apache.org/viewvc?view=revision&revision=1297916 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 Patch contributed by Daniel Rentz calc69: #i116936# fix VBA symbol Cells http://svn.apache.org/viewvc?view=revision&revision=1172135 Patches contributed by leiw: i#118546 CPU 100% on switched off AutoCalculate with Conditional Formatting on date values http://svn.apache.org/viewvc?view=revision&revision=1301380 Re-add new function documentation. Many various cleanups. Add missing calc66: #o11817313# also look at formula result number format, remove redundant binaries.
2012-11-30 12:23:25 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 16:07:07 +00:00
#include <svl/smplhint.hxx>
#include <svl/zforlist.hxx>
#include <vcl/svapp.hxx>
2000-09-18 16:07:07 +00:00
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/util/SortField.hpp>
#include <com/sun/star/table/TableSortField.hpp>
2000-09-18 16:07:07 +00:00
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/table/TableOrientation.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
2000-09-18 16:07:07 +00:00
#include <com/sun/star/sheet/DataImportMode.hpp>
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
#include <com/sun/star/sheet/FilterOperator2.hpp>
#include <com/sun/star/sheet/TableFilterField2.hpp>
2000-09-18 16:07:07 +00:00
#include "datauno.hxx"
#include "dapiuno.hxx"
#include "cellsuno.hxx"
#include "miscuno.hxx"
#include "targuno.hxx"
#include "rangeutl.hxx"
#include "dbdata.hxx"
2000-09-18 16:07:07 +00:00
#include "docsh.hxx"
#include "dbdocfun.hxx"
#include "unonames.hxx"
#include "globalnames.hxx"
2001-02-21 10:33:30 +00:00
#include "globstr.hrc"
#include "convuno.hxx"
#include "hints.hxx"
#include "attrib.hxx"
#include "dpshttab.hxx"
#include "queryentry.hxx"
#include <comphelper/extract.hxx>
#include <comphelper/servicehelper.hxx>
#include <svx/dataaccessdescriptor.hxx>
2000-09-18 16:07:07 +00:00
#include <limits>
2000-09-18 16:07:07 +00:00
using namespace com::sun::star;
//------------------------------------------------------------------------
// alles ohne Which-ID, Map nur fuer PropertySetInfo
static const SfxItemPropertyMapEntry* lcl_GetSubTotalPropertyMap()
2000-09-18 16:07:07 +00:00
{
2000-12-21 18:31:26 +00:00
// some old property names are for 5.2 compatibility
CWS-TOOLING: integrate CWS os128 2009-04-22 12:58:26 +0200 b_michaelsen r271093 : #i101084# using the frames enumeration for other SwXFrames-queries; also added a complex test to ensure the behavior to be the same 2009-04-20 14:53:03 +0200 mav r270987 : #i101219# adjust the testcases to test memory cache and temporary file cache 2009-04-20 14:52:09 +0200 mav r270986 : #i101219#,#i99077# use memory to cache data; no precopying on commit 2009-04-20 14:39:21 +0200 mav r270984 : #i101219# use memory to cache data 2009-04-20 14:39:08 +0200 mav r270983 : #i101219# use memory to cache data 2009-04-20 14:38:45 +0200 mav r270982 : #i101219# use memory to cache data 2009-04-17 07:37:52 +0200 os r270912 : CWS-TOOLING: rebase CWS os128 to trunk@270723 (milestone: DEV300:m46) 2009-04-15 14:54:18 +0200 b_michaelsen r270845 : #i101084# using frame enumerations for paragraph export for better performance 2009-04-15 14:52:54 +0200 b_michaelsen r270843 : #i101084# implemented XEnumerationAccess interface on framesets 2009-04-03 17:08:10 +0200 mav r270504 : #i100722# do not compress streams of known compressed types per default 2009-04-03 13:49:50 +0200 os r270484 : resync error fixed 2009-04-03 12:55:32 +0200 mav r270470 : #i100722# do not compress streams of known compressed types per default 2009-04-03 10:00:58 +0200 os r270463 : resync error fixed 2009-04-03 09:52:53 +0200 os r270462 : resync error fixed 2009-04-03 09:10:14 +0200 os r270449 : #i99568# string compare operator of hash_map changed 2009-04-03 09:03:49 +0200 os r270446 : #i100683# normalize file URLs 2009-04-02 11:09:27 +0200 os r270381 : #i100683# making URLs relative without file access 2009-04-02 09:04:42 +0200 os r270366 : CWS-TOOLING: rebase CWS os128 to trunk@270033 (milestone: DEV300:m45) 2009-03-31 08:08:37 +0200 os r270258 : #i100683# reducing calls to URIHelper::simpleNormalizeMakeRelative() 2009-03-19 17:06:22 +0100 os r269756 : #i99568# XTolerantMultiPropertySet activated 2009-03-16 11:46:14 +0100 os r269517 : wrong commit to #i97471# removed 2009-03-16 11:36:50 +0100 os r269514 : #i97471# SwDrawTextShell::Init(): mouse double click and key input in group objects at the same time: prevent crash 2009-03-13 11:08:54 +0100 os r269464 : #i99568# static SfxItemPropertySet 2009-03-13 11:03:22 +0100 os r269463 : #i99568# static SfxItemPropertySet 2009-03-11 12:59:27 +0100 os r269320 : #i99568# WhichId of properties handled from ScDocOptionsObj added 2009-03-06 09:09:58 +0100 os r268972 : #i99568# SfxItemPropertySet improvements 2009-03-05 20:54:43 +0100 os r268942 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 20:19:52 +0100 os r268941 : #i99568# SfxItemPropertySet improvements 2009-03-05 20:05:03 +0100 os r268940 : #i99568# SfxItemPropertySet improvements 2009-03-05 18:54:47 +0100 os r268936 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 17:51:38 +0100 os r268931 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 17:33:03 +0100 os r268930 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:53:00 +0100 os r268920 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:52:50 +0100 os r268919 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:50:41 +0100 os r268918 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:41:04 +0100 os r268916 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:40:40 +0100 os r268915 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 10:16:20 +0100 os r268881 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 10:15:55 +0100 os r268880 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-03 08:40:09 +0100 os r268704 : ScTableSheetObj::GetItemPropertyMap fixed 2009-03-03 07:50:00 +0100 os r268703 : SfxItemProperty set as pointer 2009-03-03 07:49:46 +0100 os r268702 : SfxItemProperty set as pointer 2009-03-02 08:15:37 +0100 os r268631 : minor fix 2009-03-02 07:58:38 +0100 os r268630 : minor fix 2009-02-27 13:03:25 +0100 os r268584 : exports 2009-02-27 11:17:04 +0100 os r268567 : debug code removed 2009-02-27 11:04:07 +0100 os r268565 : duplicate return removed 2009-02-27 10:17:37 +0100 os r268558 : syntax fixed 2009-02-27 09:56:14 +0100 os r268554 : #i99568# type mix fixed 2009-02-27 09:40:56 +0100 os r268553 : #i99568# exports changes reverted 2009-02-25 12:50:54 +0100 os r268433 : #i99568# SfxItemPropertySet rework 2009-02-25 12:13:39 +0100 os r268432 : #i99568# SfxItemPropertySet rework 2009-02-25 12:12:47 +0100 os r268431 : #i99568# SfxItemPropertySet rework 2009-02-25 12:10:27 +0100 os r268430 : #i99568# SfxItemPropertySet rework 2009-02-25 12:09:36 +0100 os r268429 : #i99568# SfxItemPropertySet rework 2009-02-25 12:07:39 +0100 os r268428 : #i99568# SfxItemPropertySet rework 2009-02-25 11:59:35 +0100 os r268427 : #i99568# SfxItemPropertySet rework 2009-02-25 11:52:52 +0100 os r268425 : #i99568# SfxItemPropertySet rework 2009-02-25 11:49:17 +0100 os r268424 : #i99568# SfxItemPropertySet rework 2009-02-25 11:45:17 +0100 os r268423 : #i99568# SfxItemPropertySet rework 2009-02-11 11:39:04 +0100 os r267587 : #i57008# use registration of index marks at SwUnoCallback
2009-06-03 11:26:39 +00:00
static SfxItemPropertyMapEntry aSubTotalPropertyMap_Impl[] =
2000-09-18 16:07:07 +00:00
{
{MAP_CHAR_LEN(SC_UNONAME_BINDFMT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_CASE), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ENABSORT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ENUSLIST), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_FORMATS), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_INSBRK), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ISCASE), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_MAXFLD), 0, &getCppuType((sal_Int32*)0), beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN(SC_UNONAME_SORTASC), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ULIST), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_UINDEX), 0, &getCppuType((sal_Int32*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_USINDEX), 0, &getCppuType((sal_Int32*)0), 0, 0},
{0,0,0,0,0,0}
2000-09-18 16:07:07 +00:00
};
return aSubTotalPropertyMap_Impl;
}
static const SfxItemPropertyMapEntry* lcl_GetFilterPropertyMap()
2000-09-18 16:07:07 +00:00
{
CWS-TOOLING: integrate CWS os128 2009-04-22 12:58:26 +0200 b_michaelsen r271093 : #i101084# using the frames enumeration for other SwXFrames-queries; also added a complex test to ensure the behavior to be the same 2009-04-20 14:53:03 +0200 mav r270987 : #i101219# adjust the testcases to test memory cache and temporary file cache 2009-04-20 14:52:09 +0200 mav r270986 : #i101219#,#i99077# use memory to cache data; no precopying on commit 2009-04-20 14:39:21 +0200 mav r270984 : #i101219# use memory to cache data 2009-04-20 14:39:08 +0200 mav r270983 : #i101219# use memory to cache data 2009-04-20 14:38:45 +0200 mav r270982 : #i101219# use memory to cache data 2009-04-17 07:37:52 +0200 os r270912 : CWS-TOOLING: rebase CWS os128 to trunk@270723 (milestone: DEV300:m46) 2009-04-15 14:54:18 +0200 b_michaelsen r270845 : #i101084# using frame enumerations for paragraph export for better performance 2009-04-15 14:52:54 +0200 b_michaelsen r270843 : #i101084# implemented XEnumerationAccess interface on framesets 2009-04-03 17:08:10 +0200 mav r270504 : #i100722# do not compress streams of known compressed types per default 2009-04-03 13:49:50 +0200 os r270484 : resync error fixed 2009-04-03 12:55:32 +0200 mav r270470 : #i100722# do not compress streams of known compressed types per default 2009-04-03 10:00:58 +0200 os r270463 : resync error fixed 2009-04-03 09:52:53 +0200 os r270462 : resync error fixed 2009-04-03 09:10:14 +0200 os r270449 : #i99568# string compare operator of hash_map changed 2009-04-03 09:03:49 +0200 os r270446 : #i100683# normalize file URLs 2009-04-02 11:09:27 +0200 os r270381 : #i100683# making URLs relative without file access 2009-04-02 09:04:42 +0200 os r270366 : CWS-TOOLING: rebase CWS os128 to trunk@270033 (milestone: DEV300:m45) 2009-03-31 08:08:37 +0200 os r270258 : #i100683# reducing calls to URIHelper::simpleNormalizeMakeRelative() 2009-03-19 17:06:22 +0100 os r269756 : #i99568# XTolerantMultiPropertySet activated 2009-03-16 11:46:14 +0100 os r269517 : wrong commit to #i97471# removed 2009-03-16 11:36:50 +0100 os r269514 : #i97471# SwDrawTextShell::Init(): mouse double click and key input in group objects at the same time: prevent crash 2009-03-13 11:08:54 +0100 os r269464 : #i99568# static SfxItemPropertySet 2009-03-13 11:03:22 +0100 os r269463 : #i99568# static SfxItemPropertySet 2009-03-11 12:59:27 +0100 os r269320 : #i99568# WhichId of properties handled from ScDocOptionsObj added 2009-03-06 09:09:58 +0100 os r268972 : #i99568# SfxItemPropertySet improvements 2009-03-05 20:54:43 +0100 os r268942 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 20:19:52 +0100 os r268941 : #i99568# SfxItemPropertySet improvements 2009-03-05 20:05:03 +0100 os r268940 : #i99568# SfxItemPropertySet improvements 2009-03-05 18:54:47 +0100 os r268936 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 17:51:38 +0100 os r268931 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 17:33:03 +0100 os r268930 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:53:00 +0100 os r268920 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:52:50 +0100 os r268919 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:50:41 +0100 os r268918 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:41:04 +0100 os r268916 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:40:40 +0100 os r268915 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 10:16:20 +0100 os r268881 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 10:15:55 +0100 os r268880 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-03 08:40:09 +0100 os r268704 : ScTableSheetObj::GetItemPropertyMap fixed 2009-03-03 07:50:00 +0100 os r268703 : SfxItemProperty set as pointer 2009-03-03 07:49:46 +0100 os r268702 : SfxItemProperty set as pointer 2009-03-02 08:15:37 +0100 os r268631 : minor fix 2009-03-02 07:58:38 +0100 os r268630 : minor fix 2009-02-27 13:03:25 +0100 os r268584 : exports 2009-02-27 11:17:04 +0100 os r268567 : debug code removed 2009-02-27 11:04:07 +0100 os r268565 : duplicate return removed 2009-02-27 10:17:37 +0100 os r268558 : syntax fixed 2009-02-27 09:56:14 +0100 os r268554 : #i99568# type mix fixed 2009-02-27 09:40:56 +0100 os r268553 : #i99568# exports changes reverted 2009-02-25 12:50:54 +0100 os r268433 : #i99568# SfxItemPropertySet rework 2009-02-25 12:13:39 +0100 os r268432 : #i99568# SfxItemPropertySet rework 2009-02-25 12:12:47 +0100 os r268431 : #i99568# SfxItemPropertySet rework 2009-02-25 12:10:27 +0100 os r268430 : #i99568# SfxItemPropertySet rework 2009-02-25 12:09:36 +0100 os r268429 : #i99568# SfxItemPropertySet rework 2009-02-25 12:07:39 +0100 os r268428 : #i99568# SfxItemPropertySet rework 2009-02-25 11:59:35 +0100 os r268427 : #i99568# SfxItemPropertySet rework 2009-02-25 11:52:52 +0100 os r268425 : #i99568# SfxItemPropertySet rework 2009-02-25 11:49:17 +0100 os r268424 : #i99568# SfxItemPropertySet rework 2009-02-25 11:45:17 +0100 os r268423 : #i99568# SfxItemPropertySet rework 2009-02-11 11:39:04 +0100 os r267587 : #i57008# use registration of index marks at SwUnoCallback
2009-06-03 11:26:39 +00:00
static SfxItemPropertyMapEntry aFilterPropertyMap_Impl[] =
2000-09-18 16:07:07 +00:00
{
{MAP_CHAR_LEN(SC_UNONAME_CONTHDR), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_COPYOUT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ISCASE), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_MAXFLD), 0, &getCppuType((sal_Int32*)0), beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN(SC_UNONAME_ORIENT), 0, &getCppuType((table::TableOrientation*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_OUTPOS), 0, &getCppuType((table::CellAddress*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_SAVEOUT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_SKIPDUP), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_USEREGEX), 0, &getBooleanCppuType(), 0, 0},
{0,0,0,0,0,0}
2000-09-18 16:07:07 +00:00
};
return aFilterPropertyMap_Impl;
}
static const SfxItemPropertyMapEntry* lcl_GetDBRangePropertyMap()
2000-09-18 16:07:07 +00:00
{
CWS-TOOLING: integrate CWS os128 2009-04-22 12:58:26 +0200 b_michaelsen r271093 : #i101084# using the frames enumeration for other SwXFrames-queries; also added a complex test to ensure the behavior to be the same 2009-04-20 14:53:03 +0200 mav r270987 : #i101219# adjust the testcases to test memory cache and temporary file cache 2009-04-20 14:52:09 +0200 mav r270986 : #i101219#,#i99077# use memory to cache data; no precopying on commit 2009-04-20 14:39:21 +0200 mav r270984 : #i101219# use memory to cache data 2009-04-20 14:39:08 +0200 mav r270983 : #i101219# use memory to cache data 2009-04-20 14:38:45 +0200 mav r270982 : #i101219# use memory to cache data 2009-04-17 07:37:52 +0200 os r270912 : CWS-TOOLING: rebase CWS os128 to trunk@270723 (milestone: DEV300:m46) 2009-04-15 14:54:18 +0200 b_michaelsen r270845 : #i101084# using frame enumerations for paragraph export for better performance 2009-04-15 14:52:54 +0200 b_michaelsen r270843 : #i101084# implemented XEnumerationAccess interface on framesets 2009-04-03 17:08:10 +0200 mav r270504 : #i100722# do not compress streams of known compressed types per default 2009-04-03 13:49:50 +0200 os r270484 : resync error fixed 2009-04-03 12:55:32 +0200 mav r270470 : #i100722# do not compress streams of known compressed types per default 2009-04-03 10:00:58 +0200 os r270463 : resync error fixed 2009-04-03 09:52:53 +0200 os r270462 : resync error fixed 2009-04-03 09:10:14 +0200 os r270449 : #i99568# string compare operator of hash_map changed 2009-04-03 09:03:49 +0200 os r270446 : #i100683# normalize file URLs 2009-04-02 11:09:27 +0200 os r270381 : #i100683# making URLs relative without file access 2009-04-02 09:04:42 +0200 os r270366 : CWS-TOOLING: rebase CWS os128 to trunk@270033 (milestone: DEV300:m45) 2009-03-31 08:08:37 +0200 os r270258 : #i100683# reducing calls to URIHelper::simpleNormalizeMakeRelative() 2009-03-19 17:06:22 +0100 os r269756 : #i99568# XTolerantMultiPropertySet activated 2009-03-16 11:46:14 +0100 os r269517 : wrong commit to #i97471# removed 2009-03-16 11:36:50 +0100 os r269514 : #i97471# SwDrawTextShell::Init(): mouse double click and key input in group objects at the same time: prevent crash 2009-03-13 11:08:54 +0100 os r269464 : #i99568# static SfxItemPropertySet 2009-03-13 11:03:22 +0100 os r269463 : #i99568# static SfxItemPropertySet 2009-03-11 12:59:27 +0100 os r269320 : #i99568# WhichId of properties handled from ScDocOptionsObj added 2009-03-06 09:09:58 +0100 os r268972 : #i99568# SfxItemPropertySet improvements 2009-03-05 20:54:43 +0100 os r268942 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 20:19:52 +0100 os r268941 : #i99568# SfxItemPropertySet improvements 2009-03-05 20:05:03 +0100 os r268940 : #i99568# SfxItemPropertySet improvements 2009-03-05 18:54:47 +0100 os r268936 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 17:51:38 +0100 os r268931 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 17:33:03 +0100 os r268930 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:53:00 +0100 os r268920 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:52:50 +0100 os r268919 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:50:41 +0100 os r268918 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:41:04 +0100 os r268916 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 15:40:40 +0100 os r268915 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 10:16:20 +0100 os r268881 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-05 10:15:55 +0100 os r268880 : #i99568# Sfx/SvxItemPropertySet improvements 2009-03-03 08:40:09 +0100 os r268704 : ScTableSheetObj::GetItemPropertyMap fixed 2009-03-03 07:50:00 +0100 os r268703 : SfxItemProperty set as pointer 2009-03-03 07:49:46 +0100 os r268702 : SfxItemProperty set as pointer 2009-03-02 08:15:37 +0100 os r268631 : minor fix 2009-03-02 07:58:38 +0100 os r268630 : minor fix 2009-02-27 13:03:25 +0100 os r268584 : exports 2009-02-27 11:17:04 +0100 os r268567 : debug code removed 2009-02-27 11:04:07 +0100 os r268565 : duplicate return removed 2009-02-27 10:17:37 +0100 os r268558 : syntax fixed 2009-02-27 09:56:14 +0100 os r268554 : #i99568# type mix fixed 2009-02-27 09:40:56 +0100 os r268553 : #i99568# exports changes reverted 2009-02-25 12:50:54 +0100 os r268433 : #i99568# SfxItemPropertySet rework 2009-02-25 12:13:39 +0100 os r268432 : #i99568# SfxItemPropertySet rework 2009-02-25 12:12:47 +0100 os r268431 : #i99568# SfxItemPropertySet rework 2009-02-25 12:10:27 +0100 os r268430 : #i99568# SfxItemPropertySet rework 2009-02-25 12:09:36 +0100 os r268429 : #i99568# SfxItemPropertySet rework 2009-02-25 12:07:39 +0100 os r268428 : #i99568# SfxItemPropertySet rework 2009-02-25 11:59:35 +0100 os r268427 : #i99568# SfxItemPropertySet rework 2009-02-25 11:52:52 +0100 os r268425 : #i99568# SfxItemPropertySet rework 2009-02-25 11:49:17 +0100 os r268424 : #i99568# SfxItemPropertySet rework 2009-02-25 11:45:17 +0100 os r268423 : #i99568# SfxItemPropertySet rework 2009-02-11 11:39:04 +0100 os r267587 : #i57008# use registration of index marks at SwUnoCallback
2009-06-03 11:26:39 +00:00
static SfxItemPropertyMapEntry aDBRangePropertyMap_Impl[] =
2000-09-18 16:07:07 +00:00
{
{MAP_CHAR_LEN(SC_UNONAME_AUTOFLT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_FLTCRT), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_FROMSELECT),0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ISUSER), 0, &getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_KEEPFORM), 0, &getBooleanCppuType(), 0, 0},
2000-09-18 16:07:07 +00:00
{MAP_CHAR_LEN(SC_UNO_LINKDISPBIT), 0, &getCppuType((uno::Reference<awt::XBitmap>*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNO_LINKDISPNAME), 0, &getCppuType((rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_MOVCELLS), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_REFPERIOD), 0, &getCppuType((sal_Int32*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_STRIPDAT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_TOKENINDEX),0, &getCppuType((sal_Int32*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_USEFLTCRT),0, &getBooleanCppuType(), 0, 0},
{0,0,0,0,0,0}
2000-09-18 16:07:07 +00:00
};
return aDBRangePropertyMap_Impl;
}
//------------------------------------------------------------------------
#define SCDATABASERANGEOBJ_SERVICE "com.sun.star.sheet.DatabaseRange"
SC_SIMPLE_SERVICE_INFO( ScConsolidationDescriptor, "ScConsolidationDescriptor", "com.sun.star.sheet.ConsolidationDescriptor" )
SC_SIMPLE_SERVICE_INFO( ScDatabaseRangesObj, "ScDatabaseRangesObj", "com.sun.star.sheet.DatabaseRanges" )
SC_SIMPLE_SERVICE_INFO( ScFilterDescriptorBase, "ScFilterDescriptorBase", "com.sun.star.sheet.SheetFilterDescriptor" )
SC_SIMPLE_SERVICE_INFO( ScSubTotalDescriptorBase, "ScSubTotalDescriptorBase", "com.sun.star.sheet.SubTotalDescriptor" )
SC_SIMPLE_SERVICE_INFO( ScSubTotalFieldObj, "ScSubTotalFieldObj", "com.sun.star.sheet.SubTotalField" )
//------------------------------------------------------------------------
ScSubTotalFunc ScDataUnoConversion::GeneralToSubTotal( sheet::GeneralFunction eSummary )
{
ScSubTotalFunc eSubTotal;
switch (eSummary)
{
case sheet::GeneralFunction_NONE: eSubTotal = SUBTOTAL_FUNC_NONE; break;
case sheet::GeneralFunction_SUM: eSubTotal = SUBTOTAL_FUNC_SUM; break;
case sheet::GeneralFunction_COUNT: eSubTotal = SUBTOTAL_FUNC_CNT2; break;
case sheet::GeneralFunction_AVERAGE: eSubTotal = SUBTOTAL_FUNC_AVE; break;
case sheet::GeneralFunction_MAX: eSubTotal = SUBTOTAL_FUNC_MAX; break;
case sheet::GeneralFunction_MIN: eSubTotal = SUBTOTAL_FUNC_MIN; break;
case sheet::GeneralFunction_PRODUCT: eSubTotal = SUBTOTAL_FUNC_PROD; break;
case sheet::GeneralFunction_COUNTNUMS: eSubTotal = SUBTOTAL_FUNC_CNT; break;
case sheet::GeneralFunction_STDEV: eSubTotal = SUBTOTAL_FUNC_STD; break;
case sheet::GeneralFunction_STDEVP: eSubTotal = SUBTOTAL_FUNC_STDP; break;
case sheet::GeneralFunction_VAR: eSubTotal = SUBTOTAL_FUNC_VAR; break;
case sheet::GeneralFunction_VARP: eSubTotal = SUBTOTAL_FUNC_VARP; break;
case sheet::GeneralFunction_AUTO:
default:
2011-03-01 19:05:02 +01:00
OSL_FAIL("GeneralToSubTotal: falscher enum");
2000-09-18 16:07:07 +00:00
eSubTotal = SUBTOTAL_FUNC_NONE;
}
return eSubTotal;
}
sheet::GeneralFunction ScDataUnoConversion::SubTotalToGeneral( ScSubTotalFunc eSubTotal )
{
sheet::GeneralFunction eGeneral;
switch (eSubTotal)
{
case SUBTOTAL_FUNC_NONE: eGeneral = sheet::GeneralFunction_NONE; break;
case SUBTOTAL_FUNC_AVE: eGeneral = sheet::GeneralFunction_AVERAGE; break;
case SUBTOTAL_FUNC_CNT: eGeneral = sheet::GeneralFunction_COUNTNUMS; break;
case SUBTOTAL_FUNC_CNT2: eGeneral = sheet::GeneralFunction_COUNT; break;
case SUBTOTAL_FUNC_MAX: eGeneral = sheet::GeneralFunction_MAX; break;
case SUBTOTAL_FUNC_MIN: eGeneral = sheet::GeneralFunction_MIN; break;
case SUBTOTAL_FUNC_PROD: eGeneral = sheet::GeneralFunction_PRODUCT; break;
case SUBTOTAL_FUNC_STD: eGeneral = sheet::GeneralFunction_STDEV; break;
case SUBTOTAL_FUNC_STDP: eGeneral = sheet::GeneralFunction_STDEVP; break;
case SUBTOTAL_FUNC_SUM: eGeneral = sheet::GeneralFunction_SUM; break;
case SUBTOTAL_FUNC_VAR: eGeneral = sheet::GeneralFunction_VAR; break;
case SUBTOTAL_FUNC_VARP: eGeneral = sheet::GeneralFunction_VARP; break;
default:
2011-03-01 19:05:02 +01:00
OSL_FAIL("SubTotalToGeneral: falscher enum");
2000-09-18 16:07:07 +00:00
eGeneral = sheet::GeneralFunction_NONE;
break;
}
return eGeneral;
}
//------------------------------------------------------------------------
// ScImportDescriptor: alles static
long ScImportDescriptor::GetPropertyCount()
{
return 4;
}
void ScImportDescriptor::FillProperties( uno::Sequence<beans::PropertyValue>& rSeq, const ScImportParam& rParam )
{
OSL_ENSURE( rSeq.getLength() == GetPropertyCount(), "falscher Count" );
2000-09-18 16:07:07 +00:00
beans::PropertyValue* pArray = rSeq.getArray();
sheet::DataImportMode eMode = sheet::DataImportMode_NONE;
if ( rParam.bImport )
{
if ( rParam.bSql )
eMode = sheet::DataImportMode_SQL;
else if ( rParam.nType == ScDbQuery )
2000-09-18 16:07:07 +00:00
eMode = sheet::DataImportMode_QUERY;
else
eMode = sheet::DataImportMode_TABLE; // Type ist immer ScDbQuery oder ScDbTable
2000-09-18 16:07:07 +00:00
}
::svx::ODataAccessDescriptor aDescriptor;
aDescriptor.setDataSource(rParam.aDBName);
if (aDescriptor.has( svx::daDataSource ))
{
pArray[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_DBNAME ));
2011-05-10 11:57:13 -04:00
pArray[0].Value <<= rParam.aDBName;
}
else if (aDescriptor.has( svx::daConnectionResource ))
{
pArray[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CONRES ));
2011-05-10 11:57:13 -04:00
pArray[0].Value <<= rParam.aDBName;
}
2000-09-18 16:07:07 +00:00
pArray[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SRCTYPE ));
2000-09-18 16:07:07 +00:00
pArray[1].Value <<= eMode;
pArray[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SRCOBJ ));
2011-05-10 11:57:13 -04:00
pArray[2].Value <<= rParam.aStatement;
2000-09-18 16:07:07 +00:00
pArray[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ISNATIVE ));
2000-09-18 16:07:07 +00:00
ScUnoHelpFunctions::SetBoolInAny( pArray[3].Value, rParam.bNative );
}
void ScImportDescriptor::FillImportParam( ScImportParam& rParam, const uno::Sequence<beans::PropertyValue>& rSeq )
{
rtl::OUString aStrVal;
const beans::PropertyValue* pPropArray = rSeq.getConstArray();
long nPropCount = rSeq.getLength();
for (long i = 0; i < nPropCount; i++)
{
const beans::PropertyValue& rProp = pPropArray[i];
String aPropName(rProp.Name);
2000-09-18 16:07:07 +00:00
if (aPropName.EqualsAscii( SC_UNONAME_ISNATIVE ))
2000-09-18 16:07:07 +00:00
rParam.bNative = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
else if (aPropName.EqualsAscii( SC_UNONAME_DBNAME ))
{
if ( rProp.Value >>= aStrVal )
2011-05-10 11:57:13 -04:00
rParam.aDBName = aStrVal;
2000-09-18 16:07:07 +00:00
}
else if (aPropName.EqualsAscii( SC_UNONAME_CONRES ))
{
if ( rProp.Value >>= aStrVal )
2011-05-10 11:57:13 -04:00
rParam.aDBName = aStrVal;
}
2000-09-18 16:07:07 +00:00
else if (aPropName.EqualsAscii( SC_UNONAME_SRCOBJ ))
{
if ( rProp.Value >>= aStrVal )
2011-05-10 11:57:13 -04:00
rParam.aStatement = aStrVal;
2000-09-18 16:07:07 +00:00
}
else if (aPropName.EqualsAscii( SC_UNONAME_SRCTYPE ))
{
//! test for correct enum type?
sheet::DataImportMode eMode = (sheet::DataImportMode)
ScUnoHelpFunctions::GetEnumFromAny( rProp.Value );
switch (eMode)
{
case sheet::DataImportMode_NONE:
rParam.bImport = false;
2000-09-18 16:07:07 +00:00
break;
case sheet::DataImportMode_SQL:
2011-05-10 11:57:13 -04:00
rParam.bImport = true;
rParam.bSql = true;
2000-09-18 16:07:07 +00:00
break;
case sheet::DataImportMode_TABLE:
2011-05-10 11:57:13 -04:00
rParam.bImport = true;
rParam.bSql = false;
rParam.nType = ScDbTable;
2000-09-18 16:07:07 +00:00
break;
case sheet::DataImportMode_QUERY:
2011-05-10 11:57:13 -04:00
rParam.bImport = true;
rParam.bSql = false;
rParam.nType = ScDbQuery;
2000-09-18 16:07:07 +00:00
break;
default:
2011-03-01 19:05:02 +01:00
OSL_FAIL("falscher Mode");
rParam.bImport = false;
2000-09-18 16:07:07 +00:00
}
}
}
}
//------------------------------------------------------------------------
// ScSortDescriptor: alles static
//! SortAscending muss aus der SheetSortDescriptor service-Beschreibung raus
long ScSortDescriptor::GetPropertyCount()
{
return 9; // TableSortDescriptor and SheetSortDescriptor
2000-09-18 16:07:07 +00:00
}
void ScSortDescriptor::FillProperties( uno::Sequence<beans::PropertyValue>& rSeq, const ScSortParam& rParam )
{
OSL_ENSURE( rSeq.getLength() == GetPropertyCount(), "falscher Count" );
2000-09-18 16:07:07 +00:00
beans::PropertyValue* pArray = rSeq.getArray();
// Uno-Werte zusammensuchen
table::CellAddress aOutPos;
aOutPos.Sheet = rParam.nDestTab;
aOutPos.Column = rParam.nDestCol;
aOutPos.Row = rParam.nDestRow;
sal_uInt16 nSortCount = 0;
while ( nSortCount < rParam.GetSortKeyCount() && rParam.maKeyState[nSortCount].bDoSort )
2000-09-18 16:07:07 +00:00
++nSortCount;
uno::Sequence<table::TableSortField> aFields(nSortCount);
2000-09-18 16:07:07 +00:00
if (nSortCount)
{
table::TableSortField* pFieldArray = aFields.getArray();
for (sal_uInt16 i=0; i<nSortCount; i++)
2000-09-18 16:07:07 +00:00
{
pFieldArray[i].Field = rParam.maKeyState[i].nField;
pFieldArray[i].IsAscending = rParam.maKeyState[i].bAscending;
pFieldArray[i].FieldType = table::TableSortFieldType_AUTOMATIC; // immer Automatic
pFieldArray[i].IsCaseSensitive = rParam.bCaseSens;
pFieldArray[i].CollatorLocale = rParam.aCollatorLocale;
pFieldArray[i].CollatorAlgorithm = rParam.aCollatorAlgorithm;
2000-09-18 16:07:07 +00:00
}
}
// Sequence fuellen
pArray[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ISSORTCOLUMNS ));
pArray[0].Value = ::cppu::bool2any(!rParam.bByRow);
2000-09-18 16:07:07 +00:00
pArray[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CONTHDR ));
ScUnoHelpFunctions::SetBoolInAny( pArray[1].Value, rParam.bHasHeader );
pArray[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_MAXFLD ));
pArray[2].Value <<= static_cast<sal_Int32>( rParam.GetSortKeyCount() );
2000-09-18 16:07:07 +00:00
pArray[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SORTFLD ));
pArray[3].Value <<= aFields;
2000-09-18 16:07:07 +00:00
pArray[4].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_BINDFMT ));
ScUnoHelpFunctions::SetBoolInAny( pArray[4].Value, rParam.bIncludePattern );
2000-09-18 16:07:07 +00:00
pArray[5].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_COPYOUT ));
ScUnoHelpFunctions::SetBoolInAny( pArray[5].Value, !rParam.bInplace );
2000-09-18 16:07:07 +00:00
pArray[6].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_OUTPOS ));
pArray[6].Value <<= aOutPos;
2000-09-18 16:07:07 +00:00
pArray[7].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ISULIST ));
ScUnoHelpFunctions::SetBoolInAny( pArray[7].Value, rParam.bUserDef );
2000-09-18 16:07:07 +00:00
pArray[8].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_UINDEX ));
pArray[8].Value <<= static_cast<sal_Int32>( rParam.nUserIndex );
2000-09-18 16:07:07 +00:00
}
void ScSortDescriptor::FillSortParam( ScSortParam& rParam, const uno::Sequence<beans::PropertyValue>& rSeq )
{
const beans::PropertyValue* pPropArray = rSeq.getConstArray();
long nPropCount = rSeq.getLength();
sal_Int16 nSortSize = rParam.GetSortKeyCount();
for (long nProp = 0; nProp < nPropCount; nProp++)
2000-09-18 16:07:07 +00:00
{
const beans::PropertyValue& rProp = pPropArray[nProp];
String aPropName(rProp.Name);
2000-09-18 16:07:07 +00:00
if (aPropName.EqualsAscii( SC_UNONAME_ORIENT ))
{
//! test for correct enum type?
table::TableOrientation eOrient = (table::TableOrientation)
ScUnoHelpFunctions::GetEnumFromAny( rProp.Value );
rParam.bByRow = ( eOrient != table::TableOrientation_COLUMNS );
}
else if (aPropName.EqualsAscii( SC_UNONAME_ISSORTCOLUMNS ))
{
rParam.bByRow = !::cppu::any2bool(rProp.Value);
}
2000-09-18 16:07:07 +00:00
else if (aPropName.EqualsAscii( SC_UNONAME_CONTHDR ))
rParam.bHasHeader = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
else if (aPropName.EqualsAscii( SC_UNONAME_MAXFLD ))
{
sal_Int32 nVal;
if ( (rProp.Value >>= nVal) && nVal > nSortSize )
2000-09-18 16:07:07 +00:00
{
//! specify exceptions
//! throw lang::IllegalArgumentException();
}
}
else if (aPropName.EqualsAscii( SC_UNONAME_SORTFLD ))
{
uno::Sequence<util::SortField> aSeq;
uno::Sequence<table::TableSortField> aNewSeq;
2000-09-18 16:07:07 +00:00
if ( rProp.Value >>= aSeq )
{
sal_Int32 nCount = aSeq.getLength();
sal_Int32 i;
if ( nCount > static_cast<sal_Int32>( rParam.GetSortKeyCount() ) )
2000-09-18 16:07:07 +00:00
{
nCount = nSortSize;
rParam.maKeyState.resize(nCount);
2000-09-18 16:07:07 +00:00
}
const util::SortField* pFieldArray = aSeq.getConstArray();
for (i=0; i<nCount; i++)
{
rParam.maKeyState[i].nField = static_cast<SCCOLROW>( pFieldArray[i].Field );
rParam.maKeyState[i].bAscending = pFieldArray[i].SortAscending;
// FieldType wird ignoriert
rParam.maKeyState[i].bDoSort = true;
}
for (i=nCount; i<nSortSize; i++)
rParam.maKeyState[i].bDoSort = false;
}
else if ( rProp.Value >>= aNewSeq )
{
sal_Int32 nCount = aNewSeq.getLength();
sal_Int32 i;
if ( nCount > nSortSize )
{
nCount = nSortSize;
rParam.maKeyState.resize(nCount);
}
const table::TableSortField* pFieldArray = aNewSeq.getConstArray();
for (i=0; i<nCount; i++)
{
rParam.maKeyState[i].nField = static_cast<SCCOLROW>( pFieldArray[i].Field );
rParam.maKeyState[i].bAscending = pFieldArray[i].IsAscending;
// only one is possible, sometime we should make it possible to have different for every entry
rParam.bCaseSens = pFieldArray[i].IsCaseSensitive;
rParam.aCollatorLocale = pFieldArray[i].CollatorLocale;
rParam.aCollatorAlgorithm = pFieldArray[i].CollatorAlgorithm;
2000-09-18 16:07:07 +00:00
// FieldType wird ignoriert
rParam.maKeyState[i].bDoSort = true;
2000-09-18 16:07:07 +00:00
}
for (i=nCount; i<nSortSize; i++)
rParam.maKeyState[i].bDoSort = false;
2000-09-18 16:07:07 +00:00
}
}
else if (aPropName.EqualsAscii( SC_UNONAME_ISCASE ))
{
2000-09-18 16:07:07 +00:00
rParam.bCaseSens = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
}
2000-09-18 16:07:07 +00:00
else if (aPropName.EqualsAscii( SC_UNONAME_BINDFMT ))
rParam.bIncludePattern = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
else if (aPropName.EqualsAscii( SC_UNONAME_COPYOUT ))
rParam.bInplace = !ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
else if (aPropName.EqualsAscii( SC_UNONAME_OUTPOS ))
{
table::CellAddress aAddress;
if ( rProp.Value >>= aAddress )
{
rParam.nDestTab = aAddress.Sheet;
rParam.nDestCol = (SCCOL)aAddress.Column;
rParam.nDestRow = (SCROW)aAddress.Row;
2000-09-18 16:07:07 +00:00
}
}
else if (aPropName.EqualsAscii( SC_UNONAME_ISULIST ))
rParam.bUserDef = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
else if (aPropName.EqualsAscii( SC_UNONAME_UINDEX ))
{
sal_Int32 nVal = 0;
2000-09-18 16:07:07 +00:00
if ( rProp.Value >>= nVal )
rParam.nUserIndex = (sal_uInt16)nVal;
2000-09-18 16:07:07 +00:00
}
else if (aPropName.EqualsAscii( SC_UNONAME_COLLLOC ))
{
rProp.Value >>= rParam.aCollatorLocale;
}
else if (aPropName.EqualsAscii( SC_UNONAME_COLLALG ))
{
rtl::OUString sStr;
if ( rProp.Value >>= sStr )
rParam.aCollatorAlgorithm = sStr;
}
2000-09-18 16:07:07 +00:00
}
}
//------------------------------------------------------------------------
ScSubTotalFieldObj::ScSubTotalFieldObj( ScSubTotalDescriptorBase* pDesc, sal_uInt16 nP ) :
2000-09-18 16:07:07 +00:00
xRef( pDesc ), // Objekt festhalten
rParent( *pDesc ),
2000-09-18 16:07:07 +00:00
nPos( nP )
{
OSL_ENSURE(pDesc, "ScSubTotalFieldObj: Parent ist 0");
2000-09-18 16:07:07 +00:00
}
ScSubTotalFieldObj::~ScSubTotalFieldObj()
{
}
// XSubTotalField
sal_Int32 SAL_CALL ScSubTotalFieldObj::getGroupColumn() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
rParent.GetData(aParam);
return aParam.nField[nPos];
}
void SAL_CALL ScSubTotalFieldObj::setGroupColumn( sal_Int32 nGroupColumn ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
rParent.GetData(aParam);
aParam.nField[nPos] = (SCCOL)nGroupColumn;
2000-09-18 16:07:07 +00:00
rParent.PutData(aParam);
}
uno::Sequence<sheet::SubTotalColumn> SAL_CALL ScSubTotalFieldObj::getSubTotalColumns()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
rParent.GetData(aParam);
SCCOL nCount = aParam.nSubTotals[nPos];
2000-09-18 16:07:07 +00:00
uno::Sequence<sheet::SubTotalColumn> aSeq(nCount);
sheet::SubTotalColumn* pAry = aSeq.getArray();
for (SCCOL i=0; i<nCount; i++)
2000-09-18 16:07:07 +00:00
{
pAry[i].Column = aParam.pSubTotals[nPos][i];
pAry[i].Function = ScDataUnoConversion::SubTotalToGeneral(
aParam.pFunctions[nPos][i] );
}
return aSeq;
}
void SAL_CALL ScSubTotalFieldObj::setSubTotalColumns(
const uno::Sequence<sheet::SubTotalColumn>& aSubTotalColumns )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
rParent.GetData(aParam);
sal_uInt32 nColCount = aSubTotalColumns.getLength();
if ( nColCount <= sal::static_int_cast<sal_uInt32>(SCCOL_MAX) )
2000-09-18 16:07:07 +00:00
{
SCCOL nCount = static_cast<SCCOL>(nColCount);
2000-09-18 16:07:07 +00:00
aParam.nSubTotals[nPos] = nCount;
if (nCount != 0)
2000-09-18 16:07:07 +00:00
{
aParam.pSubTotals[nPos] = new SCCOL[nCount];
2000-09-18 16:07:07 +00:00
aParam.pFunctions[nPos] = new ScSubTotalFunc[nCount];
const sheet::SubTotalColumn* pAry = aSubTotalColumns.getConstArray();
for (SCCOL i=0; i<nCount; i++)
2000-09-18 16:07:07 +00:00
{
aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column);
2000-09-18 16:07:07 +00:00
aParam.pFunctions[nPos][i] =
ScDataUnoConversion::GeneralToSubTotal( pAry[i].Function );
}
}
else
{
aParam.pSubTotals[nPos] = NULL;
aParam.pFunctions[nPos] = NULL;
}
}
//! sonst Exception oder so? (zuviele Spalten)
rParent.PutData(aParam);
}
//------------------------------------------------------------------------
ScSubTotalDescriptorBase::ScSubTotalDescriptorBase() :
aPropSet( lcl_GetSubTotalPropertyMap() )
{
}
ScSubTotalDescriptorBase::~ScSubTotalDescriptorBase()
{
}
// XSubTotalDesctiptor
ScSubTotalFieldObj* ScSubTotalDescriptorBase::GetObjectByIndex_Impl(sal_uInt16 nIndex)
2000-09-18 16:07:07 +00:00
{
if ( nIndex < getCount() )
return new ScSubTotalFieldObj( this, nIndex );
return NULL;
}
void SAL_CALL ScSubTotalDescriptorBase::clear() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
GetData(aParam);
for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
aParam.bGroupActive[i] = false;
2000-09-18 16:07:07 +00:00
//! Notify oder so fuer die Field-Objekte???
PutData(aParam);
}
void SAL_CALL ScSubTotalDescriptorBase::addNew(
const uno::Sequence<sheet::SubTotalColumn>& aSubTotalColumns,
sal_Int32 nGroupColumn ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
GetData(aParam);
sal_uInt16 nPos = 0;
2000-09-18 16:07:07 +00:00
while ( nPos < MAXSUBTOTAL && aParam.bGroupActive[nPos] )
++nPos;
sal_uInt32 nColCount = aSubTotalColumns.getLength();
2000-09-18 16:07:07 +00:00
if ( nPos < MAXSUBTOTAL && nColCount <= sal::static_int_cast<sal_uInt32>(SCCOL_MAX) )
2000-09-18 16:07:07 +00:00
{
aParam.bGroupActive[nPos] = sal_True;
aParam.nField[nPos] = static_cast<SCCOL>(nGroupColumn);
2000-09-18 16:07:07 +00:00
delete aParam.pSubTotals[nPos];
delete aParam.pFunctions[nPos];
SCCOL nCount = static_cast<SCCOL>(nColCount);
2000-09-18 16:07:07 +00:00
aParam.nSubTotals[nPos] = nCount;
if (nCount != 0)
2000-09-18 16:07:07 +00:00
{
aParam.pSubTotals[nPos] = new SCCOL[nCount];
2000-09-18 16:07:07 +00:00
aParam.pFunctions[nPos] = new ScSubTotalFunc[nCount];
const sheet::SubTotalColumn* pAry = aSubTotalColumns.getConstArray();
for (SCCOL i=0; i<nCount; i++)
2000-09-18 16:07:07 +00:00
{
aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column);
2000-09-18 16:07:07 +00:00
aParam.pFunctions[nPos][i] =
ScDataUnoConversion::GeneralToSubTotal( pAry[i].Function );
}
}
else
{
aParam.pSubTotals[nPos] = NULL;
aParam.pFunctions[nPos] = NULL;
}
}
else // too many fields / columns
throw uno::RuntimeException(); // no other exceptions specified
2000-09-18 16:07:07 +00:00
PutData(aParam);
}
// Flags/Einstellungen als Properties
// XEnumerationAccess
uno::Reference<container::XEnumeration> SAL_CALL ScSubTotalDescriptorBase::createEnumeration()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return new ScIndexEnumeration(this, rtl::OUString("com.sun.star.sheet.SubTotalFieldsEnumeration"));
2000-09-18 16:07:07 +00:00
}
// XIndexAccess
sal_Int32 SAL_CALL ScSubTotalDescriptorBase::getCount() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
GetData(aParam);
sal_uInt16 nCount = 0;
2000-09-18 16:07:07 +00:00
while ( nCount < MAXSUBTOTAL && aParam.bGroupActive[nCount] )
++nCount;
return nCount;
}
uno::Any SAL_CALL ScSubTotalDescriptorBase::getByIndex( sal_Int32 nIndex )
throw(lang::IndexOutOfBoundsException,
lang::WrappedTargetException, uno::RuntimeException)
{
SolarMutexGuard aGuard;
uno::Reference<sheet::XSubTotalField> xField(GetObjectByIndex_Impl((sal_uInt16)nIndex));
if (xField.is())
return uno::makeAny(xField);
else
throw lang::IndexOutOfBoundsException();
2000-09-18 16:07:07 +00:00
}
uno::Type SAL_CALL ScSubTotalDescriptorBase::getElementType() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return getCppuType((uno::Reference<sheet::XSubTotalField>*)0);
}
sal_Bool SAL_CALL ScSubTotalDescriptorBase::hasElements() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return ( getCount() != 0 );
}
// XPropertySet
uno::Reference<beans::XPropertySetInfo> SAL_CALL ScSubTotalDescriptorBase::getPropertySetInfo()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
2000-09-18 16:07:07 +00:00
return aRef;
}
void SAL_CALL ScSubTotalDescriptorBase::setPropertyValue(
const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
GetData(aParam);
String aString(aPropertyName);
2000-09-18 16:07:07 +00:00
2000-12-21 18:31:26 +00:00
// some old property names are for 5.2 compatibility
if (aString.EqualsAscii( SC_UNONAME_CASE ) || aString.EqualsAscii( SC_UNONAME_ISCASE ))
2000-09-18 16:07:07 +00:00
aParam.bCaseSens = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_FORMATS ) || aString.EqualsAscii( SC_UNONAME_BINDFMT ))
2000-09-18 16:07:07 +00:00
aParam.bIncludePattern = ScUnoHelpFunctions::GetBoolFromAny( aValue );
else if (aString.EqualsAscii( SC_UNONAME_ENABSORT ))
aParam.bDoSort = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_SORTASC ))
aParam.bAscending = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2000-09-18 16:07:07 +00:00
else if (aString.EqualsAscii( SC_UNONAME_INSBRK ))
aParam.bPagebreak = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_ULIST ) || aString.EqualsAscii( SC_UNONAME_ENUSLIST ))
2000-09-18 16:07:07 +00:00
aParam.bUserDef = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_UINDEX ) || aString.EqualsAscii( SC_UNONAME_USINDEX ))
2000-09-18 16:07:07 +00:00
{
sal_Int32 nVal = 0;
2000-09-18 16:07:07 +00:00
if ( aValue >>= nVal )
aParam.nUserIndex = (sal_uInt16)nVal;
2000-09-18 16:07:07 +00:00
}
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_MAXFLD ))
{
sal_Int32 nVal = 0;
if ( (aValue >>= nVal) && nVal > sal::static_int_cast<sal_Int32>(MAXSUBTOTAL) )
2000-12-21 18:31:26 +00:00
{
throw lang::IllegalArgumentException();
}
}
2000-09-18 16:07:07 +00:00
PutData(aParam);
}
uno::Any SAL_CALL ScSubTotalDescriptorBase::getPropertyValue( const rtl::OUString& aPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSubTotalParam aParam;
GetData(aParam);
String aString(aPropertyName);
2000-09-18 16:07:07 +00:00
uno::Any aRet;
2000-12-21 18:31:26 +00:00
// some old property names are for 5.2 compatibility
if (aString.EqualsAscii( SC_UNONAME_CASE ) || aString.EqualsAscii( SC_UNONAME_ISCASE ))
2000-09-18 16:07:07 +00:00
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bCaseSens );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_FORMATS ) || aString.EqualsAscii( SC_UNONAME_BINDFMT ))
2000-09-18 16:07:07 +00:00
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bIncludePattern );
else if (aString.EqualsAscii( SC_UNONAME_ENABSORT ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bDoSort );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_SORTASC ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bAscending );
2000-09-18 16:07:07 +00:00
else if (aString.EqualsAscii( SC_UNONAME_INSBRK ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bPagebreak );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_ULIST ) || aString.EqualsAscii( SC_UNONAME_ENUSLIST ))
2000-09-18 16:07:07 +00:00
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bUserDef );
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_UINDEX ) || aString.EqualsAscii( SC_UNONAME_USINDEX ))
2000-09-18 16:07:07 +00:00
aRet <<= (sal_Int32) aParam.nUserIndex;
2000-12-21 18:31:26 +00:00
else if (aString.EqualsAscii( SC_UNONAME_MAXFLD ))
aRet <<= (sal_Int32) MAXSUBTOTAL;
2000-09-18 16:07:07 +00:00
return aRet;
}
SC_IMPL_DUMMY_PROPERTY_LISTENER( ScSubTotalDescriptorBase )
// XUnoTunnel
sal_Int64 SAL_CALL ScSubTotalDescriptorBase::getSomething(
const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
{
if ( rId.getLength() == 16 &&
0 == memcmp( getUnoTunnelId().getConstArray(),
2000-09-18 16:07:07 +00:00
rId.getConstArray(), 16 ) )
{
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
2000-09-18 16:07:07 +00:00
}
return 0;
}
namespace
{
class theScSubTotalDescriptorBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScSubTotalDescriptorBaseUnoTunnelId> {};
}
2000-09-18 16:07:07 +00:00
const uno::Sequence<sal_Int8>& ScSubTotalDescriptorBase::getUnoTunnelId()
{
return theScSubTotalDescriptorBaseUnoTunnelId::get().getSeq();
2000-09-18 16:07:07 +00:00
}
ScSubTotalDescriptorBase* ScSubTotalDescriptorBase::getImplementation(
const uno::Reference<sheet::XSubTotalDescriptor> xObj )
{
ScSubTotalDescriptorBase* pRet = NULL;
uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
if (xUT.is())
pRet = reinterpret_cast<ScSubTotalDescriptorBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
2000-09-18 16:07:07 +00:00
return pRet;
}
//------------------------------------------------------------------------
ScSubTotalDescriptor::ScSubTotalDescriptor()
{
}
ScSubTotalDescriptor::~ScSubTotalDescriptor()
{
}
void ScSubTotalDescriptor::GetData( ScSubTotalParam& rParam ) const
{
rParam = aStoredParam; // Abfrage fuer Interface
}
void ScSubTotalDescriptor::PutData( const ScSubTotalParam& rParam )
{
aStoredParam = rParam; // vom Interface gesetzt
}
void ScSubTotalDescriptor::SetParam( const ScSubTotalParam& rNew )
{
aStoredParam = rNew; // von aussen gesetzt
}
//------------------------------------------------------------------------
ScRangeSubTotalDescriptor::ScRangeSubTotalDescriptor(ScDatabaseRangeObj* pPar) :
pParent(pPar)
{
if (pParent)
pParent->acquire();
}
ScRangeSubTotalDescriptor::~ScRangeSubTotalDescriptor()
{
if (pParent)
pParent->release();
}
void ScRangeSubTotalDescriptor::GetData( ScSubTotalParam& rParam ) const
{
if (pParent)
pParent->GetSubTotalParam( rParam );
}
void ScRangeSubTotalDescriptor::PutData( const ScSubTotalParam& rParam )
{
if (pParent)
pParent->SetSubTotalParam( rParam );
}
//------------------------------------------------------------------------
ScConsolidationDescriptor::ScConsolidationDescriptor()
{
}
ScConsolidationDescriptor::~ScConsolidationDescriptor()
{
}
void ScConsolidationDescriptor::SetParam( const ScConsolidateParam& rNew )
{
aParam = rNew;
}
// XConsolidationDescriptor
sheet::GeneralFunction SAL_CALL ScConsolidationDescriptor::getFunction() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return ScDataUnoConversion::SubTotalToGeneral(aParam.eFunction);
}
void SAL_CALL ScConsolidationDescriptor::setFunction( sheet::GeneralFunction nFunction )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
aParam.eFunction = ScDataUnoConversion::GeneralToSubTotal(nFunction);
}
uno::Sequence<table::CellRangeAddress> SAL_CALL ScConsolidationDescriptor::getSources()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
sal_uInt16 nCount = aParam.nDataAreaCount;
2000-09-18 16:07:07 +00:00
if (!aParam.ppDataAreas)
nCount = 0;
table::CellRangeAddress aRange;
uno::Sequence<table::CellRangeAddress> aSeq(nCount);
table::CellRangeAddress* pAry = aSeq.getArray();
for (sal_uInt16 i=0; i<nCount; i++)
2000-09-18 16:07:07 +00:00
{
ScArea* pArea = aParam.ppDataAreas[i];
if (pArea)
{
aRange.Sheet = pArea->nTab;
aRange.StartColumn = pArea->nColStart;
aRange.StartRow = pArea->nRowStart;
aRange.EndColumn = pArea->nColEnd;
aRange.EndRow = pArea->nRowEnd;
}
pAry[i] = aRange;
}
return aSeq;
}
void SAL_CALL ScConsolidationDescriptor::setSources(
const uno::Sequence<table::CellRangeAddress>& aSources )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
sal_uInt16 nCount = (sal_uInt16)aSources.getLength();
2000-09-18 16:07:07 +00:00
if (nCount)
{
const table::CellRangeAddress* pAry = aSources.getConstArray();
ScArea** pNew = new ScArea*[nCount];
sal_uInt16 i;
2000-09-18 16:07:07 +00:00
for (i=0; i<nCount; i++)
pNew[i] = new ScArea( pAry[i].Sheet,
static_cast<SCCOL>(pAry[i].StartColumn), pAry[i].StartRow,
static_cast<SCCOL>(pAry[i].EndColumn), pAry[i].EndRow );
2000-09-18 16:07:07 +00:00
aParam.SetAreas( pNew, nCount ); // kopiert alles
for (i=0; i<nCount; i++)
delete pNew[i];
delete[] pNew;
}
else
aParam.ClearDataAreas();
}
table::CellAddress SAL_CALL ScConsolidationDescriptor::getStartOutputPosition()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
table::CellAddress aPos;
aPos.Column = aParam.nCol;
aPos.Row = aParam.nRow;
aPos.Sheet = aParam.nTab;
return aPos;
}
void SAL_CALL ScConsolidationDescriptor::setStartOutputPosition(
const table::CellAddress& aStartOutputPosition )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
aParam.nCol = (SCCOL)aStartOutputPosition.Column;
aParam.nRow = (SCROW)aStartOutputPosition.Row;
2000-09-18 16:07:07 +00:00
aParam.nTab = aStartOutputPosition.Sheet;
}
sal_Bool SAL_CALL ScConsolidationDescriptor::getUseColumnHeaders() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return aParam.bByCol;
}
void SAL_CALL ScConsolidationDescriptor::setUseColumnHeaders( sal_Bool bUseColumnHeaders )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
aParam.bByCol = bUseColumnHeaders;
}
sal_Bool SAL_CALL ScConsolidationDescriptor::getUseRowHeaders() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return aParam.bByRow;
}
void SAL_CALL ScConsolidationDescriptor::setUseRowHeaders( sal_Bool bUseRowHeaders )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
aParam.bByRow = bUseRowHeaders;
}
sal_Bool SAL_CALL ScConsolidationDescriptor::getInsertLinks() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return aParam.bReferenceData;
}
void SAL_CALL ScConsolidationDescriptor::setInsertLinks( sal_Bool bInsertLinks )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
aParam.bReferenceData = bInsertLinks;
}
ScFilterDescriptorBase::ScFilterDescriptorBase(ScDocShell* pDocShell) :
aPropSet( lcl_GetFilterPropertyMap() ),
pDocSh(pDocShell)
2000-09-18 16:07:07 +00:00
{
if (pDocSh)
pDocSh->GetDocument()->AddUnoObject(*this);
2000-09-18 16:07:07 +00:00
}
ScFilterDescriptorBase::~ScFilterDescriptorBase()
{
if (pDocSh)
pDocSh->GetDocument()->RemoveUnoObject(*this);
}
void ScFilterDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if ( rHint.ISA( SfxSimpleHint ) )
{
sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
if ( nId == SFX_HINT_DYING )
{
pDocSh = NULL; // invalid
}
}
2000-09-18 16:07:07 +00:00
}
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
// XSheetFilterDescriptor and XSheetFilterDescriptor2
2000-09-18 16:07:07 +00:00
uno::Sequence<sheet::TableFilterField> SAL_CALL ScFilterDescriptorBase::getFilterFields()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScQueryParam aParam;
GetData(aParam);
SCSIZE nEntries = aParam.GetEntryCount(); // allozierte Eintraege im Param
SCSIZE nCount = 0; // aktive
2000-09-18 16:07:07 +00:00
while ( nCount < nEntries &&
aParam.GetEntry(nCount).bDoQuery )
++nCount;
sheet::TableFilterField aField;
uno::Sequence<sheet::TableFilterField> aSeq(static_cast<sal_Int32>(nCount));
2000-09-18 16:07:07 +00:00
sheet::TableFilterField* pAry = aSeq.getArray();
for (SCSIZE i=0; i<nCount; i++)
2000-09-18 16:07:07 +00:00
{
const ScQueryEntry& rEntry = aParam.GetEntry(i);
if (rEntry.GetQueryItems().empty())
continue;
const ScQueryEntry::Item& rItem = rEntry.GetQueryItems().front();
2000-09-18 16:07:07 +00:00
aField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND :
sheet::FilterConnection_OR;
aField.Field = rEntry.nField;
aField.IsNumeric = rItem.meType != ScQueryEntry::ByString;
aField.StringValue = rItem.maString;
aField.NumericValue = rItem.mfVal;
switch (rEntry.eOp) // ScQueryOp
{
case SC_EQUAL:
{
aField.Operator = sheet::FilterOperator_EQUAL;
if (rEntry.IsQueryByEmpty())
{
aField.Operator = sheet::FilterOperator_EMPTY;
aField.NumericValue = 0;
}
else if (rEntry.IsQueryByNonEmpty())
{
aField.Operator = sheet::FilterOperator_NOT_EMPTY;
aField.NumericValue = 0;
}
}
break;
case SC_LESS: aField.Operator = sheet::FilterOperator_LESS; break;
case SC_GREATER: aField.Operator = sheet::FilterOperator_GREATER; break;
case SC_LESS_EQUAL: aField.Operator = sheet::FilterOperator_LESS_EQUAL; break;
case SC_GREATER_EQUAL: aField.Operator = sheet::FilterOperator_GREATER_EQUAL; break;
case SC_NOT_EQUAL: aField.Operator = sheet::FilterOperator_NOT_EQUAL; break;
case SC_TOPVAL: aField.Operator = sheet::FilterOperator_TOP_VALUES; break;
case SC_BOTVAL: aField.Operator = sheet::FilterOperator_BOTTOM_VALUES; break;
case SC_TOPPERC: aField.Operator = sheet::FilterOperator_TOP_PERCENT; break;
case SC_BOTPERC: aField.Operator = sheet::FilterOperator_BOTTOM_PERCENT; break;
default:
2011-03-01 19:05:02 +01:00
OSL_FAIL("Falscher Filter-enum");
aField.Operator = sheet::FilterOperator_EMPTY;
}
pAry[i] = aField;
2000-09-18 16:07:07 +00:00
}
return aSeq;
}
namespace {
template<typename T>
void convertQueryEntryToUno(const ScQueryEntry& rEntry, T& rField)
{
rField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND : sheet::FilterConnection_OR;
rField.Field = rEntry.nField;
switch (rEntry.eOp) // ScQueryOp
{
case SC_EQUAL: rField.Operator = sheet::FilterOperator2::EQUAL; break;
case SC_LESS: rField.Operator = sheet::FilterOperator2::LESS; break;
case SC_GREATER: rField.Operator = sheet::FilterOperator2::GREATER; break;
case SC_LESS_EQUAL: rField.Operator = sheet::FilterOperator2::LESS_EQUAL; break;
case SC_GREATER_EQUAL: rField.Operator = sheet::FilterOperator2::GREATER_EQUAL; break;
case SC_NOT_EQUAL: rField.Operator = sheet::FilterOperator2::NOT_EQUAL; break;
case SC_TOPVAL: rField.Operator = sheet::FilterOperator2::TOP_VALUES; break;
case SC_BOTVAL: rField.Operator = sheet::FilterOperator2::BOTTOM_VALUES; break;
case SC_TOPPERC: rField.Operator = sheet::FilterOperator2::TOP_PERCENT; break;
case SC_BOTPERC: rField.Operator = sheet::FilterOperator2::BOTTOM_PERCENT; break;
case SC_CONTAINS: rField.Operator = sheet::FilterOperator2::CONTAINS; break;
case SC_DOES_NOT_CONTAIN: rField.Operator = sheet::FilterOperator2::DOES_NOT_CONTAIN; break;
case SC_BEGINS_WITH: rField.Operator = sheet::FilterOperator2::BEGINS_WITH; break;
case SC_DOES_NOT_BEGIN_WITH: rField.Operator = sheet::FilterOperator2::DOES_NOT_BEGIN_WITH; break;
case SC_ENDS_WITH: rField.Operator = sheet::FilterOperator2::ENDS_WITH; break;
case SC_DOES_NOT_END_WITH: rField.Operator = sheet::FilterOperator2::DOES_NOT_END_WITH; break;
default:
OSL_FAIL("Unknown filter operator value.");
rField.Operator = sheet::FilterOperator2::EMPTY;
}
}
2011-11-29 16:02:35 -05:00
template<typename T>
void convertUnoToQueryEntry(const T& rField, ScQueryEntry& rEntry)
{
rEntry.bDoQuery = true;
rEntry.eConnect = (rField.Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
rEntry.nField = rField.Field;
switch (rField.Operator) // FilterOperator
{
case sheet::FilterOperator2::EQUAL: rEntry.eOp = SC_EQUAL; break;
case sheet::FilterOperator2::LESS: rEntry.eOp = SC_LESS; break;
case sheet::FilterOperator2::GREATER: rEntry.eOp = SC_GREATER; break;
case sheet::FilterOperator2::LESS_EQUAL: rEntry.eOp = SC_LESS_EQUAL; break;
case sheet::FilterOperator2::GREATER_EQUAL: rEntry.eOp = SC_GREATER_EQUAL; break;
case sheet::FilterOperator2::NOT_EQUAL: rEntry.eOp = SC_NOT_EQUAL; break;
case sheet::FilterOperator2::TOP_VALUES: rEntry.eOp = SC_TOPVAL; break;
case sheet::FilterOperator2::BOTTOM_VALUES: rEntry.eOp = SC_BOTVAL; break;
case sheet::FilterOperator2::TOP_PERCENT: rEntry.eOp = SC_TOPPERC; break;
case sheet::FilterOperator2::BOTTOM_PERCENT: rEntry.eOp = SC_BOTPERC; break;
case sheet::FilterOperator2::CONTAINS: rEntry.eOp = SC_CONTAINS; break;
case sheet::FilterOperator2::DOES_NOT_CONTAIN: rEntry.eOp = SC_DOES_NOT_CONTAIN; break;
case sheet::FilterOperator2::BEGINS_WITH: rEntry.eOp = SC_BEGINS_WITH; break;
case sheet::FilterOperator2::DOES_NOT_BEGIN_WITH: rEntry.eOp = SC_DOES_NOT_BEGIN_WITH;break;
case sheet::FilterOperator2::ENDS_WITH: rEntry.eOp = SC_ENDS_WITH; break;
case sheet::FilterOperator2::DOES_NOT_END_WITH: rEntry.eOp = SC_DOES_NOT_END_WITH; break;
case sheet::FilterOperator2::EMPTY:
rEntry.SetQueryByEmpty();
break;
case sheet::FilterOperator2::NOT_EMPTY:
rEntry.SetQueryByNonEmpty();
break;
default:
OSL_FAIL("Unknown filter operator type.");
rEntry.eOp = SC_EQUAL;
}
}
void fillQueryParam(
ScQueryParam& rParam, ScDocument* pDoc,
const uno::Sequence<sheet::TableFilterField2>& aFilterFields)
{
size_t nCount = static_cast<size_t>(aFilterFields.getLength());
rParam.Resize(nCount);
const sheet::TableFilterField2* pAry = aFilterFields.getConstArray();
for (size_t i = 0; i < nCount; ++i)
{
ScQueryEntry& rEntry = rParam.GetEntry(i);
2011-11-29 16:02:35 -05:00
convertUnoToQueryEntry(pAry[i], rEntry);
if (pAry[i].Operator != sheet::FilterOperator2::EMPTY && pAry[i].Operator != sheet::FilterOperator2::NOT_EMPTY)
{
ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
rItems.resize(1);
ScQueryEntry::Item& rItem = rItems.front();
rItem.meType = pAry[i].IsNumeric ? ScQueryEntry::ByValue : ScQueryEntry::ByString;
rItem.mfVal = pAry[i].NumericValue;
rItem.maString = pAry[i].StringValue;
if (rItem.meType == ScQueryEntry::ByValue && pDoc)
pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, rItem.maString);
}
}
size_t nParamCount = rParam.GetEntryCount(); // Param wird nicht unter 8 resized
for (size_t i = nCount; i < nParamCount; ++i)
rParam.GetEntry(i).bDoQuery = false; // ueberzaehlige Felder zuruecksetzen
}
void fillQueryParam(
ScQueryParam& rParam, ScDocument* pDoc,
const uno::Sequence<sheet::TableFilterField3>& aFilterFields)
{
size_t nCount = static_cast<size_t>(aFilterFields.getLength());
rParam.Resize(nCount);
const sheet::TableFilterField3* pAry = aFilterFields.getConstArray();
for (size_t i = 0; i < nCount; ++i)
{
ScQueryEntry& rEntry = rParam.GetEntry(i);
2011-11-29 16:02:35 -05:00
convertUnoToQueryEntry(pAry[i], rEntry);
if (pAry[i].Operator != sheet::FilterOperator2::EMPTY && pAry[i].Operator != sheet::FilterOperator2::NOT_EMPTY)
{
ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
rItems.clear();
const uno::Sequence<sheet::FilterFieldValue>& rVals = pAry[i].Values;
for (sal_Int32 j = 0, n = rVals.getLength(); j < n; ++j)
{
ScQueryEntry::Item aItem;
aItem.meType = rVals[j].IsNumeric ? ScQueryEntry::ByValue : ScQueryEntry::ByString;
aItem.mfVal = rVals[j].NumericValue;
aItem.maString = rVals[j].StringValue;
if (aItem.meType == ScQueryEntry::ByValue && pDoc)
pDoc->GetFormatTable()->GetInputLineString(aItem.mfVal, 0, aItem.maString);
rItems.push_back(aItem);
}
}
}
size_t nParamCount = rParam.GetEntryCount(); // Param wird nicht unter 8 resized
for (size_t i = nCount; i < nParamCount; ++i)
rParam.GetEntry(i).bDoQuery = false; // ueberzaehlige Felder zuruecksetzen
}
}
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
uno::Sequence<sheet::TableFilterField2> SAL_CALL ScFilterDescriptorBase::getFilterFields2()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
ScQueryParam aParam;
GetData(aParam);
SCSIZE nEntries = aParam.GetEntryCount(); // allozierte Eintraege im Param
SCSIZE nCount = 0; // aktive
while ( nCount < nEntries &&
aParam.GetEntry(nCount).bDoQuery )
++nCount;
sheet::TableFilterField2 aField;
uno::Sequence<sheet::TableFilterField2> aSeq(static_cast<sal_Int32>(nCount));
sheet::TableFilterField2* pAry = aSeq.getArray();
for (SCSIZE i=0; i<nCount; i++)
{
const ScQueryEntry& rEntry = aParam.GetEntry(i);
convertQueryEntryToUno(rEntry, aField);
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
bool bByEmpty = false;
if (aField.Operator == sheet::FilterOperator2::EQUAL)
{
if (rEntry.IsQueryByEmpty())
{
aField.Operator = sheet::FilterOperator2::EMPTY;
aField.NumericValue = 0;
bByEmpty = true;
}
else if (rEntry.IsQueryByNonEmpty())
{
aField.Operator = sheet::FilterOperator2::NOT_EMPTY;
aField.NumericValue = 0;
bByEmpty = true;
}
}
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
if (!bByEmpty && !rEntry.GetQueryItems().empty())
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
{
const ScQueryEntry::Item& rItem = rEntry.GetQueryItems().front();
aField.IsNumeric = rItem.meType != ScQueryEntry::ByString;
aField.StringValue = rItem.maString;
aField.NumericValue = rItem.mfVal;
}
pAry[i] = aField;
}
return aSeq;
}
uno::Sequence<sheet::TableFilterField3> SAL_CALL ScFilterDescriptorBase::getFilterFields3()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
ScQueryParam aParam;
GetData(aParam);
SCSIZE nEntries = aParam.GetEntryCount(); // allozierte Eintraege im Param
SCSIZE nCount = 0; // aktive
while ( nCount < nEntries &&
aParam.GetEntry(nCount).bDoQuery )
++nCount;
sheet::TableFilterField3 aField;
uno::Sequence<sheet::TableFilterField3> aSeq(static_cast<sal_Int32>(nCount));
sheet::TableFilterField3* pAry = aSeq.getArray();
for (SCSIZE i = 0; i < nCount; ++i)
{
const ScQueryEntry& rEntry = aParam.GetEntry(i);
convertQueryEntryToUno(rEntry, aField);
bool bByEmpty = false;
if (aField.Operator == sheet::FilterOperator2::EQUAL)
{
if (rEntry.IsQueryByEmpty())
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
{
aField.Operator = sheet::FilterOperator2::EMPTY;
aField.Values.realloc(1);
aField.Values[0].NumericValue = 0;
bByEmpty = true;
}
else if (rEntry.IsQueryByNonEmpty())
{
aField.Operator = sheet::FilterOperator2::NOT_EMPTY;
aField.Values.realloc(1);
aField.Values[0].NumericValue = 0;
bByEmpty = true;
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
}
}
if (!bByEmpty)
{
const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
size_t nItemCount = rItems.size();
aField.Values.realloc(nItemCount);
ScQueryEntry::QueryItemsType::const_iterator itr = rItems.begin(), itrEnd = rItems.end();
for (size_t j = 0; itr != itrEnd; ++itr, ++j)
{
aField.Values[j].IsNumeric = itr->meType != ScQueryEntry::ByString;
aField.Values[j].StringValue = itr->maString;
aField.Values[j].NumericValue = itr->mfVal;
}
}
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
pAry[i] = aField;
}
return aSeq;
}
2000-09-18 16:07:07 +00:00
void SAL_CALL ScFilterDescriptorBase::setFilterFields(
const uno::Sequence<sheet::TableFilterField>& aFilterFields )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScQueryParam aParam;
GetData(aParam);
SCSIZE nCount = static_cast<SCSIZE>(aFilterFields.getLength());
2000-09-18 16:07:07 +00:00
aParam.Resize( nCount );
const sheet::TableFilterField* pAry = aFilterFields.getConstArray();
SCSIZE i;
2000-09-18 16:07:07 +00:00
for (i=0; i<nCount; i++)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
rItems.resize(1);
ScQueryEntry::Item& rItem = rItems.front();
rEntry.bDoQuery = true;
rEntry.eConnect = (pAry[i].Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
rEntry.nField = pAry[i].Field;
rItem.meType = pAry[i].IsNumeric ? ScQueryEntry::ByValue : ScQueryEntry::ByString;
rItem.mfVal = pAry[i].NumericValue;
rItem.maString = pAry[i].StringValue;
2000-09-18 16:07:07 +00:00
if (rItem.meType != ScQueryEntry::ByString && pDocSh)
pDocSh->GetDocument()->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, rItem.maString);
2000-09-18 16:07:07 +00:00
switch (pAry[i].Operator) // FilterOperator
{
case sheet::FilterOperator_EQUAL: rEntry.eOp = SC_EQUAL; break;
case sheet::FilterOperator_LESS: rEntry.eOp = SC_LESS; break;
case sheet::FilterOperator_GREATER: rEntry.eOp = SC_GREATER; break;
case sheet::FilterOperator_LESS_EQUAL: rEntry.eOp = SC_LESS_EQUAL; break;
case sheet::FilterOperator_GREATER_EQUAL: rEntry.eOp = SC_GREATER_EQUAL; break;
case sheet::FilterOperator_NOT_EQUAL: rEntry.eOp = SC_NOT_EQUAL; break;
case sheet::FilterOperator_TOP_VALUES: rEntry.eOp = SC_TOPVAL; break;
case sheet::FilterOperator_BOTTOM_VALUES: rEntry.eOp = SC_BOTVAL; break;
case sheet::FilterOperator_TOP_PERCENT: rEntry.eOp = SC_TOPPERC; break;
case sheet::FilterOperator_BOTTOM_PERCENT: rEntry.eOp = SC_BOTPERC; break;
2000-09-18 16:07:07 +00:00
case sheet::FilterOperator_EMPTY:
rEntry.SetQueryByEmpty();
break;
2000-09-18 16:07:07 +00:00
case sheet::FilterOperator_NOT_EMPTY:
rEntry.SetQueryByNonEmpty();
2000-09-18 16:07:07 +00:00
break;
default:
2011-03-01 19:05:02 +01:00
OSL_FAIL("Falscher Query-enum");
rEntry.eOp = SC_EQUAL;
2000-09-18 16:07:07 +00:00
}
}
SCSIZE nParamCount = aParam.GetEntryCount(); // Param wird nicht unter 8 resized
2000-09-18 16:07:07 +00:00
for (i=nCount; i<nParamCount; i++)
aParam.GetEntry(i).bDoQuery = false; // ueberzaehlige Felder zuruecksetzen
2000-09-18 16:07:07 +00:00
PutData(aParam);
}
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
void SAL_CALL ScFilterDescriptorBase::setFilterFields2(
const uno::Sequence<sheet::TableFilterField2>& aFilterFields )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
ScQueryParam aParam;
GetData(aParam);
fillQueryParam(aParam, pDocSh->GetDocument(), aFilterFields);
CWS-TOOLING: integrate CWS calc51 2009-07-17 15:47:46 +0200 er r274098 : #i101544# more thorough reference checking in chart data ranges; also prevent some possible crash if invalid ranges were to be passed to document/cell access. 2009-07-16 14:20:11 +0200 er r274051 : #i101544# let ScRefTokenHelper::compileRangeRepresentation() fail on all possible non-reference occasions 2009-07-07 10:11:40 +0200 nn r273776 : #i35579# don't use long instead of sal_Int32 2009-07-03 16:41:39 +0200 nn r273711 : msvc warnings 2009-07-03 14:18:45 +0200 nn r273698 : msvc warning 2009-07-03 11:30:41 +0200 nn r273685 : #i35579# move new tokens to the end 2009-07-03 10:12:55 +0200 nn r273681 : CWS-TOOLING: rebase CWS calc51 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 17:57:30 +0200 nn r273529 : #i103027# EnterData: if it's a formula, don't pass EditTextObject to undo 2009-06-29 14:31:18 +0200 er r273474 : #i101544# #i101645# #i102388# applied diff from CWS dr68ooo311 2009-06-29 10:30:20 +0200 nn r273457 : #i103161# DeleteCells: always leave list action 2009-06-24 16:16:34 +0200 nn r273353 : gcc warnings 2009-06-17 11:50:28 +0200 tbe r273055 : #i35579# Standard filter requires more options 2009-06-17 11:44:22 +0200 tbe r273054 : #i35579# Standard filter requires more options 2009-06-17 11:22:23 +0200 tbe r273052 : #i35579# Standard filter requires more options 2009-06-15 18:29:32 +0200 nn r273006 : #160063# UseFormulaData: check parenthesis position 2009-06-12 15:41:16 +0200 nn r272923 : #i99250# handle range lists in DoAutoOutline (patch from dtardon) 2009-06-11 15:07:05 +0200 nn r272874 : #i86943# GetNextPos: skip overlapped cells 2009-06-11 11:17:37 +0200 nn r272856 : #i97726# EnterData: get text from EditTextObject for repeat string of undo action 2009-06-10 20:45:07 +0200 nn r272839 : #i102566# minimum amount of code between updates of calculation progress (patch by cmc) 2009-06-10 20:22:02 +0200 nn r272838 : #i69524# PasteFile: specify target for SID_OPENDOC 2009-06-09 17:33:08 +0200 nn r272789 : #i16615# absolute/relative reference conversion for cell ranges (patch by gaojingmei)
2009-07-28 10:04:47 +00:00
PutData(aParam);
}
void SAL_CALL ScFilterDescriptorBase::setFilterFields3(
const uno::Sequence<sheet::TableFilterField3>& aFilterFields )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
ScQueryParam aParam;
GetData(aParam);
fillQueryParam(aParam, pDocSh->GetDocument(), aFilterFields);
PutData(aParam);
}
2000-09-18 16:07:07 +00:00
// Rest sind Properties
// XPropertySet
uno::Reference<beans::XPropertySetInfo> SAL_CALL ScFilterDescriptorBase::getPropertySetInfo()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
2000-09-18 16:07:07 +00:00
return aRef;
}
void SAL_CALL ScFilterDescriptorBase::setPropertyValue(
const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScQueryParam aParam;
GetData(aParam);
String aString(aPropertyName);
2000-09-18 16:07:07 +00:00
if (aString.EqualsAscii( SC_UNONAME_CONTHDR ))
aParam.bHasHeader = ScUnoHelpFunctions::GetBoolFromAny( aValue );
else if (aString.EqualsAscii( SC_UNONAME_COPYOUT ))
aParam.bInplace = !(ScUnoHelpFunctions::GetBoolFromAny( aValue ));
else if (aString.EqualsAscii( SC_UNONAME_ISCASE ))
aParam.bCaseSens = ScUnoHelpFunctions::GetBoolFromAny( aValue );
else if (aString.EqualsAscii( SC_UNONAME_MAXFLD ))
{
// silently ignored
2000-09-18 16:07:07 +00:00
}
else if (aString.EqualsAscii( SC_UNONAME_ORIENT ))
{
//! test for correct enum type?
table::TableOrientation eOrient = (table::TableOrientation)
ScUnoHelpFunctions::GetEnumFromAny( aValue );
aParam.bByRow = ( eOrient != table::TableOrientation_COLUMNS );
}
else if (aString.EqualsAscii( SC_UNONAME_OUTPOS ))
{
table::CellAddress aAddress;
if ( aValue >>= aAddress )
{
aParam.nDestTab = aAddress.Sheet;
aParam.nDestCol = (SCCOL)aAddress.Column;
aParam.nDestRow = (SCROW)aAddress.Row;
2000-09-18 16:07:07 +00:00
}
}
else if (aString.EqualsAscii( SC_UNONAME_SAVEOUT ))
aParam.bDestPers = ScUnoHelpFunctions::GetBoolFromAny( aValue );
else if (aString.EqualsAscii( SC_UNONAME_SKIPDUP ))
aParam.bDuplicate = !(ScUnoHelpFunctions::GetBoolFromAny( aValue ));
else if (aString.EqualsAscii( SC_UNONAME_USEREGEX ))
aParam.bRegExp = ScUnoHelpFunctions::GetBoolFromAny( aValue );
PutData(aParam);
}
uno::Any SAL_CALL ScFilterDescriptorBase::getPropertyValue( const rtl::OUString& aPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScQueryParam aParam;
GetData(aParam);
String aString(aPropertyName);
2000-09-18 16:07:07 +00:00
uno::Any aRet;
if (aString.EqualsAscii( SC_UNONAME_CONTHDR ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bHasHeader );
else if (aString.EqualsAscii( SC_UNONAME_COPYOUT ))
ScUnoHelpFunctions::SetBoolInAny( aRet, !(aParam.bInplace) );
else if (aString.EqualsAscii( SC_UNONAME_ISCASE ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bCaseSens );
else if (aString.EqualsAscii( SC_UNONAME_MAXFLD ))
aRet <<= (sal_Int32) aParam.GetEntryCount();
2000-09-18 16:07:07 +00:00
else if (aString.EqualsAscii( SC_UNONAME_ORIENT ))
{
table::TableOrientation eOrient = aParam.bByRow ? table::TableOrientation_ROWS :
table::TableOrientation_COLUMNS;
aRet <<= eOrient;
}
else if (aString.EqualsAscii( SC_UNONAME_OUTPOS ))
{
table::CellAddress aOutPos;
aOutPos.Sheet = aParam.nDestTab;
aOutPos.Column = aParam.nDestCol;
aOutPos.Row = aParam.nDestRow;
aRet <<= aOutPos;
}
else if (aString.EqualsAscii( SC_UNONAME_SAVEOUT ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bDestPers );
else if (aString.EqualsAscii( SC_UNONAME_SKIPDUP ))
ScUnoHelpFunctions::SetBoolInAny( aRet, !(aParam.bDuplicate) );
else if (aString.EqualsAscii( SC_UNONAME_USEREGEX ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bRegExp );
return aRet;
}
SC_IMPL_DUMMY_PROPERTY_LISTENER( ScFilterDescriptorBase )
//------------------------------------------------------------------------
ScFilterDescriptor::ScFilterDescriptor(ScDocShell* pDocShell)
:
ScFilterDescriptorBase(pDocShell)
2000-09-18 16:07:07 +00:00
{
}
ScFilterDescriptor::~ScFilterDescriptor()
{
}
void ScFilterDescriptor::GetData( ScQueryParam& rParam ) const
{
rParam = aStoredParam; // Abfrage fuer Interface
}
void ScFilterDescriptor::PutData( const ScQueryParam& rParam )
{
aStoredParam = rParam; // vom Interface gesetzt
}
void ScFilterDescriptor::SetParam( const ScQueryParam& rNew )
{
aStoredParam = rNew; // von aussen gesetzt
}
//------------------------------------------------------------------------
ScRangeFilterDescriptor::ScRangeFilterDescriptor(ScDocShell* pDocShell, ScDatabaseRangeObj* pPar) :
ScFilterDescriptorBase(pDocShell),
2000-09-18 16:07:07 +00:00
pParent(pPar)
{
if (pParent)
pParent->acquire();
}
ScRangeFilterDescriptor::~ScRangeFilterDescriptor()
{
if (pParent)
pParent->release();
}
void ScRangeFilterDescriptor::GetData( ScQueryParam& rParam ) const
{
if (pParent)
pParent->GetQueryParam( rParam );
}
void ScRangeFilterDescriptor::PutData( const ScQueryParam& rParam )
{
if (pParent)
pParent->SetQueryParam( rParam );
}
//------------------------------------------------------------------------
ScDataPilotFilterDescriptor::ScDataPilotFilterDescriptor(ScDocShell* pDocShell, ScDataPilotDescriptorBase* pPar) :
ScFilterDescriptorBase(pDocShell),
2000-09-18 16:07:07 +00:00
pParent(pPar)
{
if (pParent)
pParent->acquire();
}
ScDataPilotFilterDescriptor::~ScDataPilotFilterDescriptor()
{
if (pParent)
pParent->release();
}
void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const
{
if (pParent)
{
ScDPObject* pDPObj = pParent->GetDPObject();
if (pDPObj && pDPObj->IsSheetData())
rParam = pDPObj->GetSheetDesc()->GetQueryParam();
2000-09-18 16:07:07 +00:00
}
}
void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam )
{
if (pParent)
{
ScDPObject* pDPObj = pParent->GetDPObject();
if (pDPObj)
{
ScSheetSourceDesc aSheetDesc(pParent->GetDocShell()->GetDocument());
if (pDPObj->IsSheetData())
aSheetDesc = *pDPObj->GetSheetDesc();
aSheetDesc.SetQueryParam(rParam);
pDPObj->SetSheetDesc(aSheetDesc);
pParent->SetDPObject(pDPObj);
}
2000-09-18 16:07:07 +00:00
}
}
//------------------------------------------------------------------------
ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const String& rNm) :
pDocShell( pDocSh ),
aName( rNm ),
aPropSet( lcl_GetDBRangePropertyMap() ),
bIsUnnamed(false)
{
pDocShell->GetDocument()->AddUnoObject(*this);
}
ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const SCTAB nTab) :
pDocShell( pDocSh ),
aName(RTL_CONSTASCII_USTRINGPARAM(STR_DB_LOCAL_NONAME)),
aPropSet( lcl_GetDBRangePropertyMap() ),
bIsUnnamed(true),
aTab( nTab )
2000-09-18 16:07:07 +00:00
{
pDocShell->GetDocument()->AddUnoObject(*this);
}
ScDatabaseRangeObj::~ScDatabaseRangeObj()
{
if (pDocShell)
pDocShell->GetDocument()->RemoveUnoObject(*this);
}
void ScDatabaseRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
2000-09-18 16:07:07 +00:00
{
if ( rHint.ISA( SfxSimpleHint ) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
pDocShell = NULL; // ungueltig geworden
else if ( rHint.ISA (ScDBRangeRefreshedHint) )
{
ScDBData* pDBData = GetDBData_Impl();
const ScDBRangeRefreshedHint& rRef = (const ScDBRangeRefreshedHint&)rHint;
ScImportParam aParam;
pDBData->GetImportParam(aParam);
if (aParam == rRef.GetImportParam())
Refreshed_Impl();
}
2000-09-18 16:07:07 +00:00
}
// Hilfsfuntionen
ScDBData* ScDatabaseRangeObj::GetDBData_Impl() const
{
ScDBData* pRet = NULL;
if (pDocShell)
{
if (bIsUnnamed)
2000-09-18 16:07:07 +00:00
{
pRet = pDocShell->GetDocument()->GetAnonymousDBData(aTab);
}
else
{
ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
if (pNames)
{
ScDBData* p = pNames->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aName));
if (p)
pRet = p;
}
2000-09-18 16:07:07 +00:00
}
}
return pRet;
}
// XNamed
rtl::OUString SAL_CALL ScDatabaseRangeObj::getName() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return aName;
}
void SAL_CALL ScDatabaseRangeObj::setName( const rtl::OUString& aNewName )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
if (pDocShell)
{
ScDBDocFunc aFunc(*pDocShell);
String aNewStr(aNewName);
sal_Bool bOk = aFunc.RenameDBRange( aName, aNewStr );
2000-09-18 16:07:07 +00:00
if (bOk)
aName = aNewStr;
}
}
// XDatabaseRange
table::CellRangeAddress SAL_CALL ScDatabaseRangeObj::getDataArea() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
table::CellRangeAddress aAddress;
ScDBData* pData = GetDBData_Impl();
if (pData)
{
ScRange aRange;
pData->GetArea(aRange);
aAddress.Sheet = aRange.aStart.Tab();
aAddress.StartColumn = aRange.aStart.Col();
aAddress.StartRow = aRange.aStart.Row();
aAddress.EndColumn = aRange.aEnd.Col();
aAddress.EndRow = aRange.aEnd.Row();
}
return aAddress;
}
void SAL_CALL ScDatabaseRangeObj::setDataArea( const table::CellRangeAddress& aDataArea )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScDBData* pData = GetDBData_Impl();
if ( pDocShell && pData )
{
ScDBData aNewData( *pData );
//! MoveTo ???
aNewData.SetArea( aDataArea.Sheet, (SCCOL)aDataArea.StartColumn, (SCROW)aDataArea.StartRow,
(SCCOL)aDataArea.EndColumn, (SCROW)aDataArea.EndRow );
2000-09-18 16:07:07 +00:00
ScDBDocFunc aFunc(*pDocShell);
aFunc.ModifyDBData(aNewData);
2000-09-18 16:07:07 +00:00
}
}
uno::Sequence<beans::PropertyValue> SAL_CALL ScDatabaseRangeObj::getSortDescriptor()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScSortParam aParam;
const ScDBData* pData = GetDBData_Impl();
if (pData)
{
pData->GetSortParam(aParam);
// im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
ScRange aDBRange;
pData->GetArea(aDBRange);
SCCOLROW nFieldStart = aParam.bByRow ? static_cast<SCCOLROW>(aDBRange.aStart.Col()) : static_cast<SCCOLROW>(aDBRange.aStart.Row());
for (sal_uInt16 i=0; i<aParam.GetSortKeyCount(); i++)
if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nFieldStart )
aParam.maKeyState[i].nField -= nFieldStart;
2000-09-18 16:07:07 +00:00
}
uno::Sequence<beans::PropertyValue> aSeq( ScSortDescriptor::GetPropertyCount() );
ScSortDescriptor::FillProperties( aSeq, aParam );
return aSeq;
}
void ScDatabaseRangeObj::GetQueryParam(ScQueryParam& rQueryParam) const
{
const ScDBData* pData = GetDBData_Impl();
if (pData)
{
pData->GetQueryParam(rQueryParam);
// im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
ScRange aDBRange;
pData->GetArea(aDBRange);
SCCOLROW nFieldStart = rQueryParam.bByRow ? static_cast<SCCOLROW>(aDBRange.aStart.Col()) : static_cast<SCCOLROW>(aDBRange.aStart.Row());
SCSIZE nCount = rQueryParam.GetEntryCount();
for (SCSIZE i=0; i<nCount; i++)
2000-09-18 16:07:07 +00:00
{
ScQueryEntry& rEntry = rQueryParam.GetEntry(i);
if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
rEntry.nField -= nFieldStart;
}
}
}
void ScDatabaseRangeObj::SetQueryParam(const ScQueryParam& rQueryParam)
{
const ScDBData* pData = GetDBData_Impl();
if (pData)
{
// im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
ScQueryParam aParam(rQueryParam);
2000-09-18 16:07:07 +00:00
ScRange aDBRange;
pData->GetArea(aDBRange);
SCCOLROW nFieldStart = aParam.bByRow ? static_cast<SCCOLROW>(aDBRange.aStart.Col()) : static_cast<SCCOLROW>(aDBRange.aStart.Row());
2000-09-18 16:07:07 +00:00
SCSIZE nCount = aParam.GetEntryCount();
for (SCSIZE i=0; i<nCount; i++)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
if (rEntry.bDoQuery)
rEntry.nField += nFieldStart;
}
2000-09-18 16:07:07 +00:00
ScDBData aNewData( *pData );
aNewData.SetQueryParam(aParam);
aNewData.SetHeader(aParam.bHasHeader); // not in ScDBData::SetQueryParam
2000-09-18 16:07:07 +00:00
ScDBDocFunc aFunc(*pDocShell);
aFunc.ModifyDBData(aNewData);
2000-09-18 16:07:07 +00:00
}
}
uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScDatabaseRangeObj::getFilterDescriptor()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return new ScRangeFilterDescriptor(pDocShell, this);
2000-09-18 16:07:07 +00:00
}
void ScDatabaseRangeObj::GetSubTotalParam(ScSubTotalParam& rSubTotalParam) const
{
const ScDBData* pData = GetDBData_Impl();
if (pData)
{
pData->GetSubTotalParam(rSubTotalParam);
// im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
ScRange aDBRange;
pData->GetArea(aDBRange);
SCCOL nFieldStart = aDBRange.aStart.Col();
for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
2000-09-18 16:07:07 +00:00
{
if ( rSubTotalParam.bGroupActive[i] )
{
if ( rSubTotalParam.nField[i] >= nFieldStart )
rSubTotalParam.nField[i] = sal::static_int_cast<SCCOL>( rSubTotalParam.nField[i] - nFieldStart );
for (SCCOL j=0; j<rSubTotalParam.nSubTotals[i]; j++)
2000-09-18 16:07:07 +00:00
if ( rSubTotalParam.pSubTotals[i][j] >= nFieldStart )
rSubTotalParam.pSubTotals[i][j] =
sal::static_int_cast<SCCOL>( rSubTotalParam.pSubTotals[i][j] - nFieldStart );
2000-09-18 16:07:07 +00:00
}
}
}
}
void ScDatabaseRangeObj::SetSubTotalParam(const ScSubTotalParam& rSubTotalParam)
{
const ScDBData* pData = GetDBData_Impl();
if (pData)
{
// im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
ScSubTotalParam aParam(rSubTotalParam);
2000-09-18 16:07:07 +00:00
ScRange aDBRange;
pData->GetArea(aDBRange);
SCCOL nFieldStart = aDBRange.aStart.Col();
for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
2000-09-18 16:07:07 +00:00
{
if ( aParam.bGroupActive[i] )
{
aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] + nFieldStart );
for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] + nFieldStart );
2000-09-18 16:07:07 +00:00
}
}
ScDBData aNewData( *pData );
aNewData.SetSubTotalParam(aParam);
ScDBDocFunc aFunc(*pDocShell);
aFunc.ModifyDBData(aNewData);
2000-09-18 16:07:07 +00:00
}
}
uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScDatabaseRangeObj::getSubTotalDescriptor()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return new ScRangeSubTotalDescriptor(this);
}
uno::Sequence<beans::PropertyValue> SAL_CALL ScDatabaseRangeObj::getImportDescriptor()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScImportParam aParam;
const ScDBData* pData = GetDBData_Impl();
if (pData)
pData->GetImportParam(aParam);
uno::Sequence<beans::PropertyValue> aSeq( ScImportDescriptor::GetPropertyCount() );
ScImportDescriptor::FillProperties( aSeq, aParam );
return aSeq;
}
// XRefreshable
2000-09-18 16:07:07 +00:00
void SAL_CALL ScDatabaseRangeObj::refresh() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScDBData* pData = GetDBData_Impl();
if ( pDocShell && pData )
{
ScDBDocFunc aFunc(*pDocShell);
// Import zu wiederholen?
sal_Bool bContinue = sal_True;
2000-09-18 16:07:07 +00:00
ScImportParam aImportParam;
pData->GetImportParam( aImportParam );
if (aImportParam.bImport && !pData->HasImportSelection())
{
SCTAB nTab;
SCCOL nDummyCol;
SCROW nDummyRow;
pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow );
bContinue = aFunc.DoImport( nTab, aImportParam, NULL, true ); //! Api-Flag as parameter
2000-09-18 16:07:07 +00:00
}
// interne Operationen (sort, query, subtotal) nur, wenn kein Fehler
if (bContinue)
aFunc.RepeatDB( pData->GetName(), true, true, bIsUnnamed, aTab );
2000-09-18 16:07:07 +00:00
}
}
void SAL_CALL ScDatabaseRangeObj::addRefreshListener(
const uno::Reference<util::XRefreshListener >& xListener )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
uno::Reference<util::XRefreshListener>* pObj =
new uno::Reference<util::XRefreshListener>( xListener );
aRefreshListeners.push_back( pObj );
// hold one additional ref to keep this object alive as long as there are listeners
if ( aRefreshListeners.size() == 1 )
acquire();
}
void SAL_CALL ScDatabaseRangeObj::removeRefreshListener(
const uno::Reference<util::XRefreshListener >& xListener )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
sal_uInt16 nCount = aRefreshListeners.size();
for ( sal_uInt16 n=nCount; n--; )
{
uno::Reference<util::XRefreshListener>& rObj = aRefreshListeners[n];
if ( rObj == xListener )
{
aRefreshListeners.erase( aRefreshListeners.begin() + n );
if ( aRefreshListeners.empty() )
release(); // release ref for listeners
break;
}
}
}
void ScDatabaseRangeObj::Refreshed_Impl()
{
lang::EventObject aEvent;
aEvent.Source = (cppu::OWeakObject*)this;
for ( sal_uInt16 n=0; n<aRefreshListeners.size(); n++ )
aRefreshListeners[n]->refreshed( aEvent );
}
2000-09-18 16:07:07 +00:00
// XCellRangeSource
uno::Reference<table::XCellRange> SAL_CALL ScDatabaseRangeObj::getReferredCells()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScRange aRange;
ScDBData* pData = GetDBData_Impl();
if ( pData )
{
//! static Funktion um ScCellObj/ScCellRangeObj zu erzeugen am ScCellRangeObj ???
pData->GetArea(aRange);
if ( aRange.aStart == aRange.aEnd )
return new ScCellObj( pDocShell, aRange.aStart );
else
return new ScCellRangeObj( pDocShell, aRange );
}
return NULL;
}
// XPropertySet
uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDatabaseRangeObj::getPropertySetInfo()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
2000-09-18 16:07:07 +00:00
return aRef;
}
void SAL_CALL ScDatabaseRangeObj::setPropertyValue(
const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
ScDBData* pData = GetDBData_Impl();
if ( pDocShell && pData )
{
ScDBData aNewData( *pData );
sal_Bool bDo = sal_True;
2000-09-18 16:07:07 +00:00
String aString(aPropertyName);
2000-09-18 16:07:07 +00:00
if ( aString.EqualsAscii( SC_UNONAME_KEEPFORM ) )
aNewData.SetKeepFmt( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if ( aString.EqualsAscii( SC_UNONAME_MOVCELLS ) )
aNewData.SetDoSize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if ( aString.EqualsAscii( SC_UNONAME_STRIPDAT ) )
aNewData.SetStripData( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if (aString.EqualsAscii( SC_UNONAME_AUTOFLT ))
{
sal_Bool bAutoFilter(ScUnoHelpFunctions::GetBoolFromAny( aValue ));
aNewData.SetAutoFilter(bAutoFilter);
ScRange aRange;
aNewData.GetArea(aRange);
ScDocument* pDoc = pDocShell->GetDocument();
if (bAutoFilter && pDoc)
pDoc->ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(), SC_MF_AUTO );
else if (!bAutoFilter && pDoc)
pDoc->RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(), SC_MF_AUTO );
ScRange aPaintRange(aRange.aStart, aRange.aEnd);
aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
pDocShell->PostPaint(aPaintRange, PAINT_GRID);
}
else if (aString.EqualsAscii( SC_UNONAME_USEFLTCRT ))
{
if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
{
ScRange aRange;
aNewData.GetAdvancedQuerySource(aRange);
aNewData.SetAdvancedQuerySource(&aRange);
}
else
aNewData.SetAdvancedQuerySource(NULL);
}
else if (aString.EqualsAscii( SC_UNONAME_FLTCRT ))
{
table::CellRangeAddress aRange;
if (aValue >>= aRange)
{
ScRange aCoreRange;
ScUnoConversion::FillScRange(aCoreRange, aRange);
aNewData.SetAdvancedQuerySource(&aCoreRange);
}
}
else if (aString.EqualsAscii( SC_UNONAME_FROMSELECT ))
{
aNewData.SetImportSelection(::cppu::any2bool(aValue));
}
else if (aString.EqualsAscii( SC_UNONAME_REFPERIOD ))
{
sal_Int32 nRefresh = 0;
if (aValue >>= nRefresh)
{
ScDocument* pDoc = pDocShell->GetDocument();
aNewData.SetRefreshDelay(nRefresh);
if (pDoc && pDoc->GetDBCollection())
{
aNewData.SetRefreshHandler( pDoc->GetDBCollection()->GetRefreshHandler() );
aNewData.SetRefreshControl( pDoc->GetRefreshTimerControlAddress() );
}
}
}
else if (aString.EqualsAscii( SC_UNONAME_CONRES ))
{
}
2000-09-18 16:07:07 +00:00
else
bDo = false;
2000-09-18 16:07:07 +00:00
if (bDo)
{
ScDBDocFunc aFunc(*pDocShell);
aFunc.ModifyDBData(aNewData);
2000-09-18 16:07:07 +00:00
}
}
}
uno::Any SAL_CALL ScDatabaseRangeObj::getPropertyValue( const rtl::OUString& aPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
uno::Any aRet;
ScDBData* pData = GetDBData_Impl();
if ( pData )
{
String aString(aPropertyName);
2000-09-18 16:07:07 +00:00
if ( aString.EqualsAscii( SC_UNONAME_KEEPFORM ) )
ScUnoHelpFunctions::SetBoolInAny( aRet, pData->IsKeepFmt() );
else if ( aString.EqualsAscii( SC_UNONAME_MOVCELLS ) )
ScUnoHelpFunctions::SetBoolInAny( aRet, pData->IsDoSize() );
else if ( aString.EqualsAscii( SC_UNONAME_STRIPDAT ) )
ScUnoHelpFunctions::SetBoolInAny( aRet, pData->IsStripData() );
2001-02-21 10:33:30 +00:00
else if ( aString.EqualsAscii( SC_UNONAME_ISUSER ) )
{
// all database ranges except "unnamed" are user defined
ScUnoHelpFunctions::SetBoolInAny(
aRet, !pData->GetName().equalsAscii(STR_DB_LOCAL_NONAME));
2001-02-21 10:33:30 +00:00
}
2000-09-18 16:07:07 +00:00
else if ( aString.EqualsAscii( SC_UNO_LINKDISPBIT ) )
{
// no target bitmaps for individual entries (would be all equal)
// ScLinkTargetTypeObj::SetLinkTargetBitmap( aRet, SC_LINKTARGETTYPE_DBAREA );
}
else if ( aString.EqualsAscii( SC_UNO_LINKDISPNAME ) )
aRet <<= rtl::OUString( aName );
else if (aString.EqualsAscii( SC_UNONAME_AUTOFLT ))
{
sal_Bool bAutoFilter(GetDBData_Impl()->HasAutoFilter());
ScUnoHelpFunctions::SetBoolInAny( aRet, bAutoFilter );
}
else if (aString.EqualsAscii( SC_UNONAME_USEFLTCRT ))
{
ScRange aRange;
sal_Bool bIsAdvancedSource(GetDBData_Impl()->GetAdvancedQuerySource(aRange));
ScUnoHelpFunctions::SetBoolInAny( aRet, bIsAdvancedSource );
}
else if (aString.EqualsAscii( SC_UNONAME_FLTCRT ))
{
table::CellRangeAddress aRange;
ScRange aCoreRange;
if (GetDBData_Impl()->GetAdvancedQuerySource(aCoreRange))
ScUnoConversion::FillApiRange(aRange, aCoreRange);
aRet <<= aRange;
}
else if (aString.EqualsAscii( SC_UNONAME_FROMSELECT ))
{
ScUnoHelpFunctions::SetBoolInAny( aRet, GetDBData_Impl()->HasImportSelection() );
}
else if (aString.EqualsAscii( SC_UNONAME_REFPERIOD ))
{
sal_Int32 nRefresh(GetDBData_Impl()->GetRefreshDelay());
aRet <<= nRefresh;
}
else if (aString.EqualsAscii( SC_UNONAME_CONRES ))
{
}
else if (aString.EqualsAscii( SC_UNONAME_TOKENINDEX ))
{
// get index for use in formula tokens (read-only)
aRet <<= static_cast<sal_Int32>(GetDBData_Impl()->GetIndex());
}
2000-09-18 16:07:07 +00:00
}
return aRet;
}
SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDatabaseRangeObj )
// XServiceInfo
rtl::OUString SAL_CALL ScDatabaseRangeObj::getImplementationName() throw(uno::RuntimeException)
{
return rtl::OUString( "ScDatabaseRangeObj" );
2000-09-18 16:07:07 +00:00
}
sal_Bool SAL_CALL ScDatabaseRangeObj::supportsService( const rtl::OUString& rServiceName )
throw(uno::RuntimeException)
{
String aServiceStr( rServiceName );
return aServiceStr.EqualsAscii( SCDATABASERANGEOBJ_SERVICE ) ||
aServiceStr.EqualsAscii( SCLINKTARGET_SERVICE );
}
uno::Sequence<rtl::OUString> SAL_CALL ScDatabaseRangeObj::getSupportedServiceNames()
throw(uno::RuntimeException)
{
uno::Sequence<rtl::OUString> aRet(2);
rtl::OUString* pArray = aRet.getArray();
pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCDATABASERANGEOBJ_SERVICE ));
pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCLINKTARGET_SERVICE ));
2000-09-18 16:07:07 +00:00
return aRet;
}
//------------------------------------------------------------------------
ScDatabaseRangesObj::ScDatabaseRangesObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
pDocShell->GetDocument()->AddUnoObject(*this);
}
ScDatabaseRangesObj::~ScDatabaseRangesObj()
{
if (pDocShell)
pDocShell->GetDocument()->RemoveUnoObject(*this);
}
void ScDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
2000-09-18 16:07:07 +00:00
{
// Referenz-Update interessiert hier nicht
if ( rHint.ISA( SfxSimpleHint ) &&
((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
{
pDocShell = NULL; // ungueltig geworden
}
}
// XDatabaseRanges
ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByIndex_Impl(size_t nIndex)
2000-09-18 16:07:07 +00:00
{
if (!pDocShell)
return NULL;
ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
if (!pNames)
return NULL;
const ScDBCollection::NamedDBs& rDBs = pNames->getNamedDBs();
if (rDBs.empty() || nIndex >= rDBs.size())
return NULL;
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin();
::std::advance(itr, nIndex); // boundary check is done above.
return new ScDatabaseRangeObj(pDocShell, itr->GetName());
2000-09-18 16:07:07 +00:00
}
ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByName_Impl(const rtl::OUString& aName)
{
if ( pDocShell && hasByName(aName) )
{
String aString(aName);
2000-09-18 16:07:07 +00:00
return new ScDatabaseRangeObj( pDocShell, aString );
}
return NULL;
}
void SAL_CALL ScDatabaseRangesObj::addNewByName( const rtl::OUString& aName,
const table::CellRangeAddress& aRange )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
sal_Bool bDone = false;
2000-09-18 16:07:07 +00:00
if (pDocShell)
{
ScDBDocFunc aFunc(*pDocShell);
String aString(aName);
ScRange aNameRange( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet,
(SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet );
bDone = aFunc.AddDBRange( aString, aNameRange, sal_True );
2000-09-18 16:07:07 +00:00
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
2000-09-18 16:07:07 +00:00
}
void SAL_CALL ScDatabaseRangesObj::removeByName( const rtl::OUString& aName )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
sal_Bool bDone = false;
2000-09-18 16:07:07 +00:00
if (pDocShell)
{
ScDBDocFunc aFunc(*pDocShell);
String aString(aName);
bDone = aFunc.DeleteDBRange( aString );
2000-09-18 16:07:07 +00:00
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
2000-09-18 16:07:07 +00:00
}
// XEnumerationAccess
uno::Reference<container::XEnumeration> SAL_CALL ScDatabaseRangesObj::createEnumeration()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return new ScIndexEnumeration(this, rtl::OUString("com.sun.star.sheet.DatabaseRangesEnumeration"));
2000-09-18 16:07:07 +00:00
}
// XIndexAccess
sal_Int32 SAL_CALL ScDatabaseRangesObj::getCount() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
//! "unbenannt" weglassen ?
if (pDocShell)
{
ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
2000-09-18 16:07:07 +00:00
if (pNames)
return static_cast<sal_Int32>(pNames->getNamedDBs().size());
2000-09-18 16:07:07 +00:00
}
return 0;
2000-09-18 16:07:07 +00:00
}
uno::Any SAL_CALL ScDatabaseRangesObj::getByIndex( sal_Int32 nIndex )
throw(lang::IndexOutOfBoundsException,
lang::WrappedTargetException, uno::RuntimeException)
{
SolarMutexGuard aGuard;
if (nIndex < 0)
throw lang::IndexOutOfBoundsException();
uno::Reference<sheet::XDatabaseRange> xRange(GetObjectByIndex_Impl(static_cast<size_t>(nIndex)));
if (xRange.is())
return uno::makeAny(xRange);
else
throw lang::IndexOutOfBoundsException();
2000-09-18 16:07:07 +00:00
}
uno::Type SAL_CALL ScDatabaseRangesObj::getElementType() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return getCppuType((uno::Reference<sheet::XDatabaseRange>*)0);
}
sal_Bool SAL_CALL ScDatabaseRangesObj::hasElements() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
return ( getCount() != 0 );
}
// XNameAccess
uno::Any SAL_CALL ScDatabaseRangesObj::getByName( const rtl::OUString& aName )
throw(container::NoSuchElementException,
lang::WrappedTargetException, uno::RuntimeException)
{
SolarMutexGuard aGuard;
uno::Reference<sheet::XDatabaseRange> xRange(GetObjectByName_Impl(aName));
if (xRange.is())
return uno::makeAny(xRange);
else
throw container::NoSuchElementException();
// return uno::Any();
2000-09-18 16:07:07 +00:00
}
uno::Sequence<rtl::OUString> SAL_CALL ScDatabaseRangesObj::getElementNames()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
//! "unbenannt" weglassen ?
if (pDocShell)
{
ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
2000-09-18 16:07:07 +00:00
if (pNames)
{
const ScDBCollection::NamedDBs& rDBs = pNames->getNamedDBs();
uno::Sequence<rtl::OUString> aSeq(rDBs.size());
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (size_t i = 0; itr != itrEnd; ++itr, ++i)
aSeq[i] = itr->GetName();
2000-09-18 16:07:07 +00:00
return aSeq;
}
}
return uno::Sequence<rtl::OUString>(0);
}
sal_Bool SAL_CALL ScDatabaseRangesObj::hasByName( const rtl::OUString& aName )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
2000-09-18 16:07:07 +00:00
//! "unbenannt" weglassen ?
if (pDocShell)
{
ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
2000-09-18 16:07:07 +00:00
if (pNames)
return pNames->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aName)) != NULL;
2000-09-18 16:07:07 +00:00
}
return false;
2000-09-18 16:07:07 +00:00
}
//------------------------------------------------------------------------
ScUnnamedDatabaseRangesObj::ScUnnamedDatabaseRangesObj(ScDocShell* pDocSh) :
pDocShell( pDocSh )
{
pDocShell->GetDocument()->AddUnoObject(*this);
}
ScUnnamedDatabaseRangesObj::~ScUnnamedDatabaseRangesObj()
{
if (pDocShell)
pDocShell->GetDocument()->RemoveUnoObject(*this);
}
void ScUnnamedDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
// Referenz-Update interessiert hier nicht
if ( rHint.ISA( SfxSimpleHint ) &&
((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
{
pDocShell = NULL; // ungueltig geworden
}
}
// XUnnamedDatabaseRanges
void ScUnnamedDatabaseRangesObj::setByTable( const table::CellRangeAddress& aRange )
throw( uno::RuntimeException,
lang::IndexOutOfBoundsException )
{
SolarMutexGuard aGuard;
bool bDone = false;
if (pDocShell)
{
if ( pDocShell->GetDocument()->GetTableCount() <= aRange.Sheet )
throw lang::IndexOutOfBoundsException();
2000-09-18 16:07:07 +00:00
ScDBDocFunc aFunc(*pDocShell);
String aString(RTL_CONSTASCII_USTRINGPARAM(STR_DB_LOCAL_NONAME));
ScRange aUnnamedRange( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet,
(SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet );
bDone = aFunc.AddDBRange( aString, aUnnamedRange, sal_True );
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
}
2000-09-18 16:07:07 +00:00
uno::Any ScUnnamedDatabaseRangesObj::getByTable( sal_Int32 nTab )
throw(uno::RuntimeException,
lang::IndexOutOfBoundsException,
container::NoSuchElementException)
{
SolarMutexGuard aGuard;
if (pDocShell)
{
if ( pDocShell->GetDocument()->GetTableCount() <= nTab )
throw lang::IndexOutOfBoundsException();
uno::Reference<sheet::XDatabaseRange> xRange(
new ScDatabaseRangeObj(pDocShell, static_cast<SCTAB>(nTab)));
if (xRange.is())
return uno::makeAny(xRange);
else
throw container::NoSuchElementException();
}
else
throw uno::RuntimeException();
}
sal_Bool ScUnnamedDatabaseRangesObj::hasByTable( sal_Int32 nTab )
throw (uno::RuntimeException,
lang::IndexOutOfBoundsException)
{
SolarMutexGuard aGuard;
if (pDocShell)
{
if (pDocShell->GetDocument()->GetTableCount() <= nTab)
throw lang::IndexOutOfBoundsException();
if (pDocShell->GetDocument()->GetAnonymousDBData((SCTAB) nTab))
return true;
return false;
}
else
return false;
}
//------------------------------------------------------------------------
2000-09-18 16:07:07 +00:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */