update credits
[LibreOffice.git] / sc / inc / global.hxx
blob66f332030909fc3d15a704e139c5582b945fedcc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_SCGLOB_HXX
21 #define SC_SCGLOB_HXX
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>
31 #include <boost/unordered_map.hpp>
32 #include <vector>
34 class ImageList;
35 class Bitmap;
36 class SfxItemSet;
37 class Color;
39 // Macro for call profiler (WinNT)
40 // S_CAP starts a measurement, E_CAP stops it
41 #if defined( WNT ) && defined( PROFILE )
43 extern "C" {
44 void StartCAP();
45 void StopCAP();
46 void DumpCAP();
49 #define S_CAP StartCAP();
50 #define E_CAP StopCAP(); DumpCAP();
52 #endif
54 #define SC_COLLATOR_IGNORES ( \
55 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
57 #define SC_TRANSLITERATION_IGNORECASE ( \
58 ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE )
59 #define SC_TRANSLITERATION_CASESENSE 0
61 // Calc has lots of names...
62 // Clipboard names are in so3/soapp.hxx now
63 // STRING_SCAPP was "scalc3", "scalc4", now just "scalc"
65 #define STRING_SCAPP "scalc"
66 #define STRING_SCSTREAM "StarCalcDocument"
68 #define STRING_STANDARD "Standard"
70 // characters
72 // '\r' does not work on a Mac...
73 #define CHAR_CR char(13)
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;
83 // ----------------------------------------------------------------------------
85 #define MINDOUBLE 1.7e-307
86 #define MAXDOUBLE 1.7e307
88 #define MINZOOM 20
89 #define MAXZOOM 400
91 const SCSIZE MAXSUBTOTAL = 3;
93 #define SC_START_INDEX_DB_COLL 50000
94 // Above this threshold are indices
95 // for data base areas
97 #define SC_USE_PS_POINTS 1 /**< use PostScript points (72ppi) instead of old TeX points (72.27ppi) */
99 #define PIXEL_PER_INCH 96.0
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)
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. */
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
134 /* standard row height: text + margin - STD_ROWHEIGHT_DIFF */
135 #define STD_ROWHEIGHT_DIFF 23
137 /// use ScGlobal::nStdRowHeight instead of STD_ROW_HEIGHT !
139 #define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) /* 256 Twips, 0.45 cm */
141 namespace sc
143 inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 72; }
144 inline long HMMToTwips( long nHMM ) { return (nHMM * 72 + 63) / 127; }
145 inline long TwipsToEvenHMM( long nTwips ) { return ( (nTwips * 127 + 72) / 144 ) * 2; }
148 // standard size as OLE server (cells)
149 #define OLE_STD_CELLS_X 4
150 #define OLE_STD_CELLS_Y 5
152 #define SC_SIZE_OPTIMUM 0xFFFF
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 )
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);
174 typedef sal_uInt8 ScBreakType;
175 const ScBreakType BREAK_NONE = 0;
176 const ScBreakType BREAK_PAGE = 1;
177 const ScBreakType BREAK_MANUAL = 2;
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_OUTLINE = 0x0800; /// Sheet / outlining (grouping) information
191 const sal_uInt16 IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
192 const sal_uInt16 IDF_ADDNOTES = 0x0400; /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
193 const sal_uInt16 IDF_SPECIAL_BOOLEAN = 0x1000;
194 const sal_uInt16 IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES;
195 const sal_uInt16 IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA | IDF_OUTLINE;
196 const sal_uInt16 IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
198 /// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
199 const sal_uInt16 IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS);
201 #define PASTE_NOFUNC 0
202 #define PASTE_ADD 1
203 #define PASTE_SUB 2
204 #define PASTE_MUL 3
205 #define PASTE_DIV 4
207 // bits for HasAttr
208 #define HASATTR_LINES 1
209 #define HASATTR_MERGED 2
210 #define HASATTR_OVERLAPPED 4
211 #define HASATTR_PROTECTED 8
212 #define HASATTR_SHADOW 16
213 #define HASATTR_NEEDHEIGHT 32
214 #define HASATTR_SHADOW_RIGHT 64
215 #define HASATTR_SHADOW_DOWN 128
216 #define HASATTR_AUTOFILTER 256
217 #define HASATTR_CONDITIONAL 512
218 #define HASATTR_ROTATE 1024
219 #define HASATTR_NOTOVERLAPPED 2048
220 #define HASATTR_RTL 4096
221 #define HASATTR_RIGHTORCENTER 8192 // right or centered logical alignment
223 #define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL )
226 #define EMPTY_STRING ScGlobal::GetEmptyString()
227 #define EMPTY_OUSTRING ScGlobal::GetEmptyOUString()
229 // layer id's for drawing
230 #define SC_LAYER_FRONT 0
231 #define SC_LAYER_BACK 1
232 #define SC_LAYER_INTERN 2
233 #define SC_LAYER_CONTROLS 3
234 #define SC_LAYER_HIDDEN 4
236 // link tables
237 #define SC_LINK_NONE 0
238 #define SC_LINK_NORMAL 1
239 #define SC_LINK_VALUE 2
241 // input
242 #define SC_ENTER_NORMAL 0
243 #define SC_ENTER_BLOCK 1
244 #define SC_ENTER_MATRIX 2
246 // step = 10pt, max. indention = 100 steps
247 #define SC_INDENT_STEP 200
248 #define SC_MAX_INDENT 20000
250 // scenario flags
251 #define SC_SCENARIO_COPYALL 1
252 #define SC_SCENARIO_SHOWFRAME 2
253 #define SC_SCENARIO_PRINTFRAME 4
254 #define SC_SCENARIO_TWOWAY 8
255 #define SC_SCENARIO_ATTRIB 16
256 #define SC_SCENARIO_VALUE 32
257 #define SC_SCENARIO_PROTECT 64
259 /** Default cell clone flags: do not start listening, do not adjust 3D refs to
260 old position, clone note captions of cell notes. */
261 const int SC_CLONECELL_DEFAULT = 0x0000;
263 /** If set, cloned formula cells will start to listen to the document. */
264 const int SC_CLONECELL_STARTLISTENING = 0x0001;
266 /** If set, relative 3D references of cloned formula cells will be adjusted to
267 old position (used while swapping cells for sorting a cell range). */
268 const int SC_CLONECELL_ADJUST3DREL = 0x0002;
270 /** If set, the caption object of a cell note will not be cloned (used while
271 copying cells to undo document, where captions are handled in drawing undo). */
272 const int SC_CLONECELL_NOCAPTION = 0x0004;
274 /** If set, absolute refs will not transformed to external references */
275 const int SC_CLONECELL_NOMAKEABS_EXTERNAL = 0x0008;
277 #ifndef DELETEZ
278 #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
279 #endif
281 // is bit set in set?
282 #define IS_SET(bit,set)(((set)&(bit))==(bit))
284 enum CellType
286 CELLTYPE_NONE,
287 CELLTYPE_VALUE,
288 CELLTYPE_STRING,
289 CELLTYPE_FORMULA,
290 CELLTYPE_EDIT,
291 #if OSL_DEBUG_LEVEL > 0
292 CELLTYPE_DESTROYED
293 #endif
296 enum DelCellCmd
298 DEL_CELLSUP,
299 DEL_CELLSLEFT,
300 DEL_DELROWS,
301 DEL_DELCOLS,
302 DEL_NONE
305 enum InsCellCmd
307 INS_CELLSDOWN,
308 INS_CELLSRIGHT,
309 INS_INSROWS,
310 INS_INSCOLS,
311 INS_NONE
314 enum UpdateRefMode
316 URM_INSDEL,
317 URM_COPY,
318 URM_MOVE,
319 URM_REORDER
322 enum FillDir
324 FILL_TO_BOTTOM,
325 FILL_TO_RIGHT,
326 FILL_TO_TOP,
327 FILL_TO_LEFT
330 enum FillCmd
332 FILL_SIMPLE,
333 FILL_LINEAR,
334 FILL_GROWTH,
335 FILL_DATE,
336 FILL_AUTO
339 enum ScMoveDirection
341 SC_MOVE_RIGHT,
342 SC_MOVE_LEFT,
343 SC_MOVE_UP,
344 SC_MOVE_DOWN
347 enum FillDateCmd
349 FILL_DAY,
350 FILL_WEEKDAY,
351 FILL_MONTH,
352 FILL_YEAR
355 enum ScDirection
357 DIR_BOTTOM,
358 DIR_RIGHT,
359 DIR_TOP,
360 DIR_LEFT
363 enum ScSizeMode
365 SC_SIZE_DIRECT, // set size or hide if value is 0
366 SC_SIZE_OPTIMAL, // set optimal size for everything
367 SC_SIZE_SHOW, // show with original size
368 SC_SIZE_VISOPT, // set optimal size only if visible
369 SC_SIZE_ORIGINAL // only set size, don't change visible flag
372 enum ScInputMode
374 SC_INPUT_NONE,
375 SC_INPUT_TYPE, // input, while not in inplace mode
376 SC_INPUT_TABLE, // text cursor in the table
377 SC_INPUT_TOP // text cursor in the input line
380 enum ScVObjMode // output modes of objects on a page
382 VOBJ_MODE_SHOW,
383 VOBJ_MODE_HIDE
386 enum ScAnchorType // anchor of a character object
388 SCA_CELL,
389 SCA_PAGE,
390 SCA_DONTKNOW // for multi selection
393 enum ScGetDBMode
395 SC_DB_MAKE, // create "untitled" (if necessary)
396 SC_DB_IMPORT, // create "Importx" (if necessary)
397 SC_DB_OLD // don't create
400 /// For ScDBFunc::GetDBData()
401 enum ScGetDBSelection
403 /** Keep selection as is, expand to used data area if no selection. */
404 SC_DBSEL_KEEP,
406 /** Shrink selection to sheet's data area. */
407 SC_DBSEL_SHRINK_TO_SHEET_DATA,
409 /** Shrink selection to actually used data area within the selection. */
410 SC_DBSEL_SHRINK_TO_USED_DATA,
412 /** If only one row or portion thereof is selected, shrink row to used data
413 columns and select further rows down until end of data. If an area is
414 selected, shrink rows to actually used columns. Else, no selection,
415 expand to used data area. */
416 SC_DBSEL_ROW_DOWN,
418 /** Behave as if the range corresponding to a ScDBData area was selected,
419 for API use. */
420 SC_DBSEL_FORCE_MARK
423 enum ScLkUpdMode // modes for updating links
425 LM_ALWAYS,
426 LM_NEVER,
427 LM_ON_DEMAND,
428 LM_UNKNOWN
432 // enum with values equal to old DBObject enum from sdb
433 enum ScDBObject
435 ScDbTable,
436 ScDbQuery
439 struct ScImportParam
441 SCCOL nCol1;
442 SCROW nRow1;
443 SCCOL nCol2;
444 SCROW nRow2;
445 bool bImport;
446 OUString aDBName; // alias of data base
447 OUString aStatement;
448 bool bNative;
449 bool bSql; // statement or name?
450 sal_uInt8 nType; // enum DBObject
452 ScImportParam();
453 ScImportParam( const ScImportParam& r );
454 ~ScImportParam();
456 ScImportParam& operator= ( const ScImportParam& r );
457 bool operator== ( const ScImportParam& r ) const;
460 struct ScStringHashCode
462 size_t operator()( const String& rStr ) const
464 return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
468 class ScDocument;
469 class ScDocShell;
470 class ScDocShellRef;
471 class SvxSearchItem;
472 class ScAutoFormat;
473 class FuncCollection;
474 class ScUnoAddInCollection;
475 class ScUserList;
476 class SvxBrushItem;
477 class ScFunctionList;
478 class ScFunctionMgr;
479 class SfxItemPool;
480 class SdrModel;
481 class EditTextObject;
482 class SfxObjectShell;
483 class SvNumberFormatter;
484 class ScUnitConverter;
485 class CharClass;
486 class LocaleDataWrapper;
487 class SvtSysLocale;
488 class CalendarWrapper;
489 class CollatorWrapper;
490 class IntlWrapper;
491 class OutputDevice;
492 class ScFieldEditEngine;
494 namespace com { namespace sun { namespace star {
495 namespace lang {
496 struct Locale;
498 namespace i18n {
499 class XOrdinalSuffix;
502 namespace utl {
503 class TransliterationWrapper;
506 #ifndef _SCALC_EXE
507 class ScGlobal
509 static SvxSearchItem* pSearchItem;
510 static ScAutoFormat* pAutoFormat;
511 static FuncCollection* pFuncCollection;
512 static ScUnoAddInCollection* pAddInCollection;
513 static ScUserList* pUserList;
514 static OUString** ppRscString;
515 static String* pStrScDoc;
516 static String* pEmptyString;
517 static OUString* pEmptyOUString;
518 static String* pStrClipDocName;
519 static SvxBrushItem* pEmptyBrushItem;
520 static SvxBrushItem* pButtonBrushItem;
521 static SvxBrushItem* pEmbeddedBrushItem;
522 static SvxBrushItem* pProtectedBrushItem;
524 static ImageList* pOutlineBitmaps;
526 static ScFunctionList* pStarCalcFunctionList;
527 static ScFunctionMgr* pStarCalcFunctionMgr;
529 static ScUnitConverter* pUnitConverter;
531 static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export
533 static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix;
534 static CalendarWrapper* pCalendar;
535 static CollatorWrapper* pCaseCollator;
536 static CollatorWrapper* pCollator;
537 static ::utl::TransliterationWrapper* pTransliteration;
538 static ::utl::TransliterationWrapper* pCaseTransliteration;
539 static IntlWrapper* pScIntlWrapper;
540 static ::com::sun::star::lang::Locale* pLocale;
542 static ScFieldEditEngine* pFieldEditEngine;
544 public:
545 static SvtSysLocale* pSysLocale;
546 // for faster access a pointer to the single instance provided by SvtSysLocale
547 SC_DLLPUBLIC static const CharClass* pCharClass;
548 // for faster access a pointer to the single instance provided by SvtSysLocale
549 SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData;
550 SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData();
552 static CalendarWrapper* GetCalendar();
553 SC_DLLPUBLIC static CollatorWrapper* GetCollator();
554 static CollatorWrapper* GetCaseCollator();
555 static IntlWrapper* GetScIntlWrapper();
556 static ::com::sun::star::lang::Locale* GetLocale();
558 SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration();
559 static ::utl::TransliterationWrapper* GetCaseTransliteration();
561 SC_DLLPUBLIC static LanguageType eLnge;
562 static sal_Unicode cListDelimiter;
564 static const String& GetClipDocName();
565 static void SetClipDocName( const String& rNew );
566 SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem();
567 SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew );
568 SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat();
569 SC_DLLPUBLIC static ScAutoFormat* GetOrCreateAutoFormat();
570 static void ClearAutoFormat(); //BugId 54209
571 static FuncCollection* GetFuncCollection();
572 SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
573 SC_DLLPUBLIC static ScUserList* GetUserList();
574 static void SetUserList( const ScUserList* pNewList );
575 SC_DLLPUBLIC static const OUString& GetRscString( sal_uInt16 nIndex );
576 static void OpenURL( const String& rURL, const String& rTarget );
577 SC_DLLPUBLIC static String GetAbsDocName( const String& rFileName,
578 SfxObjectShell* pShell );
579 SC_DLLPUBLIC static String GetDocTabName( const String& rFileName,
580 const String& rTabName );
581 SC_DLLPUBLIC static sal_uLong GetStandardFormat( SvNumberFormatter&,
582 sal_uLong nFormat, short nType );
583 SC_DLLPUBLIC static sal_uLong GetStandardFormat( double, SvNumberFormatter&,
584 sal_uLong nFormat, short nType );
586 SC_DLLPUBLIC static double nScreenPPTX;
587 SC_DLLPUBLIC static double nScreenPPTY;
589 static ScDocShellRef* pDrawClipDocShellRef;
591 static sal_uInt16 nDefFontHeight;
592 SC_DLLPUBLIC static sal_uInt16 nStdRowHeight;
594 SC_DLLPUBLIC static long nLastRowHeightExtra;
595 static long nLastColWidthExtra;
597 static void Init(); // during start up
598 static void InitAddIns();
599 static void Clear(); // at the end of the program
601 static void UpdatePPT(OutputDevice* pDev);
603 static void InitTextHeight(SfxItemPool* pPool);
604 static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; }
605 static SvxBrushItem* GetButtonBrushItem();
606 static SvxBrushItem* GetEmbeddedBrushItem() { return pEmbeddedBrushItem; }
607 static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; }
608 SC_DLLPUBLIC static const String& GetEmptyString();
609 SC_DLLPUBLIC static const OUString& GetEmptyOUString();
610 static const String& GetScDocString();
612 /** Returns the specified image list with outline symbols. */
613 static ImageList* GetOutlineSymbols();
615 static bool HasStarCalcFunctionList();
616 static ScFunctionList* GetStarCalcFunctionList();
617 static ScFunctionMgr* GetStarCalcFunctionMgr();
618 static void ResetFunctionList();
620 static String GetErrorString(sal_uInt16 nErrNumber);
621 static String GetLongErrorString(sal_uInt16 nErrNumber);
622 static sal_Bool EETextObjEqual( const EditTextObject* pObj1,
623 const EditTextObject* pObj2 );
624 static sal_Bool CheckWidthInvalidate( bool& bNumFormatChanged,
625 const SfxItemSet& rNewAttrs,
626 const SfxItemSet& rOldAttrs );
627 static sal_Bool HasAttrChanged( const SfxItemSet& rNewAttrs,
628 const SfxItemSet& rOldAttrs,
629 const sal_uInt16 nWhich );
631 static ScUnitConverter* GetUnitConverter();
633 /// strchr() functionality on unicode, as long as we need it for ScToken etc.
634 static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c );
636 static inline sal_Unicode ToUpperAlpha( sal_Unicode c )
637 { return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; }
639 /** Adds the string rToken to rTokenList, using a list separator character.
640 @param rTokenList The string list where the token will be appended to.
641 @param rToken The token string to append to the token list.
642 @param cSep The character to separate the tokens.
643 @param nSepCount Specifies how often cSep is inserted between two tokens.
644 @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */
645 SC_DLLPUBLIC static OUString addToken(
646 const OUString& rTokenList, const OUString& rToken,
647 sal_Unicode cSep, sal_Int32 nSepCount = 1,
648 bool bForceSep = false );
650 /** Returns true, if the first and last character of the string is cQuote. */
651 SC_DLLPUBLIC static bool IsQuoted( const String& rString, sal_Unicode cQuote = '\'' );
653 /** Inserts the character cQuote at beginning and end of rString.
654 @param bEscapeEmbedded If <TRUE/>, embedded quote characters are
655 escaped by doubling them.
657 SC_DLLPUBLIC static void AddQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true );
659 /** Erases the character cQuote from rString, if it exists at beginning AND end.
660 @param bUnescapeEmbedded If <TRUE/>, embedded doubled quote characters
661 are unescaped by replacing them with a
662 single instance.
664 SC_DLLPUBLIC static void EraseQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true );
666 /** Finds an unquoted instance of cChar in rString, starting at
667 offset nStart. Unquoted instances may occur when concatenating two
668 quoted strings with a separator, for example, 's1':'s2'. Embedded
669 quotes have to be escaped by being doubled. Caller must ensure that
670 nStart points into an unquoted range or the opening quote. Specialty:
671 if cChar==cQuote the first cQuote character from nStart on is found.
672 @returns offset if found, else STRING_NOTFOUND
674 SC_DLLPUBLIC static xub_StrLen FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' );
676 /** Finds an unquoted instance of cChar in null-terminated pString. Same
677 semantics as FindUnquoted( const String&, ...)
678 @returns: pointer to cChar if found, else NULL
680 SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' );
683 static CharSet GetCharsetValue( const String& rCharSet );
684 static String GetCharsetString( CharSet eVal );
686 /// a "ReadOnly" formatter for UNO/XML export
687 static SvNumberFormatter* GetEnglishFormatter();
689 static sal_Bool IsSystemRTL(); // depending on system language
690 static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage
691 SC_DLLPUBLIC static sal_uInt8 GetDefaultScriptType(); // for all WEAK characters
692 /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
693 If more than one SCRIPTTYPE_... values are or'ed together, prefers
694 first COMPLEX, then ASIAN */
695 SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich );
697 /** Adds a language item to the item set, if the number format item contains
698 a language that differs from its parent's language. */
699 SC_DLLPUBLIC static void AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter );
701 /** Obtain the ordinal suffix for a number according to the system locale */
702 static String GetOrdinalSuffix( sal_Int32 nNumber);
704 /** A static instance of ScFieldEditEngine not capable of resolving
705 document specific fields, to be used only by ScEditUtil::GetString(). */
706 static ScFieldEditEngine& GetStaticFieldEditEngine();
708 /** Replaces the first occurrence of rPlaceholder in rString with
709 rReplacement, or if rPlaceholder is not found appends one space if
710 rString does not end in a space and appends rReplacement.
712 Meant to be used with resource strings ala "Column %1" where a
713 translation may have omitted the %1 placeholder and a simple
714 replacement would end up with nothing replaced so no column indicator
715 in the result string.
717 SC_DLLPUBLIC static OUString ReplaceOrAppend( const OUString& rString,
718 const OUString& rPlaceholder,
719 const OUString& rReplacement );
721 #endif
723 // maybe move to dbdata.hxx (?):
725 enum ScQueryOp
727 SC_EQUAL,
728 SC_LESS,
729 SC_GREATER,
730 SC_LESS_EQUAL,
731 SC_GREATER_EQUAL,
732 SC_NOT_EQUAL,
733 SC_TOPVAL,
734 SC_BOTVAL,
735 SC_TOPPERC,
736 SC_BOTPERC,
737 SC_CONTAINS,
738 SC_DOES_NOT_CONTAIN,
739 SC_BEGINS_WITH,
740 SC_DOES_NOT_BEGIN_WITH,
741 SC_ENDS_WITH,
742 SC_DOES_NOT_END_WITH
745 enum ScQueryConnect
747 SC_AND,
748 SC_OR
751 enum ScSubTotalFunc
753 SUBTOTAL_FUNC_NONE = 0,
754 SUBTOTAL_FUNC_AVE = 1,
755 SUBTOTAL_FUNC_CNT = 2,
756 SUBTOTAL_FUNC_CNT2 = 3,
757 SUBTOTAL_FUNC_MAX = 4,
758 SUBTOTAL_FUNC_MIN = 5,
759 SUBTOTAL_FUNC_PROD = 6,
760 SUBTOTAL_FUNC_STD = 7,
761 SUBTOTAL_FUNC_STDP = 8,
762 SUBTOTAL_FUNC_SUM = 9,
763 SUBTOTAL_FUNC_VAR = 10,
764 SUBTOTAL_FUNC_VARP = 11,
765 SUBTOTAL_FUNC_SELECTION_COUNT = 12
768 class ScArea;
770 struct ScConsolidateParam
772 SCCOL nCol; // cursor position /
773 SCROW nRow; // or start of destination area respectively
774 SCTAB nTab;
775 ScSubTotalFunc eFunction;
776 sal_uInt16 nDataAreaCount; // number of data areas
777 ScArea** ppDataAreas; // array of pointers into data areas
778 sal_Bool bByCol;
779 sal_Bool bByRow;
780 sal_Bool bReferenceData; // reference source data
782 ScConsolidateParam();
783 ScConsolidateParam( const ScConsolidateParam& r );
784 ~ScConsolidateParam();
786 ScConsolidateParam& operator= ( const ScConsolidateParam& r );
787 sal_Bool operator== ( const ScConsolidateParam& r ) const;
788 void Clear (); // = ClearDataAreas()+Members
789 void ClearDataAreas ();
790 void SetAreas ( ScArea* const* ppAreas, sal_uInt16 nCount );
793 #endif
795 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */