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