LibreOffice Module framework (master) 1
menuconfiguration.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
23#include <utility>
24
25namespace com::sun::star::container { class XIndexAccess; }
27namespace com::sun::star::io { class XInputStream; }
28namespace com::sun::star::io { class XOutputStream; }
29namespace com::sun::star::uno { class XComponentContext; }
30
31namespace framework
32{
33
35{
36private:
37 oslInterlockedCount refCount;
38
39 MenuAttributes(OUString sFrame, OUString sImageIdStr)
40 : refCount(0)
41 , aTargetFrame(std::move(sFrame))
42 , aImageId(std::move(sImageIdStr))
43 {
44 }
45
46 MenuAttributes(css::uno::WeakReference<css::frame::XDispatchProvider> _xDispatchProvider)
47 : refCount(0)
48 , xDispatchProvider(std::move(_xDispatchProvider))
49 {
50 }
51
53
54public:
55 OUString aTargetFrame;
56 OUString aImageId;
57 css::uno::WeakReference<css::frame::XDispatchProvider> xDispatchProvider;
58
59 static void* CreateAttribute(const OUString& rFrame, const OUString& rImageIdStr);
60 static void* CreateAttribute(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider);
61 static void ReleaseAttribute(void* nAttributePtr);
62
63 void acquire()
64 {
65 osl_atomic_increment(&refCount);
66 }
67
68 void release()
69 {
70 if (!osl_atomic_decrement(&refCount))
71 delete this;
72 }
73};
74
76{
77public:
79 // use const when giving a UNO reference by reference
80 css::uno::Reference< css::uno::XComponentContext > rxContext );
81
83
86 css::uno::Reference< css::container::XIndexAccess > CreateMenuBarConfigurationFromXML(
87 css::uno::Reference< css::io::XInputStream > const & rInputStream );
88
92 css::uno::Reference< css::container::XIndexAccess > const & rMenuBarConfiguration,
93 css::uno::Reference< css::io::XOutputStream > const & rOutputStream,
94 bool bIsMenuBar );
95
96private:
97 css::uno::Reference< css::uno::XComponentContext> m_xContext;
98};
99
100}
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sFrame
void StoreMenuBarConfigurationToXML(css::uno::Reference< css::container::XIndexAccess > const &rMenuBarConfiguration, css::uno::Reference< css::io::XOutputStream > const &rOutputStream, bool bIsMenuBar)
MenuConfiguration(css::uno::Reference< css::uno::XComponentContext > rxContext)
css::uno::Reference< css::container::XIndexAccess > CreateMenuBarConfigurationFromXML(css::uno::Reference< css::io::XInputStream > const &rInputStream)
css::uno::Reference< css::uno::XComponentContext > m_xContext
Reference< XInputStream > rInputStream
search a dispatcher for given URL @descr If no interceptor is set on owner, we search for right frame...
MenuAttributes(OUString sFrame, OUString sImageIdStr)
oslInterlockedCount refCount
static void ReleaseAttribute(void *nAttributePtr)
MenuAttributes(const MenuAttributes &)=delete
css::uno::WeakReference< css::frame::XDispatchProvider > xDispatchProvider
MenuAttributes(css::uno::WeakReference< css::frame::XDispatchProvider > _xDispatchProvider)
static void * CreateAttribute(const OUString &rFrame, const OUString &rImageIdStr)