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