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 __FRAMEWORK_UIELEMENT_UICOMMANDDESCRPTION_HXX_
21 #define __FRAMEWORK_UIELEMENT_UICOMMANDDESCRPTION_HXX_
23 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
24 with solaris headers ...
28 #include <boost/unordered_map.hpp>
30 #include <threadhelp/threadhelpbase.hxx>
31 #include <macros/generic.hxx>
32 #include <macros/xinterface.hxx>
33 #include <macros/xtypeprovider.hxx>
34 #include <macros/xserviceinfo.hxx>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XTypeProvider.hpp>
39 #include <com/sun/star/configuration/theDefaultProvider.hpp>
40 #include <com/sun/star/container/XNameAccess.hpp>
41 #include <com/sun/star/frame/XModuleManager2.hpp>
43 #include <cppuhelper/implbase2.hxx>
44 #include <rtl/ustring.hxx>
48 class UICommandDescription
: private ThreadHelpBase
, // Struct for right initalization of mutex member! Must be first of baseclasses.
49 public ::cppu::WeakImplHelper2
< com::sun::star::lang::XServiceInfo
,
50 com::sun::star::container::XNameAccess
>
53 UICommandDescription( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
54 virtual ~UICommandDescription();
56 // XInterface, XTypeProvider, XServiceInfo
60 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
61 throw ( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
63 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
64 throw (::com::sun::star::uno::RuntimeException
);
66 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
67 throw (::com::sun::star::uno::RuntimeException
);
70 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
71 throw (::com::sun::star::uno::RuntimeException
);
72 virtual sal_Bool SAL_CALL
hasElements()
73 throw (::com::sun::star::uno::RuntimeException
);
76 typedef ::boost::unordered_map
< OUString
,
79 ::std::equal_to
< OUString
> > ModuleToCommandFileMap
;
81 typedef ::boost::unordered_map
< OUString
,
82 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>,
84 ::std::equal_to
< OUString
> > UICommandsHashMap
;
87 UICommandDescription( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
, bool );
88 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> impl_createConfigAccess(const OUString
& _sName
);
89 void impl_fillElements(const sal_Char
* _pName
);
90 sal_Bool m_bConfigRead
;
91 OUString m_aPrivateResourceURL
;
92 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
93 ModuleToCommandFileMap m_aModuleToCommandFileMap
;
94 UICommandsHashMap m_aUICommandsHashMap
;
95 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xGenericUICommands
;
96 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModuleManager2
> m_xModuleManager
;
99 } // namespace framework
101 #endif // __FRAMEWORK_SERVICES_UICOMMANDDESCRPTION_HXX_
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */