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 <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 <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 30539 : inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 72; }
144 47918 : inline long HMMToTwips( long nHMM ) { return (nHMM * 72 + 63) / 127; }
145 8 : 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 : /** Default cell clone flags: do not start listening, do not adjust 3D refs to
259 : old position, clone note captions of cell notes. */
260 : const int SC_CLONECELL_DEFAULT = 0x0000;
261 :
262 : /** If set, cloned formula cells will start to listen to the document. */
263 : const int SC_CLONECELL_STARTLISTENING = 0x0001;
264 :
265 : /** If set, relative 3D references of cloned formula cells will be adjusted to
266 : old position (used while swapping cells for sorting a cell range). */
267 : const int SC_CLONECELL_ADJUST3DREL = 0x0002;
268 :
269 : /** If set, the caption object of a cell note will not be cloned (used while
270 : copying cells to undo document, where captions are handled in drawing undo). */
271 : const int SC_CLONECELL_NOCAPTION = 0x0004;
272 :
273 : /** If set, absolute refs will not transformed to external references */
274 : const int SC_CLONECELL_NOMAKEABS_EXTERNAL = 0x0008;
275 :
276 : #ifndef DELETEZ
277 : #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
278 : #endif
279 :
280 : // is bit set in set?
281 : #define IS_SET(bit,set)(((set)&(bit))==(bit))
282 :
283 : enum CellType
284 : {
285 : CELLTYPE_NONE,
286 : CELLTYPE_VALUE,
287 : CELLTYPE_STRING,
288 : CELLTYPE_FORMULA,
289 : CELLTYPE_EDIT,
290 : };
291 :
292 : enum DelCellCmd
293 : {
294 : DEL_CELLSUP,
295 : DEL_CELLSLEFT,
296 : DEL_DELROWS,
297 : DEL_DELCOLS,
298 : DEL_NONE
299 : };
300 :
301 : enum InsCellCmd
302 : {
303 : INS_CELLSDOWN,
304 : INS_CELLSRIGHT,
305 : INS_INSROWS,
306 : INS_INSCOLS,
307 : INS_NONE
308 : };
309 :
310 : enum UpdateRefMode
311 : {
312 : URM_INSDEL,
313 : URM_COPY,
314 : URM_MOVE,
315 : URM_REORDER
316 : };
317 :
318 : enum FillDir
319 : {
320 : FILL_TO_BOTTOM,
321 : FILL_TO_RIGHT,
322 : FILL_TO_TOP,
323 : FILL_TO_LEFT
324 : };
325 :
326 : enum FillCmd
327 : {
328 : FILL_SIMPLE,
329 : FILL_LINEAR,
330 : FILL_GROWTH,
331 : FILL_DATE,
332 : FILL_AUTO
333 : };
334 :
335 : enum ScMoveDirection
336 : {
337 : SC_MOVE_RIGHT,
338 : SC_MOVE_LEFT,
339 : SC_MOVE_UP,
340 : SC_MOVE_DOWN
341 : };
342 :
343 : enum FillDateCmd
344 : {
345 : FILL_DAY,
346 : FILL_WEEKDAY,
347 : FILL_MONTH,
348 : FILL_YEAR
349 : };
350 :
351 : enum ScDirection
352 : {
353 : DIR_BOTTOM,
354 : DIR_RIGHT,
355 : DIR_TOP,
356 : DIR_LEFT
357 : };
358 :
359 : enum ScSizeMode
360 : {
361 : SC_SIZE_DIRECT, // set size or hide if value is 0
362 : SC_SIZE_OPTIMAL, // set optimal size for everything
363 : SC_SIZE_SHOW, // show with original size
364 : SC_SIZE_VISOPT, // set optimal size only if visible
365 : SC_SIZE_ORIGINAL // only set size, don't change visible flag
366 : };
367 :
368 : enum ScInputMode
369 : {
370 : SC_INPUT_NONE,
371 : SC_INPUT_TYPE, // input, while not in inplace mode
372 : SC_INPUT_TABLE, // text cursor in the table
373 : SC_INPUT_TOP // text cursor in the input line
374 : };
375 :
376 : enum ScVObjMode // output modes of objects on a page
377 : {
378 : VOBJ_MODE_SHOW,
379 : VOBJ_MODE_HIDE
380 : };
381 :
382 : enum ScAnchorType // anchor of a character object
383 : {
384 : SCA_CELL,
385 : SCA_PAGE,
386 : SCA_DONTKNOW // for multi selection
387 : };
388 :
389 : enum ScGetDBMode
390 : {
391 : SC_DB_MAKE, // create "untitled" (if necessary)
392 : SC_DB_IMPORT, // create "Importx" (if necessary)
393 : SC_DB_OLD // don't create
394 : };
395 :
396 : /// For ScDBFunc::GetDBData()
397 : enum ScGetDBSelection
398 : {
399 : /** Keep selection as is, expand to used data area if no selection. */
400 : SC_DBSEL_KEEP,
401 :
402 : /** Shrink selection to sheet's data area. */
403 : SC_DBSEL_SHRINK_TO_SHEET_DATA,
404 :
405 : /** Shrink selection to actually used data area within the selection. */
406 : SC_DBSEL_SHRINK_TO_USED_DATA,
407 :
408 : /** If only one row or portion thereof is selected, shrink row to used data
409 : columns and select further rows down until end of data. If an area is
410 : selected, shrink rows to actually used columns. Else, no selection,
411 : expand to used data area. */
412 : SC_DBSEL_ROW_DOWN,
413 :
414 : /** Behave as if the range corresponding to a ScDBData area was selected,
415 : for API use. */
416 : SC_DBSEL_FORCE_MARK
417 : };
418 :
419 : enum ScLkUpdMode // modes for updating links
420 : {
421 : LM_ALWAYS,
422 : LM_NEVER,
423 : LM_ON_DEMAND,
424 : LM_UNKNOWN
425 : };
426 :
427 :
428 : // enum with values equal to old DBObject enum from sdb
429 : enum ScDBObject
430 : {
431 : ScDbTable,
432 : ScDbQuery
433 : };
434 :
435 : struct ScImportParam
436 : {
437 : SCCOL nCol1;
438 : SCROW nRow1;
439 : SCCOL nCol2;
440 : SCROW nRow2;
441 : bool bImport;
442 : OUString aDBName; // alias of data base
443 : OUString aStatement;
444 : bool bNative;
445 : bool bSql; // statement or name?
446 : sal_uInt8 nType; // enum DBObject
447 :
448 : ScImportParam();
449 : ScImportParam( const ScImportParam& r );
450 : ~ScImportParam();
451 :
452 : ScImportParam& operator= ( const ScImportParam& r );
453 : bool operator== ( const ScImportParam& r ) const;
454 : };
455 :
456 : struct ScStringHashCode
457 : {
458 12279 : size_t operator()( const String& rStr ) const
459 : {
460 12279 : return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
461 : }
462 : };
463 :
464 : class ScDocument;
465 : class ScDocShell;
466 : class ScDocShellRef;
467 : class SvxSearchItem;
468 : class ScAutoFormat;
469 : class FuncCollection;
470 : class ScUnoAddInCollection;
471 : class ScUserList;
472 : class SvxBrushItem;
473 : class ScFunctionList;
474 : class ScFunctionMgr;
475 : class SfxItemPool;
476 : class SdrModel;
477 : class EditTextObject;
478 : class SfxObjectShell;
479 : class SvNumberFormatter;
480 : class ScUnitConverter;
481 : class CharClass;
482 : class LocaleDataWrapper;
483 : class SvtSysLocale;
484 : class CalendarWrapper;
485 : class CollatorWrapper;
486 : class IntlWrapper;
487 : class OutputDevice;
488 :
489 : namespace com { namespace sun { namespace star {
490 : namespace lang {
491 : struct Locale;
492 : }
493 : namespace i18n {
494 : class XOrdinalSuffix;
495 : }
496 : }}}
497 : namespace utl {
498 : class TransliterationWrapper;
499 : }
500 :
501 : #ifndef _SCALC_EXE
502 : class ScGlobal
503 : {
504 : static SvxSearchItem* pSearchItem;
505 : static ScAutoFormat* pAutoFormat;
506 : static FuncCollection* pFuncCollection;
507 : static ScUnoAddInCollection* pAddInCollection;
508 : static ScUserList* pUserList;
509 : static OUString** ppRscString;
510 : static String* pStrScDoc;
511 : static String* pEmptyString;
512 : static OUString* pEmptyOUString;
513 : static String* pStrClipDocName;
514 : static SvxBrushItem* pEmptyBrushItem;
515 : static SvxBrushItem* pButtonBrushItem;
516 : static SvxBrushItem* pEmbeddedBrushItem;
517 : static SvxBrushItem* pProtectedBrushItem;
518 :
519 : static ImageList* pOutlineBitmaps;
520 :
521 : static ScFunctionList* pStarCalcFunctionList;
522 : static ScFunctionMgr* pStarCalcFunctionMgr;
523 :
524 : static ScUnitConverter* pUnitConverter;
525 :
526 : static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export
527 :
528 : static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix;
529 : static CalendarWrapper* pCalendar;
530 : static CollatorWrapper* pCaseCollator;
531 : static CollatorWrapper* pCollator;
532 : static ::utl::TransliterationWrapper* pTransliteration;
533 : static ::utl::TransliterationWrapper* pCaseTransliteration;
534 : static IntlWrapper* pScIntlWrapper;
535 : static ::com::sun::star::lang::Locale* pLocale;
536 :
537 : public:
538 : static SvtSysLocale* pSysLocale;
539 : // for faster access a pointer to the single instance provided by SvtSysLocale
540 : SC_DLLPUBLIC static const CharClass* pCharClass;
541 : // for faster access a pointer to the single instance provided by SvtSysLocale
542 : SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData;
543 : SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData();
544 :
545 : static CalendarWrapper* GetCalendar();
546 : SC_DLLPUBLIC static CollatorWrapper* GetCollator();
547 : static CollatorWrapper* GetCaseCollator();
548 : static IntlWrapper* GetScIntlWrapper();
549 : static ::com::sun::star::lang::Locale* GetLocale();
550 :
551 : SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration();
552 : static ::utl::TransliterationWrapper* GetCaseTransliteration();
553 :
554 : SC_DLLPUBLIC static LanguageType eLnge;
555 : static sal_Unicode cListDelimiter;
556 :
557 : static const String& GetClipDocName();
558 : static void SetClipDocName( const String& rNew );
559 : SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem();
560 : SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew );
561 : SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat();
562 : SC_DLLPUBLIC static ScAutoFormat* GetOrCreateAutoFormat();
563 : static void ClearAutoFormat(); //BugId 54209
564 : static FuncCollection* GetFuncCollection();
565 : SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
566 : SC_DLLPUBLIC static ScUserList* GetUserList();
567 : static void SetUserList( const ScUserList* pNewList );
568 : SC_DLLPUBLIC static const OUString& GetRscString( sal_uInt16 nIndex );
569 : static void OpenURL( const String& rURL, const String& rTarget );
570 : SC_DLLPUBLIC static String GetAbsDocName( const String& rFileName,
571 : SfxObjectShell* pShell );
572 : SC_DLLPUBLIC static String GetDocTabName( const String& rFileName,
573 : const String& rTabName );
574 : SC_DLLPUBLIC static sal_uLong GetStandardFormat( SvNumberFormatter&,
575 : sal_uLong nFormat, short nType );
576 : SC_DLLPUBLIC static sal_uLong GetStandardFormat( double, SvNumberFormatter&,
577 : sal_uLong nFormat, short nType );
578 :
579 : SC_DLLPUBLIC static double nScreenPPTX;
580 : SC_DLLPUBLIC static double nScreenPPTY;
581 :
582 : static ScDocShellRef* pDrawClipDocShellRef;
583 :
584 : static sal_uInt16 nDefFontHeight;
585 : SC_DLLPUBLIC static sal_uInt16 nStdRowHeight;
586 :
587 : SC_DLLPUBLIC static long nLastRowHeightExtra;
588 : static long nLastColWidthExtra;
589 :
590 : static void Init(); // during start up
591 : static void InitAddIns();
592 : static void Clear(); // at the end of the program
593 :
594 : static void UpdatePPT(OutputDevice* pDev);
595 :
596 : static void InitTextHeight(SfxItemPool* pPool);
597 610 : static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; }
598 : static SvxBrushItem* GetButtonBrushItem();
599 : static SvxBrushItem* GetEmbeddedBrushItem() { return pEmbeddedBrushItem; }
600 60 : static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; }
601 : SC_DLLPUBLIC static const String& GetEmptyString();
602 : SC_DLLPUBLIC static const OUString& GetEmptyOUString();
603 : static const String& GetScDocString();
604 :
605 : /** Returns the specified image list with outline symbols. */
606 : static ImageList* GetOutlineSymbols();
607 :
608 : static bool HasStarCalcFunctionList();
609 : static ScFunctionList* GetStarCalcFunctionList();
610 : static ScFunctionMgr* GetStarCalcFunctionMgr();
611 : static void ResetFunctionList();
612 :
613 : static String GetErrorString(sal_uInt16 nErrNumber);
614 : static String GetLongErrorString(sal_uInt16 nErrNumber);
615 : static sal_Bool EETextObjEqual( const EditTextObject* pObj1,
616 : const EditTextObject* pObj2 );
617 : static sal_Bool CheckWidthInvalidate( bool& bNumFormatChanged,
618 : const SfxItemSet& rNewAttrs,
619 : const SfxItemSet& rOldAttrs );
620 : static sal_Bool HasAttrChanged( const SfxItemSet& rNewAttrs,
621 : const SfxItemSet& rOldAttrs,
622 : const sal_uInt16 nWhich );
623 :
624 : static ScUnitConverter* GetUnitConverter();
625 :
626 : /// strchr() functionality on unicode, as long as we need it for ScToken etc.
627 : static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c );
628 :
629 12098 : static inline sal_Unicode ToUpperAlpha( sal_Unicode c )
630 12098 : { return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; }
631 :
632 : /** Adds the string rToken to rTokenList, using a list separator character.
633 : @param rTokenList The string list where the token will be appended to.
634 : @param rToken The token string to append to the token list.
635 : @param cSep The character to separate the tokens.
636 : @param nSepCount Specifies how often cSep is inserted between two tokens.
637 : @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */
638 : SC_DLLPUBLIC static OUString addToken(
639 : const OUString& rTokenList, const OUString& rToken,
640 : sal_Unicode cSep, sal_Int32 nSepCount = 1,
641 : bool bForceSep = false );
642 :
643 : /** Returns true, if the first and last character of the string is cQuote. */
644 : SC_DLLPUBLIC static bool IsQuoted( const String& rString, sal_Unicode cQuote = '\'' );
645 :
646 : /** Inserts the character cQuote at beginning and end of rString.
647 : @param bEscapeEmbedded If <TRUE/>, embedded quote characters are
648 : escaped by doubling them.
649 : */
650 : SC_DLLPUBLIC static void AddQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true );
651 :
652 : /** Erases the character cQuote from rString, if it exists at beginning AND end.
653 : @param bUnescapeEmbedded If <TRUE/>, embedded doubled quote characters
654 : are unescaped by replacing them with a
655 : single instance.
656 : */
657 : SC_DLLPUBLIC static void EraseQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true );
658 :
659 : /** Finds an unquoted instance of cChar in rString, starting at
660 : offset nStart. Unquoted instances may occur when concatenating two
661 : quoted strings with a separator, for example, 's1':'s2'. Embedded
662 : quotes have to be escaped by being doubled. Caller must ensure that
663 : nStart points into an unquoted range or the opening quote. Specialty:
664 : if cChar==cQuote the first cQuote character from nStart on is found.
665 : @returns offset if found, else STRING_NOTFOUND
666 : */
667 : SC_DLLPUBLIC static xub_StrLen FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' );
668 :
669 : /** Finds an unquoted instance of cChar in null-terminated pString. Same
670 : semantics as FindUnquoted( const String&, ...)
671 : @returns: pointer to cChar if found, else NULL
672 : */
673 : SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' );
674 :
675 :
676 : static CharSet GetCharsetValue( const String& rCharSet );
677 : static String GetCharsetString( CharSet eVal );
678 :
679 : /// a "ReadOnly" formatter for UNO/XML export
680 : static SvNumberFormatter* GetEnglishFormatter();
681 :
682 : static sal_Bool IsSystemRTL(); // depending on system language
683 : static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage
684 : SC_DLLPUBLIC static sal_uInt8 GetDefaultScriptType(); // for all WEAK characters
685 : /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
686 : If more than one SCRIPTTYPE_... values are or'ed together, prefers
687 : first COMPLEX, then ASIAN */
688 : SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich );
689 :
690 : /** Adds a language item to the item set, if the number format item contains
691 : a language that differs from its parent's language. */
692 : SC_DLLPUBLIC static void AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter );
693 :
694 : /** Obtain the ordinal suffix for a number according to the system locale */
695 : static String GetOrdinalSuffix( sal_Int32 nNumber);
696 : };
697 : #endif
698 :
699 : // maybe move to dbdata.hxx (?):
700 :
701 : enum ScQueryOp
702 : {
703 : SC_EQUAL,
704 : SC_LESS,
705 : SC_GREATER,
706 : SC_LESS_EQUAL,
707 : SC_GREATER_EQUAL,
708 : SC_NOT_EQUAL,
709 : SC_TOPVAL,
710 : SC_BOTVAL,
711 : SC_TOPPERC,
712 : SC_BOTPERC,
713 : SC_CONTAINS,
714 : SC_DOES_NOT_CONTAIN,
715 : SC_BEGINS_WITH,
716 : SC_DOES_NOT_BEGIN_WITH,
717 : SC_ENDS_WITH,
718 : SC_DOES_NOT_END_WITH
719 : };
720 :
721 : enum ScQueryConnect
722 : {
723 : SC_AND,
724 : SC_OR
725 : };
726 :
727 : enum ScSubTotalFunc
728 : {
729 : SUBTOTAL_FUNC_NONE = 0,
730 : SUBTOTAL_FUNC_AVE = 1,
731 : SUBTOTAL_FUNC_CNT = 2,
732 : SUBTOTAL_FUNC_CNT2 = 3,
733 : SUBTOTAL_FUNC_MAX = 4,
734 : SUBTOTAL_FUNC_MIN = 5,
735 : SUBTOTAL_FUNC_PROD = 6,
736 : SUBTOTAL_FUNC_STD = 7,
737 : SUBTOTAL_FUNC_STDP = 8,
738 : SUBTOTAL_FUNC_SUM = 9,
739 : SUBTOTAL_FUNC_VAR = 10,
740 : SUBTOTAL_FUNC_VARP = 11,
741 : SUBTOTAL_FUNC_SELECTION_COUNT = 12
742 : };
743 :
744 : class ScArea;
745 :
746 : struct ScConsolidateParam
747 : {
748 : SCCOL nCol; // cursor position /
749 : SCROW nRow; // or start of destination area respectively
750 : SCTAB nTab;
751 : ScSubTotalFunc eFunction;
752 : sal_uInt16 nDataAreaCount; // number of data areas
753 : ScArea** ppDataAreas; // array of pointers into data areas
754 : sal_Bool bByCol;
755 : sal_Bool bByRow;
756 : sal_Bool bReferenceData; // reference source data
757 :
758 : ScConsolidateParam();
759 : ScConsolidateParam( const ScConsolidateParam& r );
760 : ~ScConsolidateParam();
761 :
762 : ScConsolidateParam& operator= ( const ScConsolidateParam& r );
763 : sal_Bool operator== ( const ScConsolidateParam& r ) const;
764 : void Clear (); // = ClearDataAreas()+Members
765 : void ClearDataAreas ();
766 : void SetAreas ( ScArea* const* ppAreas, sal_uInt16 nCount );
767 : };
768 :
769 : #endif
770 :
771 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|