1*d4a7ee09SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*d4a7ee09SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d4a7ee09SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d4a7ee09SAndrew Rist * distributed with this work for additional information 6*d4a7ee09SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d4a7ee09SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d4a7ee09SAndrew Rist * "License"); you may not use this file except in compliance 9*d4a7ee09SAndrew Rist * with the License. You may obtain a copy of the License at 10*d4a7ee09SAndrew Rist * 11*d4a7ee09SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d4a7ee09SAndrew Rist * 13*d4a7ee09SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d4a7ee09SAndrew Rist * software distributed under the License is distributed on an 15*d4a7ee09SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d4a7ee09SAndrew Rist * KIND, either express or implied. See the License for the 17*d4a7ee09SAndrew Rist * specific language governing permissions and limitations 18*d4a7ee09SAndrew Rist * under the License. 19*d4a7ee09SAndrew Rist * 20*d4a7ee09SAndrew Rist *************************************************************/ 21*d4a7ee09SAndrew Rist 22*d4a7ee09SAndrew Rist 23cdf0e10cSrcweir #ifndef SC_VBA_COMMANDBAR_HXX 24cdf0e10cSrcweir #define SC_VBA_COMMANDBAR_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <ooo/vba/XCommandBar.hpp> 27cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfigurationManager.hpp> 28cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> 29cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp> 30cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <vbahelper/vbahelperinterface.hxx> 33cdf0e10cSrcweir #include "vbacommandbarhelper.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <map> 36cdf0e10cSrcweir 37cdf0e10cSrcweir typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE; 38cdf0e10cSrcweir 39cdf0e10cSrcweir class ScVbaCommandBar : public CommandBar_BASE 40cdf0e10cSrcweir { 41cdf0e10cSrcweir private: 42cdf0e10cSrcweir VbaCommandBarHelperRef pCBarHelper; 43cdf0e10cSrcweir css::uno::Reference< css::container::XIndexAccess > m_xBarSettings; 44cdf0e10cSrcweir rtl::OUString m_sResourceUrl; 45cdf0e10cSrcweir sal_Bool m_bIsMenu; 46cdf0e10cSrcweir sal_Bool m_bTemporary; 47cdf0e10cSrcweir 48cdf0e10cSrcweir public: 49cdf0e10cSrcweir 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 ); 50cdf0e10cSrcweir IsMenu()51cdf0e10cSrcweir sal_Bool IsMenu() { return m_bIsMenu; } 52cdf0e10cSrcweir 53cdf0e10cSrcweir // Attributes 54cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); 55cdf0e10cSrcweir virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException); 56cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); 57cdf0e10cSrcweir virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); 58cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); 59cdf0e10cSrcweir virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException); 60cdf0e10cSrcweir 61cdf0e10cSrcweir // Methods 62cdf0e10cSrcweir virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 63cdf0e10cSrcweir virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 64cdf0e10cSrcweir virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 65cdf0e10cSrcweir 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); 66cdf0e10cSrcweir 67cdf0e10cSrcweir // XHelperInterface 68cdf0e10cSrcweir virtual rtl::OUString& getServiceImplName(); 69cdf0e10cSrcweir virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir 72cdf0e10cSrcweir /** Dummy command bar implementation. Does nothing but provide its name. */ 73cdf0e10cSrcweir class VbaDummyCommandBar : public CommandBar_BASE 74cdf0e10cSrcweir { 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir VbaDummyCommandBar( 77cdf0e10cSrcweir const css::uno::Reference< ov::XHelperInterface > xParent, 78cdf0e10cSrcweir const css::uno::Reference< css::uno::XComponentContext > xContext, 79cdf0e10cSrcweir const ::rtl::OUString& rName, 80cdf0e10cSrcweir sal_Int32 nType ) throw( css::uno::RuntimeException ); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // Attributes 83cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); 84cdf0e10cSrcweir virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException); 85cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); 86cdf0e10cSrcweir virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); 87cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); 88cdf0e10cSrcweir virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException); 89cdf0e10cSrcweir 90cdf0e10cSrcweir // Methods 91cdf0e10cSrcweir virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 92cdf0e10cSrcweir virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 93cdf0e10cSrcweir virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); 94cdf0e10cSrcweir 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); 95cdf0e10cSrcweir 96cdf0e10cSrcweir // XHelperInterface 97cdf0e10cSrcweir virtual rtl::OUString& getServiceImplName(); 98cdf0e10cSrcweir virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 99cdf0e10cSrcweir 100cdf0e10cSrcweir private: 101cdf0e10cSrcweir ::rtl::OUString maName; 102cdf0e10cSrcweir sal_Int32 mnType; 103cdf0e10cSrcweir }; 104cdf0e10cSrcweir 105cdf0e10cSrcweir #endif//SC_VBA_COMMANDBAR_HXX 106