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 #include <vcl/lstbox.hxx>
21 #include <vcl/button.hxx>
22 #include <vcl/menu.hxx>
23 #include <svl/lstner.hxx>
25 #include "svx/galbrws.hxx"
27 #include <boost/function.hpp>
33 class GalleryButton
: public PushButton
37 virtual void KeyInput( const KeyEvent
& rKEvt
);
41 GalleryButton( GalleryBrowser1
* pParent
, WinBits nWinBits
);
45 // -----------------------
46 // - GalleryThemeListBox -
47 // -----------------------
49 class GalleryThemeListBox
: public ListBox
55 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
56 virtual long PreNotify( NotifyEvent
& rNEvt
);
60 GalleryThemeListBox( GalleryBrowser1
* pParent
, WinBits nWinBits
);
61 ~GalleryThemeListBox();
64 // -------------------
65 // - GalleryBrowser1 -
66 // -------------------
69 class GalleryThemeEntry
;
71 class VclAbstractDialog2
;
75 namespace svx
{ namespace sidebar
{ class GalleryControl
; } }
77 class GalleryBrowser1
: public Control
, SfxListener
79 friend class GalleryBrowser
;
80 friend class svx::sidebar::GalleryControl
;
81 friend class GalleryThemeListBox
;
82 using Control::Notify
;
83 using Window::KeyInput
;
87 GalleryButton maNewTheme
;
88 GalleryThemeListBox
* mpThemes
;
90 ExchangeData
* mpExchangeData
;
91 SfxItemSet
* mpThemePropsDlgItemSet
;
98 ::boost::function
<sal_Bool(const KeyEvent
&,Window
*)> maKeyInputHandler
;
99 ::boost::function
<void(void)> maThemeSlectionHandler
;
101 void ImplAdjustControls();
102 sal_uIntPtr
ImplInsertThemeEntry( const GalleryThemeEntry
* pEntry
);
103 void ImplFillExchangeData( const GalleryTheme
* pThm
, ExchangeData
& rData
);
104 void ImplGetExecuteVector(::std::vector
< sal_uInt16
>& o_aExec
);
105 void ImplExecute( sal_uInt16 nId
);
106 void ImplGalleryThemeProperties( const String
& rThemeName
, bool bCreateNew
);
107 void ImplEndGalleryThemeProperties( VclAbstractDialog2
* pDialog
, bool bCreateNew
);
110 virtual void Resize();
111 virtual void GetFocus();
114 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
116 DECL_LINK( ClickNewThemeHdl
, void* );
117 DECL_LINK( SelectThemeHdl
, void* );
118 DECL_LINK( ShowContextMenuHdl
, void* );
119 DECL_LINK( PopupMenuHdl
, Menu
* );
120 DECL_LINK( EndNewThemePropertiesDlgHdl
, VclAbstractDialog2
* );
121 DECL_LINK( EndThemePropertiesDlgHdl
, VclAbstractDialog2
* );
122 DECL_LINK( DestroyThemePropertiesDlgHdl
, VclAbstractDialog2
* );
130 const ::boost::function
<sal_Bool(const KeyEvent
&,Window
*)>& rKeyInputHandler
,
131 const ::boost::function
<void(void)>& rThemeSlectionHandler
);
134 void SelectTheme( const String
& rThemeName
) { mpThemes
->SelectEntry( rThemeName
); SelectThemeHdl( NULL
); }
135 void SelectTheme( sal_uIntPtr nThemePos
) { mpThemes
->SelectEntryPos( (sal_uInt16
) nThemePos
); SelectThemeHdl( NULL
); }
136 String
GetSelectedTheme() { return mpThemes
->GetEntryCount() ? mpThemes
->GetEntry( mpThemes
->GetSelectEntryPos() ) : String(); }
138 void ShowContextMenu();
139 sal_Bool
KeyInput( const KeyEvent
& rKEvt
, Window
* pWindow
);
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */