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 .
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>
31 class GalleryBrowser1
;
34 class GalleryButton
: public PushButton
38 virtual void KeyInput( const KeyEvent
& rKEvt
) override
;
42 GalleryButton( GalleryBrowser1
* pParent
, WinBits nWinBits
);
46 class GalleryThemeListBox
: public ListBox
52 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
53 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
57 GalleryThemeListBox( GalleryBrowser1
* pParent
, WinBits nWinBits
);
62 class GalleryThemeEntry
;
64 class VclAbstractDialog2
;
68 namespace svx
{ namespace sidebar
{ class GalleryControl
; } }
70 class GalleryBrowser1
: public Control
, public SfxListener
72 friend class GalleryBrowser
;
73 friend class svx::sidebar::GalleryControl
;
74 friend class GalleryThemeListBox
;
75 using Window::KeyInput
;
79 VclPtr
<GalleryButton
> maNewTheme
;
80 VclPtr
<GalleryThemeListBox
> mpThemes
;
81 VclPtr
<VclAbstractDialog2
> mpThemePropertiesDialog
; // to keep it alive during execution
83 ExchangeData
* mpExchangeData
;
84 SfxItemSet
* mpThemePropsDlgItemSet
;
90 ::std::function
<sal_Bool (const KeyEvent
&,Window
*)> maKeyInputHandler
;
91 ::std::function
<void ()> maThemeSlectionHandler
;
93 void ImplAdjustControls();
94 sal_uIntPtr
ImplInsertThemeEntry( const GalleryThemeEntry
* pEntry
);
95 static void ImplFillExchangeData( const GalleryTheme
* pThm
, ExchangeData
& rData
);
96 void ImplGetExecuteVector(std::vector
<OString
>& o_aExec
);
97 void ImplExecute(const OString
&rIdent
);
98 void ImplGalleryThemeProperties( const OUString
& rThemeName
, bool bCreateNew
);
99 void ImplEndGalleryThemeProperties(bool bCreateNew
);
102 virtual void Resize() override
;
103 virtual void GetFocus() override
;
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( EndNewThemePropertiesDlgHdl
, Dialog
&, void );
113 DECL_LINK( EndThemePropertiesDlgHdl
, Dialog
&, void );
114 DECL_LINK( DestroyThemePropertiesDlgHdl
, void*, void );
119 vcl::Window
* pParent
,
121 const ::std::function
<sal_Bool (const KeyEvent
&,Window
*)>& rKeyInputHandler
,
122 const ::std::function
<void ()>& rThemeSlectionHandler
);
123 virtual ~GalleryBrowser1() override
;
124 virtual void dispose() override
;
126 void SelectTheme( sal_uInt16 nThemePos
) { mpThemes
->SelectEntryPos( nThemePos
); SelectThemeHdl( *mpThemes
); }
127 OUString
GetSelectedTheme() { return mpThemes
->GetEntryCount() ? mpThemes
->GetSelectEntry() : OUString(); }
129 void ShowContextMenu();
130 bool KeyInput( const KeyEvent
& rKEvt
, vcl::Window
* pWindow
);
133 #endif // INCLUDED_SVX_SOURCE_GALLERY2_GALBRWS1_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */