xref: /aoo41x/main/sd/source/ui/inc/TabControl.hxx (revision c45d927a)
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 
24 #ifndef SD_TAB_CONTROL_HXX
25 #define SD_TAB_CONTROL_HXX
26 
27 #include <svtools/tabbar.hxx>
28 #include <svtools/transfer.hxx>
29 
30 namespace sd {
31 
32 /*************************************************************************
33 |*
34 |* TabControl-Klasse fuer Seitenumschaltung
35 |*
36 \************************************************************************/
37 
38 class DrawViewShell;
39 
40 class TabControl
41     : public TabBar,
42       public DragSourceHelper,
43       public DropTargetHelper
44 {
45 public:
46     TabControl (DrawViewShell* pDrViewSh, ::Window* pParent);
47     virtual ~TabControl (void);
48 
49     /** Inform all listeners of this control that the current page has been
50         activated.  Call this method after switching the current page and is
51         not done elsewhere (like when using page up/down keys).
52     */
53     void SendActivatePageEvent (void);
54 
55     /** Inform all listeners of this control that the current page has been
56         deactivated.  Call this method before switching the current page and
57         is not done elsewhere (like when using page up/down keys).
58     */
59     void SendDeactivatePageEvent (void);
60 
61 protected:
62 	DrawViewShell*	pDrViewSh;
63 	sal_Bool				bInternalMove;
64 
65 	// TabBar
66 	virtual void		Select();
67 	virtual void		DoubleClick();
68 	virtual void		MouseButtonDown(const MouseEvent& rMEvt);
69 
70 	virtual void		Command(const CommandEvent& rCEvt);
71 
72 	virtual long		StartRenaming();
73 	virtual long		AllowRenaming();
74 	virtual void		EndRenaming();
75 
76 	virtual void		ActivatePage();
77 	virtual long		DeactivatePage();
78 
79 	// DragSourceHelper
80 	virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
81 
82 	// DropTargetHelper
83 	virtual sal_Int8	AcceptDrop( const AcceptDropEvent& rEvt );
84 	virtual sal_Int8	ExecuteDrop( const ExecuteDropEvent& rEvt );
85 
86 						DECL_LINK(DeactivatePageHdl, void*);
87 
88 private:
89 	// nested class to implement the TransferableHelper
90 	class TabControlTransferable : public TransferableHelper
91 	{
92 	public:
93         TabControlTransferable( TabControl& rParent ) :
94             mrParent( rParent ) {}
95 	private:
96 
97 		TabControl&		mrParent;
98 
99 		virtual				~TabControlTransferable();
100 
101 		virtual void		AddSupportedFormats();
102 		virtual sal_Bool	GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
103 		virtual void		DragFinished( sal_Int8 nDropAction );
104 
105 	};
106 
107 	friend class TabControl::TabControlTransferable;
108 
109 	void				DragFinished( sal_Int8 nDropAction );
110 
111 private:
112 	using TabBar::StartDrag;
113 };
114 
115 } // end of namespace sd
116 
117 #endif
118 
119