xref: /trunk/main/sd/source/ui/inc/TabControl.hxx (revision a0d53b35b9c5a6bd9856ab272d521493ba628169)
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 //IAccessibility2 Implementation 2009-----
46     //Solution: declare bIsMarked variable
47     sal_uInt16    RrePageID;
48 //-----IAccessibility2 Implementation 2009
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