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