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