Remove exec bits on odt file
[LibreOffice.git] / framework / inc / menuconfiguration.hxx
blob9389ed3e3986cd5f106e0e05e80d99a176b4e422
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <cppuhelper/weakref.hxx>
23 #include <utility>
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; }
31 namespace framework
34 struct MenuAttributes
36 private:
37 oslInterlockedCount refCount;
39 MenuAttributes(OUString sFrame, OUString sImageIdStr)
40 : refCount(0)
41 , aTargetFrame(std::move(sFrame))
42 , aImageId(std::move(sImageIdStr))
46 MenuAttributes(css::uno::WeakReference<css::frame::XDispatchProvider> _xDispatchProvider)
47 : refCount(0)
48 , xDispatchProvider(std::move(_xDispatchProvider))
52 MenuAttributes(const MenuAttributes&) = delete;
54 public:
55 OUString aTargetFrame;
56 OUString aImageId;
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);
63 void acquire()
65 osl_atomic_increment(&refCount);
68 void release()
70 if (!osl_atomic_decrement(&refCount))
71 delete this;
75 class MenuConfiguration final
77 public:
78 MenuConfiguration(
79 // use const when giving a UNO reference by reference
80 css::uno::Reference< css::uno::XComponentContext > rxContext );
82 ~MenuConfiguration();
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,
94 bool bIsMenuBar );
96 private:
97 css::uno::Reference< css::uno::XComponentContext> m_xContext;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */