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