Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
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"
35 : :
36 : : // -----------------
37 : : // - GalleryButton -
38 : : // -----------------
39 : :
40 : : class GalleryButton : public PushButton
41 : : {
42 : : private:
43 : :
44 : : virtual void KeyInput( const KeyEvent& rKEvt );
45 : :
46 : : public:
47 : :
48 : : GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits );
49 : : ~GalleryButton();
50 : : };
51 : :
52 : : // -----------------------
53 : : // - GalleryThemeListBox -
54 : : // -----------------------
55 : :
56 : : class GalleryThemeListBox : public ListBox
57 : : {
58 : : protected:
59 : :
60 : : void InitSettings();
61 : :
62 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
63 : : virtual long PreNotify( NotifyEvent& rNEvt );
64 : :
65 : : public:
66 : :
67 : : GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits );
68 : : ~GalleryThemeListBox();
69 : : };
70 : :
71 : : // -------------------
72 : : // - GalleryBrowser1 -
73 : : // -------------------
74 : :
75 : : class Gallery;
76 : : class GalleryThemeEntry;
77 : : class GalleryTheme;
78 : : class VclAbstractDialog2;
79 : : struct ExchangeData;
80 : : class SfxItemSet;
81 : :
82 : : class GalleryBrowser1 : public Control, SfxListener
83 : : {
84 : : friend class GalleryBrowser;
85 : : friend class GalleryThemeListBox;
86 : : using Control::Notify;
87 : : using Window::KeyInput;
88 : :
89 : : private:
90 : :
91 : : GalleryButton maNewTheme;
92 : : GalleryThemeListBox* mpThemes;
93 : : Gallery* mpGallery;
94 : : ExchangeData* mpExchangeData;
95 : : SfxItemSet* mpThemePropsDlgItemSet;
96 : :
97 : : Image aImgNormal;
98 : : Image aImgDefault;
99 : : Image aImgReadOnly;
100 : : Image aImgImported;
101 : :
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 );
109 : :
110 : : // Control
111 : : virtual void Resize();
112 : : virtual void GetFocus();
113 : :
114 : : // SfxListener
115 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
116 : :
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* );
124 : :
125 : : public:
126 : :
127 : : GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
128 : : ~GalleryBrowser1();
129 : :
130 : : void SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
131 : 0 : void SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); }
132 [ # # ]: 0 : String GetSelectedTheme() { return mpThemes->GetEntryCount() ? mpThemes->GetEntry( mpThemes->GetSelectEntryPos() ) : String(); }
133 : :
134 : : void ShowContextMenu();
135 : : sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow );
136 : : };
137 : :
138 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|