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_COMMANDBARCONTROLS_HXX
24cdf0e10cSrcweir #define SC_VBA_COMMANDBARCONTROLS_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <ooo/vba/XCommandBarControls.hpp>
27cdf0e10cSrcweir #include <com/sun/star/awt/XMenu.hpp>
28cdf0e10cSrcweir #include <vbahelper/vbahelperinterface.hxx>
29cdf0e10cSrcweir #include <vbahelper/vbacollectionimpl.hxx>
30cdf0e10cSrcweir #include "vbacommandbarhelper.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class ScVbaCommandBarControls : public CommandBarControls_BASE
35cdf0e10cSrcweir {
36cdf0e10cSrcweir private:
37cdf0e10cSrcweir     VbaCommandBarHelperRef                              pCBarHelper;
38cdf0e10cSrcweir     css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
39cdf0e10cSrcweir     rtl::OUString                                       m_sResourceUrl;
40cdf0e10cSrcweir     sal_Bool                                            m_bIsMenu;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL,
43cdf0e10cSrcweir                                                                         const rtl::OUString& sHelpURL,
44cdf0e10cSrcweir                                                                         const rtl::OUString& sLabel,
45cdf0e10cSrcweir                                                                         sal_uInt16 nType,
46cdf0e10cSrcweir                                                                         const css::uno::Any& aSubMenu,
47cdf0e10cSrcweir                                                                         sal_Bool isVisible,
48cdf0e10cSrcweir                                                                         sal_Bool isEnabled );
49cdf0e10cSrcweir     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 );
50cdf0e10cSrcweir 
51cdf0e10cSrcweir public:
52cdf0e10cSrcweir     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()53cdf0e10cSrcweir     sal_Bool IsMenu(){ return m_bIsMenu; }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     // XEnumerationAccess
56cdf0e10cSrcweir     virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
57cdf0e10cSrcweir     virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
58cdf0e10cSrcweir     virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     // Methods
61cdf0e10cSrcweir     virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
62cdf0e10cSrcweir     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);
63cdf0e10cSrcweir     // XHelperInterface
64cdf0e10cSrcweir     virtual rtl::OUString& getServiceImplName();
65cdf0e10cSrcweir     virtual css::uno::Sequence<rtl::OUString> getServiceNames();
66cdf0e10cSrcweir };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir class VbaDummyCommandBarControls : public CommandBarControls_BASE
69cdf0e10cSrcweir {
70cdf0e10cSrcweir public:
71cdf0e10cSrcweir     VbaDummyCommandBarControls(
72cdf0e10cSrcweir         const css::uno::Reference< ov::XHelperInterface >& xParent,
73cdf0e10cSrcweir         const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw( css::uno::RuntimeException );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     // XEnumerationAccess
76cdf0e10cSrcweir     virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
77cdf0e10cSrcweir     virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
78cdf0e10cSrcweir     virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     // Methods
81cdf0e10cSrcweir     virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
82cdf0e10cSrcweir     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);
83cdf0e10cSrcweir     // XHelperInterface
84cdf0e10cSrcweir     virtual rtl::OUString& getServiceImplName();
85cdf0e10cSrcweir     virtual css::uno::Sequence<rtl::OUString> getServiceNames();
86cdf0e10cSrcweir };
87cdf0e10cSrcweir 
88cdf0e10cSrcweir #endif//SC_VBA_COMMANDBARCONTROLS_HXX
89