Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : */
9 :
10 : #ifndef INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
11 : #define INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
12 :
13 : #include <sfx2/tabdlg.hxx>
14 : #include <salhelper/thread.hxx>
15 : #include <rtl/ref.hxx>
16 : #include <vcl/prgsbar.hxx>
17 :
18 : #include <vector>
19 :
20 : class FixedText;
21 : class SearchAndParseThread;
22 :
23 : class SvxPersonalizationTabPage : public SfxTabPage
24 : {
25 : using SfxTabPage::DeactivatePage;
26 :
27 : private:
28 : RadioButton *m_pNoPersona; ///< Just the default look, without any bitmap
29 : RadioButton *m_pDefaultPersona; ///< Use the built-in bitmap
30 : RadioButton *m_pOwnPersona; ///< Use the user-defined bitmap
31 : PushButton *m_pSelectPersona; ///< Let the user select in the 'own' case
32 : PushButton *m_vDefaultPersonaImages[3]; ///< Buttons to show the default persona images
33 : PushButton *m_pExtensionPersonaPreview; ///< Buttons to show the last 3 personas installed via extensions
34 : 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 : FixedText *m_pExtensionLabel; ///< The "select persona installed via extensions" label
37 :
38 : std::vector<OUString> m_vDefaultPersonaSettings;
39 : std::vector<OUString> m_vExtensionPersonaSettings;
40 :
41 : public:
42 : ::rtl::Reference< SearchAndParseThread > m_rApplyThread;
43 : SvxPersonalizationTabPage( vcl::Window *pParent, const SfxItemSet &rSet );
44 : virtual ~SvxPersonalizationTabPage();
45 :
46 : static SfxTabPage* Create( vcl::Window *pParent, const SfxItemSet *rSet );
47 :
48 : /// Apply the settings ([OK] button).
49 : virtual bool FillItemSet( SfxItemSet *rSet ) SAL_OVERRIDE;
50 :
51 : /// Reset to default settings ([Revert] button).
52 : virtual void Reset( const SfxItemSet *rSet ) SAL_OVERRIDE;
53 :
54 : void SetPersonaSettings( const OUString& );
55 :
56 : void LoadDefaultImages();
57 : void LoadExtensionThemes();
58 :
59 : private:
60 : /// Handle the Persona selection
61 : DECL_LINK( SelectPersona, PushButton* );
62 :
63 : /// When 'own' is chosen, but the Persona is not chosen yet.
64 : DECL_LINK( ForceSelect, RadioButton* );
65 :
66 : /// Handle the default Persona selection
67 : DECL_LINK( DefaultPersona, PushButton* );
68 :
69 : /// Handle the Personas installed through extensions selection
70 : DECL_LINK( SelectInstalledPersona, ListBox* );
71 : };
72 :
73 : /** Dialog that will allow the user to choose a Persona to use.
74 :
75 : So far there is no better possibility than just to paste the URL from
76 : https://addons.mozilla.org/firefox/themes ...
77 : */
78 0 : class SelectPersonaDialog : public ModalDialog
79 : {
80 : private:
81 : Edit *m_pEdit; ///< The input line for the search term
82 : PushButton *m_pSearchButton; ///< The search button
83 : FixedText *m_pProgressLabel; ///< The label for showing progress of search
84 : PushButton *m_vResultList[9]; ///< List of buttons to show search results
85 : PushButton *m_vSearchSuggestions[5]; ///< List of buttons for the search suggestions
86 : PushButton *m_pOkButton; ///< The OK button
87 : PushButton *m_pCancelButton; ///< The Cancel button
88 :
89 : std::vector<OUString> m_vPersonaSettings;
90 : OUString m_aSelectedPersona;
91 : OUString m_aAppliedPersona;
92 :
93 : public:
94 : SelectPersonaDialog( vcl::Window *pParent );
95 : ::rtl::Reference< SearchAndParseThread > m_rSearchThread;
96 :
97 : OUString GetSelectedPersona() const;
98 : void SetProgress( OUString& );
99 : void SetImages( Image, sal_Int32 );
100 : void AddPersonaSetting( OUString& );
101 : void ClearSearchResults();
102 : void SetAppliedPersonaSetting( OUString& );
103 : OUString GetAppliedPersonaSetting() const;
104 :
105 : private:
106 : /// Handle the Search button
107 : DECL_LINK( SearchPersonas, PushButton* );
108 : DECL_LINK( SelectPersona, PushButton* );
109 : DECL_LINK( ActionOK, PushButton* );
110 : DECL_LINK( ActionCancel, PushButton* );
111 : };
112 :
113 : class SearchAndParseThread: public salhelper::Thread
114 : {
115 : private:
116 :
117 : SelectPersonaDialog *m_pPersonaDialog;
118 : OUString m_aURL;
119 : bool m_bExecute;
120 :
121 : virtual ~SearchAndParseThread();
122 : virtual void execute() SAL_OVERRIDE;
123 : void getPreviewFile( const OUString&, OUString *, OUString * );
124 :
125 : public:
126 :
127 : SearchAndParseThread( SelectPersonaDialog* pDialog,
128 : const OUString& rURL );
129 :
130 0 : void StopExecution() { m_bExecute = false; }
131 : };
132 :
133 : #endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|