xref: /aoo4110/main/sfx2/inc/sfx2/ctrlitem.hxx (revision b1cdbd2c)
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 _SFXCTRLITEM_HXX
24 #define _SFXCTRLITEM_HXX
25 
26 #include "sal/config.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 #include <svl/poolitem.hxx>
30 
31 class SfxPoolItem;
32 class SfxBindings;
33 class SvStream;
34 
35 class SFX2_DLLPUBLIC SfxControllerItem
36 {
37 private:
38 	sal_uInt16				nId;
39 	SfxControllerItem*	pNext; // zu benachrichtigendes weiteres ControllerItem
40 	SfxBindings*		pBindings;
41 
42 protected:
43 //#if defined( DBG_UTIL ) && defined( _SOLAR__PRIVATE )
44 #if defined( DBG_UTIL )
45 	SAL_DLLPRIVATE void CheckConfigure_Impl( sal_uIntPtr nType );
46 #endif
47 
48 public:
GetBindings()49 	SfxBindings &		GetBindings() {
50 							DBG_ASSERT(pBindings, "keine Bindings");
51 							return *pBindings;
52 						}
GetBindings() const53 	const SfxBindings &	GetBindings() const {
54 							DBG_ASSERT(pBindings, "keine Bindings");
55 							return *pBindings;
56 						}
57 
58 						SfxControllerItem(); // fuer arrays
59 						SfxControllerItem( sal_uInt16 nId, SfxBindings & );
60 	virtual 			~SfxControllerItem();
61 
62 	void				Bind( sal_uInt16 nNewId, SfxBindings * = 0);	// in SfxBindings registrieren
63 	void				UnBind();
64 	void				ReBind();
65 	sal_Bool				IsBound() const;
66 	void				UpdateSlot();
67 	void				ClearCache();
SetBindings(SfxBindings & rBindings)68 	void				SetBindings(SfxBindings &rBindings) { pBindings = &rBindings; }
69 
70 	SfxControllerItem*	GetItemLink();
71 	SfxControllerItem*	ChangeItemLink( SfxControllerItem* pNewLink );
72 
73 	void                SetId( sal_uInt16 nItemId );
GetId() const74 	sal_uInt16				GetId() const { return nId; }
75 
76 	virtual void		StateChanged( sal_uInt16 nSID, SfxItemState eState,
77 									  const SfxPoolItem* pState );
78 	virtual void        DeleteFloatingWindow();
79 
80 	SfxMapUnit			GetCoreMetric() const;
81 
82 	static SfxItemState	GetItemState( const SfxPoolItem* pState );
83 
84 //#if 0 // _SOLAR__PRIVATE
IsBindable_Impl() const85 	SAL_DLLPRIVATE sal_Bool IsBindable_Impl() const
86 						{ return pBindings != NULL; }
87     SAL_DLLPRIVATE void BindInternal_Impl( sal_uInt16 nNewId, SfxBindings* );
88 //#endif
89 };
90 
91 //====================================================================
92 
93 class SFX2_DLLPUBLIC SfxStatusForwarder: public SfxControllerItem
94 {
95 	SfxControllerItem*		pMaster;
96 
97 protected:
98 	virtual void		StateChanged( sal_uInt16 nSID, SfxItemState eState,
99 									  const SfxPoolItem* pState );
100 
101 public:
102 							SfxStatusForwarder( sal_uInt16 nSlotId,
103 								   SfxControllerItem&rMaster );
104 };
105 
106 #endif
107 
108