1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <svl/lstner.hxx>
23 #include <vcl/weld.hxx>
28 class GalleryBrowser1
;
32 class GalleryThemeEntry
;
34 class VclAbstractDialog
;
38 namespace svx::sidebar
{ class GalleryControl
; }
40 class GalleryBrowser1 final
: public SfxListener
42 friend class GalleryBrowser
;
43 friend class svx::sidebar::GalleryControl
;
47 std::unique_ptr
<weld::Button
> mxNewTheme
;
48 std::unique_ptr
<weld::TreeView
> mxThemes
;
49 std::unique_ptr
<weld::Button
> mxMoreGalleries
;
51 std::unique_ptr
<ExchangeData
> mpExchangeData
;
52 std::unique_ptr
<SfxItemSet
> mpThemePropsDlgItemSet
;
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
);
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 );
81 weld::Builder
& rBuilder
,
83 ::std::function
<void ()> aThemeSelectionHandler
);
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: */