cid#1607171 Data race condition
[LibreOffice.git] / sd / source / ui / inc / TabControl.hxx
blob5e5eba7bbf091ca32c67809f434ca0645ef2efc2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <svtools/tabbar.hxx>
23 #include <vcl/transfer.hxx>
25 namespace sd {
27 /**
28 * TabControl-Class for page switch
31 class DrawViewShell;
33 class TabControl final
34 : public TabBar,
35 public DragSourceHelper,
36 public DropTargetHelper
38 public:
39 TabControl (DrawViewShell* pDrViewSh, vcl::Window* pParent);
40 virtual void dispose() override;
41 virtual ~TabControl() override;
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).
47 void SendActivatePageEvent();
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).
53 void SendDeactivatePageEvent();
55 private:
56 DrawViewShell* pDrViewSh;
57 bool bInternalMove;
59 // TabBar
60 virtual void Select() override;
61 virtual void DoubleClick() override;
62 virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
64 virtual void Command(const CommandEvent& rCEvt) override;
66 virtual bool StartRenaming() override;
67 virtual TabBarAllowRenamingReturnCode AllowRenaming() override;
68 virtual void EndRenaming() override;
70 virtual void ActivatePage() override;
71 virtual bool DeactivatePage() override;
73 // DragSourceHelper
74 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
76 // DropTargetHelper
77 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
78 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
80 // nested class to implement the TransferableHelper
81 class TabControlTransferable final : public TransferableHelper
83 public:
84 explicit TabControlTransferable( TabControl& rParent ) :
85 mrParent( rParent ) {}
86 private:
88 TabControl& mrParent;
90 virtual ~TabControlTransferable() override;
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;
98 friend class TabControl::TabControlTransferable;
100 void DragFinished();
102 using TabBar::StartDrag;
105 } // end of namespace sd
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */