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