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 #ifndef INCLUDED_UNOTOOLS_CMDOPTIONS_HXX
20 #define INCLUDED_UNOTOOLS_CMDOPTIONS_HXX
21 
22 #include <unotools/unotoolsdllapi.h>
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
25 #include <unotools/options.hxx>
26 #include <memory>
27 
28 namespace com { namespace sun { namespace star { namespace uno { template <typename > class Reference; } } } }
29 
30 namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
31 namespace osl { class Mutex; }
32 
33 /*-************************************************************************************************************
34     @descr          The method GetList() returns a list of property values.
35                     Use follow defines to separate values by names.
36 *//*-*************************************************************************************************************/
37 
38 /*-************************************************************************************************************
39     @short          forward declaration to our private date container implementation
40     @descr          We use these class as internal member to support small memory requirements.
41                     You can create the container if it is necessary. The class which use these mechanism
42                     is faster and smaller then a complete implementation!
43 *//*-*************************************************************************************************************/
44 
45 class SvtCommandOptions_Impl;
46 
47 /*-************************************************************************************************************
48     @short          collect information about dynamic menus
49     @descr          Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
50     @devstatus      ready to use
51 *//*-*************************************************************************************************************/
52 
53 class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtCommandOptions final : public utl::detail::Options
54 {
55     friend class SvtCommandOptions_Impl;
56 
57     public:
58 
59         enum CmdOption
60         {
61             CMDOPTION_DISABLED,
62             CMDOPTION_NONE
63         };
64 
65          SvtCommandOptions();
66         virtual ~SvtCommandOptions() override;
67 
68         /*-****************************************************************************************************
69             @short      return complete specified list
70             @descr      Call it to get all entries of an dynamic menu.
71                         We return a list of all nodes with its names and properties.
72             @param      "eOption" select the list to retrieve.
73             @return     A list of command strings is returned.
74 
75             @onerror    We return an empty list.
76         *//*-*****************************************************************************************************/
77 
78         bool HasEntries( CmdOption eOption ) const;
79 
80         /*-****************************************************************************************************
81             @short      Lookup if a command URL is inside a given list
82             @descr      Lookup if a command URL is inside a given lst
83             @param      "eOption" select right command list
84             @param      "aCommandURL" a command URL that is used for the look up
85             @return     "sal_True" if the command is inside the list otherwise "sal_False"
86         *//*-*****************************************************************************************************/
87 
88         bool Lookup( CmdOption eOption, const OUString& aCommandURL ) const;
89 
90         /*-****************************************************************************************************
91             @short      register an office frame, which must update its dispatches if
92                         the underlying configuration was changed.
93 
94             @descr      To avoid using of "dead" frame objects or implementing
95                         deregistration mechanism too, we use weak references to
96                         the given frames.
97 
98             @param      "xFrame"            points to the frame, which wishes to be
99                                             notified, if configuration was changed.
100         *//*-*****************************************************************************************************/
101 
102         void EstablishFrameCallback(const css::uno::Reference< css::frame::XFrame >& xFrame);
103 
104     private:
105 
106         /*-****************************************************************************************************
107             @short      return a reference to a static mutex
108             @descr      These class is partially threadsafe (for de-/initialization only).
109                         All access methods aren't safe!
110                         We create a static mutex only for one ime and use at different times.
111             @return     A reference to a static mutex member.
112         *//*-*****************************************************************************************************/
113 
114         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
115 
116     private:
117         std::shared_ptr<SvtCommandOptions_Impl>  m_pImpl;
118 
119 };      // class SvtCmdOptions
120 
121 #endif // INCLUDED_UNOTOOLS_CMDOPTIONS_HXX
122 
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
124