Avoid potential negative array index access to cached text.
[LibreOffice.git] / sfx2 / inc / sidebar / UnoPanel.hxx
blob97cd6c910c265d7636dfeff82899382fd9a39241
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 */
11 #pragma once
13 #include <com/sun/star/ui/XPanel.hpp>
16 #include <cppuhelper/implbase.hxx>
18 #include <sfx2/sidebar/Panel.hxx>
19 #include <sfx2/sidebar/Deck.hxx>
20 #include <sfx2/sidebar/ResourceManager.hxx>
22 namespace com::sun::star::awt { class XWindow; }
23 namespace com::sun::star::frame { class XFrame; }
24 namespace sfx2::sidebar { class SidebarController; }
27 /** get the Panel
29 class SfxUnoPanel final : public cppu::WeakImplHelper<css::ui::XPanel>
32 public:
34 SfxUnoPanel(css::uno::Reference<css::frame::XFrame>, OUString, OUString );
36 virtual OUString SAL_CALL getId() override;
38 virtual OUString SAL_CALL getTitle() override;
39 virtual void SAL_CALL setTitle( const OUString& newTitle ) override;
41 virtual sal_Bool SAL_CALL isExpanded() override;
42 virtual void SAL_CALL expand( const sal_Bool bCollapseOther ) override;
43 virtual void SAL_CALL collapse( ) override;
45 virtual sal_Int32 SAL_CALL getOrderIndex() override;
46 virtual void SAL_CALL setOrderIndex( const sal_Int32 newOrderIndex ) override;
47 virtual void SAL_CALL moveFirst() override;
48 virtual void SAL_CALL moveLast() override;
49 virtual void SAL_CALL moveUp() override;
50 virtual void SAL_CALL moveDown() override;
52 virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getDialog() override;
54 private:
56 const css::uno::Reference<css::frame::XFrame> xFrame;
57 sfx2::sidebar::SidebarController* getSidebarController();
59 const OUString mPanelId;
60 const OUString mDeckId;
62 VclPtr<sfx2::sidebar::Deck> mpDeck;
63 std::weak_ptr<sfx2::sidebar::Panel> mxPanel;
65 sal_Int32 GetMaxOrderIndex(const sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer& rPanels);
66 sal_Int32 GetMinOrderIndex(const sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer& rPanels);
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */