LibreOffice Module sc (master)  1
appluno.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 <appluno.hxx>
21 #include <sal/types.h>
22 #include <osl/diagnose.h>
23 #include <formula/funcvarargs.h>
24 
25 #include <vcl/svapp.hxx>
26 #include <sfx2/app.hxx>
27 #include <sfx2/sfxmodelfactory.hxx>
28 #include <miscuno.hxx>
29 #include <scmod.hxx>
30 #include <appoptio.hxx>
31 #include <inputopt.hxx>
32 #include <printopt.hxx>
33 #include <userlist.hxx>
34 #include <scdll.hxx>
35 #include <unonames.hxx>
36 #include <funcdesc.hxx>
37 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
38 #include <com/sun/star/sheet/FunctionArgument.hpp>
39 #include <memory>
40 
41 using namespace com::sun::star;
42 
43 // Special value for zoom
45 #define SC_ZOOMVAL_OPTIMAL (-1)
46 #define SC_ZOOMVAL_WHOLEPAGE (-2)
47 #define SC_ZOOMVAL_PAGEWIDTH (-3)
48 
49 // Number of PropertyValues in a function description
50 #define SC_FUNCDESC_PROPCOUNT 5
51 
52 // everything without Which-ID, map only for PropertySetInfo
53 
55 {
56  static const SfxItemPropertyMapEntry aSettingsPropertyMap_Impl[] =
57  {
76  {u"", 0, css::uno::Type(), 0, 0 }
77  };
78  return aSettingsPropertyMap_Impl;
79 }
80 
81 constexpr OUStringLiteral SCFUNCTIONLISTOBJ_SERVICE = u"com.sun.star.sheet.FunctionDescriptions";
82 constexpr OUStringLiteral SCRECENTFUNCTIONSOBJ_SERVICE = u"com.sun.star.sheet.RecentFunctions";
83 constexpr OUStringLiteral SCSPREADSHEETSETTINGS_SERVICE = u"com.sun.star.sheet.GlobalSheetSettings";
84 
85 SC_SIMPLE_SERVICE_INFO( ScFunctionListObj, "stardiv.StarCalc.ScFunctionListObj", SCFUNCTIONLISTOBJ_SERVICE )
86 SC_SIMPLE_SERVICE_INFO( ScRecentFunctionsObj, "stardiv.StarCalc.ScRecentFunctionsObj", SCRECENTFUNCTIONSOBJ_SERVICE )
87 SC_SIMPLE_SERVICE_INFO( ScSpreadsheetSettings, "stardiv.StarCalc.ScSpreadsheetSettings", SCSPREADSHEETSETTINGS_SERVICE )
88 
89 
90 ScSpreadsheetSettings::ScSpreadsheetSettings() :
91  aPropSet( lcl_GetSettingsPropertyMap() )
92 {
93 }
94 
96 {
97 }
98 
99 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
101  css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
102 {
103  SolarMutexGuard aGuard;
104  ScDLL::Init();
105  return cppu::acquire(new ScSpreadsheetSettings());
106 }
107 
108 
109 bool ScSpreadsheetSettings::getPropertyBool(const OUString& aPropertyName)
110 {
111  uno::Any any = getPropertyValue(aPropertyName);
112  bool b = false;
113  any >>= b;
114  return b;
115 }
116 
117 sal_Int16 ScSpreadsheetSettings::getPropertyInt16(const OUString& aPropertyName)
118 {
119  uno::Any any = getPropertyValue(aPropertyName);
120  sal_Int16 b = 0;
121  any >>= b;
122  return b;
123 }
124 
125 // XPropertySet
126 
127 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScSpreadsheetSettings::getPropertySetInfo()
128 {
129  SolarMutexGuard aGuard;
130  static uno::Reference<beans::XPropertySetInfo> aRef(
131  new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
132  return aRef;
133 }
134 
136  const OUString& aPropertyName, const uno::Any& aValue )
137 {
138  SolarMutexGuard aGuard;
139 
140  ScModule* pScMod = SC_MOD();
141  ScAppOptions aAppOpt(pScMod->GetAppOptions());
142  ScInputOptions aInpOpt(pScMod->GetInputOptions());
143  bool bSaveApp = false;
144  bool bSaveInp = false;
145  // print options aren't loaded until needed
146 
147  if (aPropertyName == SC_UNONAME_DOAUTOCP)
148  {
149  aAppOpt.SetAutoComplete( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
150  bSaveApp = true;
151  }
152  else if (aPropertyName == SC_UNONAME_ENTERED)
153  {
155  bSaveInp = true;
156  }
157  else if (aPropertyName == SC_UNONAME_EXPREF)
158  {
159  aInpOpt.SetExpandRefs( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
160  bSaveInp = true;
161  }
162  else if (aPropertyName == SC_UNONAME_EXTFMT)
163  {
164  aInpOpt.SetExtendFormat( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
165  bSaveInp = true;
166  }
167  else if (aPropertyName == SC_UNONAME_LINKUPD)
168  {
169  // XXX NOTE: this is not css::document::Settings property
170  // LinkUpdateMode but css::sheet::XGlobalSheetSettings attribute
171  // LinkUpdateMode.
172  sal_Int16 n;
173  if (!(aValue >>= n) || n < 0 || n >= ScLkUpdMode::LM_UNKNOWN)
174  {
175  throw css::lang::IllegalArgumentException(
176  ("LinkUpdateMode property value must be a SHORT with a value in the range of 0--2"
177  " as documented for css::sheet::XGlobalSheetSettings attribute LinkUpdateMode"),
178  css::uno::Reference<css::uno::XInterface>(), -1);
179  }
180  aAppOpt.SetLinkMode( static_cast<ScLkUpdMode>(n) );
181  bSaveApp = true;
182  }
183  else if (aPropertyName == SC_UNONAME_MARKHDR)
184  {
185  aInpOpt.SetMarkHeader( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
186  bSaveInp = true;
187  }
188  else if (aPropertyName == SC_UNONAME_MOVESEL)
189  {
190  aInpOpt.SetMoveSelection( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
191  bSaveInp = true;
192  }
193  else if (aPropertyName == SC_UNONAME_RANGEFIN)
194  {
195  aInpOpt.SetRangeFinder( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
196  bSaveInp = true;
197  }
198  else if (aPropertyName == SC_UNONAME_USETABCOL)
199  {
200  aInpOpt.SetUseTabCol( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
201  bSaveInp = true;
202  }
203  else if (aPropertyName == SC_UNONAME_PRMETRICS)
204  {
205  aInpOpt.SetTextWysiwyg( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
206  bSaveInp = true;
207  }
208  else if (aPropertyName == SC_UNONAME_REPLWARN)
209  {
210  aInpOpt.SetReplaceCellsWarn( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
211  bSaveInp = true;
212  }
213  else if (aPropertyName == SC_UNONAME_METRIC)
214  {
215  aAppOpt.SetAppMetric( static_cast<FieldUnit>(ScUnoHelpFunctions::GetInt16FromAny( aValue )) );
216  bSaveApp = true;
217  }
218  else if (aPropertyName == SC_UNONAME_MOVEDIR)
219  {
220  aInpOpt.SetMoveDir( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
221  bSaveInp = true;
222  }
223  else if (aPropertyName == SC_UNONAME_SCALE)
224  {
225  short nVal = ScUnoHelpFunctions::GetInt16FromAny( aValue );
226  if ( nVal < 0 )
227  {
228  SvxZoomType eType = SvxZoomType::PERCENT;
229  switch (nVal)
230  {
231  case SC_ZOOMVAL_OPTIMAL: eType = SvxZoomType::OPTIMAL; break;
232  case SC_ZOOMVAL_WHOLEPAGE: eType = SvxZoomType::WHOLEPAGE; break;
233  case SC_ZOOMVAL_PAGEWIDTH: eType = SvxZoomType::PAGEWIDTH; break;
234  }
235  aAppOpt.SetZoomType( eType );
236  }
237  else if ( nVal >= MINZOOM && nVal <= MAXZOOM )
238  {
239  aAppOpt.SetZoom( nVal );
240  aAppOpt.SetZoomType( SvxZoomType::PERCENT );
241  }
242  bSaveApp = true;
243  }
244  else if (aPropertyName == SC_UNONAME_STBFUNC)
245  {
246  aAppOpt.SetStatusFunc( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
247  bSaveApp = true;
248  }
249  else if (aPropertyName == SC_UNONAME_ULISTS)
250  {
251  ScUserList* pUserList = ScGlobal::GetUserList();
252  uno::Sequence<OUString> aSeq;
253  if ( pUserList && ( aValue >>= aSeq ) )
254  {
255  // directly change the active list
256  // ScGlobal::SetUseTabCol does not do much else
257 
258  pUserList->clear();
259  for (const OUString& aEntry : std::as_const(aSeq))
260  {
261  ScUserListData* pData = new ScUserListData(aEntry);
262  pUserList->push_back(pData);
263  }
264  bSaveApp = true; // List with App-Options are saved
265  }
266  }
267  else if (aPropertyName == SC_UNONAME_PRALLSH)
268  {
269  ScPrintOptions aPrintOpt(pScMod->GetPrintOptions());
270  aPrintOpt.SetAllSheets( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
271  pScMod->SetPrintOptions( aPrintOpt );
272  }
273  else if (aPropertyName == SC_UNONAME_PREMPTY)
274  {
275  ScPrintOptions aPrintOpt(pScMod->GetPrintOptions());
276  aPrintOpt.SetSkipEmpty( !ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); // reversed
277  pScMod->SetPrintOptions( aPrintOpt );
278  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScPrintOptions ) ); // update previews
279  }
280 
281  if ( bSaveApp )
282  pScMod->SetAppOptions( aAppOpt );
283  if ( bSaveInp )
284  pScMod->SetInputOptions( aInpOpt );
285 }
286 
287 uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aPropertyName )
288 {
289  SolarMutexGuard aGuard;
290  uno::Any aRet;
291 
292  ScModule* pScMod = SC_MOD();
293  ScAppOptions aAppOpt = pScMod->GetAppOptions();
294  ScInputOptions aInpOpt = pScMod->GetInputOptions();
295  // print options aren't loaded until needed
296 
297  if (aPropertyName == SC_UNONAME_DOAUTOCP) aRet <<= aAppOpt.GetAutoComplete();
298  else if (aPropertyName == SC_UNONAME_ENTERED ) aRet <<= aInpOpt.GetEnterEdit();
299  else if (aPropertyName == SC_UNONAME_EXPREF ) aRet <<= aInpOpt.GetExpandRefs();
300  else if (aPropertyName == SC_UNONAME_EXTFMT ) aRet <<= aInpOpt.GetExtendFormat();
301  else if (aPropertyName == SC_UNONAME_LINKUPD ) aRet <<= static_cast<sal_Int16>(aAppOpt.GetLinkMode());
302  else if (aPropertyName == SC_UNONAME_MARKHDR ) aRet <<= aInpOpt.GetMarkHeader();
303  else if (aPropertyName == SC_UNONAME_MOVESEL ) aRet <<= aInpOpt.GetMoveSelection();
304  else if (aPropertyName == SC_UNONAME_RANGEFIN ) aRet <<= aInpOpt.GetRangeFinder();
305  else if (aPropertyName == SC_UNONAME_USETABCOL ) aRet <<= aInpOpt.GetUseTabCol();
306  else if (aPropertyName == SC_UNONAME_PRMETRICS ) aRet <<= aInpOpt.GetTextWysiwyg();
307  else if (aPropertyName == SC_UNONAME_REPLWARN ) aRet <<= aInpOpt.GetReplaceCellsWarn();
308  else if (aPropertyName == SC_UNONAME_METRIC ) aRet <<= static_cast<sal_Int16>(aAppOpt.GetAppMetric());
309  else if (aPropertyName == SC_UNONAME_MOVEDIR ) aRet <<= static_cast<sal_Int16>(aInpOpt.GetMoveDir());
310  else if (aPropertyName == SC_UNONAME_STBFUNC ) aRet <<= static_cast<sal_Int16>(aAppOpt.GetStatusFunc());
311  else if (aPropertyName == SC_UNONAME_SCALE )
312  {
313  sal_Int16 nZoomVal = 0;
314  switch ( aAppOpt.GetZoomType() )
315  {
316  case SvxZoomType::PERCENT: nZoomVal = aAppOpt.GetZoom(); break;
317  case SvxZoomType::OPTIMAL: nZoomVal = SC_ZOOMVAL_OPTIMAL; break;
318  case SvxZoomType::WHOLEPAGE: nZoomVal = SC_ZOOMVAL_WHOLEPAGE; break;
319  case SvxZoomType::PAGEWIDTH: nZoomVal = SC_ZOOMVAL_PAGEWIDTH; break;
320  default:
321  {
322  // added to avoid warnings
323  }
324  }
325  aRet <<= nZoomVal;
326  }
327  else if (aPropertyName == SC_UNONAME_ULISTS )
328  {
329  ScUserList* pUserList = ScGlobal::GetUserList();
330  if (pUserList)
331  {
332  size_t nCount = pUserList->size();
333  uno::Sequence<OUString> aSeq(nCount);
334  OUString* pAry = aSeq.getArray();
335  for (size_t i=0; i<nCount; ++i)
336  {
337  OUString aEntry((*pUserList)[i].GetString());
338  pAry[i] = aEntry;
339  }
340  aRet <<= aSeq;
341  }
342  }
343  else if (aPropertyName == SC_UNONAME_PRALLSH )
344  aRet <<= pScMod->GetPrintOptions().GetAllSheets();
345  else if (aPropertyName == SC_UNONAME_PREMPTY )
346  aRet <<= !pScMod->GetPrintOptions().GetSkipEmpty(); // reversed
347 
348  return aRet;
349 }
350 
352 
354 {
355 }
356 
358 {
359 }
360 
361 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
362 ScRecentFunctionsObj_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &)
363 {
364  SolarMutexGuard aGuard;
365  ScDLL::Init();
366  return cppu::acquire(new ScRecentFunctionsObj());
367 }
368 
369 // XRecentFunctions
370 
371 uno::Sequence<sal_Int32> SAL_CALL ScRecentFunctionsObj::getRecentFunctionIds()
372 {
373  SolarMutexGuard aGuard;
374  const ScAppOptions& rOpt = SC_MOD()->GetAppOptions();
375  sal_uInt16 nCount = rOpt.GetLRUFuncListCount();
376  const sal_uInt16* pFuncs = rOpt.GetLRUFuncList();
377  if (pFuncs)
378  {
379  uno::Sequence<sal_Int32> aSeq(nCount);
380  sal_Int32* pAry = aSeq.getArray();
381  for (sal_uInt16 i=0; i<nCount; i++)
382  pAry[i] = pFuncs[i];
383  return aSeq;
384  }
385  return {};
386 }
387 
389  const uno::Sequence<sal_Int32>& aRecentFunctionIds )
390 {
391  SolarMutexGuard aGuard;
392  sal_uInt16 nCount = static_cast<sal_uInt16>(std::min( aRecentFunctionIds.getLength(), sal_Int32(LRU_MAX) ));
393  const sal_Int32* pAry = aRecentFunctionIds.getConstArray();
394 
395  std::unique_ptr<sal_uInt16[]> pFuncs(nCount ? new sal_uInt16[nCount] : nullptr);
396  for (sal_uInt16 i=0; i<nCount; i++)
397  pFuncs[i] = static_cast<sal_uInt16>(pAry[i]);
398 
399  ScModule* pScMod = SC_MOD();
400  ScAppOptions aNewOpts(pScMod->GetAppOptions());
401  aNewOpts.SetLRUFuncList(pFuncs.get(), nCount);
402  pScMod->SetAppOptions(aNewOpts);
403 }
404 
406 {
407  return LRU_MAX;
408 }
409 
411 {
412 }
413 
415 {
416 }
417 
418 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
419 ScFunctionListObj_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &)
420 {
421  SolarMutexGuard aGuard;
422  ScDLL::Init();
423  return cppu::acquire(new ScFunctionListObj());
424 }
425 
426 static void lcl_FillSequence( uno::Sequence<beans::PropertyValue>& rSequence, const ScFuncDesc& rDesc )
427 {
428  rDesc.initArgumentInfo(); // full argument info is needed
429 
430  OSL_ENSURE( rSequence.getLength() == SC_FUNCDESC_PROPCOUNT, "Wrong count" );
431 
432  beans::PropertyValue* pArray = rSequence.getArray();
433 
434  pArray[0].Name = SC_UNONAME_ID;
435  pArray[0].Value <<= static_cast<sal_Int32>(rDesc.nFIndex);
436 
437  pArray[1].Name = SC_UNONAME_CATEGORY;
438  pArray[1].Value <<= static_cast<sal_Int32>(rDesc.nCategory);
439 
440  pArray[2].Name = SC_UNONAME_NAME;
441  if (rDesc.mxFuncName)
442  pArray[2].Value <<= *rDesc.mxFuncName;
443 
444  pArray[3].Name = SC_UNONAME_DESCRIPTION;
445  if (rDesc.mxFuncDesc)
446  pArray[3].Value <<= *rDesc.mxFuncDesc;
447 
448  pArray[4].Name = SC_UNONAME_ARGUMENTS;
449  if (rDesc.maDefArgNames.empty() || rDesc.maDefArgDescs.empty() || !rDesc.pDefArgFlags)
450  return;
451 
452  sal_uInt16 nCount = rDesc.nArgCount;
453  if (nCount >= PAIRED_VAR_ARGS)
454  nCount -= PAIRED_VAR_ARGS - 2;
455  else if (nCount >= VAR_ARGS)
456  nCount -= VAR_ARGS - 1;
457  sal_uInt16 nSeqCount = rDesc.GetSuppressedArgCount();
458  if (nSeqCount >= PAIRED_VAR_ARGS)
459  nSeqCount -= PAIRED_VAR_ARGS - 2;
460  else if (nSeqCount >= VAR_ARGS)
461  nSeqCount -= VAR_ARGS - 1;
462 
463  if (!nSeqCount)
464  return;
465 
466  uno::Sequence<sheet::FunctionArgument> aArgSeq(nSeqCount);
467  sheet::FunctionArgument* pArgAry = aArgSeq.getArray();
468  for (sal_uInt16 i=0, j=0; i<nCount; i++)
469  {
470  sheet::FunctionArgument aArgument;
471  aArgument.Name = rDesc.maDefArgNames[i];
472  aArgument.Description = rDesc.maDefArgDescs[i];
473  aArgument.IsOptional = rDesc.pDefArgFlags[i].bOptional;
474  pArgAry[j++] = aArgument;
475  }
476  pArray[4].Value <<= aArgSeq;
477 }
478 
479 // XFunctionDescriptions
480 
481 uno::Sequence<beans::PropertyValue> SAL_CALL ScFunctionListObj::getById( sal_Int32 nId )
482 {
483  SolarMutexGuard aGuard;
485  if ( !pFuncList )
486  throw uno::RuntimeException(); // should not happen
487 
488  sal_uInt16 nCount = static_cast<sal_uInt16>(pFuncList->GetCount());
489  for (sal_uInt16 nIndex=0; nIndex<nCount; nIndex++)
490  {
491  const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
492  if ( pDesc && pDesc->nFIndex == nId )
493  {
494  uno::Sequence<beans::PropertyValue> aSeq( SC_FUNCDESC_PROPCOUNT );
495  lcl_FillSequence( aSeq, *pDesc );
496  return aSeq;
497  }
498  }
499 
500  throw lang::IllegalArgumentException(); // not found
501 }
502 
503 // XNameAccess
504 
505 uno::Any SAL_CALL ScFunctionListObj::getByName( const OUString& aName )
506 {
507  SolarMutexGuard aGuard;
509  if ( !pFuncList )
510  throw uno::RuntimeException(); // should not happen
511 
512  sal_uInt16 nCount = static_cast<sal_uInt16>(pFuncList->GetCount());
513  for (sal_uInt16 nIndex=0; nIndex<nCount; nIndex++)
514  {
515  const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
517  if ( pDesc && pDesc->mxFuncName && aName == *pDesc->mxFuncName )
518  {
519  uno::Sequence<beans::PropertyValue> aSeq( SC_FUNCDESC_PROPCOUNT );
520  lcl_FillSequence( aSeq, *pDesc );
521  return uno::makeAny(aSeq);
522  }
523  }
524 
525  throw container::NoSuchElementException(); // not found
526 }
527 
528 // XIndexAccess
529 
530 sal_Int32 SAL_CALL ScFunctionListObj::getCount()
531 {
532  SolarMutexGuard aGuard;
533  sal_Int32 nCount = 0;
535  if ( pFuncList )
536  nCount = static_cast<sal_Int32>(pFuncList->GetCount());
537  return nCount;
538 }
539 
540 uno::Any SAL_CALL ScFunctionListObj::getByIndex( sal_Int32 nIndex )
541 {
542  SolarMutexGuard aGuard;
544  if ( !pFuncList )
545  throw uno::RuntimeException(); // should not happen
546 
547  if ( nIndex >= 0 && nIndex < static_cast<sal_Int32>(pFuncList->GetCount()) )
548  {
549  const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
550  if ( pDesc )
551  {
552  uno::Sequence<beans::PropertyValue> aSeq( SC_FUNCDESC_PROPCOUNT );
553  lcl_FillSequence( aSeq, *pDesc );
554  return uno::makeAny(aSeq);
555  }
556  }
557 
558  throw lang::IndexOutOfBoundsException(); // illegal index
559 }
560 
561 // XEnumerationAccess
562 
563 uno::Reference<container::XEnumeration> SAL_CALL ScFunctionListObj::createEnumeration()
564 {
565  SolarMutexGuard aGuard;
566  return new ScIndexEnumeration(this, "com.sun.star.sheet.FunctionDescriptionEnumeration");
567 }
568 
569 // XElementAccess
570 
572 {
573  SolarMutexGuard aGuard;
575 }
576 
578 {
579  SolarMutexGuard aGuard;
580  return ( getCount() > 0 );
581 }
582 
583 uno::Sequence<OUString> SAL_CALL ScFunctionListObj::getElementNames()
584 {
585  SolarMutexGuard aGuard;
587  if ( pFuncList )
588  {
589  sal_uInt32 nCount = pFuncList->GetCount();
590  uno::Sequence<OUString> aSeq(nCount);
591  OUString* pAry = aSeq.getArray();
592  for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
593  {
594  const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
595  if ( pDesc && pDesc->mxFuncName )
596  pAry[nIndex] = *pDesc->mxFuncName;
597  }
598  return aSeq;
599  }
600  return {};
601 }
602 
603 sal_Bool SAL_CALL ScFunctionListObj::hasByName( const OUString& aName )
604 {
605  SolarMutexGuard aGuard;
607  if ( pFuncList )
608  {
609  sal_uInt32 nCount = pFuncList->GetCount();
610  for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
611  {
612  const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
614  if ( pDesc && pDesc->mxFuncName && aName == *pDesc->mxFuncName )
615  return true;
616  }
617  }
618  return false;
619 }
620 
621 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define MAXZOOM
Definition: global.hxx:78
virtual void SAL_CALL setRecentFunctionIds(const css::uno::Sequence< sal_Int32 > &aRecentFunctionIds) override
Definition: appluno.cxx:388
#define SC_UNONAME_METRIC
Definition: unonames.hxx:239
List of spreadsheet functions.
Definition: funcdesc.hxx:241
#define SC_UNONAME_ID
Definition: unonames.hxx:229
#define SC_UNONAME_PRALLSH
Definition: unonames.hxx:248
#define SC_UNONAME_PREMPTY
Definition: unonames.hxx:249
Collection of user-defined sort lists.
Definition: userlist.hxx:66
virtual sal_Int32 SAL_CALL getCount() override
Definition: appluno.cxx:530
sal_Int32 nIndex
static const SfxItemPropertyMapEntry * lcl_GetSettingsPropertyMap()
Definition: appluno.cxx:54
bool GetMoveSelection() const
Definition: inputopt.hxx:49
bool GetAutoComplete() const
Definition: appoptio.hxx:54
virtual ~ScSpreadsheetSettings() override
Definition: appluno.cxx:95
#define PAIRED_VAR_ARGS
sal_uInt16 GetSuppressedArgCount() const
Returns the number of non-suppressed arguments.
Definition: funcdesc.cxx:278
bool bOptional
Parameter is optional.
Definition: funcdesc.hxx:211
#define SC_UNONAME_PRMETRICS
Definition: unonames.hxx:247
static void lcl_FillSequence(uno::Sequence< beans::PropertyValue > &rSequence, const ScFuncDesc &rDesc)
Definition: appluno.cxx:426
ScLkUpdMode GetLinkMode() const
Definition: appoptio.hxx:67
std::unique_ptr< ContentProperties > pData
#define SC_UNONAME_STBFUNC
Definition: unonames.hxx:244
#define SC_UNONAME_MOVEDIR
Definition: unonames.hxx:240
sal_uInt16 char char * pDesc
Definition: callform.cxx:57
sal_uInt16 GetLRUFuncListCount() const
Definition: appoptio.hxx:47
#define SC_UNONAME_SCALE
Definition: unonames.hxx:243
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: appluno.cxx:287
void SetLRUFuncList(const sal_uInt16 *pList, const sal_uInt16 nCount)
Definition: appoptio.cxx:107
sal_Int64 n
#define SC_UNONAME_MARKHDR
Definition: unonames.hxx:238
#define SC_ZOOMVAL_PAGEWIDTH
Definition: appluno.cxx:47
#define SC_FUNCDESC_PROPCOUNT
Definition: appluno.cxx:50
virtual ~ScFunctionListObj() override
Definition: appluno.cxx:414
size_t size() const
Definition: userlist.cxx:345
SvxZoomType GetZoomType() const
Definition: appoptio.hxx:44
virtual sal_Int32 SAL_CALL getMaxRecentFunctions() override
Definition: appluno.cxx:405
#define SC_UNONAME_CATEGORY
Definition: unonames.hxx:227
virtual css::uno::Type SAL_CALL getElementType() override
Definition: appluno.cxx:571
void SetEnterEdit(bool bSet)
Definition: inputopt.hxx:50
#define SC_UNONAME_MOVESEL
Definition: unonames.hxx:241
SfxApplication * SfxGetpApp()
OUString GetString(int nId)
FieldUnit GetAppMetric() const
Definition: appoptio.hxx:40
void push_back(ScUserListData *p)
Definition: userlist.cxx:350
Stores individual user-defined sort list.
Definition: userlist.hxx:32
#define SC_UNONAME_EXPREF
Definition: unonames.hxx:235
#define SC_UNONAME_RANGEFIN
Definition: unonames.hxx:242
bool GetMarkHeader() const
Definition: inputopt.hxx:61
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: appluno.cxx:563
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: appluno.cxx:603
sal_uInt16 GetZoom() const
Definition: appoptio.hxx:42
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
int nCount
sal_uInt16 * GetLRUFuncList() const
Definition: appoptio.hxx:48
virtual sal_Bool SAL_CALL hasElements() override
Definition: appluno.cxx:577
virtual ~ScRecentFunctionsObj() override
Definition: appluno.cxx:357
ParameterFlags * pDefArgFlags
Flags for each parameter.
Definition: funcdesc.hxx:220
#define SC_UNONAME_USETABCOL
Definition: unonames.hxx:246
SC_DLLPUBLIC void SetInputOptions(const ScInputOptions &rOpt)
Definition: scmod.cxx:767
bool GetTextWysiwyg() const
Definition: inputopt.hxx:65
DocumentType eType
SC_DLLPUBLIC void SetAppOptions(const ScAppOptions &rOpt)
Definition: scmod.cxx:714
sal_uInt16 nCategory
Function category.
Definition: funcdesc.hxx:222
#define SC_UNONAME_DESCRIPTION
Definition: unonames.hxx:228
bool GetUseTabCol() const
Definition: inputopt.hxx:63
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: appluno.cxx:135
int i
bool GetReplaceCellsWarn() const
Definition: inputopt.hxx:67
bool GetEnterEdit() const
Definition: inputopt.hxx:51
void SetAllSheets(bool bVal)
Definition: printopt.hxx:39
SC_DLLPUBLIC const ScPrintOptions & GetPrintOptions()
Definition: scmod.cxx:791
#define VAR_ARGS
std::vector< OUString > maDefArgDescs
Description(s) of parameter(s)
Definition: funcdesc.hxx:219
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
Definition: scdll.cxx:99
#define SC_MOD()
Definition: scmod.hxx:250
void SetPrintOptions(const ScPrintOptions &rOpt)
Definition: scmod.cxx:783
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ScRecentFunctionsObj_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: appluno.cxx:362
const Any & any
sal_Int16 getPropertyInt16(const OUString &aPropertyName)
Definition: appluno.cxx:117
SC_DLLPUBLIC const ScAppOptions & GetAppOptions()
Definition: scmod.cxx:727
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ScFunctionListObj_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: appluno.cxx:419
#define SC_UNONAME_ULISTS
Definition: unonames.hxx:245
float u
unsigned char sal_Bool
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:276
std::optional< OUString > mxFuncDesc
Description of function.
Definition: funcdesc.hxx:217
#define LRU_MAX
Definition: funcdesc.hxx:34
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:63
constexpr OUStringLiteral SCFUNCTIONLISTOBJ_SERVICE
Definition: appluno.cxx:81
const ScFuncDesc * GetFunction(sal_uInt32 nIndex) const
Definition: funcdesc.cxx:1009
static sal_Int16 GetInt16FromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:144
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:72
static ScFunctionList * GetStarCalcFunctionList()
Definition: global.cxx:612
constexpr OUStringLiteral SCSPREADSHEETSETTINGS_SERVICE
Definition: appluno.cxx:83
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_ScSpreadsheetSettings_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: appluno.cxx:100
#define SC_ZOOMVAL_OPTIMAL
somewhere central
Definition: appluno.cxx:45
bool GetExtendFormat() const
Definition: inputopt.hxx:53
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getRecentFunctionIds() override
Definition: appluno.cxx:371
bool GetExpandRefs() const
Definition: inputopt.hxx:57
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getById(sal_Int32 nId) override
Definition: appluno.cxx:481
bool getPropertyBool(const OUString &aPropertyName)
Definition: appluno.cxx:109
std::optional< OUString > mxFuncName
Function name.
Definition: funcdesc.hxx:216
Any makeAny(Color const &value)
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: appluno.cxx:505
#define SC_UNONAME_DOAUTOCP
Definition: unonames.hxx:233
bool GetAllSheets() const
Definition: printopt.hxx:38
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: appluno.cxx:127
#define SC_UNONAME_NAME
Definition: unonames.hxx:230
virtual void initArgumentInfo() const override
Requests function data from AddInCollection.
Definition: funcdesc.cxx:327
void clear()
Definition: userlist.cxx:340
sal_uInt16 GetMoveDir() const
Definition: inputopt.hxx:47
SC_DLLPUBLIC const ScInputOptions & GetInputOptions()
Definition: scmod.cxx:775
Sequence< sal_Int8 > aSeq
sal_uInt16 nFIndex
Unique function index.
Definition: funcdesc.hxx:221
#define SC_ZOOMVAL_WHOLEPAGE
Definition: appluno.cxx:46
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: appluno.cxx:583
sal_uInt32 GetCount() const
Definition: funcdesc.hxx:247
constexpr OUStringLiteral SCRECENTFUNCTIONSOBJ_SERVICE
Definition: appluno.cxx:82
void SetSkipEmpty(bool bVal)
Definition: printopt.hxx:37
#define SC_UNONAME_EXTFMT
Definition: unonames.hxx:236
#define SC_UNONAME_ENTERED
Definition: unonames.hxx:234
sal_uInt32 GetStatusFunc() const
Definition: appoptio.hxx:52
bool GetRangeFinder() const
Definition: inputopt.hxx:55
#define MINZOOM
Definition: global.hxx:77
#define SC_UNONAME_ARGUMENTS
Definition: unonames.hxx:226
std::vector< OUString > maDefArgNames
Parameter name(s)
Definition: funcdesc.hxx:218
bool GetSkipEmpty() const
Definition: printopt.hxx:36
SvxZoomType
#define SC_UNONAME_LINKUPD
Definition: unonames.hxx:237
static bool GetBoolFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:138
#define SC_UNONAME_REPLWARN
Definition: unonames.hxx:250
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
Definition: funcdesc.hxx:40
sal_uInt16 nArgCount
All parameter count, suppressed and unsuppressed.
Definition: funcdesc.hxx:223
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: appluno.cxx:540