Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBARCONTROLS_HXX
20 : #define INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBARCONTROLS_HXX
21 :
22 : #include <ooo/vba/XCommandBarControls.hpp>
23 : #include <com/sun/star/awt/XMenu.hpp>
24 : #include <vbahelper/vbahelperinterface.hxx>
25 : #include <vbahelper/vbacollectionimpl.hxx>
26 : #include "vbacommandbarhelper.hxx"
27 :
28 : typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE;
29 :
30 0 : class ScVbaCommandBarControls : public CommandBarControls_BASE
31 : {
32 : private:
33 : VbaCommandBarHelperRef pCBarHelper;
34 : css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
35 : OUString m_sResourceUrl;
36 : bool m_bIsMenu;
37 :
38 : static css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const OUString& sCommandURL,
39 : const OUString& sHelpURL,
40 : const OUString& sLabel,
41 : sal_uInt16 nType,
42 : const css::uno::Any& aSubMenu,
43 : bool isVisible,
44 : bool isEnabled );
45 : static css::uno::Sequence< css::beans::PropertyValue > CreateToolbarItemData( const OUString& sCommandURL, const OUString& sHelpURL, const OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu, bool isVisible, sal_Int32 nStyle );
46 :
47 : public:
48 : 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 OUString& sResourceUrl ) throw( css::uno::RuntimeException );
49 0 : bool IsMenu(){ return m_bIsMenu; }
50 :
51 : // XEnumerationAccess
52 : virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) SAL_OVERRIDE;
53 : virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) SAL_OVERRIDE;
54 : virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) SAL_OVERRIDE;
55 :
56 : // Methods
57 : virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException) SAL_OVERRIDE;
58 : 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, std::exception) SAL_OVERRIDE;
59 : // XHelperInterface
60 : virtual OUString getServiceImplName() SAL_OVERRIDE;
61 : virtual css::uno::Sequence<OUString> getServiceNames() SAL_OVERRIDE;
62 : };
63 :
64 0 : class VbaDummyCommandBarControls : public CommandBarControls_BASE
65 : {
66 : public:
67 : VbaDummyCommandBarControls(
68 : const css::uno::Reference< ov::XHelperInterface >& xParent,
69 : const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw( css::uno::RuntimeException );
70 :
71 : // XEnumerationAccess
72 : virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) SAL_OVERRIDE;
73 : virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) SAL_OVERRIDE;
74 : virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) SAL_OVERRIDE;
75 :
76 : // Methods
77 : virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException) SAL_OVERRIDE;
78 : 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, std::exception) SAL_OVERRIDE;
79 : // XHelperInterface
80 : virtual OUString getServiceImplName() SAL_OVERRIDE;
81 : virtual css::uno::Sequence<OUString> getServiceNames() SAL_OVERRIDE;
82 : };
83 :
84 : #endif // INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBARCONTROLS_HXX
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|