Files
libreoffice/sc/source/ui/dbgui/validate.cxx

663 lines
24 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* $RCSfile: validate.cxx,v $
* $Revision: 1.18 $
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
#ifdef SC_DLLIMPLEMENTATION
#undef SC_DLLIMPLEMENTATION
#endif
#include <vcl/svapp.hxx>
2000-09-18 16:07:07 +00:00
#include <svtools/aeitem.hxx>
#include <svtools/stritem.hxx>
#include <svtools/eitem.hxx>
#include <svtools/intitem.hxx>
2000-09-18 16:07:07 +00:00
#include <basic/sbmeth.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbmod.hxx>
#include <sfx2/app.hxx>
2000-09-18 16:07:07 +00:00
#include "scresid.hxx"
#include "sc.hrc" // -> Slot IDs
#include "validat.hxx"
#include "validate.hrc"
#include "validate.hxx"
#include "compiler.hxx"
CWS-TOOLING: integrate CWS frmdlg 2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05 2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative' parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and ODFF if omitted, for backwards compatibility. 2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37) 2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula 2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula 2008-12-12 13:22:00 +0100 msc r265413 : #i97089# 2008-12-12 13:20:25 +0100 msc r265412 : #i97089# 2008-12-12 12:35:12 +0100 msc r265406 : #i97089# 2008-12-12 12:34:16 +0100 msc r265405 : #i97089# 2008-12-12 12:33:05 +0100 msc r265404 : #i97089# 2008-12-12 12:31:11 +0100 msc r265403 : #i97089# 2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG 2008-12-08 11:50:17 +0100 oj r264980 : some small changes 2008-12-05 12:57:57 +0100 oj r264902 : eof changed 2008-12-05 12:56:46 +0100 oj r264901 : eof changed 2008-12-05 12:28:47 +0100 oj r264899 : wrong var used 2008-12-05 10:08:57 +0100 oj r264890 : token order reversed 2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage 2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id 2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button 2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button 2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends 2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends 2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends 2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set 2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category 2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids 2008-12-01 14:36:43 +0100 oj r264604 : use temp var 2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula 2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula 2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc 2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select 2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void 2008-11-28 11:16:48 +0100 oj r264532 : add help ids 2008-11-28 10:16:56 +0100 oj r264529 : set help id 2008-11-28 10:16:43 +0100 oj r264528 : set help id 2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes 2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug 2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them 2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code 2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code 2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline 2008-11-21 12:35:27 +0100 oj r264124 : hold symbols 2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost 2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove 2008-11-19 20:37:41 +0100 oj r264021 : removed unused var 2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token 2008-11-19 10:59:47 +0100 oj r263967 : deleted 2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files 2008-11-18 15:27:36 +0100 oj r263777 : unused para removed 2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg 2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting 2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef 2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling 2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file 2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula 2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction 2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35 2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35 2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35 2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35 2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35 2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35 2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35 2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35 2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35 2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35 2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved 2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target 2008-10-07 10:08:39 +0200 oj r262077 : copy 2008-10-07 09:45:31 +0200 oj r262076 : #i94535# 2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class 2008-10-07 09:43:21 +0200 oj r262074 : moved to formula 2008-10-07 09:41:51 +0200 oj r262073 : new images 2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula 2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula 2008-10-02 08:08:54 +0200 oj r262023 : #i94535# 2008-10-02 08:06:28 +0200 oj r262022 : #i94535# 2008-10-02 08:05:52 +0200 oj r262021 : #i94535# 2008-10-01 17:15:29 +0200 oj r262014 : #i94535# 2008-10-01 17:12:40 +0200 oj r262013 : new module formula 2008-10-01 17:04:55 +0200 oj r262012 : #i94535# 2008-10-01 16:49:03 +0200 oj r262010 : #i94535# 2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
#include "formula/opcode.hxx" //CHINA001
2000-09-18 16:07:07 +00:00
// ============================================================================
2000-09-18 16:07:07 +00:00
static USHORT pValueRanges[] =
{
FID_VALID_MODE, FID_VALID_ERRTEXT,
FID_VALID_LISTTYPE, FID_VALID_LISTTYPE,
2000-09-18 16:07:07 +00:00
0
};
// ============================================================================
ScValidationDlg::ScValidationDlg( Window* pParent, const SfxItemSet* pArgSet ) :
SfxTabDialog( pParent, ScResId( TAB_DLG_VALIDATION ), pArgSet )
2000-09-18 16:07:07 +00:00
{
AddTabPage( TP_VALIDATION_VALUES, ScTPValidationValue::Create, 0 );
2000-09-18 16:07:07 +00:00
AddTabPage( TP_VALIDATION_INPUTHELP, ScTPValidationHelp::Create, 0 );
AddTabPage( TP_VALIDATION_ERROR, ScTPValidationError::Create, 0 );
2000-09-18 16:07:07 +00:00
FreeResource();
}
ScValidationDlg::~ScValidationDlg()
2000-09-18 16:07:07 +00:00
{
}
// ============================================================================
2000-09-18 16:07:07 +00:00
namespace {
/** Converts the passed ScValidationMode to the position in the list box. */
USHORT lclGetPosFromValMode( ScValidationMode eValMode )
2000-09-18 16:07:07 +00:00
{
USHORT nLbPos = SC_VALIDDLG_ALLOW_ANY;
switch( eValMode )
{
case SC_VALID_ANY: nLbPos = SC_VALIDDLG_ALLOW_ANY; break;
case SC_VALID_WHOLE: nLbPos = SC_VALIDDLG_ALLOW_WHOLE; break;
case SC_VALID_DECIMAL: nLbPos = SC_VALIDDLG_ALLOW_DECIMAL; break;
case SC_VALID_DATE: nLbPos = SC_VALIDDLG_ALLOW_DATE; break;
case SC_VALID_TIME: nLbPos = SC_VALIDDLG_ALLOW_TIME; break;
case SC_VALID_TEXTLEN: nLbPos = SC_VALIDDLG_ALLOW_TEXTLEN; break;
case SC_VALID_LIST: nLbPos = SC_VALIDDLG_ALLOW_RANGE; break;
case SC_VALID_CUSTOM: nLbPos = SC_VALIDDLG_ALLOW_ANY; break; // not supported
default: DBG_ERRORFILE( "lclGetPosFromValMode - unknown validity mode" );
}
return nLbPos;
2000-09-18 16:07:07 +00:00
}
/** Converts the passed list box position to an ScValidationMode. */
ScValidationMode lclGetValModeFromPos( USHORT nLbPos )
{
ScValidationMode eValMode = SC_VALID_ANY;
switch( nLbPos )
{
case SC_VALIDDLG_ALLOW_ANY: eValMode = SC_VALID_ANY; break;
case SC_VALIDDLG_ALLOW_WHOLE: eValMode = SC_VALID_WHOLE; break;
case SC_VALIDDLG_ALLOW_DECIMAL: eValMode = SC_VALID_DECIMAL; break;
case SC_VALIDDLG_ALLOW_DATE: eValMode = SC_VALID_DATE; break;
case SC_VALIDDLG_ALLOW_TIME: eValMode = SC_VALID_TIME; break;
case SC_VALIDDLG_ALLOW_RANGE: eValMode = SC_VALID_LIST; break;
case SC_VALIDDLG_ALLOW_LIST: eValMode = SC_VALID_LIST; break;
case SC_VALIDDLG_ALLOW_TEXTLEN: eValMode = SC_VALID_TEXTLEN; break;
default: DBG_ERRORFILE( "lclGetValModeFromPos - invalid list box position" );
}
return eValMode;
}
2000-09-18 16:07:07 +00:00
/** Converts the passed ScConditionMode to the position in the list box. */
USHORT lclGetPosFromCondMode( ScConditionMode eCondMode )
2000-09-18 16:07:07 +00:00
{
USHORT nLbPos = SC_VALIDDLG_DATA_EQUAL;
switch( eCondMode )
{
case SC_COND_NONE: // #111771# may occur in old XML files after Excel import
case SC_COND_EQUAL: nLbPos = SC_VALIDDLG_DATA_EQUAL; break;
case SC_COND_LESS: nLbPos = SC_VALIDDLG_DATA_LESS; break;
case SC_COND_GREATER: nLbPos = SC_VALIDDLG_DATA_GREATER; break;
case SC_COND_EQLESS: nLbPos = SC_VALIDDLG_DATA_EQLESS; break;
case SC_COND_EQGREATER: nLbPos = SC_VALIDDLG_DATA_EQGREATER; break;
case SC_COND_NOTEQUAL: nLbPos = SC_VALIDDLG_DATA_NOTEQUAL; break;
case SC_COND_BETWEEN: nLbPos = SC_VALIDDLG_DATA_BETWEEN; break;
case SC_COND_NOTBETWEEN: nLbPos = SC_VALIDDLG_DATA_NOTBETWEEN; break;
default: DBG_ERRORFILE( "lclGetPosFromCondMode - unknown condition mode" );
}
return nLbPos;
2000-09-18 16:07:07 +00:00
}
/** Converts the passed list box position to an ScConditionMode. */
ScConditionMode lclGetCondModeFromPos( USHORT nLbPos )
{
ScConditionMode eCondMode = SC_COND_EQUAL;
switch( nLbPos )
{
case SC_VALIDDLG_DATA_EQUAL: eCondMode = SC_COND_EQUAL; break;
case SC_VALIDDLG_DATA_LESS: eCondMode = SC_COND_LESS; break;
case SC_VALIDDLG_DATA_GREATER: eCondMode = SC_COND_GREATER; break;
case SC_VALIDDLG_DATA_EQLESS: eCondMode = SC_COND_EQLESS; break;
case SC_VALIDDLG_DATA_EQGREATER: eCondMode = SC_COND_EQGREATER; break;
case SC_VALIDDLG_DATA_NOTEQUAL: eCondMode = SC_COND_NOTEQUAL; break;
case SC_VALIDDLG_DATA_BETWEEN: eCondMode = SC_COND_BETWEEN; break;
case SC_VALIDDLG_DATA_NOTBETWEEN: eCondMode = SC_COND_NOTBETWEEN; break;
default: DBG_ERRORFILE( "lclGetCondModeFromPos - invalid list box position" );
}
return eCondMode;
}
2000-09-18 16:07:07 +00:00
/** Converts line feed separated string to a formula with strings separated by semicolons.
@descr Keeps all empty strings.
Example: abc\ndef\n\nghi -> "abc";"def";"";"ghi".
@param rFmlaStr (out-param) The converted formula string. */
void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, sal_Unicode cFmlaSep )
{
rFmlaStr.Erase();
xub_StrLen nTokenCnt = rStringList.GetTokenCount( '\n' );
for( xub_StrLen nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken )
{
String aToken( rStringList.GetToken( 0, '\n', nStringIx ) );
CWS-TOOLING: integrate CWS mooxlsc 2008-12-12 09:32:19 +0100 dr r265390 : #i10000# warning 2008-12-11 14:54:26 +0100 dr r265301 : add strings from dr66 to meet ui freeze 2008-12-11 14:53:20 +0100 dr r265300 : add strings from dr66 to meet ui freeze 2008-12-08 14:43:25 +0100 er r264997 : DBG_... need semicolon 2008-12-04 19:16:50 +0100 er r264872 : DBG_... needs semicolon 2008-12-04 11:09:27 +0100 er r264824 : DBG_ERROR needs semicolon 2008-12-03 13:29:46 +0100 er r264770 : CWS-TOOLING: rebase CWS mooxlsc to trunk@264325 (milestone: DEV300:m36) 2008-12-02 16:49:09 +0100 er r264722 : disable code for named references #i4385# import as long as #i3740# isn't fully implemented 2008-12-02 16:45:04 +0100 er r264721 : some compilers attempt to be too smart; persuade them it's really meant what was written 2008-12-02 16:04:56 +0100 er r264715 : #i3740# no storage in ODF for external name references 2008-11-29 02:20:50 +0100 er r264575 : some huge performance improvement when reading repeated empty rows for the external references cache from ODF, as they often occur in the sparse matrix 2008-11-29 01:14:55 +0100 er r264574 : WriteExternalRefCaches: for table:number-columns-repeated write used columns instead of MAXCOLCOUNT 2008-11-28 18:30:04 +0100 er r264570 : #i3740# write/read external name references as bracketed references, as proposed on the ODFF list 2008-11-27 20:36:54 +0100 er r264521 : merge i95068 from cws calc46 for code correctness 2008-11-21 20:39:34 +0100 kohei r264174 : fixed a crash when importing a BIFF8 document with per-sheet external names. For now, we don't support per-sheet external names. Let's throw in NoName error until they are supported. 2008-11-21 18:47:27 +0100 kohei r264168 : I forgot to process cached range references in the EXTERNNAME record, which prevented cached external names with range references from being imported correctly. P.S. I swear I thought I had covered this.... 2008-11-20 23:07:22 +0100 er r264104 : #i4385# parse external defined names in MOOXML import 2008-11-14 23:18:54 +0100 er r263700 : #i92797# parse external sheet references under aspects of MOOXML import and new ScExternalRefManager 2008-11-14 18:49:48 +0100 er r263696 : remove infinity assertion, leftover from binary file format; coded double error may occur via filter import 2008-11-12 13:29:44 +0100 er r263593 : make references to entire rows/columns, such as A:A or 3:3, actually work in MOOXML import 2008-11-03 12:35:11 +0100 er r263282 : a struct is a struct is a ... 2008-10-31 00:30:59 +0100 er r262843 : aTableRowCellAttrTokenMap needed 2008-10-31 00:26:07 +0100 er r262842 : GetTableRowCellAttrTokenMap() is not unused 2008-10-31 00:13:53 +0100 er r262841 : merge error 2008-10-31 00:05:39 +0100 er r262840 : merge error 2008-10-30 23:17:48 +0100 er r262839 : unresolved merge conflict!?! 2008-10-30 22:59:11 +0100 er r262838 : merge error 2008-10-30 16:31:04 +0100 hr r262833 : CWS-TOOLING: rebase CWS mooxlsc to trunk@262620 (milestone: DEV300:m34) 2008-10-16 21:57:51 +0200 er r262272 : migrate CWS mooxlsc to SVN
2008-12-12 09:38:47 +00:00
ScGlobal::AddQuotes( aToken, '"' );
ScGlobal::AddToken( rFmlaStr, aToken, cFmlaSep );
}
if( !rFmlaStr.Len() )
rFmlaStr.AssignAscii( "\"\"" );
}
/** Converts formula with strings separated by semicolons to line feed separated string.
@descr Keeps all empty strings. Ignores all empty tokens (multiple semicolons).
Example: "abc";;;"def";"";"ghi" -> abc\ndef\n\nghi.
@param rStringList (out-param) The converted line feed separated string list.
@return true = Conversion successful. */
bool lclGetStringListFromFormula( String& rStringList, const String& rFmlaStr, sal_Unicode cFmlaSep )
2000-09-18 16:07:07 +00:00
{
String aQuotes( RTL_CONSTASCII_USTRINGPARAM( "\"\"" ) );
xub_StrLen nTokenCnt = rFmlaStr.GetQuotedTokenCount( aQuotes, cFmlaSep );
2000-09-18 16:07:07 +00:00
rStringList.Erase();
bool bIsStringList = (nTokenCnt > 0);
bool bTokenAdded = false;
2000-09-18 16:07:07 +00:00
for( xub_StrLen nToken = 0, nStringIx = 0; bIsStringList && (nToken < nTokenCnt); ++nToken )
{
String aToken( rFmlaStr.GetQuotedToken( 0, aQuotes, cFmlaSep, nStringIx ) );
aToken.EraseLeadingAndTrailingChars();
if( aToken.Len() ) // ignore empty tokens, i.e. "a";;"b"
{
CWS-TOOLING: integrate CWS mooxlsc 2008-12-12 09:32:19 +0100 dr r265390 : #i10000# warning 2008-12-11 14:54:26 +0100 dr r265301 : add strings from dr66 to meet ui freeze 2008-12-11 14:53:20 +0100 dr r265300 : add strings from dr66 to meet ui freeze 2008-12-08 14:43:25 +0100 er r264997 : DBG_... need semicolon 2008-12-04 19:16:50 +0100 er r264872 : DBG_... needs semicolon 2008-12-04 11:09:27 +0100 er r264824 : DBG_ERROR needs semicolon 2008-12-03 13:29:46 +0100 er r264770 : CWS-TOOLING: rebase CWS mooxlsc to trunk@264325 (milestone: DEV300:m36) 2008-12-02 16:49:09 +0100 er r264722 : disable code for named references #i4385# import as long as #i3740# isn't fully implemented 2008-12-02 16:45:04 +0100 er r264721 : some compilers attempt to be too smart; persuade them it's really meant what was written 2008-12-02 16:04:56 +0100 er r264715 : #i3740# no storage in ODF for external name references 2008-11-29 02:20:50 +0100 er r264575 : some huge performance improvement when reading repeated empty rows for the external references cache from ODF, as they often occur in the sparse matrix 2008-11-29 01:14:55 +0100 er r264574 : WriteExternalRefCaches: for table:number-columns-repeated write used columns instead of MAXCOLCOUNT 2008-11-28 18:30:04 +0100 er r264570 : #i3740# write/read external name references as bracketed references, as proposed on the ODFF list 2008-11-27 20:36:54 +0100 er r264521 : merge i95068 from cws calc46 for code correctness 2008-11-21 20:39:34 +0100 kohei r264174 : fixed a crash when importing a BIFF8 document with per-sheet external names. For now, we don't support per-sheet external names. Let's throw in NoName error until they are supported. 2008-11-21 18:47:27 +0100 kohei r264168 : I forgot to process cached range references in the EXTERNNAME record, which prevented cached external names with range references from being imported correctly. P.S. I swear I thought I had covered this.... 2008-11-20 23:07:22 +0100 er r264104 : #i4385# parse external defined names in MOOXML import 2008-11-14 23:18:54 +0100 er r263700 : #i92797# parse external sheet references under aspects of MOOXML import and new ScExternalRefManager 2008-11-14 18:49:48 +0100 er r263696 : remove infinity assertion, leftover from binary file format; coded double error may occur via filter import 2008-11-12 13:29:44 +0100 er r263593 : make references to entire rows/columns, such as A:A or 3:3, actually work in MOOXML import 2008-11-03 12:35:11 +0100 er r263282 : a struct is a struct is a ... 2008-10-31 00:30:59 +0100 er r262843 : aTableRowCellAttrTokenMap needed 2008-10-31 00:26:07 +0100 er r262842 : GetTableRowCellAttrTokenMap() is not unused 2008-10-31 00:13:53 +0100 er r262841 : merge error 2008-10-31 00:05:39 +0100 er r262840 : merge error 2008-10-30 23:17:48 +0100 er r262839 : unresolved merge conflict!?! 2008-10-30 22:59:11 +0100 er r262838 : merge error 2008-10-30 16:31:04 +0100 hr r262833 : CWS-TOOLING: rebase CWS mooxlsc to trunk@262620 (milestone: DEV300:m34) 2008-10-16 21:57:51 +0200 er r262272 : migrate CWS mooxlsc to SVN
2008-12-12 09:38:47 +00:00
bIsStringList = ScGlobal::IsQuoted( aToken, '"' );
if( bIsStringList )
{
CWS-TOOLING: integrate CWS mooxlsc 2008-12-12 09:32:19 +0100 dr r265390 : #i10000# warning 2008-12-11 14:54:26 +0100 dr r265301 : add strings from dr66 to meet ui freeze 2008-12-11 14:53:20 +0100 dr r265300 : add strings from dr66 to meet ui freeze 2008-12-08 14:43:25 +0100 er r264997 : DBG_... need semicolon 2008-12-04 19:16:50 +0100 er r264872 : DBG_... needs semicolon 2008-12-04 11:09:27 +0100 er r264824 : DBG_ERROR needs semicolon 2008-12-03 13:29:46 +0100 er r264770 : CWS-TOOLING: rebase CWS mooxlsc to trunk@264325 (milestone: DEV300:m36) 2008-12-02 16:49:09 +0100 er r264722 : disable code for named references #i4385# import as long as #i3740# isn't fully implemented 2008-12-02 16:45:04 +0100 er r264721 : some compilers attempt to be too smart; persuade them it's really meant what was written 2008-12-02 16:04:56 +0100 er r264715 : #i3740# no storage in ODF for external name references 2008-11-29 02:20:50 +0100 er r264575 : some huge performance improvement when reading repeated empty rows for the external references cache from ODF, as they often occur in the sparse matrix 2008-11-29 01:14:55 +0100 er r264574 : WriteExternalRefCaches: for table:number-columns-repeated write used columns instead of MAXCOLCOUNT 2008-11-28 18:30:04 +0100 er r264570 : #i3740# write/read external name references as bracketed references, as proposed on the ODFF list 2008-11-27 20:36:54 +0100 er r264521 : merge i95068 from cws calc46 for code correctness 2008-11-21 20:39:34 +0100 kohei r264174 : fixed a crash when importing a BIFF8 document with per-sheet external names. For now, we don't support per-sheet external names. Let's throw in NoName error until they are supported. 2008-11-21 18:47:27 +0100 kohei r264168 : I forgot to process cached range references in the EXTERNNAME record, which prevented cached external names with range references from being imported correctly. P.S. I swear I thought I had covered this.... 2008-11-20 23:07:22 +0100 er r264104 : #i4385# parse external defined names in MOOXML import 2008-11-14 23:18:54 +0100 er r263700 : #i92797# parse external sheet references under aspects of MOOXML import and new ScExternalRefManager 2008-11-14 18:49:48 +0100 er r263696 : remove infinity assertion, leftover from binary file format; coded double error may occur via filter import 2008-11-12 13:29:44 +0100 er r263593 : make references to entire rows/columns, such as A:A or 3:3, actually work in MOOXML import 2008-11-03 12:35:11 +0100 er r263282 : a struct is a struct is a ... 2008-10-31 00:30:59 +0100 er r262843 : aTableRowCellAttrTokenMap needed 2008-10-31 00:26:07 +0100 er r262842 : GetTableRowCellAttrTokenMap() is not unused 2008-10-31 00:13:53 +0100 er r262841 : merge error 2008-10-31 00:05:39 +0100 er r262840 : merge error 2008-10-30 23:17:48 +0100 er r262839 : unresolved merge conflict!?! 2008-10-30 22:59:11 +0100 er r262838 : merge error 2008-10-30 16:31:04 +0100 hr r262833 : CWS-TOOLING: rebase CWS mooxlsc to trunk@262620 (milestone: DEV300:m34) 2008-10-16 21:57:51 +0200 er r262272 : migrate CWS mooxlsc to SVN
2008-12-12 09:38:47 +00:00
ScGlobal::EraseQuotes( aToken, '"' );
ScGlobal::AddToken( rStringList, aToken, '\n', 1, bTokenAdded );
bTokenAdded = true;
}
}
}
return bIsStringList;
2000-09-18 16:07:07 +00:00
}
} // namespace
// ----------------------------------------------------------------------------
ScTPValidationValue::ScTPValidationValue( Window* pParent, const SfxItemSet& rArgSet ) :
SfxTabPage( pParent, ScResId( TP_VALIDATION_VALUES ), rArgSet ),
maFtAllow ( this, ScResId( FT_ALLOW ) ),
maLbAllow ( this, ScResId( LB_ALLOW ) ),
maCbAllow ( this, ScResId( TSB_ALLOW_BLANKS ) ),
maCbShow ( this, ScResId( CB_SHOWLIST ) ),
maCbSort ( this, ScResId( CB_SORTLIST ) ),
maFtValue ( this, ScResId( FT_VALUE ) ),
maLbValue ( this, ScResId( LB_VALUE ) ),
maFtMin ( this, ScResId( FT_MIN ) ),
maEdMin ( this, ScResId( EDT_MIN ) ),
maEdList ( this, ScResId( EDT_LIST ) ),
maFtMax ( this, ScResId( FT_MAX ) ),
maEdMax ( this, ScResId( EDT_MAX ) ),
maFtHint ( this, ScResId( FT_SOURCEHINT ) ),
maStrMin ( ScResId( SCSTR_VALID_MINIMUM ) ),
maStrMax ( ScResId( SCSTR_VALID_MAXIMUM ) ),
maStrValue( ScResId( SCSTR_VALID_VALUE ) ),
maStrRange( ScResId( SCSTR_VALID_RANGE ) ),
maStrList ( ScResId( SCSTR_VALID_LIST ) )
{
Init();
FreeResource();
2000-09-18 16:07:07 +00:00
// list separator in formulas
//CHINA001 const String& rListSep = ScCompiler::pSymbolTableNative[ ocSep ];
String aListSep = ::GetScCompilerNativeSymbol( ocSep ); //CHINA001
DBG_ASSERT( aListSep.Len() == 1, "ScTPValidationValue::ScTPValidationValue - list separator error" );
mcFmlaSep = aListSep.Len() ? aListSep.GetChar( 0 ) : ';';
}
ScTPValidationValue::~ScTPValidationValue()
2000-09-18 16:07:07 +00:00
{
}
void ScTPValidationValue::Init()
{
maLbAllow.SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) );
maLbValue.SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) );
maCbShow.SetClickHdl( LINK( this, ScTPValidationValue, CheckHdl ) );
2000-09-18 16:07:07 +00:00
maLbAllow.SelectEntryPos( SC_VALIDDLG_ALLOW_ANY );
maLbValue.SelectEntryPos( SC_VALIDDLG_DATA_EQUAL );
SelectHdl( NULL );
CheckHdl( NULL );
}
SfxTabPage* ScTPValidationValue::Create( Window* pParent, const SfxItemSet& rArgSet )
2000-09-18 16:07:07 +00:00
{
return( new ScTPValidationValue( pParent, rArgSet ) );
2000-09-18 16:07:07 +00:00
}
USHORT* ScTPValidationValue::GetRanges()
{
return pValueRanges;
}
2000-09-18 16:07:07 +00:00
void ScTPValidationValue::Reset( const SfxItemSet& rArgSet )
2000-09-18 16:07:07 +00:00
{
const SfxPoolItem* pItem;
USHORT nLbPos = SC_VALIDDLG_ALLOW_ANY;
if( rArgSet.GetItemState( FID_VALID_MODE, TRUE, &pItem ) == SFX_ITEM_SET )
nLbPos = lclGetPosFromValMode( static_cast< ScValidationMode >(
static_cast< const SfxAllEnumItem* >( pItem )->GetValue() ) );
maLbAllow.SelectEntryPos( nLbPos );
nLbPos = SC_VALIDDLG_DATA_EQUAL;
if( rArgSet.GetItemState( FID_VALID_CONDMODE, TRUE, &pItem ) == SFX_ITEM_SET )
nLbPos = lclGetPosFromCondMode( static_cast< ScConditionMode >(
static_cast< const SfxAllEnumItem* >( pItem )->GetValue() ) );
maLbValue.SelectEntryPos( nLbPos );
// *** check boxes ***
BOOL bCheck = TRUE;
if( rArgSet.GetItemState( FID_VALID_BLANK, TRUE, &pItem ) == SFX_ITEM_SET )
bCheck = static_cast< const SfxBoolItem* >( pItem )->GetValue();
maCbAllow.Check( bCheck );
sal_Int32 nListType = ValidListType::UNSORTED;
if( rArgSet.GetItemState( FID_VALID_LISTTYPE, TRUE, &pItem ) == SFX_ITEM_SET )
nListType = static_cast< const SfxInt16Item* >( pItem )->GetValue();
maCbShow.Check( nListType != ValidListType::INVISIBLE );
maCbSort.Check( nListType == ValidListType::SORTEDASCENDING );
// *** formulas ***
String aFmlaStr;
2000-09-18 16:07:07 +00:00
if ( rArgSet.GetItemState( FID_VALID_VALUE1, TRUE, &pItem ) == SFX_ITEM_SET )
aFmlaStr = static_cast< const SfxStringItem* >( pItem )->GetValue();
SetFirstFormula( aFmlaStr );
2001-01-17 18:28:42 +00:00
aFmlaStr.Erase();
2000-09-18 16:07:07 +00:00
if ( rArgSet.GetItemState( FID_VALID_VALUE2, TRUE, &pItem ) == SFX_ITEM_SET )
aFmlaStr = static_cast< const SfxStringItem* >( pItem )->GetValue();
SetSecondFormula( aFmlaStr );
2001-01-17 18:28:42 +00:00
SelectHdl( NULL );
CheckHdl( NULL );
2000-09-18 16:07:07 +00:00
}
BOOL ScTPValidationValue::FillItemSet( SfxItemSet& rArgSet )
2000-09-18 16:07:07 +00:00
{
sal_Int16 nListType = maCbShow.IsChecked() ?
(maCbSort.IsChecked() ? ValidListType::SORTEDASCENDING : ValidListType::UNSORTED) :
ValidListType::INVISIBLE;
rArgSet.Put( SfxAllEnumItem( FID_VALID_MODE, sal::static_int_cast<USHORT>(
lclGetValModeFromPos( maLbAllow.GetSelectEntryPos() ) ) ) );
rArgSet.Put( SfxAllEnumItem( FID_VALID_CONDMODE, sal::static_int_cast<USHORT>(
lclGetCondModeFromPos( maLbValue.GetSelectEntryPos() ) ) ) );
rArgSet.Put( SfxStringItem( FID_VALID_VALUE1, GetFirstFormula() ) );
rArgSet.Put( SfxStringItem( FID_VALID_VALUE2, GetSecondFormula() ) );
rArgSet.Put( SfxBoolItem( FID_VALID_BLANK, maCbAllow.IsChecked() ) );
rArgSet.Put( SfxInt16Item( FID_VALID_LISTTYPE, nListType ) );
2000-09-18 16:07:07 +00:00
return TRUE;
}
String ScTPValidationValue::GetFirstFormula() const
{
String aFmlaStr;
if( maLbAllow.GetSelectEntryPos() == SC_VALIDDLG_ALLOW_LIST )
lclGetFormulaFromStringList( aFmlaStr, maEdList.GetText(), mcFmlaSep );
else
aFmlaStr = maEdMin.GetText();
return aFmlaStr;
}
2000-09-18 16:07:07 +00:00
String ScTPValidationValue::GetSecondFormula() const
2000-09-18 16:07:07 +00:00
{
return maEdMax.GetText();
}
2000-09-18 16:07:07 +00:00
void ScTPValidationValue::SetFirstFormula( const String& rFmlaStr )
{
// try if formula is a string list, validation mode must already be set
String aStringList;
if( (maLbAllow.GetSelectEntryPos() == SC_VALIDDLG_ALLOW_RANGE) &&
lclGetStringListFromFormula( aStringList, rFmlaStr, mcFmlaSep ) )
{
maEdList.SetText( aStringList );
maEdMin.SetText( EMPTY_STRING );
// change validation mode to string list
maLbAllow.SelectEntryPos( SC_VALIDDLG_ALLOW_LIST );
}
else
{
maEdMin.SetText( rFmlaStr );
maEdList.SetText( EMPTY_STRING );
}
}
2000-09-18 16:07:07 +00:00
void ScTPValidationValue::SetSecondFormula( const String& rFmlaStr )
{
maEdMax.SetText( rFmlaStr );
2000-09-18 16:07:07 +00:00
}
// ----------------------------------------------------------------------------
2000-09-18 16:07:07 +00:00
IMPL_LINK( ScTPValidationValue, SelectHdl, ListBox*, EMPTYARG )
{
USHORT nLbPos = maLbAllow.GetSelectEntryPos();
bool bEnable = (nLbPos != SC_VALIDDLG_ALLOW_ANY);
bool bRange = (nLbPos == SC_VALIDDLG_ALLOW_RANGE);
bool bList = (nLbPos == SC_VALIDDLG_ALLOW_LIST);
maCbAllow.Enable( bEnable ); // Leerzellen
maFtValue.Enable( bEnable );
maLbValue.Enable( bEnable );
maFtMin.Enable( bEnable );
maEdMin.Enable( bEnable );
maEdList.Enable( bEnable );
maFtMax.Enable( bEnable );
maEdMax.Enable( bEnable );
bool bShowMax = false;
if( bRange )
maFtMin.SetText( maStrRange );
else if( bList )
maFtMin.SetText( maStrList );
else
2000-09-18 16:07:07 +00:00
{
switch( maLbValue.GetSelectEntryPos() )
{
case SC_VALIDDLG_DATA_EQUAL:
case SC_VALIDDLG_DATA_NOTEQUAL: maFtMin.SetText( maStrValue ); break;
case SC_VALIDDLG_DATA_LESS:
case SC_VALIDDLG_DATA_EQLESS: maFtMin.SetText( maStrMax ); break;
case SC_VALIDDLG_DATA_BETWEEN:
case SC_VALIDDLG_DATA_NOTBETWEEN: bShowMax = true; // fall through
case SC_VALIDDLG_DATA_GREATER:
case SC_VALIDDLG_DATA_EQGREATER: maFtMin.SetText( maStrMin ); break;
default:
DBG_ERRORFILE( "ScTPValidationValue::SelectHdl - unknown condition mode" );
}
2000-09-18 16:07:07 +00:00
}
maCbShow.Show( bRange || bList );
maCbSort.Show( bRange || bList );
maFtValue.Show( !bRange && !bList );
maLbValue.Show( !bRange && !bList );
maEdMin.Show( !bList );
maEdList.Show( bList );
maFtMax.Show( bShowMax );
maEdMax.Show( bShowMax );
maFtHint.Show( bRange );
return 0;
}
2000-09-18 16:07:07 +00:00
IMPL_LINK( ScTPValidationValue, CheckHdl, CheckBox*, EMPTYARG )
{
maCbSort.Enable( maCbShow.IsChecked() );
return 0;
2000-09-18 16:07:07 +00:00
}
2000-09-18 16:07:07 +00:00
//========================================================================
//========================================================================
2001-01-17 18:28:42 +00:00
// Input Help Page
2000-09-18 16:07:07 +00:00
ScTPValidationHelp::ScTPValidationHelp( Window* pParent,
const SfxItemSet& rArgSet )
: SfxTabPage ( pParent,
ScResId( TP_VALIDATION_INPUTHELP ),
rArgSet ),
aTsbHelp ( this, ScResId( TSB_HELP ) ),
aFlContent ( this, ScResId( FL_CONTENT ) ),
2000-09-18 16:07:07 +00:00
aFtTitle ( this, ScResId( FT_TITLE ) ),
aEdtTitle ( this, ScResId( EDT_TITLE ) ),
aFtInputHelp ( this, ScResId( FT_INPUTHELP ) ),
aEdInputHelp ( this, ScResId( EDT_INPUTHELP ) ),
mrArgSet ( rArgSet )
2000-09-18 16:07:07 +00:00
{
Init();
FreeResource();
}
// -----------------------------------------------------------------------
__EXPORT ScTPValidationHelp::~ScTPValidationHelp()
{
}
// -----------------------------------------------------------------------
void ScTPValidationHelp::Init()
{
//aLb.SetSelectHdl( LINK( this, ScTPValidationHelp, SelectHdl ) );
aTsbHelp.EnableTriState( FALSE );
}
//------------------------------------------------------------------------
USHORT* __EXPORT ScTPValidationHelp::GetRanges()
{
return pValueRanges;
}
// -----------------------------------------------------------------------
SfxTabPage* __EXPORT ScTPValidationHelp::Create( Window* pParent,
const SfxItemSet& rArgSet )
{
return ( new ScTPValidationHelp( pParent, rArgSet ) );
}
// -----------------------------------------------------------------------
void __EXPORT ScTPValidationHelp::Reset( const SfxItemSet& rArgSet )
{
const SfxPoolItem* pItem;
if ( rArgSet.GetItemState( FID_VALID_SHOWHELP, TRUE, &pItem ) == SFX_ITEM_SET )
aTsbHelp.SetState( ((const SfxBoolItem*)pItem)->GetValue() ? STATE_CHECK : STATE_NOCHECK );
2001-01-17 18:28:42 +00:00
else
aTsbHelp.SetState( STATE_NOCHECK );
2000-09-18 16:07:07 +00:00
if ( rArgSet.GetItemState( FID_VALID_HELPTITLE, TRUE, &pItem ) == SFX_ITEM_SET )
aEdtTitle.SetText( ((const SfxStringItem*)pItem)->GetValue() );
2001-01-17 18:28:42 +00:00
else
aEdtTitle.SetText( EMPTY_STRING );
2000-09-18 16:07:07 +00:00
if ( rArgSet.GetItemState( FID_VALID_HELPTEXT, TRUE, &pItem ) == SFX_ITEM_SET )
aEdInputHelp.SetText( ((const SfxStringItem*)pItem)->GetValue() );
2001-01-17 18:28:42 +00:00
else
aEdInputHelp.SetText( EMPTY_STRING );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
BOOL __EXPORT ScTPValidationHelp::FillItemSet( SfxItemSet& rArgSet )
{
rArgSet.Put( SfxBoolItem( FID_VALID_SHOWHELP, aTsbHelp.GetState() == STATE_CHECK ) );
rArgSet.Put( SfxStringItem( FID_VALID_HELPTITLE, aEdtTitle.GetText() ) );
rArgSet.Put( SfxStringItem( FID_VALID_HELPTEXT, aEdInputHelp.GetText() ) );
return TRUE;
}
//========================================================================
//========================================================================
2001-01-17 18:28:42 +00:00
// Error Alert Page
2000-09-18 16:07:07 +00:00
ScTPValidationError::ScTPValidationError( Window* pParent,
const SfxItemSet& rArgSet )
: SfxTabPage ( pParent,
ScResId( TP_VALIDATION_ERROR ),
rArgSet ),
aTsbShow ( this, ScResId( TSB_SHOW ) ),
aFlContent ( this, ScResId( FL_CONTENT ) ),
2000-09-18 16:07:07 +00:00
aFtAction ( this, ScResId( FT_ACTION ) ),
aLbAction ( this, ScResId( LB_ACTION ) ),
aBtnSearch ( this, ScResId( BTN_SEARCH ) ),
aFtTitle ( this, ScResId( FT_TITLE ) ),
aEdtTitle ( this, ScResId( EDT_TITLE ) ),
aFtError ( this, ScResId( FT_ERROR ) ),
aEdError ( this, ScResId( EDT_ERROR ) ),
mrArgSet ( rArgSet )
2000-09-18 16:07:07 +00:00
{
Init();
FreeResource();
}
// -----------------------------------------------------------------------
__EXPORT ScTPValidationError::~ScTPValidationError()
{
}
// -----------------------------------------------------------------------
void ScTPValidationError::Init()
{
aLbAction.SetSelectHdl( LINK( this, ScTPValidationError, SelectActionHdl ) );
aBtnSearch.SetClickHdl( LINK( this, ScTPValidationError, ClickSearchHdl ) );
aLbAction.SelectEntryPos( 0 );
aTsbShow.EnableTriState( FALSE );
SelectActionHdl( NULL );
}
//------------------------------------------------------------------------
USHORT* __EXPORT ScTPValidationError::GetRanges()
{
return pValueRanges;
}
// -----------------------------------------------------------------------
SfxTabPage* __EXPORT ScTPValidationError::Create( Window* pParent,
const SfxItemSet& rArgSet )
{
return ( new ScTPValidationError( pParent, rArgSet ) );
}
// -----------------------------------------------------------------------
void __EXPORT ScTPValidationError::Reset( const SfxItemSet& rArgSet )
{
const SfxPoolItem* pItem;
if ( rArgSet.GetItemState( FID_VALID_SHOWERR, TRUE, &pItem ) == SFX_ITEM_SET )
aTsbShow.SetState( ((const SfxBoolItem*)pItem)->GetValue() ? STATE_CHECK : STATE_NOCHECK );
2001-01-17 18:28:42 +00:00
else
aTsbShow.SetState( STATE_CHECK ); // #111720# check by default
2001-01-17 18:28:42 +00:00
2000-09-18 16:07:07 +00:00
if ( rArgSet.GetItemState( FID_VALID_ERRSTYLE, TRUE, &pItem ) == SFX_ITEM_SET )
aLbAction.SelectEntryPos( ((const SfxAllEnumItem*)pItem)->GetValue() );
2001-01-17 18:28:42 +00:00
else
aLbAction.SelectEntryPos( 0 );
2000-09-18 16:07:07 +00:00
if ( rArgSet.GetItemState( FID_VALID_ERRTITLE, TRUE, &pItem ) == SFX_ITEM_SET )
aEdtTitle.SetText( ((const SfxStringItem*)pItem)->GetValue() );
2001-01-17 18:28:42 +00:00
else
aEdtTitle.SetText( EMPTY_STRING );
2000-09-18 16:07:07 +00:00
if ( rArgSet.GetItemState( FID_VALID_ERRTEXT, TRUE, &pItem ) == SFX_ITEM_SET )
aEdError.SetText( ((const SfxStringItem*)pItem)->GetValue() );
2001-01-17 18:28:42 +00:00
else
aEdError.SetText( EMPTY_STRING );
2000-09-18 16:07:07 +00:00
SelectActionHdl( NULL );
}
// -----------------------------------------------------------------------
BOOL __EXPORT ScTPValidationError::FillItemSet( SfxItemSet& rArgSet )
{
rArgSet.Put( SfxBoolItem( FID_VALID_SHOWERR, aTsbShow.GetState() == STATE_CHECK ) );
rArgSet.Put( SfxAllEnumItem( FID_VALID_ERRSTYLE, aLbAction.GetSelectEntryPos() ) );
rArgSet.Put( SfxStringItem( FID_VALID_ERRTITLE, aEdtTitle.GetText() ) );
rArgSet.Put( SfxStringItem( FID_VALID_ERRTEXT, aEdError.GetText() ) );
return TRUE;
}
// -----------------------------------------------------------------------
IMPL_LINK( ScTPValidationError, SelectActionHdl, ListBox*, EMPTYARG )
2000-09-18 16:07:07 +00:00
{
ScValidErrorStyle eStyle = (ScValidErrorStyle) aLbAction.GetSelectEntryPos();
BOOL bMacro = ( eStyle == SC_VALERR_MACRO );
aBtnSearch.Enable( bMacro );
aFtError.Enable( !bMacro );
aEdError.Enable( !bMacro );
return( 0L );
}
// -----------------------------------------------------------------------
IMPL_LINK( ScTPValidationError, ClickSearchHdl, PushButton*, EMPTYARG )
2000-09-18 16:07:07 +00:00
{
Window* pOld = Application::GetDefDialogParent();
Application::SetDefDialogParent( this );
// Use static SfxApplication method to bring up selector dialog for
// choosing a script
::rtl::OUString aScriptURL = SfxApplication::ChooseScript();
2001-08-03 14:28:32 +00:00
Application::SetDefDialogParent( pOld );
if ( aScriptURL != NULL && aScriptURL.getLength() != 0 )
2000-09-18 16:07:07 +00:00
{
aEdtTitle.SetText( aScriptURL );
2000-09-18 16:07:07 +00:00
}
return( 0L );
}