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