Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_SCGLOB_HXX
30 : : #define SC_SCGLOB_HXX
31 : :
32 : : #include "address.hxx"
33 : : #include <i18npool/lang.h>
34 : : #include <tools/stream.hxx>
35 : : #include <osl/endian.h>
36 : : #include <com/sun/star/uno/Reference.hxx>
37 : : #include "scdllapi.h"
38 : : #include <rtl/ustring.hxx>
39 : :
40 : : #include <boost/unordered_map.hpp>
41 : : #include <vector>
42 : :
43 : : class ImageList;
44 : : class Bitmap;
45 : : class SfxItemSet;
46 : : class Color;
47 : :
48 : : // Macro for call profiler (WinNT)
49 : : // S_CAP starts a measurement, E_CAP stops it
50 : : #if defined( WNT ) && defined( PROFILE )
51 : :
52 : : extern "C" {
53 : : void StartCAP();
54 : : void StopCAP();
55 : : void DumpCAP();
56 : : };
57 : :
58 : : #define S_CAP StartCAP();
59 : : #define E_CAP StopCAP(); DumpCAP();
60 : :
61 : : #endif
62 : :
63 : : #define SC_COLLATOR_IGNORES ( \
64 : : ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
65 : :
66 : : #define SC_TRANSLITERATION_IGNORECASE ( \
67 : : ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE )
68 : : #define SC_TRANSLITERATION_CASESENSE 0
69 : :
70 : : // Calc has lots of names...
71 : : // Clipboard names are in so3/soapp.hxx now
72 : : // STRING_SCAPP was "scalc3", "scalc4", now just "scalc"
73 : :
74 : : #define STRING_SCAPP "scalc"
75 : : #define STRING_SCSTREAM "StarCalcDocument"
76 : :
77 : : #define STRING_STANDARD "Standard"
78 : :
79 : : // characters
80 : :
81 : : // '\r' does not work on a Mac...
82 : : #define CHAR_CR char(13)
83 : :
84 : : const sal_Unicode CHAR_NBSP = 0x00A0;
85 : : const sal_Unicode CHAR_SHY = 0x00AD;
86 : : const sal_Unicode CHAR_ZWSP = 0x200B;
87 : : const sal_Unicode CHAR_LRM = 0x200E;
88 : : const sal_Unicode CHAR_RLM = 0x200F;
89 : : const sal_Unicode CHAR_NBHY = 0x2011;
90 : : const sal_Unicode CHAR_ZWNBSP = 0x2060;
91 : :
92 : : // ----------------------------------------------------------------------------
93 : :
94 : : #define MINDOUBLE 1.7e-307
95 : : #define MAXDOUBLE 1.7e307
96 : :
97 : : #define MINZOOM 20
98 : : #define MAXZOOM 400
99 : :
100 : : const SCSIZE MAXSUBTOTAL = 3;
101 : :
102 : : #define SC_START_INDEX_DB_COLL 50000
103 : : // Above this threshold are indices
104 : : // for data base areas
105 : :
106 : : #define SC_USE_PS_POINTS 1 /**< use PostScript points (72ppi) instead of old TeX points (72.27ppi) */
107 : :
108 : : #define PIXEL_PER_INCH 96.0
109 : :
110 : : #define CM_PER_INCH 2.54
111 : : #define PS_POINTS_PER_INCH 72.0 /**< PostScript points per inch */
112 : : #define TEX_POINTS_PER_INCH 72.27 /**< old printer points, or TeX points per inch */
113 : : #if SC_USE_PS_POINTS
114 : : #define POINTS_PER_INCH PS_POINTS_PER_INCH /**< the actual definition of points used */
115 : : #else
116 : : #define POINTS_PER_INCH TEX_POINTS_PER_INCH
117 : : #endif
118 : : #define PIXEL_PER_POINT (PIXEL_PER_INCH / POINTS_PER_INCH)
119 : : #define TWIPS_PER_POINT 20.0
120 : : #define TWIPS_PER_INCH (TWIPS_PER_POINT * POINTS_PER_INCH)
121 : : #define TWIPS_PER_CM (TWIPS_PER_INCH / CM_PER_INCH)
122 : : #define CM_PER_TWIPS (CM_PER_INCH / TWIPS_PER_INCH)
123 : : #define TWIPS_PER_PIXEL (TWIPS_PER_INCH / PIXEL_PER_INCH)
124 : : #define TWIPS_PER_CHAR (TWIPS_PER_INCH / 13.6)
125 : : #define PIXEL_PER_TWIPS (PIXEL_PER_INCH / TWIPS_PER_INCH)
126 : : #define HMM_PER_TWIPS (CM_PER_TWIPS * 1000.0)
127 : :
128 : : #if SC_USE_PS_POINTS
129 : : #define STD_COL_WIDTH 1280 /* 2.2577cm, 64.00pt PS */
130 : : #else
131 : : #define STD_COL_WIDTH 1285 /* 2.2581cm, 64.25pt TeX */
132 : : #endif
133 : : #define STD_EXTRA_WIDTH 113 /* 2mm extra for optimal width,
134 : : * 0.1986cm with TeX points,
135 : : * 0.1993cm with PS points. */
136 : :
137 : :
138 : : #define MAX_EXTRA_WIDTH 23811 /* 42cm in TWIPS, 41.8430cm TeX, 41.9999cm PS */
139 : : #define MAX_EXTRA_HEIGHT 23811
140 : : #define MAX_COL_WIDTH 56693 /* 1m in TWIPS, 99.6266cm TeX, 100.0001cm PS */
141 : : #define MAX_ROW_HEIGHT 56693
142 : :
143 : : /* standard row height: text + margin - STD_ROWHEIGHT_DIFF */
144 : : #define STD_ROWHEIGHT_DIFF 23
145 : :
146 : : /// use ScGlobal::nStdRowHeight instead of STD_ROW_HEIGHT !
147 : :
148 : : #define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) /* 256 Twips, 0.45 cm */
149 : :
150 : : namespace sc
151 : : {
152 : 22377 : inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 72; }
153 : 5504 : inline long HMMToTwips( long nHMM ) { return (nHMM * 72 + 63) / 127; }
154 : 4 : inline long TwipsToEvenHMM( long nTwips ) { return ( (nTwips * 127 + 72) / 144 ) * 2; }
155 : : }
156 : :
157 : : // standard size as OLE server (cells)
158 : : #define OLE_STD_CELLS_X 4
159 : : #define OLE_STD_CELLS_Y 5
160 : :
161 : : #define SC_SIZE_OPTIMUM 0xFFFF
162 : :
163 : : // repaint flags (for messages)
164 : : #define PAINT_GRID 1
165 : : #define PAINT_TOP 2
166 : : #define PAINT_LEFT 4
167 : : #define PAINT_EXTRAS 8
168 : : #define PAINT_MARKS 16
169 : : #define PAINT_OBJECTS 32
170 : : #define PAINT_SIZE 64
171 : : #define PAINT_ALL ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE )
172 : :
173 : :
174 : : // flags for columns / rows
175 : : // FILTERED always together with HIDDEN
176 : : // FILTERED and MANUALSIZE only valid for rows
177 : : const sal_uInt8 CR_HIDDEN = 1;
178 : : const sal_uInt8 CR_MANUALBREAK = 8;
179 : : const sal_uInt8 CR_FILTERED = 16;
180 : : const sal_uInt8 CR_MANUALSIZE = 32;
181 : : const sal_uInt8 CR_ALL = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE);
182 : :
183 : : typedef sal_uInt8 ScBreakType;
184 : : const ScBreakType BREAK_NONE = 0;
185 : : const ScBreakType BREAK_PAGE = 1;
186 : : const ScBreakType BREAK_MANUAL = 2;
187 : :
188 : : // insert/delete flags
189 : : const sal_uInt16 IDF_NONE = 0x0000;
190 : : const sal_uInt16 IDF_VALUE = 0x0001; /// Numeric values (and numeric results if IDF_FORMULA is not set).
191 : : const sal_uInt16 IDF_DATETIME = 0x0002; /// Dates, times, datetime values.
192 : : const sal_uInt16 IDF_STRING = 0x0004; /// Strings (and string results if IDF_FORMULA is not set).
193 : : const sal_uInt16 IDF_NOTE = 0x0008; /// Cell notes.
194 : : const sal_uInt16 IDF_FORMULA = 0x0010; /// Formula cells.
195 : : const sal_uInt16 IDF_HARDATTR = 0x0020; /// Hard cell attributes.
196 : : const sal_uInt16 IDF_STYLES = 0x0040; /// Cell styles.
197 : : const sal_uInt16 IDF_OBJECTS = 0x0080; /// Drawing objects.
198 : : const sal_uInt16 IDF_EDITATTR = 0x0100; /// Rich-text attributes.
199 : : const sal_uInt16 IDF_SPECIAL_BOOLEAN = 0x1000;
200 : : const sal_uInt16 IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES;
201 : : const sal_uInt16 IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA;
202 : : const sal_uInt16 IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
203 : : const sal_uInt16 IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
204 : : const sal_uInt16 IDF_ADDNOTES = 0x0400; /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
205 : :
206 : : /// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
207 : : const sal_uInt16 IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS);
208 : :
209 : : #define PASTE_NOFUNC 0
210 : : #define PASTE_ADD 1
211 : : #define PASTE_SUB 2
212 : : #define PASTE_MUL 3
213 : : #define PASTE_DIV 4
214 : :
215 : : // bits for HasAttr
216 : : #define HASATTR_LINES 1
217 : : #define HASATTR_MERGED 2
218 : : #define HASATTR_OVERLAPPED 4
219 : : #define HASATTR_PROTECTED 8
220 : : #define HASATTR_SHADOW 16
221 : : #define HASATTR_NEEDHEIGHT 32
222 : : #define HASATTR_SHADOW_RIGHT 64
223 : : #define HASATTR_SHADOW_DOWN 128
224 : : #define HASATTR_AUTOFILTER 256
225 : : #define HASATTR_CONDITIONAL 512
226 : : #define HASATTR_ROTATE 1024
227 : : #define HASATTR_NOTOVERLAPPED 2048
228 : : #define HASATTR_RTL 4096
229 : : #define HASATTR_RIGHTORCENTER 8192 // right or centered logical alignment
230 : :
231 : : #define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL )
232 : :
233 : :
234 : : #define EMPTY_STRING ScGlobal::GetEmptyString()
235 : : #define EMPTY_OUSTRING ScGlobal::GetEmptyOUString()
236 : :
237 : : // layer id's for drawing
238 : : #define SC_LAYER_FRONT 0
239 : : #define SC_LAYER_BACK 1
240 : : #define SC_LAYER_INTERN 2
241 : : #define SC_LAYER_CONTROLS 3
242 : : #define SC_LAYER_HIDDEN 4
243 : :
244 : : // link tables
245 : : #define SC_LINK_NONE 0
246 : : #define SC_LINK_NORMAL 1
247 : : #define SC_LINK_VALUE 2
248 : :
249 : : // input
250 : : #define SC_ENTER_NORMAL 0
251 : : #define SC_ENTER_BLOCK 1
252 : : #define SC_ENTER_MATRIX 2
253 : :
254 : : // step = 10pt, max. indention = 100 steps
255 : : #define SC_INDENT_STEP 200
256 : : #define SC_MAX_INDENT 20000
257 : :
258 : : // scenario flags
259 : : #define SC_SCENARIO_COPYALL 1
260 : : #define SC_SCENARIO_SHOWFRAME 2
261 : : #define SC_SCENARIO_PRINTFRAME 4
262 : : #define SC_SCENARIO_TWOWAY 8
263 : : #define SC_SCENARIO_ATTRIB 16
264 : : #define SC_SCENARIO_VALUE 32
265 : : #define SC_SCENARIO_PROTECT 64
266 : :
267 : :
268 : : #ifndef DELETEZ
269 : : #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
270 : : #endif
271 : :
272 : : // is bit set in set?
273 : : #define IS_SET(bit,set)(((set)&(bit))==(bit))
274 : :
275 : : enum CellType
276 : : {
277 : : CELLTYPE_NONE,
278 : : CELLTYPE_VALUE,
279 : : CELLTYPE_STRING,
280 : : CELLTYPE_FORMULA,
281 : : CELLTYPE_NOTE,
282 : : CELLTYPE_EDIT,
283 : : CELLTYPE_SYMBOLS // for load/save
284 : : #if OSL_DEBUG_LEVEL > 0
285 : : ,CELLTYPE_DESTROYED
286 : : #endif
287 : : };
288 : :
289 : : enum DelCellCmd
290 : : {
291 : : DEL_CELLSUP,
292 : : DEL_CELLSLEFT,
293 : : DEL_DELROWS,
294 : : DEL_DELCOLS,
295 : : DEL_NONE
296 : : };
297 : :
298 : : enum InsCellCmd
299 : : {
300 : : INS_CELLSDOWN,
301 : : INS_CELLSRIGHT,
302 : : INS_INSROWS,
303 : : INS_INSCOLS,
304 : : INS_NONE
305 : : };
306 : :
307 : : enum UpdateRefMode
308 : : {
309 : : URM_INSDEL,
310 : : URM_COPY,
311 : : URM_MOVE,
312 : : URM_REORDER
313 : : };
314 : :
315 : : enum FillDir
316 : : {
317 : : FILL_TO_BOTTOM,
318 : : FILL_TO_RIGHT,
319 : : FILL_TO_TOP,
320 : : FILL_TO_LEFT
321 : : };
322 : :
323 : : enum FillCmd
324 : : {
325 : : FILL_SIMPLE,
326 : : FILL_LINEAR,
327 : : FILL_GROWTH,
328 : : FILL_DATE,
329 : : FILL_AUTO
330 : : };
331 : :
332 : : enum ScMoveDirection
333 : : {
334 : : SC_MOVE_RIGHT,
335 : : SC_MOVE_LEFT,
336 : : SC_MOVE_UP,
337 : : SC_MOVE_DOWN
338 : : };
339 : :
340 : : enum FillDateCmd
341 : : {
342 : : FILL_DAY,
343 : : FILL_WEEKDAY,
344 : : FILL_MONTH,
345 : : FILL_YEAR
346 : : };
347 : :
348 : : enum ScDirection
349 : : {
350 : : DIR_BOTTOM,
351 : : DIR_RIGHT,
352 : : DIR_TOP,
353 : : DIR_LEFT
354 : : };
355 : :
356 : : enum ScSizeMode
357 : : {
358 : : SC_SIZE_DIRECT, // set size or hide if value is 0
359 : : SC_SIZE_OPTIMAL, // set optimal size for everything
360 : : SC_SIZE_SHOW, // show with original size
361 : : SC_SIZE_VISOPT, // set optimal size only if visible
362 : : SC_SIZE_ORIGINAL // only set size, don't change visible flag
363 : : };
364 : :
365 : : enum ScInputMode
366 : : {
367 : : SC_INPUT_NONE,
368 : : SC_INPUT_TYPE, // input, while not in inplace mode
369 : : SC_INPUT_TABLE, // text cursor in the table
370 : : SC_INPUT_TOP // text cursor in the input line
371 : : };
372 : :
373 : : enum ScVObjMode // output modes of objects on a page
374 : : {
375 : : VOBJ_MODE_SHOW,
376 : : VOBJ_MODE_HIDE
377 : : };
378 : :
379 : : enum ScAnchorType // anchor of a character object
380 : : {
381 : : SCA_CELL,
382 : : SCA_PAGE,
383 : : SCA_DONTKNOW // for multi selection
384 : : };
385 : :
386 : : enum ScGetDBMode
387 : : {
388 : : SC_DB_MAKE, // create "untitled" (if necessary)
389 : : SC_DB_IMPORT, // create "Importx" (if necessary)
390 : : SC_DB_OLD // don't create
391 : : };
392 : :
393 : : /// For ScDBFunc::GetDBData()
394 : : enum ScGetDBSelection
395 : : {
396 : : /** Keep selection as is, expand to used data area if no selection. */
397 : : SC_DBSEL_KEEP,
398 : :
399 : : /** Shrink selection to sheet's data area. */
400 : : SC_DBSEL_SHRINK_TO_SHEET_DATA,
401 : :
402 : : /** Shrink selection to actually used data area within the selection. */
403 : : SC_DBSEL_SHRINK_TO_USED_DATA,
404 : :
405 : : /** If only one row or portion thereof is selected, shrink row to used data
406 : : columns and select further rows down until end of data. If an area is
407 : : selected, shrink rows to actually used columns. Else, no selection,
408 : : expand to used data area. */
409 : : SC_DBSEL_ROW_DOWN,
410 : :
411 : : /** Behave as if the range corresponding to a ScDBData area was selected,
412 : : for API use. */
413 : : SC_DBSEL_FORCE_MARK
414 : : };
415 : :
416 : : enum ScLkUpdMode // modes for updating links
417 : : {
418 : : LM_ALWAYS,
419 : : LM_NEVER,
420 : : LM_ON_DEMAND,
421 : : LM_UNKNOWN
422 : : };
423 : :
424 : :
425 : : // enum with values equal to old DBObject enum from sdb
426 : : enum ScDBObject
427 : : {
428 : : ScDbTable,
429 : : ScDbQuery
430 : : };
431 : :
432 : : struct ScImportParam
433 : : {
434 : : SCCOL nCol1;
435 : : SCROW nRow1;
436 : : SCCOL nCol2;
437 : : SCROW nRow2;
438 : : bool bImport;
439 : : ::rtl::OUString aDBName; // alias of data base
440 : : ::rtl::OUString aStatement;
441 : : bool bNative;
442 : : bool bSql; // statement or name?
443 : : sal_uInt8 nType; // enum DBObject
444 : :
445 : : ScImportParam();
446 : : ScImportParam( const ScImportParam& r );
447 : : ~ScImportParam();
448 : :
449 : : ScImportParam& operator= ( const ScImportParam& r );
450 : : bool operator== ( const ScImportParam& r ) const;
451 : : };
452 : :
453 : : struct ScStringHashCode
454 : : {
455 : 15242 : size_t operator()( const String& rStr ) const
456 : : {
457 : 15242 : return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
458 : : }
459 : : };
460 : :
461 : : class ScDocument;
462 : : class ScDocShell;
463 : : class ScDocShellRef;
464 : : class SvxSearchItem;
465 : : class ScAutoFormat;
466 : : class FuncCollection;
467 : : class ScUnoAddInCollection;
468 : : class ScUserList;
469 : : class SvxBrushItem;
470 : : class ScFunctionList;
471 : : class ScFunctionMgr;
472 : : class SfxItemPool;
473 : : class SdrModel;
474 : : class EditTextObject;
475 : : class SfxObjectShell;
476 : : class SvNumberFormatter;
477 : : class ScUnitConverter;
478 : : class CharClass;
479 : : class LocaleDataWrapper;
480 : : class SvtSysLocale;
481 : : class CalendarWrapper;
482 : : class CollatorWrapper;
483 : : class IntlWrapper;
484 : : class OutputDevice;
485 : :
486 : : namespace com { namespace sun { namespace star {
487 : : namespace lang {
488 : : struct Locale;
489 : : }
490 : : namespace i18n {
491 : : class XOrdinalSuffix;
492 : : }
493 : : }}}
494 : : namespace utl {
495 : : class TransliterationWrapper;
496 : : }
497 : :
498 : : #ifndef _SCALC_EXE
499 : : class ScGlobal
500 : : {
501 : : static SvxSearchItem* pSearchItem;
502 : : static ScAutoFormat* pAutoFormat;
503 : : static FuncCollection* pFuncCollection;
504 : : static ScUnoAddInCollection* pAddInCollection;
505 : : static ScUserList* pUserList;
506 : : static String** ppRscString;
507 : : static String* pStrScDoc;
508 : : static String* pEmptyString;
509 : : static ::rtl::OUString* pEmptyOUString;
510 : : static String* pStrClipDocName;
511 : : static SvxBrushItem* pEmptyBrushItem;
512 : : static SvxBrushItem* pButtonBrushItem;
513 : : static SvxBrushItem* pEmbeddedBrushItem;
514 : : static SvxBrushItem* pProtectedBrushItem;
515 : :
516 : : static ImageList* pOutlineBitmaps;
517 : :
518 : : static ScFunctionList* pStarCalcFunctionList;
519 : : static ScFunctionMgr* pStarCalcFunctionMgr;
520 : :
521 : : static ScUnitConverter* pUnitConverter;
522 : :
523 : : static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export
524 : :
525 : : static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix;
526 : : static CalendarWrapper* pCalendar;
527 : : static CollatorWrapper* pCaseCollator;
528 : : static CollatorWrapper* pCollator;
529 : : static ::utl::TransliterationWrapper* pTransliteration;
530 : : static ::utl::TransliterationWrapper* pCaseTransliteration;
531 : : static IntlWrapper* pScIntlWrapper;
532 : : static ::com::sun::star::lang::Locale* pLocale;
533 : :
534 : : public:
535 : : static SvtSysLocale* pSysLocale;
536 : : // for faster access a pointer to the single instance provided by SvtSysLocale
537 : : SC_DLLPUBLIC static const CharClass* pCharClass;
538 : : // for faster access a pointer to the single instance provided by SvtSysLocale
539 : : SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData;
540 : : SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData();
541 : :
542 : : static CalendarWrapper* GetCalendar();
543 : : SC_DLLPUBLIC static CollatorWrapper* GetCollator();
544 : : static CollatorWrapper* GetCaseCollator();
545 : : static IntlWrapper* GetScIntlWrapper();
546 : : static ::com::sun::star::lang::Locale* GetLocale();
547 : :
548 : : SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration();
549 : : static ::utl::TransliterationWrapper* GetCaseTransliteration();
550 : :
551 : : SC_DLLPUBLIC static LanguageType eLnge;
552 : : static sal_Unicode cListDelimiter;
553 : :
554 : : static const String& GetClipDocName();
555 : : static void SetClipDocName( const String& rNew );
556 : : SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem();
557 : : SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew );
558 : : SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat();
559 : : SC_DLLPUBLIC static ScAutoFormat* GetOrCreateAutoFormat();
560 : : static void ClearAutoFormat(); //BugId 54209
561 : : static FuncCollection* GetFuncCollection();
562 : : SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
563 : : SC_DLLPUBLIC static ScUserList* GetUserList();
564 : : static void SetUserList( const ScUserList* pNewList );
565 : : SC_DLLPUBLIC static const String& GetRscString( sal_uInt16 nIndex );
566 : : static void OpenURL( const String& rURL, const String& rTarget );
567 : : SC_DLLPUBLIC static String GetAbsDocName( const String& rFileName,
568 : : SfxObjectShell* pShell );
569 : : SC_DLLPUBLIC static String GetDocTabName( const String& rFileName,
570 : : const String& rTabName );
571 : : SC_DLLPUBLIC static sal_uLong GetStandardFormat( SvNumberFormatter&,
572 : : sal_uLong nFormat, short nType );
573 : : SC_DLLPUBLIC static sal_uLong GetStandardFormat( double, SvNumberFormatter&,
574 : : sal_uLong nFormat, short nType );
575 : :
576 : : SC_DLLPUBLIC static double nScreenPPTX;
577 : : SC_DLLPUBLIC static double nScreenPPTY;
578 : :
579 : : static ScDocShellRef* pDrawClipDocShellRef;
580 : :
581 : : static sal_uInt16 nDefFontHeight;
582 : : static sal_uInt16 nStdRowHeight;
583 : :
584 : : SC_DLLPUBLIC static long nLastRowHeightExtra;
585 : : static long nLastColWidthExtra;
586 : :
587 : : static void Init(); // during start up
588 : : static void InitAddIns();
589 : : static void Clear(); // at the end of the program
590 : :
591 : : static void UpdatePPT(OutputDevice* pDev);
592 : :
593 : : static void InitTextHeight(SfxItemPool* pPool);
594 : 900 : static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; }
595 : : static SvxBrushItem* GetButtonBrushItem();
596 : 0 : static SvxBrushItem* GetEmbeddedBrushItem() { return pEmbeddedBrushItem; }
597 : 0 : static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; }
598 : : SC_DLLPUBLIC static const String& GetEmptyString();
599 : : SC_DLLPUBLIC static const ::rtl::OUString& GetEmptyOUString();
600 : : static const String& GetScDocString();
601 : :
602 : : /** Returns the specified image list with outline symbols. */
603 : : static ImageList* GetOutlineSymbols();
604 : :
605 : : static bool HasStarCalcFunctionList();
606 : : static ScFunctionList* GetStarCalcFunctionList();
607 : : static ScFunctionMgr* GetStarCalcFunctionMgr();
608 : : static void ResetFunctionList();
609 : :
610 : : static String GetErrorString(sal_uInt16 nErrNumber);
611 : : static String GetLongErrorString(sal_uInt16 nErrNumber);
612 : : static sal_Bool EETextObjEqual( const EditTextObject* pObj1,
613 : : const EditTextObject* pObj2 );
614 : : static sal_Bool CheckWidthInvalidate( bool& bNumFormatChanged,
615 : : const SfxItemSet& rNewAttrs,
616 : : const SfxItemSet& rOldAttrs );
617 : : static sal_Bool HasAttrChanged( const SfxItemSet& rNewAttrs,
618 : : const SfxItemSet& rOldAttrs,
619 : : const sal_uInt16 nWhich );
620 : :
621 : : static ScUnitConverter* GetUnitConverter();
622 : :
623 : : /// strchr() functionality on unicode, as long as we need it for ScToken etc.
624 : : static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c );
625 : :
626 : 36278 : static inline sal_Unicode ToUpperAlpha( sal_Unicode c )
627 [ + + ][ + - ]: 36278 : { return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; }
628 : :
629 : : /** Adds the string rToken to rTokenList, using a list separator character.
630 : : @param rTokenList The string list where the token will be appended to.
631 : : @param rToken The token string to append to the token list.
632 : : @param cSep The character to separate the tokens.
633 : : @param nSepCount Specifies how often cSep is inserted between two tokens.
634 : : @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */
635 : : SC_DLLPUBLIC static void AddToken(
636 : : String& rTokenList, const String& rToken,
637 : : sal_Unicode cSep, xub_StrLen nSepCount = 1,
638 : : bool bForceSep = false );
639 : :
640 : : /** Returns true, if the first and last character of the string is cQuote. */
641 : : SC_DLLPUBLIC static bool IsQuoted( const String& rString, sal_Unicode cQuote = '\'' );
642 : :
643 : : /** Inserts the character cQuote at beginning and end of rString.
644 : : @param bEscapeEmbedded If <TRUE/>, embedded quote characters are
645 : : escaped by doubling them.
646 : : */
647 : : SC_DLLPUBLIC static void AddQuotes( String& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true );
648 : :
649 : : /** Erases the character cQuote from rString, if it exists at beginning AND end.
650 : : @param bUnescapeEmbedded If <TRUE/>, embedded doubled quote characters
651 : : are unescaped by replacing them with a
652 : : single instance.
653 : : */
654 : : SC_DLLPUBLIC static void EraseQuotes( String& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true );
655 : :
656 : : /** Finds an unquoted instance of cChar in rString, starting at
657 : : offset nStart. Unquoted instances may occur when concatenating two
658 : : quoted strings with a separator, for example, 's1':'s2'. Embedded
659 : : quotes have to be escaped by being doubled. Caller must ensure that
660 : : nStart points into an unquoted range or the opening quote. Specialty:
661 : : if cChar==cQuote the first cQuote character from nStart on is found.
662 : : @returns offset if found, else STRING_NOTFOUND
663 : : */
664 : : SC_DLLPUBLIC static xub_StrLen FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' );
665 : :
666 : : /** Finds an unquoted instance of cChar in null-terminated pString. Same
667 : : semantics as FindUnquoted( const String&, ...)
668 : : @returns: pointer to cChar if found, else NULL
669 : : */
670 : : SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' );
671 : :
672 : :
673 : : static CharSet GetCharsetValue( const String& rCharSet );
674 : : static String GetCharsetString( CharSet eVal );
675 : :
676 : : /// a "ReadOnly" formatter for UNO/XML export
677 : : static SvNumberFormatter* GetEnglishFormatter();
678 : :
679 : : static sal_Bool IsSystemRTL(); // depending on system language
680 : : static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage
681 : : SC_DLLPUBLIC static sal_uInt8 GetDefaultScriptType(); // for all WEAK characters
682 : : /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
683 : : If more than one SCRIPTTYPE_... values are or'ed together, prefers
684 : : first COMPLEX, then ASIAN */
685 : : SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich );
686 : :
687 : : /** Adds a language item to the item set, if the number format item contains
688 : : a language that differs from its parent's language. */
689 : : SC_DLLPUBLIC static void AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter );
690 : :
691 : : /** Obtain the ordinal suffix for a number according to the system locale */
692 : : static String GetOrdinalSuffix( sal_Int32 nNumber);
693 : : };
694 : : #endif
695 : :
696 : : // maybe move to dbdata.hxx (?):
697 : :
698 : : enum ScQueryOp
699 : : {
700 : : SC_EQUAL,
701 : : SC_LESS,
702 : : SC_GREATER,
703 : : SC_LESS_EQUAL,
704 : : SC_GREATER_EQUAL,
705 : : SC_NOT_EQUAL,
706 : : SC_TOPVAL,
707 : : SC_BOTVAL,
708 : : SC_TOPPERC,
709 : : SC_BOTPERC,
710 : : SC_CONTAINS,
711 : : SC_DOES_NOT_CONTAIN,
712 : : SC_BEGINS_WITH,
713 : : SC_DOES_NOT_BEGIN_WITH,
714 : : SC_ENDS_WITH,
715 : : SC_DOES_NOT_END_WITH
716 : : };
717 : :
718 : : enum ScQueryConnect
719 : : {
720 : : SC_AND,
721 : : SC_OR
722 : : };
723 : :
724 : : enum ScSubTotalFunc
725 : : {
726 : : SUBTOTAL_FUNC_NONE = 0,
727 : : SUBTOTAL_FUNC_AVE = 1,
728 : : SUBTOTAL_FUNC_CNT = 2,
729 : : SUBTOTAL_FUNC_CNT2 = 3,
730 : : SUBTOTAL_FUNC_MAX = 4,
731 : : SUBTOTAL_FUNC_MIN = 5,
732 : : SUBTOTAL_FUNC_PROD = 6,
733 : : SUBTOTAL_FUNC_STD = 7,
734 : : SUBTOTAL_FUNC_STDP = 8,
735 : : SUBTOTAL_FUNC_SUM = 9,
736 : : SUBTOTAL_FUNC_VAR = 10,
737 : : SUBTOTAL_FUNC_VARP = 11
738 : : };
739 : :
740 : : class ScArea;
741 : :
742 : : struct ScConsolidateParam
743 : : {
744 : : SCCOL nCol; // cursor position /
745 : : SCROW nRow; // or start of destination area respectively
746 : : SCTAB nTab;
747 : : ScSubTotalFunc eFunction;
748 : : sal_uInt16 nDataAreaCount; // number of data areas
749 : : ScArea** ppDataAreas; // array of pointers into data areas
750 : : sal_Bool bByCol;
751 : : sal_Bool bByRow;
752 : : sal_Bool bReferenceData; // reference source data
753 : :
754 : : ScConsolidateParam();
755 : : ScConsolidateParam( const ScConsolidateParam& r );
756 : : ~ScConsolidateParam();
757 : :
758 : : ScConsolidateParam& operator= ( const ScConsolidateParam& r );
759 : : sal_Bool operator== ( const ScConsolidateParam& r ) const;
760 : : void Clear (); // = ClearDataAreas()+Members
761 : : void ClearDataAreas ();
762 : : void SetAreas ( ScArea* const* ppAreas, sal_uInt16 nCount );
763 : : };
764 : :
765 : : #endif
766 : :
767 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|