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