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 _SFXCTRLITEM_HXX
20 : #define _SFXCTRLITEM_HXX
21 :
22 : #include "sal/config.h"
23 : #include "sfx2/dllapi.h"
24 : #include "sal/types.h"
25 : #include <svl/poolitem.hxx>
26 :
27 : class SfxPoolItem;
28 : class SfxBindings;
29 : class SvStream;
30 :
31 : class SFX2_DLLPUBLIC SfxControllerItem
32 : {
33 : private:
34 : sal_uInt16 nId;
35 : SfxControllerItem* pNext; // to notify next ControllerItem
36 : SfxBindings* pBindings;
37 :
38 : protected:
39 : #if defined( DBG_UTIL )
40 : SAL_DLLPRIVATE void CheckConfigure_Impl( sal_uIntPtr nType );
41 : #endif
42 :
43 : public:
44 0 : SfxBindings & GetBindings() {
45 : DBG_ASSERT(pBindings, "no Bindings");
46 0 : return *pBindings;
47 : }
48 : const SfxBindings & GetBindings() const {
49 : DBG_ASSERT(pBindings, "no Bindings");
50 : return *pBindings;
51 : }
52 :
53 : SfxControllerItem(); // for arrays
54 : SfxControllerItem( sal_uInt16 nId, SfxBindings & );
55 : virtual ~SfxControllerItem();
56 :
57 : void Bind( sal_uInt16 nNewId, SfxBindings * = 0); // Register in SfxBindings
58 : void UnBind();
59 : void ReBind();
60 : sal_Bool IsBound() const;
61 : void ClearCache();
62 : void SetBindings(SfxBindings &rBindings) { pBindings = &rBindings; }
63 :
64 : SfxControllerItem* GetItemLink();
65 : SfxControllerItem* ChangeItemLink( SfxControllerItem* pNewLink );
66 :
67 : void SetId( sal_uInt16 nItemId );
68 0 : sal_uInt16 GetId() const { return nId; }
69 :
70 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
71 : const SfxPoolItem* pState );
72 : virtual void DeleteFloatingWindow();
73 :
74 : static SfxItemState GetItemState( const SfxPoolItem* pState );
75 :
76 : SAL_DLLPRIVATE sal_Bool IsBindable_Impl() const
77 : { return pBindings != NULL; }
78 : SAL_DLLPRIVATE void BindInternal_Impl( sal_uInt16 nNewId, SfxBindings* );
79 : };
80 :
81 : //====================================================================
82 :
83 0 : class SFX2_DLLPUBLIC SfxStatusForwarder: public SfxControllerItem
84 : {
85 : SfxControllerItem* pMaster;
86 :
87 : protected:
88 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
89 : const SfxPoolItem* pState );
90 :
91 : public:
92 : SfxStatusForwarder( sal_uInt16 nSlotId,
93 : SfxControllerItem&rMaster );
94 : };
95 :
96 : #endif
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|