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>
34 #include "svx/galbrws.hxx"
40 class GalleryButton
: public PushButton
44 virtual void KeyInput( const KeyEvent
& rKEvt
);
48 GalleryButton( GalleryBrowser1
* pParent
, WinBits nWinBits
);
52 // -----------------------
53 // - GalleryThemeListBox -
54 // -----------------------
56 class GalleryThemeListBox
: public ListBox
62 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
63 virtual long PreNotify( NotifyEvent
& rNEvt
);
67 GalleryThemeListBox( GalleryBrowser1
* pParent
, WinBits nWinBits
);
68 ~GalleryThemeListBox();
71 // -------------------
72 // - GalleryBrowser1 -
73 // -------------------
76 class GalleryThemeEntry
;
78 class VclAbstractDialog2
;
82 class GalleryBrowser1
: public Control
, SfxListener
84 friend class GalleryBrowser
;
85 friend class GalleryThemeListBox
;
86 using Control::Notify
;
87 using Window::KeyInput
;
91 GalleryButton maNewTheme
;
92 GalleryThemeListBox
* mpThemes
;
94 ExchangeData
* mpExchangeData
;
95 SfxItemSet
* mpThemePropsDlgItemSet
;
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
);
111 virtual void Resize();
112 virtual void GetFocus();
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
* );
127 GalleryBrowser1( GalleryBrowser
* pParent
, const ResId
& rResId
, Gallery
* pGallery
);
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: */