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 
11 #pragma once
12 
13 #include <memory>
14 
15 #include <sfx2/sidebar/PanelLayout.hxx>
16 #include <sfx2/sidebar/ControllerItem.hxx>
17 #include <svtools/valueset.hxx>
18 
19 namespace sw::sidebar {
20 
21 class StylePresetsPanel : public PanelLayout,
22                        public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
23 {
24 public:
25     static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent);
26 
27     StylePresetsPanel(weld::Widget* pParent);
28 
29     virtual ~StylePresetsPanel() override;
30 
31     virtual void NotifyItemUpdate(const sal_uInt16 nSId,
32                                   const SfxItemState eState,
33                                   const SfxPoolItem* pState) override;
34 
GetControlState(const sal_uInt16,boost::property_tree::ptree &)35     virtual void GetControlState(
36         const sal_uInt16 /*nSId*/,
37         boost::property_tree::ptree& /*rState*/) override {};
38 
39 private:
40     struct TemplateEntry
41     {
TemplateEntrysw::sidebar::StylePresetsPanel::TemplateEntry42         explicit TemplateEntry(const OUString& rURL)
43             : maURL(rURL)
44         {}
45 
46         OUString maURL;
47     };
48 
49     void RefreshList();
50 
51     std::unique_ptr<ValueSet> mxValueSet;
52     std::unique_ptr<weld::CustomWeld> mxValueSetWin;
53 
54     std::vector<std::unique_ptr<TemplateEntry>> maTemplateEntries;
55 
56     DECL_LINK(DoubleClickHdl, ValueSet*, void);
57 };
58 
59 } // end of namespace sw::sidebar
60 
61 
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
63