1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_UICOMMANDDESCRIPTION_HXX
21 #define INCLUDED_FRAMEWORK_INC_UIELEMENT_UICOMMANDDESCRIPTION_HXX
23 #include <unordered_map>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/container/XNameAccess.hpp>
27 #include <com/sun/star/frame/XModuleManager2.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <cppuhelper/basemutex.hxx>
31 #include <cppuhelper/compbase2.hxx>
32 #include <cppuhelper/supportsservice.hxx>
33 #include <rtl/ustring.hxx>
37 typedef ::cppu::WeakComponentImplHelper2
< com::sun::star::lang::XServiceInfo
,
38 com::sun::star::container::XNameAccess
> UICommandDescription_BASE
;
40 class UICommandDescription
: private cppu::BaseMutex
,
41 public UICommandDescription_BASE
44 UICommandDescription( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
45 virtual ~UICommandDescription();
47 virtual OUString SAL_CALL
getImplementationName()
48 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
50 return OUString("com.sun.star.comp.framework.UICommandDescription");
53 virtual sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
)
54 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
56 return cppu::supportsService(this, ServiceName
);
59 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
60 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
62 css::uno::Sequence
< OUString
> aSeq(1);
63 aSeq
[0] = "com.sun.star.frame.UICommandDescription";
69 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
70 throw ( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
72 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
73 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
76 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
80 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
81 virtual sal_Bool SAL_CALL
hasElements()
82 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 typedef std::unordered_map
< OUString
,
88 std::equal_to
< OUString
> > ModuleToCommandFileMap
;
90 typedef std::unordered_map
< OUString
,
91 css::uno::Reference
< css::container::XNameAccess
>,
93 std::equal_to
< OUString
> > UICommandsHashMap
;
96 UICommandDescription( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
, bool );
97 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> impl_createConfigAccess(const OUString
& _sName
);
98 void impl_fillElements(const sal_Char
* _pName
);
100 OUString m_aPrivateResourceURL
;
101 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
102 ModuleToCommandFileMap m_aModuleToCommandFileMap
;
103 UICommandsHashMap m_aUICommandsHashMap
;
104 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xGenericUICommands
;
105 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModuleManager2
> m_xModuleManager
;
108 } // namespace framework
110 #endif // __FRAMEWORK_SERVICES_UICOMMANDDESCRPTION_HXX_
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */