Line data Source code
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 <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>
28 :
29 : struct SfxInterface_Impl;
30 : class SfxConfigItem;
31 : class SfxModule;
32 : class SvStream;
33 :
34 : class SFX2_DLLPUBLIC SfxInterface
35 : {
36 : friend class SfxSlotPool;
37 :
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 : ResId aNameResId; // ResId of external interface name
44 : SfxInterface_Impl* pImpData;
45 :
46 : SfxSlot* operator[]( sal_uInt16 nPos ) const;
47 :
48 : public:
49 : SfxInterface( const char *pClass,
50 : const ResId& rResId,
51 : SfxInterfaceId nClassId,
52 : const SfxInterface* pGeno,
53 : SfxSlot &rMessages, sal_uInt16 nMsgCount );
54 : virtual ~SfxInterface();
55 :
56 : void SetSlotMap( SfxSlot& rMessages, sal_uInt16 nMsgCount );
57 : inline sal_uInt16 Count() const;
58 :
59 : const SfxSlot* GetRealSlot( const SfxSlot * ) const;
60 : const SfxSlot* GetRealSlot( sal_uInt16 nSlotId ) const;
61 : virtual const SfxSlot* GetSlot( sal_uInt16 nSlotId ) const;
62 : const SfxSlot* GetSlot( const OUString& rCommand ) const;
63 :
64 : const char* GetClassName() const { return pName; }
65 191025 : bool HasName() const { return 0 != aNameResId.GetId(); }
66 : OUString GetName() const
67 : { return HasName() ? aNameResId.toString() : OUString(); }
68 0 : ResMgr* GetResMgr() const
69 0 : { return aNameResId.GetResMgr(); }
70 :
71 1688 : const SfxInterface* GetGenoType() const { return pGenoType; }
72 :
73 : void RegisterObjectBar( sal_uInt16, const ResId&, const OUString* pST=0 );
74 : void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const OUString* pST=0 );
75 : void RegisterChildWindow( sal_uInt16, bool bContext = false, const OUString* pST=0 );
76 : void RegisterChildWindow( sal_uInt16, bool bContext, sal_uInt32 nFeature, const OUString* pST=0 );
77 : void RegisterStatusBar( const ResId& );
78 : const ResId& GetObjectBarResId( sal_uInt16 nNo ) const;
79 : sal_uInt16 GetObjectBarPos( sal_uInt16 nNo ) const;
80 : sal_uInt32 GetObjectBarFeature( sal_uInt16 nNo ) const;
81 : sal_uInt16 GetObjectBarCount() const;
82 : void SetObjectBarPos( sal_uInt16 nPos, sal_uInt16 nId );
83 : const OUString* GetObjectBarName( sal_uInt16 nNo ) const;
84 : bool IsObjectBarVisible( sal_uInt16 nNo) const;
85 : sal_uInt32 GetChildWindowFeature( sal_uInt16 nNo ) const;
86 : sal_uInt32 GetChildWindowId( sal_uInt16 nNo ) const;
87 : sal_uInt16 GetChildWindowCount() const;
88 : void RegisterPopupMenu( const ResId& );
89 : const ResId& GetPopupMenuResId() const;
90 : const ResId& GetStatusBarResId() const;
91 :
92 : void Register( SfxModule* );
93 :
94 0 : SAL_DLLPRIVATE bool ContainsSlot_Impl( const SfxSlot *pSlot ) const
95 0 : { return pSlot >= pSlots && pSlot < pSlots + Count(); }
96 : };
97 :
98 :
99 :
100 : // returns the number of functions in this cluster
101 :
102 381818 : inline sal_uInt16 SfxInterface::Count() const
103 : {
104 381818 : return nCount;
105 : }
106 :
107 :
108 :
109 : // returns a function by position in the array
110 :
111 376244 : inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const
112 : {
113 376244 : return nPos < nCount? pSlots+nPos: 0;
114 : }
115 :
116 : #endif
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|