Avoid potential negative array index access to cached text.
[LibreOffice.git] / sfx2 / inc / sidebar / TitleBar.hxx
blob7836a57be17aa83edb91723094b52efb127e45ae
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 .
19 #pragma once
21 #include <sfx2/sidebar/Theme.hxx>
22 #include <vcl/weld.hxx>
24 namespace sfx2::sidebar {
26 class TitleBar
28 public:
29 TitleBar(weld::Builder& rBuilder, Theme::ThemeItem eThemeItem);
30 virtual ~TitleBar();
32 virtual void SetTitle (const OUString& rsTitle) = 0;
33 virtual OUString GetTitle() const = 0;
35 virtual void DataChanged();
37 void Show(bool bShow);
38 bool GetVisible() const;
40 Size get_preferred_size() const;
42 void SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon);
44 weld::Toolbar& GetToolBox()
46 return *mxToolBox;
48 const weld::Toolbar& GetToolBox() const
50 return *mxToolBox;
53 protected:
54 weld::Builder& mrBuilder;
55 std::unique_ptr<weld::Box> mxTitlebar;
56 std::unique_ptr<weld::Image> mxAddonImage;
57 std::unique_ptr<weld::Toolbar> mxToolBox;
58 Theme::ThemeItem meThemeItem;
59 OUString msToolBoxRId;
61 virtual void HandleToolBoxItemClick() = 0;
63 DECL_LINK(SelectionHandler, const OUString&, void);
64 static void ShowHelp(const OUString& rHelpId);
66 private:
67 void SetBackground();
70 } // end of namespace sfx2::sidebar
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */