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 : bool bSuperClass; // Whether children inherit its toolbars etc
44 : SfxInterface_Impl* pImpData;
45 :
46 : SfxSlot* operator[]( sal_uInt16 nPos ) const;
47 :
48 : public:
49 : SfxInterface( const char *pClass,
50 : bool bSuperClass,
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 : const SfxSlot* GetSlot( sal_uInt16 nSlotId ) const;
62 : const SfxSlot* GetSlot( const OUString& rCommand ) const;
63 :
64 : const char* GetClassName() const { return pName; }
65 99802 : bool UseAsSuperClass() const { return bSuperClass; }
66 :
67 888 : const SfxInterface* GetGenoType() const { return pGenoType; }
68 :
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;
86 :
87 : void Register( SfxModule* );
88 :
89 1740 : SAL_DLLPRIVATE bool ContainsSlot_Impl( const SfxSlot *pSlot ) const
90 1740 : { return pSlot >= pSlots && pSlot < pSlots + Count(); }
91 : };
92 :
93 :
94 :
95 : // returns the number of functions in this cluster
96 :
97 255263 : inline sal_uInt16 SfxInterface::Count() const
98 : {
99 255263 : return nCount;
100 : }
101 :
102 :
103 :
104 : // returns a function by position in the array
105 :
106 249802 : inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const
107 : {
108 249802 : return nPos < nCount? pSlots+nPos: 0;
109 : }
110 :
111 : #endif
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|