xref: /aoo41x/main/sd/source/ui/inc/TabControl.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_TAB_CONTROL_HXX
29 #define SD_TAB_CONTROL_HXX
30 
31 #include <svtools/tabbar.hxx>
32 #include <svtools/transfer.hxx>
33 
34 namespace sd {
35 
36 /*************************************************************************
37 |*
38 |* TabControl-Klasse fuer Seitenumschaltung
39 |*
40 \************************************************************************/
41 
42 class DrawViewShell;
43 
44 class TabControl
45     : public TabBar,
46       public DragSourceHelper,
47       public DropTargetHelper
48 {
49 public:
50     TabControl (DrawViewShell* pDrViewSh, ::Window* pParent);
51     virtual ~TabControl (void);
52 
53     /** Inform all listeners of this control that the current page has been
54         activated.  Call this method after switching the current page and is
55         not done elsewhere (like when using page up/down keys).
56     */
57     void SendActivatePageEvent (void);
58 
59     /** Inform all listeners of this control that the current page has been
60         deactivated.  Call this method before switching the current page and
61         is not done elsewhere (like when using page up/down keys).
62     */
63     void SendDeactivatePageEvent (void);
64 
65 protected:
66 	DrawViewShell*	pDrViewSh;
67 	sal_Bool				bInternalMove;
68 
69 	// TabBar
70 	virtual void		Select();
71 	virtual void		DoubleClick();
72 	virtual void		MouseButtonDown(const MouseEvent& rMEvt);
73 
74 	virtual void		Command(const CommandEvent& rCEvt);
75 
76 	virtual long		StartRenaming();
77 	virtual long		AllowRenaming();
78 	virtual void		EndRenaming();
79 
80 	virtual void		ActivatePage();
81 	virtual long		DeactivatePage();
82 
83 	// DragSourceHelper
84 	virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
85 
86 	// DropTargetHelper
87 	virtual sal_Int8	AcceptDrop( const AcceptDropEvent& rEvt );
88 	virtual sal_Int8	ExecuteDrop( const ExecuteDropEvent& rEvt );
89 
90 						DECL_LINK(DeactivatePageHdl, void*);
91 
92 private:
93 	// nested class to implement the TransferableHelper
94 	class TabControlTransferable : public TransferableHelper
95 	{
96 	public:
97         TabControlTransferable( TabControl& rParent ) :
98             mrParent( rParent ) {}
99 	private:
100 
101 		TabControl&		mrParent;
102 
103 		virtual				~TabControlTransferable();
104 
105 		virtual void		AddSupportedFormats();
106 		virtual sal_Bool	GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
107 		virtual void		DragFinished( sal_Int8 nDropAction );
108 
109 	};
110 
111 	friend class TabControl::TabControlTransferable;
112 
113 	void				DragFinished( sal_Int8 nDropAction );
114 
115 private:
116 	using TabBar::StartDrag;
117 };
118 
119 } // end of namespace sd
120 
121 #endif
122 
123