merge the formfield patch from ooo-build
[ooovba.git] / svx / source / gallery2 / galbrws1.hxx
blob289ff4379c8989dad0084cba7b9be94f9875e9c8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: galbrws1.hxx,v $
10 * $Revision: 1.11 $
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>
35 #include <vector>
36 #include "galbrws.hxx"
38 // -----------------
39 // - GalleryButton -
40 // -----------------
42 class GalleryButton : public PushButton
44 private:
46 virtual void KeyInput( const KeyEvent& rKEvt );
48 public:
50 GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits );
51 ~GalleryButton();
54 // -----------------------
55 // - GalleryThemeListBox -
56 // -----------------------
58 class GalleryThemeListBox : public ListBox
60 protected:
62 void InitSettings();
64 virtual void DataChanged( const DataChangedEvent& rDCEvt );
65 virtual long PreNotify( NotifyEvent& rNEvt );
67 public:
69 GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits );
70 ~GalleryThemeListBox();
73 // -------------------
74 // - GalleryBrowser1 -
75 // -------------------
77 class Gallery;
78 class GalleryThemeEntry;
79 class GalleryTheme;
80 class VclAbstractDialog2;
81 struct ExchangeData;
82 class SfxItemSet;
84 class GalleryBrowser1 : public Control, SfxListener
86 friend class GalleryBrowser;
87 friend class GalleryThemeListBox;
88 using Control::Notify;
89 using Window::KeyInput;
91 private:
93 GalleryButton maNewTheme;
94 GalleryThemeListBox* mpThemes;
95 Gallery* mpGallery;
96 ExchangeData* mpExchangeData;
97 SfxItemSet* mpThemePropsDlgItemSet;
99 Image aImgNormal;
100 Image aImgDefault;
101 Image aImgReadOnly;
102 Image aImgImported;
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 );
112 // Control
113 virtual void Resize();
114 virtual void GetFocus();
116 // SfxListener
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* );
127 public:
129 GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
130 ~GalleryBrowser1();
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 );