/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ #include <vbahelper/vbaglobalbase.hxx> #include <sal/macros.h>
// special key to return the Application constchar sAppService[] = "ooo.vba.Application";
constexpr OUString gsApplication( u"Application"_ustr );
VbaGlobalsBase::VbaGlobalsBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const OUString& sDocCtxName )
: Globals_BASE( xParent, xContext )
, msDocCtxName( sDocCtxName )
{ // overwrite context with custom one ( that contains the application ) // wrap the service manager as we don't want the disposing context to tear down the 'normal' ServiceManager ( or at least that's what the code appears like it wants to do )
uno::Reference< uno::XInterface > aSrvMgr; if ( xContext.is() && xContext->getServiceManager().is() )
{
aSrvMgr = xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.comp.stoc.OServiceManagerWrapper"_ustr , xContext );
}
::cppu::ContextEntry_Init aHandlerContextInfo[] =
{
::cppu::ContextEntry_Init( gsApplication, uno::Any() ),
::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ),
::cppu::ContextEntry_Init( u"/singletons/com.sun.star.lang.theServiceManager"_ustr , uno::Any( aSrvMgr ) )
}; // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and // some strange behavior
mxContext = ::cppu::createComponentContext(
aHandlerContextInfo,
SAL_N_ELEMENTS( aHandlerContextInfo ), nullptr ); if ( !aSrvMgr.is() ) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.