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 _SFXOBJFACE_HXX
20 #define _SFXOBJFACE_HXX
22 #include "sal/config.h"
24 #include "rtl/ustring.hxx"
25 #include "sfx2/dllapi.h"
26 #include "sal/types.h"
27 #include <tools/string.hxx>
28 #include <tools/resid.hxx>
30 #include <sfx2/msg.hxx>
32 struct SfxFormalArgument
;
33 struct SfxInterface_Impl
;
38 class SFX2_DLLPUBLIC SfxInterface
40 friend class SfxSlotPool
;
42 const char* pName
; // Sfx-internal name of interface
43 const SfxInterface
* pGenoType
; // base interface
44 SfxSlot
* pSlots
; // SlotMap
45 sal_uInt16 nCount
; // number of slots in SlotMap
46 SfxInterfaceId nClassId
; // Id of interface
47 ResId aNameResId
; // ResId of external interface name
48 SfxInterface_Impl
* pImpData
;
50 SfxSlot
* operator[]( sal_uInt16 nPos
) const;
53 SfxInterface( const char *pClass
,
55 SfxInterfaceId nClassId
,
56 const SfxInterface
* pGeno
,
57 SfxSlot
&rMessages
, sal_uInt16 nMsgCount
);
58 virtual ~SfxInterface();
60 void SetSlotMap( SfxSlot
& rMessages
, sal_uInt16 nMsgCount
);
61 inline sal_uInt16
Count() const;
63 const SfxSlot
* GetRealSlot( const SfxSlot
* ) const;
64 const SfxSlot
* GetRealSlot( sal_uInt16 nSlotId
) const;
65 virtual const SfxSlot
* GetSlot( sal_uInt16 nSlotId
) const;
66 const SfxSlot
* GetSlot( const String
& rCommand
) const;
68 const char* GetClassName() const { return pName
; }
69 bool HasName() const { return 0 != aNameResId
.GetId(); }
70 OUString
GetName() const
71 { return HasName() ? aNameResId
.toString() : OUString(); }
72 ResMgr
* GetResMgr() const
73 { return aNameResId
.GetResMgr(); }
75 const SfxInterface
* GetGenoType() const { return pGenoType
; }
76 const SfxInterface
* GetRealInterfaceForSlot( const SfxSlot
* ) const;
78 void RegisterObjectBar( sal_uInt16
, const ResId
&, const String
* pST
=0 );
79 void RegisterObjectBar( sal_uInt16
, const ResId
&, sal_uInt32 nFeature
, const String
* pST
=0 );
80 void RegisterChildWindow( sal_uInt16
, sal_Bool bContext
, const String
* pST
=0 );
81 void RegisterChildWindow( sal_uInt16
, sal_Bool bContext
, sal_uInt32 nFeature
, const String
* pST
=0 );
82 void RegisterStatusBar( const ResId
& );
83 const ResId
& GetObjectBarResId( sal_uInt16 nNo
) const;
84 sal_uInt16
GetObjectBarPos( sal_uInt16 nNo
) const;
85 sal_uInt32
GetObjectBarFeature( sal_uInt16 nNo
) const;
86 sal_uInt16
GetObjectBarCount() const;
87 void SetObjectBarPos( sal_uInt16 nPos
, sal_uInt16 nId
);
88 const String
* GetObjectBarName( sal_uInt16 nNo
) const;
89 sal_Bool
IsObjectBarVisible( sal_uInt16 nNo
) const;
90 sal_uInt32
GetChildWindowFeature( sal_uInt16 nNo
) const;
91 sal_uInt32
GetChildWindowId( sal_uInt16 nNo
) const;
92 sal_uInt16
GetChildWindowCount() const;
93 void RegisterPopupMenu( const ResId
& );
94 const ResId
& GetPopupMenuResId() const;
95 const ResId
& GetStatusBarResId() const;
97 void Register( SfxModule
* );
99 SAL_DLLPRIVATE
int ContainsSlot_Impl( const SfxSlot
*pSlot
) const
100 { return pSlot
>= pSlots
&& pSlot
< pSlots
+ Count(); }
101 SAL_DLLPRIVATE ResMgr
* GetResManager_Impl() const
102 { return aNameResId
.GetResMgr(); }
105 //--------------------------------------------------------------------
107 // returns the number of functions in this cluster
109 inline sal_uInt16
SfxInterface::Count() const
114 //--------------------------------------------------------------------
116 // returns a function by position in the array
118 inline SfxSlot
* SfxInterface::operator[]( sal_uInt16 nPos
) const
120 return nPos
< nCount
? pSlots
+nPos
: 0;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */