LibreOffice Module svx (master)  1
galbrws1.hxx
Go to the documentation of this file.
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  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include <svl/lstner.hxx>
23 #include <vector>
24 
25 #include <functional>
26 
27 class GalleryBrowser1;
28 
29 
30 class Gallery;
31 class GalleryThemeEntry;
32 class GalleryTheme;
33 class VclAbstractDialog;
34 struct ExchangeData;
35 class SfxItemSet;
36 
37 namespace svx::sidebar { class GalleryControl; }
38 
39 class GalleryBrowser1 final : public SfxListener
40 {
41  friend class GalleryBrowser;
43 
44 private:
45 
46  std::unique_ptr<weld::Button> mxNewTheme;
47  std::unique_ptr<weld::TreeView> mxThemes;
48  std::unique_ptr<weld::Button> mxMoreGalleries;
50  std::unique_ptr<ExchangeData> mpExchangeData;
51  std::unique_ptr<SfxItemSet> mpThemePropsDlgItemSet;
52 
53  OUString aImgNormal;
54  OUString aImgDefault;
55  OUString aImgReadOnly;
56 
57  ::std::function<void ()> maThemeSelectionHandler;
58 
59  void ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
60  static void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
61  void ImplGetExecuteVector(std::vector<OString>& o_aExec);
62  void ImplExecute(const OString &rIdent);
63  void ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew );
64  void EndNewThemePropertiesDlgHdl(sal_Int32 nResult);
65  void EndThemePropertiesDlgHdl(sal_Int32 nResult);
66  void ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 nResult);
67 
68  // SfxListener
69  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
70 
71  DECL_LINK( ClickNewThemeHdl, weld::Button&, void );
72  DECL_LINK( SelectThemeHdl, weld::TreeView&, void );
73  DECL_LINK( PopupMenuHdl, const CommandEvent&, bool );
74  DECL_LINK( KeyInputHdl, const KeyEvent&, bool );
75  DECL_STATIC_LINK( GalleryBrowser1, OnMoreGalleriesClick, weld::Button&, void );
76 
77 public:
78 
80  weld::Builder& rBuilder,
81  Gallery* pGallery,
82  const ::std::function<void ()>& rThemeSelectionHandler);
83 
85 
86  void SelectTheme( sal_uInt16 nThemePos ) { mxThemes->select( nThemePos ); SelectThemeHdl( *mxThemes ); }
87  OUString GetSelectedTheme() const { return mxThemes->get_selected_text(); }
88  void GrabFocus();
89 };
90 
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: galbrws1.cxx:319
friend class svx::sidebar::GalleryControl
Definition: galbrws1.hxx:42
void GrabFocus()
Definition: galbrws1.cxx:311
void ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 nResult)
Definition: galbrws1.cxx:199
void ImplGetExecuteVector(std::vector< OString > &o_aExec)
Definition: galbrws1.cxx:135
OUString aImgDefault
Definition: galbrws1.hxx:54
DECL_STATIC_LINK(GalleryBrowser1, OnMoreGalleriesClick, weld::Button &, void)
OUString aImgReadOnly
Definition: galbrws1.hxx:55
void SelectTheme(sal_uInt16 nThemePos)
Definition: galbrws1.hxx:86
std::unique_ptr< ExchangeData > mpExchangeData
Definition: galbrws1.hxx:50
std::unique_ptr< weld::Button > mxMoreGalleries
Definition: galbrws1.hxx:48
Gallery * mpGallery
Definition: galbrws1.hxx:49
void EndNewThemePropertiesDlgHdl(sal_Int32 nResult)
Definition: galbrws1.cxx:234
OUString GetSelectedTheme() const
Definition: galbrws1.hxx:87
void ImplGalleryThemeProperties(const OUString &rThemeName, bool bCreateNew)
Definition: galbrws1.cxx:172
GalleryBrowser1(weld::Builder &rBuilder, Gallery *pGallery, const ::std::function< void()> &rThemeSelectionHandler)
Definition: galbrws1.cxx:49
std::unique_ptr< SfxItemSet > mpThemePropsDlgItemSet
Definition: galbrws1.hxx:51
void EndThemePropertiesDlgHdl(sal_Int32 nResult)
Definition: galbrws1.cxx:239
void ImplExecute(const OString &rIdent)
Definition: galbrws1.cxx:244
OUString aImgNormal
Definition: galbrws1.hxx:53
static void ImplFillExchangeData(const GalleryTheme *pThm, ExchangeData &rData)
Definition: galbrws1.cxx:112
std::unique_ptr< weld::TreeView > mxThemes
Definition: galbrws1.hxx:47
::std::function< void()> maThemeSelectionHandler
Definition: galbrws1.hxx:57
DECL_LINK(ClickNewThemeHdl, weld::Button &, void)
std::unique_ptr< weld::Button > mxNewTheme
Definition: galbrws1.hxx:46
void ImplInsertThemeEntry(const GalleryThemeEntry *pEntry)
Definition: galbrws1.cxx:93
friend class GalleryBrowser
Definition: galbrws1.hxx:41