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