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