Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / svx / source / gallery2 / galbrws1.hxx
blob5441b1fc6cf705d8821e8ea0834b336df7017310
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <vcl/lstbox.hxx>
30 #include <vcl/button.hxx>
31 #include <vcl/menu.hxx>
32 #include <svl/lstner.hxx>
33 #include <vector>
34 #include "svx/galbrws.hxx"
36 // -----------------
37 // - GalleryButton -
38 // -----------------
40 class GalleryButton : public PushButton
42 private:
44 virtual void KeyInput( const KeyEvent& rKEvt );
46 public:
48 GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits );
49 ~GalleryButton();
52 // -----------------------
53 // - GalleryThemeListBox -
54 // -----------------------
56 class GalleryThemeListBox : public ListBox
58 protected:
60 void InitSettings();
62 virtual void DataChanged( const DataChangedEvent& rDCEvt );
63 virtual long PreNotify( NotifyEvent& rNEvt );
65 public:
67 GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits );
68 ~GalleryThemeListBox();
71 // -------------------
72 // - GalleryBrowser1 -
73 // -------------------
75 class Gallery;
76 class GalleryThemeEntry;
77 class GalleryTheme;
78 class VclAbstractDialog2;
79 struct ExchangeData;
80 class SfxItemSet;
82 class GalleryBrowser1 : public Control, SfxListener
84 friend class GalleryBrowser;
85 friend class GalleryThemeListBox;
86 using Control::Notify;
87 using Window::KeyInput;
89 private:
91 GalleryButton maNewTheme;
92 GalleryThemeListBox* mpThemes;
93 Gallery* mpGallery;
94 ExchangeData* mpExchangeData;
95 SfxItemSet* mpThemePropsDlgItemSet;
97 Image aImgNormal;
98 Image aImgDefault;
99 Image aImgReadOnly;
100 Image aImgImported;
102 void ImplAdjustControls();
103 sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
104 void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
105 void ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec);
106 void ImplExecute( sal_uInt16 nId );
107 void ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew );
108 void ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog, bool bCreateNew );
110 // Control
111 virtual void Resize();
112 virtual void GetFocus();
114 // SfxListener
115 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
117 DECL_LINK( ClickNewThemeHdl, void* );
118 DECL_LINK( SelectThemeHdl, void* );
119 DECL_LINK( ShowContextMenuHdl, void* );
120 DECL_LINK( PopupMenuHdl, Menu* );
121 DECL_LINK( EndNewThemePropertiesDlgHdl, VclAbstractDialog2* );
122 DECL_LINK( EndThemePropertiesDlgHdl, VclAbstractDialog2* );
123 DECL_LINK( DestroyThemePropertiesDlgHdl, VclAbstractDialog2* );
125 public:
127 GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
128 ~GalleryBrowser1();
130 void SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
131 void SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); }
132 String GetSelectedTheme() { return mpThemes->GetEntryCount() ? mpThemes->GetEntry( mpThemes->GetSelectEntryPos() ) : String(); }
134 void ShowContextMenu();
135 sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow );
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */