/* -*- 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 .
*/
uno::Any
ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
{ // aSource should be a name at this time, because of the class is API wrapper.
OUString sResourceUrl;
uno::Reference< container::XIndexAccess > xBarSettings;
OUString sBarName; bool bMenu = false;
uno::Any aRet;
if( aSource >>= sBarName )
{ // some built-in command bars if( m_pCBarHelper->getModuleId() == "com.sun.star.sheet.SpreadsheetDocument" )
{ if( sBarName.equalsIgnoreAsciiCase( "Worksheet Menu Bar" ) )
{ // spreadsheet menu bar
sResourceUrl = ITEM_MENUBAR_URL;
bMenu = true;
} elseif( sBarName.equalsIgnoreAsciiCase( "Cell" ) )
{ // EVIL HACK (tm): spreadsheet cell context menu as dummy object without functionality
aRet <<= uno::Reference< XCommandBar >( new VbaDummyCommandBar( this, mxContext, sBarName ) );
}
} elseif( m_pCBarHelper->getModuleId() == "com.sun.star.text.TextDocument" )
{ if( sBarName.equalsIgnoreAsciiCase( "Menu Bar" ) )
{ // text processor menu bar
sResourceUrl = ITEM_MENUBAR_URL;
bMenu = true;
}
}
// nothing found - try to resolve from name if( !aRet.hasValue() && sResourceUrl.isEmpty() )
{
sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sBarName );
bMenu = false;
}
}
if( !aRet.hasValue() ) throw uno::RuntimeException( u"Toolbar do not exist"_ustr );
return aRet;
}
// XCommandBars
uno::Reference< XCommandBar > SAL_CALL
ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Position*/, const css::uno::Any& /*MenuBar*/, const css::uno::Any& /*Temporary*/ )
{ // FIXME: only support to add Toolbar // Position - MsoBar MenuBar - sal_Bool // Currently only the Name is supported.
OUString sName; if( Name.hasValue() )
Name >>= sName;
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.