bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / framework / menuconfiguration.hxx
blob191b0e72371300ed860362443c07a31f072facfb
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 #ifndef INCLUDED_FRAMEWORK_MENUCONFIGURATION_HXX
21 #define INCLUDED_FRAMEWORK_MENUCONFIGURATION_HXX
23 #include <framework/fwedllapi.h>
25 #include <cppuhelper/weakref.hxx>
27 namespace com::sun::star::container { class XIndexAccess; }
28 namespace com::sun::star::frame { class XDispatchProvider; }
29 namespace com::sun::star::io { class XInputStream; }
30 namespace com::sun::star::io { class XOutputStream; }
31 namespace com::sun::star::uno { class XComponentContext; }
33 const sal_uInt16 START_ITEMID_WINDOWLIST = 4600;
34 const sal_uInt16 END_ITEMID_WINDOWLIST = 4699;
35 const sal_uInt16 ITEMID_ADDONLIST = 6678; // used to be a SID in sfx2, now just a unique id...
37 namespace framework
40 struct FWE_DLLPUBLIC MenuAttributes
42 private:
43 oslInterlockedCount refCount;
45 MenuAttributes(const OUString& rFrame, const OUString& rImageIdStr)
46 : refCount(0)
47 , aTargetFrame(rFrame)
48 , aImageId(rImageIdStr)
52 MenuAttributes(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider)
53 : refCount(0)
54 , xDispatchProvider(rDispatchProvider)
58 MenuAttributes(const MenuAttributes&) = delete;
60 public:
61 OUString aTargetFrame;
62 OUString aImageId;
63 css::uno::WeakReference<css::frame::XDispatchProvider> xDispatchProvider;
65 static void* CreateAttribute(const OUString& rFrame, const OUString& rImageIdStr);
66 static void* CreateAttribute(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider);
67 static void ReleaseAttribute(void* nAttributePtr);
69 void acquire()
71 osl_atomic_increment(&refCount);
74 void release()
76 if (!osl_atomic_decrement(&refCount))
77 delete this;
81 class FWE_DLLPUBLIC MenuConfiguration final
83 public:
84 MenuConfiguration(
85 // use const when giving a uno reference by reference
86 const css::uno::Reference< css::uno::XComponentContext >& rxContext );
88 ~MenuConfiguration();
90 /// @throws css::lang::WrappedTargetException
91 /// @throws css::uno::RuntimeException
92 css::uno::Reference< css::container::XIndexAccess > CreateMenuBarConfigurationFromXML(
93 css::uno::Reference< css::io::XInputStream > const & rInputStream );
95 /// @throws css::lang::WrappedTargetException
96 /// @throws css::uno::RuntimeException
97 void StoreMenuBarConfigurationToXML(
98 css::uno::Reference< css::container::XIndexAccess > const & rMenuBarConfiguration,
99 css::uno::Reference< css::io::XOutputStream > const & rOutputStream,
100 bool bIsMenuBar );
102 private:
103 css::uno::Reference< css::uno::XComponentContext> m_xContext;
108 #endif // INCLUDED_FRAMEWORK_MENUCONFIGURATION_HXX
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */