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>
61 #include <osl/file.hxx>
79 #include <unonames.hxx>
93 using ::com::sun::star::uno::Reference;
94 using ::com::sun::star::uno::UNO_QUERY_THROW;
95 using ::com::sun::star::uno::UNO_QUERY;
110 mbDisplayAlerts( true ),
111 mbEnableEvents( true ),
112 mbExcel4Menus(
false ),
113 mbDisplayNoteIndicator( true ),
114 mbShowWindowsInTaskbar( true ),
115 mbEnableCancelKey(
false )
127 class ScVbaApplicationOutgoingConnectionPoint :
public cppu::WeakImplHelper<XConnectionPoint>
136 sal_uInt32 SAL_CALL Advise(
const uno::Reference< XSink >& Sink )
override;
137 void SAL_CALL Unadvise( sal_uInt32 Cookie )
override;
150 SC_MOD()->RegisterAutomationApplicationEventsCaller( uno::Reference< XSinkCaller >(
this) );
158 if (nNumber < 1 || nNumber >
mvSinks.size())
161 mvSinks[nNumber-1] = uno::Reference< XSink >();
166 mrAppSettings( ScVbaStaticAppSettings() ),
177 return ScVbaStaticAppSettings().mbEnableEvents;
184 return xWSF->getExactName( aApproximateName );
187 uno::Reference< beans::XIntrospectionAccess > SAL_CALL
191 return xWSF->getIntrospection();
195 ScVbaApplication::invoke(
const OUString& FunctionName,
const uno::Sequence< uno::Any >& Params, uno::Sequence< sal_Int16 >& OutParamIndex, uno::Sequence< uno::Any >& OutParam)
203 aAny = xWSF->invoke( FunctionName, Params, OutParamIndex, OutParam );
205 catch (
const uno::Exception&)
207 aAny <<= script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), 1000, OUString() );
216 xWSF->setValue( PropertyName, Value );
223 return xWSF->getValue( PropertyName );
230 return xWSF->hasMethod( Name );
237 return xWSF->hasProperty( Name );
240 uno::Reference< excel::XWorkbook >
244 uno::Reference< excel::XWorkbook > xWorkbook(
getVBADocument( xModel ), uno::UNO_QUERY );
245 if( xWorkbook.is() )
return xWorkbook;
250 uno::Reference< excel::XWorkbook > SAL_CALL
254 uno::Reference< excel::XWorkbook > xWorkbook(
getVBADocument( xModel ), uno::UNO_QUERY );
255 if( xWorkbook.is() )
return xWorkbook;
260 uno::Reference< XAssistant > SAL_CALL
271 Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), UNO_QUERY_THROW );
274 uno::Any aOldVal = xPropSet->getPropertyValue( aPropName );
277 xPropSet->setPropertyValue( aPropName, any );
278 uno::Reference<uno::XInterface> aSelection(xSelSupp->getSelection(), uno::UNO_QUERY);
279 xPropSet->setPropertyValue( aPropName, aOldVal );
281 if (!aSelection.is())
283 throw uno::RuntimeException(
"failed to obtain current selection" );
286 uno::Reference< lang::XServiceInfo > xServiceInfo( aSelection, uno::UNO_QUERY_THROW );
289 if( sImplementationName.equalsIgnoreAsciiCase(
"com.sun.star.drawing.SvxShapeCollection") )
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 );
298 if ( nType == office::MsoShapeType::msoAutoShape )
307 uno::Reference< lang::XServiceInfo > xShapeServiceInfo( xShape, uno::UNO_QUERY_THROW );
308 if ( xShapeServiceInfo->supportsService(
"com.sun.star.drawing.Text") )
310 return uno::Any( uno::Reference< msforms::XTextBoxShape >(
314 else if ( nType == office::MsoShapeType::msoLine )
317 mxContext, xShape, xShapes, xModel ) ) );
321 else if( xServiceInfo->supportsService(
"com.sun.star.sheet.SheetCellRange") ||
322 xServiceInfo->supportsService(
"com.sun.star.sheet.SheetCellRanges") )
324 uno::Reference< table::XCellRange > xRange( aSelection, ::uno::UNO_QUERY);
327 uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aSelection, ::uno::UNO_QUERY);
336 throw uno::RuntimeException( sImplementationName +
" not supported" );
340 uno::Reference< excel::XRange >
343 uno::Reference< sheet::XSpreadsheetView > xView(
getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
344 uno::Reference< table::XCellRange > xRange( xView->getActiveSheet(), ::uno::UNO_QUERY_THROW);
347 throw uno::RuntimeException(
"No ViewShell available" );
348 ScViewData& rTabView = pViewShell->GetViewData();
350 sal_Int32 nCursorX = rTabView.
GetCurX();
351 sal_Int32 nCursorY = rTabView.
GetCurY();
361 uno::Reference<excel::XFileDialog> xDialog(
new ScVbaFileDialog(
this,
mxContext, office::MsoFileDialogType::msoFileDialogFilePicker));
362 xDialog->setTitle(aTitle);
363 xDialog->setAllowMultiSelect(aMultiSelect);
365 bool bMultiSelect =
false;
366 aMultiSelect >>= bMultiSelect;
368 if (xDialog->Show() == 0)
374 uno::Reference<excel::XFileDialogSelectedItems> xItems = xDialog->getSelectedItems();
379 throw uno::RuntimeException(
"Unexpected XFileDialogSelectedItems implementation");
381 auto const & rItemVector = pItems->getItems();
386 if (!rItemVector.empty())
387 aPath = rItemVector.at(0);
410 DialogType >>=
nType;
424 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
430 return xWorkBooks->Item( aIndex,
uno::Any() );
436 uno::Reference< excel::XWorkbook > xWorkbook(
getActiveWorkbook(), uno::UNO_SET_THROW );
437 return xWorkbook->Worksheets( aIndex );
462 return xDialogs->Item( aIndex );
465 uno::Reference< excel::XWindow > SAL_CALL
469 uno::Reference< frame::XController >
xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
470 uno::Reference< XHelperInterface > xParent(
getActiveWorkbook(), uno::UNO_QUERY_THROW );
493 return uno::Any( !getDisplayStatusBar() );
510 bool bDefault =
false;
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 )
516 setDisplayStatusBar(
true );
517 if ( !sText.isEmpty() )
518 xStatusIndicator->start( sText, 100 );
520 xStatusIndicator->end();
522 else if( _statusbar >>= bDefault )
526 xStatusIndicator->end();
527 setDisplayStatusBar(
true );
531 throw uno::RuntimeException(
"Invalid parameter. It should be a string or False" );
538 uno::Reference<sheet::XCalculatable> xCalc(
getCurrentDocument(), uno::UNO_QUERY_THROW);
539 if(xCalc->isAutomaticCalculationEnabled())
540 return excel::XlCalculation::xlCalculationAutomatic;
542 return excel::XlCalculation::xlCalculationManual;
549 uno::Reference< sheet::XCalculatable > xCalc(
getCurrentDocument(), uno::UNO_QUERY_THROW);
552 case excel::XlCalculation::xlCalculationManual:
553 xCalc->enableAutomaticCalculation(
false);
555 case excel::XlCalculation::xlCalculationAutomatic:
556 case excel::XlCalculation::xlCalculationSemiautomatic:
557 xCalc->enableAutomaticCalculation(
true);
566 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
568 return xWindows->Item( aIndex,
uno::Any() );
577 aArgs->
Put(aRef.
get(), 1);
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 );
604 css::uno::Reference< excel::XNames > xNames (
new ScVbaNames(
this ,
mxContext , xNamedRanges , xModel ) );
605 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
609 return xNames->Item( aIndex,
uno::Any() );
612 uno::Reference< excel::XWorksheet > SAL_CALL
615 uno::Reference< excel::XWorksheet >
result;
617 if ( xWorkbook.is() )
619 uno::Reference< excel::XWorksheet > xWorksheet =
620 xWorkbook->getActiveSheet();
621 if ( xWorksheet.is() )
630 throw uno::RuntimeException(
"No activeSheet available" );
650 bool bScroll =
false;
655 bool aScroll =
false;
656 if( !(Scroll >>= aScroll) )
657 throw uno::RuntimeException(
"second parameter should be boolean" );
664 if( Reference >>= sRangeName )
667 uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
668 xModel->getCurrentController(), uno::UNO_QUERY_THROW );
679 xVbaSheetRange->Select();
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) ) );
692 xVbaSheetRange->Select();
696 catch (
const uno::RuntimeException&)
704 throw uno::RuntimeException(
"invalid reference for range name, it should be procedure name" );
708 uno::Reference< excel::XRange > xRange;
709 if( Reference >>= xRange )
711 uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY );
714 if ( xVbaRange.is() )
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) ) );
738 throw uno::RuntimeException(
"invalid reference or name" );
746 switch( nPointerStyle )
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;
757 return excel::XlMousePointer::xlDefault;
769 case excel::XlMousePointer::xlNorthwestArrow:
774 case excel::XlMousePointer::xlWait:
775 case excel::XlMousePointer::xlIBeam:
777 PointerStyle nPointer( static_cast< PointerStyle >( _cursor ) );
782 case excel::XlMousePointer::xlDefault:
788 throw uno::RuntimeException(
"Unknown value for Cursor pointer" );
793 catch (
const uno::Exception&)
804 return "Microsoft Excel";
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 ) );
928 return SC_MOD()->GetDocOptions().IsIter();
934 uno::Reference< lang::XMultiComponentFactory >
xSMgr(
935 mxContext->getServiceManager(), uno::UNO_SET_THROW );
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() )
942 uno::Reference< lang::XServiceInfo > xServiceInfo( xComponents->nextElement(), uno::UNO_QUERY );
943 if ( xServiceInfo.is() && xServiceInfo->supportsService(
"com.sun.star.sheet.SpreadsheetDocument" ) )
945 uno::Reference< beans::XPropertySet > xProps( xServiceInfo, uno::UNO_QUERY );
952 SC_MOD()->SetDocOptions( aOpts );
959 uno::Reference< sheet::XCalculatable > xCalculatable(
getCurrentDocument(), uno::UNO_QUERY_THROW );
960 xCalculatable->calculateAll();
966 static uno::Reference< util::XPathSettings > xPathSettings( util::PathSettings::create( xContext ) );
967 return xPathSettings;
977 xProps->getPropertyValue( _sPathType ) >>= sUrl;
980 sal_Int32
nIndex = sUrl.lastIndexOf(
';' ) ;
982 sUrl = sUrl.copy( nIndex + 1 );
983 ::osl::File::getSystemPathFromFileURL( sUrl, sRetPath );
985 catch (
const uno::Exception&)
997 osl::FileBase::getFileURLFromSystemPath( DefaultFilePath, aURL );
998 xProps->setWork( aURL );
1032 #elif defined(MACOSX)
1038 return OUString(
"Unknown");
1046 typedef ::std::list< ScRange > ListOfScRange;
1053 void lclAddToListOfScRange( ListOfScRange& rList,
const uno::Any& rArg )
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 )
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 );
1066 rList.push_back( aScRange );
1095 if( (n1T == n2T) && (n1B == n2B) )
1098 if( ((n1L < n2L) && (n2L - 1 <= n1R)) || ((n2L < n1L) && (n1L - 1 <= n2R)) )
1108 if( (n1L == n2L) && (n1R == n2R) )
1111 if( ((n1T < n2T) && (n2T + 1 <= n1B)) || ((n2T < n1T) && (n1T + 1 <= n2B)) )
1126 void lclJoinRanges( ListOfScRange& rList )
1128 ListOfScRange::iterator aOuterIt = rList.begin();
1129 while( aOuterIt != rList.end() )
1131 bool bAnyErased =
false;
1132 ListOfScRange::iterator aInnerIt = rList.begin();
1133 while( aInnerIt != rList.end() )
1135 bool bInnerErased =
false;
1137 if( (aOuterIt != aInnerIt) && lclTryJoin( *aOuterIt, *aInnerIt ) )
1140 aInnerIt = rList.erase( aInnerIt );
1141 bInnerErased = bAnyErased =
true;
1159 void lclIntersectRanges( ListOfScRange& rList,
const uno::Any& rArg )
1162 ListOfScRange aList2;
1163 lclAddToListOfScRange( aList2, rArg );
1165 if( rList.empty() || aList2.empty() )
1169 ListOfScRange aList1;
1170 aList1.swap( rList );
1172 lclJoinRanges( aList2 );
1174 for(
const auto& rOuterItem : aList1 )
1176 for(
const auto& rInnerItem : aList2 )
1178 if( rOuterItem.Intersects( rInnerItem ) )
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 );
1192 lclJoinRanges( rList );
1199 uno::Reference< excel::XRange > lclCreateVbaRange(
1200 const uno::Reference< uno::XComponentContext >& rxContext,
1201 const uno::Reference< frame::XModel >& rxModel,
1202 const ListOfScRange& rList )
1205 if( !pDocShell )
throw uno::RuntimeException();
1208 for(
const auto& rItem : rList )
1211 if( aCellRanges.
size() == 1 )
1213 uno::Reference< table::XCellRange > xRange(
new ScCellRangeObj( pDocShell, aCellRanges.
front() ) );
1216 if( aCellRanges.
size() > 1 )
1218 uno::Reference< sheet::XSheetCellRangeContainer > xRanges(
new ScCellRangesObj( pDocShell, aCellRanges ) );
1227 const uno::Reference< excel::XRange >& rArg1,
const uno::Reference< excel::XRange >& rArg2,
1236 if( !rArg1.is() || !rArg2.is() )
1240 ListOfScRange aList;
1241 lclAddToListOfScRange( aList,
uno::Any( rArg1 ) );
1242 lclJoinRanges( aList );
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 );
1280 const uno::Reference< excel::XRange >& rArg1,
const uno::Reference< excel::XRange >& rArg2,
1289 if( !rArg1.is() || !rArg2.is() )
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 );
1325 lclJoinRanges( aList );
1334 double result = Inches * 72.0;
1341 bool bVolatile =
true;
1342 aVolatile >>= bVolatile;
1363 reqList.
Put( sfxFormBar );
1367 bRes = pItem->GetValue();
1379 SfxRequest aReq( FID_TOGGLEINPUTLINE, SfxCallMode::SLOT, reqList );
1400 uno::Reference< frame::XModel >
1409 uno::Reference< XCommandBars > xCommandBars( CommandBars(
uno::Any() ), uno::UNO_QUERY_THROW );
1413 return xMenuBars->Item( aIndex,
uno::Any() );
1422 uno::Reference< excel::XWorksheet > xWorksheet =
getActiveSheet();
1423 if ( xWorksheet.is() )
1424 return uno::Any( xWorksheet->Rows( aIndex ) );
1436 catch( container::NoSuchElementException& )
1480 return "{82154425-0FBF-11d4-8313-005004526AB4}";
1488 return "{82154426-0FBF-11D4-8313-005004526AB4}";
1494 TypeAndIID aResult =
1495 { excel::XApplicationOutgoing::static_type(),
1496 "{82154427-0FBF-11D4-8313-005004526AB4}"
1502 uno::Reference<XConnectionPoint> SAL_CALL
1505 uno::Reference<XConnectionPoint> xCP(
new ScVbaApplicationOutgoingConnectionPoint(
this));
1517 i->Call(Method, Arguments);
1524 return "ScVbaApplication";
1527 uno::Sequence< OUString >
1532 "ooo.vba.excel.Application"
1538 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1540 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
1548 ScVbaApplicationOutgoingConnectionPoint::ScVbaApplicationOutgoingConnectionPoint(
ScVbaApplication* pApp ) :
1555 ScVbaApplicationOutgoingConnectionPoint::Advise(
const uno::Reference< XSink >& Sink )
1557 return mpApp->AddSink(Sink);
1561 ScVbaApplicationOutgoingConnectionPoint::Unadvise( sal_uInt32 Cookie )
1563 mpApp->RemoveSink( Cookie );
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
bool mbDisplayNoteIndicator
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
virtual ::sal_Int32 SAL_CALL getCalculation() override
ScVSplitPos WhichV(ScSplitPos ePos)
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)
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)
virtual sal_Bool SAL_CALL getEnableCancelKey() override
#define SC_UNO_ITERENABLED
bool mbShowWindowsInTaskbar
virtual css::uno::Any SAL_CALL Evaluate(const OUString &Name) override
bool IsVScrollMode() const
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)
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
ScHSplitPos WhichH(ScSplitPos ePos)
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
ScSplitPos GetActivePart() const
virtual OUString SAL_CALL getTemplatesPath() override
static bool IsFullScreen(const SfxViewShell &rViewShell)
Returns true, if the passed view shell is in full screen mode.
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
virtual double SAL_CALL InchesToPoints(double InchesToPoints) override
virtual OUString SAL_CALL getPathSeparator() override
bool IsAdjustHeightLocked() const
virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) override
virtual css::uno::Any SAL_CALL Workbooks(const css::uno::Any &aIndex) override
void UpdateAllRowHeights(const ScMarkData *pTabMark=nullptr)
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
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.
virtual void SAL_CALL setDefaultFilePath(const OUString &DefaultFilePath) override
void push_back(const ScRange &rRange)
virtual css::uno::Any SAL_CALL WorksheetFunction() override
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
ScViewData & GetViewData()
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
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
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
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)
virtual OUString SAL_CALL GetIIDForClassItselfNotCoclass() override
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
virtual css::uno::Any SAL_CALL getWindowState() override
sal_uInt32 AddSink(const css::uno::Reference< ooo::vba::XSink > &xSink)
SC_DLLPUBLIC void UnlockAdjustHeight()
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
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)
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)
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
virtual void SAL_CALL OnKey(const OUString &Key, const css::uno::Any &Procedure) override
SC_DLLPUBLIC ScMacroManager * GetMacroManager()
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)
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 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
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?
#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
uno::Reference< frame::XModel > getCurrentExcelDoc(const uno::Reference< uno::XComponentContext > &xContext)
vcl::Window * GetWindow() const
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)
virtual css::uno::Any SAL_CALL getValue(const OUString &PropertyName) override
#define SC_UNO_FILTERED_RANGE_SELECTION
Reference< XModel > xModel
virtual OUString getServiceImplName() override
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
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
bool m_bDetectedRangeSegmentation false
OUString getOfficePath(const OUString &sPath)