LibreOffice Module sc (master) 1
vbaapplication.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 <com/sun/star/frame/XDesktop.hpp>
21#include <com/sun/star/lang/XServiceInfo.hpp>
22#include <com/sun/star/script/BasicErrorException.hpp>
23#include <com/sun/star/sheet/XCalculatable.hpp>
24#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
25#include <com/sun/star/sheet/XNamedRanges.hpp>
26#include <com/sun/star/sheet/XSpreadsheetView.hpp>
27#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
28#include <com/sun/star/task/XStatusIndicator.hpp>
29#include <com/sun/star/util/PathSettings.hpp>
30#include <com/sun/star/view/XSelectionSupplier.hpp>
31#include <ooo/vba/XCommandBars.hpp>
32#include <ooo/vba/excel/XApplicationOutgoing.hpp>
33#include <ooo/vba/excel/XlCalculation.hpp>
34#include <ooo/vba/excel/XlMousePointer.hpp>
35#include <ooo/vba/office/MsoShapeType.hpp>
36#include <ooo/vba/office/MsoAutoShapeType.hpp>
37#include <ooo/vba/office/MsoFileDialogType.hpp>
38
39#include "vbaapplication.hxx"
40#include "vbaworkbooks.hxx"
41#include "vbaworkbook.hxx"
42#include "vbarange.hxx"
43#include "vbawsfunction.hxx"
44#include "vbadialogs.hxx"
45#include "vbawindow.hxx"
46#include "vbawindows.hxx"
47#include "vbamenubars.hxx"
48#include <tabvwsh.hxx>
49#include <gridwin.hxx>
50#include "vbanames.hxx"
52#include "vbatextboxshape.hxx"
53#include "vbaovalshape.hxx"
54#include "vbalineshape.hxx"
55#include "vbaassistant.hxx"
56#include <sc.hrc>
57#include <macromgr.hxx>
58#include "vbafiledialog.hxx"
60
61#include <osl/file.hxx>
62
63#include <sfx2/bindings.hxx>
64#include <sfx2/request.hxx>
65#include <sfx2/app.hxx>
66#include <vcl/svapp.hxx>
67
69
70#include <basic/sbx.hxx>
71#include <basic/sbstar.hxx>
72#include <basic/sbuno.hxx>
73#include <basic/sbmeth.hxx>
74#include <basic/sberrors.hxx>
76#include <cppu/unotype.hxx>
77
78#include <convuno.hxx>
79#include <cellsuno.hxx>
80#include <unonames.hxx>
81#include <docsh.hxx>
82#include "excelvbahelper.hxx"
83#include <basic/sbxobj.hxx>
84
85#include <viewutil.hxx>
86#include <docoptio.hxx>
87#include <scmod.hxx>
88#include <scdll.hxx>
89
90#include <list>
91
92using namespace ::ooo::vba;
93using namespace ::com::sun::star;
94using ::com::sun::star::uno::Reference;
95using ::com::sun::star::uno::UNO_QUERY_THROW;
96using ::com::sun::star::uno::UNO_QUERY;
97
100{
107 explicit ScVbaAppSettings();
108};
109
111 mbDisplayAlerts( true ),
112 mbEnableEvents( true ),
113 mbExcel4Menus( false ),
114 mbDisplayNoteIndicator( true ),
115 mbShowWindowsInTaskbar( true ),
116 mbEnableCancelKey( false )
117{
118}
119
120namespace {
121
122ScVbaAppSettings& ScVbaStaticAppSettings()
123{
124 static ScVbaAppSettings SINGLETON;
125 return SINGLETON;
126}
127
128class ScVbaApplicationOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint>
129{
130private:
131 ScVbaApplication* mpApp;
132
133public:
134 ScVbaApplicationOutgoingConnectionPoint( ScVbaApplication* pApp );
135
136 // XConnectionPoint
137 sal_uInt32 SAL_CALL Advise(const uno::Reference< XSink >& Sink ) override;
138 void SAL_CALL Unadvise( sal_uInt32 Cookie ) override;
139};
140
141}
142
143sal_uInt32
144ScVbaApplication::AddSink( const uno::Reference< XSink >& xSink )
145{
146 {
147 SolarMutexGuard aGuard;
148 ScDLL::Init();
149 }
150 // No harm in potentially calling this several times
151 SC_MOD()->RegisterAutomationApplicationEventsCaller( uno::Reference< XSinkCaller >(this) );
152 mvSinks.push_back(xSink);
153 return mvSinks.size();
154}
155
156void
157ScVbaApplication::RemoveSink( sal_uInt32 nNumber )
158{
159 if (nNumber < 1 || nNumber > mvSinks.size())
160 return;
161
162 mvSinks[nNumber-1] = uno::Reference< XSink >();
163}
164
165ScVbaApplication::ScVbaApplication( const uno::Reference<uno::XComponentContext >& xContext ) :
166 ScVbaApplication_BASE( xContext ),
167 mrAppSettings( ScVbaStaticAppSettings() ),
168 m_nDialogType(0)
169{
170}
171
173{
174}
175
177{
178 return ScVbaStaticAppSettings().mbEnableEvents;
179}
180
181OUString SAL_CALL
182ScVbaApplication::getExactName( const OUString& aApproximateName )
183{
184 uno::Reference< beans::XExactName > xWSF( new ScVbaWSFunction( this, mxContext ) );
185 return xWSF->getExactName( aApproximateName );
186}
187
188uno::Reference< beans::XIntrospectionAccess > SAL_CALL
190{
191 uno::Reference< script::XInvocation > xWSF( new ScVbaWSFunction( this, mxContext ) );
192 return xWSF->getIntrospection();
193}
194
195uno::Any SAL_CALL
196ScVbaApplication::invoke( const OUString& FunctionName, const uno::Sequence< uno::Any >& Params, uno::Sequence< sal_Int16 >& OutParamIndex, uno::Sequence< uno::Any >& OutParam)
197{
198 /* When calling the functions directly at the Application object, no runtime
199 errors are thrown, but the error is inserted into the return value. */
200 uno::Any aAny;
201 try
202 {
203 uno::Reference< script::XInvocation > xWSF( new ScVbaWSFunction( this, mxContext ) );
204 aAny = xWSF->invoke( FunctionName, Params, OutParamIndex, OutParam );
205 }
206 catch (const uno::Exception&)
207 {
208 aAny <<= script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), 1000, OUString() );
209 }
210 return aAny;
211}
212
213void SAL_CALL
214ScVbaApplication::setValue( const OUString& PropertyName, const uno::Any& Value )
215{
216 uno::Reference< script::XInvocation > xWSF( new ScVbaWSFunction( this, mxContext ) );
217 xWSF->setValue( PropertyName, Value );
218}
219
220uno::Any SAL_CALL
221ScVbaApplication::getValue( const OUString& PropertyName )
222{
223 uno::Reference< script::XInvocation > xWSF( new ScVbaWSFunction( this, mxContext ) );
224 return xWSF->getValue( PropertyName );
225}
226
227sal_Bool SAL_CALL
228ScVbaApplication::hasMethod( const OUString& Name )
229{
230 uno::Reference< script::XInvocation > xWSF( new ScVbaWSFunction( this, mxContext ) );
231 return xWSF->hasMethod( Name );
232}
233
234sal_Bool SAL_CALL
235ScVbaApplication::hasProperty( const OUString& Name )
236{
237 uno::Reference< script::XInvocation > xWSF( new ScVbaWSFunction( this, mxContext ) );
238 return xWSF->hasProperty( Name );
239}
240
241uno::Reference< excel::XWorkbook >
243{
244 uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ), uno::UNO_SET_THROW );
245 uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY );
246 if( xWorkbook.is() ) return xWorkbook;
247 // #i116936# getVBADocument() may return null in documents without global VBA mode enabled
248 return new ScVbaWorkbook( this, mxContext, xModel );
249}
250
251uno::Reference< excel::XWorkbook > SAL_CALL
253{
254 uno::Reference< frame::XModel > xModel( getThisExcelDoc( mxContext ), uno::UNO_SET_THROW );
255 uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY );
256 if( xWorkbook.is() ) return xWorkbook;
257 // #i116936# getVBADocument() may return null in documents without global VBA mode enabled
258 return new ScVbaWorkbook( this, mxContext, xModel );
259}
260
261uno::Reference< XAssistant > SAL_CALL
263{
264 return uno::Reference< XAssistant >( new ScVbaAssistant( this, mxContext ) );
265}
266
267uno::Any SAL_CALL
269{
270 uno::Reference< frame::XModel > xModel( getCurrentDocument() );
271
272 Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), UNO_QUERY_THROW );
273 Reference< beans::XPropertySet > xPropSet( xSelSupp, UNO_QUERY_THROW );
275 uno::Any aOldVal = xPropSet->getPropertyValue( aPropName );
277 any <<= false;
278 xPropSet->setPropertyValue( aPropName, any );
279 uno::Reference<uno::XInterface> aSelection(xSelSupp->getSelection(), uno::UNO_QUERY);
280 xPropSet->setPropertyValue( aPropName, aOldVal );
281
282 if (!aSelection.is())
283 {
284 throw uno::RuntimeException( "failed to obtain current selection" );
285 }
286
287 uno::Reference< lang::XServiceInfo > xServiceInfo( aSelection, uno::UNO_QUERY_THROW );
288 OUString sImplementationName = xServiceInfo->getImplementationName();
289
290 if( sImplementationName.equalsIgnoreAsciiCase("com.sun.star.drawing.SvxShapeCollection") )
291 {
292 uno::Reference< drawing::XShapes > xShapes( aSelection, uno::UNO_QUERY_THROW );
293 uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW );
294 uno::Reference< drawing::XShape > xShape( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
295 // if ScVbaShape::getType( xShape ) == office::MsoShapeType::msoAutoShape
296 // and the uno object implements the com.sun.star.drawing.Text service
297 // return a textboxshape object
298 sal_Int32 nType = ScVbaShape::getType( xShape );
299 if ( nType == office::MsoShapeType::msoAutoShape )
300 {
301 // TODO Oval with text box
302 if( ScVbaShape::getAutoShapeType( xShape ) == office::MsoAutoShapeType::msoShapeOval )
303 {
304 return uno::Any( uno::Reference< msforms::XOval >(new ScVbaOvalShape( mxContext, xShape, xShapes, xModel ) ) );
305 }
306
307
308 uno::Reference< lang::XServiceInfo > xShapeServiceInfo( xShape, uno::UNO_QUERY_THROW );
309 if ( xShapeServiceInfo->supportsService("com.sun.star.drawing.Text") )
310 {
311 return uno::Any( uno::Reference< msforms::XTextBoxShape >(
312 new ScVbaTextBoxShape( mxContext, xShape, xShapes, xModel ) ) );
313 }
314 }
315 else if ( nType == office::MsoShapeType::msoLine )
316 {
317 return uno::Any( uno::Reference< msforms::XLine >( new ScVbaLineShape(
318 mxContext, xShape, xShapes, xModel ) ) );
319 }
320 return uno::Any( uno::Reference< msforms::XShape >(new ScVbaShape( this, mxContext, xShape, xShapes, xModel, ScVbaShape::getType( xShape ) ) ) );
321 }
322 else if( xServiceInfo->supportsService("com.sun.star.sheet.SheetCellRange") ||
323 xServiceInfo->supportsService("com.sun.star.sheet.SheetCellRanges") )
324 {
325 uno::Reference< table::XCellRange > xRange( aSelection, ::uno::UNO_QUERY);
326 if ( !xRange.is() )
327 {
328 uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aSelection, ::uno::UNO_QUERY);
329 if ( xRanges.is() )
330 return uno::Any( uno::Reference< excel::XRange >( new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ), mxContext, xRanges ) ) );
331
332 }
333 return uno::Any( uno::Reference< excel::XRange >(new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange ) ) );
334 }
335 else
336 {
337 throw uno::RuntimeException( sImplementationName + " not supported" );
338 }
339}
340
341uno::Reference< excel::XRange >
343{
344 uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
345 uno::Reference< table::XCellRange > xRange( xView->getActiveSheet(), ::uno::UNO_QUERY_THROW);
347 if ( !pViewShell )
348 throw uno::RuntimeException("No ViewShell available" );
349 ScViewData& rTabView = pViewShell->GetViewData();
350
351 sal_Int32 nCursorX = rTabView.GetCurX();
352 sal_Int32 nCursorY = rTabView.GetCurY();
353
354 // #i117392# excel::getUnoSheetModuleObj() may return null in documents without global VBA mode enabled
355 return new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) );
356}
357
358uno::Any SAL_CALL
359ScVbaApplication::GetOpenFilename(const uno::Any& /*aFileFilter*/, const uno::Any& /*aFilterIndex*/, const uno::Any& aTitle, const uno::Any& /*aButtonText*/, const uno::Any& aMultiSelect)
360{
361 // TODO - take all parameters into account
362 uno::Reference<excel::XFileDialog> xDialog(new ScVbaFileDialog(this, mxContext, office::MsoFileDialogType::msoFileDialogFilePicker));
363 xDialog->setTitle(aTitle);
364 xDialog->setAllowMultiSelect(aMultiSelect);
365
366 bool bMultiSelect = false;
367 aMultiSelect >>= bMultiSelect;
368
369 if (xDialog->Show() == 0)
370 {
371 // return FALSE when canceled
372 return uno::Any(false);
373 }
374
375 uno::Reference<excel::XFileDialogSelectedItems> xItems = xDialog->getSelectedItems();
376 auto* pItems = dynamic_cast<ScVbaFileDialogSelectedItems*>(xItems.get());
377
378 // Check, if the implementation of XFileDialogSelectedItems is what we expect
379 if (!pItems)
380 throw uno::RuntimeException("Unexpected XFileDialogSelectedItems implementation");
381
382 auto const & rItemVector = pItems->getItems();
383
384 if (!bMultiSelect) // only 1 selection allowed - return path
385 {
386 OUString aPath;
387 if (!rItemVector.empty())
388 aPath = rItemVector.at(0);
389 return uno::Any(aPath);
390 }
391 else
392 {
393 // convert to sequence
394 return uno::Any(comphelper::containerToSequence(rItemVector));
395 }
396}
397
398uno::Any SAL_CALL
400{
401 // complete stub for now
402 // #TODO flesh out some of the Indices we could handle
403 uno::Any aRet;
404 return aRet;
405}
406
407uno::Any SAL_CALL
409{
410 sal_Int32 nType = 0;
411 DialogType >>= nType;
412
414 {
416 m_xFileDialog = uno::Reference<excel::XFileDialog> ( new ScVbaFileDialog( this, mxContext, nType ));
417 }
418 return uno::Any( m_xFileDialog );
419}
420
421uno::Any SAL_CALL
423{
424 uno::Reference< XCollection > xWorkBooks( new ScVbaWorkbooks( this, mxContext ) );
425 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
426 {
427 // void then somebody did Workbooks.something in vba
428 return uno::Any( xWorkBooks );
429 }
430
431 return xWorkBooks->Item( aIndex, uno::Any() );
432}
433
434uno::Any SAL_CALL
436{
437 uno::Reference< excel::XWorkbook > xWorkbook( getActiveWorkbook(), uno::UNO_SET_THROW );
438 return xWorkbook->Worksheets( aIndex );
439}
440
441uno::Any SAL_CALL
443{
444 return uno::Any( uno::Reference< script::XInvocation >( new ScVbaWSFunction( this, mxContext ) ) );
445}
446
447uno::Any SAL_CALL
448ScVbaApplication::Evaluate( const OUString& Name )
449{
450 // #TODO Evaluate allows other things to be evaluated, e.g. functions
451 // I think ( like SIN(3) etc. ) need to investigate that
452 // named Ranges also? e.g. [MyRange] if so need a list of named ranges
453 uno::Any aVoid;
454 return uno::Any( getActiveWorkbook()->getActiveSheet()->Range( uno::Any( Name ), aVoid ) );
455}
456
459{
460 uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( uno::Reference< XHelperInterface >( this ), mxContext, getCurrentDocument() ) );
461 if( !aIndex.hasValue() )
462 return uno::Any( xDialogs );
463 return xDialogs->Item( aIndex );
464}
465
466uno::Reference< excel::XWindow > SAL_CALL
468{
469 uno::Reference< frame::XModel > xModel = getCurrentDocument();
470 uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
471 uno::Reference< XHelperInterface > xParent( getActiveWorkbook(), uno::UNO_QUERY_THROW );
472 uno::Reference< excel::XWindow > xWin( new ScVbaWindow( xParent, mxContext, xModel, xController ) );
473 return xWin;
474}
475
476uno::Any SAL_CALL
478{
479 //# FIXME TODO, implementation
481 result <<= false;
482 return result;
483}
484
485void SAL_CALL
486ScVbaApplication::setCutCopyMode( const uno::Any& /* _cutcopymode */ )
487{
488 //# FIXME TODO, implementation
489}
490
491uno::Any SAL_CALL
493{
494 return uno::Any( !getDisplayStatusBar() );
495}
496
497css::uno::Any SAL_CALL ScVbaApplication::getWindowState()
498{
499 return getActiveWindow()->getWindowState();
500}
501
502void SAL_CALL ScVbaApplication::setWindowState(const css::uno::Any& rWindowState)
503{
504 getActiveWindow()->setWindowState(rWindowState);
505}
506
507void SAL_CALL
509{
510 OUString sText;
511 bool bDefault = false;
512 uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW );
513 uno::Reference< task::XStatusIndicatorSupplier > xStatusIndicatorSupplier( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
514 uno::Reference< task::XStatusIndicator > xStatusIndicator( xStatusIndicatorSupplier->getStatusIndicator(), uno::UNO_SET_THROW );
515 if( _statusbar >>= sText )
516 {
517 setDisplayStatusBar( true );
518 if ( !sText.isEmpty() )
519 xStatusIndicator->start( sText, 100 );
520 else
521 xStatusIndicator->end(); // restore normal state for empty text
522 }
523 else if( _statusbar >>= bDefault )
524 {
525 if( !bDefault )
526 {
527 xStatusIndicator->end();
528 setDisplayStatusBar( true );
529 }
530 }
531 else
532 throw uno::RuntimeException("Invalid parameter. It should be a string or False" );
533}
534
535::sal_Int32 SAL_CALL
537{
538 // TODO: in Excel, this is an application-wide setting
539 uno::Reference<sheet::XCalculatable> xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
540 if(xCalc->isAutomaticCalculationEnabled())
541 return excel::XlCalculation::xlCalculationAutomatic;
542 else
543 return excel::XlCalculation::xlCalculationManual;
544}
545
546void SAL_CALL
547ScVbaApplication::setCalculation( ::sal_Int32 _calculation )
548{
549 // TODO: in Excel, this is an application-wide setting
550 uno::Reference< sheet::XCalculatable > xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
551 switch(_calculation)
552 {
553 case excel::XlCalculation::xlCalculationManual:
554 xCalc->enableAutomaticCalculation(false);
555 break;
556 case excel::XlCalculation::xlCalculationAutomatic:
557 case excel::XlCalculation::xlCalculationSemiautomatic:
558 xCalc->enableAutomaticCalculation(true);
559 break;
560 }
561}
562
563uno::Any SAL_CALL
565{
566 uno::Reference< excel::XWindows > xWindows( new ScVbaWindows( this, mxContext ) );
567 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
568 return uno::Any( xWindows );
569 return xWindows->Item( aIndex, uno::Any() );
570}
571void SAL_CALL
573{
575 SbxArrayRef aArgs = new SbxArray;
576 SbxVariableRef aRef = new SbxVariable;
577 aRef->PutDouble( time );
578 aArgs->Put(aRef.get(), 1);
579 SbMethod* pMeth = static_cast<SbMethod*>(pBasic->GetRtl()->Find( "WaitUntil", SbxClassType::Method ));
580
581 if ( pMeth )
582 {
583 pMeth->SetParameters( aArgs.get() );
584 SbxVariableRef refTemp = pMeth;
585 // forces a broadcast
586 SbxVariableRef pNew = new SbxMethod( *static_cast<SbxMethod*>(pMeth));
587 }
588}
589
590uno::Any SAL_CALL
591ScVbaApplication::Range( const uno::Any& Cell1, const uno::Any& Cell2 )
592{
593 uno::Reference< excel::XRange > xVbRange = ScVbaRange::ApplicationRange( mxContext, Cell1, Cell2 );
594 return uno::Any( xVbRange );
595}
596
597uno::Any SAL_CALL
598ScVbaApplication::Names( const css::uno::Any& aIndex )
599{
600 uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW );
601 uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
602 uno::Reference< sheet::XNamedRanges > xNamedRanges( xPropertySet->getPropertyValue(
603 "NamedRanges" ), uno::UNO_QUERY_THROW );
604
605 css::uno::Reference< excel::XNames > xNames ( new ScVbaNames( this , mxContext , xNamedRanges , xModel ) );
606 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
607 {
608 return uno::Any( xNames );
609 }
610 return xNames->Item( aIndex, uno::Any() );
611}
612
613uno::Reference< excel::XWorksheet > SAL_CALL
615{
616 uno::Reference< excel::XWorksheet > result;
617 uno::Reference< excel::XWorkbook > xWorkbook = getActiveWorkbook();
618 if ( xWorkbook.is() )
619 {
620 uno::Reference< excel::XWorksheet > xWorksheet =
621 xWorkbook->getActiveSheet();
622 if ( xWorksheet.is() )
623 {
624 result = xWorksheet;
625 }
626 }
627
628 if ( !result.is() )
629 {
630 // Fixme - check if this is reasonable/desired behavior
631 throw uno::RuntimeException("No activeSheet available" );
632 }
633 return result;
634
635}
636
637/*******************************************************************************
638 * In msdn:
639 * Reference Optional Variant. The destination. Can be a Range
640 * object, a string that contains a cell reference in R1C1-style notation,
641 * or a string that contains a Visual Basic procedure name.
642 * Scroll Optional Variant. True to scroll, False to not scroll through
643 * the window. The default is False.
644 * Parser is split to three parts, Range, R1C1 string and procedure name.
645 * by test excel, it seems Scroll no effect. ???
646*******************************************************************************/
647void SAL_CALL
648ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll )
649{
650 //test Scroll is a boolean
651 bool bScroll = false;
652 //R1C1-style string or a string of procedure name.
653
654 if( Scroll.hasValue() )
655 {
656 bool aScroll = false;
657 if( !(Scroll >>= aScroll) )
658 throw uno::RuntimeException("second parameter should be boolean" );
659
660 bScroll = aScroll;
661
662 }
663
664 OUString sRangeName;
665 if( Reference >>= sRangeName )
666 {
667 uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW );
668 uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
669 xModel->getCurrentController(), uno::UNO_QUERY_THROW );
670
672 ScGridWindow* gridWindow = static_cast<ScGridWindow*>(pShell->GetWindow());
673 try
674 {
675 uno::Reference< excel::XRange > xVbaSheetRange = ScVbaRange::getRangeObjectForName(
677
678 if( bScroll )
679 {
680 xVbaSheetRange->Select();
681 uno::Reference< excel::XWindow > xWindow = getActiveWindow();
682 ScSplitPos eWhich = pShell->GetViewData().GetActivePart();
683 sal_Int32 nValueX = pShell->GetViewData().GetPosX(WhichH(eWhich));
684 sal_Int32 nValueY = pShell->GetViewData().GetPosY(WhichV(eWhich));
685 xWindow->SmallScroll( uno::Any( static_cast<sal_Int16>(xVbaSheetRange->getRow() - 1) ),
686 uno::Any( static_cast<sal_Int16>(nValueY) ),
687 uno::Any( static_cast<sal_Int16>(xVbaSheetRange->getColumn() - 1) ),
688 uno::Any( static_cast<sal_Int16>(nValueX) ) );
689 gridWindow->GrabFocus();
690 }
691 else
692 {
693 xVbaSheetRange->Select();
694 gridWindow->GrabFocus();
695 }
696 }
697 catch (const uno::RuntimeException&)
698 {
699 //maybe this should be a procedure name
700 //TODO for procedure name
701 //browse::XBrowseNodeFactory is a singleton. OUString( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory")
702 //and the createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) to get a root browse::XBrowseNode.
703 //for query XInvocation interface.
704 //but how to directly get the XInvocation?
705 throw uno::RuntimeException("invalid reference for range name, it should be procedure name" );
706 }
707 return;
708 }
709 uno::Reference< excel::XRange > xRange;
710 if( Reference >>= xRange )
711 {
712 uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY );
714 ScGridWindow* gridWindow = static_cast<ScGridWindow*>(pShell->GetWindow());
715 if ( xVbaRange.is() )
716 {
717 //TODO bScroll should be used. At this time, it does not have effect
718 if( bScroll )
719 {
720 xVbaRange->Select();
721 uno::Reference< excel::XWindow > xWindow = getActiveWindow();
722 ScSplitPos eWhich = pShell->GetViewData().GetActivePart();
723 sal_Int32 nValueX = pShell->GetViewData().GetPosX(WhichH(eWhich));
724 sal_Int32 nValueY = pShell->GetViewData().GetPosY(WhichV(eWhich));
725 xWindow->SmallScroll( uno::Any( static_cast<sal_Int16>(xVbaRange->getRow() - 1) ),
726 uno::Any( static_cast<sal_Int16>(nValueY) ),
727 uno::Any( static_cast<sal_Int16>(xVbaRange->getColumn() - 1) ),
728 uno::Any( static_cast<sal_Int16>(nValueX) ) );
729 gridWindow->GrabFocus();
730 }
731 else
732 {
733 xVbaRange->Select();
734 gridWindow->GrabFocus();
735 }
736 }
737 return;
738 }
739 throw uno::RuntimeException("invalid reference or name" );
740}
741
742sal_Int32 SAL_CALL
744{
746
747 switch( nPointerStyle )
748 {
749 case PointerStyle::Arrow:
750 return excel::XlMousePointer::xlNorthwestArrow;
751 case PointerStyle::Null:
752 return excel::XlMousePointer::xlDefault;
753 case PointerStyle::Wait:
754 return excel::XlMousePointer::xlWait;
755 case PointerStyle::Text:
756 return excel::XlMousePointer::xlIBeam;
757 default:
758 return excel::XlMousePointer::xlDefault;
759 }
760}
761
762void SAL_CALL
763ScVbaApplication::setCursor( sal_Int32 _cursor )
764{
765 try
766 {
767 uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW );
768 switch( _cursor )
769 {
770 case excel::XlMousePointer::xlNorthwestArrow:
771 {
772 setCursorHelper( xModel, PointerStyle::Arrow, false );
773 break;
774 }
775 case excel::XlMousePointer::xlWait:
776 case excel::XlMousePointer::xlIBeam:
777 {
778 PointerStyle nPointer( static_cast< PointerStyle >( _cursor ) );
779 //It will set the edit window, toobar and statusbar's mouse pointer.
780 setCursorHelper( xModel, nPointer, true );
781 break;
782 }
783 case excel::XlMousePointer::xlDefault:
784 {
785 setCursorHelper( xModel, PointerStyle::Null, false );
786 break;
787 }
788 default:
789 throw uno::RuntimeException("Unknown value for Cursor pointer" );
790 // TODO: isn't this a flaw in the API? It should be allowed to throw an
791 // IllegalArgumentException, or so
792 }
793 }
794 catch (const uno::Exception&)
795 {
797 }
798}
799
800// #TODO perhaps we should switch the return type depending of the filter
801// type, e.g. return Calc for Calc and Excel if it's an imported doc
802OUString SAL_CALL
804{
805 return "Microsoft Excel";
806}
807
808// #TODO #FIXME get/setDisplayAlerts are just stub impl
809// here just the status of the switch is set
810// the function that throws an error message needs to
811// evaluate this switch in order to know whether it has to disable the
812// error message thrown by OpenOffice
813
814void SAL_CALL
816{
817 mrAppSettings.mbDisplayAlerts = displayAlerts;
818}
819
820sal_Bool SAL_CALL
822{
824}
825
826void SAL_CALL
828{
830}
831
832sal_Bool SAL_CALL
834{
836}
837
838void SAL_CALL
840{
841 // Stub, does nothing
843}
844
845sal_Bool SAL_CALL
847{
849}
850
851sal_Bool SAL_CALL
853{
855 if ( pShell )
856 return ScViewUtil::IsFullScreen( *pShell );
857 return false;
858}
859
860void SAL_CALL
862{
863 // #FIXME calling ScViewUtil::SetFullScreen( *pShell, bSet );
864 // directly results in a strange crash, using dispatch instead
865 if ( bSet != getDisplayFullScreen() )
866 dispatchRequests( getCurrentDocument(), ".uno:FullScreen" );
867}
868
869sal_Bool SAL_CALL
871{
873 if ( pShell )
874 {
875 return ( pShell->GetViewData().IsHScrollMode() && pShell->GetViewData().IsVScrollMode() );
876 }
877 return true;
878}
879
880void SAL_CALL
882{
883 // use uno here as it does all he repainting etc. magic
884 uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
885 uno::Reference< beans::XPropertySet > xProps( xView, uno::UNO_QUERY );
886 xProps->setPropertyValue("HasVerticalScrollBar", uno::Any( bSet ) );
887 xProps->setPropertyValue("HasHorizontalScrollBar", uno::Any( bSet ) );
888}
889
890sal_Bool SAL_CALL
892{
894}
895
896void SAL_CALL
898{
900}
901
902sal_Bool SAL_CALL
904{
906}
907
908void SAL_CALL
910{
912}
913
914sal_Bool SAL_CALL
916{
918}
919
920void SAL_CALL
922{
924}
925
926sal_Bool SAL_CALL
928{
929 return SC_MOD()->GetDocOptions().IsIter();
930}
931
932void SAL_CALL
934{
935 uno::Reference< lang::XMultiComponentFactory > xSMgr(
936 mxContext->getServiceManager(), uno::UNO_SET_THROW );
937
938 uno::Reference< frame::XDesktop > xDesktop
939 (xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW );
940 uno::Reference< container::XEnumeration > xComponents = xDesktop->getComponents()->createEnumeration();
941 while ( xComponents->hasMoreElements() )
942 {
943 uno::Reference< lang::XServiceInfo > xServiceInfo( xComponents->nextElement(), uno::UNO_QUERY );
944 if ( xServiceInfo.is() && xServiceInfo->supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
945 {
946 uno::Reference< beans::XPropertySet > xProps( xServiceInfo, uno::UNO_QUERY );
947 if ( xProps.is() )
948 xProps->setPropertyValue( SC_UNO_ITERENABLED, uno::Any( bSet ) );
949 }
950 }
951 ScDocOptions aOpts( SC_MOD()->GetDocOptions() );
952 aOpts.SetIter( bSet );
953 SC_MOD()->SetDocOptions( aOpts );
954}
955
956void SAL_CALL
958{
959 uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW );
960 uno::Reference< sheet::XCalculatable > xCalculatable( getCurrentDocument(), uno::UNO_QUERY_THROW );
961 xCalculatable->calculateAll();
962}
963
965static uno::Reference< util::XPathSettings > const & lcl_getPathSettingsService( const uno::Reference< uno::XComponentContext >& xContext )
966{
967 static uno::Reference< util::XPathSettings > xPathSettings( util::PathSettings::create( xContext ) );
968 return xPathSettings;
969}
970
971OUString ScVbaApplication::getOfficePath( const OUString& _sPathType )
972{
973 OUString sRetPath;
974 const uno::Reference< util::XPathSettings >& xProps = lcl_getPathSettingsService( mxContext );
975 try
976 {
977 OUString sUrl;
978 xProps->getPropertyValue( _sPathType ) >>= sUrl;
979
980 // if it's a list of paths then use the last one
981 sal_Int32 nIndex = sUrl.lastIndexOf( ';' ) ;
982 if ( nIndex > 0 )
983 sUrl = sUrl.copy( nIndex + 1 );
984 ::osl::File::getSystemPathFromFileURL( sUrl, sRetPath );
985 }
986 catch (const uno::Exception&)
987 {
988 DebugHelper::runtimeexception(ERRCODE_BASIC_METHOD_FAILED);
989 }
990 return sRetPath;
991}
992
993void SAL_CALL
994ScVbaApplication::setDefaultFilePath( const OUString& DefaultFilePath )
995{
996 const uno::Reference< util::XPathSettings >& xProps = lcl_getPathSettingsService( mxContext );
997 OUString aURL;
998 osl::FileBase::getFileURLFromSystemPath( DefaultFilePath, aURL );
999 xProps->setWork( aURL );
1000}
1001
1002OUString SAL_CALL
1004{
1005 return getOfficePath( "Work");
1006}
1007
1008OUString SAL_CALL
1010{
1011 return getOfficePath( "Basic");
1012}
1013
1014OUString SAL_CALL
1016{
1017 return getOfficePath( "Template");
1018}
1019
1020OUString SAL_CALL
1022{
1023 return OUString( sal_Unicode(SAL_PATHDELIMITER) );
1024}
1025
1026OUString SAL_CALL
1028{
1029 // TODO Solution should contain the version number of the operating system
1030 // too.
1031#if defined(_WIN32)
1032 return "Windows";
1033#elif defined(MACOSX)
1034 return "Macintosh";
1035#elif defined(UNX)
1036 // M. Office is not available on Unix systems, so it is not documented.
1037 return "Unix";
1038#else
1039 return OUString("Unknown");
1040#endif
1041}
1042
1043// Helpers for Intersect and Union
1044
1045namespace {
1046
1047typedef ::std::list< ScRange > ListOfScRange;
1048
1054void lclAddToListOfScRange( ListOfScRange& rList, const uno::Any& rArg )
1055{
1056 if( !rArg.hasValue() )
1057 return;
1058
1059 uno::Reference< excel::XRange > xRange( rArg, uno::UNO_QUERY_THROW );
1060 uno::Reference< XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW );
1061 for( sal_Int32 nIdx = 1, nCount = xCol->getCount(); nIdx <= nCount; ++nIdx )
1062 {
1063 uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::Any( nIdx ), uno::Any() ), uno::UNO_QUERY_THROW );
1064 uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW );
1065 ScRange aScRange;
1066 ScUnoConversion::FillScRange( aScRange, xAddressable->getRangeAddress() );
1067 rList.push_back( aScRange );
1068 }
1069}
1070
1073bool lclTryJoin( ScRange& r1, const ScRange& r2 )
1074{
1075 // 1) r2 is completely inside r1
1076 if( r1.Contains( r2 ) )
1077 return true;
1078
1079 // 2) r1 is completely inside r2
1080 if( r2.Contains( r1 ) )
1081 {
1082 r1 = r2;
1083 return true;
1084 }
1085
1086 SCCOL n1L = r1.aStart.Col();
1087 SCCOL n1R = r1.aEnd.Col();
1088 SCROW n1T = r1.aStart.Row();
1089 SCROW n1B = r1.aEnd.Row();
1090 SCCOL n2L = r2.aStart.Col();
1091 SCCOL n2R = r2.aEnd.Col();
1092 SCROW n2T = r2.aStart.Row();
1093 SCROW n2B = r2.aEnd.Row();
1094
1095 // 3) r1 and r2 have equal upper and lower border
1096 if( (n1T == n2T) && (n1B == n2B) )
1097 {
1098 // check that r1 overlaps or touches r2
1099 if( ((n1L < n2L) && (n2L - 1 <= n1R)) || ((n2L < n1L) && (n1L - 1 <= n2R)) )
1100 {
1101 r1.aStart.SetCol( ::std::min( n1L, n2L ) );
1102 r1.aEnd.SetCol( ::std::max( n1R, n2R ) );
1103 return true;
1104 }
1105 return false;
1106 }
1107
1108 // 4) r1 and r2 have equal left and right border
1109 if( (n1L == n2L) && (n1R == n2R) )
1110 {
1111 // check that r1 overlaps or touches r2
1112 if( ((n1T < n2T) && (n2T + 1 <= n1B)) || ((n2T < n1T) && (n1T + 1 <= n2B)) )
1113 {
1114 r1.aStart.SetRow( ::std::min( n1T, n2T ) );
1115 r1.aEnd.SetRow( ::std::max( n1B, n2B ) );
1116 return true;
1117 }
1118 return false;
1119 }
1120
1121 // 5) cannot join these ranges
1122 return false;
1123}
1124
1127void lclJoinRanges( ListOfScRange& rList )
1128{
1129 ListOfScRange::iterator aOuterIt = rList.begin();
1130 while( aOuterIt != rList.end() )
1131 {
1132 bool bAnyErased = false; // true = any range erased from rList
1133 ListOfScRange::iterator aInnerIt = rList.begin();
1134 while( aInnerIt != rList.end() )
1135 {
1136 bool bInnerErased = false; // true = aInnerIt erased from rList
1137 // do not compare a range with itself
1138 if( (aOuterIt != aInnerIt) && lclTryJoin( *aOuterIt, *aInnerIt ) )
1139 {
1140 // aOuterIt points to joined range, aInnerIt will be removed
1141 aInnerIt = rList.erase( aInnerIt );
1142 bInnerErased = bAnyErased = true;
1143 }
1144 /* If aInnerIt has been erased from rList, it already points to
1145 the next element (return value of list::erase()). */
1146 if( !bInnerErased )
1147 ++aInnerIt;
1148 }
1149 // if any range has been erased, repeat outer loop with the same range
1150 if( !bAnyErased )
1151 ++aOuterIt;
1152 }
1153}
1154
1160void lclIntersectRanges( ListOfScRange& rList, const uno::Any& rArg )
1161{
1162 // extract the ranges from the passed argument, will throw on invalid data
1163 ListOfScRange aList2;
1164 lclAddToListOfScRange( aList2, rArg );
1165 // do nothing, if the passed list is already empty
1166 if( rList.empty() || aList2.empty() )
1167 return;
1168
1169 // save original list in a local
1170 ListOfScRange aList1;
1171 aList1.swap( rList );
1172 // join ranges from passed argument
1173 lclJoinRanges( aList2 );
1174 // calculate intersection of the ranges in both lists
1175 for( const auto& rOuterItem : aList1 )
1176 {
1177 for( const auto& rInnerItem : aList2 )
1178 {
1179 if( rOuterItem.Intersects( rInnerItem ) )
1180 {
1181 ScRange aIsectRange(
1182 std::max( rOuterItem.aStart.Col(), rInnerItem.aStart.Col() ),
1183 std::max( rOuterItem.aStart.Row(), rInnerItem.aStart.Row() ),
1184 std::max( rOuterItem.aStart.Tab(), rInnerItem.aStart.Tab() ),
1185 std::min( rOuterItem.aEnd.Col(), rInnerItem.aEnd.Col() ),
1186 std::min( rOuterItem.aEnd.Row(), rInnerItem.aEnd.Row() ),
1187 std::min( rOuterItem.aEnd.Tab(), rInnerItem.aEnd.Tab() ) );
1188 rList.push_back( aIsectRange );
1189 }
1190 }
1191 }
1192 // again, join the result ranges
1193 lclJoinRanges( rList );
1194}
1195
1200uno::Reference< excel::XRange > lclCreateVbaRange(
1201 const uno::Reference< uno::XComponentContext >& rxContext,
1202 const uno::Reference< frame::XModel >& rxModel,
1203 const ListOfScRange& rList )
1204{
1205 ScDocShell* pDocShell = excel::getDocShell( rxModel );
1206 if( !pDocShell )
1207 throw uno::RuntimeException();
1208
1209 ScRangeList aCellRanges;
1210 for( const auto& rItem : rList )
1211 aCellRanges.push_back( rItem );
1212
1213 if( aCellRanges.size() == 1 )
1214 {
1215 uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pDocShell, aCellRanges.front() ) );
1216 return new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), rxContext, xRange );
1217 }
1218 if( aCellRanges.size() > 1 )
1219 {
1220 uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) );
1221 return new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ), rxContext, xRanges );
1222 }
1223 return nullptr;
1224}
1225
1226} // namespace
1227
1228uno::Reference< excel::XRange > SAL_CALL ScVbaApplication::Intersect(
1229 const uno::Reference< excel::XRange >& rArg1, const uno::Reference< excel::XRange >& rArg2,
1230 const uno::Any& rArg3, const uno::Any& rArg4, const uno::Any& rArg5, const uno::Any& rArg6,
1231 const uno::Any& rArg7, const uno::Any& rArg8, const uno::Any& rArg9, const uno::Any& rArg10,
1232 const uno::Any& rArg11, const uno::Any& rArg12, const uno::Any& rArg13, const uno::Any& rArg14,
1233 const uno::Any& rArg15, const uno::Any& rArg16, const uno::Any& rArg17, const uno::Any& rArg18,
1234 const uno::Any& rArg19, const uno::Any& rArg20, const uno::Any& rArg21, const uno::Any& rArg22,
1235 const uno::Any& rArg23, const uno::Any& rArg24, const uno::Any& rArg25, const uno::Any& rArg26,
1236 const uno::Any& rArg27, const uno::Any& rArg28, const uno::Any& rArg29, const uno::Any& rArg30 )
1237{
1238 if( !rArg1.is() || !rArg2.is() )
1239 DebugHelper::basicexception( ERRCODE_BASIC_BAD_PARAMETER, {} );
1240
1241 // initialize the result list with 1st parameter, join its ranges together
1242 ListOfScRange aList;
1243 lclAddToListOfScRange( aList, uno::Any( rArg1 ) );
1244 lclJoinRanges( aList );
1245
1246 // process all other parameters, this updates the list with intersection
1247 lclIntersectRanges( aList, uno::Any( rArg2 ) );
1248 lclIntersectRanges( aList, rArg3 );
1249 lclIntersectRanges( aList, rArg4 );
1250 lclIntersectRanges( aList, rArg5 );
1251 lclIntersectRanges( aList, rArg6 );
1252 lclIntersectRanges( aList, rArg7 );
1253 lclIntersectRanges( aList, rArg8 );
1254 lclIntersectRanges( aList, rArg9 );
1255 lclIntersectRanges( aList, rArg10 );
1256 lclIntersectRanges( aList, rArg11 );
1257 lclIntersectRanges( aList, rArg12 );
1258 lclIntersectRanges( aList, rArg13 );
1259 lclIntersectRanges( aList, rArg14 );
1260 lclIntersectRanges( aList, rArg15 );
1261 lclIntersectRanges( aList, rArg16 );
1262 lclIntersectRanges( aList, rArg17 );
1263 lclIntersectRanges( aList, rArg18 );
1264 lclIntersectRanges( aList, rArg19 );
1265 lclIntersectRanges( aList, rArg20 );
1266 lclIntersectRanges( aList, rArg21 );
1267 lclIntersectRanges( aList, rArg22 );
1268 lclIntersectRanges( aList, rArg23 );
1269 lclIntersectRanges( aList, rArg24 );
1270 lclIntersectRanges( aList, rArg25 );
1271 lclIntersectRanges( aList, rArg26 );
1272 lclIntersectRanges( aList, rArg27 );
1273 lclIntersectRanges( aList, rArg28 );
1274 lclIntersectRanges( aList, rArg29 );
1275 lclIntersectRanges( aList, rArg30 );
1276
1277 // create the VBA Range object
1278 return lclCreateVbaRange( mxContext, getCurrentDocument(), aList );
1279}
1280
1281uno::Reference< excel::XRange > SAL_CALL ScVbaApplication::Union(
1282 const uno::Reference< excel::XRange >& rArg1, const uno::Reference< excel::XRange >& rArg2,
1283 const uno::Any& rArg3, const uno::Any& rArg4, const uno::Any& rArg5, const uno::Any& rArg6,
1284 const uno::Any& rArg7, const uno::Any& rArg8, const uno::Any& rArg9, const uno::Any& rArg10,
1285 const uno::Any& rArg11, const uno::Any& rArg12, const uno::Any& rArg13, const uno::Any& rArg14,
1286 const uno::Any& rArg15, const uno::Any& rArg16, const uno::Any& rArg17, const uno::Any& rArg18,
1287 const uno::Any& rArg19, const uno::Any& rArg20, const uno::Any& rArg21, const uno::Any& rArg22,
1288 const uno::Any& rArg23, const uno::Any& rArg24, const uno::Any& rArg25, const uno::Any& rArg26,
1289 const uno::Any& rArg27, const uno::Any& rArg28, const uno::Any& rArg29, const uno::Any& rArg30 )
1290{
1291 if( !rArg1.is() || !rArg2.is() )
1292 DebugHelper::basicexception( ERRCODE_BASIC_BAD_PARAMETER, {} );
1293
1294 ListOfScRange aList;
1295 lclAddToListOfScRange( aList, uno::Any( rArg1 ) );
1296 lclAddToListOfScRange( aList, uno::Any( rArg2 ) );
1297 lclAddToListOfScRange( aList, rArg3 );
1298 lclAddToListOfScRange( aList, rArg4 );
1299 lclAddToListOfScRange( aList, rArg5 );
1300 lclAddToListOfScRange( aList, rArg6 );
1301 lclAddToListOfScRange( aList, rArg7 );
1302 lclAddToListOfScRange( aList, rArg8 );
1303 lclAddToListOfScRange( aList, rArg9 );
1304 lclAddToListOfScRange( aList, rArg10 );
1305 lclAddToListOfScRange( aList, rArg11 );
1306 lclAddToListOfScRange( aList, rArg12 );
1307 lclAddToListOfScRange( aList, rArg13 );
1308 lclAddToListOfScRange( aList, rArg14 );
1309 lclAddToListOfScRange( aList, rArg15 );
1310 lclAddToListOfScRange( aList, rArg16 );
1311 lclAddToListOfScRange( aList, rArg17 );
1312 lclAddToListOfScRange( aList, rArg18 );
1313 lclAddToListOfScRange( aList, rArg19 );
1314 lclAddToListOfScRange( aList, rArg20 );
1315 lclAddToListOfScRange( aList, rArg21 );
1316 lclAddToListOfScRange( aList, rArg22 );
1317 lclAddToListOfScRange( aList, rArg23 );
1318 lclAddToListOfScRange( aList, rArg24 );
1319 lclAddToListOfScRange( aList, rArg25 );
1320 lclAddToListOfScRange( aList, rArg26 );
1321 lclAddToListOfScRange( aList, rArg27 );
1322 lclAddToListOfScRange( aList, rArg28 );
1323 lclAddToListOfScRange( aList, rArg29 );
1324 lclAddToListOfScRange( aList, rArg30 );
1325
1326 // simply join together all ranges as much as possible, strip out covered ranges etc.
1327 lclJoinRanges( aList );
1328
1329 // create the VBA Range object
1330 return lclCreateVbaRange( mxContext, getCurrentDocument(), aList );
1331}
1332
1333double SAL_CALL
1335{
1337}
1338
1339double SAL_CALL
1341{
1342 return o3tl::convert(Centimeters, o3tl::Length::cm, o3tl::Length::pt);
1343}
1344
1345void
1347{
1348 bool bVolatile = true;
1349 aVolatile >>= bVolatile;
1351 if ( pMeth )
1352 {
1353 uno::Reference< frame::XModel > xModel( getCurrentDocument() );
1354 if ( ScDocShell* pShell = excel::getDocShell( xModel ))
1355 {
1356 ScDocument& rDoc = pShell->GetDocument();
1357 rDoc.GetMacroManager()->SetUserFuncVolatile( pMeth->GetName(), bVolatile);
1358 }
1359 }
1360
1361// this is bound to break when loading the document
1362}
1363
1364sal_Bool SAL_CALL
1366{
1367 bool bRes = false;
1369 if ( pViewShell )
1370 {
1371 SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE);
1372 SfxAllItemSet reqList( SfxGetpApp()->GetPool() );
1373 reqList.Put( sfxFormBar );
1374
1375 pViewShell->GetState( reqList );
1376 if ( const SfxBoolItem *pItem = reqList.GetItemIfSet( FID_TOGGLEINPUTLINE, false ) )
1377 bRes = pItem->GetValue();
1378 }
1379 return bRes;
1380}
1381
1382void SAL_CALL
1384{
1386 if ( pViewShell && ( _displayformulabar != getDisplayFormulaBar() ) )
1387 {
1388 SfxAllItemSet reqList( SfxGetpApp()->GetPool() );
1389 SfxRequest aReq( FID_TOGGLEINPUTLINE, SfxCallMode::SLOT, reqList );
1390 pViewShell->Execute( aReq );
1391 }
1392}
1393
1394uno::Any SAL_CALL
1396{
1398 SbMethod* pMeth = static_cast<SbMethod*>(pBasic->GetRtl()->Find( "FuncCaller", SbxClassType::Method ));
1399 uno::Any aRet;
1400 if ( pMeth )
1401 {
1402 SbxVariableRef refTemp = pMeth;
1403 // forces a broadcast
1404 SbxVariableRef pNew = new SbxMethod( *static_cast<SbxMethod*>(pMeth));
1405 aRet = sbxToUnoValue( pNew.get() );
1406 }
1407 return aRet;
1408}
1409
1410uno::Reference< frame::XModel >
1412{
1414}
1415
1416uno::Any SAL_CALL
1418{
1419 uno::Reference< XCommandBars > xCommandBars( CommandBars( uno::Any() ), uno::UNO_QUERY_THROW );
1420 uno::Reference< XCollection > xMenuBars( new ScVbaMenuBars( this, mxContext, xCommandBars ) );
1421 if ( aIndex.hasValue() )
1422 {
1423 return xMenuBars->Item( aIndex, uno::Any() );
1424 }
1425
1426 return uno::Any( xMenuBars );
1427}
1428
1429uno::Any SAL_CALL
1431{
1432 uno::Reference< excel::XWorksheet > xWorksheet = getActiveSheet();
1433 if ( xWorksheet.is() )
1434 return uno::Any( xWorksheet->Rows( aIndex ) );
1435 return uno::Any();
1436}
1437
1438void SAL_CALL ScVbaApplication::OnKey( const OUString& Key, const uno::Any& Procedure )
1439{
1440 try
1441 {
1442 // Perhaps we can catch some excel specific
1443 // related behaviour here
1444 VbaApplicationBase::OnKey( Key, Procedure );
1445 }
1446 catch( container::NoSuchElementException& )
1447 {
1448 // #TODO special handling for unhandled
1449 // bindings
1450 }
1451}
1452
1454{
1456
1457 uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ), uno::UNO_SET_THROW );
1458
1459 ScDocShell* pDocShell = excel::getDocShell( xModel );
1460 if (!pDocShell)
1461 return;
1462 ScDocument& rDoc = pDocShell->GetDocument();
1463
1464 if( bUpdate )
1465 {
1466 // Since setting ScreenUpdating from user code might be unpaired, avoid calling function,
1467 // that asserts correct lock/unlock order and number, when not locked.
1468 if(rDoc.IsAdjustHeightLocked())
1469 rDoc.UnlockAdjustHeight();
1470 if( !rDoc.IsAdjustHeightLocked() )
1471 pDocShell->UpdateAllRowHeights();
1472 }
1473 else
1474 {
1475 rDoc.LockAdjustHeight();
1476 }
1477}
1478
1480{
1481 uno::Reference< frame::XModel > xModel( getThisExcelDoc( mxContext ), uno::UNO_SET_THROW );
1482
1484 if ( pViewShell )
1485 dispatchExecute( pViewShell, SID_UNDO );
1486}
1487
1488// XInterfaceWithIID
1489
1490OUString SAL_CALL
1492{
1493 return "{82154425-0FBF-11d4-8313-005004526AB4}";
1494}
1495
1496// XConnectable
1497
1498OUString SAL_CALL
1500{
1501 return "{82154426-0FBF-11D4-8313-005004526AB4}";
1502}
1503
1504TypeAndIID SAL_CALL
1506{
1507 TypeAndIID aResult =
1509 "{82154427-0FBF-11D4-8313-005004526AB4}"
1510 };
1511
1512 return aResult;
1513}
1514
1515uno::Reference<XConnectionPoint> SAL_CALL
1517{
1518 uno::Reference<XConnectionPoint> xCP(new ScVbaApplicationOutgoingConnectionPoint(this));
1519 return xCP;
1520}
1521
1522// XSinkCaller
1523
1524void SAL_CALL
1525ScVbaApplication::CallSinks( const OUString& Method, uno::Sequence< uno::Any >& Arguments )
1526{
1527 for (auto& i : mvSinks)
1528 {
1529 if (i.is())
1530 i->Call(Method, Arguments);
1531 }
1532}
1533
1534OUString
1536{
1537 return "ScVbaApplication";
1538}
1539
1540uno::Sequence< OUString >
1542{
1543 static uno::Sequence< OUString > aServiceNames
1544 {
1545 "ooo.vba.excel.Application"
1546 };
1547 return aServiceNames;
1548}
1549
1550
1551extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1553 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
1554{
1555 return cppu::acquire(new ScVbaApplication(context));
1556}
1557
1558
1559// ScVbaApplicationOutgoingConnectionPoint
1560
1561ScVbaApplicationOutgoingConnectionPoint::ScVbaApplicationOutgoingConnectionPoint( ScVbaApplication* pApp ) :
1562 mpApp(pApp)
1563{
1564}
1565
1566// XConnectionPoint
1567sal_uInt32 SAL_CALL
1568ScVbaApplicationOutgoingConnectionPoint::Advise( const uno::Reference< XSink >& Sink )
1569{
1570 return mpApp->AddSink(Sink);
1571}
1572
1573void SAL_CALL
1574ScVbaApplicationOutgoingConnectionPoint::Unadvise( sal_uInt32 Cookie )
1575{
1576 mpApp->RemoveSink( Cookie );
1577}
1578
1579/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOKey Key
const Any & any
constexpr OUStringLiteral sImplementationName
SfxApplication * SfxGetpApp()
virtual SbxVariable * Find(const OUString &, SbxClassType)
void SetParameters(SbxArray *p)
const OUString & GetName(SbxNameType=SbxNameType::NONE) const
void SetCol(SCCOL nColP)
Definition: address.hxx:291
SCROW Row() const
Definition: address.hxx:274
void SetRow(SCROW nRowP)
Definition: address.hxx:287
SCCOL Col() const
Definition: address.hxx:279
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
Definition: scdll.cxx:100
void SetIter(bool bVal)
Definition: docoptio.hxx:60
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void UpdateAllRowHeights(const ScMarkData *pTabMark=nullptr)
Definition: docsh5.cxx:423
SC_DLLPUBLIC ScMacroManager * GetMacroManager()
Definition: documen8.cxx:377
bool IsAdjustHeightLocked() const
Definition: document.hxx:1599
void LockAdjustHeight()
Definition: document.hxx:1600
SC_DLLPUBLIC void UnlockAdjustHeight()
Definition: document.cxx:1781
SC_DLLPUBLIC void SetUserFuncVolatile(const OUString &sName, bool isVolatile)
Definition: macromgr.cxx:164
ScRange & front()
Definition: rangelst.hxx:92
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
size_t size() const
Definition: rangelst.hxx:89
ScAddress aEnd
Definition: address.hxx:498
bool Contains(const ScAddress &) const
is Address& fully in Range?
Definition: address.hxx:718
ScAddress aStart
Definition: address.hxx:497
void Execute(SfxRequest &rReq)
Definition: tabvwsh3.cxx:172
void GetState(SfxItemSet &rSet)
Definition: tabvwsha.cxx:186
ScViewData & GetViewData()
Definition: tabview.hxx:344
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
virtual double SAL_CALL InchesToPoints(double Inches) override
virtual void SAL_CALL GoTo(const css::uno::Any &Reference, const css::uno::Any &Scroll) override
virtual css::uno::Any SAL_CALL getStatusBar() override
virtual void SAL_CALL setWindowState(const css::uno::Any &rWindowState) override
virtual double SAL_CALL CentimetersToPoints(double Centimeters) override
virtual ov::TypeAndIID SAL_CALL GetConnectionPoint() override
virtual css::uno::Any SAL_CALL getWindowState() override
virtual css::uno::Any SAL_CALL getValue(const OUString &PropertyName) override
sal_Int32 m_nDialogType
virtual OUString getServiceImplName() override
virtual OUString SAL_CALL getTemplatesPath() override
ScVbaAppSettings & mrAppSettings
virtual css::uno::Any SAL_CALL MenuBars(const css::uno::Any &aIndex) override
virtual void SAL_CALL setValue(const OUString &PropertyName, const css::uno::Any &Value) override
virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getActiveWorkbook() override
virtual OUString SAL_CALL getName() override
OUString getOfficePath(const OUString &sPath)
virtual css::uno::Any SAL_CALL Dialogs(const css::uno::Any &DialogIndex) override
virtual void SAL_CALL setCursor(::sal_Int32 _cursor) override
virtual css::uno::Any SAL_CALL getCutCopyMode() override
virtual css::uno::Any SAL_CALL Worksheets(const css::uno::Any &aIndex) override
virtual css::uno::Any SAL_CALL GetOpenFilename(const css::uno::Any &FileFilter, const css::uno::Any &FilterIndex, const css::uno::Any &Title, const css::uno::Any &ButtonText, const css::uno::Any &MultiSelect) override
std::vector< css::uno::Reference< ooo::vba::XSink > > mvSinks
virtual sal_Bool SAL_CALL getDisplayNoteIndicator() override
virtual void SAL_CALL setDisplayFormulaBar(sal_Bool _displayformulabar) override
virtual void SAL_CALL setIteration(sal_Bool bSet) override
virtual sal_Bool SAL_CALL getShowWindowsInTaskbar() override
virtual css::uno::Any SAL_CALL Windows(const css::uno::Any &aIndex) override
virtual void SAL_CALL CallSinks(const OUString &Method, css::uno::Sequence< css::uno::Any > &Arguments) override
virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getThisWorkbook() override
virtual css::uno::Any SAL_CALL getSelection() override
virtual void SAL_CALL setDisplayFullScreen(sal_Bool bSet) override
virtual css::uno::Reference< ov::excel::XWindow > SAL_CALL getActiveWindow() override
virtual OUString SAL_CALL getIID() override
virtual css::uno::Reference< ov::XAssistant > SAL_CALL getAssistant() override
virtual sal_Bool SAL_CALL getIteration() override
virtual void SAL_CALL setDisplayNoteIndicator(sal_Bool bSet) override
virtual void SAL_CALL setStatusBar(const css::uno::Any &_statusbar) override
virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) override
virtual OUString SAL_CALL getExactName(const OUString &aApproximateName) override
virtual void SAL_CALL setShowWindowsInTaskbar(sal_Bool bSet) override
virtual sal_Bool SAL_CALL getDisplayFormulaBar() override
ScVbaApplication(const css::uno::Reference< css::uno::XComponentContext > &m_xContext)
sal_uInt32 AddSink(const css::uno::Reference< ooo::vba::XSink > &xSink)
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual css::uno::Reference< ov::XConnectionPoint > SAL_CALL FindConnectionPoint() override
virtual css::uno::Any SAL_CALL FileDialog(const css::uno::Any &DialogType) override
virtual void SAL_CALL OnKey(const OUString &Key, const css::uno::Any &Procedure) override
virtual sal_Bool SAL_CALL getDisplayFullScreen() override
virtual void SAL_CALL wait(double time) override
virtual css::uno::Any SAL_CALL Names(const css::uno::Any &aIndex) override
virtual css::uno::Any SAL_CALL Range(const css::uno::Any &Cell1, const css::uno::Any &Cell2) override
virtual OUString SAL_CALL GetIIDForClassItselfNotCoclass() override
virtual css::uno::Any SAL_CALL Rows(const css::uno::Any &aIndex) override
virtual void SAL_CALL setEnableCancelKey(sal_Bool bEnable) override
virtual void SAL_CALL setDisplayAlerts(sal_Bool displayAlerts) override
virtual void SAL_CALL Undo() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getActiveCell() override
virtual css::uno::Any SAL_CALL WorksheetFunction() override
virtual sal_Bool SAL_CALL getDisplayExcel4Menus() override
virtual void SAL_CALL Calculate() override
virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() override
virtual void SAL_CALL setDefaultFilePath(const OUString &DefaultFilePath) override
css::uno::Reference< ov::excel::XFileDialog > m_xFileDialog
virtual void SAL_CALL setEnableEvents(sal_Bool bEnable) override
virtual OUString SAL_CALL getPathSeparator() override
virtual css::uno::Any SAL_CALL invoke(const OUString &FunctionName, const css::uno::Sequence< css::uno::Any > &Params, css::uno::Sequence< sal_Int16 > &OutParamIndex, css::uno::Sequence< css::uno::Any > &OutParam) override
virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override
virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection() override
virtual css::uno::Any SAL_CALL Workbooks(const css::uno::Any &aIndex) override
virtual void SAL_CALL Volatile(const css::uno::Any &Volatile) override
virtual css::uno::Any SAL_CALL International(sal_Int32 Index) override
virtual sal_Bool SAL_CALL getEnableEvents() override
static bool getDocumentEventsEnabled()
Returns true, if VBA document events are enabled.
virtual sal_Bool SAL_CALL getEnableCancelKey() override
virtual void SAL_CALL setDisplayExcel4Menus(sal_Bool bSet) override
virtual void SAL_CALL setDisplayScrollBars(sal_Bool bSet) override
virtual OUString SAL_CALL getDefaultFilePath() override
virtual sal_Bool SAL_CALL hasMethod(const OUString &Name) override
void RemoveSink(sal_uInt32 nNumber)
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union(const css::uno::Reference< ov::excel::XRange > &Arg1, const css::uno::Reference< ov::excel::XRange > &Arg2, const css::uno::Any &Arg3, const css::uno::Any &Arg4, const css::uno::Any &Arg5, const css::uno::Any &Arg6, const css::uno::Any &Arg7, const css::uno::Any &Arg8, const css::uno::Any &Arg9, const css::uno::Any &Arg10, const css::uno::Any &Arg11, const css::uno::Any &Arg12, const css::uno::Any &Arg13, const css::uno::Any &Arg14, const css::uno::Any &Arg15, const css::uno::Any &Arg16, const css::uno::Any &Arg17, const css::uno::Any &Arg18, const css::uno::Any &Arg19, const css::uno::Any &Arg20, const css::uno::Any &Arg21, const css::uno::Any &Arg22, const css::uno::Any &Arg23, const css::uno::Any &Arg24, const css::uno::Any &Arg25, const css::uno::Any &Arg26, const css::uno::Any &Arg27, const css::uno::Any &Arg28, const css::uno::Any &Arg29, const css::uno::Any &Arg30) override
virtual ~ScVbaApplication() override
virtual void SAL_CALL setCalculation(::sal_Int32 _calculation) override
virtual sal_Bool SAL_CALL getDisplayScrollBars() override
virtual OUString SAL_CALL getOperatingSystem() override
virtual void SAL_CALL setCutCopyMode(const css::uno::Any &_cutcopymode) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect(const css::uno::Reference< ov::excel::XRange > &Arg1, const css::uno::Reference< ov::excel::XRange > &Arg2, const css::uno::Any &Arg3, const css::uno::Any &Arg4, const css::uno::Any &Arg5, const css::uno::Any &Arg6, const css::uno::Any &Arg7, const css::uno::Any &Arg8, const css::uno::Any &Arg9, const css::uno::Any &Arg10, const css::uno::Any &Arg11, const css::uno::Any &Arg12, const css::uno::Any &Arg13, const css::uno::Any &Arg14, const css::uno::Any &Arg15, const css::uno::Any &Arg16, const css::uno::Any &Arg17, const css::uno::Any &Arg18, const css::uno::Any &Arg19, const css::uno::Any &Arg20, const css::uno::Any &Arg21, const css::uno::Any &Arg22, const css::uno::Any &Arg23, const css::uno::Any &Arg24, const css::uno::Any &Arg25, const css::uno::Any &Arg26, const css::uno::Any &Arg27, const css::uno::Any &Arg28, const css::uno::Any &Arg29, const css::uno::Any &Arg30) override
virtual OUString SAL_CALL getLibraryPath() override
virtual css::uno::Any SAL_CALL Evaluate(const OUString &Name) override
virtual css::uno::Any SAL_CALL Caller(const css::uno::Any &aIndex) override
virtual ::sal_Int32 SAL_CALL getCursor() override
virtual sal_Bool SAL_CALL getDisplayAlerts() override
virtual ::sal_Int32 SAL_CALL getCalculation() override
virtual sal_Bool SAL_CALL hasProperty(const OUString &Name) override
static css::uno::Reference< ov::excel::XRange > getRangeObjectForName(const css::uno::Reference< css::uno::XComponentContext > &xContext, const OUString &sRangeName, ScDocShell *pDocSh, formula::FormulaGrammar::AddressConvention eConv)
Definition: vbarange.cxx:1376
static css::uno::Reference< ov::excel::XRange > ApplicationRange(const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2)
Definition: vbarange.cxx:4266
virtual sal_Int32 SAL_CALL getType() override
static sal_Int32 getAutoShapeType(const css::uno::Reference< css::drawing::XShape > &rShape)
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1417
bool IsVScrollMode() const
Definition: viewdata.hxx:563
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
bool IsHScrollMode() const
Definition: viewdata.hxx:564
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOL GetCurX() const
Definition: viewdata.hxx:401
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1403
static bool IsFullScreen(const SfxViewShell &rViewShell)
Returns true, if the passed view shell is in full screen mode.
Definition: viewutil.cxx:331
static StarBASIC * GetBasic()
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
vcl::Window * GetWindow() const
static SbMethod * GetActiveMethod(sal_uInt16 nLevel=0)
SbxObject * GetRtl()
virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) override
virtual void SAL_CALL OnKey(const OUString &Key, const css::uno::Any &Procedure) override
css::uno::Type const & get()
T * get() const
void GrabFocus()
#define SAL_PATHDELIMITER
#define DBG_UNHANDLED_EXCEPTION(...)
URL aURL
uno::Reference< uno::XComponentContext > mxContext
std::deque< AttacherIndex_Impl > aIndex
Reference< XMultiServiceFactory > xSMgr
Sequence< OUString > aServiceNames
sal_Int32 nIndex
tools::SvRef< SvBaseLink > xSink
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Value
Reference
int i
OUString aPropName
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
ScTabViewShell * getCurrentBestViewShell(const uno::Reference< uno::XComponentContext > &xContext)
ScDocShell * getDocShell(const css::uno::Reference< css::frame::XModel > &xModel)
ScTabViewShell * getBestViewShell(const css::uno::Reference< css::frame::XModel > &xModel)
uno::Reference< XHelperInterface > getUnoSheetModuleObj(const uno::Reference< table::XCellRange > &xRange)
VBAHELPER_DLLPUBLIC css::uno::Reference< XHelperInterface > getVBADocument(const css::uno::Reference< css::frame::XModel > &xModel)
VBAHELPER_DLLPUBLIC void dispatchRequests(const css::uno::Reference< css::frame::XModel > &xModel, const OUString &aUrl)
VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisExcelDoc(const css::uno::Reference< css::uno::XComponentContext > &xContext)
VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc(const css::uno::Reference< css::uno::XComponentContext > &xContext)
VBAHELPER_DLLPUBLIC PointerStyle getPointerStyle(const css::uno::Reference< css::frame::XModel > &)
void dispatchExecute(SfxViewShell const *pViewShell, sal_uInt16 nSlot)
VBAHELPER_DLLPUBLIC void setCursorHelper(const css::uno::Reference< css::frame::XModel > &xModel, PointerStyle nPointer, bool bOverWrite)
PointerStyle
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
#define ERRCODE_BASIC_BAD_PARAMETER
#define ERRCODE_BASIC_METHOD_FAILED
Any sbxToUnoValue(const SbxValue *pVar)
#define SC_MOD()
Definition: scmod.hxx:247
Global application settings shared by all open workbooks.
bool hasValue()
Reference< XController > xController
Reference< XModel > xModel
OUString Name
unsigned char sal_Bool
sal_uInt16 sal_Unicode
Method
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
Any result
constexpr OUStringLiteral SC_UNO_FILTERED_RANGE_SELECTION
Definition: unonames.hxx:586
constexpr OUStringLiteral SC_UNO_ITERENABLED
Definition: unonames.hxx:517
static uno::Reference< util::XPathSettings > const & lcl_getPathSettingsService(const uno::Reference< uno::XComponentContext > &xContext)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_ScVbaApplication_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
cppu::ImplInheritanceHelper< VbaApplicationBase, ov::excel::XApplication, ov::XSinkCaller > ScVbaApplication_BASE
ScSplitPos
Definition: viewdata.hxx:44
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:722
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:728