xref: /aoo4110/main/sc/inc/global.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_SCGLOB_HXX
25 #define SC_SCGLOB_HXX
26 
27 #include "address.hxx"
28 #include <i18npool/lang.h>
29 #include <tools/stream.hxx>
30 #include <osl/endian.h>
31 #include <com/sun/star/uno/Reference.hxx>
32 #include "scdllapi.h"
33 
34 #include <hash_map>
35 
36 class ImageList;
37 class Bitmap;
38 class SfxItemSet;
39 class Color;
40 
41 // Macro fuer den Call-Profiler unter WinNT
42 // mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden
43 #if defined( WNT ) && defined( PROFILE )
44 
45 extern "C" {
46 	void StartCAP();
47 	void StopCAP();
48 	void DumpCAP();
49 };
50 
51 #define S_CAP	StartCAP();
52 #define E_CAP	StopCAP(); DumpCAP();
53 
54 #endif
55 
56 #if 0
57 // I18N doesn't get this right, can't specify more than one to ignore
58 #define SC_COLLATOR_IGNORES ( \
59 	::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \
60 	::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \
61 	::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH )
62 #else
63 #define SC_COLLATOR_IGNORES ( \
64 	::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
65 #endif
66 #if 0
67 // #107998# Don't ignore Width and Kana. The issue was mainly with AutoInput,
68 // but affects also comparison of names in general.
69 #define SC_TRANSLITERATION_IGNORECASE ( \
70     ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE | \
71     ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \
72     ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH )
73 #define SC_TRANSLITERATION_CASESENSE ( \
74     ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \
75     ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH )
76 #else
77 #define SC_TRANSLITERATION_IGNORECASE ( \
78     ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE )
79 #define SC_TRANSLITERATION_CASESENSE 0
80 #endif
81 
82 //------------------------------------------------------------------------
83 
84 //	die 1000 Namen des Calc...
85 //	Clipboard-Namen sind jetzt in so3/soapp.hxx
86 //	STRING_SCAPP war "scalc3", "scalc4", jetzt nur noch "scalc"
87 
88 #define STRING_SCAPP	"scalc"
89 #define	STRING_SCSTREAM	"StarCalcDocument"
90 
91 #define	STRING_STANDARD	"Standard"
92 
93 // characters -----------------------------------------------------------------
94 
95 //	'\r' geht auf'm Mac nicht...
96 #define CHAR_CR		char(13)
97 
98 const sal_Unicode CHAR_NBSP     = 0x00A0;
99 const sal_Unicode CHAR_SHY      = 0x00AD;
100 const sal_Unicode CHAR_ZWSP     = 0x200B;
101 const sal_Unicode CHAR_LRM      = 0x200E;
102 const sal_Unicode CHAR_RLM      = 0x200F;
103 const sal_Unicode CHAR_NBHY     = 0x2011;
104 const sal_Unicode CHAR_ZWNBSP   = 0x2060;
105 
106 // ----------------------------------------------------------------------------
107 
108 #define	MINDOUBLE	1.7e-307
109 #define	MAXDOUBLE	1.7e307
110 
111 #define MINZOOM 	20
112 #define MAXZOOM 	400
113 
114 #ifdef SC_ROWLIMIT_TYPECONVERSION_NOCONVPASS
115 const size_t MAXSUBTOTAL        = 3;
116 const size_t MAXQUERY           = 8;
117 #else
118 const SCSIZE MAXSUBTOTAL        = 3;
119 const SCSIZE MAXQUERY           = 8;
120 #endif
121 
122 #define SC_START_INDEX_DB_COLL 50000
123 										// Oberhalb dieser Grenze liegen
124 										// die Indizes fuer DBBereiche
125 
126 /*
127 #ifdef OS2
128 #define PIXEL_PER_INCH      72.0
129 #else
130 #define PIXEL_PER_INCH      96.0
131 #endif
132 */
133 
134 #define PIXEL_PER_INCH      96.0
135 
136 #define CM_PER_INCH         2.54
137 #define POINTS_PER_INCH		72.27
138 #define PIXEL_PER_POINT		(PIXEL_PER_INCH / POINTS_PER_INCH)
139 #define INCHT_PER_CM		(1.0 / CM_PER_INCH)
140 #define POINTS_PER_CM		(POINTS_PER_INCH / CM_PER_INCH)
141 #define TWIPS_PER_POINT		20.0
142 #define TWIPS_PER_INCH		(TWIPS_PER_POINT * POINTS_PER_INCH)
143 #define TWIPS_PER_CM		(TWIPS_PER_INCH / CM_PER_INCH)
144 #define CM_PER_TWIPS		(CM_PER_INCH / TWIPS_PER_INCH)
145 #define TWIPS_PER_PIXEL		(TWIPS_PER_INCH / PIXEL_PER_INCH)
146 #define TWIPS_PER_CHAR		(TWIPS_PER_INCH / 13.6)
147 #define PIXEL_PER_TWIPS		(PIXEL_PER_INCH / TWIPS_PER_INCH)
148 #define HMM_PER_TWIPS		(CM_PER_TWIPS * 1000.0)
149 
150 #define STD_COL_WIDTH		1285
151 #define STD_EXTRA_WIDTH		113		// 2mm Extra fuer optimale Breite
152 									// Standard Zeilenhoehe: Text + Rand - STD_ROWHEIGHT_DIFF
153 
154 
155 #define MAX_EXTRA_WIDTH  	23811	// 42cm in TWIPS
156 #define MAX_EXTRA_HEIGHT	23811
157 #define MAX_COL_WIDTH		56693	// 1m in TWIPS
158 #define MAX_COL_HEIGHT		56693
159 
160 #define STD_ROWHEIGHT_DIFF	23
161 #define STD_FONT_HEIGHT		200 	// entspricht 10 Punkt
162 
163 //!		statt STD_ROW_HEIGHT ScGlobal::nStdRowHeight benutzen !
164 
165 #define STD_ROW_HEIGHT		(12.8 * TWIPS_PER_POINT) 			// 256 Twips, 0.45 cm
166 
167 									// Standardgroesse als Ole-Server (Zellen)
168 #define OLE_STD_CELLS_X		4
169 #define OLE_STD_CELLS_Y		5
170 
171 #define SC_SIZE_OPTIMUM		0xFFFF
172 
173 									// Update-Flags
174 #define UF_SCROLL_LEFT		1
175 #define UF_SCROLL_RIGHT		2
176 #define UF_SCROLL_UP		4
177 #define UF_SCROLL_DOWN		8
178 #define UF_ROW				16
179 #define UF_VIEW				32
180 
181 									// Repaint-Flags (fuer Messages)
182 #define PAINT_GRID			1
183 #define PAINT_TOP			2
184 #define PAINT_LEFT			4
185 #define PAINT_EXTRAS		8
186 #define PAINT_INVERT		16
187 #define PAINT_MARKS			32
188 #define PAINT_OBJECTS		64
189 #define PAINT_SIZE			128
190 #define PAINT_ALL			( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE )
191 
192 
193 									// Flags fuer Spalten / Zeilen
194 									// FILTERED immer zusammen mit HIDDEN
195 									// FILTERED und MANUALSIZE nur fuer Zeilen moeglich
196 const sal_uInt8   CR_HIDDEN      = 1;
197 //const sal_uInt8 CR_MARKED      = 2;
198 //const sal_uInt8 CR_PAGEBREAK   = 4;
199 const sal_uInt8   CR_MANUALBREAK = 8;
200 const sal_uInt8   CR_FILTERED    = 16;
201 const sal_uInt8   CR_MANUALSIZE  = 32;
202 const sal_uInt8   CR_ALL         = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE);
203 
204 typedef sal_uInt8 ScBreakType;
205 const ScBreakType BREAK_NONE   = 0;
206 const ScBreakType BREAK_PAGE   = 1;
207 const ScBreakType BREAK_MANUAL = 2;
208 
209 // Insert-/Delete-Flags
210 const sal_uInt16 IDF_NONE       = 0x0000;
211 const sal_uInt16 IDF_VALUE      = 0x0001;   /// Numeric values (and numeric results if IDF_FORMULA is not set).
212 const sal_uInt16 IDF_DATETIME   = 0x0002;   /// Dates, times, datetime values.
213 const sal_uInt16 IDF_STRING     = 0x0004;   /// Strings (and string results if IDF_FORMULA is not set).
214 const sal_uInt16 IDF_NOTE       = 0x0008;   /// Cell notes.
215 const sal_uInt16 IDF_FORMULA    = 0x0010;   /// Formula cells.
216 const sal_uInt16 IDF_HARDATTR   = 0x0020;   /// Hard cell attributes.
217 const sal_uInt16 IDF_STYLES     = 0x0040;   /// Cell styles.
218 const sal_uInt16 IDF_OBJECTS    = 0x0080;   /// Drawing objects.
219 const sal_uInt16 IDF_EDITATTR   = 0x0100;   /// Rich-text attributes.
220 const sal_uInt16 IDF_ATTRIB     = IDF_HARDATTR | IDF_STYLES;
221 const sal_uInt16 IDF_CONTENTS   = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA;
222 const sal_uInt16 IDF_ALL        = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
223 const sal_uInt16 IDF_NOCAPTIONS = 0x0200;   /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
224 const sal_uInt16 IDF_ADDNOTES   = 0x0400;   /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
225 
226 /// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
227 const sal_uInt16 IDF_AUTOFILL   = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS);
228 
229 #define PASTE_NOFUNC		0
230 #define PASTE_ADD			1
231 #define PASTE_SUB			2
232 #define PASTE_MUL			3
233 #define PASTE_DIV			4
234 
235 #define PASTE_NONEMPTY		5
236 
237 										// Bits fuer HasAttr
238 #define HASATTR_LINES			1
239 #define HASATTR_MERGED			2
240 #define HASATTR_OVERLAPPED		4
241 #define HASATTR_PROTECTED		8
242 #define HASATTR_SHADOW			16
243 #define HASATTR_NEEDHEIGHT		32
244 #define HASATTR_SHADOW_RIGHT	64
245 #define HASATTR_SHADOW_DOWN		128
246 #define HASATTR_AUTOFILTER		256
247 #define HASATTR_CONDITIONAL		512
248 #define HASATTR_ROTATE			1024
249 #define HASATTR_NOTOVERLAPPED	2048
250 #define HASATTR_RTL				4096
251 #define HASATTR_RIGHTORCENTER   8192    // right or centered logical alignment
252 
253 #define HASATTR_PAINTEXT		( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL )
254 
255 
256 #define EMPTY_STRING ScGlobal::GetEmptyString()
257 
258 										//	Layer-ID's fuer Drawing
259 #define SC_LAYER_FRONT		0
260 #define SC_LAYER_BACK		1
261 #define SC_LAYER_INTERN		2
262 #define SC_LAYER_CONTROLS	3
263 #define SC_LAYER_HIDDEN     4
264 
265 										//	Tabellen linken
266 #define SC_LINK_NONE		0
267 #define SC_LINK_NORMAL		1
268 #define SC_LINK_VALUE		2
269 
270 										//	Eingabe
271 #define SC_ENTER_NORMAL		0
272 #define SC_ENTER_BLOCK		1
273 #define SC_ENTER_MATRIX		2
274 
275 										//	Step = 10pt, max. Einzug = 100 Schritte
276 #define SC_INDENT_STEP		200
277 #define SC_MAX_INDENT		20000
278 
279 										//	Szenario-Flags
280 #define SC_SCENARIO_COPYALL		1
281 #define SC_SCENARIO_SHOWFRAME	2
282 #define SC_SCENARIO_PRINTFRAME	4
283 #define SC_SCENARIO_TWOWAY		8
284 #define SC_SCENARIO_ATTRIB		16
285 #define SC_SCENARIO_VALUE		32
286 #define SC_SCENARIO_PROTECT		64
287 
288 
289 #ifndef DELETEZ
290 #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
291 #endif
292 
293 									// Ist Bit in Set gesetzt?
294 #define IS_SET(bit,set)(((set)&(bit))==(bit))
295 
296 #define SEL_ALL			-1	// Eingabezeile: alles Selektieren
297 #define RES_CANCEL		0	// Resultate der Funk.AutoPilot-Seiten
298 #define RES_BACKWARD	1
299 #define RES_END			2
300 
301 enum CellType
302 	{
303 		CELLTYPE_NONE,
304 		CELLTYPE_VALUE,
305 		CELLTYPE_STRING,
306 		CELLTYPE_FORMULA,
307 		CELLTYPE_NOTE,
308 		CELLTYPE_EDIT,
309 		CELLTYPE_SYMBOLS 		// fuer Laden/Speichern
310 #if DBG_UTIL
311    		,CELLTYPE_DESTROYED
312 #endif
313 	};
314 
315 enum DelCellCmd
316 	{
317 		DEL_CELLSUP,
318 		DEL_CELLSLEFT,
319 		DEL_DELROWS,
320 		DEL_DELCOLS,
321 		DEL_NONE
322 	};
323 
324 enum InsCellCmd
325 	{
326 		INS_CELLSDOWN,
327 		INS_CELLSRIGHT,
328 		INS_INSROWS,
329 		INS_INSCOLS,
330 		INS_NONE
331 	};
332 
333 enum UpdateRefMode
334 	{
335 		URM_INSDEL,
336 		URM_COPY,
337 		URM_MOVE,
338 		URM_REORDER
339 	};
340 
341 enum FillDir
342 	{
343 		FILL_TO_BOTTOM,
344 		FILL_TO_RIGHT,
345 		FILL_TO_TOP,
346 		FILL_TO_LEFT
347 	};
348 
349 enum FillCmd
350 	{
351 		FILL_SIMPLE,
352 		FILL_LINEAR,
353 		FILL_GROWTH,
354 		FILL_DATE,
355 		FILL_AUTO
356 	};
357 
358 enum FillDateCmd
359 	{
360 		FILL_DAY,
361 		FILL_WEEKDAY,
362 		FILL_MONTH,
363 		FILL_YEAR
364 	};
365 
366 enum ScDirection
367 	{
368 		DIR_BOTTOM,
369 		DIR_RIGHT,
370 		DIR_TOP,
371 		DIR_LEFT
372 	};
373 
374 enum ScSizeMode
375 	{
376 		SC_SIZE_DIRECT,				// set size or hide if value is 0
377 		SC_SIZE_OPTIMAL,			// set optimal size for everything
378 		SC_SIZE_SHOW,				// show with original size
379 		SC_SIZE_VISOPT,				// set optimal size only if visible
380 		SC_SIZE_ORIGINAL			// only set size, don't change visible flag
381 	};
382 
383 enum ScInputMode
384 	{
385 		SC_INPUT_NONE,
386 		SC_INPUT_TYPE,				// Eingabe, ohne im Inplace-Modus zu sein
387 		SC_INPUT_TABLE,				// Textcursor in der Tabelle
388 		SC_INPUT_TOP				// Textcursor in der Eingabezeile
389 	};
390 
391 enum ScVObjMode						// Ausgabemodi von Objekten auf einer Seite
392 {
393 	VOBJ_MODE_SHOW,
394 	VOBJ_MODE_HIDE
395 	// #i80528# VOBJ_MODE_DUMMY removed, no longer supported
396 };
397 
398 enum ScAnchorType 					// Verankerung eines Zeichenobjekts
399 {
400 	SCA_CELL,
401 	SCA_PAGE,
402 	SCA_DONTKNOW 					// bei Mehrfachselektion
403 };
404 
405 enum ScGetDBMode
406 {
407     SC_DB_MAKE,             // if needed create database range with name $STR_DB_NONAME
408     SC_DB_IMPORT,           // if needed create database range with name $STR_DBNAME_IMPORT[X]
409     SC_DB_OLD,              // do not create new database range, provide only existing one
410     SC_DB_MAKE_AUTOFILTER   // if needed create database range with name $SC_DBNAME_UNNAMED[X]
411 };
412 
413 /// For ScDBFunc::GetDBData()
414 enum ScGetDBSelection
415 {
416     /** Keep selection as is, expand to used data area if no selection. */
417     SC_DBSEL_KEEP,
418 
419     /** Shrink selection to sheet's data area. */
420     SC_DBSEL_SHRINK_TO_SHEET_DATA,
421 
422     /** Shrink selection to actually used data area within the selection. */
423     SC_DBSEL_SHRINK_TO_USED_DATA,
424 
425     /** If only one row or portion thereof is selected, shrink row to used data
426         columns and select further rows down until end of data. If an area is
427         selected, shrink rows to actually used columns. Else, no selection,
428         expand to used data area. */
429     SC_DBSEL_ROW_DOWN,
430 
431     /** Behave as if the range corresponding to a ScDBData area was selected,
432         for API use. */
433     SC_DBSEL_FORCE_MARK
434 };
435 
436 enum ScLkUpdMode
437 {					//Verknuepfungen
438 	LM_ALWAYS,		//immer aktualisieren
439 	LM_NEVER,		//niemals
440 	LM_ON_DEMAND,	//auf nachfrage
441 	LM_UNKNOWN		//Shit happens
442 };
443 
444 
445 // -----------------------------------------------------------------------
446 
447 //==================================================================
448 
449 // -----------------------------------------------------------------------
450 
451 // enum with values equal to old DBObject enum from sdb
452 enum ScDBObject
453 {
454 	ScDbTable,
455 	ScDbQuery
456 };
457 
458 struct ScImportParam
459 {
460 	SCCOL			nCol1;
461 	SCROW			nRow1;
462 	SCCOL			nCol2;
463 	SCROW			nRow2;
464 	sal_Bool			bImport;
465 	String			aDBName;					// Alias der Datenbank
466 	String			aStatement;
467 	sal_Bool			bNative;
468 	sal_Bool			bSql;						// Statement oder Name?
469 	sal_uInt8			nType;						// enum DBObject
470 
471 	ScImportParam();
472 	ScImportParam( const ScImportParam& r );
473 	~ScImportParam();
474 
475 	ScImportParam&	operator=	( const ScImportParam& r );
476 	sal_Bool			operator==	( const ScImportParam& r ) const;
477 //UNUSED2009-05 void			Clear		();
478 };
479 
480 struct ScStringHashCode
481 {
operator ()ScStringHashCode482     size_t operator()( const String& rStr ) const
483     {
484         return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
485     }
486 };
487 
488 // -----------------------------------------------------------------------
489 
490 class ScDocument;
491 class ScDocShell;
492 class ScDocShellRef;
493 class SvxSearchItem;
494 class ScAutoFormat;
495 class FuncCollection;
496 class ScUnoAddInCollection;
497 class ScUserList;
498 class SvxBrushItem;
499 class ScFunctionList;
500 class ScFunctionMgr;
501 class SfxItemPool;
502 class SdrModel;
503 class EditTextObject;
504 class SfxObjectShell;
505 class SvNumberFormatter;
506 class ScUnitConverter;
507 class CharClass;
508 class LocaleDataWrapper;
509 class SvtSysLocale;
510 class CalendarWrapper;
511 class CollatorWrapper;
512 class IntlWrapper;
513 class OutputDevice;
514 
515 namespace com { namespace sun { namespace star {
516     namespace lang {
517         struct Locale;
518     }
519     namespace i18n {
520         class XOrdinalSuffix;
521     }
522 }}}
523 namespace utl {
524     class TransliterationWrapper;
525 }
526 
527 #ifndef _SCALC_EXE
528 class ScGlobal
529 {
530 	static SvxSearchItem*	pSearchItem;
531 	static ScAutoFormat*	pAutoFormat;
532 	static FuncCollection*	pFuncCollection;
533 	static ScUnoAddInCollection* pAddInCollection;
534 	static ScUserList*		pUserList;
535 	static String**			ppRscString;
536 	static String* 			pStrScDoc;
537 	static String*          pEmptyString;
538 	static String*			pStrClipDocName;
539 	static SvxBrushItem*    pEmptyBrushItem;
540 	static SvxBrushItem*	pButtonBrushItem;
541 	static SvxBrushItem*	pEmbeddedBrushItem;
542 	static SvxBrushItem*	pProtectedBrushItem;
543 
544     static ImageList*       pOutlineBitmaps;
545     static ImageList*       pOutlineBitmapsHC;
546 
547 //	static Bitmap*			pAnchorBitmap;
548 //	static Bitmap*			pGrayAnchorBitmap;
549 
550 	static ScFunctionList*	pStarCalcFunctionList;
551 	static ScFunctionMgr*	pStarCalcFunctionMgr;
552 
553 	static ScUnitConverter*	pUnitConverter;
554 
555     static  SvNumberFormatter*  pEnglishFormatter;          // for UNO / XML export
556 
557     static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix;
558     static CalendarWrapper*		pCalendar;
559     static CollatorWrapper*		pCaseCollator;
560     static CollatorWrapper*		pCollator;
561     static ::utl::TransliterationWrapper* pTransliteration;
562     static ::utl::TransliterationWrapper* pCaseTransliteration;
563     static IntlWrapper*         pScIntlWrapper;
564     static ::com::sun::star::lang::Locale*		pLocale;
565 
566 public:
567     static SvtSysLocale*        pSysLocale;
568     // for faster access a pointer to the single instance provided by SvtSysLocale
569     SC_DLLPUBLIC static const CharClass*     pCharClass;
570     // for faster access a pointer to the single instance provided by SvtSysLocale
571     SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData;
572     SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData();
573 
574     static CalendarWrapper*     GetCalendar();
575     SC_DLLPUBLIC static CollatorWrapper*		GetCollator();
576     static CollatorWrapper*		GetCaseCollator();
577     static IntlWrapper*         GetScIntlWrapper();
578     static ::com::sun::star::lang::Locale*		GetLocale();
579 
580     SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); //CHINA001
581     static ::utl::TransliterationWrapper* GetCaseTransliteration();
582 
583     SC_DLLPUBLIC static LanguageType	   		eLnge;
584 	static sal_Unicode			cListDelimiter;
585 
586 	static const String&	 	GetClipDocName();
587 	static void 			 	SetClipDocName( const String& rNew );
588 	SC_DLLPUBLIC static const SvxSearchItem&	GetSearchItem();
589 	SC_DLLPUBLIC static void					SetSearchItem( const SvxSearchItem& rNew );
590     SC_DLLPUBLIC static ScAutoFormat*		GetAutoFormat();
591 	static void					ClearAutoFormat(); //BugId 54209
592 	static FuncCollection*		GetFuncCollection();
593     SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
594     SC_DLLPUBLIC static ScUserList*			GetUserList();
595 	static void					SetUserList( const ScUserList* pNewList );
596     SC_DLLPUBLIC static const String&		GetRscString( sal_uInt16 nIndex );
597 	static void					OpenURL( const String& rURL, const String& rTarget );
598     SC_DLLPUBLIC static String				GetAbsDocName( const String& rFileName,
599 												SfxObjectShell* pShell );
600     SC_DLLPUBLIC static String				GetDocTabName( const String& rFileName,
601 												const String& rTabName );
602     SC_DLLPUBLIC static sal_uLong				GetStandardFormat( SvNumberFormatter&,
603 									sal_uLong nFormat, short nType );
604     SC_DLLPUBLIC static sal_uLong				GetStandardFormat( double, SvNumberFormatter&,
605 									sal_uLong nFormat, short nType );
606 
607     SC_DLLPUBLIC static double				nScreenPPTX;
608     SC_DLLPUBLIC static double				nScreenPPTY;
609 
610 	static ScDocShellRef*	pDrawClipDocShellRef;
611 
612 	static sal_uInt16			nDefFontHeight;
613 	static sal_uInt16			nStdRowHeight;
614 
615     SC_DLLPUBLIC static long				nLastRowHeightExtra;
616 	static long				nLastColWidthExtra;
617 
618 	static void             Init();						// am Anfang
619 	static void             InitAddIns();
620 	static void				Clear();					// bei Programmende
621 
622 	static void				UpdatePPT(OutputDevice* pDev);
623 
624 	static void             InitTextHeight(SfxItemPool* pPool);
GetEmptyBrushItem()625 	static SvxBrushItem*	GetEmptyBrushItem()	{ return pEmptyBrushItem; }
626     static SvxBrushItem*    GetButtonBrushItem();
GetEmbeddedBrushItem()627 	static SvxBrushItem*	GetEmbeddedBrushItem()	{ return pEmbeddedBrushItem; }
GetProtectedBrushItem()628 	static SvxBrushItem*	GetProtectedBrushItem()	{ return pProtectedBrushItem; }
629     SC_DLLPUBLIC    static const String&	GetEmptyString();
630 	static const String& 	GetScDocString();
631 
632     /** Returns the specified image list with outline symbols.
633         @param bHC  false = standard symbols; true = high contrast symbols. */
634     static ImageList*       GetOutlineSymbols( bool bHC );
635 
636 //	static const Bitmap&	GetAnchorBitmap();
637 //	static const Bitmap&	GetGrayAnchorBitmap();
638 
639     static bool             HasStarCalcFunctionList();
640 	static ScFunctionList*	GetStarCalcFunctionList();
641 	static ScFunctionMgr*	GetStarCalcFunctionMgr();
642     static void             ResetFunctionList();
643 
644 	static String			GetErrorString(sal_uInt16 nErrNumber);
645 	static String			GetLongErrorString(sal_uInt16 nErrNumber);
646 	static sal_Bool				EETextObjEqual( const EditTextObject* pObj1,
647 											const EditTextObject* pObj2 );
648 	static sal_Bool				CheckWidthInvalidate( sal_Bool& bNumFormatChanged,
649 												  const SfxItemSet& rNewAttrs,
650 												  const SfxItemSet& rOldAttrs );
651 	static sal_Bool				HasAttrChanged( const SfxItemSet& rNewAttrs,
652 											const SfxItemSet& rOldAttrs,
653 											const sal_uInt16	  nWhich );
654 
655 	static ScUnitConverter*	GetUnitConverter();
656 
657 	/// strchr() functionality on unicode, as long as we need it for ScToken etc.
658 	static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c );
659 
ToUpperAlpha(sal_Unicode c)660 	static inline sal_Unicode ToUpperAlpha( sal_Unicode c )
661 		{ return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; }
662 
663     /** Adds the string rToken to rTokenList, using a list separator character.
664         @param rTokenList  The string list where the token will be appended to.
665         @param rToken  The token string to append to the token list.
666         @param cSep  The character to separate the tokens.
667         @param nSepCount  Specifies how often cSep is inserted between two tokens.
668         @param bForceSep  true = Always insert separator; false = Only, if not at begin or end. */
669     SC_DLLPUBLIC static void             AddToken(
670                                 String& rTokenList, const String& rToken,
671                                 sal_Unicode cSep, xub_StrLen nSepCount = 1,
672                                 bool bForceSep = false );
673 
674     /** Returns true, if the first and last character of the string is cQuote. */
675     SC_DLLPUBLIC static bool             IsQuoted( const String& rString, sal_Unicode cQuote = '\'' );
676 
677     /** Inserts the character cQuote at beginning and end of rString.
678         @param bEscapeEmbedded      If <TRUE/>, embedded quote characters are
679                                     escaped by doubling them.
680      */
681 SC_DLLPUBLIC    static void             AddQuotes( String& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true );
682 
683     /** Erases the character cQuote from rString, if it exists at beginning AND end.
684         @param bUnescapeEmbedded    If <TRUE/>, embedded doubled quote characters
685                                     are unescaped by replacing them with a
686                                     single instance.
687      */
688 SC_DLLPUBLIC    static void             EraseQuotes( String& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true );
689 
690     /** Finds an unquoted instance of cChar in rString, starting at
691         offset nStart. Unquoted instances may occur when concatenating two
692         quoted strings with a separator, for example, 's1':'s2'. Embedded
693         quotes have to be escaped by being doubled. Caller must ensure that
694         nStart points into an unquoted range or the opening quote. Specialty:
695         if cChar==cQuote the first cQuote character from nStart on is found.
696         @returns offset if found, else STRING_NOTFOUND
697      */
698 SC_DLLPUBLIC    static xub_StrLen       FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' );
699 
700     /** Finds an unquoted instance of cChar in null-terminated pString. Same
701         semantics as FindUnquoted( const String&, ...)
702         @returns: pointer to cChar if found, else NULL
703      */
704 SC_DLLPUBLIC    static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' );
705 
706 
707 	static	CharSet			GetCharsetValue( const String& rCharSet );
708 	static	String			GetCharsetString( CharSet eVal );
709 
710     /// a "ReadOnly" formatter for UNO/XML export
711     static  SvNumberFormatter*  GetEnglishFormatter();
712 
713 	static sal_Bool IsSystemRTL();						// depending on system language
714 	static LanguageType GetEditDefaultLanguage();	// for EditEngine::SetDefaultLanguage
715     SC_DLLPUBLIC static sal_uInt8	GetDefaultScriptType();				// for all WEAK characters
716     /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
717         If more than one SCRIPTTYPE_... values are or'ed together, prefers
718         first COMPLEX, then ASIAN */
719     SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich );
720 
721     /** Adds a language item to the item set, if the number format item contains
722         a language that differs from its parent's language. */
723     SC_DLLPUBLIC static void             AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter );
724 
725     /** Obtain the ordinal suffix for a number according to the system locale */
726     static String           GetOrdinalSuffix( sal_Int32 nNumber);
727 };
728 #endif
729 
730 //==================================================================
731 // evtl. in dbdata.hxx auslagern (?):
732 
733 enum ScQueryOp
734 	{
735 		SC_EQUAL,
736 		SC_LESS,
737 		SC_GREATER,
738 		SC_LESS_EQUAL,
739 		SC_GREATER_EQUAL,
740 		SC_NOT_EQUAL,
741 		SC_TOPVAL,
742 		SC_BOTVAL,
743 		SC_TOPPERC,
744         SC_BOTPERC,
745         SC_CONTAINS,
746         SC_DOES_NOT_CONTAIN,
747         SC_BEGINS_WITH,
748         SC_DOES_NOT_BEGIN_WITH,
749         SC_ENDS_WITH,
750         SC_DOES_NOT_END_WITH
751 	};
752 
753 // -----------------------------------------------------------------------
754 
755 enum ScQueryConnect
756 	{
757 		SC_AND,
758 		SC_OR
759 	};
760 
761 // -----------------------------------------------------------------------
762 
763 enum ScSubTotalFunc
764 	{
765 		SUBTOTAL_FUNC_NONE	= 0,
766 		SUBTOTAL_FUNC_AVE	= 1,
767 		SUBTOTAL_FUNC_CNT	= 2,
768 		SUBTOTAL_FUNC_CNT2	= 3,
769 		SUBTOTAL_FUNC_MAX	= 4,
770 		SUBTOTAL_FUNC_MIN	= 5,
771 		SUBTOTAL_FUNC_PROD	= 6,
772 		SUBTOTAL_FUNC_STD	= 7,
773 		SUBTOTAL_FUNC_STDP	= 8,
774 		SUBTOTAL_FUNC_SUM	= 9,
775 		SUBTOTAL_FUNC_VAR	= 10,
776 		SUBTOTAL_FUNC_VARP	= 11
777 	};
778 
779 
780 // -----------------------------------------------------------------------
781 
782 /*
783  * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer"
784  * als Konstanten SC_EMPTYFIELDS bzw. SC_NONEMPTYFIELDS in nVal in
785  * Verbindung mit dem Schalter bQueryByString auf FALSE.
786  */
787 
788 #define SC_EMPTYFIELDS		((double)0x0042)
789 #define SC_NONEMPTYFIELDS	((double)0x0043)
790 
791 namespace utl
792 {
793 	class SearchParam;
794 	class TextSearch;
795 }
796 
797 struct ScQueryEntry
798 {
799 	sal_Bool			bDoQuery;
800 	sal_Bool			bQueryByString;
801     bool            bQueryByDate;
802 	SCCOLROW		nField;
803 	ScQueryOp		eOp;
804 	ScQueryConnect  eConnect;
805 	String*			pStr;
806 	double			nVal;
807 	utl::SearchParam*	pSearchParam;		// falls RegExp, nicht gespeichert
808 	utl::TextSearch*	pSearchText;		// falls RegExp, nicht gespeichert
809 
810 	ScQueryEntry();
811 	ScQueryEntry(const ScQueryEntry& r);
812 	~ScQueryEntry();
813 
814 	// legt ggbf. pSearchParam und pSearchText an, immer RegExp!
815 	utl::TextSearch*	GetSearchTextPtr( sal_Bool bCaseSens );
816 
817 	void			Clear();
818 	ScQueryEntry&	operator=( const ScQueryEntry& r );
819 	sal_Bool			operator==( const ScQueryEntry& r ) const;
820 };
821 
822 // -----------------------------------------------------------------------
823 
824 struct SC_DLLPUBLIC ScSubTotalParam
825 {
826 	SCCOL			nCol1;			// Selektierter Bereich
827 	SCROW			nRow1;
828 	SCCOL			nCol2;
829 	SCROW			nRow2;
830 	sal_Bool			bRemoveOnly;
831 	sal_Bool			bReplace;					// vorhandene Ergebnisse ersetzen
832 	sal_Bool			bPagebreak;					// Seitenumbruch bei Gruppenwechsel
833 	sal_Bool			bCaseSens;					// Gross-/Kleinschreibung
834 	sal_Bool			bDoSort;					// vorher sortieren
835 	sal_Bool			bAscending;					// aufsteigend sortieren
836 	sal_Bool			bUserDef;					// Benutzer-def. Sort.Reihenfolge
837 	sal_uInt16			nUserIndex;                 // Index auf Liste
838 	sal_Bool			bIncludePattern;			// Formate mit sortieren
839 	sal_Bool			bGroupActive[MAXSUBTOTAL];	// aktive Gruppen
840 	SCCOL			nField[MAXSUBTOTAL];		// zugehoeriges Feld
841 	SCCOL			nSubTotals[MAXSUBTOTAL];	// Anzahl der SubTotals
842 	SCCOL*			pSubTotals[MAXSUBTOTAL];	// Array der zu berechnenden Spalten
843 	ScSubTotalFunc*	pFunctions[MAXSUBTOTAL];	// Array der zugehoerige Funktionen
844 
845 	ScSubTotalParam();
846 	ScSubTotalParam( const ScSubTotalParam& r );
847 
848 	ScSubTotalParam&	operator=		( const ScSubTotalParam& r );
849 	sal_Bool				operator==		( const ScSubTotalParam& r ) const;
850 	void				Clear			();
851 	void 				SetSubTotals	( sal_uInt16				nGroup,
852 										  const SCCOL*			ptrSubTotals,
853 										  const ScSubTotalFunc*	ptrFuncions,
854 										  sal_uInt16				nCount );
855 };
856 
857 // -----------------------------------------------------------------------
858 class ScArea;
859 
860 struct ScConsolidateParam
861 {
862 	SCCOL			nCol;					// Cursor Position /
863 	SCROW			nRow;					// bzw. Anfang des Zielbereiches
864 	SCTAB			nTab;
865 	ScSubTotalFunc	eFunction;				// Berechnungsvorschrift
866 	sal_uInt16			nDataAreaCount;			// Anzahl der Datenbereiche
867 	ScArea**		ppDataAreas;			// Zeiger-Array auf Datenbereiche
868 	sal_Bool			bByCol;					// nach Spalten
869 	sal_Bool			bByRow;					// nach Zeilen
870 	sal_Bool			bReferenceData;			// Quelldaten referenzieren
871 
872 	ScConsolidateParam();
873 	ScConsolidateParam( const ScConsolidateParam& r );
874 	~ScConsolidateParam();
875 
876 	ScConsolidateParam&	operator=		( const ScConsolidateParam& r );
877 	sal_Bool				operator==		( const ScConsolidateParam& r ) const;
878 	void				Clear			(); // = ClearDataAreas()+Members
879 	void				ClearDataAreas	();
880 	void				SetAreas		( ScArea* const* ppAreas, sal_uInt16 nCount );
881 };
882 
883 // -----------------------------------------------------------------------
884 extern ::utl::TransliterationWrapper* GetScGlobalpTransliteration();//CHINA001
885 extern const LocaleDataWrapper* GetScGlobalpLocaleData();
886 
887 #endif
888