/src/libreoffice/sd/source/ui/inc/TabControl.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #include <svtools/tabbar.hxx> |
23 | | #include <vcl/transfer.hxx> |
24 | | |
25 | | namespace sd { |
26 | | |
27 | | /** |
28 | | * TabControl-Class for page switch |
29 | | */ |
30 | | |
31 | | class DrawViewShell; |
32 | | |
33 | | class TabControl final |
34 | | : public TabBar, |
35 | | public DragSourceHelper, |
36 | | public DropTargetHelper |
37 | | { |
38 | | public: |
39 | | TabControl (DrawViewShell* pDrViewSh, vcl::Window* pParent); |
40 | | virtual void dispose() override; |
41 | | virtual ~TabControl() override; |
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(); |
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(); |
54 | | |
55 | | private: |
56 | | DrawViewShell* pDrViewSh; |
57 | | bool bInternalMove; |
58 | | |
59 | | // TabBar |
60 | | virtual void Select() override; |
61 | | virtual void DoubleClick() override; |
62 | | virtual void MouseButtonDown(const MouseEvent& rMEvt) override; |
63 | | |
64 | | virtual void Command(const CommandEvent& rCEvt) override; |
65 | | |
66 | | virtual bool StartRenaming() override; |
67 | | virtual TabBarAllowRenamingReturnCode AllowRenaming() override; |
68 | | virtual void EndRenaming() override; |
69 | | |
70 | | virtual void ActivatePage() override; |
71 | | virtual bool DeactivatePage() override; |
72 | | |
73 | | // DragSourceHelper |
74 | | virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override; |
75 | | |
76 | | // DropTargetHelper |
77 | | virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; |
78 | | virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; |
79 | | |
80 | | // nested class to implement the TransferableHelper |
81 | | class TabControlTransferable final : public TransferableHelper |
82 | | { |
83 | | public: |
84 | | explicit TabControlTransferable( TabControl& rParent ) : |
85 | 0 | mrParent( rParent ) {} |
86 | | private: |
87 | | |
88 | | TabControl& mrParent; |
89 | | |
90 | | virtual ~TabControlTransferable() override; |
91 | | |
92 | | virtual void AddSupportedFormats() override; |
93 | | virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; |
94 | | virtual void DragFinished( sal_Int8 nDropAction ) override; |
95 | | |
96 | | }; |
97 | | |
98 | | friend class TabControl::TabControlTransferable; |
99 | | |
100 | | void DragFinished(); |
101 | | |
102 | | using TabBar::StartDrag; |
103 | | }; |
104 | | |
105 | | } // end of namespace sd |
106 | | |
107 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |