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 <o3tl/unit_conversion.hxx>
27 #include <sfx2/docfile.hxx>
28 #include <sfx2/dispatch.hxx>
29 #include <sfx2/objsh.hxx>
30 #include <sfx2/sfxsids.hrc>
31 #include <sfx2/viewfrm.hxx>
32 #include <sfx2/viewsh.hxx>
33 #include <svl/intitem.hxx>
34 #include <svl/stritem.hxx>
35 #include <svl/zforlist.hxx>
36 #include <svl/zformat.hxx>
37 #include <vcl/keycodes.hxx>
38 #include <vcl/virdev.hxx>
39 #include <vcl/settings.hxx>
40 #include <vcl/svapp.hxx>
41 #include <unotools/charclass.hxx>
43 #include <osl/diagnose.h>
44 
45 #include <i18nlangtag/mslangid.hxx>
48 #include <comphelper/string.hxx>
51 #include <unotools/syslocale.hxx>
53 
54 #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  }
422  return ScResId(pErrNumber);
423 }
424 
426 {
428  xButtonBrushItem->SetColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
429  return xButtonBrushItem.get();
430 }
431 
433 {
434  // The default language for number formats (ScGlobal::eLnge) must
435  // always be LANGUAGE_SYSTEM
436  // FIXME: So remove this variable?
438 
439  xSysLocale = std::make_unique<SvtSysLocale>();
440 
441  xEmptyBrushItem = std::make_unique<SvxBrushItem>( COL_TRANSPARENT, ATTR_BACKGROUND );
442  xButtonBrushItem = std::make_unique<SvxBrushItem>( Color(), ATTR_BACKGROUND );
443 
444  InitPPT();
445  //ScCompiler::InitSymbolsNative();
446  // ScParameterClassification _after_ Compiler, needs function resources if
447  // arguments are to be merged in, which in turn need strings of function
448  // names from the compiler.
450 
451  InitAddIns();
452 
453  aStrClipDocName = ScResId( SCSTR_NONAME ) + "1";
454 
455  // ScDocumentPool::InitVersionMaps() has been called earlier already
456 }
457 
459 {
461 
463  {
464  // LOK: the below limited precision is not enough for RowColumnHeader.
465  nScreenPPTX = o3tl::convert<double>(pDev->GetDPIX(), o3tl::Length::twip, o3tl::Length::in);
466  nScreenPPTY = o3tl::convert<double>(pDev->GetDPIY(), o3tl::Length::twip, o3tl::Length::in);
467  }
468  else
469  {
470  // Avoid cumulative placement errors by intentionally limiting
471  // precision.
472  Point aPix1000 = pDev->LogicToPixel(Point(1000, 1000), MapMode(MapUnit::MapTwip));
473  nScreenPPTX = aPix1000.X() / 1000.0;
474  nScreenPPTY = aPix1000.Y() / 1000.0;
475  }
476 }
477 
478 const OUString& ScGlobal::GetClipDocName()
479 {
480  return aStrClipDocName;
481 }
482 
483 void ScGlobal::SetClipDocName( const OUString& rNew )
484 {
486  aStrClipDocName = rNew;
487 }
488 
490 {
491  if (!pPool)
492  {
493  OSL_FAIL("ScGlobal::InitTextHeight: No Pool");
494  return;
495  }
496 
497  const ScPatternAttr& rPattern = pPool->GetDefaultItem(ATTR_PATTERN);
498 
500  ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *pDefaultDev );
501  pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
502  vcl::Font aDefFont;
503  rPattern.GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color doesn't matter here
504  pVirtWindow->SetFont(aDefFont);
505  sal_uInt16 nTest = static_cast<sal_uInt16>(
506  pVirtWindow->PixelToLogic(Size(0, pVirtWindow->GetTextHeight()), MapMode(MapUnit::MapTwip)).Height());
507 
508  if (nTest > nDefFontHeight)
509  nDefFontHeight = nTest;
510 
511  const SvxMarginItem& rMargin = rPattern.GetItem(ATTR_MARGIN);
512 
513  nTest = static_cast<sal_uInt16>(nDefFontHeight + rMargin.GetTopMargin()
514  + rMargin.GetBottomMargin() - STD_ROWHEIGHT_DIFF);
515 
516  if (nTest > nStdRowHeight)
517  nStdRowHeight = nTest;
518 }
519 
521 {
522  // Destroy asyncs _before_ ExitExternalFunc!
523  theAddInAsyncTbl.clear();
525  ClearAutoFormat();
526  xSearchItem.reset();
527  delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr;
528  delete pAddInCollection.load(); pAddInCollection = nullptr;
529  xUserList.reset();
530  xStarCalcFunctionList.reset(); // Destroy before ResMgr!
531  xStarCalcFunctionMgr.reset();
534  ScInterpreter::GlobalExit(); // Delete static Stack
535 
536  xEmptyBrushItem.reset();
537  xButtonBrushItem.reset();
538  xEnglishFormatter.reset();
539  delete pCaseTransliteration.load(); pCaseTransliteration = nullptr;
540  delete pTransliteration.load(); pTransliteration = nullptr;
541  delete pCaseCollator.load(); pCaseCollator = nullptr;
542  delete pCollator.load(); pCollator = nullptr;
543  xCalendar.reset();
544  xSysLocale.reset();
545  delete pLocale.load(); pLocale = nullptr;
546 
547  delete pUnitConverter.load(); pUnitConverter = nullptr;
548  xFieldEditEngine.reset();
549 
551 }
552 
553 rtl_TextEncoding ScGlobal::GetCharsetValue( const OUString& rCharSet )
554 {
555  // new TextEncoding values
556  if ( CharClass::isAsciiNumeric( rCharSet ) )
557  {
558  sal_Int32 nVal = rCharSet.toInt32();
559  if ( nVal == RTL_TEXTENCODING_DONTKNOW )
560  return osl_getThreadTextEncoding();
561  return static_cast<rtl_TextEncoding>(nVal);
562  }
563  // old CharSet values for compatibility
564  else if (rCharSet.equalsIgnoreAsciiCase("ANSI") ) return RTL_TEXTENCODING_MS_1252;
565  else if (rCharSet.equalsIgnoreAsciiCase("MAC") ) return RTL_TEXTENCODING_APPLE_ROMAN;
566  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC") ) return RTL_TEXTENCODING_IBM_850;
567  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_437")) return RTL_TEXTENCODING_IBM_437;
568  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_850")) return RTL_TEXTENCODING_IBM_850;
569  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_860")) return RTL_TEXTENCODING_IBM_860;
570  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_861")) return RTL_TEXTENCODING_IBM_861;
571  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_863")) return RTL_TEXTENCODING_IBM_863;
572  else if (rCharSet.equalsIgnoreAsciiCase("IBMPC_865")) return RTL_TEXTENCODING_IBM_865;
573  // Some wrong "help" on the net mentions UTF8 and even unoconv uses it,
574  // which worked accidentally if the system encoding is UTF-8 anyway, so
575  // support it ;) but only when reading.
576  else if (rCharSet.equalsIgnoreAsciiCase("UTF8")) return RTL_TEXTENCODING_UTF8;
577  else if (rCharSet.equalsIgnoreAsciiCase("UTF-8")) return RTL_TEXTENCODING_UTF8;
578  else return osl_getThreadTextEncoding();
579 }
580 
581 OUString ScGlobal::GetCharsetString( rtl_TextEncoding eVal )
582 {
583  const char* pChar;
584  switch ( eVal )
585  {
586  // old CharSet strings for compatibility
587  case RTL_TEXTENCODING_MS_1252: pChar = "ANSI"; break;
588  case RTL_TEXTENCODING_APPLE_ROMAN: pChar = "MAC"; break;
589  // IBMPC == IBMPC_850
590  case RTL_TEXTENCODING_IBM_437: pChar = "IBMPC_437"; break;
591  case RTL_TEXTENCODING_IBM_850: pChar = "IBMPC_850"; break;
592  case RTL_TEXTENCODING_IBM_860: pChar = "IBMPC_860"; break;
593  case RTL_TEXTENCODING_IBM_861: pChar = "IBMPC_861"; break;
594  case RTL_TEXTENCODING_IBM_863: pChar = "IBMPC_863"; break;
595  case RTL_TEXTENCODING_IBM_865: pChar = "IBMPC_865"; break;
596  case RTL_TEXTENCODING_DONTKNOW: pChar = "SYSTEM"; break;
597  // new string of TextEncoding value
598  default:
599  return OUString::number( eVal );
600  }
601  return OUString::createFromAscii(pChar);
602 }
603 
605 {
606  return bool(xStarCalcFunctionList);
607 }
608 
610 {
612  if ( !xStarCalcFunctionList )
614 
615  return xStarCalcFunctionList.get();
616 }
617 
619 {
621  if ( !xStarCalcFunctionMgr )
623 
624  return xStarCalcFunctionMgr.get();
625 }
626 
628 {
629  // FunctionMgr has pointers into FunctionList, must also be updated
630  xStarCalcFunctionMgr.reset();
631  xStarCalcFunctionList.reset();
632 }
633 
635 {
637  []() { return new ScUnitConverter; });
638 }
639 
641  sal_Unicode c )
642 {
643  if ( !pStr )
644  return nullptr;
645  while ( *pStr )
646  {
647  if ( *pStr == c )
648  return pStr;
649  pStr++;
650  }
651  return nullptr;
652 }
653 
654 OUString ScGlobal::addToken(const OUString& rTokenList, std::u16string_view rToken,
655  sal_Unicode cSep, sal_Int32 nSepCount, bool bForceSep)
656 {
657  OUStringBuffer aBuf(rTokenList);
658  if( bForceSep || (!rToken.empty() && !rTokenList.isEmpty()) )
659  comphelper::string::padToLength(aBuf, aBuf.getLength() + nSepCount, cSep);
660  aBuf.append(rToken);
661  return aBuf.makeStringAndClear();
662 }
663 
664 bool ScGlobal::IsQuoted( const OUString& rString, sal_Unicode cQuote )
665 {
666  return (rString.getLength() >= 2) && (rString[0] == cQuote) && (rString[ rString.getLength() - 1 ] == cQuote);
667 }
668 
669 void ScGlobal::AddQuotes( OUString& rString, sal_Unicode cQuote, bool bEscapeEmbedded )
670 {
671  if (bEscapeEmbedded)
672  {
673  sal_Unicode pQ[3];
674  pQ[0] = pQ[1] = cQuote;
675  pQ[2] = 0;
676  OUString aQuotes( pQ );
677  rString = rString.replaceAll( OUStringChar(cQuote), aQuotes);
678  }
679  rString = OUStringChar( cQuote ) + rString + OUStringChar( cQuote );
680 }
681 
682 void ScGlobal::EraseQuotes( OUString& rString, sal_Unicode cQuote, bool bUnescapeEmbedded )
683 {
684  if ( IsQuoted( rString, cQuote ) )
685  {
686  rString = rString.copy( 1, rString.getLength() - 2 );
687  if (bUnescapeEmbedded)
688  {
689  sal_Unicode pQ[3];
690  pQ[0] = pQ[1] = cQuote;
691  pQ[2] = 0;
692  OUString aQuotes( pQ );
693  rString = rString.replaceAll( aQuotes, OUStringChar(cQuote));
694  }
695  }
696 }
697 
698 sal_Int32 ScGlobal::FindUnquoted( const OUString& rString, sal_Unicode cChar, sal_Int32 nStart )
699 {
700  assert(nStart >= 0);
701  const sal_Unicode cQuote = '\'';
702  const sal_Unicode* const pStart = rString.getStr();
703  const sal_Unicode* const pStop = pStart + rString.getLength();
704  const sal_Unicode* p = pStart + nStart;
705  bool bQuoted = false;
706  while (p < pStop)
707  {
708  if (*p == cChar && !bQuoted)
709  return sal::static_int_cast< sal_Int32 >( p - pStart );
710  else if (*p == cQuote)
711  {
712  if (!bQuoted)
713  bQuoted = true;
714  else if (p < pStop-1 && *(p+1) == cQuote)
715  ++p;
716  else
717  bQuoted = false;
718  }
719  ++p;
720  }
721  return -1;
722 }
723 
725 {
726  sal_Unicode cQuote = '\'';
727  const sal_Unicode* p = pString;
728  bool bQuoted = false;
729  while (*p)
730  {
731  if (*p == cChar && !bQuoted)
732  return p;
733  else if (*p == cQuote)
734  {
735  if (!bQuoted)
736  bQuoted = true;
737  else if (*(p+1) == cQuote)
738  ++p;
739  else
740  bQuoted = false;
741  }
742  ++p;
743  }
744  return nullptr;
745 }
746 
748  const EditTextObject* pObj2 )
749 {
750  if ( pObj1 == pObj2 ) // Both empty or the same object
751  return true;
752 
753  if ( pObj1 && pObj2 )
754  return pObj1->Equals( *pObj2);
755 
756  return false;
757 }
758 
759 void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgnoreSettings)
760 {
761  // OpenURL is always called in the GridWindow by mouse clicks in some way or another.
762  // That's why pScActiveViewShell and nScClickMouseModifier are correct.
763 
764  if (!bIgnoreSettings && !ShouldOpenURL())
765  return;
766 
767  SfxViewFrame* pViewFrm = SfxViewFrame::Current();
768  if (!pViewFrm)
769  return;
770 
771  OUString aUrlName( rURL );
772  SfxViewFrame* pFrame = nullptr;
773  const SfxObjectShell* pObjShell = nullptr;
774  OUString aReferName;
775  if ( pScActiveViewShell )
776  {
777  pFrame = pScActiveViewShell->GetViewFrame();
778  pObjShell = pFrame->GetObjectShell();
779  const SfxMedium* pMed = pObjShell->GetMedium();
780  if (pMed)
781  aReferName = pMed->GetName();
782  }
783 
784  // Don't fiddle with fragments pointing into current document.
785  // Also don't mess around with a vnd.sun.star.script or service or other
786  // internal "URI".
787  if (!aUrlName.startsWith("#")
788  && !aUrlName.startsWithIgnoreAsciiCase("vnd.sun.star.script:")
789  && !aUrlName.startsWithIgnoreAsciiCase("macro:")
790  && !aUrlName.startsWithIgnoreAsciiCase("slot:")
791  && !aUrlName.startsWithIgnoreAsciiCase("service:")
792  && !aUrlName.startsWithIgnoreAsciiCase(".uno:"))
793  {
794  // Any relative reference would fail with "not an absolute URL"
795  // error, try to construct an absolute URI with the path relative
796  // to the current document's path or work path, as usual for all
797  // external references.
798  // This then also, as ScGlobal::GetAbsDocName() uses
799  // INetURLObject::smartRel2Abs(), supports "\\" UNC path names as
800  // smb:// Samba shares and DOS path separators converted to proper
801  // file:// URI.
802  const OUString aNewUrlName( ScGlobal::GetAbsDocName( aUrlName, pObjShell));
803  if (!aNewUrlName.isEmpty())
804  aUrlName = aNewUrlName;
805  }
806 
807  SfxStringItem aUrl( SID_FILE_NAME, aUrlName );
808  SfxStringItem aTarget( SID_TARGETNAME, rTarget );
809  if ( nScClickMouseModifier & KEY_SHIFT ) // control-click -> into new window
810  aTarget.SetValue("_blank");
811 
812  SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
813  SfxStringItem aReferer( SID_REFERER, aReferName );
814 
815  SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
816  SfxBoolItem aBrowsing( SID_BROWSE, true );
817 
818  // No SID_SILENT anymore
819  pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC,
820  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
821  { &aUrl, &aTarget, &aFrm, &aReferer, &aNewView, &aBrowsing });
822 }
823 
825 {
826  SvtSecurityOptions aSecOpt;
827  bool bCtrlClickHappened = (nScClickMouseModifier & KEY_MOD1);
828  bool bCtrlClickSecOption = aSecOpt.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink );
829  if( bCtrlClickHappened && ! bCtrlClickSecOption )
830  {
831  // return since ctrl+click happened when the
832  // ctrl+click security option was disabled, link should not open
833  return false;
834  }
835  else if( ! bCtrlClickHappened && bCtrlClickSecOption )
836  {
837  // ctrl+click did not happen; only click happened maybe with some
838  // other key combo. and security option is set, so return
839  return false;
840  }
841  return true;
842 }
843 
845 {
846  return MsLangId::isRightToLeft( Application::GetSettings().GetLanguageTag().getLanguageType() );
847 }
848 
850 {
851  // Used when text contains only WEAK characters.
852  // Script type of office language is used then (same as GetEditDefaultLanguage,
853  // to get consistent behavior of text in simple cells and EditEngine,
854  // also same as GetAppLanguage() in Writer)
855  return SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
856 }
857 
859 {
860  // Used for EditEngine::SetDefaultLanguage
862 }
863 
864 sal_uInt16 ScGlobal::GetScriptedWhichID( SvtScriptType nScriptType, sal_uInt16 nWhich )
865 {
866  switch ( nScriptType )
867  {
868  case SvtScriptType::LATIN:
869  case SvtScriptType::ASIAN:
870  case SvtScriptType::COMPLEX:
871  break; // take exact matches
872  default: // prefer one, first COMPLEX, then ASIAN
873  if ( nScriptType & SvtScriptType::COMPLEX )
874  nScriptType = SvtScriptType::COMPLEX;
875  else if ( nScriptType & SvtScriptType::ASIAN )
876  nScriptType = SvtScriptType::ASIAN;
877  }
878  switch ( nScriptType )
879  {
880  case SvtScriptType::COMPLEX:
881  {
882  switch ( nWhich )
883  {
884  case ATTR_FONT:
885  case ATTR_CJK_FONT:
886  nWhich = ATTR_CTL_FONT;
887  break;
888  case ATTR_FONT_HEIGHT:
890  nWhich = ATTR_CTL_FONT_HEIGHT;
891  break;
892  case ATTR_FONT_WEIGHT:
894  nWhich = ATTR_CTL_FONT_WEIGHT;
895  break;
896  case ATTR_FONT_POSTURE:
898  nWhich = ATTR_CTL_FONT_POSTURE;
899  break;
900  }
901  }
902  break;
903  case SvtScriptType::ASIAN:
904  {
905  switch ( nWhich )
906  {
907  case ATTR_FONT:
908  case ATTR_CTL_FONT:
909  nWhich = ATTR_CJK_FONT;
910  break;
911  case ATTR_FONT_HEIGHT:
913  nWhich = ATTR_CJK_FONT_HEIGHT;
914  break;
915  case ATTR_FONT_WEIGHT:
917  nWhich = ATTR_CJK_FONT_WEIGHT;
918  break;
919  case ATTR_FONT_POSTURE:
921  nWhich = ATTR_CJK_FONT_POSTURE;
922  break;
923  }
924  }
925  break;
926  default:
927  {
928  switch ( nWhich )
929  {
930  case ATTR_CTL_FONT:
931  case ATTR_CJK_FONT:
932  nWhich = ATTR_FONT;
933  break;
936  nWhich = ATTR_FONT_HEIGHT;
937  break;
940  nWhich = ATTR_FONT_WEIGHT;
941  break;
944  nWhich = ATTR_FONT_POSTURE;
945  break;
946  }
947  }
948  }
949  return nWhich;
950 }
951 
952 void ScGlobal::AddLanguage( SfxItemSet& rSet, const SvNumberFormatter& rFormatter )
953 {
954  OSL_ENSURE( rSet.GetItemState( ATTR_LANGUAGE_FORMAT, false ) == SfxItemState::DEFAULT,
955  "ScGlobal::AddLanguage - language already added");
956 
957  const SfxPoolItem* pHardItem;
958  if ( rSet.GetItemState( ATTR_VALUE_FORMAT, false, &pHardItem ) != SfxItemState::SET )
959  return;
960 
961  const SvNumberformat* pHardFormat = rFormatter.GetEntry(
962  static_cast<const SfxUInt32Item*>(pHardItem)->GetValue() );
963 
964  sal_uInt32 nParentFmt = 0; // Pool default
965  const SfxItemSet* pParent = rSet.GetParent();
966  if ( pParent )
967  nParentFmt = pParent->Get( ATTR_VALUE_FORMAT ).GetValue();
968  const SvNumberformat* pParFormat = rFormatter.GetEntry( nParentFmt );
969 
970  if ( pHardFormat && pParFormat &&
971  (pHardFormat->GetLanguage() != pParFormat->GetLanguage()) )
972  rSet.Put( SvxLanguageItem( pHardFormat->GetLanguage(), ATTR_LANGUAGE_FORMAT ) );
973 }
974 
976 {
978  []()
979  {
981  ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
982  ::comphelper::getProcessComponentContext(), TransliterationFlags::IGNORE_CASE );
983  p->loadModuleIfNeeded( eOfficeLanguage );
984  return p;
985  });
986 }
988 {
990  []()
991  {
993  ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
994  ::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
995  p->loadModuleIfNeeded( eOfficeLanguage );
996  return p;
997  });
998 }
999 
1001 {
1002  OSL_ENSURE(
1003  xSysLocale,
1004  "ScGlobal::getLocaleDataPtr() called before ScGlobal::Init()");
1005 
1006  return xSysLocale->GetLocaleDataPtr();
1007 }
1008 
1010 {
1011  OSL_ENSURE(
1012  xSysLocale,
1013  "ScGlobal::getCharClassPtr() called before ScGlobal::Init()");
1014 
1015  return xSysLocale->GetCharClassPtr();
1016 }
1017 
1019 {
1021  if ( !xCalendar )
1022  {
1024  xCalendar->loadDefaultCalendar( *GetLocale() );
1025  }
1026  return xCalendar.get();
1027 }
1029 {
1031  []()
1032  {
1035  return p;
1036  });
1037 }
1039 {
1041  []()
1042  {
1044  p->loadDefaultCollator( *GetLocale(), 0 );
1045  return p;
1046  });
1047 }
1048 css::lang::Locale* ScGlobal::GetLocale()
1049 {
1051  []() { return new css::lang::Locale( Application::GetSettings().GetLanguageTag().getLocale()); });
1052 }
1053 
1055 {
1057  if (!xFieldEditEngine)
1058  {
1059  // Creating a ScFieldEditEngine with pDocument=NULL leads to document
1060  // specific fields not being resolvable! See
1061  // ScFieldEditEngine::CalcFieldValue(). pEnginePool=NULL lets
1062  // EditEngine internally create and delete a default pool.
1063  xFieldEditEngine.reset(new ScFieldEditEngine( nullptr, nullptr));
1064  }
1065  return *xFieldEditEngine;
1066 }
1067 
1068 OUString ScGlobal::ReplaceOrAppend( const OUString& rString,
1069  std::u16string_view rPlaceholder, const OUString& rReplacement )
1070 {
1071  if (rString.isEmpty())
1072  return rReplacement;
1073  sal_Int32 nFound = rString.indexOf( rPlaceholder);
1074  if (nFound < 0)
1075  {
1076  if (rString[rString.getLength()-1] == ' ')
1077  return rString + rReplacement;
1078  return rString + " " + rReplacement;
1079  }
1080  return rString.replaceFirst( rPlaceholder, rReplacement, &nFound);
1081 }
1082 
1083 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsOptionSet(EOption eOption) const
static bool IsSystemRTL()
Definition: global.cxx:844
SfxViewFrame * GetViewFrame() const
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
List of spreadsheet functions.
Definition: funcdesc.hxx:241
static const OUString & GetClipDocName()
Definition: global.cxx:478
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:167
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 SC_DLLPUBLIC OUString ReplaceOrAppend(const OUString &rString, std::u16string_view rPlaceholder, const OUString &rReplacement)
Replaces the first occurrence of rPlaceholder in rString with rReplacement, or if rPlaceholder is not...
Definition: global.cxx:1068
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:747
#define LANGUAGE_ENGLISH_US
static SC_DLLPUBLIC::utl::TransliterationWrapper * GetpTransliteration()
Definition: global.cxx:975
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:987
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:432
SfxDispatcher * GetDispatcher()
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
const OUString & GetName() const
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
static const AllSettings & GetSettings()
#define STD_ROWHEIGHT_DIFF
Definition: global.hxx:105
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:1028
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:759
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:824
static SvxBrushItem * GetButtonBrushItem()
Definition: global.cxx:425
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
static OUString GetCharsetString(rtl_TextEncoding eVal)
Definition: global.cxx:581
virtual SfxObjectShell * GetObjectShell() override
void ExitExternalFunc()
Definition: callform.cxx:239
Stores spreadsheet functions in categories, including a cumulative ('All') category and makes them ac...
Definition: funcdesc.hxx:305
static SC_DLLPUBLIC sal_Int32 FindUnquoted(const OUString &rString, sal_Unicode cChar, sal_Int32 nStart=0)
Finds an unquoted instance of cChar in rString, starting at offset nStart.
Definition: global.cxx:698
static void InitPPT()
Definition: global.cxx:458
static OutputDevice * GetDefaultDevice()
static SC_DLLPUBLIC ScAutoFormat * GetAutoFormat()
Definition: global.cxx:247
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
sal_uInt16 sal_Unicode
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:682
static css::lang::Locale * GetLocale()
Definition: global.cxx:1048
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:864
#define STD_EXTRA_WIDTH
Definition: global.hxx:95
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 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
ScAddInAsyncs theAddInAsyncTbl
Definition: adiasync.cxx:32
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:952
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:214
static void SetClipDocName(const OUString &rNew)
Definition: global.cxx:483
static const OUString & GetNativeSymbol(OpCode eOp)
static void GlobalExit()
Definition: interpr4.cxx:3883
const SfxItemSet * GetParent() const
static bool isRightToLeft(LanguageType nLang)
static ScFieldEditEngine & GetStaticFieldEditEngine()
A static instance of ScFieldEditEngine not capable of resolving document specific fields...
Definition: global.cxx:1054
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:520
static tools::SvRef< ScDocShell > xDrawClipDocShellRef
Definition: global.hxx:580
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:578
::tools::Long nLastColWidthExtra
Definition: global.hxx:586
static std::unique_ptr< CalendarWrapper > xCalendar
Definition: global.hxx:523
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:618
virtual SvxSearchItem * Clone(SfxItemPool *pPool=nullptr) const override
ocErrName
static void Init()
MUST be called once before any other method.
Definition: parclass.cxx:284
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:274
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
bool Equals(const EditTextObject &rCompare) const
SvNumFormatType
static ScUnitConverter * GetUnitConverter()
Definition: global.cxx:634
static CollatorWrapper * GetCaseCollator()
Definition: global.cxx:1038
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
void global_InitAppOptions()
Definition: scmod.cxx:723
ocErrNull
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:547
static SC_DLLPUBLIC OUString addToken(const OUString &rTokenList, std::u16string_view 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:654
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:858
static ScFunctionList * GetStarCalcFunctionList()
Definition: global.cxx:609
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:604
static SC_DLLPUBLIC const LocaleDataWrapper * getLocaleDataPtr()
Definition: global.cxx:1000
static std::unique_ptr< SvtSysLocale > xSysLocale
Definition: global.hxx:535
static void InitTextHeight(const SfxItemPool *pPool)
Definition: global.cxx:489
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
NF_EVALDATEFORMAT_INTL_FORMAT
static SC_DLLPUBLIC SvtScriptType GetDefaultScriptType()
Definition: global.cxx:849
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:1018
SfxItemState
static sal_uInt16 nDefFontHeight
Definition: global.hxx:582
static void InitAddIns()
Definition: globalx.cxx:44
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr TypedWhichId< SvxOverlineItem > ATTR_FONT_OVERLINE(105)
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:49
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:1009
void * p
Reference< XComponentContext > getProcessComponentContext()
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
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:553
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:640
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:664
constexpr sal_uInt16 KEY_SHIFT
static SC_DLLPUBLIC ScAutoFormat * GetOrCreateAutoFormat()
Definition: global.cxx:252
static SC_DLLPUBLIC::tools::Long nLastRowHeightExtra
Definition: global.hxx:585
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:669
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:627
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