xref: /AOO41X/main/sfx2/inc/sfx2/msgpool.hxx (revision 353d8f4d17010cd2d0ea815067cad67e477f2bee)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SFXMSGPOOL_HXX
24 #define _SFXMSGPOOL_HXX
25 
26 #include "sal/config.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 
30 #include <sfx2/msg.hxx>
31 #include <tools/string.hxx>
32 #include <svl/svarray.hxx>
33 
34 class SfxInterface;
35 class SfxSlot;
36 class SfxInterfaceArr_Impl;
37 class SfxSlotGroupArr_Impl;
38 class SfxSlotTypeArr_Impl;
39 class SfxSlotArr_Impl;
40 
41 //=========================================================================
42 
43 class SFX2_DLLPUBLIC SfxSlotPool
44 {
45     SfxSlotGroupArr_Impl*       _pGroups;
46     SfxSlotTypeArr_Impl*        _pTypes;
47     SfxSlotPool*                _pParentPool;
48     ResMgr*                     _pResMgr;
49     SfxInterfaceArr_Impl*       _pInterfaces;
50     sal_uInt16                      _nCurGroup;
51     sal_uInt16                      _nCurInterface;
52     sal_uInt16                      _nCurMsg;
53     SfxSlotArr_Impl*            _pUnoSlots;
54 
55 private:
56     const SfxSlot* SeekSlot( sal_uInt16 nObject );
57 
58 public:
59                         SfxSlotPool( SfxSlotPool* pParent=0, ResMgr* pMgr=0);
60                         ~SfxSlotPool();
61 
62     void                RegisterInterface( SfxInterface& rFace );
63     void                ReleaseInterface( SfxInterface& rFace );
64     SfxInterface*       FirstInterface();
65     SfxInterface*       NextInterface();
66 
67     static SfxSlotPool& GetSlotPool( SfxViewFrame *pFrame=NULL );
68 
69     sal_uInt16              GetGroupCount();
70     String              SeekGroup( sal_uInt16 nNo );
71     const SfxSlot*      FirstSlot();
72     const SfxSlot*      NextSlot();
73     const SfxSlot*      GetSlot( sal_uInt16 nId );
74     const SfxSlot*      GetUnoSlot( sal_uInt16 nId );
75     const SfxSlot*      GetUnoSlot( const String& rUnoName );
76     TypeId              GetSlotType( sal_uInt16 nSlotId ) const;
77 };
78 
79 //--------------------------------------------------------------------
80 
81 // seeks to the first func in the current group
82 
FirstSlot()83 inline const SfxSlot* SfxSlotPool::FirstSlot()
84 {
85     return SeekSlot(0);
86 }
87 
88 #define SFX_SLOTPOOL() SfxSlotPool::GetSlotPool()
89 
90 #endif
91 
92