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_COMMANDBAR_HXX 24 #define SC_VBA_COMMANDBAR_HXX 25 26 #include <ooo/vba/XCommandBar.hpp> 27 #include <com/sun/star/ui/XUIConfigurationManager.hpp> 28 #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> 29 #include <com/sun/star/container/XIndexContainer.hpp> 30 #include <com/sun/star/beans/PropertyValues.hpp> 31 32 #include <vbahelper/vbahelperinterface.hxx> 33 #include "vbacommandbarhelper.hxx" 34 35 #include <map> 36 37 typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE; 38 39 class ScVbaCommandBar : public CommandBar_BASE 40 { 41 private: 42 VbaCommandBarHelperRef pCBarHelper; 43 css::uno::Reference< css::container::XIndexAccess > m_xBarSettings; 44 rtl::OUString m_sResourceUrl; 45 sal_Bool m_bIsMenu; 46 sal_Bool m_bTemporary; 47 48 public: 49 ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary = sal_True ) throw( css::uno::RuntimeException ); 50 IsMenu()51 sal_Bool IsMenu() { return m_bIsMenu; } 52 53 // Attributes 54 virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); 55 virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException); 56 virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); 57 virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); 58 virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); 59 virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException); 60 61 // Methods 62 virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 63 virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 64 virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 65 virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 66 67 // XHelperInterface 68 virtual rtl::OUString& getServiceImplName(); 69 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 70 }; 71 72 /** Dummy command bar implementation. Does nothing but provide its name. */ 73 class VbaDummyCommandBar : public CommandBar_BASE 74 { 75 public: 76 VbaDummyCommandBar( 77 const css::uno::Reference< ov::XHelperInterface > xParent, 78 const css::uno::Reference< css::uno::XComponentContext > xContext, 79 const ::rtl::OUString& rName, 80 sal_Int32 nType ) throw( css::uno::RuntimeException ); 81 82 // Attributes 83 virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); 84 virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException); 85 virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); 86 virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); 87 virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); 88 virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException); 89 90 // Methods 91 virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 92 virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 93 virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 94 virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 95 96 // XHelperInterface 97 virtual rtl::OUString& getServiceImplName(); 98 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 99 100 private: 101 ::rtl::OUString maName; 102 sal_Int32 mnType; 103 }; 104 105 #endif//SC_VBA_COMMANDBAR_HXX 106