1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: galbrws1.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <vcl/lstbox.hxx>
32 #include <vcl/button.hxx>
33 #include <vcl/menu.hxx>
34 #include <svtools/lstner.hxx>
36 #include "galbrws.hxx"
42 class GalleryButton
: public PushButton
46 virtual void KeyInput( const KeyEvent
& rKEvt
);
50 GalleryButton( GalleryBrowser1
* pParent
, WinBits nWinBits
);
54 // -----------------------
55 // - GalleryThemeListBox -
56 // -----------------------
58 class GalleryThemeListBox
: public ListBox
64 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
65 virtual long PreNotify( NotifyEvent
& rNEvt
);
69 GalleryThemeListBox( GalleryBrowser1
* pParent
, WinBits nWinBits
);
70 ~GalleryThemeListBox();
73 // -------------------
74 // - GalleryBrowser1 -
75 // -------------------
78 class GalleryThemeEntry
;
80 class VclAbstractDialog2
;
84 class GalleryBrowser1
: public Control
, SfxListener
86 friend class GalleryBrowser
;
87 friend class GalleryThemeListBox
;
88 using Control::Notify
;
89 using Window::KeyInput
;
93 GalleryButton maNewTheme
;
94 GalleryThemeListBox
* mpThemes
;
96 ExchangeData
* mpExchangeData
;
97 SfxItemSet
* mpThemePropsDlgItemSet
;
104 void ImplAdjustControls();
105 ULONG
ImplInsertThemeEntry( const GalleryThemeEntry
* pEntry
);
106 void ImplFillExchangeData( const GalleryTheme
* pThm
, ExchangeData
& rData
);
107 ::std::vector
< USHORT
> ImplGetExecuteVector();
108 void ImplExecute( USHORT nId
);
109 void ImplGalleryThemeProperties( const String
& rThemeName
, bool bCreateNew
);
110 void ImplEndGalleryThemeProperties( VclAbstractDialog2
* pDialog
, bool bCreateNew
);
113 virtual void Resize();
114 virtual void GetFocus();
117 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
119 DECL_LINK( ClickNewThemeHdl
, void* );
120 DECL_LINK( SelectThemeHdl
, void* );
121 DECL_LINK( ShowContextMenuHdl
, void* );
122 DECL_LINK( PopupMenuHdl
, Menu
* );
123 DECL_LINK( EndNewThemePropertiesDlgHdl
, VclAbstractDialog2
* );
124 DECL_LINK( EndThemePropertiesDlgHdl
, VclAbstractDialog2
* );
125 DECL_LINK( DestroyThemePropertiesDlgHdl
, VclAbstractDialog2
* );
129 GalleryBrowser1( GalleryBrowser
* pParent
, const ResId
& rResId
, Gallery
* pGallery
);
132 void SelectTheme( const String
& rThemeName
) { mpThemes
->SelectEntry( rThemeName
); SelectThemeHdl( NULL
); }
133 void SelectTheme( ULONG nThemePos
) { mpThemes
->SelectEntryPos( (USHORT
) nThemePos
); SelectThemeHdl( NULL
); }
134 String
GetSelectedTheme() { return mpThemes
->GetEntryCount() ? mpThemes
->GetEntry( mpThemes
->GetSelectEntryPos() ) : String(); }
136 void ShowContextMenu();
137 BOOL
KeyInput( const KeyEvent
& rKEvt
, Window
* pWindow
);