1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
11 #define INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
13 #include <sfx2/tabdlg.hxx>
14 #include <salhelper/thread.hxx>
15 #include <rtl/ref.hxx>
16 #include <vcl/prgsbar.hxx>
21 class SearchAndParseThread
;
23 class SvxPersonalizationTabPage
: public SfxTabPage
25 using SfxTabPage::DeactivatePage
;
28 VclPtr
<RadioButton
> m_pNoPersona
; ///< Just the default look, without any bitmap
29 VclPtr
<RadioButton
> m_pDefaultPersona
; ///< Use the built-in bitmap
30 VclPtr
<RadioButton
> m_pOwnPersona
; ///< Use the user-defined bitmap
31 VclPtr
<PushButton
> m_pSelectPersona
; ///< Let the user select in the 'own' case
32 VclPtr
<PushButton
> m_vDefaultPersonaImages
[3]; ///< Buttons to show the default persona images
33 VclPtr
<PushButton
> m_pExtensionPersonaPreview
; ///< Buttons to show the last 3 personas installed via extensions
34 VclPtr
<ListBox
> m_pPersonaList
; ///< The ListBox to show the list of installed personas
35 OUString m_aPersonaSettings
; ///< Header and footer images + color to be set in the settings.
36 VclPtr
<FixedText
> m_pExtensionLabel
; ///< The "select persona installed via extensions" label
38 std::vector
<OUString
> m_vDefaultPersonaSettings
;
39 std::vector
<OUString
> m_vExtensionPersonaSettings
;
42 ::rtl::Reference
< SearchAndParseThread
> m_rApplyThread
;
43 SvxPersonalizationTabPage( vcl::Window
*pParent
, const SfxItemSet
&rSet
);
44 virtual ~SvxPersonalizationTabPage();
45 virtual void dispose() SAL_OVERRIDE
;
47 static VclPtr
<SfxTabPage
> Create( vcl::Window
*pParent
, const SfxItemSet
*rSet
);
49 /// Apply the settings ([OK] button).
50 virtual bool FillItemSet( SfxItemSet
*rSet
) SAL_OVERRIDE
;
52 /// Reset to default settings ([Revert] button).
53 virtual void Reset( const SfxItemSet
*rSet
) SAL_OVERRIDE
;
55 void SetPersonaSettings( const OUString
& );
57 void LoadDefaultImages();
58 void LoadExtensionThemes();
61 /// Handle the Persona selection
62 DECL_LINK( SelectPersona
, PushButton
* );
64 /// When 'own' is chosen, but the Persona is not chosen yet.
65 DECL_LINK( ForceSelect
, RadioButton
* );
67 /// Handle the default Persona selection
68 DECL_LINK( DefaultPersona
, PushButton
* );
70 /// Handle the Personas installed through extensions selection
71 DECL_LINK( SelectInstalledPersona
, ListBox
* );
74 /** Dialog that will allow the user to choose a Persona to use.
76 So far there is no better possibility than just to paste the URL from
77 https://addons.mozilla.org/firefox/themes ...
79 class SelectPersonaDialog
: public ModalDialog
82 VclPtr
<Edit
> m_pEdit
; ///< The input line for the search term
83 VclPtr
<PushButton
> m_pSearchButton
; ///< The search button
84 VclPtr
<FixedText
> m_pProgressLabel
; ///< The label for showing progress of search
85 VclPtr
<PushButton
> m_vResultList
[9]; ///< List of buttons to show search results
86 VclPtr
<PushButton
> m_vSearchSuggestions
[5]; ///< List of buttons for the search suggestions
87 VclPtr
<PushButton
> m_pOkButton
; ///< The OK button
88 VclPtr
<PushButton
> m_pCancelButton
; ///< The Cancel button
90 std::vector
<OUString
> m_vPersonaSettings
;
91 OUString m_aSelectedPersona
;
92 OUString m_aAppliedPersona
;
95 SelectPersonaDialog( vcl::Window
*pParent
);
96 virtual ~SelectPersonaDialog();
97 virtual void dispose() SAL_OVERRIDE
;
98 ::rtl::Reference
< SearchAndParseThread
> m_rSearchThread
;
100 OUString
GetSelectedPersona() const;
101 void SetProgress( OUString
& );
102 void SetImages( Image
, sal_Int32
);
103 void AddPersonaSetting( OUString
& );
104 void ClearSearchResults();
105 void SetAppliedPersonaSetting( OUString
& );
106 OUString
GetAppliedPersonaSetting() const;
109 /// Handle the Search button
110 DECL_LINK( SearchPersonas
, PushButton
* );
111 DECL_LINK( SelectPersona
, PushButton
* );
112 DECL_LINK( ActionOK
, PushButton
* );
113 DECL_LINK( ActionCancel
, PushButton
* );
116 class SearchAndParseThread
: public salhelper::Thread
120 VclPtr
<SelectPersonaDialog
> m_pPersonaDialog
;
124 virtual ~SearchAndParseThread();
125 virtual void execute() SAL_OVERRIDE
;
126 void getPreviewFile( const OUString
&, OUString
*, OUString
* );
130 SearchAndParseThread( SelectPersonaDialog
* pDialog
,
131 const OUString
& rURL
);
133 void StopExecution() { m_bExecute
= false; }
136 #endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */