bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / LayerTabBar.hxx
blob2e0bee3aabefd464016b61ebd70bd5e4f058791c
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 #ifndef INCLUDED_SD_SOURCE_UI_INC_LAYERTABBAR_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_LAYERTABBAR_HXX
23 #include <svtools/tabbar.hxx>
24 #include <vcl/transfer.hxx>
25 #include <sddllapi.h>
27 namespace sd {
29 /**
30 * TabBar for layer administration
32 class DrawViewShell;
34 class SAL_DLLPUBLIC_RTTI LayerTabBar final
35 : public TabBar,
36 public DropTargetHelper
38 public:
39 LayerTabBar (
40 DrawViewShell* pDrViewSh,
41 vcl::Window* pParent);
42 virtual void dispose() override;
43 virtual ~LayerTabBar() override;
45 /** Inform all listeners of this control that the current layer has been
46 activated. Call this method after switching the current layer and is
47 not done elsewhere (like when using ctrl + page up/down keys).
49 void SendActivatePageEvent();
51 /** Inform all listeners of this control that the current layer has been
52 deactivated. Call this method before switching the current layer
53 and is not done elsewhere (like when using ctrl page up/down keys).
55 void SendDeactivatePageEvent();
57 // Expects not-localized, real layer name in rText. Generates a localized layer name
58 // that will be displayed on the tab of the LayerTabBar and writes the real name
59 // to maAuxiliaryText. In case you want no entry in maAuxiliaryText, use method from TabBar.
60 virtual void InsertPage( sal_uInt16 nPageId, const OUString& rText,
61 TabBarPageBits nBits = TabBarPageBits::NONE,
62 sal_uInt16 nPos = TabBar::APPEND ) override;
63 virtual void SetPageText( sal_uInt16 nPageId, const OUString& rText ) override;
65 // Returns the real layer name if exists and empty OUString otherwise.
66 OUString GetLayerName(sal_uInt16 nPageId) const;
68 // Used e.g. in DeleteActualLayer() to test whether deleting is allowed.
69 static bool IsRealNameOfStandardLayer(const OUString& rName);
71 // Used e.g. in validity test of user entered names
72 static bool IsLocalizedNameOfStandardLayer(const OUString& rName);
74 // In case rName is one of the sUNO_LayerName_*, it generates a localized name,
75 // otherwise it returns value of rName.
76 static OUString convertToLocalizedName(const OUString& rName);
78 // TabBar
79 virtual void Select() override;
80 virtual void DoubleClick() override;
82 SD_DLLPUBLIC virtual void MouseButtonDown(const MouseEvent& rMEvt) override; // export for unit test
84 virtual void Command(const CommandEvent& rCEvt) override;
86 virtual bool StartRenaming() override;
87 virtual TabBarAllowRenamingReturnCode AllowRenaming() override;
88 virtual void EndRenaming() override;
90 virtual void ActivatePage() override;
92 // DropTargetHelper
93 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
94 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
96 private:
97 DrawViewShell* pDrViewSh;
99 // Expects not-localized, real layer name in rText and writes it to maAuxiliaryText.
100 void SetLayerName( sal_uInt16 nPageId, const OUString& rText );
103 } // end of namespace sd
105 #endif
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */