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