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