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_SFX2_OBJFACE_HXX
20 #define INCLUDED_SFX2_OBJFACE_HXX
21 
22 #include <memory>
23 #include <rtl/ustring.hxx>
24 #include <sal/config.h>
25 #include <sal/types.h>
26 #include <sfx2/dllapi.h>
27 #include <sfx2/msg.hxx>
28 #include <sfx2/toolbarids.hxx>
29 
30 struct SfxInterface_Impl;
31 class  SfxModule;
32 
33 #define SFX_OBJECTBAR_APPLICATION       0
34 #define SFX_OBJECTBAR_OBJECT            1
35 #define SFX_OBJECTBAR_TOOLS             2
36 #define SFX_OBJECTBAR_MACRO             3
37 #define SFX_OBJECTBAR_FULLSCREEN        4
38 #define SFX_OBJECTBAR_RECORDING         5
39 #define SFX_OBJECTBAR_COMMONTASK        6
40 #define SFX_OBJECTBAR_OPTIONS           7
41 #define SFX_OBJECTBAR_NAVIGATION        12
42 #define SFX_OBJECTBAR_MAX               13
43 
44 enum class StatusBarId : sal_uInt32
45 {
46     None = 0,
47     GenericStatusBar = 4,
48     WriterStatusBar = 20013,
49     MathStatusBar = 20816,
50     DrawStatusBar = 23007,
51     CalcStatusBar = 26005,
52     BasicIdeStatusBar = 30805
53 };
54 
55 class SFX2_DLLPUBLIC SfxInterface final
56 {
57 friend class SfxSlotPool;
58 
59     const char*             pName;          // Sfx-internal name of interface
60     const SfxInterface*     pGenoType;      // base interface
61     SfxSlot*                pSlots;         // SlotMap
62     sal_uInt16              nCount;         // number of slots in SlotMap
63     SfxInterfaceId const    nClassId;       // Id of interface
64     bool const              bSuperClass;    // Whether children inherit its toolbars etc
65     std::unique_ptr<SfxInterface_Impl>      pImplData;
66 
67 public:
68                             SfxInterface( const char *pClass,
69                                           bool bSuperClass,
70                                           SfxInterfaceId nClassId,
71                                           const SfxInterface* pGeno,
72                                           SfxSlot &rMessages, sal_uInt16 nMsgCount );
73                             ~SfxInterface();
74 
75     void                    SetSlotMap( SfxSlot& rMessages, sal_uInt16 nMsgCount );
76     inline sal_uInt16           Count() const;
77 
78     const SfxSlot*          GetRealSlot( const SfxSlot * ) const;
79     const SfxSlot*  GetSlot( sal_uInt16 nSlotId ) const;
80     const SfxSlot*          GetSlot( const OUString& rCommand ) const;
81 
GetClassName() const82     const char*             GetClassName() const { return pName; }
UseAsSuperClass() const83     bool                    UseAsSuperClass() const { return bSuperClass; }
84 
GetGenoType() const85     const SfxInterface*     GetGenoType() const { return pGenoType; }
86 
87     void                    RegisterObjectBar(sal_uInt16, SfxVisibilityFlags nFlags, ToolbarId eId);
88     void                    RegisterObjectBar(sal_uInt16, SfxVisibilityFlags nFlags, ToolbarId eId, SfxShellFeature nFeature);
89     void                    RegisterChildWindow(sal_uInt16, bool bContext = false);
90     void                    RegisterChildWindow(sal_uInt16, bool bContext, SfxShellFeature nFeature);
91     void                    RegisterStatusBar(StatusBarId eId);
92     ToolbarId               GetObjectBarId(sal_uInt16 nNo) const;
93     sal_uInt16              GetObjectBarPos( sal_uInt16 nNo ) const;
94     SfxVisibilityFlags      GetObjectBarFlags( sal_uInt16 nNo ) const;
95     SfxShellFeature         GetObjectBarFeature(sal_uInt16 nNo) const;
96     sal_uInt16              GetObjectBarCount() const;
97     bool                    IsObjectBarVisible( sal_uInt16 nNo) const;
98     SfxShellFeature         GetChildWindowFeature(sal_uInt16 nNo) const;
99     sal_uInt32              GetChildWindowId( sal_uInt16 nNo ) const;
100     sal_uInt16              GetChildWindowCount() const;
101     void                    RegisterPopupMenu( const OUString& );
102     const OUString&         GetPopupMenuName() const;
103     StatusBarId             GetStatusBarId() const;
104 
105     void                    Register( SfxModule* );
106 
ContainsSlot_Impl(const SfxSlot * pSlot) const107     SAL_DLLPRIVATE bool     ContainsSlot_Impl( const SfxSlot *pSlot ) const
108                             { return pSlot >= pSlots && pSlot < pSlots + Count(); }
109 };
110 
111 
112 // returns the number of functions in this cluster
113 
Count() const114 inline sal_uInt16 SfxInterface::Count() const
115 {
116     return nCount;
117 }
118 
119 #endif
120 
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
122