xref: /AOO41X/main/svx/source/gallery2/galbrws1.hxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
13334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
33334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
43334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
53334a7e6SAndrew Rist  * distributed with this work for additional information
63334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
73334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
83334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
93334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
113334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
133334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
143334a7e6SAndrew Rist  * software distributed under the License is distributed on an
153334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
163334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
173334a7e6SAndrew Rist  * specific language governing permissions and limitations
183334a7e6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
203334a7e6SAndrew Rist  *************************************************************/
213334a7e6SAndrew Rist 
223334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <vcl/lstbox.hxx>
25cdf0e10cSrcweir #include <vcl/button.hxx>
26cdf0e10cSrcweir #include <vcl/menu.hxx>
27cdf0e10cSrcweir #include <svl/lstner.hxx>
28cdf0e10cSrcweir #include <vector>
29cdf0e10cSrcweir #include "svx/galbrws.hxx"
30cdf0e10cSrcweir 
31*02c50d82SAndre Fischer #include <boost/function.hpp>
32*02c50d82SAndre Fischer 
33cdf0e10cSrcweir // -----------------
34cdf0e10cSrcweir // - GalleryButton -
35cdf0e10cSrcweir // -----------------
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class GalleryButton : public PushButton
38cdf0e10cSrcweir {
39cdf0e10cSrcweir private:
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	virtual void	KeyInput( const KeyEvent& rKEvt );
42cdf0e10cSrcweir 
43cdf0e10cSrcweir public:
44cdf0e10cSrcweir 
45cdf0e10cSrcweir                     GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits );
46cdf0e10cSrcweir                     ~GalleryButton();
47cdf0e10cSrcweir };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // -----------------------
50cdf0e10cSrcweir // - GalleryThemeListBox -
51cdf0e10cSrcweir // -----------------------
52cdf0e10cSrcweir 
53cdf0e10cSrcweir class GalleryThemeListBox : public ListBox
54cdf0e10cSrcweir {
55cdf0e10cSrcweir protected:
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     void            InitSettings();
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
60cdf0e10cSrcweir 	virtual long	PreNotify( NotifyEvent& rNEvt );
61cdf0e10cSrcweir 
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 					GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits );
65cdf0e10cSrcweir 					~GalleryThemeListBox();
66cdf0e10cSrcweir };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // -------------------
69cdf0e10cSrcweir // - GalleryBrowser1 -
70cdf0e10cSrcweir // -------------------
71cdf0e10cSrcweir 
72cdf0e10cSrcweir class Gallery;
73cdf0e10cSrcweir class GalleryThemeEntry;
74cdf0e10cSrcweir class GalleryTheme;
75cdf0e10cSrcweir class VclAbstractDialog2;
76cdf0e10cSrcweir struct ExchangeData;
77cdf0e10cSrcweir class SfxItemSet;
78cdf0e10cSrcweir 
79*02c50d82SAndre Fischer namespace svx { namespace sidebar { class GalleryControl; } }
80*02c50d82SAndre Fischer 
81cdf0e10cSrcweir class GalleryBrowser1 : public Control, SfxListener
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	friend class GalleryBrowser;
84*02c50d82SAndre Fischer 	friend class svx::sidebar::GalleryControl;
85cdf0e10cSrcweir 	friend class GalleryThemeListBox;
86cdf0e10cSrcweir 	using Control::Notify;
87cdf0e10cSrcweir 	using Window::KeyInput;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir private:
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	GalleryButton           maNewTheme;
92cdf0e10cSrcweir 	GalleryThemeListBox*	mpThemes;
93cdf0e10cSrcweir 	Gallery*				mpGallery;
94cdf0e10cSrcweir     ExchangeData*           mpExchangeData;
95cdf0e10cSrcweir     SfxItemSet*             mpThemePropsDlgItemSet;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	Image					aImgNormal;
98cdf0e10cSrcweir 	Image					aImgDefault;
99cdf0e10cSrcweir 	Image					aImgReadOnly;
100cdf0e10cSrcweir 	Image					aImgImported;
101cdf0e10cSrcweir 
102*02c50d82SAndre Fischer     ::boost::function<sal_Bool(const KeyEvent&,Window*)> maKeyInputHandler;
103*02c50d82SAndre Fischer     ::boost::function<void(void)> maThemeSlectionHandler;
104*02c50d82SAndre Fischer 
105cdf0e10cSrcweir 	void					ImplAdjustControls();
106cdf0e10cSrcweir 	sal_uIntPtr					ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
107cdf0e10cSrcweir 	void					ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
108cdf0e10cSrcweir     void                    ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec);
109cdf0e10cSrcweir     void                    ImplExecute( sal_uInt16 nId );
110cdf0e10cSrcweir     void                    ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew );
111cdf0e10cSrcweir     void                    ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog, bool bCreateNew );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	// Control
114cdf0e10cSrcweir 	virtual void			Resize();
115cdf0e10cSrcweir 	virtual void			GetFocus();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// SfxListener
118cdf0e10cSrcweir 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 							DECL_LINK( ClickNewThemeHdl, void* );
121cdf0e10cSrcweir 							DECL_LINK( SelectThemeHdl, void* );
122cdf0e10cSrcweir 							DECL_LINK( ShowContextMenuHdl, void* );
123cdf0e10cSrcweir 							DECL_LINK( PopupMenuHdl, Menu* );
124cdf0e10cSrcweir                             DECL_LINK( EndNewThemePropertiesDlgHdl, VclAbstractDialog2* );
125cdf0e10cSrcweir                             DECL_LINK( EndThemePropertiesDlgHdl, VclAbstractDialog2* );
126cdf0e10cSrcweir                             DECL_LINK( DestroyThemePropertiesDlgHdl, VclAbstractDialog2* );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir public:
129cdf0e10cSrcweir 
130*02c50d82SAndre Fischer 							GalleryBrowser1(
131*02c50d82SAndre Fischer                                 Window* pParent,
132*02c50d82SAndre Fischer                                 const ResId& rResId,
133*02c50d82SAndre Fischer                                 Gallery* pGallery,
134*02c50d82SAndre Fischer                                 const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler,
135*02c50d82SAndre Fischer                                 const ::boost::function<void(void)>& rThemeSlectionHandler);
136cdf0e10cSrcweir     						~GalleryBrowser1();
137cdf0e10cSrcweir 
SelectTheme(const String & rThemeName)138cdf0e10cSrcweir 	void					SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
SelectTheme(sal_uIntPtr nThemePos)139cdf0e10cSrcweir 	void					SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); }
GetSelectedTheme()140cdf0e10cSrcweir 	String					GetSelectedTheme() { return mpThemes->GetEntryCount() ? mpThemes->GetEntry( mpThemes->GetSelectEntryPos() ) : String(); }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	void					ShowContextMenu();
143cdf0e10cSrcweir     sal_Bool                    KeyInput( const KeyEvent& rKEvt, Window* pWindow );
144cdf0e10cSrcweir };
145