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>
29 #include <boost/function.hpp>
31 class GalleryBrowser1
;
35 class GalleryButton
: public PushButton
39 virtual void KeyInput( const KeyEvent
& rKEvt
) SAL_OVERRIDE
;
43 GalleryButton( GalleryBrowser1
* pParent
, WinBits nWinBits
);
46 // - GalleryThemeListBox -
48 class GalleryThemeListBox
: public ListBox
54 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
55 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
59 GalleryThemeListBox( GalleryBrowser1
* pParent
, WinBits nWinBits
);
62 // - GalleryBrowser1 -
65 class GalleryThemeEntry
;
67 class VclAbstractDialog2
;
71 namespace svx
{ namespace sidebar
{ class GalleryControl
; } }
73 class GalleryBrowser1
: public Control
, SfxListener
75 friend class GalleryBrowser
;
76 friend class svx::sidebar::GalleryControl
;
77 friend class GalleryThemeListBox
;
78 using Control::Notify
;
79 using Window::KeyInput
;
83 VclPtr
<GalleryButton
> maNewTheme
;
84 VclPtr
<GalleryThemeListBox
> mpThemes
;
86 ExchangeData
* mpExchangeData
;
87 SfxItemSet
* mpThemePropsDlgItemSet
;
94 ::boost::function
<sal_Bool(const KeyEvent
&,Window
*)> maKeyInputHandler
;
95 ::boost::function
<void()> maThemeSlectionHandler
;
97 void ImplAdjustControls();
98 sal_uIntPtr
ImplInsertThemeEntry( const GalleryThemeEntry
* pEntry
);
99 static void ImplFillExchangeData( const GalleryTheme
* pThm
, ExchangeData
& rData
);
100 void ImplGetExecuteVector(::std::vector
< sal_uInt16
>& o_aExec
);
101 void ImplExecute( sal_uInt16 nId
);
102 void ImplGalleryThemeProperties( const OUString
& rThemeName
, bool bCreateNew
);
103 void ImplEndGalleryThemeProperties( VclAbstractDialog2
* pDialog
, bool bCreateNew
);
106 virtual void Resize() SAL_OVERRIDE
;
107 virtual void GetFocus() SAL_OVERRIDE
;
110 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
112 DECL_LINK( ClickNewThemeHdl
, void* );
113 DECL_LINK( SelectThemeHdl
, void* );
114 DECL_LINK( ShowContextMenuHdl
, void* );
115 DECL_LINK( PopupMenuHdl
, Menu
* );
116 DECL_LINK( EndNewThemePropertiesDlgHdl
, VclAbstractDialog2
* );
117 DECL_LINK( EndThemePropertiesDlgHdl
, VclAbstractDialog2
* );
118 DECL_LINK( DestroyThemePropertiesDlgHdl
, VclAbstractDialog2
* );
123 vcl::Window
* pParent
,
125 const ::boost::function
<sal_Bool(const KeyEvent
&,Window
*)>& rKeyInputHandler
,
126 const ::boost::function
<void()>& rThemeSlectionHandler
);
127 virtual ~GalleryBrowser1();
128 virtual void dispose() SAL_OVERRIDE
;
130 void SelectTheme( const OUString
& rThemeName
) { mpThemes
->SelectEntry( rThemeName
); SelectThemeHdl( NULL
); }
131 void SelectTheme( sal_uIntPtr nThemePos
) { mpThemes
->SelectEntryPos( (sal_uInt16
) nThemePos
); SelectThemeHdl( NULL
); }
132 OUString
GetSelectedTheme() { return mpThemes
->GetEntryCount() ? mpThemes
->GetSelectEntry() : OUString(); }
134 void ShowContextMenu();
135 bool KeyInput( const KeyEvent
& rKEvt
, vcl::Window
* pWindow
);
138 #endif // INCLUDED_SVX_SOURCE_GALLERY2_GALBRWS1_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */