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