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 case FormulaError::NoCode:
395 pErrNumber = STR_LONG_ERR_SYNTAX;
396 break;
397 case FormulaError::CircularReference:
398 pErrNumber = STR_LONG_ERR_CIRC_REF;
399 break;
400 case FormulaError::NoConvergence:
401 pErrNumber = STR_LONG_ERR_NO_CONV;
402 break;
403 case FormulaError::NoRef:
404 pErrNumber = STR_LONG_ERR_NO_REF;
405 break;
406 case FormulaError::NoName:
407 pErrNumber = STR_LONG_ERR_NO_NAME;
408 break;
409 case FormulaError::NoAddin:
410 pErrNumber = STR_LONG_ERR_NO_ADDIN;
411 break;
412 case FormulaError::NoMacro:
413 pErrNumber = STR_LONG_ERR_NO_MACRO;
414 break;
415 case FormulaError::DivisionByZero:
416 pErrNumber = STR_LONG_ERR_DIV_ZERO;
417 break;
418 case FormulaError::NestedArray:
419 pErrNumber = STR_ERR_LONG_NESTED_ARRAY;
420 break;
421 case FormulaError::BadArrayContent:
422 pErrNumber = STR_ERR_LONG_BAD_ARRAY_CONTENT;
423 break;
424 case FormulaError::LinkFormulaNeedingCheck:
425 pErrNumber = STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK;
426 break;
427 case FormulaError::NoValue:
428 pErrNumber = STR_LONG_ERR_NO_VALUE;
429 break;
430 case FormulaError::NotAvailable:
431 pErrNumber = STR_LONG_ERR_NV;
432 break;
433 default:
434 return ScResId(STR_ERROR_STR) + OUString::number( static_cast<int>(nErr) );
435 }
436 return ScResId(pErrNumber);
437}
438
440{
442 xButtonBrushItem->SetColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
443 return xButtonBrushItem.get();
444}
445
447{
448 // The default language for number formats (ScGlobal::eLnge) must
449 // always be LANGUAGE_SYSTEM
450 // FIXME: So remove this variable?
452
453 oSysLocale.emplace();
454
455 xEmptyBrushItem = std::make_unique<SvxBrushItem>( COL_TRANSPARENT, ATTR_BACKGROUND );
456 xButtonBrushItem = std::make_unique<SvxBrushItem>( Color(), ATTR_BACKGROUND );
457
458 InitPPT();
459 //ScCompiler::InitSymbolsNative();
460 // ScParameterClassification _after_ Compiler, needs function resources if
461 // arguments are to be merged in, which in turn need strings of function
462 // names from the compiler.
464
465 InitAddIns();
466
467 aStrClipDocName = ScResId( SCSTR_NONAME ) + "1";
468
469 // ScDocumentPool::InitVersionMaps() has been called earlier already
470}
471
473{
475
477 {
478 // LOK: the below limited precision is not enough for RowColumnHeader.
479 nScreenPPTX = o3tl::convert<double>(pDev->GetDPIX(), o3tl::Length::twip, o3tl::Length::in);
480 nScreenPPTY = o3tl::convert<double>(pDev->GetDPIY(), o3tl::Length::twip, o3tl::Length::in);
481 }
482 else
483 {
484 // Avoid cumulative placement errors by intentionally limiting
485 // precision.
486 Point aPix1000 = pDev->LogicToPixel(Point(1000, 1000), MapMode(MapUnit::MapTwip));
487 nScreenPPTX = aPix1000.X() / 1000.0;
488 nScreenPPTY = aPix1000.Y() / 1000.0;
489 }
490}
491
493{
494 return aStrClipDocName;
495}
496
497void ScGlobal::SetClipDocName( const OUString& rNew )
498{
500 aStrClipDocName = rNew;
501}
502
504{
505 if (!pPool)
506 {
507 OSL_FAIL("ScGlobal::InitTextHeight: No Pool");
508 return;
509 }
510
511 const ScPatternAttr& rPattern = pPool->GetDefaultItem(ATTR_PATTERN);
512
514 ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *pDefaultDev );
515 pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
516 vcl::Font aDefFont;
517 rPattern.GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color doesn't matter here
518 pVirtWindow->SetFont(aDefFont);
519 sal_uInt16 nTest = static_cast<sal_uInt16>(
520 pVirtWindow->PixelToLogic(Size(0, pVirtWindow->GetTextHeight()), MapMode(MapUnit::MapTwip)).Height());
521
522 if (nTest > nDefFontHeight)
523 nDefFontHeight = nTest;
524
525 const SvxMarginItem& rMargin = rPattern.GetItem(ATTR_MARGIN);
526
527 nTest = static_cast<sal_uInt16>(nDefFontHeight + rMargin.GetTopMargin()
528 + rMargin.GetBottomMargin() - STD_ROWHEIGHT_DIFF);
529
530 if (nTest > nStdRowHeight)
531 nStdRowHeight = nTest;
532}
533
535{
536 // Destroy asyncs _before_ ExitExternalFunc!
537 theAddInAsyncTbl.clear();
540 xSearchItem.reset();
541 delete pLegacyFuncCollection.exchange(nullptr);
542 delete pAddInCollection.exchange(nullptr);
543 xUserList.reset();
544 xStarCalcFunctionList.reset(); // Destroy before ResMgr!
545 xStarCalcFunctionMgr.reset();
548 ScInterpreter::GlobalExit(); // Delete static Stack
549
550 xEmptyBrushItem.reset();
551 xButtonBrushItem.reset();
552 xEnglishFormatter.reset();
553 delete pCaseTransliteration.exchange(nullptr);
554 delete pTransliteration.exchange(nullptr);
555 delete pCaseCollator.exchange(nullptr);
556 delete pCollator.exchange(nullptr);
557 oCalendar.reset();
558 oSysLocale.reset();
559 delete pLocale.exchange(nullptr);
560
561 delete pUnitConverter.exchange(nullptr);
562 xFieldEditEngine.reset();
563 delete pSharedStringPoolPurge.exchange(nullptr);
564
566}
567
568rtl_TextEncoding ScGlobal::GetCharsetValue( std::u16string_view rCharSet )
569{
570 // new TextEncoding values
571 if ( CharClass::isAsciiNumeric( rCharSet ) )
572 {
573 sal_Int32 nVal = o3tl::toInt32(rCharSet);
574 if ( nVal == RTL_TEXTENCODING_DONTKNOW )
575 return osl_getThreadTextEncoding();
576 return static_cast<rtl_TextEncoding>(nVal);
577 }
578 // old CharSet values for compatibility
579 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"ANSI") ) return RTL_TEXTENCODING_MS_1252;
580 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"MAC") ) return RTL_TEXTENCODING_APPLE_ROMAN;
581 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"IBMPC") ) return RTL_TEXTENCODING_IBM_850;
582 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"IBMPC_437")) return RTL_TEXTENCODING_IBM_437;
583 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"IBMPC_850")) return RTL_TEXTENCODING_IBM_850;
584 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"IBMPC_860")) return RTL_TEXTENCODING_IBM_860;
585 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"IBMPC_861")) return RTL_TEXTENCODING_IBM_861;
586 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"IBMPC_863")) return RTL_TEXTENCODING_IBM_863;
587 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"IBMPC_865")) return RTL_TEXTENCODING_IBM_865;
588 // Some wrong "help" on the net mentions UTF8 and even unoconv uses it,
589 // which worked accidentally if the system encoding is UTF-8 anyway, so
590 // support it ;) but only when reading.
591 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"UTF8")) return RTL_TEXTENCODING_UTF8;
592 else if (o3tl::equalsIgnoreAsciiCase(rCharSet, u"UTF-8")) return RTL_TEXTENCODING_UTF8;
593 else return osl_getThreadTextEncoding();
594}
595
596OUString ScGlobal::GetCharsetString( rtl_TextEncoding eVal )
597{
598 const char* pChar;
599 switch ( eVal )
600 {
601 // old CharSet strings for compatibility
602 case RTL_TEXTENCODING_MS_1252: pChar = "ANSI"; break;
603 case RTL_TEXTENCODING_APPLE_ROMAN: pChar = "MAC"; break;
604 // IBMPC == IBMPC_850
605 case RTL_TEXTENCODING_IBM_437: pChar = "IBMPC_437"; break;
606 case RTL_TEXTENCODING_IBM_850: pChar = "IBMPC_850"; break;
607 case RTL_TEXTENCODING_IBM_860: pChar = "IBMPC_860"; break;
608 case RTL_TEXTENCODING_IBM_861: pChar = "IBMPC_861"; break;
609 case RTL_TEXTENCODING_IBM_863: pChar = "IBMPC_863"; break;
610 case RTL_TEXTENCODING_IBM_865: pChar = "IBMPC_865"; break;
611 case RTL_TEXTENCODING_DONTKNOW: pChar = "SYSTEM"; break;
612 // new string of TextEncoding value
613 default:
614 return OUString::number( eVal );
615 }
616 return OUString::createFromAscii(pChar);
617}
618
620{
621 return bool(xStarCalcFunctionList);
622}
623
625{
628 xStarCalcFunctionList.reset( new ScFunctionList( SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName()));
629
630 return xStarCalcFunctionList.get();
631}
632
634{
638
639 return xStarCalcFunctionMgr.get();
640}
641
643{
644 // FunctionMgr has pointers into FunctionList, must also be updated
645 xStarCalcFunctionMgr.reset();
646 xStarCalcFunctionList.reset();
647 // Building new names also needs InputHandler data to be refreshed.
649}
650
652{
654 {
655 const OUString aParenthesesReplacement( cParenthesesReplacement);
656 const ScFunctionList* pFuncList = GetStarCalcFunctionList();
657 const sal_uInt32 nListCount = pFuncList->GetCount();
658 const CharClass* pCharClass = (pFuncList->IsEnglishFunctionNames()
661 for (sal_uInt32 i=0; i < nListCount; ++i)
662 {
663 const ScFuncDesc* pDesc = pFuncList->GetFunction( i );
664 if ( pDesc->mxFuncName )
665 {
666 OUString aFuncName(pCharClass->uppercase(*(pDesc->mxFuncName)));
667 // fdo#75264 fill maFormulaChar with all characters used in formula names
668 for (sal_Int32 j = 0; j < aFuncName.getLength(); j++)
669 maInputHandlerFunctionNames.maFunctionChar.insert(aFuncName[j]);
671 ScTypedStrData(*(pDesc->mxFuncName) + aParenthesesReplacement, 0.0, 0.0,
673 pDesc->initArgumentInfo();
674 OUString aEntry = pDesc->getSignature();
676 ScTypedStrData(aEntry, 0.0, 0.0, ScTypedStrData::Standard));
677 }
678 }
679 }
681}
682
684{
686 []() { return new ScUnitConverter; });
687}
688
690 sal_Unicode c )
691{
692 if ( !pStr )
693 return nullptr;
694 while ( *pStr )
695 {
696 if ( *pStr == c )
697 return pStr;
698 pStr++;
699 }
700 return nullptr;
701}
702
703OUString ScGlobal::addToken(std::u16string_view rTokenList, std::u16string_view rToken,
704 sal_Unicode cSep, sal_Int32 nSepCount, bool bForceSep)
705{
706 OUStringBuffer aBuf(rTokenList);
707 if( bForceSep || (!rToken.empty() && !rTokenList.empty()) )
708 comphelper::string::padToLength(aBuf, aBuf.getLength() + nSepCount, cSep);
709 aBuf.append(rToken);
710 return aBuf.makeStringAndClear();
711}
712
713bool ScGlobal::IsQuoted( std::u16string_view rString, sal_Unicode cQuote )
714{
715 return (rString.size() >= 2) && (rString[0] == cQuote) && (rString[ rString.size() - 1 ] == cQuote);
716}
717
718void ScGlobal::AddQuotes( OUString& rString, sal_Unicode cQuote, bool bEscapeEmbedded )
719{
720 if (bEscapeEmbedded)
721 {
722 sal_Unicode pQ[3];
723 pQ[0] = pQ[1] = cQuote;
724 pQ[2] = 0;
725 OUString aQuotes( pQ );
726 rString = rString.replaceAll( OUStringChar(cQuote), aQuotes);
727 }
728 rString = OUStringChar( cQuote ) + rString + OUStringChar( cQuote );
729}
730
731void ScGlobal::EraseQuotes( OUString& rString, sal_Unicode cQuote, bool bUnescapeEmbedded )
732{
733 if ( IsQuoted( rString, cQuote ) )
734 {
735 rString = rString.copy( 1, rString.getLength() - 2 );
736 if (bUnescapeEmbedded)
737 {
738 sal_Unicode pQ[3];
739 pQ[0] = pQ[1] = cQuote;
740 pQ[2] = 0;
741 OUString aQuotes( pQ );
742 rString = rString.replaceAll( aQuotes, OUStringChar(cQuote));
743 }
744 }
745}
746
747sal_Int32 ScGlobal::FindUnquoted( const OUString& rString, sal_Unicode cChar, sal_Int32 nStart )
748{
749 assert(nStart >= 0);
750 const sal_Unicode cQuote = '\'';
751 const sal_Unicode* const pStart = rString.getStr();
752 const sal_Unicode* const pStop = pStart + rString.getLength();
753 const sal_Unicode* p = pStart + nStart;
754 bool bQuoted = false;
755 while (p < pStop)
756 {
757 if (*p == cChar && !bQuoted)
758 return sal::static_int_cast< sal_Int32 >( p - pStart );
759 else if (*p == cQuote)
760 {
761 if (!bQuoted)
762 bQuoted = true;
763 else if (p < pStop-1 && *(p+1) == cQuote)
764 ++p;
765 else
766 bQuoted = false;
767 }
768 ++p;
769 }
770 return -1;
771}
772
774{
775 sal_Unicode cQuote = '\'';
776 const sal_Unicode* p = pString;
777 bool bQuoted = false;
778 while (*p)
779 {
780 if (*p == cChar && !bQuoted)
781 return p;
782 else if (*p == cQuote)
783 {
784 if (!bQuoted)
785 bQuoted = true;
786 else if (*(p+1) == cQuote)
787 ++p;
788 else
789 bQuoted = false;
790 }
791 ++p;
792 }
793 return nullptr;
794}
795
797 const EditTextObject* pObj2 )
798{
799 if ( pObj1 == pObj2 ) // Both empty or the same object
800 return true;
801
802 if ( pObj1 && pObj2 )
803 return pObj1->Equals( *pObj2);
804
805 return false;
806}
807
808void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgnoreSettings)
809{
810 // OpenURL is always called in the GridWindow by mouse clicks in some way or another.
811 // That's why pScActiveViewShell and nScClickMouseModifier are correct.
812
813 // Fragments pointing into the current document should be always opened.
814 if (!bIgnoreSettings && !(ShouldOpenURL() || rURL.startsWith("#")))
815 return;
816
818 if (!pViewFrm)
819 return;
820
821 OUString aUrlName( rURL );
822 SfxViewFrame* pFrame = nullptr;
823 const SfxObjectShell* pObjShell = nullptr;
824 OUString aReferName;
825 if ( pScActiveViewShell )
826 {
828 pObjShell = pFrame->GetObjectShell();
829 const SfxMedium* pMed = pObjShell->GetMedium();
830 if (pMed)
831 aReferName = pMed->GetName();
832 }
833
834 // Don't fiddle with fragments pointing into current document.
835 // Also don't mess around with a vnd.sun.star.script or service or other
836 // internal "URI".
837 if (!aUrlName.startsWith("#")
838 && !aUrlName.startsWithIgnoreAsciiCase("vnd.sun.star.script:")
839 && !aUrlName.startsWithIgnoreAsciiCase("macro:")
840 && !aUrlName.startsWithIgnoreAsciiCase("slot:")
841 && !aUrlName.startsWithIgnoreAsciiCase("service:")
842 && !aUrlName.startsWithIgnoreAsciiCase(".uno:"))
843 {
844 // Any relative reference would fail with "not an absolute URL"
845 // error, try to construct an absolute URI with the path relative
846 // to the current document's path or work path, as usual for all
847 // external references.
848 // This then also, as ScGlobal::GetAbsDocName() uses
849 // INetURLObject::smartRel2Abs(), supports "\\" UNC path names as
850 // smb:// Samba shares and DOS path separators converted to proper
851 // file:// URI.
852 const OUString aNewUrlName( ScGlobal::GetAbsDocName( aUrlName, pObjShell));
853 if (!aNewUrlName.isEmpty())
854 aUrlName = aNewUrlName;
855 }
856
857 SfxStringItem aUrl( SID_FILE_NAME, aUrlName );
858 SfxStringItem aTarget( SID_TARGETNAME, rTarget );
859 if ( nScClickMouseModifier & KEY_SHIFT ) // control-click -> into new window
860 aTarget.SetValue("_blank");
861
862 SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
863 SfxStringItem aReferer( SID_REFERER, aReferName );
864
865 SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
866 SfxBoolItem aBrowsing( SID_BROWSE, true );
867
868 // No SID_SILENT anymore
869 pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC,
870 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
871 { &aUrl, &aTarget, &aFrm, &aReferer, &aNewView, &aBrowsing });
872}
873
875{
876 bool bCtrlClickHappened = (nScClickMouseModifier & KEY_MOD1);
878 if( bCtrlClickHappened && ! bCtrlClickSecOption )
879 {
880 // return since ctrl+click happened when the
881 // ctrl+click security option was disabled, link should not open
882 return false;
883 }
884 else if( ! bCtrlClickHappened && bCtrlClickSecOption )
885 {
886 // ctrl+click did not happen; only click happened maybe with some
887 // other key combo. and security option is set, so return
888 return false;
889 }
890 return true;
891}
892
894{
895 return MsLangId::isRightToLeft( Application::GetSettings().GetLanguageTag().getLanguageType() );
896}
897
899{
900 // Used when text contains only WEAK characters.
901 // Script type of office language is used then (same as GetEditDefaultLanguage,
902 // to get consistent behavior of text in simple cells and EditEngine,
903 // also same as GetAppLanguage() in Writer)
904 return SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
905}
906
908{
909 // Used for EditEngine::SetDefaultLanguage
911}
912
913sal_uInt16 ScGlobal::GetScriptedWhichID( SvtScriptType nScriptType, sal_uInt16 nWhich )
914{
915 switch ( nScriptType )
916 {
917 case SvtScriptType::LATIN:
918 case SvtScriptType::ASIAN:
919 case SvtScriptType::COMPLEX:
920 break; // take exact matches
921 default: // prefer one, first COMPLEX, then ASIAN
922 if ( nScriptType & SvtScriptType::COMPLEX )
923 nScriptType = SvtScriptType::COMPLEX;
924 else if ( nScriptType & SvtScriptType::ASIAN )
925 nScriptType = SvtScriptType::ASIAN;
926 }
927 switch ( nScriptType )
928 {
929 case SvtScriptType::COMPLEX:
930 {
931 switch ( nWhich )
932 {
933 case ATTR_FONT:
934 case ATTR_CJK_FONT:
935 nWhich = ATTR_CTL_FONT;
936 break;
937 case ATTR_FONT_HEIGHT:
939 nWhich = ATTR_CTL_FONT_HEIGHT;
940 break;
941 case ATTR_FONT_WEIGHT:
943 nWhich = ATTR_CTL_FONT_WEIGHT;
944 break;
947 nWhich = ATTR_CTL_FONT_POSTURE;
948 break;
949 }
950 }
951 break;
952 case SvtScriptType::ASIAN:
953 {
954 switch ( nWhich )
955 {
956 case ATTR_FONT:
957 case ATTR_CTL_FONT:
958 nWhich = ATTR_CJK_FONT;
959 break;
960 case ATTR_FONT_HEIGHT:
962 nWhich = ATTR_CJK_FONT_HEIGHT;
963 break;
964 case ATTR_FONT_WEIGHT:
966 nWhich = ATTR_CJK_FONT_WEIGHT;
967 break;
970 nWhich = ATTR_CJK_FONT_POSTURE;
971 break;
972 }
973 }
974 break;
975 default:
976 {
977 switch ( nWhich )
978 {
979 case ATTR_CTL_FONT:
980 case ATTR_CJK_FONT:
981 nWhich = ATTR_FONT;
982 break;
985 nWhich = ATTR_FONT_HEIGHT;
986 break;
989 nWhich = ATTR_FONT_WEIGHT;
990 break;
993 nWhich = ATTR_FONT_POSTURE;
994 break;
995 }
996 }
997 }
998 return nWhich;
999}
1000
1002{
1003 OSL_ENSURE( rSet.GetItemState( ATTR_LANGUAGE_FORMAT, false ) == SfxItemState::DEFAULT,
1004 "ScGlobal::AddLanguage - language already added");
1005
1006 const SfxUInt32Item* pHardItem = rSet.GetItemIfSet( ATTR_VALUE_FORMAT, false );
1007 if ( !pHardItem )
1008 return;
1009
1010 const SvNumberformat* pHardFormat = rFormatter.GetEntry(
1011 pHardItem->GetValue() );
1012
1013 sal_uInt32 nParentFmt = 0; // Pool default
1014 const SfxItemSet* pParent = rSet.GetParent();
1015 if ( pParent )
1016 nParentFmt = pParent->Get( ATTR_VALUE_FORMAT ).GetValue();
1017 const SvNumberformat* pParFormat = rFormatter.GetEntry( nParentFmt );
1018
1019 if ( pHardFormat && pParFormat &&
1020 (pHardFormat->GetLanguage() != pParFormat->GetLanguage()) )
1022}
1023
1025{
1027 []()
1028 {
1030 ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
1031 ::comphelper::getProcessComponentContext(), TransliterationFlags::IGNORE_CASE );
1032 p->loadModuleIfNeeded( eOfficeLanguage );
1033 return p;
1034 });
1035}
1037{
1039 []()
1040 {
1042 ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
1043 ::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
1044 p->loadModuleIfNeeded( eOfficeLanguage );
1045 return p;
1046 });
1047}
1049{
1050 return bCaseSensitive ? GetCaseTransliteration() : GetTransliteration();
1051}
1052
1054{
1055 OSL_ENSURE(
1056 oSysLocale,
1057 "ScGlobal::getLocaleDataPtr() called before ScGlobal::Init()");
1058
1059 return oSysLocale->GetLocaleData();
1060}
1061
1063{
1064 OSL_ENSURE(
1065 oSysLocale,
1066 "ScGlobal::getCharClassPtr() called before ScGlobal::Init()");
1067
1068 return oSysLocale->GetCharClass();
1069}
1070
1072{
1074 if ( !oCalendar )
1075 {
1076 oCalendar.emplace( ::comphelper::getProcessComponentContext() );
1077 oCalendar->loadDefaultCalendar( GetLocale() );
1078 }
1079 return *oCalendar;
1080}
1081
1082namespace {
1083
1084struct GetMutex {
1085 osl::Mutex * operator ()() {
1086 static osl::Mutex m;
1087 return &m;
1088 }
1089};
1090
1091}
1092
1094{
1096 []()
1097 {
1098 CollatorWrapper* p = new CollatorWrapper( ::comphelper::getProcessComponentContext() );
1099 p->loadDefaultCollator( GetLocale(), SC_COLLATOR_IGNORES );
1100 return p;
1101 },
1102 GetMutex());
1103}
1105{
1107 []()
1108 {
1109 CollatorWrapper* p = new CollatorWrapper( ::comphelper::getProcessComponentContext() );
1110 p->loadDefaultCollator( GetLocale(), 0 );
1111 return p;
1112 },
1113 GetMutex());
1114}
1116{
1117 return bCaseSensitive ? GetCaseCollator() : GetCollator();
1118}
1119css::lang::Locale& ScGlobal::GetLocale()
1120{
1122 []() { return new css::lang::Locale( Application::GetSettings().GetLanguageTag().getLocale()); });
1123}
1124
1126{
1128 if (!xFieldEditEngine)
1129 {
1130 // Creating a ScFieldEditEngine with pDocument=NULL leads to document
1131 // specific fields not being resolvable! See
1132 // ScFieldEditEngine::CalcFieldValue(). pEnginePool=NULL lets
1133 // EditEngine internally create and delete a default pool.
1134 xFieldEditEngine.reset(new ScFieldEditEngine( nullptr, nullptr));
1135 }
1136 return *xFieldEditEngine;
1137}
1138
1140{
1142 []() { return new sc::SharedStringPoolPurge; });
1143}
1144
1145OUString ScGlobal::ReplaceOrAppend( const OUString& rString,
1146 std::u16string_view rPlaceholder, const OUString& rReplacement )
1147{
1148 if (rString.isEmpty())
1149 return rReplacement;
1150 sal_Int32 nFound = rString.indexOf( rPlaceholder);
1151 if (nFound < 0)
1152 {
1153 if (rString[rString.getLength()-1] == ' ')
1154 return rString + rReplacement;
1155 return rString + " " + rReplacement;
1156 }
1157 return rString.replaceFirst( rPlaceholder, rReplacement, &nFound);
1158}
1159
1160/* 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
static const CharClass * GetCharClassEnglish()
Definition: compiler.cxx:225
static void DeInit()
Definition: compiler.cxx:188
static const CharClass * GetCharClassLocalized()
Definition: compiler.cxx:239
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:327
std::optional< OUString > mxFuncName
Function name.
Definition: funcdesc.hxx:216
virtual OUString getSignature() const override
Returns the full function signature.
Definition: funcdesc.cxx:224
List of spreadsheet functions.
Definition: funcdesc.hxx:242
const ScFuncDesc * GetFunction(sal_uInt32 nIndex) const
Definition: funcdesc.cxx:1010
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:588
static rtl_TextEncoding GetCharsetValue(std::u16string_view rCharSet)
Definition: global.cxx:568
static SC_DLLPUBLIC bool bThreadedGroupCalcInProgress
Calc's threaded group calculation is in progress.
Definition: global.hxx:827
static SC_DLLPUBLIC sal_uInt16 GetStandardRowHeight()
Definition: global.cxx:169
static std::unique_ptr< ScFunctionList > xStarCalcFunctionList
Definition: global.hxx:519
static void InitTextHeight(const SfxItemPool *pPool)
Definition: global.cxx:503
static std::atomic<::utl::TransliterationWrapper * > pTransliteration
Definition: global.hxx:530
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:689
static SC_DLLPUBLIC sal_uInt16 nStdRowHeight
Definition: global.hxx:595
static LanguageType GetEditDefaultLanguage()
Definition: global.cxx:907
static css::lang::Locale & GetLocale()
Definition: global.cxx:1119
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:713
static SC_DLLPUBLIC CollatorWrapper & GetCollator()
case-insensitive collator
Definition: global.cxx:1093
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:1145
static std::atomic<::utl::TransliterationWrapper * > pCaseTransliteration
Definition: global.hxx:531
static SvxBrushItem * GetButtonBrushItem()
Definition: global.cxx:439
static OUString aStrClipDocName
Definition: global.hxx:515
static SC_DLLPUBLIC sal_uInt32 GetStandardFormat(SvNumberFormatter &, sal_uInt32 nFormat, SvNumFormatType nType)
Definition: global.cxx:160
::tools::Long nLastColWidthExtra
Definition: global.hxx:598
static std::unique_ptr< ScAutoFormat > xAutoFormat
Definition: global.hxx:511
::utl::TransliterationWrapper & GetCaseTransliteration()
Definition: global.cxx:1036
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:590
static SvNumberFormatter * GetEnglishFormatter()
a "ReadOnly" formatter for UNO/XML export
Definition: global.cxx:174
static std::optional< CalendarWrapper > oCalendar
Definition: global.hxx:527
static std::atomic< CollatorWrapper * > pCaseCollator
Definition: global.hxx:528
static void ResetFunctionList()
Definition: global.cxx:642
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:808
static std::atomic< LegacyFuncCollection * > pLegacyFuncCollection
Definition: global.hxx:512
static bool IsSystemRTL()
Definition: global.cxx:893
static SC_DLLPUBLIC ::utl::TransliterationWrapper & GetTransliteration()
Definition: global.cxx:1024
static std::unique_ptr< ScUserList > xUserList
Definition: global.hxx:514
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:731
static const InputHandlerFunctionNames & GetInputHandlerFunctionNames()
Definition: global.cxx:651
static void SetUserList(const ScUserList *pNewList)
Definition: global.cxx:299
static InputHandlerFunctionNames maInputHandlerFunctionNames
Definition: global.hxx:538
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:559
static std::unique_ptr< ScFieldEditEngine > xFieldEditEngine
Definition: global.hxx:534
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:796
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:703
static SC_DLLPUBLIC sal_uInt16 GetScriptedWhichID(SvtScriptType nScriptType, sal_uInt16 nWhich)
Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
Definition: global.cxx:913
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:747
static ScFunctionList * GetStarCalcFunctionList()
Definition: global.cxx:624
static std::unique_ptr< SvxBrushItem > xButtonBrushItem
Definition: global.hxx:517
static std::unique_ptr< SvNumberFormatter > xEnglishFormatter
Definition: global.hxx:524
static OUString GetCharsetString(rtl_TextEncoding eVal)
Definition: global.cxx:596
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
Definition: global2.cxx:287
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
Definition: global.cxx:1053
static std::optional< SvtSysLocale > oSysLocale
Definition: global.hxx:543
static std::atomic< ScUnoAddInCollection * > pAddInCollection
Definition: global.hxx:513
static CollatorWrapper & GetCaseCollator()
case-sensitive collator
Definition: global.cxx:1104
static bool HasStarCalcFunctionList()
Definition: global.cxx:619
static OUString GetErrorString(FormulaError nErrNumber)
Definition: global.cxx:315
static ScFunctionMgr * GetStarCalcFunctionMgr()
Definition: global.cxx:633
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:532
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:718
static ScFieldEditEngine & GetStaticFieldEditEngine()
A static instance of ScFieldEditEngine not capable of resolving document specific fields,...
Definition: global.cxx:1125
static sc::SharedStringPoolPurge & GetSharedStringPoolPurge()
Definition: global.cxx:1139
static tools::SvRef< ScDocShell > xDrawClipDocShellRef
Definition: global.hxx:592
static std::unique_ptr< SvxSearchItem > xSearchItem
Definition: global.hxx:510
static sal_uInt16 nDefFontHeight
Definition: global.hxx:594
static ScUnitConverter * GetUnitConverter()
Definition: global.cxx:683
static std::atomic< CollatorWrapper * > pCollator
Definition: global.hxx:529
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:288
static void InitPPT()
Definition: global.cxx:472
static std::unique_ptr< ScFunctionMgr > xStarCalcFunctionMgr
Definition: global.hxx:520
static css::uno::Reference< css::i18n::XOrdinalSuffix > xOrdinalSuffix
Definition: global.hxx:526
static std::atomic< ScUnitConverter * > pUnitConverter
Definition: global.hxx:522
static SC_DLLPUBLIC SvtScriptType GetDefaultScriptType()
Definition: global.cxx:898
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:1001
static void SetClipDocName(const OUString &rNew)
Definition: global.cxx:497
static SC_DLLPUBLIC const CharClass & getCharClass()
Definition: global.cxx:1062
static const OUString & GetClipDocName()
Definition: global.cxx:492
static SC_DLLPUBLIC ::tools::Long nLastRowHeightExtra
Definition: global.hxx:597
static CalendarWrapper & GetCalendar()
Definition: global.cxx:1071
static SC_DLLPUBLIC void Clear()
Definition: global.cxx:534
static SC_DLLPUBLIC ScAutoFormat * GetAutoFormat()
Definition: global.cxx:261
static std::atomic< sc::SharedStringPoolPurge * > pSharedStringPoolPurge
Definition: global.hxx:536
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:874
static void ClearAutoFormat()
Definition: global.cxx:248
static SC_DLLPUBLIC void Init()
Definition: global.cxx:446
static bool CheckWidthInvalidate(bool &bNumFormatChanged, const SfxItemSet &rNewAttrs, const SfxItemSet &rOldAttrs)
Definition: global.cxx:186
static std::unique_ptr< SvxBrushItem > xEmptyBrushItem
Definition: global.hxx:516
static void InitAddIns()
Definition: globalx.cxx:44
static void GlobalExit()
Definition: interpr4.cxx:3901
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:122
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:251
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:72
Collection of user-defined sort lists.
Definition: userlist.hxx:67
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 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:462
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
@ SC_AUTOCOL_BLACK
always use black
Definition: patattr.hxx:45
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:769
#define SC_MOD()
Definition: scmod.hxx:249
static SfxItemSet & rSet
ScTypedCaseStrSet maFunctionDataPara
Definition: global.hxx:466
std::set< sal_Unicode > maFunctionChar
Definition: global.hxx:467
ScTypedCaseStrSet maFunctionData
Definition: global.hxx:465
sal_uInt16 sal_Unicode
const char * pChar
SvNumFormatType
NF_EVALDATEFORMAT_INTL_FORMAT