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 10 #pragma once 11 12 #include <sfx2/dllapi.h> 13 #include <vcl/weld.hxx> 14 15 class DataChangedEvent; 16 class VclSimpleEvent; 17 namespace sfx2 { namespace sidebar { class Panel; } } 18 namespace tools { class JsonWriter; } 19 20 /// This class is the base for the Widget Layout-based sidebar panels. 21 class SFX2_DLLPUBLIC PanelLayout 22 { 23 protected: 24 std::unique_ptr<weld::Builder> m_xBuilder; 25 std::unique_ptr<weld::Container> m_xContainer; 26 sfx2::sidebar::Panel* m_pPanel; 27 28 virtual void DataChanged(const DataChangedEvent& rEvent); 29 virtual void DumpAsPropertyTree(tools::JsonWriter&); 30 31 virtual weld::Window* GetFrameWeld() const; 32 33 private: 34 DECL_LINK(DataChangedEventListener, VclSimpleEvent&, void); 35 DECL_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void); 36 37 public: 38 PanelLayout(weld::Widget* pParent, const OString& rID, const OUString& rUIXMLDescription); 39 40 void SetPanel(sfx2::sidebar::Panel* pPanel); 41 42 virtual ~PanelLayout(); 43 get_preferred_size() const44 Size get_preferred_size() const 45 { 46 return m_xContainer->get_preferred_size(); 47 } 48 49 void queue_resize(); 50 }; 51 52 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 53