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 .
22 #include <cppuhelper/weakref.hxx>
25 namespace com::sun::star::container
{ class XIndexAccess
; }
26 namespace com::sun::star::frame
{ class XDispatchProvider
; }
27 namespace com::sun::star::io
{ class XInputStream
; }
28 namespace com::sun::star::io
{ class XOutputStream
; }
29 namespace com::sun::star::uno
{ class XComponentContext
; }
37 oslInterlockedCount refCount
;
39 MenuAttributes(OUString sFrame
, OUString sImageIdStr
)
41 , aTargetFrame(std::move(sFrame
))
42 , aImageId(std::move(sImageIdStr
))
46 MenuAttributes(css::uno::WeakReference
<css::frame::XDispatchProvider
> _xDispatchProvider
)
48 , xDispatchProvider(std::move(_xDispatchProvider
))
52 MenuAttributes(const MenuAttributes
&) = delete;
55 OUString aTargetFrame
;
57 css::uno::WeakReference
<css::frame::XDispatchProvider
> xDispatchProvider
;
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
);
65 osl_atomic_increment(&refCount
);
70 if (!osl_atomic_decrement(&refCount
))
75 class MenuConfiguration final
79 // use const when giving a UNO reference by reference
80 css::uno::Reference
< css::uno::XComponentContext
> rxContext
);
84 /// @throws css::lang::WrappedTargetException
85 /// @throws css::uno::RuntimeException
86 css::uno::Reference
< css::container::XIndexAccess
> CreateMenuBarConfigurationFromXML(
87 css::uno::Reference
< css::io::XInputStream
> const & rInputStream
);
89 /// @throws css::lang::WrappedTargetException
90 /// @throws css::uno::RuntimeException
91 void StoreMenuBarConfigurationToXML(
92 css::uno::Reference
< css::container::XIndexAccess
> const & rMenuBarConfiguration
,
93 css::uno::Reference
< css::io::XOutputStream
> const & rOutputStream
,
97 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */