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 _SFXOBJFACE_HXX
20 : #define _SFXOBJFACE_HXX
21 :
22 : #include "sal/config.h"
23 :
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>
29 :
30 : #include <sfx2/msg.hxx>
31 :
32 : struct SfxFormalArgument;
33 : struct SfxInterface_Impl;
34 : class SfxConfigItem;
35 : class SfxIFConfig_Impl;
36 : class SfxObjectUIArr_Impl ;
37 : class SfxModule;
38 : class SvStream;
39 :
40 : class SFX2_DLLPUBLIC SfxInterface
41 : {
42 : friend class SfxIFConfig_Impl;
43 : friend class SfxSlotPool;
44 :
45 : const char* pName; // Sfx-internal name of interface
46 : const SfxInterface* pGenoType; // base interface
47 : SfxSlot* pSlots; // SlotMap
48 : sal_uInt16 nCount; // number of slots in SlotMap
49 : SfxInterfaceId nClassId; // Id of interface
50 : ResId aNameResId; // ResId of external interface name
51 : SfxInterface_Impl* pImpData;
52 :
53 : SfxSlot* operator[]( sal_uInt16 nPos ) const;
54 :
55 : public:
56 : SfxInterface( const char *pClass,
57 : const ResId& rResId,
58 : SfxInterfaceId nClassId,
59 : const SfxInterface* pGeno,
60 : SfxSlot &rMessages, sal_uInt16 nMsgCount );
61 : virtual ~SfxInterface();
62 :
63 : void SetSlotMap( SfxSlot& rMessages, sal_uInt16 nMsgCount );
64 : inline sal_uInt16 Count() const;
65 :
66 : const SfxSlot* GetRealSlot( const SfxSlot * ) const;
67 : const SfxSlot* GetRealSlot( sal_uInt16 nSlotId ) const;
68 : virtual const SfxSlot* GetSlot( sal_uInt16 nSlotId ) const;
69 : const SfxSlot* GetSlot( const String& rCommand ) const;
70 :
71 : const char* GetClassName() const { return pName; }
72 22808 : bool HasName() const { return 0 != aNameResId.GetId(); }
73 : rtl::OUString GetName() const
74 : { return HasName() ? aNameResId.toString() : rtl::OUString(); }
75 0 : ResMgr* GetResMgr() const
76 0 : { return aNameResId.GetResMgr(); }
77 :
78 0 : const SfxInterface* GetGenoType() const { return pGenoType; }
79 : const SfxInterface* GetRealInterfaceForSlot( const SfxSlot* ) const;
80 :
81 : void RegisterObjectBar( sal_uInt16, const ResId&, const String* pST=0 );
82 : void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 );
83 : void RegisterChildWindow( sal_uInt16, sal_Bool bContext, const String* pST=0 );
84 : void RegisterChildWindow( sal_uInt16, sal_Bool bContext, sal_uInt32 nFeature, const String* pST=0 );
85 : void RegisterStatusBar( const ResId& );
86 : const ResId& GetObjectBarResId( sal_uInt16 nNo ) const;
87 : sal_uInt16 GetObjectBarPos( sal_uInt16 nNo ) const;
88 : sal_uInt32 GetObjectBarFeature( sal_uInt16 nNo ) const;
89 : sal_uInt16 GetObjectBarCount() const;
90 : void SetObjectBarPos( sal_uInt16 nPos, sal_uInt16 nId );
91 : const String* GetObjectBarName( sal_uInt16 nNo ) const;
92 : sal_Bool IsObjectBarVisible( sal_uInt16 nNo) const;
93 : sal_uInt32 GetChildWindowFeature( sal_uInt16 nNo ) const;
94 : sal_uInt32 GetChildWindowId( sal_uInt16 nNo ) const;
95 : sal_uInt16 GetChildWindowCount() const;
96 : void RegisterPopupMenu( const ResId& );
97 : const ResId& GetPopupMenuResId() const;
98 : const ResId& GetStatusBarResId() const;
99 :
100 : void Register( SfxModule* );
101 :
102 0 : SAL_DLLPRIVATE int ContainsSlot_Impl( const SfxSlot *pSlot ) const
103 0 : { return pSlot >= pSlots && pSlot < pSlots + Count(); }
104 : SAL_DLLPRIVATE ResMgr* GetResManager_Impl() const
105 : { return aNameResId.GetResMgr(); }
106 : };
107 :
108 : //--------------------------------------------------------------------
109 :
110 : // returns the number of functions in this cluster
111 :
112 104817 : inline sal_uInt16 SfxInterface::Count() const
113 : {
114 104817 : return nCount;
115 : }
116 :
117 : //--------------------------------------------------------------------
118 :
119 : // returns a function by position in the array
120 :
121 103558 : inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const
122 : {
123 103558 : return nPos < nCount? pSlots+nPos: 0;
124 : }
125 :
126 : class SfxIFConfig_Impl
127 : {
128 : friend class SfxInterface;
129 : sal_uInt16 nCount;
130 : SfxObjectUIArr_Impl* pObjectBars;
131 :
132 : public:
133 : SfxIFConfig_Impl();
134 : ~SfxIFConfig_Impl();
135 : sal_Bool Store(SvStream&);
136 : void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 );
137 : sal_uInt16 GetType();
138 : };
139 :
140 : #endif
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|