LibreOffice Module sd (master) 1
LayerTabBar.hxx
Go to the documentation of this file.
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 <sal/config.h>
23
24#include <string_view>
25
26#include <svtools/tabbar.hxx>
27#include <vcl/transfer.hxx>
28#include <sddllapi.h>
29
30namespace sd {
31
35class DrawViewShell;
36
37class SAL_DLLPUBLIC_RTTI LayerTabBar final
38 : public TabBar,
39 public DropTargetHelper
40{
41public:
43 DrawViewShell* pDrViewSh,
44 vcl::Window* pParent);
45 virtual void dispose() override;
46 virtual ~LayerTabBar() override;
47
52 void SendActivatePageEvent();
53
58 void SendDeactivatePageEvent();
59
60 // Expects not-localized, real layer name in rText. Generates a localized layer name
61 // that will be displayed on the tab of the LayerTabBar and writes the real name
62 // to maAuxiliaryText. In case you want no entry in maAuxiliaryText, use method from TabBar.
63 virtual void InsertPage( sal_uInt16 nPageId, const OUString& rText,
64 TabBarPageBits nBits = TabBarPageBits::NONE,
65 sal_uInt16 nPos = TabBar::APPEND ) override;
66 virtual void SetPageText( sal_uInt16 nPageId, const OUString& rText ) override;
67
68 // Returns the real layer name if exists and empty OUString otherwise.
69 OUString GetLayerName(sal_uInt16 nPageId) const;
70
71 // Used e.g. in DeleteActualLayer() to test whether deleting is allowed.
72 static bool IsRealNameOfStandardLayer(std::u16string_view rName);
73
74 // Used e.g. in validity test of user entered names
75 static bool IsLocalizedNameOfStandardLayer(std::u16string_view rName);
76
77 // In case rName is one of the sUNO_LayerName_*, it generates a localized name,
78 // otherwise it returns value of rName.
79 static OUString convertToLocalizedName(const OUString& rName);
80
81 // TabBar
82 virtual void Select() override;
83 virtual void DoubleClick() override;
84
85 SD_DLLPUBLIC virtual void MouseButtonDown(const MouseEvent& rMEvt) override; // export for unit test
86
87 virtual void Command(const CommandEvent& rCEvt) override;
88
89 virtual bool StartRenaming() override;
90 virtual TabBarAllowRenamingReturnCode AllowRenaming() override;
91 virtual void EndRenaming() override;
92
93 virtual void ActivatePage() override;
94
95 // DropTargetHelper
96 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
97 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
98
99private:
101
102 // Expects not-localized, real layer name in rText and writes it to maAuxiliaryText.
103 void SetLayerName( sal_uInt16 nPageId, const OUString& rText );
104};
105
106} // end of namespace sd
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 nPageId
static const sal_uInt16 APPEND
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
DrawViewShell * pDrViewSh
sal_uInt16 nPos
void dispose()
@ MouseButtonDown
#define SD_DLLPUBLIC
Definition: sddllapi.h:27
TabBarAllowRenamingReturnCode
TabBarPageBits
signed char sal_Int8