Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / gallery2 / galbrws1.hxx
blobffe05c942b4993cb721f2ee8564453d168619005
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 .
20 #pragma once
22 #include <svl/lstner.hxx>
23 #include <vcl/weld.hxx>
24 #include <vector>
26 #include <functional>
28 class GalleryBrowser1;
31 class Gallery;
32 class GalleryThemeEntry;
33 class GalleryTheme;
34 class VclAbstractDialog;
35 struct ExchangeData;
36 class SfxItemSet;
38 namespace svx::sidebar { class GalleryControl; }
40 class GalleryBrowser1 final : public SfxListener
42 friend class GalleryBrowser;
43 friend class svx::sidebar::GalleryControl;
45 private:
47 std::unique_ptr<weld::Button> mxNewTheme;
48 std::unique_ptr<weld::TreeView> mxThemes;
49 std::unique_ptr<weld::Button> mxMoreGalleries;
50 Gallery* mpGallery;
51 std::unique_ptr<ExchangeData> mpExchangeData;
52 std::unique_ptr<SfxItemSet> mpThemePropsDlgItemSet;
54 OUString aImgNormal;
55 OUString aImgDefault;
56 OUString aImgReadOnly;
58 ::std::function<void ()> maThemeSelectionHandler;
60 void ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
61 static void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
62 void ImplGetExecuteVector(std::vector<OUString>& o_aExec);
63 void ImplExecute(std::u16string_view rIdent);
64 void ImplGalleryThemeProperties( std::u16string_view rThemeName, bool bCreateNew );
65 void EndNewThemePropertiesDlgHdl(sal_Int32 nResult);
66 void EndThemePropertiesDlgHdl(sal_Int32 nResult);
67 void ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 nResult);
69 // SfxListener
70 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
72 DECL_LINK( ClickNewThemeHdl, weld::Button&, void );
73 DECL_LINK( SelectThemeHdl, weld::TreeView&, void );
74 DECL_LINK( PopupMenuHdl, const CommandEvent&, bool );
75 DECL_LINK( KeyInputHdl, const KeyEvent&, bool );
76 DECL_STATIC_LINK( GalleryBrowser1, OnMoreGalleriesClick, weld::Button&, void );
78 public:
80 GalleryBrowser1(
81 weld::Builder& rBuilder,
82 Gallery* pGallery,
83 ::std::function<void ()> aThemeSelectionHandler);
85 ~GalleryBrowser1();
87 void SelectTheme( sal_uInt16 nThemePos ) { mxThemes->select( nThemePos ); SelectThemeHdl( *mxThemes ); }
88 OUString GetSelectedTheme() const { return mxThemes->get_selected_text(); }
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */