2012-11-29 13:05:39 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
2013-10-28 03:46:16 +01:00
|
|
|
#ifndef INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
|
|
|
|
#define INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
|
2012-11-29 13:05:39 +01:00
|
|
|
|
|
|
|
#include <sfx2/tabdlg.hxx>
|
2014-05-21 11:38:21 +05:30
|
|
|
#include <salhelper/thread.hxx>
|
|
|
|
#include <rtl/ref.hxx>
|
|
|
|
#include <vcl/prgsbar.hxx>
|
2012-11-29 13:05:39 +01:00
|
|
|
|
2014-05-22 20:48:34 +05:30
|
|
|
#include <vector>
|
|
|
|
|
2012-11-29 13:05:39 +01:00
|
|
|
class FixedText;
|
2014-05-21 11:38:21 +05:30
|
|
|
class SearchAndParseThread;
|
2012-11-29 13:05:39 +01:00
|
|
|
|
|
|
|
class SvxPersonalizationTabPage : public SfxTabPage
|
|
|
|
{
|
|
|
|
using SfxTabPage::DeactivatePage;
|
|
|
|
|
|
|
|
private:
|
2014-07-01 18:27:42 +05:30
|
|
|
RadioButton *m_pNoPersona; ///< Just the default look, without any bitmap
|
|
|
|
RadioButton *m_pDefaultPersona; ///< Use the built-in bitmap
|
|
|
|
RadioButton *m_pOwnPersona; ///< Use the user-defined bitmap
|
|
|
|
PushButton *m_pSelectPersona; ///< Let the user select in the 'own' case
|
|
|
|
PushButton *m_vDefaultPersonaImages[3]; ///< Buttons to show the default persona images
|
|
|
|
PushButton *m_pExtensionPersonaPreview; ///< Buttons to show the last 3 personas installed via extensions
|
|
|
|
ListBox* m_pPersonaList; ///< The ListBox to show the list of installed personas
|
|
|
|
OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings.
|
2014-07-08 22:09:30 +05:30
|
|
|
FixedText *m_pExtensionLabel; ///< The "select persona installed via extensions" label
|
2012-11-29 13:05:39 +01:00
|
|
|
|
2014-06-19 18:49:36 +05:30
|
|
|
std::vector<OUString> m_vDefaultPersonaSettings;
|
2014-06-27 23:52:42 +05:30
|
|
|
std::vector<OUString> m_vExtensionPersonaSettings;
|
2014-06-19 18:49:36 +05:30
|
|
|
|
2012-11-29 13:05:39 +01:00
|
|
|
public:
|
2014-06-12 17:13:33 +05:30
|
|
|
::rtl::Reference< SearchAndParseThread > m_rApplyThread;
|
2014-09-23 11:20:40 +02:00
|
|
|
SvxPersonalizationTabPage( vcl::Window *pParent, const SfxItemSet &rSet );
|
2014-04-01 19:18:35 +02:00
|
|
|
virtual ~SvxPersonalizationTabPage();
|
2012-11-29 13:05:39 +01:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
static SfxTabPage* Create( vcl::Window *pParent, const SfxItemSet *rSet );
|
2012-11-30 09:44:17 +01:00
|
|
|
|
2012-12-03 14:43:43 +01:00
|
|
|
/// Apply the settings ([OK] button).
|
2014-06-10 17:23:12 +02:00
|
|
|
virtual bool FillItemSet( SfxItemSet *rSet ) SAL_OVERRIDE;
|
2012-12-03 14:43:43 +01:00
|
|
|
|
|
|
|
/// Reset to default settings ([Revert] button).
|
2014-06-11 10:35:24 +02:00
|
|
|
virtual void Reset( const SfxItemSet *rSet ) SAL_OVERRIDE;
|
2012-11-30 09:44:17 +01:00
|
|
|
|
2014-08-15 02:26:53 +03:00
|
|
|
void SetPersonaSettings( const OUString& );
|
2014-06-19 18:49:36 +05:30
|
|
|
|
|
|
|
void LoadDefaultImages();
|
2014-07-01 18:27:42 +05:30
|
|
|
void LoadExtensionThemes();
|
2014-06-12 17:13:33 +05:30
|
|
|
|
2012-12-03 14:43:43 +01:00
|
|
|
private:
|
2012-11-30 09:44:17 +01:00
|
|
|
/// Handle the Persona selection
|
|
|
|
DECL_LINK( SelectPersona, PushButton* );
|
2012-12-06 08:04:48 +01:00
|
|
|
|
2013-05-10 10:47:53 +02:00
|
|
|
/// When 'own' is chosen, but the Persona is not chosen yet.
|
2012-12-06 08:29:02 +01:00
|
|
|
DECL_LINK( ForceSelect, RadioButton* );
|
2014-06-19 18:49:36 +05:30
|
|
|
|
|
|
|
/// Handle the default Persona selection
|
|
|
|
DECL_LINK( DefaultPersona, PushButton* );
|
2014-07-01 15:30:44 +05:30
|
|
|
|
|
|
|
/// Handle the Personas installed through extensions selection
|
2014-07-01 18:27:42 +05:30
|
|
|
DECL_LINK( SelectInstalledPersona, ListBox* );
|
2012-11-29 13:05:39 +01:00
|
|
|
};
|
|
|
|
|
2014-05-19 19:56:44 +05:30
|
|
|
/** Dialog that will allow the user to choose a Persona to use.
|
|
|
|
|
|
|
|
So far there is no better possibility than just to paste the URL from
|
|
|
|
https://addons.mozilla.org/firefox/themes ...
|
|
|
|
*/
|
|
|
|
class SelectPersonaDialog : public ModalDialog
|
|
|
|
{
|
|
|
|
private:
|
2014-06-07 13:01:29 +05:30
|
|
|
Edit *m_pEdit; ///< The input line for the search term
|
|
|
|
PushButton *m_pSearchButton; ///< The search button
|
|
|
|
FixedText *m_pProgressLabel; ///< The label for showing progress of search
|
|
|
|
PushButton *m_vResultList[9]; ///< List of buttons to show search results
|
2014-06-21 09:16:16 +05:30
|
|
|
PushButton *m_vSearchSuggestions[5]; ///< List of buttons for the search suggestions
|
2014-06-13 22:54:45 +05:30
|
|
|
PushButton *m_pOkButton; ///< The OK button
|
|
|
|
PushButton *m_pCancelButton; ///< The Cancel button
|
2014-06-07 13:01:29 +05:30
|
|
|
|
|
|
|
std::vector<OUString> m_vPersonaSettings;
|
|
|
|
OUString m_aSelectedPersona;
|
2014-06-13 22:54:45 +05:30
|
|
|
OUString m_aAppliedPersona;
|
2014-05-19 19:56:44 +05:30
|
|
|
|
|
|
|
public:
|
2014-09-23 11:20:40 +02:00
|
|
|
SelectPersonaDialog( vcl::Window *pParent );
|
2014-06-12 17:13:33 +05:30
|
|
|
::rtl::Reference< SearchAndParseThread > m_rSearchThread;
|
2014-05-19 19:56:44 +05:30
|
|
|
|
2014-06-08 20:33:50 +05:30
|
|
|
OUString GetSelectedPersona() const;
|
2014-05-22 20:48:34 +05:30
|
|
|
void SetProgress( OUString& );
|
2014-06-20 15:38:26 +05:30
|
|
|
void SetImages( Image, sal_Int32 );
|
2014-06-08 20:33:50 +05:30
|
|
|
void AddPersonaSetting( OUString& );
|
2014-06-13 13:42:25 +05:30
|
|
|
void ClearSearchResults();
|
2014-06-13 22:54:45 +05:30
|
|
|
void SetAppliedPersonaSetting( OUString& );
|
|
|
|
OUString GetAppliedPersonaSetting() const;
|
2014-05-19 19:56:44 +05:30
|
|
|
|
|
|
|
private:
|
2014-06-07 13:01:29 +05:30
|
|
|
/// Handle the Search button
|
2014-06-08 20:33:50 +05:30
|
|
|
DECL_LINK( SearchPersonas, PushButton* );
|
|
|
|
DECL_LINK( SelectPersona, PushButton* );
|
2014-06-13 22:54:45 +05:30
|
|
|
DECL_LINK( ActionOK, PushButton* );
|
|
|
|
DECL_LINK( ActionCancel, PushButton* );
|
2014-05-19 19:56:44 +05:30
|
|
|
};
|
|
|
|
|
2014-05-21 11:38:21 +05:30
|
|
|
class SearchAndParseThread: public salhelper::Thread
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
SelectPersonaDialog *m_pPersonaDialog;
|
|
|
|
OUString m_aURL;
|
2014-07-10 23:23:12 +05:30
|
|
|
bool m_bExecute;
|
2014-05-19 19:56:44 +05:30
|
|
|
|
2014-05-21 11:38:21 +05:30
|
|
|
virtual ~SearchAndParseThread();
|
|
|
|
virtual void execute() SAL_OVERRIDE;
|
2014-06-08 20:33:50 +05:30
|
|
|
void getPreviewFile( const OUString&, OUString *, OUString * );
|
2014-05-21 11:38:21 +05:30
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SearchAndParseThread( SelectPersonaDialog* pDialog,
|
|
|
|
const OUString& rURL );
|
2014-07-10 23:23:12 +05:30
|
|
|
|
|
|
|
void StopExecution() { m_bExecute = false; }
|
2014-05-21 11:38:21 +05:30
|
|
|
};
|
2014-05-19 19:56:44 +05:30
|
|
|
|
2013-10-28 03:46:16 +01:00
|
|
|
#endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
|
2012-11-29 13:05:39 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|