1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef SC_VBA_COMMANDBARCONTROLS_HXX 24 #define SC_VBA_COMMANDBARCONTROLS_HXX 25 26 #include <ooo/vba/XCommandBarControls.hpp> 27 #include <com/sun/star/awt/XMenu.hpp> 28 #include <vbahelper/vbahelperinterface.hxx> 29 #include <vbahelper/vbacollectionimpl.hxx> 30 #include "vbacommandbarhelper.hxx" 31 32 typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE; 33 34 class ScVbaCommandBarControls : public CommandBarControls_BASE 35 { 36 private: 37 VbaCommandBarHelperRef pCBarHelper; 38 css::uno::Reference< css::container::XIndexAccess > m_xBarSettings; 39 rtl::OUString m_sResourceUrl; 40 sal_Bool m_bIsMenu; 41 42 css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL, 43 const rtl::OUString& sHelpURL, 44 const rtl::OUString& sLabel, 45 sal_uInt16 nType, 46 const css::uno::Any& aSubMenu, 47 sal_Bool isVisible, 48 sal_Bool isEnabled ); 49 css::uno::Sequence< css::beans::PropertyValue > CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle ); 50 51 public: 52 ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw( css::uno::RuntimeException ); IsMenu()53 sal_Bool IsMenu(){ return m_bIsMenu; } 54 55 // XEnumerationAccess 56 virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); 57 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); 58 virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 59 60 // Methods 61 virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException); 62 virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 63 // XHelperInterface 64 virtual rtl::OUString& getServiceImplName(); 65 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 66 }; 67 68 class VbaDummyCommandBarControls : public CommandBarControls_BASE 69 { 70 public: 71 VbaDummyCommandBarControls( 72 const css::uno::Reference< ov::XHelperInterface >& xParent, 73 const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw( css::uno::RuntimeException ); 74 75 // XEnumerationAccess 76 virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); 77 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); 78 virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 79 80 // Methods 81 virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException); 82 virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 83 // XHelperInterface 84 virtual rtl::OUString& getServiceImplName(); 85 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 86 }; 87 88 #endif//SC_VBA_COMMANDBARCONTROLS_HXX 89