LibreOffice Module framework (master) 1
uicommanddescription.hxx
Go to the documentation of this file.
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
20#pragma once
21
22#include <unordered_map>
23#include <map>
24#include <com/sun/star/lang/XServiceInfo.hpp>
25#include <com/sun/star/container/XNameAccess.hpp>
26#include <com/sun/star/frame/XModuleManager2.hpp>
27#include <com/sun/star/uno/XComponentContext.hpp>
28
31#include <rtl/ustring.hxx>
33
34namespace framework
35{
36typedef comphelper::WeakComponentImplHelper< css::lang::XServiceInfo,
37 css::container::XNameAccess > UICommandDescription_BASE;
38
40{
41 public:
42 UICommandDescription( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
43 virtual ~UICommandDescription() override;
44
45 virtual OUString SAL_CALL getImplementationName() override
46 {
47 return "com.sun.star.comp.framework.UICommandDescription";
48 }
49
50 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override
51 {
53 }
54
55 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
56 {
57 css::uno::Sequence< OUString > aSeq { "com.sun.star.frame.UICommandDescription" };
58 return aSeq;
59 }
60
61private:
62 // XNameAccess
63 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
64
65 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
66
67 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
68
69 // XElementAccess
70 virtual css::uno::Type SAL_CALL getElementType() override;
71 virtual sal_Bool SAL_CALL hasElements() override;
72
73public:
74 typedef std::unordered_map< OUString,
76
77 typedef std::unordered_map< OUString,
78 css::uno::Reference< css::container::XNameAccess > > UICommandsHashMap;
79
80 protected:
81 UICommandDescription( const css::uno::Reference< css::uno::XComponentContext>& rxContext, bool );
82 void impl_fillElements(const char* _pName);
84
86 css::uno::Reference< css::uno::XComponentContext > m_xContext;
88 std::map<LanguageTag, UICommandsHashMap> m_aUICommandsHashMap;
89 std::map<LanguageTag, css::uno::Reference< css::container::XNameAccess > > m_xGenericUICommands;
90 css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager;
91};
92
93} // namespace framework
94
95/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Type SAL_CALL getElementType() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
UICommandDescription(const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool)
css::uno::Reference< css::uno::XComponentContext > m_xContext
std::unordered_map< OUString, OUString > ModuleToCommandFileMap
virtual sal_Bool SAL_CALL hasElements() override
ModuleToCommandFileMap m_aModuleToCommandFileMap
UICommandDescription(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
std::unordered_map< OUString, css::uno::Reference< css::container::XNameAccess > > UICommandsHashMap
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
std::map< LanguageTag, css::uno::Reference< css::container::XNameAccess > > m_xGenericUICommands
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void impl_fillElements(const char *_pName)
std::map< LanguageTag, UICommandsHashMap > m_aUICommandsHashMap
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
void ensureGenericUICommandsForLanguage(const LanguageTag &rLanguage)
Sequence< sal_Int8 > aSeq
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
comphelper::WeakComponentImplHelper< css::lang::XServiceInfo, css::container::XNameAccess > UICommandDescription_BASE
unsigned char sal_Bool