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 .
19 #ifndef INCLUDED_SFX2_OBJFACE_HXX
20 #define INCLUDED_SFX2_OBJFACE_HXX
22 #include <rtl/ustring.hxx>
23 #include <sal/config.h>
24 #include <sal/types.h>
25 #include <sfx2/dllapi.h>
26 #include <sfx2/msg.hxx>
27 #include <tools/resid.hxx>
29 struct SfxInterface_Impl
;
34 class SFX2_DLLPUBLIC SfxInterface
36 friend class SfxSlotPool
;
38 const char* pName
; // Sfx-internal name of interface
39 const SfxInterface
* pGenoType
; // base interface
40 SfxSlot
* pSlots
; // SlotMap
41 sal_uInt16 nCount
; // number of slots in SlotMap
42 SfxInterfaceId nClassId
; // Id of interface
43 bool bSuperClass
; // Whether children inherit its toolbars etc
44 SfxInterface_Impl
* pImpData
;
46 SfxSlot
* operator[]( sal_uInt16 nPos
) const;
49 SfxInterface( const char *pClass
,
51 SfxInterfaceId nClassId
,
52 const SfxInterface
* pGeno
,
53 SfxSlot
&rMessages
, sal_uInt16 nMsgCount
);
54 virtual ~SfxInterface();
56 void SetSlotMap( SfxSlot
& rMessages
, sal_uInt16 nMsgCount
);
57 inline sal_uInt16
Count() const;
59 const SfxSlot
* GetRealSlot( const SfxSlot
* ) const;
60 const SfxSlot
* GetRealSlot( sal_uInt16 nSlotId
) const;
61 const SfxSlot
* GetSlot( sal_uInt16 nSlotId
) const;
62 const SfxSlot
* GetSlot( const OUString
& rCommand
) const;
64 const char* GetClassName() const { return pName
; }
65 bool UseAsSuperClass() const { return bSuperClass
; }
67 const SfxInterface
* GetGenoType() const { return pGenoType
; }
69 void RegisterObjectBar(sal_uInt16
, sal_uInt32 nResId
);
70 void RegisterObjectBar(sal_uInt16
, sal_uInt32 nResId
, sal_uInt32 nFeature
);
71 void RegisterChildWindow(sal_uInt16
, bool bContext
= false);
72 void RegisterChildWindow(sal_uInt16
, bool bContext
, sal_uInt32 nFeature
);
73 void RegisterStatusBar( const ResId
& );
74 sal_uInt32
GetObjectBarId(sal_uInt16 nNo
) const;
75 sal_uInt16
GetObjectBarPos( sal_uInt16 nNo
) const;
76 sal_uInt32
GetObjectBarFeature( sal_uInt16 nNo
) const;
77 sal_uInt16
GetObjectBarCount() const;
78 void SetObjectBarPos( sal_uInt16 nPos
, sal_uInt16 nId
);
79 bool IsObjectBarVisible( sal_uInt16 nNo
) const;
80 sal_uInt32
GetChildWindowFeature( sal_uInt16 nNo
) const;
81 sal_uInt32
GetChildWindowId( sal_uInt16 nNo
) const;
82 sal_uInt16
GetChildWindowCount() const;
83 void RegisterPopupMenu( const ResId
& );
84 const ResId
& GetPopupMenuResId() const;
85 const ResId
& GetStatusBarResId() const;
87 void Register( SfxModule
* );
89 SAL_DLLPRIVATE
bool ContainsSlot_Impl( const SfxSlot
*pSlot
) const
90 { return pSlot
>= pSlots
&& pSlot
< pSlots
+ Count(); }
95 // returns the number of functions in this cluster
97 inline sal_uInt16
SfxInterface::Count() const
104 // returns a function by position in the array
106 inline SfxSlot
* SfxInterface::operator[]( sal_uInt16 nPos
) const
108 return nPos
< nCount
? pSlots
+nPos
: 0;
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */