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