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 ************************************************************************/
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>
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 )
58 #define S_CAP StartCAP();
59 #define E_CAP StopCAP(); DumpCAP();
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 )
70 #define SC_COLLATOR_IGNORES ( \
71 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
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 )
84 #define SC_TRANSLITERATION_IGNORECASE ( \
85 ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE )
86 #define SC_TRANSLITERATION_CASESENSE 0
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
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;
127 const SCSIZE MAXSUBTOTAL
= 3;
128 const SCSIZE MAXQUERY
= 8;
129 const SCSIZE PIVOT_MAXFIELD
= 8;
130 const SCSIZE PIVOT_MAXPAGEFIELD
= 10;
133 #define SC_START_INDEX_DB_COLL 50000
134 // Oberhalb dieser Grenze liegen
135 // die Indizes fuer DBBereiche
139 #define PIXEL_PER_INCH 72.0
141 #define PIXEL_PER_INCH 96.0
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
185 #define UF_SCROLL_LEFT 1
186 #define UF_SCROLL_RIGHT 2
187 #define UF_SCROLL_UP 4
188 #define UF_SCROLL_DOWN 8
192 // Repaint-Flags (fuer Messages)
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;
214 // was davon kommt in die Datei:
215 #define CR_SAVEMASK ( ~CR_PAGEBREAK )
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_SPECIAL_BOOLEAN
= 0x1000;
229 const USHORT IDF_ATTRIB
= IDF_HARDATTR
| IDF_STYLES
;
230 const USHORT IDF_CONTENTS
= IDF_VALUE
| IDF_DATETIME
| IDF_STRING
| IDF_NOTE
| IDF_FORMULA
;
231 const USHORT IDF_ALL
= IDF_CONTENTS
| IDF_ATTRIB
| IDF_OBJECTS
;
232 const USHORT IDF_NOCAPTIONS
= 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
233 const USHORT IDF_ADDNOTES
= 0x0400; /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
235 /// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
236 const USHORT IDF_AUTOFILL
= IDF_ALL
& ~(IDF_NOTE
| IDF_OBJECTS
);
238 #define PASTE_NOFUNC 0
244 #define PASTE_NONEMPTY 5
247 #define HASATTR_LINES 1
248 #define HASATTR_MERGED 2
249 #define HASATTR_OVERLAPPED 4
250 #define HASATTR_PROTECTED 8
251 #define HASATTR_SHADOW 16
252 #define HASATTR_NEEDHEIGHT 32
253 #define HASATTR_SHADOW_RIGHT 64
254 #define HASATTR_SHADOW_DOWN 128
255 #define HASATTR_AUTOFILTER 256
256 #define HASATTR_CONDITIONAL 512
257 #define HASATTR_ROTATE 1024
258 #define HASATTR_NOTOVERLAPPED 2048
259 #define HASATTR_RTL 4096
260 #define HASATTR_RIGHTORCENTER 8192 // right or centered logical alignment
262 #define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL )
265 #define EMPTY_STRING ScGlobal::GetEmptyString()
267 // Layer-ID's fuer Drawing
268 #define SC_LAYER_FRONT 0
269 #define SC_LAYER_BACK 1
270 #define SC_LAYER_INTERN 2
271 #define SC_LAYER_CONTROLS 3
272 #define SC_LAYER_HIDDEN 4
275 #define SC_LINK_NONE 0
276 #define SC_LINK_NORMAL 1
277 #define SC_LINK_VALUE 2
280 #define SC_ENTER_NORMAL 0
281 #define SC_ENTER_BLOCK 1
282 #define SC_ENTER_MATRIX 2
284 // Step = 10pt, max. Einzug = 100 Schritte
285 #define SC_INDENT_STEP 200
286 #define SC_MAX_INDENT 20000
289 #define SC_SCENARIO_COPYALL 1
290 #define SC_SCENARIO_SHOWFRAME 2
291 #define SC_SCENARIO_PRINTFRAME 4
292 #define SC_SCENARIO_TWOWAY 8
293 #define SC_SCENARIO_ATTRIB 16
294 #define SC_SCENARIO_VALUE 32
295 #define SC_SCENARIO_PROTECT 64
299 #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
302 // Ist Bit in Set gesetzt?
303 #define IS_SET(bit,set)(((set)&(bit))==(bit))
305 #define SEL_ALL -1 // Eingabezeile: alles Selektieren
306 #define RES_CANCEL 0 // Resultate der Funk.AutoPilot-Seiten
307 #define RES_BACKWARD 1
318 CELLTYPE_SYMBOLS
// fuer Laden/Speichern
385 SC_SIZE_DIRECT
, // set size or hide if value is 0
386 SC_SIZE_OPTIMAL
, // set optimal size for everything
387 SC_SIZE_SHOW
, // show with original size
388 SC_SIZE_VISOPT
, // set optimal size only if visible
389 SC_SIZE_ORIGINAL
// only set size, don't change visible flag
395 SC_INPUT_TYPE
, // Eingabe, ohne im Inplace-Modus zu sein
396 SC_INPUT_TABLE
, // Textcursor in der Tabelle
397 SC_INPUT_TOP
// Textcursor in der Eingabezeile
400 enum ScVObjMode
// Ausgabemodi von Objekten auf einer Seite
404 // #i80528# VOBJ_MODE_DUMMY removed, no longer supported
407 enum ScAnchorType
// Verankerung eines Zeichenobjekts
411 SCA_DONTKNOW
// bei Mehrfachselektion
416 SC_DB_MAKE
, // wenn noetig, "unbenannt" anlegen
417 SC_DB_IMPORT
, // wenn noetig, "Importx" anlegen
418 SC_DB_OLD
// nicht neu anlegen
423 LM_ALWAYS
, //immer aktualisieren
425 LM_ON_DEMAND
, //auf nachfrage
426 LM_UNKNOWN
//Shit happens
430 // -----------------------------------------------------------------------
432 //==================================================================
434 // -----------------------------------------------------------------------
436 // enum with values equal to old DBObject enum from sdb
450 String aDBName
; // Alias der Datenbank
453 BOOL bSql
; // Statement oder Name?
454 BYTE nType
; // enum DBObject
457 ScImportParam( const ScImportParam
& r
);
460 ScImportParam
& operator= ( const ScImportParam
& r
);
461 BOOL
operator== ( const ScImportParam
& r
) const;
462 //UNUSED2009-05 void Clear ();
465 struct ScStringHashCode
467 size_t operator()( const String
& rStr
) const
469 return rtl_ustr_hashCode_WithLength( rStr
.GetBuffer(), rStr
.Len() );
473 // -----------------------------------------------------------------------
480 class FuncCollection
;
481 class ScUnoAddInCollection
;
484 class ScFunctionList
;
488 class EditTextObject
;
489 class SfxObjectShell
;
490 class SvNumberFormatter
;
491 class ScUnitConverter
;
493 class LocaleDataWrapper
;
495 class CalendarWrapper
;
496 class CollatorWrapper
;
500 namespace com
{ namespace sun
{ namespace star
{
505 class XOrdinalSuffix
;
509 class TransliterationWrapper
;
515 static SvxSearchItem
* pSearchItem
;
516 static ScAutoFormat
* pAutoFormat
;
517 static FuncCollection
* pFuncCollection
;
518 static ScUnoAddInCollection
* pAddInCollection
;
519 static ScUserList
* pUserList
;
520 static String
** ppRscString
;
521 static String
* pStrScDoc
;
522 static String
* pEmptyString
;
523 static String
* pStrClipDocName
;
524 static SvxBrushItem
* pEmptyBrushItem
;
525 static SvxBrushItem
* pButtonBrushItem
;
526 static SvxBrushItem
* pEmbeddedBrushItem
;
527 static SvxBrushItem
* pProtectedBrushItem
;
529 static ImageList
* pOutlineBitmaps
;
530 static ImageList
* pOutlineBitmapsHC
;
532 // static Bitmap* pAnchorBitmap;
533 // static Bitmap* pGrayAnchorBitmap;
535 static ScFunctionList
* pStarCalcFunctionList
;
536 static ScFunctionMgr
* pStarCalcFunctionMgr
;
538 static ScUnitConverter
* pUnitConverter
;
540 static SvNumberFormatter
* pEnglishFormatter
; // for UNO / XML export
542 static ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XOrdinalSuffix
> xOrdinalSuffix
;
545 static ::com::sun::star::lang::Locale
* pLocale
;
546 static SvtSysLocale
* pSysLocale
;
547 // for faster access a pointer to the single instance provided by SvtSysLocale
548 SC_DLLPUBLIC
static const CharClass
* pCharClass
;
549 // for faster access a pointer to the single instance provided by SvtSysLocale
550 SC_DLLPUBLIC
static const LocaleDataWrapper
* pLocaleData
;
551 SC_DLLPUBLIC
static const LocaleDataWrapper
* GetpLocaleData();
553 static CalendarWrapper
* pCalendar
;
554 SC_DLLPUBLIC
static CollatorWrapper
* pCollator
;
555 static CollatorWrapper
* pCaseCollator
;
557 static ::utl::TransliterationWrapper
* pTransliteration
;
558 SC_DLLPUBLIC
static ::utl::TransliterationWrapper
* GetpTransliteration(); //CHINA001
560 static ::utl::TransliterationWrapper
* pCaseTransliteration
;
561 static IntlWrapper
* pScIntlWrapper
;
562 SC_DLLPUBLIC
static LanguageType eLnge
;
563 static sal_Unicode cListDelimiter
;
565 static const String
& GetClipDocName();
566 static void SetClipDocName( const String
& rNew
);
567 SC_DLLPUBLIC
static const SvxSearchItem
& GetSearchItem();
568 SC_DLLPUBLIC
static void SetSearchItem( const SvxSearchItem
& rNew
);
569 SC_DLLPUBLIC
static ScAutoFormat
* GetAutoFormat();
570 static void ClearAutoFormat(); //BugId 54209
571 static FuncCollection
* GetFuncCollection();
572 SC_DLLPUBLIC
static ScUnoAddInCollection
* GetAddInCollection();
573 SC_DLLPUBLIC
static ScUserList
* GetUserList();
574 static void SetUserList( const ScUserList
* pNewList
);
575 SC_DLLPUBLIC
static const String
& GetRscString( USHORT nIndex
);
576 static void OpenURL( const String
& rURL
, const String
& rTarget
);
577 SC_DLLPUBLIC
static String
GetAbsDocName( const String
& rFileName
,
578 SfxObjectShell
* pShell
);
579 SC_DLLPUBLIC
static String
GetDocTabName( const String
& rFileName
,
580 const String
& rTabName
);
581 SC_DLLPUBLIC
static ULONG
GetStandardFormat( SvNumberFormatter
&,
582 ULONG nFormat
, short nType
);
583 SC_DLLPUBLIC
static ULONG
GetStandardFormat( double, SvNumberFormatter
&,
584 ULONG nFormat
, short nType
);
586 SC_DLLPUBLIC
static double nScreenPPTX
;
587 SC_DLLPUBLIC
static double nScreenPPTY
;
589 static ScDocShellRef
* pDrawClipDocShellRef
;
591 static USHORT nDefFontHeight
;
592 static USHORT nStdRowHeight
;
594 SC_DLLPUBLIC
static long nLastRowHeightExtra
;
595 static long nLastColWidthExtra
;
597 static void Init(); // am Anfang
598 static void InitAddIns();
599 static void Clear(); // bei Programmende
601 static void UpdatePPT(OutputDevice
* pDev
);
603 static void InitTextHeight(SfxItemPool
* pPool
);
604 static SvxBrushItem
* GetEmptyBrushItem() { return pEmptyBrushItem
; }
605 static SvxBrushItem
* GetButtonBrushItem();
606 static SvxBrushItem
* GetEmbeddedBrushItem() { return pEmbeddedBrushItem
; }
607 static SvxBrushItem
* GetProtectedBrushItem() { return pProtectedBrushItem
; }
608 SC_DLLPUBLIC
static const String
& GetEmptyString();
609 static const String
& GetScDocString();
611 /** Returns the specified image list with outline symbols.
612 @param bHC false = standard symbols; true = high contrast symbols. */
613 static ImageList
* GetOutlineSymbols( bool bHC
);
615 // static const Bitmap& GetAnchorBitmap();
616 // static const Bitmap& GetGrayAnchorBitmap();
618 static bool HasStarCalcFunctionList();
619 static ScFunctionList
* GetStarCalcFunctionList();
620 static ScFunctionMgr
* GetStarCalcFunctionMgr();
621 static void ResetFunctionList();
623 static String
GetErrorString(USHORT nErrNumber
);
624 static String
GetLongErrorString(USHORT nErrNumber
);
625 static BOOL
EETextObjEqual( const EditTextObject
* pObj1
,
626 const EditTextObject
* pObj2
);
627 static BOOL
CheckWidthInvalidate( BOOL
& bNumFormatChanged
,
628 const SfxItemSet
& rNewAttrs
,
629 const SfxItemSet
& rOldAttrs
);
630 static BOOL
HasAttrChanged( const SfxItemSet
& rNewAttrs
,
631 const SfxItemSet
& rOldAttrs
,
632 const USHORT nWhich
);
634 static ScUnitConverter
* GetUnitConverter();
636 /// strchr() functionality on unicode, as long as we need it for ScToken etc.
637 static const sal_Unicode
* UnicodeStrChr( const sal_Unicode
* pStr
, sal_Unicode c
);
639 static inline sal_Unicode
ToUpperAlpha( sal_Unicode c
)
640 { return ( c
>= 'a' && c
<= 'z' ) ? ( c
-'a'+'A' ) : c
; }
642 /** Adds the string rToken to rTokenList, using a list separator character.
643 @param rTokenList The string list where the token will be appended to.
644 @param rToken The token string to append to the token list.
645 @param cSep The character to separate the tokens.
646 @param nSepCount Specifies how often cSep is inserted between two tokens.
647 @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */
648 SC_DLLPUBLIC
static void AddToken(
649 String
& rTokenList
, const String
& rToken
,
650 sal_Unicode cSep
, xub_StrLen nSepCount
= 1,
651 bool bForceSep
= false );
653 /** Returns true, if the first and last character of the string is cQuote. */
654 SC_DLLPUBLIC
static bool IsQuoted( const String
& rString
, sal_Unicode cQuote
= '\'' );
656 /** Inserts the character cQuote at beginning and end of rString.
657 @param bEscapeEmbedded If <TRUE/>, embedded quote characters are
658 escaped by doubling them.
660 SC_DLLPUBLIC
static void AddQuotes( String
& rString
, sal_Unicode cQuote
= '\'', bool bEscapeEmbedded
= true );
662 /** Erases the character cQuote from rString, if it exists at beginning AND end.
663 @param bUnescapeEmbedded If <TRUE/>, embedded doubled quote characters
664 are unescaped by replacing them with a
667 SC_DLLPUBLIC
static void EraseQuotes( String
& rString
, sal_Unicode cQuote
= '\'', bool bUnescapeEmbedded
= true );
669 /** Finds an unquoted instance of cChar in rString, starting at
670 offset nStart. Unquoted instances may occur when concatenating two
671 quoted strings with a separator, for example, 's1':'s2'. Embedded
672 quotes have to be escaped by being doubled. Caller must ensure that
673 nStart points into an unquoted range or the opening quote. Specialty:
674 if cChar==cQuote the first cQuote character from nStart on is found.
675 @returns offset if found, else STRING_NOTFOUND
677 SC_DLLPUBLIC
static xub_StrLen
FindUnquoted( const String
& rString
, sal_Unicode cChar
, xub_StrLen nStart
= 0, sal_Unicode cQuote
= '\'' );
679 /** Finds an unquoted instance of cChar in null-terminated pString. Same
680 semantics as FindUnquoted( const String&, ...)
681 @returns: pointer to cChar if found, else NULL
683 SC_DLLPUBLIC
static const sal_Unicode
* FindUnquoted( const sal_Unicode
* pString
, sal_Unicode cChar
, sal_Unicode cQuote
= '\'' );
686 static CharSet
GetCharsetValue( const String
& rCharSet
);
687 static String
GetCharsetString( CharSet eVal
);
689 /// a "ReadOnly" formatter for UNO/XML export
690 static SvNumberFormatter
* GetEnglishFormatter();
692 static BOOL
IsSystemRTL(); // depending on system language
693 static LanguageType
GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage
694 SC_DLLPUBLIC
static BYTE
GetDefaultScriptType(); // for all WEAK characters
695 /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
696 If more than one SCRIPTTYPE_... values are or'ed together, prefers
697 first COMPLEX, then ASIAN */
698 SC_DLLPUBLIC
static USHORT
GetScriptedWhichID( BYTE nScriptType
, USHORT nWhich
);
700 /** Adds a language item to the item set, if the number format item contains
701 a language that differs from its parent's language. */
702 SC_DLLPUBLIC
static void AddLanguage( SfxItemSet
& rSet
, SvNumberFormatter
& rFormatter
);
704 /** Obtain the ordinal suffix for a number according to the system locale */
705 static String
GetOrdinalSuffix( sal_Int32 nNumber
);
709 //==================================================================
710 // evtl. in dbdata.hxx auslagern (?):
727 SC_DOES_NOT_BEGIN_WITH
,
732 // -----------------------------------------------------------------------
740 // -----------------------------------------------------------------------
744 SUBTOTAL_FUNC_NONE
= 0,
745 SUBTOTAL_FUNC_AVE
= 1,
746 SUBTOTAL_FUNC_CNT
= 2,
747 SUBTOTAL_FUNC_CNT2
= 3,
748 SUBTOTAL_FUNC_MAX
= 4,
749 SUBTOTAL_FUNC_MIN
= 5,
750 SUBTOTAL_FUNC_PROD
= 6,
751 SUBTOTAL_FUNC_STD
= 7,
752 SUBTOTAL_FUNC_STDP
= 8,
753 SUBTOTAL_FUNC_SUM
= 9,
754 SUBTOTAL_FUNC_VAR
= 10,
755 SUBTOTAL_FUNC_VARP
= 11
759 #define PIVOT_MAXFUNC 11
760 #define PIVOT_FUNC_NONE 0x0000
761 #define PIVOT_FUNC_SUM 0x0001
762 #define PIVOT_FUNC_COUNT 0x0002
763 #define PIVOT_FUNC_AVERAGE 0x0004
764 #define PIVOT_FUNC_MAX 0x0008
765 #define PIVOT_FUNC_MIN 0x0010
766 #define PIVOT_FUNC_PRODUCT 0x0020
767 #define PIVOT_FUNC_COUNT_NUM 0x0040
768 #define PIVOT_FUNC_STD_DEV 0x0080
769 #define PIVOT_FUNC_STD_DEVP 0x0100
770 #define PIVOT_FUNC_STD_VAR 0x0200
771 #define PIVOT_FUNC_STD_VARP 0x0400
772 #define PIVOT_FUNC_AUTO 0x1000
774 // -----------------------------------------------------------------------
777 * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer"
778 * als Konstanten SC_EMPTYFIELDS bzw. SC_NONEMPTYFIELDS in nVal in
779 * Verbindung mit dem Schalter bQueryByString auf FALSE.
782 #define SC_EMPTYFIELDS ((double)0x0042)
783 #define SC_NONEMPTYFIELDS ((double)0x0043)
797 ScQueryConnect eConnect
;
800 utl::SearchParam
* pSearchParam
; // falls RegExp, nicht gespeichert
801 utl::TextSearch
* pSearchText
; // falls RegExp, nicht gespeichert
804 ScQueryEntry(const ScQueryEntry
& r
);
807 // legt ggbf. pSearchParam und pSearchText an, immer RegExp!
808 utl::TextSearch
* GetSearchTextPtr( BOOL bCaseSens
);
811 ScQueryEntry
& operator=( const ScQueryEntry
& r
);
812 BOOL
operator==( const ScQueryEntry
& r
) const;
815 struct SC_DLLPUBLIC ScQueryParam
828 BOOL bMixedComparison
; // whether numbers are smaller than strings
830 BOOL bDestPers
; // nicht gespeichert
834 SCROW nDynamicEndRow
;
835 bool bUseDynamicRange
;
839 ScQueryEntry
* pEntries
;
843 ScQueryParam( const ScQueryParam
& r
);
846 SCSIZE
GetEntryCount() const { return nEntryCount
; }
847 ScQueryEntry
& GetEntry(SCSIZE n
) const { return pEntries
[n
]; }
848 void Resize(SCSIZE nNew
);
850 ScQueryParam
& operator= ( const ScQueryParam
& r
);
851 BOOL
operator== ( const ScQueryParam
& rOther
) const;
853 void DeleteQuery( SCSIZE nPos
);
856 void FillInExcelSyntax(String
& aCellStr
, SCSIZE nIndex
);
859 // -----------------------------------------------------------------------
861 struct SC_DLLPUBLIC ScSubTotalParam
863 SCCOL nCol1
; // Selektierter Bereich
868 BOOL bReplace
; // vorhandene Ergebnisse ersetzen
869 BOOL bPagebreak
; // Seitenumbruch bei Gruppenwechsel
870 BOOL bCaseSens
; // Gross-/Kleinschreibung
871 BOOL bDoSort
; // vorher sortieren
872 BOOL bAscending
; // aufsteigend sortieren
873 BOOL bUserDef
; // Benutzer-def. Sort.Reihenfolge
874 USHORT nUserIndex
; // Index auf Liste
875 BOOL bIncludePattern
; // Formate mit sortieren
876 BOOL bGroupActive
[MAXSUBTOTAL
]; // aktive Gruppen
877 SCCOL nField
[MAXSUBTOTAL
]; // zugehoeriges Feld
878 SCCOL nSubTotals
[MAXSUBTOTAL
]; // Anzahl der SubTotals
879 SCCOL
* pSubTotals
[MAXSUBTOTAL
]; // Array der zu berechnenden Spalten
880 ScSubTotalFunc
* pFunctions
[MAXSUBTOTAL
]; // Array der zugehoerige Funktionen
883 ScSubTotalParam( const ScSubTotalParam
& r
);
885 ScSubTotalParam
& operator= ( const ScSubTotalParam
& r
);
886 BOOL
operator== ( const ScSubTotalParam
& r
) const;
888 void SetSubTotals ( USHORT nGroup
,
889 const SCCOL
* ptrSubTotals
,
890 const ScSubTotalFunc
* ptrFuncions
,
894 // -----------------------------------------------------------------------
897 struct ScConsolidateParam
899 SCCOL nCol
; // Cursor Position /
900 SCROW nRow
; // bzw. Anfang des Zielbereiches
902 ScSubTotalFunc eFunction
; // Berechnungsvorschrift
903 USHORT nDataAreaCount
; // Anzahl der Datenbereiche
904 ScArea
** ppDataAreas
; // Zeiger-Array auf Datenbereiche
905 BOOL bByCol
; // nach Spalten
906 BOOL bByRow
; // nach Zeilen
907 BOOL bReferenceData
; // Quelldaten referenzieren
909 ScConsolidateParam();
910 ScConsolidateParam( const ScConsolidateParam
& r
);
911 ~ScConsolidateParam();
913 ScConsolidateParam
& operator= ( const ScConsolidateParam
& r
);
914 BOOL
operator== ( const ScConsolidateParam
& r
) const;
915 void Clear (); // = ClearDataAreas()+Members
916 void ClearDataAreas ();
917 void SetAreas ( ScArea
* const* ppAreas
, USHORT nCount
);
920 // -----------------------------------------------------------------------
922 class ScSimpleSharedString
925 static const sal_Int32 EMPTY
= 0;
927 ScSimpleSharedString();
928 ScSimpleSharedString(const ScSimpleSharedString
& r
);
929 ~ScSimpleSharedString();
931 const String
* getString(sal_Int32 nId
);
932 sal_Int32
getStringId(const String
& aStr
);
933 sal_Int32
insertString(const String
& aStr
);
937 /** internal shared string table implementation */
941 sal_Int32
insertString(const String
& aStr
);
942 sal_Int32
getStringId(const String
& aStr
);
943 const String
* getString(sal_Int32 nId
) const;
946 StringTable(const StringTable
& r
);
950 typedef ::std::hash_map
< String
, sal_Int32
, ScStringHashCode
, ::std::equal_to
< String
> > SharedStrMap
;
952 ::std::vector
<String
> maSharedStrings
;
953 SharedStrMap maSharedStringIds
;
954 sal_Int32 mnStrCount
;
957 StringTable maStringTable
;
960 // -----------------------------------------------------------------------
961 extern ::utl::TransliterationWrapper
* GetScGlobalpTransliteration();//CHINA001
962 extern const LocaleDataWrapper
* GetScGlobalpLocaleData();