LibreOffice Module sc (master)  1
funcuno.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 
21 #include <sfx2/app.hxx>
22 #include <svl/itemprop.hxx>
23 #include <svl/sharedstringpool.hxx>
24 #include <unotools/charclass.hxx>
25 #include <osl/diagnose.h>
26 #include <vcl/svapp.hxx>
27 
28 #include <funcuno.hxx>
29 #include <miscuno.hxx>
30 #include <cellsuno.hxx>
31 #include <scdll.hxx>
32 #include <document.hxx>
33 #include <compiler.hxx>
34 #include <formula/errorcodes.hxx>
35 #include <callform.hxx>
36 #include <addincol.hxx>
37 #include <rangeseq.hxx>
38 #include <formulacell.hxx>
39 #include <docoptio.hxx>
40 #include <optuno.hxx>
41 #include <markdata.hxx>
42 #include <patattr.hxx>
43 #include <docpool.hxx>
44 #include <attrib.hxx>
45 #include <clipparam.hxx>
46 #include <stringutil.hxx>
47 #include <tokenarray.hxx>
48 #include <memory>
49 
50 using namespace com::sun::star;
51 
52 // registered as implementation for service FunctionAccess,
53 // also supports service SpreadsheetDocumentSettings (to set null date etc.)
54 
55 #define SCFUNCTIONACCESS_SERVICE "com.sun.star.sheet.FunctionAccess"
56 #define SCDOCSETTINGS_SERVICE "com.sun.star.sheet.SpreadsheetDocumentSettings"
57 
58 // helper to use cached document if not in use, temporary document otherwise
59 
60 namespace {
61 
62 class ScTempDocSource
63 {
64 private:
65  ScTempDocCache& rCache;
66  ScDocument* pTempDoc;
67 
68  static ScDocument* CreateDocument(); // create and initialize doc
69 
70 public:
71  explicit ScTempDocSource( ScTempDocCache& rDocCache );
72  ~ScTempDocSource() COVERITY_NOEXCEPT_FALSE;
73 
74  ScDocument* GetDocument();
75 };
76 
77 }
78 
79 ScDocument* ScTempDocSource::CreateDocument()
80 {
82  pDoc->MakeTable( 0 );
83  return pDoc;
84 }
85 
86 ScTempDocSource::ScTempDocSource( ScTempDocCache& rDocCache ) :
87  rCache( rDocCache ),
88  pTempDoc( nullptr )
89 {
90  if ( rCache.IsInUse() )
91  pTempDoc = CreateDocument();
92  else
93  {
94  rCache.SetInUse( true );
95  if ( !rCache.GetDocument() )
96  rCache.SetDocument( CreateDocument() );
97  }
98 }
99 
100 ScTempDocSource::~ScTempDocSource() COVERITY_NOEXCEPT_FALSE
101 {
102  if ( pTempDoc )
103  delete pTempDoc;
104  else
105  rCache.SetInUse( false );
106 }
107 
108 ScDocument* ScTempDocSource::GetDocument()
109 {
110  if ( pTempDoc )
111  return pTempDoc;
112  else
113  return rCache.GetDocument();
114 }
115 
117  : bInUse(false)
118 {
119 }
120 
122 {
123  OSL_ENSURE(!xDoc, "ScTempDocCache::SetDocument: already set");
124  xDoc.reset(pNew);
125 }
126 
128 {
129  OSL_ENSURE( !bInUse, "ScTempDocCache::Clear: bInUse" );
130  xDoc.reset();
131 }
132 
133 // copy results from one document into another
136 
137 static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange,
138  ScDocument* pDestDoc, const ScAddress& rDestPos )
139 {
140  SCTAB nSrcTab = rSrcRange.aStart.Tab();
141  SCTAB nDestTab = rDestPos.Tab();
142 
143  ScRange aNewRange( rDestPos, ScAddress(
144  rSrcRange.aEnd.Col() - rSrcRange.aStart.Col() + rDestPos.Col(),
145  rSrcRange.aEnd.Row() - rSrcRange.aStart.Row() + rDestPos.Row(),
146  nDestTab ) );
147 
149  ScMarkData aSourceMark(pSrcDoc->GetSheetLimits());
150  aSourceMark.SelectOneTable( nSrcTab ); // for CopyToClip
151  aSourceMark.SetMarkArea( rSrcRange );
152  ScClipParam aClipParam(rSrcRange, false);
153  pSrcDoc->CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, false, false);
154 
155  if ( pClipDoc->HasAttrib( 0,0,nSrcTab, pClipDoc->MaxCol(), pClipDoc->MaxRow(),nSrcTab,
157  {
158  ScPatternAttr aPattern( pSrcDoc->GetPool() );
159  aPattern.GetItemSet().Put( ScMergeAttr() ); // Defaults
160  aPattern.GetItemSet().Put( ScMergeFlagAttr() );
161  pClipDoc->ApplyPatternAreaTab( 0,0, pClipDoc->MaxCol(), pClipDoc->MaxRow(), nSrcTab, aPattern );
162  }
163 
164  ScMarkData aDestMark(pDestDoc->GetSheetLimits());
165  aDestMark.SelectOneTable( nDestTab );
166  aDestMark.SetMarkArea( aNewRange );
167  pDestDoc->CopyFromClip( aNewRange, aDestMark, InsertDeleteFlags::ALL & ~InsertDeleteFlags::FORMULA, nullptr, pClipDoc.get(), false );
168 
169  return true;
170 }
171 
173  aPropertyMap( ScDocOptionsHelper::GetPropertyMap() ),
174  mbArray( true ), // default according to behaviour of older Office versions
175  mbValid( true )
176 {
177  StartListening( *SfxGetpApp() ); // for SfxHintId::Deinitializing
178 }
179 
181 {
182  pOptions.reset();
183  {
184  // SfxBroadcaster::RemoveListener checks DBG_TESTSOLARMUTEX():
185  SolarMutexGuard g;
186  EndListeningAll();
187  }
188 }
189 
191 {
192  if ( rHint.GetId() == SfxHintId::Deinitializing )
193  {
194  // document must not be used anymore
195  aDocCache.Clear();
196  mbValid = false;
197  }
198 }
199 
200 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
201 ScFunctionAccess_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &)
202 {
203  SolarMutexGuard aGuard;
204  ScDLL::Init();
205  return cppu::acquire(new ScFunctionAccess);
206 }
207 
208 // XServiceInfo
210 {
211  return "stardiv.StarCalc.ScFunctionAccess";
212 }
213 
214 sal_Bool SAL_CALL ScFunctionAccess::supportsService( const OUString& rServiceName )
215 {
216  return cppu::supportsService(this, rServiceName);
217 }
218 
219 uno::Sequence<OUString> SAL_CALL ScFunctionAccess::getSupportedServiceNames()
220 {
222 }
223 
224 // XPropertySet (document settings)
225 
226 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScFunctionAccess::getPropertySetInfo()
227 {
228  SolarMutexGuard aGuard;
229  static uno::Reference<beans::XPropertySetInfo> aRef(
231  return aRef;
232 }
233 
235  const OUString& aPropertyName, const uno::Any& aValue )
236 {
237  SolarMutexGuard aGuard;
238 
239  if ( aPropertyName == "IsArrayFunction" )
240  {
241  if( !(aValue >>= mbArray) )
242  throw lang::IllegalArgumentException();
243  }
244  else
245  {
246  if ( !pOptions )
247  pOptions.reset( new ScDocOptions() );
248 
249  // options aren't initialized from configuration - always get the same default behaviour
250 
251  bool bDone = ScDocOptionsHelper::setPropertyValue( *pOptions, aPropertyMap, aPropertyName, aValue );
252  if (!bDone)
253  throw beans::UnknownPropertyException(aPropertyName);
254  }
255 }
256 
257 uno::Any SAL_CALL ScFunctionAccess::getPropertyValue( const OUString& aPropertyName )
258 {
259  SolarMutexGuard aGuard;
260 
261  if ( aPropertyName == "IsArrayFunction" )
262  return uno::Any( mbArray );
263 
264  if ( !pOptions )
265  pOptions.reset( new ScDocOptions() );
266 
267  // options aren't initialized from configuration - always get the same default behaviour
268 
270 }
271 
273 
274 // XFunctionAccess
275 
276 static bool lcl_AddFunctionToken( ScTokenArray& rArray, const OUString& rName,const ScCompiler& rCompiler )
277 {
278  // function names are always case-insensitive
279  OUString aUpper = ScGlobal::getCharClassPtr()->uppercase(rName);
280 
281  // same options as in ScCompiler::IsOpCode:
282  // 1. built-in function name
283 
284  OpCode eOp = rCompiler.GetEnglishOpCode( aUpper );
285  if ( eOp != ocNone )
286  {
287  rArray.AddOpCode( eOp );
288  return true;
289  }
290 
291  // 2. old add in functions
292 
293  if (ScGlobal::GetLegacyFuncCollection()->findByName(aUpper))
294  {
295  rArray.AddExternal(aUpper.getStr());
296  return true;
297  }
298 
299  // 3. new (uno) add in functions
300 
301  OUString aIntName =
302  ScGlobal::GetAddInCollection()->FindFunction(aUpper, false);
303  if (!aIntName.isEmpty())
304  {
305  rArray.AddExternal(aIntName.getStr()); // international name
306  return true;
307  }
308 
309  return false; // no valid function name
310 }
311 
312 static void lcl_AddRef( ScTokenArray& rArray, sal_Int32 nStartRow, sal_Int32 nColCount, sal_Int32 nRowCount )
313 {
314  ScComplexRefData aRef;
315  aRef.InitRange(ScRange(0,nStartRow,0,nColCount-1,nStartRow+nRowCount-1,0));
316  rArray.AddDoubleReference(aRef);
317 }
318 
319 namespace {
320 
321 class SimpleVisitor
322 {
323 protected:
324  bool mbArgError;
325  ScDocument* mpDoc;
326 public:
327  explicit SimpleVisitor( ScDocument* pDoc ) : mbArgError( false ), mpDoc( pDoc ) {}
328  // could possibly just get away with JUST the following overload
329  // 1) virtual void visitElem( long& nCol, long& nRow, const double& elem )
330  // 2) virtual void visitElem( long& nCol, long& nRow, const OUString& elem )
331  // 3) virtual void visitElem( long& nCol, long& nRow, const uno::Any& elem )
332  // the other types methods are here just to reflect the orig code and for
333  // completeness.
334 
335  void visitElem( sal_Int32 nCol, sal_Int32 nRow, sal_Int16 elem )
336  {
337  mpDoc->SetValue( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), 0, elem );
338  }
339  void visitElem( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 elem )
340  {
341  mpDoc->SetValue( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), 0, elem );
342  }
343  void visitElem( sal_Int32 nCol, sal_Int32 nRow, const double& elem )
344  {
345  mpDoc->SetValue( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), 0, elem );
346  }
347  void visitElem( sal_Int32 nCol, sal_Int32 nRow, const OUString& elem )
348  {
349  if (!elem.isEmpty())
350  {
351  ScSetStringParam aParam;
352  aParam.setTextInput();
353  mpDoc->SetString(ScAddress(nCol,nRow,0), elem, &aParam);
354  }
355  }
356  void visitElem( sal_Int32 nCol, sal_Int32 nRow, const uno::Any& rElement )
357  {
358  uno::TypeClass eElemClass = rElement.getValueTypeClass();
359  if ( eElemClass == uno::TypeClass_VOID )
360  {
361  // leave empty
362  }
363  else if ( eElemClass == uno::TypeClass_BYTE ||
364  eElemClass == uno::TypeClass_SHORT ||
365  eElemClass == uno::TypeClass_UNSIGNED_SHORT ||
366  eElemClass == uno::TypeClass_LONG ||
367  eElemClass == uno::TypeClass_UNSIGNED_LONG ||
368  eElemClass == uno::TypeClass_FLOAT ||
369  eElemClass == uno::TypeClass_DOUBLE )
370  {
371  // accept integer types because Basic passes a floating point
372  // variable as byte, short or long if it's an integer number.
373  double fVal(0.0);
374  rElement >>= fVal;
375  visitElem( nCol, nRow, fVal );
376  }
377  else if ( eElemClass == uno::TypeClass_STRING )
378  {
379  OUString aUStr;
380  rElement >>= aUStr;
381  visitElem( nCol, nRow, aUStr );
382  }
383  else
384  mbArgError = true;
385  }
386  bool hasArgError() const { return mbArgError; }
387 };
388 
389 template< class seq >
390 class SequencesContainer
391 {
392  uno::Sequence< uno::Sequence< seq > > maSeq;
393 
394  sal_Int32& mrDocRow;
395  bool mbOverflow;
396  bool mbArgError;
397  ScDocument* mpDoc;
398  ScTokenArray& mrTokenArr;
399 
400 public:
401  SequencesContainer( const uno::Any& rArg, ScTokenArray& rTokenArr, sal_Int32& rDocRow, ScDocument* pDoc ) :
402  mrDocRow( rDocRow ), mbOverflow(false), mbArgError(false), mpDoc( pDoc ), mrTokenArr( rTokenArr )
403  {
404  rArg >>= maSeq;
405  }
406 
407  void process()
408  {
409  SimpleVisitor aVisitor(mpDoc);
410  sal_Int32 nStartRow = mrDocRow;
411  sal_Int32 nRowCount = maSeq.getLength();
412  sal_Int32 nMaxColCount = 0;
413  for ( const uno::Sequence< seq >& rRow : maSeq )
414  {
415  sal_Int32 nColCount = rRow.getLength();
416  if ( nColCount > nMaxColCount )
417  nMaxColCount = nColCount;
418  const seq* pColArr = rRow.getConstArray();
419  for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
420  if ( nCol <= mpDoc->MaxCol() && mrDocRow <= mpDoc->MaxRow() )
421  aVisitor.visitElem( nCol, mrDocRow, pColArr[ nCol ] );
422  else
423  mbOverflow=true;
424  mrDocRow++;
425  }
426  mbArgError = aVisitor.hasArgError();
427  if ( nRowCount && nMaxColCount && !mbOverflow )
428  lcl_AddRef( mrTokenArr, nStartRow, nMaxColCount, nRowCount );
429  }
430  bool getOverflow() const { return mbOverflow; }
431  bool getArgError() const { return mbArgError; }
432 };
433 
434 template <class T>
435 class ArrayOfArrayProc
436 {
437 public:
438 static void processSequences( ScDocument* pDoc, const uno::Any& rArg, ScTokenArray& rTokenArr,
439  sal_Int32& rDocRow, bool& rArgErr, bool& rOverflow )
440 {
441  SequencesContainer< T > aContainer( rArg, rTokenArr, rDocRow, pDoc );
442  aContainer.process();
443  rArgErr = aContainer.getArgError();
444  rOverflow = aContainer.getOverflow();
445 }
446 };
447 
448 }
449 
450 uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName,
451  const uno::Sequence<uno::Any>& aArguments )
452 {
453  SolarMutexGuard aGuard;
454 
455  if (!mbValid)
456  throw uno::RuntimeException();
457 
458  // use cached document if not in use, temporary document otherwise
459  // (deleted in ScTempDocSource dtor)
460  ScTempDocSource aSource( aDocCache );
461  ScDocument* pDoc = aSource.GetDocument();
462  const static SCTAB nTempSheet = 1;
463  // Create an extra tab to contain the Function Cell
464  // this will allow full rows to be used.
465  if ( !pDoc->HasTable( nTempSheet ) )
466  pDoc->MakeTable( nTempSheet );
467 
469  ScAddress aAdr;
470  ScCompiler aCompiler(*pDoc, aAdr, pDoc->GetGrammar());
471 
472  // find function
473 
474  ScTokenArray aTokenArr(*pDoc);
475  if ( !lcl_AddFunctionToken( aTokenArr, aName,aCompiler ) )
476  {
477  // function not found
478  throw container::NoSuchElementException();
479  }
480 
481  // set options (null date, etc.)
482 
483  if ( pOptions )
484  pDoc->SetDocOptions( *pOptions );
485 
486  // add arguments to token array
487 
488  bool bArgErr = false;
489  bool bOverflow = false;
490  sal_Int32 nDocRow = 0;
491  tools::Long nArgCount = aArguments.getLength();
492  const uno::Any* pArgArr = aArguments.getConstArray();
493 
494  svl::SharedStringPool& rSPool = pDoc->GetSharedStringPool();
495  aTokenArr.AddOpCode(ocOpen);
496  for (tools::Long nPos=0; nPos<nArgCount; nPos++)
497  {
498  if ( nPos > 0 )
499  aTokenArr.AddOpCode(ocSep);
500 
501  const uno::Any& rArg = pArgArr[nPos];
502 
503  uno::TypeClass eClass = rArg.getValueTypeClass();
504  const uno::Type& aType = rArg.getValueType();
505  if ( eClass == uno::TypeClass_BYTE ||
506  eClass == uno::TypeClass_BOOLEAN ||
507  eClass == uno::TypeClass_SHORT ||
508  eClass == uno::TypeClass_UNSIGNED_SHORT ||
509  eClass == uno::TypeClass_LONG ||
510  eClass == uno::TypeClass_UNSIGNED_LONG ||
511  eClass == uno::TypeClass_FLOAT ||
512  eClass == uno::TypeClass_DOUBLE )
513  {
514  // accept integer types because Basic passes a floating point
515  // variable as byte, short or long if it's an integer number.
516  double fVal = 0;
517  rArg >>= fVal;
518  aTokenArr.AddDouble( fVal );
519  }
520  else if ( eClass == uno::TypeClass_STRING )
521  {
522  OUString aUStr;
523  rArg >>= aUStr;
524  aTokenArr.AddString(rSPool.intern(aUStr));
525  }
526  else if ( aType.equals( cppu::UnoType<uno::Sequence< uno::Sequence<sal_Int16> >>::get() ) )
527  {
528  ArrayOfArrayProc<sal_Int16>::processSequences( pDoc, rArg, aTokenArr, nDocRow, bArgErr, bOverflow );
529  }
530  else if ( aType.equals( cppu::UnoType<uno::Sequence< uno::Sequence<sal_Int32> >>::get() ) )
531  {
532  ArrayOfArrayProc<sal_Int32>::processSequences( pDoc, rArg, aTokenArr, nDocRow, bArgErr, bOverflow );
533  }
534  else if ( aType.equals( cppu::UnoType<uno::Sequence< uno::Sequence<double> >>::get() ) )
535  {
536  ArrayOfArrayProc<double>::processSequences( pDoc, rArg, aTokenArr, nDocRow, bArgErr, bOverflow );
537  }
538  else if ( aType.equals( cppu::UnoType<uno::Sequence< uno::Sequence<OUString> >>::get() ) )
539  {
540  ArrayOfArrayProc<OUString>::processSequences( pDoc, rArg, aTokenArr, nDocRow, bArgErr, bOverflow );
541  }
542  else if ( aType.equals( cppu::UnoType<uno::Sequence< uno::Sequence<uno::Any> >>::get() ) )
543  {
544  ArrayOfArrayProc<uno::Any>::processSequences( pDoc, rArg, aTokenArr, nDocRow, bArgErr, bOverflow );
545  }
546  else if ( aType.equals( cppu::UnoType<table::XCellRange>::get()) )
547  {
548  // currently, only our own cell ranges are supported
549 
550  uno::Reference<table::XCellRange> xRange(rArg, uno::UNO_QUERY);
551  ScCellRangesBase* pImpl = comphelper::getUnoTunnelImplementation<ScCellRangesBase>( xRange );
552  if ( pImpl )
553  {
554  ScDocument* pSrcDoc = pImpl->GetDocument();
555  const ScRangeList& rRanges = pImpl->GetRangeList();
556  if ( pSrcDoc && rRanges.size() == 1 )
557  {
558  ScRange const & rSrcRange = rRanges[ 0 ];
559 
560  sal_Int32 nStartRow = nDocRow;
561  sal_Int32 nColCount = rSrcRange.aEnd.Col() - rSrcRange.aStart.Col() + 1;
562  sal_Int32 nRowCount = rSrcRange.aEnd.Row() - rSrcRange.aStart.Row() + 1;
563 
564  if ( nStartRow + nRowCount > pDoc->GetSheetLimits().GetMaxRowCount() )
565  bOverflow = true;
566  else
567  {
568  // copy data
569  if ( !lcl_CopyData( pSrcDoc, rSrcRange, pDoc, ScAddress( 0, static_cast<SCROW>(nDocRow), 0 ) ) )
570  bOverflow = true;
571  }
572 
573  nDocRow += nRowCount;
574  if ( !bOverflow )
575  lcl_AddRef( aTokenArr, nStartRow, nColCount, nRowCount );
576  }
577  else
578  bArgErr = true;
579  }
580  else
581  bArgErr = true;
582  }
583  else
584  bArgErr = true; // invalid type
585  }
586  aTokenArr.AddOpCode(ocClose);
587  aTokenArr.AddOpCode(ocStop);
588 
589  // execute formula
590 
591  uno::Any aRet;
592  if ( !bArgErr && !bOverflow && nDocRow <= pDoc->GetSheetLimits().GetMaxRowCount() )
593  {
594  ScAddress aFormulaPos( 0, 0, nTempSheet );
595  // GRAM_API doesn't really matter for the token array but fits with
596  // other API compatibility grammars.
597  ScFormulaCell* pFormula = new ScFormulaCell(
598  *pDoc, aFormulaPos, aTokenArr, formula::FormulaGrammar::GRAM_API,
600  pFormula = pDoc->SetFormulaCell(aFormulaPos, pFormula);
601  if (mbArray && pFormula)
602  pFormula->SetMatColsRows(1,1); // the cell dimensions (only one cell)
603 
604  // call GetMatrix before GetErrCode because GetMatrix always recalculates
605  // if there is no matrix result
606 
607  const ScMatrix* pMat = (mbArray && pFormula) ? pFormula->GetMatrix() : nullptr;
608  FormulaError nErrCode = pFormula ? pFormula->GetErrCode() : FormulaError::IllegalArgument;
609  if ( nErrCode == FormulaError::NONE )
610  {
611  if ( pMat )
612  {
613  // array result
614  ScRangeToSequence::FillMixedArray( aRet, pMat );
615  }
616  else if ( pFormula->IsValue() )
617  {
618  // numeric value
619  aRet <<= pFormula->GetValue();
620  }
621  else
622  {
623  // string result
624  OUString aStrVal = pFormula->GetString().getString();
625  aRet <<= aStrVal;
626  }
627  }
628  else if ( nErrCode == FormulaError::NotAvailable )
629  {
630  // #N/A: leave result empty, no exception
631  }
632  else
633  {
634  // any other error: IllegalArgumentException
635  bArgErr = true;
636  }
637 
638  pDoc->DeleteAreaTab( 0, 0, pDoc->MaxCol(), pDoc->MaxRow(), 0, InsertDeleteFlags::ALL );
639  pDoc->DeleteAreaTab( 0, 0, 0, 0, nTempSheet, InsertDeleteFlags::ALL );
640  }
641 
642  if (bOverflow)
643  throw uno::RuntimeException();
644 
645  if (bArgErr)
646  throw lang::IllegalArgumentException();
647 
648  return aRet;
649 }
650 
651 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Matrix data type that can store values of mixed types.
Definition: scmatrix.hxx:113
virtual ~ScFunctionAccess() override
Definition: funcuno.cxx:180
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
Definition: token.cxx:2212
const int nColCount
ocStop
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: funcuno.cxx:214
static SC_DLLPUBLIC ScUnoAddInCollection * GetAddInCollection()
Definition: global.cxx:269
std::unique_ptr< ScDocOptions > pOptions
Definition: funcuno.hxx:64
OUString getString() const
ScAddress aStart
Definition: address.hxx:500
SharedString intern(const OUString &rStr)
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:563
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
Store parameters used in the ScDocument::SetString() method.
Definition: stringutil.hxx:35
SCROW Row() const
Definition: address.hxx:262
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is...
Definition: stringutil.cxx:38
SC_DLLPUBLIC void CopyFromClip(const ScRange &rDestRange, const ScMarkData &rMark, InsertDeleteFlags nInsFlag, ScDocument *pRefUndoDoc, ScDocument *pClipDoc, bool bResetCut=true, bool bAsLink=false, bool bIncludeFiltered=true, bool bSkipAttrForEmpty=false, const ScRangeList *pDestRanges=nullptr)
If pDestRanges is given it overrides rDestRange, rDestRange in this case is the overall encompassing ...
Definition: document.cxx:2798
virtual OUString SAL_CALL getImplementationName() override
Definition: funcuno.cxx:209
long Long
SfxItemPropertyMap aPropertyMap
Definition: funcuno.hxx:65
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ScFunctionAccess_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: funcuno.cxx:201
ocOpen
const SfxItemSet & GetItemSet() const
#define SCFUNCTIONACCESS_SERVICE
Definition: funcuno.cxx:55
ScAddress aEnd
Definition: address.hxx:501
ScTempDocCache aDocCache
Definition: funcuno.hxx:63
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3458
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:991
SCROW GetMaxRowCount() const
Definition: sheetlimits.hxx:61
virtual css::uno::Any SAL_CALL callFunction(const OUString &aName, const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: funcuno.cxx:450
const ScRangeList & GetRangeList() const
Definition: cellsuno.hxx:244
SfxHintId GetId() const
SfxApplication * SfxGetpApp()
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6056
static css::uno::Any getPropertyValue(const ScDocOptions &rOptions, const SfxItemPropertyMap &rPropMap, const OUString &PropertyName)
Definition: optuno.cxx:129
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:879
ScDocumentUniquePtr xDoc
Definition: funcuno.hxx:42
double GetValue()
FormulaError GetErrCode()
OpCode
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:191
SCTAB Tab() const
Definition: address.hxx:271
static bool FillMixedArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange, bool bAllowNV=false)
void Clear()
Definition: funcuno.cxx:127
ocSep
static bool setPropertyValue(ScDocOptions &rOptions, const SfxItemPropertyMap &rPropMap, const OUString &aPropertyName, const css::uno::Any &aValue)
Definition: optuno.cxx:54
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3363
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:878
void SetDocument(ScDocument *pNew)
Definition: funcuno.cxx:121
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2619
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
Definition: scdll.cxx:105
ScDocument * GetDocument() const
Definition: cellsuno.cxx:1670
const OUString & FindFunction(const OUString &rUpperName, bool bLocalFirst)
User entered name. rUpperName MUST already be upper case!
Definition: addincol.cxx:1070
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:880
size_t size() const
Definition: rangelst.hxx:90
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:189
unsigned char sal_Bool
ocNone
void SetMatColsRows(SCCOL nCols, SCROW nRows)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:73
FormulaError
SCCOL Col() const
Definition: address.hxx:267
svl::SharedString GetString()
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: funcuno.cxx:190
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SC_DLLPUBLIC ScFormulaCell * SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell)
Set formula cell, and transfer its ownership to the document.
Definition: documen2.cxx:1081
void EndListeningAll()
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: documen3.cxx:1929
static LegacyFuncCollection * GetLegacyFuncCollection()
Definition: global.cxx:264
static bool lcl_CopyData(ScDocument *pSrcDoc, const ScRange &rSrcRange, ScDocument *pDestDoc, const ScAddress &rDestPos)
merge this with ScAreaLink::Refresh copy directly without a clipboard document?
Definition: funcuno.cxx:137
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: funcuno.cxx:257
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: funcuno.cxx:234
#define SCDOCSETTINGS_SERVICE
Definition: funcuno.cxx:56
static bool lcl_AddFunctionToken(ScTokenArray &rArray, const OUString &rName, const ScCompiler &rCompiler)
Definition: funcuno.cxx:276
static void lcl_AddRef(ScTokenArray &rArray, sal_Int32 nStartRow, sal_Int32 nColCount, sal_Int32 nRowCount)
Definition: funcuno.cxx:312
void InitRange(const ScRange &rRange)
Definition: refdata.hxx:130
const ScMatrix * GetMatrix()
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
Definition: global.cxx:1011
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: funcuno.cxx:226
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: funcuno.cxx:219
SC_DLLPUBLIC void MakeTable(SCTAB nTab, bool _bNeedsNameCheck=true)
Definition: document.cxx:168
This struct stores general clipboard parameters associated with a ScDocument instance created in clip...
Definition: clipparam.hxx:30
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
Definition: document.cxx:1955
ocClose
bool mbValid
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
SC_DLLPUBLIC void CopyToClip(const ScClipParam &rClipParam, ScDocument *pClipDoc, const ScMarkData *pMarks, bool bKeepScenarioFlags, bool bIncludeObjects)
Definition: document.cxx:2175