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