Bump version to 6.4-15
[LibreOffice.git] / svx / source / gallery2 / galbrws1.hxx
blob825d773801af4b29d137ffc17e421ada93a8b161
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 #ifndef INCLUDED_SVX_SOURCE_GALLERY2_GALBRWS1_HXX
21 #define INCLUDED_SVX_SOURCE_GALLERY2_GALBRWS1_HXX
23 #include <vcl/lstbox.hxx>
24 #include <vcl/button.hxx>
25 #include <vcl/menu.hxx>
26 #include <svl/lstner.hxx>
27 #include <vector>
29 #include <functional>
31 class GalleryBrowser1;
34 class GalleryButton : public PushButton
36 private:
38 virtual void KeyInput( const KeyEvent& rKEvt ) override;
40 public:
42 GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits );
46 class GalleryThemeListBox final : public ListBox
48 void InitSettings();
50 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
51 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
53 public:
55 GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits );
59 class Gallery;
60 class GalleryThemeEntry;
61 class GalleryTheme;
62 class VclAbstractDialog;
63 struct ExchangeData;
64 class SfxItemSet;
66 namespace svx { namespace sidebar { class GalleryControl; } }
68 class GalleryBrowser1 : public Control, public SfxListener
70 friend class GalleryBrowser;
71 friend class svx::sidebar::GalleryControl;
72 friend class GalleryThemeListBox;
73 using Window::KeyInput;
75 private:
77 VclPtr<GalleryButton> maNewTheme;
78 VclPtr<GalleryThemeListBox> mpThemes;
79 VclPtr<VclAbstractDialog> mpThemePropertiesDialog; // to keep it alive during execution
80 Gallery* mpGallery;
81 std::unique_ptr<ExchangeData> mpExchangeData;
82 std::unique_ptr<SfxItemSet> mpThemePropsDlgItemSet;
84 Image aImgNormal;
85 Image aImgDefault;
86 Image aImgReadOnly;
88 ::std::function<sal_Bool (const KeyEvent&,Window*)> const maKeyInputHandler;
89 ::std::function<void ()> const maThemeSlectionHandler;
91 void ImplAdjustControls();
92 sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
93 static void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
94 void ImplGetExecuteVector(std::vector<OString>& o_aExec);
95 void ImplExecute(const OString &rIdent);
96 void ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew );
97 void EndNewThemePropertiesDlgHdl(sal_Int32 nResult);
98 void EndThemePropertiesDlgHdl(sal_Int32 nResult);
99 void ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 nResult);
101 // Control
102 virtual void Resize() override;
103 virtual void GetFocus() override;
105 // SfxListener
106 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
108 DECL_LINK( ClickNewThemeHdl, Button*, void );
109 DECL_LINK( SelectThemeHdl, ListBox&, void );
110 DECL_LINK( ShowContextMenuHdl, void*, void );
111 DECL_LINK( PopupMenuHdl, Menu*, bool );
112 DECL_LINK( DestroyThemePropertiesDlgHdl, void*, void );
114 public:
116 GalleryBrowser1(
117 vcl::Window* pParent,
118 Gallery* pGallery,
119 const ::std::function<sal_Bool (const KeyEvent&,Window*)>& rKeyInputHandler,
120 const ::std::function<void ()>& rThemeSlectionHandler);
121 virtual ~GalleryBrowser1() override;
122 virtual void dispose() override;
124 void SelectTheme( sal_uInt16 nThemePos ) { mpThemes->SelectEntryPos( nThemePos ); SelectThemeHdl( *mpThemes ); }
125 OUString GetSelectedTheme() const { return mpThemes->GetEntryCount() ? mpThemes->GetSelectedEntry() : OUString(); }
127 void ShowContextMenu();
128 bool KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow );
131 #endif // INCLUDED_SVX_SOURCE_GALLERY2_GALBRWS1_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */