LibreOffice Module sc (master)  1
global.cxx
Go to the documentation of this file.
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 #include <scitems.hxx>
21 #include <svx/algitem.hxx>
22 #include <editeng/brushitem.hxx>
23 #include <editeng/editobj.hxx>
24 #include <svl/srchitem.hxx>
25 #include <editeng/langitem.hxx>
26 #include <sfx2/docfile.hxx>
27 #include <sfx2/dispatch.hxx>
28 #include <sfx2/objsh.hxx>
29 #include <sfx2/sfxsids.hrc>
30 #include <sfx2/viewfrm.hxx>
31 #include <sfx2/viewsh.hxx>
32 #include <svl/intitem.hxx>
33 #include <svl/stritem.hxx>
34 #include <svl/zforlist.hxx>
35 #include <svl/zformat.hxx>
36 #include <vcl/keycodes.hxx>
37 #include <vcl/virdev.hxx>
38 #include <vcl/settings.hxx>
39 #include <vcl/svapp.hxx>
40 #include <unotools/charclass.hxx>
42 #include <osl/diagnose.h>
43 
44 #include <i18nlangtag/mslangid.hxx>
47 #include <comphelper/string.hxx>
50 #include <unotools/syslocale.hxx>
52 
53 #include <comphelper/lok.hxx>
55 
56 #include <global.hxx>
57 #include <scresid.hxx>
58 #include <autoform.hxx>
59 #include <patattr.hxx>
60 #include <addincol.hxx>
61 #include <adiasync.hxx>
62 #include <userlist.hxx>
63 #include <interpre.hxx>
64 #include <unitconv.hxx>
65 #include <compiler.hxx>
66 #include <parclass.hxx>
67 #include <funcdesc.hxx>
68 #include <globstr.hrc>
69 #include <strings.hrc>
70 #include <scmod.hxx>
71 #include <editutil.hxx>
72 #include <docsh.hxx>
73 
75 std::unique_ptr<SvxSearchItem> ScGlobal::xSearchItem;
76 std::unique_ptr<ScAutoFormat> ScGlobal::xAutoFormat;
77 std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr);
78 std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr);
79 std::unique_ptr<ScUserList> ScGlobal::xUserList;
81 std::atomic<css::lang::Locale*> ScGlobal::pLocale(nullptr);
82 std::unique_ptr<SvtSysLocale> ScGlobal::xSysLocale;
83 std::unique_ptr<CalendarWrapper> ScGlobal::xCalendar;
84 std::atomic<CollatorWrapper*> ScGlobal::pCollator(nullptr);
85 std::atomic<CollatorWrapper*> ScGlobal::pCaseCollator(nullptr);
86 std::atomic<::utl::TransliterationWrapper*> ScGlobal::pTransliteration(nullptr);
87 std::atomic<::utl::TransliterationWrapper*> ScGlobal::pCaseTransliteration(nullptr);
88 css::uno::Reference< css::i18n::XOrdinalSuffix> ScGlobal::xOrdinalSuffix;
89 const OUString ScGlobal::aEmptyOUString;
91 
92 std::unique_ptr<SvxBrushItem> ScGlobal::xEmptyBrushItem;
93 std::unique_ptr<SvxBrushItem> ScGlobal::xButtonBrushItem;
94 
95 std::unique_ptr<ScFunctionList> ScGlobal::xStarCalcFunctionList;
96 std::unique_ptr<ScFunctionMgr> ScGlobal::xStarCalcFunctionMgr;
97 
98 std::atomic<ScUnitConverter*> ScGlobal::pUnitConverter(nullptr);
99 std::unique_ptr<SvNumberFormatter> ScGlobal::xEnglishFormatter;
100 std::unique_ptr<ScFieldEditEngine> ScGlobal::xFieldEditEngine;
101 
102 double ScGlobal::nScreenPPTX = 96.0;
103 double ScGlobal::nScreenPPTY = 96.0;
104 
105 sal_uInt16 ScGlobal::nDefFontHeight = 225;
106 sal_uInt16 ScGlobal::nStdRowHeight = 256;
107 
110 
111 SfxViewShell* pScActiveViewShell = nullptr; //FIXME: Make this a member
112 sal_uInt16 nScClickMouseModifier = 0; //FIXME: This too
113 sal_uInt16 nScFillModeMouseModifier = 0; //FIXME: And this
114 
116 
117 // Static functions
118 
119 bool ScGlobal::HasAttrChanged( const SfxItemSet& rNewAttrs,
120  const SfxItemSet& rOldAttrs,
121  const sal_uInt16 nWhich )
122 {
123  bool bInvalidate = false;
124  const SfxPoolItem* pNewItem = nullptr;
125  const SfxItemState eNewState = rNewAttrs.GetItemState( nWhich, true, &pNewItem );
126  const SfxPoolItem* pOldItem = nullptr;
127  const SfxItemState eOldState = rOldAttrs.GetItemState( nWhich, true, &pOldItem );
128 
129  if ( eNewState == eOldState )
130  {
131  // Both Items set
132  // PoolItems, meaning comparing pointers is valid
133  if ( SfxItemState::SET == eOldState )
134  bInvalidate = (pNewItem != pOldItem);
135  }
136  else
137  {
138  // Contains a Default Item
139  // PoolItems, meaning Item comparison necessary
140  if (!pOldItem)
141  pOldItem = &rOldAttrs.GetPool()->GetDefaultItem( nWhich );
142 
143  if (!pNewItem)
144  pNewItem = &rNewAttrs.GetPool()->GetDefaultItem( nWhich );
145 
146  bInvalidate = (*pNewItem != *pOldItem);
147  }
148 
149  return bInvalidate;
150 }
151 
153  sal_uInt32 nFormat, SvNumFormatType nType )
154 {
155  const SvNumberformat* pFormat = rFormatter.GetEntry( nFormat );
156  if ( pFormat )
157  return rFormatter.GetStandardFormat( nFormat, nType, pFormat->GetLanguage() );
158  return rFormatter.GetStandardFormat( nType, eLnge );
159 }
160 
162 {
163  return nStdRowHeight;
164 }
165 
167 {
169  if ( !xEnglishFormatter )
170  {
173  xEnglishFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
174  }
175  return xEnglishFormatter.get();
176 }
177 
178 bool ScGlobal::CheckWidthInvalidate( bool& bNumFormatChanged,
179  const SfxItemSet& rNewAttrs,
180  const SfxItemSet& rOldAttrs )
181 {
182  // Check whether attribute changes in rNewAttrs compared to rOldAttrs render
183  // the text width at a cell invalid
184  bNumFormatChanged =
185  HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_VALUE_FORMAT );
186  return ( bNumFormatChanged
187  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_LANGUAGE_FORMAT )
188  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT )
189  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CJK_FONT )
190  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CTL_FONT )
191  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_HEIGHT )
192  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CJK_FONT_HEIGHT )
193  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CTL_FONT_HEIGHT )
194  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_WEIGHT )
195  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CJK_FONT_WEIGHT )
196  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CTL_FONT_WEIGHT )
197  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_POSTURE )
198  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CJK_FONT_POSTURE )
199  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_CTL_FONT_POSTURE )
200  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_UNDERLINE )
201  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_OVERLINE )
202  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_CROSSEDOUT )
203  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_CONTOUR )
204  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_FONT_SHADOWED )
205  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_STACKED )
206  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_ROTATE_VALUE )
207  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_ROTATE_MODE )
208  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_LINEBREAK )
209  || HasAttrChanged( rNewAttrs, rOldAttrs, ATTR_MARGIN )
210  );
211 }
212 
214 {
216  if (!xSearchItem)
217  {
218  xSearchItem.reset(new SvxSearchItem( SID_SEARCH_ITEM ));
219  xSearchItem->SetAppFlag( SvxSearchApp::CALC );
220  }
221  return *xSearchItem;
222 }
223 
225 {
227  // FIXME: An assignment operator would be nice here
228  xSearchItem.reset(rNew.Clone());
229 
230  xSearchItem->SetWhich( SID_SEARCH_ITEM );
231  xSearchItem->SetAppFlag( SvxSearchApp::CALC );
232 }
233 
235 {
237  if (xAutoFormat)
238  {
239  // When modified via StarOne then only the SaveLater flag is set and no saving is done.
240  // If the flag is set then save now.
241  if (xAutoFormat->IsSaveLater())
242  xAutoFormat->Save();
243  xAutoFormat.reset();
244  }
245 }
246 
248 {
249  return xAutoFormat.get();
250 }
251 
253 {
255  if ( !xAutoFormat )
256  {
257  xAutoFormat.reset(new ScAutoFormat);
258  xAutoFormat->Load();
259  }
260 
261  return xAutoFormat.get();
262 }
263 
265 {
267 }
268 
270 {
272 }
273 
275 {
277  // Hack: Load Cfg item at the App
279 
280  if (!xUserList)
281  xUserList.reset(new ScUserList());
282  return xUserList.get();
283 }
284 
285 void ScGlobal::SetUserList( const ScUserList* pNewList )
286 {
288  if ( pNewList )
289  {
290  if ( !xUserList )
291  xUserList.reset( new ScUserList( *pNewList ) );
292  else
293  *xUserList = *pNewList;
294  }
295  else
296  {
297  xUserList.reset();
298  }
299 }
300 
302 {
303  const char* pErrNumber;
304  switch (nErr)
305  {
306  case FormulaError::NoRef:
307  pErrNumber = STR_NO_REF_TABLE;
308  break;
309  case FormulaError::NoAddin:
310  pErrNumber = STR_NO_ADDIN;
311  break;
312  case FormulaError::NoMacro:
313  pErrNumber = STR_NO_MACRO;
314  break;
315  case FormulaError::NotAvailable:
317  case FormulaError::NoName:
319  case FormulaError::NoValue:
321  case FormulaError::NoCode:
323  case FormulaError::DivisionByZero:
325  case FormulaError::IllegalFPOperation:
327  default:
328  return ScResId(STR_ERROR_STR) + OUString::number( static_cast<int>(nErr) );
329  }
330  return ScResId(pErrNumber);
331 }
332 
334 {
335  const char* pErrNumber;
336  switch (nErr)
337  {
338  case FormulaError::NONE:
339  return OUString();
340  case FormulaError::IllegalArgument:
341  pErrNumber = STR_LONG_ERR_ILL_ARG;
342  break;
343  case FormulaError::IllegalFPOperation:
344  pErrNumber = STR_LONG_ERR_ILL_FPO;
345  break;
346  case FormulaError::IllegalChar:
347  pErrNumber = STR_LONG_ERR_ILL_CHAR;
348  break;
349  case FormulaError::IllegalParameter:
350  pErrNumber = STR_LONG_ERR_ILL_PAR;
351  break;
352  case FormulaError::Pair:
353  case FormulaError::PairExpected:
354  pErrNumber = STR_LONG_ERR_PAIR;
355  break;
356  case FormulaError::OperatorExpected:
357  pErrNumber = STR_LONG_ERR_OP_EXP;
358  break;
359  case FormulaError::VariableExpected:
360  case FormulaError::ParameterExpected:
361  pErrNumber = STR_LONG_ERR_VAR_EXP;
362  break;
363  case FormulaError::CodeOverflow:
364  pErrNumber = STR_LONG_ERR_CODE_OVF;
365  break;
366  case FormulaError::StringOverflow:
367  pErrNumber = STR_LONG_ERR_STR_OVF;
368  break;
369  case FormulaError::StackOverflow:
370  pErrNumber = STR_LONG_ERR_STACK_OVF;
371  break;
372  case FormulaError::MatrixSize:
373  pErrNumber = STR_LONG_ERR_MATRIX_SIZE;
374  break;
375  case FormulaError::UnknownState:
376  case FormulaError::UnknownVariable:
377  case FormulaError::UnknownOpCode:
378  case FormulaError::UnknownStackVariable:
379  case FormulaError::UnknownToken:
380  case FormulaError::NoCode:
381  pErrNumber = STR_LONG_ERR_SYNTAX;
382  break;
383  case FormulaError::CircularReference:
384  pErrNumber = STR_LONG_ERR_CIRC_REF;
385  break;
386  case FormulaError::NoConvergence:
387  pErrNumber = STR_LONG_ERR_NO_CONV;
388  break;
389  case FormulaError::NoRef:
390  pErrNumber = STR_LONG_ERR_NO_REF;
391  break;
392  case FormulaError::NoName:
393  pErrNumber = STR_LONG_ERR_NO_NAME;
394  break;
395  case FormulaError::NoAddin:
396  pErrNumber = STR_LONG_ERR_NO_ADDIN;
397  break;
398  case FormulaError::NoMacro:
399  pErrNumber = STR_LONG_ERR_NO_MACRO;
400  break;
401  case FormulaError::DivisionByZero:
402  pErrNumber = STR_LONG_ERR_DIV_ZERO;
403  break;
404  case FormulaError::NestedArray:
405  pErrNumber = STR_ERR_LONG_NESTED_ARRAY;
406  break;
407  case FormulaError::BadArrayContent:
408  pErrNumber = STR_ERR_LONG_BAD_ARRAY_CONTENT;
409  break;
410  case FormulaError::LinkFormulaNeedingCheck:
411  pErrNumber = STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK;
412  break;
413  case FormulaError::NoValue:
414  pErrNumber = STR_LONG_ERR_NO_VALUE;
415  break;
416  case FormulaError::NotAvailable:
417  pErrNumber = STR_LONG_ERR_NV;
418  break;
419  default:
420  return ScResId(STR_ERROR_STR) + OUString::number( static_cast<int>(nErr) );
421  break;
422  }
423  return ScResId(pErrNumber);
424 }
425 
427 {
429  xButtonBrushItem->SetColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
430  return xButtonBrushItem.get();
431 }
432 
434 {
435  // The default language for number formats (ScGlobal::eLnge) must
436  // always be LANGUAGE_SYSTEM
437  // FIXME: So remove this variable?
439 
440  xSysLocale = std::make_unique<SvtSysLocale>();
441 
442  xEmptyBrushItem = std::make_unique<SvxBrushItem>( COL_TRANSPARENT, ATTR_BACKGROUND );
443  xButtonBrushItem = std::make_unique<SvxBrushItem>( Color(), ATTR_BACKGROUND );
444 
445  InitPPT();
446  //ScCompiler::InitSymbolsNative();
447  // ScParameterClassification _after_ Compiler, needs function resources if
448  // arguments are to be merged in, which in turn need strings of function
449  // names from the compiler.
451 
452  InitAddIns();
453 
454  aStrClipDocName = ScResId( SCSTR_NONAME ) + "1";
455 
456  // ScDocumentPool::InitVersionMaps() has been called earlier already
457 }
458 
460 {
462 
464  {
465  // LOK: the below limited precision is not enough for RowColumnHeader.
466  // OpenGL: limited precision breaks AA of text in charts.
467  nScreenPPTX = double(pDev->GetDPIX()) / double(TWIPS_PER_INCH);
468  nScreenPPTY = double(pDev->GetDPIY()) / double(TWIPS_PER_INCH);
469  }
470  else
471  {
472  // Avoid cumulative placement errors by intentionally limiting
473  // precision.
474  Point aPix1000 = pDev->LogicToPixel(Point(1000, 1000), MapMode(MapUnit::MapTwip));
475  nScreenPPTX = aPix1000.X() / 1000.0;
476  nScreenPPTY = aPix1000.Y() / 1000.0;
477  }
478 }
479 
480 const OUString& ScGlobal::GetClipDocName()
481 {
482  return aStrClipDocName;
483 }
484 
485 void ScGlobal::SetClipDocName( const OUString& rNew )
486 {
488  aStrClipDocName = rNew;
489 }
490 
492 {
493  if (!pPool)
494  {
495  OSL_FAIL("ScGlobal::InitTextHeight: No Pool");
496  return;
497  }
498 
499  const ScPatternAttr& rPattern = pPool->GetDefaultItem(ATTR_PATTERN);
500 
502  ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *pDefaultDev );
503  pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
504  vcl::Font aDefFont;
505  rPattern.GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color doesn't matter here
506  pVirtWindow->SetFont(aDefFont);
507  sal_uInt16 nTest = static_cast<sal_uInt16>(
508  pVirtWindow->PixelToLogic(Size(0, pVirtWindow->GetTextHeight()), MapMode(MapUnit::MapTwip)).Height());
509 
510  if (nTest > nDefFontHeight)
511  nDefFontHeight = nTest;
512 
513  const SvxMarginItem& rMargin = rPattern.GetItem(ATTR_MARGIN);
514 
515  nTest = static_cast<sal_uInt16>(nDefFontHeight + rMargin.GetTopMargin()
516  + rMargin.GetBottomMargin() - STD_ROWHEIGHT_DIFF);
517 
518  if (nTest > nStdRowHeight)
519  nStdRowHeight = nTest;
520 }
521 
523 {
524  // Destroy asyncs _before_ ExitExternalFunc!
525  theAddInAsyncTbl.clear();
527  ClearAutoFormat();
528  xSearchItem.reset();
529  delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr;
530  delete pAddInCollection.load(); pAddInCollection = nullptr;
531  xUserList.reset();
532  xStarCalcFunctionList.reset(); // Destroy before ResMgr!
533  xStarCalcFunctionMgr.reset();
536  ScInterpreter::GlobalExit(); // Delete static Stack
537 
538  xEmptyBrushItem.reset();
539  xButtonBrushItem.reset();
540  xEnglishFormatter.reset();
541  delete pCaseTransliteration.load(); pCaseTransliteration = nullptr;
542  delete pTransliteration.load(); pTransliteration = nullptr;
543  delete pCaseCollator.load(); pCaseCollator = nullptr;
544  delete pCollator.load(); pCollator = nullptr;
545  xCalendar.reset();
546  xSysLocale.reset();
547  delete pLocale.load(); pLocale = nullptr;
548 
549  delete pUnitConverter.load(); pUnitConverter = nullptr;
550  xFieldEditEngine.reset();
551 
553 }
554 
555 rtl_TextEncoding ScGlobal::GetCharsetValue( const OUString& rCharSet )
556 {
557  // new TextEncoding values
558  if ( CharClass::isAsciiNumeric( rCharSet ) )
559  {
560  sal_Int32 nVal = rCharSet.toInt32();
561  if ( nVal == RTL_TEXTENCODING_DONTKNOW )
562  return osl_getThreadTextEncoding();
563  return static_cast<rtl_TextEncoding>(nVal);
564  }
565  // old CharSet values for compatibility
566  else if (rCharSet.equalsIgnoreAsciiCase("ANSI") ) return RTL_TEXTENCODING_MS_1252;
567  else if (rCharSet.equalsIgnoreAsciiCase("MAC") ) return RTL_TEXTENCODING_APPLE_ROMAN;
568  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC") ) return RTL_TEXTENCODING_IBM_850;
569  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_437")) return RTL_TEXTENCODING_IBM_437;
570  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_850")) return RTL_TEXTENCODING_IBM_850;
571  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_860")) return RTL_TEXTENCODING_IBM_860;
572  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_861")) return RTL_TEXTENCODING_IBM_861;
573  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_863")) return RTL_TEXTENCODING_IBM_863;
574  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_865")) return RTL_TEXTENCODING_IBM_865;
575  // Some wrong "help" on the net mentions UTF8 and even unoconv uses it,
576  // which worked accidentally if the system encoding is UTF-8 anyway, so
577  // support it ;) but only when reading.
578  else if (rCharSet.equalsIgnoreAsciiCase("UTF8")) return RTL_TEXTENCODING_UTF8;
579  else if (rCharSet.equalsIgnoreAsciiCase("UTF-8")) return RTL_TEXTENCODING_UTF8;
580  else return osl_getThreadTextEncoding();
581 }
582 
583 OUString ScGlobal::GetCharsetString( rtl_TextEncoding eVal )
584 {
585  const char* pChar;
586  switch ( eVal )
587  {
588  // old CharSet strings for compatibility
589  case RTL_TEXTENCODING_MS_1252: pChar = "ANSI"; break;
590  case RTL_TEXTENCODING_APPLE_ROMAN: pChar = "MAC"; break;
591  // IBMPC == IBMPC_850
592  case RTL_TEXTENCODING_IBM_437: pChar = "IBMPC_437"; break;
593  case RTL_TEXTENCODING_IBM_850: pChar = "IBMPC_850"; break;
594  case RTL_TEXTENCODING_IBM_860: pChar = "IBMPC_860"; break;
595  case RTL_TEXTENCODING_IBM_861: pChar = "IBMPC_861"; break;
596  case RTL_TEXTENCODING_IBM_863: pChar = "IBMPC_863"; break;
597  case RTL_TEXTENCODING_IBM_865: pChar = "IBMPC_865"; break;
598  case RTL_TEXTENCODING_DONTKNOW: pChar = "SYSTEM"; break;
599  // new string of TextEncoding value
600  default:
601  return OUString::number( eVal );
602  }
603  return OUString::createFromAscii(pChar);
604 }
605 
607 {
608  return bool(xStarCalcFunctionList);
609 }
610 
612 {
614  if ( !xStarCalcFunctionList )
616 
617  return xStarCalcFunctionList.get();
618 }
619 
621 {
623  if ( !xStarCalcFunctionMgr )
625 
626  return xStarCalcFunctionMgr.get();
627 }
628 
630 {
631  // FunctionMgr has pointers into FunctionList, must also be updated
632  xStarCalcFunctionMgr.reset();
633  xStarCalcFunctionList.reset();
634 }
635 
637 {
639  []() { return new ScUnitConverter; });
640 }
641 
643  sal_Unicode c )
644 {
645  if ( !pStr )
646  return nullptr;
647  while ( *pStr )
648  {
649  if ( *pStr == c )
650  return pStr;
651  pStr++;
652  }
653  return nullptr;
654 }
655 
656 OUString ScGlobal::addToken(const OUString& rTokenList, const OUString& rToken,
657  sal_Unicode cSep, sal_Int32 nSepCount, bool bForceSep)
658 {
659  OUStringBuffer aBuf(rTokenList);
660  if( bForceSep || (!rToken.isEmpty() && !rTokenList.isEmpty()) )
661  comphelper::string::padToLength(aBuf, aBuf.getLength() + nSepCount, cSep);
662  aBuf.append(rToken);
663  return aBuf.makeStringAndClear();
664 }
665 
666 bool ScGlobal::IsQuoted( const OUString& rString, sal_Unicode cQuote )
667 {
668  return (rString.getLength() >= 2) && (rString[0] == cQuote) && (rString[ rString.getLength() - 1 ] == cQuote);
669 }
670 
671 void ScGlobal::AddQuotes( OUString& rString, sal_Unicode cQuote, bool bEscapeEmbedded )
672 {
673  if (bEscapeEmbedded)
674  {
675  sal_Unicode pQ[3];
676  pQ[0] = pQ[1] = cQuote;
677  pQ[2] = 0;
678  OUString aQuotes( pQ );
679  rString = rString.replaceAll( OUStringChar(cQuote), aQuotes);
680  }
681  rString = OUStringChar( cQuote ) + rString + OUStringChar( cQuote );
682 }
683 
684 void ScGlobal::EraseQuotes( OUString& rString, sal_Unicode cQuote, bool bUnescapeEmbedded )
685 {
686  if ( IsQuoted( rString, cQuote ) )
687  {
688  rString = rString.copy( 1, rString.getLength() - 2 );
689  if (bUnescapeEmbedded)
690  {
691  sal_Unicode pQ[3];
692  pQ[0] = pQ[1] = cQuote;
693  pQ[2] = 0;
694  OUString aQuotes( pQ );
695  rString = rString.replaceAll( aQuotes, OUStringChar(cQuote));
696  }
697  }
698 }
699 
700 sal_Int32 ScGlobal::FindUnquoted( const OUString& rString, sal_Unicode cChar)
701 {
702  const sal_Unicode cQuote = '\'';
703  const sal_Unicode* const pStart = rString.getStr();
704  const sal_Unicode* const pStop = pStart + rString.getLength();
705  const sal_Unicode* p = pStart;
706  bool bQuoted = false;
707  while (p < pStop)
708  {
709  if (*p == cChar && !bQuoted)
710  return sal::static_int_cast< sal_Int32 >( p - pStart );
711  else if (*p == cQuote)
712  {
713  if (!bQuoted)
714  bQuoted = true;
715  else if (p < pStop-1 && *(p+1) == cQuote)
716  ++p;
717  else
718  bQuoted = false;
719  }
720  ++p;
721  }
722  return -1;
723 }
724 
726 {
727  sal_Unicode cQuote = '\'';
728  const sal_Unicode* p = pString;
729  bool bQuoted = false;
730  while (*p)
731  {
732  if (*p == cChar && !bQuoted)
733  return p;
734  else if (*p == cQuote)
735  {
736  if (!bQuoted)
737  bQuoted = true;
738  else if (*(p+1) == cQuote)
739  ++p;
740  else
741  bQuoted = false;
742  }
743  ++p;
744  }
745  return nullptr;
746 }
747 
749  const EditTextObject* pObj2 )
750 {
751  if ( pObj1 == pObj2 ) // Both empty or the same object
752  return true;
753 
754  if ( pObj1 && pObj2 )
755  return pObj1->Equals( *pObj2);
756 
757  return false;
758 }
759 
760 void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgnoreSettings)
761 {
762  // OpenURL is always called in the GridWindow by mouse clicks in some way or another.
763  // That's why pScActiveViewShell and nScClickMouseModifier are correct.
764 
765  if (!bIgnoreSettings && !ShouldOpenURL())
766  return;
767 
768  SfxViewFrame* pViewFrm = SfxViewFrame::Current();
769  if (!pViewFrm)
770  return;
771 
772  OUString aUrlName( rURL );
773  SfxViewFrame* pFrame = nullptr;
774  const SfxObjectShell* pObjShell = nullptr;
775  OUString aReferName;
776  if ( pScActiveViewShell )
777  {
778  pFrame = pScActiveViewShell->GetViewFrame();
779  pObjShell = pFrame->GetObjectShell();
780  const SfxMedium* pMed = pObjShell->GetMedium();
781  if (pMed)
782  aReferName = pMed->GetName();
783  }
784 
785  // Don't fiddle with fragments pointing into current document.
786  // Also don't mess around with a vnd.sun.star.script or service or other
787  // internal "URI".
788  if (!aUrlName.startsWith("#")
789  && !aUrlName.startsWithIgnoreAsciiCase("vnd.sun.star.script:")
790  && !aUrlName.startsWithIgnoreAsciiCase("macro:")
791  && !aUrlName.startsWithIgnoreAsciiCase("slot:")
792  && !aUrlName.startsWithIgnoreAsciiCase("service:")
793  && !aUrlName.startsWithIgnoreAsciiCase(".uno:"))
794  {
795  // Any relative reference would fail with "not an absolute URL"
796  // error, try to construct an absolute URI with the path relative
797  // to the current document's path or work path, as usual for all
798  // external references.
799  // This then also, as ScGlobal::GetAbsDocName() uses
800  // INetURLObject::smartRel2Abs(), supports "\\" UNC path names as
801  // smb:// Samba shares and DOS path separators converted to proper
802  // file:// URI.
803  const OUString aNewUrlName( ScGlobal::GetAbsDocName( aUrlName, pObjShell));
804  if (!aNewUrlName.isEmpty())
805  aUrlName = aNewUrlName;
806  }
807 
808  SfxStringItem aUrl( SID_FILE_NAME, aUrlName );
809  SfxStringItem aTarget( SID_TARGETNAME, rTarget );
810  if ( nScClickMouseModifier & KEY_SHIFT ) // control-click -> into new window
811  aTarget.SetValue("_blank");
812 
813  SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
814  SfxStringItem aReferer( SID_REFERER, aReferName );
815 
816  SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
817  SfxBoolItem aBrowsing( SID_BROWSE, true );
818 
819  // No SID_SILENT anymore
820  pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC,
821  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
822  { &aUrl, &aTarget, &aFrm, &aReferer, &aNewView, &aBrowsing });
823 }
824 
826 {
827  SvtSecurityOptions aSecOpt;
828  bool bCtrlClickHappened = (nScClickMouseModifier & KEY_MOD1);
829  bool bCtrlClickSecOption = aSecOpt.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink );
830  if( bCtrlClickHappened && ! bCtrlClickSecOption )
831  {
832  // return since ctrl+click happened when the
833  // ctrl+click security option was disabled, link should not open
834  return false;
835  }
836  else if( ! bCtrlClickHappened && bCtrlClickSecOption )
837  {
838  // ctrl+click did not happen; only click happened maybe with some
839  // other key combo. and security option is set, so return
840  return false;
841  }
842  return true;
843 }
844 
846 {
847  return MsLangId::isRightToLeft( Application::GetSettings().GetLanguageTag().getLanguageType() );
848 }
849 
851 {
852  // Used when text contains only WEAK characters.
853  // Script type of office language is used then (same as GetEditDefaultLanguage,
854  // to get consistent behavior of text in simple cells and EditEngine,
855  // also same as GetAppLanguage() in Writer)
856  return SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
857 }
858 
860 {
861  // Used for EditEngine::SetDefaultLanguage
863 }
864 
865 sal_uInt16 ScGlobal::GetScriptedWhichID( SvtScriptType nScriptType, sal_uInt16 nWhich )
866 {
867  switch ( nScriptType )
868  {
869  case SvtScriptType::LATIN:
870  case SvtScriptType::ASIAN:
871  case SvtScriptType::COMPLEX:
872  break; // take exact matches
873  default: // prefer one, first COMPLEX, then ASIAN
874  if ( nScriptType & SvtScriptType::COMPLEX )
875  nScriptType = SvtScriptType::COMPLEX;
876  else if ( nScriptType & SvtScriptType::ASIAN )
877  nScriptType = SvtScriptType::ASIAN;
878  }
879  switch ( nScriptType )
880  {
881  case SvtScriptType::COMPLEX:
882  {
883  switch ( nWhich )
884  {
885  case ATTR_FONT:
886  case ATTR_CJK_FONT:
887  nWhich = ATTR_CTL_FONT;
888  break;
889  case ATTR_FONT_HEIGHT:
891  nWhich = ATTR_CTL_FONT_HEIGHT;
892  break;
893  case ATTR_FONT_WEIGHT:
895  nWhich = ATTR_CTL_FONT_WEIGHT;
896  break;
897  case ATTR_FONT_POSTURE:
899  nWhich = ATTR_CTL_FONT_POSTURE;
900  break;
901  }
902  }
903  break;
904  case SvtScriptType::ASIAN:
905  {
906  switch ( nWhich )
907  {
908  case ATTR_FONT:
909  case ATTR_CTL_FONT:
910  nWhich = ATTR_CJK_FONT;
911  break;
912  case ATTR_FONT_HEIGHT:
914  nWhich = ATTR_CJK_FONT_HEIGHT;
915  break;
916  case ATTR_FONT_WEIGHT:
918  nWhich = ATTR_CJK_FONT_WEIGHT;
919  break;
920  case ATTR_FONT_POSTURE:
922  nWhich = ATTR_CJK_FONT_POSTURE;
923  break;
924  }
925  }
926  break;
927  default:
928  {
929  switch ( nWhich )
930  {
931  case ATTR_CTL_FONT:
932  case ATTR_CJK_FONT:
933  nWhich = ATTR_FONT;
934  break;
937  nWhich = ATTR_FONT_HEIGHT;
938  break;
941  nWhich = ATTR_FONT_WEIGHT;
942  break;
945  nWhich = ATTR_FONT_POSTURE;
946  break;
947  }
948  }
949  }
950  return nWhich;
951 }
952 
953 void ScGlobal::AddLanguage( SfxItemSet& rSet, const SvNumberFormatter& rFormatter )
954 {
955  OSL_ENSURE( rSet.GetItemState( ATTR_LANGUAGE_FORMAT, false ) == SfxItemState::DEFAULT,
956  "ScGlobal::AddLanguage - language already added");
957 
958  const SfxPoolItem* pHardItem;
959  if ( rSet.GetItemState( ATTR_VALUE_FORMAT, false, &pHardItem ) != SfxItemState::SET )
960  return;
961 
962  const SvNumberformat* pHardFormat = rFormatter.GetEntry(
963  static_cast<const SfxUInt32Item*>(pHardItem)->GetValue() );
964 
965  sal_uInt32 nParentFmt = 0; // Pool default
966  const SfxItemSet* pParent = rSet.GetParent();
967  if ( pParent )
968  nParentFmt = pParent->Get( ATTR_VALUE_FORMAT ).GetValue();
969  const SvNumberformat* pParFormat = rFormatter.GetEntry( nParentFmt );
970 
971  if ( pHardFormat && pParFormat &&
972  (pHardFormat->GetLanguage() != pParFormat->GetLanguage()) )
973  rSet.Put( SvxLanguageItem( pHardFormat->GetLanguage(), ATTR_LANGUAGE_FORMAT ) );
974 }
975 
977 {
979  []()
980  {
982  ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
983  ::comphelper::getProcessComponentContext(), TransliterationFlags::IGNORE_CASE );
984  p->loadModuleIfNeeded( eOfficeLanguage );
985  return p;
986  });
987 }
989 {
991  []()
992  {
994  ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
995  ::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
996  p->loadModuleIfNeeded( eOfficeLanguage );
997  return p;
998  });
999 }
1000 
1002 {
1003  OSL_ENSURE(
1004  xSysLocale,
1005  "ScGlobal::getLocaleDataPtr() called before ScGlobal::Init()");
1006 
1007  return xSysLocale->GetLocaleDataPtr();
1008 }
1009 
1011 {
1012  OSL_ENSURE(
1013  xSysLocale,
1014  "ScGlobal::getCharClassPtr() called before ScGlobal::Init()");
1015 
1016  return xSysLocale->GetCharClassPtr();
1017 }
1018 
1020 {
1022  if ( !xCalendar )
1023  {
1025  xCalendar->loadDefaultCalendar( *GetLocale() );
1026  }
1027  return xCalendar.get();
1028 }
1030 {
1032  []()
1033  {
1036  return p;
1037  });
1038 }
1040 {
1042  []()
1043  {
1045  p->loadDefaultCollator( *GetLocale(), 0 );
1046  return p;
1047  });
1048 }
1049 css::lang::Locale* ScGlobal::GetLocale()
1050 {
1052  []() { return new css::lang::Locale( Application::GetSettings().GetLanguageTag().getLocale()); });
1053 }
1054 
1056 {
1058  if (!xFieldEditEngine)
1059  {
1060  // Creating a ScFieldEditEngine with pDocument=NULL leads to document
1061  // specific fields not being resolvable! See
1062  // ScFieldEditEngine::CalcFieldValue(). pEnginePool=NULL lets
1063  // EditEngine internally create and delete a default pool.
1064  xFieldEditEngine.reset(new ScFieldEditEngine( nullptr, nullptr));
1065  }
1066  return *xFieldEditEngine;
1067 }
1068 
1069 OUString ScGlobal::ReplaceOrAppend( const OUString& rString,
1070  const OUString& rPlaceholder, const OUString& rReplacement )
1071 {
1072  if (rString.isEmpty())
1073  return rReplacement;
1074  sal_Int32 nFound = rString.indexOf( rPlaceholder);
1075  if (nFound < 0)
1076  {
1077  if (rString[rString.getLength()-1] == ' ')
1078  return rString + rReplacement;
1079  return rString + " " + rReplacement;
1080  }
1081  return rString.replaceFirst( rPlaceholder, rReplacement, &nFound);
1082 }
1083 
1084 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsOptionSet(EOption eOption) const
static bool IsSystemRTL()
Definition: global.cxx:845
SfxViewFrame * GetViewFrame() const
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
List of spreadsheet functions.
Definition: funcdesc.hxx:242
static const OUString & GetClipDocName()
Definition: global.cxx:480
static std::atomic< CollatorWrapper * > pCaseCollator
Definition: global.hxx:524
static SC_DLLPUBLIC bool bThreadedGroupCalcInProgress
Calc's threaded group calculation is in progress.
Definition: global.hxx:813
static void DeInit()
Definition: compiler.cxx:171
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
Collection of user-defined sort lists.
Definition: userlist.hxx:66
static SC_DLLPUBLIC ScUnoAddInCollection * GetAddInCollection()
Definition: global.cxx:269
static Type * doubleCheckedInit(std::atomic< Type * > &pointer, Function function, GuardCtor guardCtor=osl::GetGlobalMutex())
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
constexpr sal_uInt16 KEY_MOD1
static bool EETextObjEqual(const EditTextObject *pObj1, const EditTextObject *pObj2)
Definition: global.cxx:748
#define LANGUAGE_ENGLISH_US
static SC_DLLPUBLIC::utl::TransliterationWrapper * GetpTransliteration()
Definition: global.cxx:976
std::string GetValue
static std::unique_ptr< ScFunctionMgr > xStarCalcFunctionMgr
Definition: global.hxx:516
static std::unique_ptr< ScUserList > xUserList
Definition: global.hxx:509
::utl::TransliterationWrapper * GetCaseTransliteration()
Definition: global.cxx:988
LanguageType getLanguageType(bool bResolveSystem=true) const
static std::atomic< css::lang::Locale * > pLocale
Definition: global.hxx:528
static SC_DLLPUBLIC void Init()
Definition: global.cxx:433
SfxDispatcher * GetDispatcher()
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
const OUString & GetName() const
static const AllSettings & GetSettings()
#define STD_ROWHEIGHT_DIFF
Definition: global.hxx:104
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
static std::unique_ptr< ScFieldEditEngine > xFieldEditEngine
Definition: global.hxx:530
static SC_DLLPUBLIC CollatorWrapper * GetCollator()
Definition: global.cxx:1029
aBuf
static void SetUserList(const ScUserList *pNewList)
Definition: global.cxx:285
static void OpenURL(const OUString &rURL, const OUString &rTarget, bool bIgnoreSettings=false)
Open the specified URL.
Definition: global.cxx:760
static std::atomic<::utl::TransliterationWrapper * > pCaseTransliteration
Definition: global.hxx:527
static std::unique_ptr< SvNumberFormatter > xEnglishFormatter
Definition: global.hxx:520
static OUString GetLongErrorString(FormulaError nErrNumber)
Definition: global.cxx:333
static bool ShouldOpenURL()
Whether the URL can be opened according to current security options (Click/Ctrl-Click) ...
Definition: global.cxx:825
static SvxBrushItem * GetButtonBrushItem()
Definition: global.cxx:426
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
static OUString GetCharsetString(rtl_TextEncoding eVal)
Definition: global.cxx:583
static SC_DLLPUBLIC OUString ReplaceOrAppend(const OUString &rString, const OUString &rPlaceholder, const OUString &rReplacement)
Replaces the first occurrence of rPlaceholder in rString with rReplacement, or if rPlaceholder is not...
Definition: global.cxx:1069
virtual SfxObjectShell * GetObjectShell() override
void ExitExternalFunc()
Definition: callform.cxx:240
Stores spreadsheet functions in categories, including a cumulative ('All') category and makes them ac...
Definition: funcdesc.hxx:306
static void InitPPT()
Definition: global.cxx:459
static OutputDevice * GetDefaultDevice()
static SC_DLLPUBLIC ScAutoFormat * GetAutoFormat()
Definition: global.cxx:247
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
sal_uInt16 sal_Unicode
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
static std::atomic< ScUnitConverter * > pUnitConverter
Definition: global.hxx:518
static bool HasAttrChanged(const SfxItemSet &rNewAttrs, const SfxItemSet &rOldAttrs, const sal_uInt16 nWhich)
Definition: global.cxx:119
static SC_DLLPUBLIC void EraseQuotes(OUString &rString, sal_Unicode cQuote, bool bUnescapeEmbedded=true)
Erases the character cQuote from rString, if it exists at beginning AND end.
Definition: global.cxx:684
static css::lang::Locale * GetLocale()
Definition: global.cxx:1049
void SetValue(const OUString &rTheValue)
static std::atomic< LegacyFuncCollection * > pLegacyFuncCollection
Definition: global.hxx:507
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static std::unique_ptr< ScFunctionList > xStarCalcFunctionList
Definition: global.hxx:515
static std::atomic< CollatorWrapper * > pCollator
Definition: global.hxx:525
static SC_DLLPUBLIC sal_uInt16 GetScriptedWhichID(SvtScriptType nScriptType, sal_uInt16 nWhich)
Map ATTR_((CJK|CTL)_)?FONT_...
Definition: global.cxx:865
#define STD_EXTRA_WIDTH
Definition: global.hxx:94
static SC_DLLPUBLIC sal_uInt32 GetStandardFormat(SvNumberFormatter &, sal_uInt32 nFormat, SvNumFormatType nType)
Definition: global.cxx:152
static SC_DLLPUBLIC void SetSearchItem(const SvxSearchItem &rNew)
Definition: global.cxx:224
static bool isVCLOpenGLEnabled()
static SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:70
const LanguageTag & GetLanguageTag() const
#define TWIPS_PER_INCH
Definition: global.hxx:85
ScAddInAsyncs theAddInAsyncTbl
Definition: adiasync.cxx:34
static SC_DLLPUBLIC sal_uInt16 nStdRowHeight
Definition: global.hxx:583
static SC_DLLPUBLIC void AddLanguage(SfxItemSet &rSet, const SvNumberFormatter &rFormatter)
Adds a language item to the item set, if the number format item contains a language that differs from...
Definition: global.cxx:953
static void ClearAutoFormat()
Definition: global.cxx:234
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
Definition: global2.cxx:284
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
SvtScriptType
static void GetFont(vcl::Font &rFont, const SfxItemSet &rItemSet, ScAutoFontColorMode eAutoMode, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE, const Color *pBackConfigColor=nullptr, const Color *pTextConfigColor=nullptr)
Static helper function to fill a font object from the passed item set.
Definition: patattr.cxx:216
static void SetClipDocName(const OUString &rNew)
Definition: global.cxx:485
static const OUString & GetNativeSymbol(OpCode eOp)
static void GlobalExit()
Definition: interpr4.cxx:3886
const SfxItemSet * GetParent() const
static bool isRightToLeft(LanguageType nLang)
static SC_DLLPUBLIC sal_Int32 FindUnquoted(const OUString &rString, sal_Unicode cChar)
Finds an unquoted instance of cChar in rString, starting at offset nStart.
Definition: global.cxx:700
static ScFieldEditEngine & GetStaticFieldEditEngine()
A static instance of ScFieldEditEngine not capable of resolving document specific fields...
Definition: global.cxx:1055
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define LANGUAGE_SYSTEM
static SC_DLLPUBLIC void Clear()
Definition: global.cxx:522
static tools::SvRef< ScDocShell > xDrawClipDocShellRef
Definition: global.hxx:580
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:578
static std::unique_ptr< CalendarWrapper > xCalendar
Definition: global.hxx:523
static long nLastColWidthExtra
Definition: global.hxx:586
sal_Int32 loadDefaultCollator(const css::lang::Locale &rLocale, sal_Int32 nOption)
static SC_DLLPUBLIC sal_uInt16 GetStandardRowHeight()
Definition: global.cxx:161
static ScFunctionMgr * GetStarCalcFunctionMgr()
Definition: global.cxx:620
virtual SvxSearchItem * Clone(SfxItemPool *pPool=nullptr) const override
ocErrName
static void Init()
MUST be called once before any other method.
Definition: parclass.cxx:286
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:274
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
bool Equals(const EditTextObject &rCompare) const
SvNumFormatType
static SC_DLLPUBLIC long nLastRowHeightExtra
Definition: global.hxx:585
static ScUnitConverter * GetUnitConverter()
Definition: global.cxx:636
static CollatorWrapper * GetCaseCollator()
Definition: global.cxx:1039
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
void global_InitAppOptions()
Definition: scmod.cxx:727
ocErrNull
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:547
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
ocErrNum
SfxItemPool * GetPool() const
sal_Int16 GetBottomMargin() const
FormulaError
static LanguageType GetEditDefaultLanguage()
Definition: global.cxx:859
static ScFunctionList * GetStarCalcFunctionList()
Definition: global.cxx:611
static std::unique_ptr< ScAutoFormat > xAutoFormat
Definition: global.hxx:506
ocErrValue
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
Point LogicToPixel(const Point &rLogicPt) const
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
const LanguageTag & getLocale()
static bool HasStarCalcFunctionList()
Definition: global.cxx:606
static SC_DLLPUBLIC const LocaleDataWrapper * getLocaleDataPtr()
Definition: global.cxx:1001
static std::unique_ptr< SvtSysLocale > xSysLocale
Definition: global.hxx:535
static void InitTextHeight(const SfxItemPool *pPool)
Definition: global.cxx:491
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
NF_EVALDATEFORMAT_INTL_FORMAT
static SC_DLLPUBLIC SvtScriptType GetDefaultScriptType()
Definition: global.cxx:850
ocErrDivZero
static SfxViewFrame * Current()
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
static LegacyFuncCollection * GetLegacyFuncCollection()
Definition: global.cxx:264
static CalendarWrapper * GetCalendar()
Definition: global.cxx:1019
SfxItemState
static sal_uInt16 nDefFontHeight
Definition: global.hxx:582
static void InitAddIns()
Definition: globalx.cxx:43
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr TypedWhichId< SvxOverlineItem > ATTR_FONT_OVERLINE(105)
static SC_DLLPUBLIC OUString addToken(const OUString &rTokenList, const OUString &rToken, sal_Unicode cSep, sal_Int32 nSepCount=1, bool bForceSep=false)
Adds the string rToken to rTokenList, using a list separator character.
Definition: global.cxx:656
static std::unique_ptr< SvxSearchItem > xSearchItem
Definition: global.hxx:505
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
sal_uInt16 nScFillModeMouseModifier
Definition: global.cxx:113
sal_uInt16 nScClickMouseModifier
Definition: global.cxx:112
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
#define SC_COLLATOR_IGNORES
Definition: global.hxx:48
static bool CheckWidthInvalidate(bool &bNumFormatChanged, const SfxItemSet &rNewAttrs, const SfxItemSet &rOldAttrs)
Definition: global.cxx:178
SfxViewShell * pScActiveViewShell
Definition: global.cxx:111
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
static SvNumberFormatter * GetEnglishFormatter()
a "ReadOnly" formatter for UNO/XML export
Definition: global.cxx:166
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
Definition: global.cxx:1010
void * p
Reference< XComponentContext > getProcessComponentContext()
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:576
const char * pChar
static rtl_TextEncoding GetCharsetValue(const OUString &rCharSet)
Definition: global.cxx:555
static bool isAsciiNumeric(const OUString &rStr)
static const sal_Unicode * UnicodeStrChr(const sal_Unicode *pStr, sal_Unicode c)
strchr() functionality on unicode, as long as we need it for FormulaToken etc.
Definition: global.cxx:642
ocErrNA
static std::unique_ptr< SvxBrushItem > xEmptyBrushItem
Definition: global.hxx:512
static SC_DLLPUBLIC const OUString aEmptyOUString
Definition: global.hxx:510
static std::atomic<::utl::TransliterationWrapper * > pTransliteration
Definition: global.hxx:526
static std::atomic< ScUnoAddInCollection * > pAddInCollection
Definition: global.hxx:508
static std::unique_ptr< SvxBrushItem > xButtonBrushItem
Definition: global.hxx:513
static SC_DLLPUBLIC bool IsQuoted(const OUString &rString, sal_Unicode cQuote)
Returns true, if the first and last character of the string is cQuote.
Definition: global.cxx:666
constexpr sal_uInt16 KEY_SHIFT
static SC_DLLPUBLIC ScAutoFormat * GetOrCreateAutoFormat()
Definition: global.cxx:252
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
static SC_DLLPUBLIC void AddQuotes(OUString &rString, sal_Unicode cQuote, bool bEscapeEmbedded=true)
Inserts the character cQuote at beginning and end of rString.
Definition: global.cxx:671
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
static OUString GetErrorString(FormulaError nErrNumber)
Definition: global.cxx:301
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
static void ResetFunctionList()
Definition: global.cxx:629
LanguageType GetLanguage() const
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
void loadModuleIfNeeded(LanguageType nLang)
static css::uno::Reference< css::i18n::XOrdinalSuffix > xOrdinalSuffix
Definition: global.hxx:522
sal_Int16 GetTopMargin() const
static SC_DLLPUBLIC const SvxSearchItem & GetSearchItem()
Definition: global.cxx:213
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill= '\0')
static OUString aStrClipDocName
Definition: global.hxx:511
SfxMedium * GetMedium() const