summaryrefslogtreecommitdiff
path: root/cui/source/options/personalization.hxx
blob: 1a172939d3301a6d4673d1587a80776676694d17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* -*- 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/.
 */

#ifndef INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
#define INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX

#include <sfx2/tabdlg.hxx>
#include <salhelper/thread.hxx>
#include <rtl/ref.hxx>
#include <vcl/prgsbar.hxx>

#include <vector>

class FixedText;
class SearchAndParseThread;

class SvxPersonalizationTabPage : public SfxTabPage
{
    using SfxTabPage::DeactivatePage;

private:
    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
    OUString m_aPersonaSettings;            ///< Header and footer images + color to be set in the settings.

public:
    SvxPersonalizationTabPage( Window *pParent, const SfxItemSet &rSet );
    virtual ~SvxPersonalizationTabPage();

    static SfxTabPage* Create( Window *pParent, const SfxItemSet *rSet );

    /// Apply the settings ([OK] button).
    virtual bool FillItemSet( SfxItemSet *rSet ) SAL_OVERRIDE;

    /// Reset to default settings ([Revert] button).
    virtual void Reset( const SfxItemSet *rSet ) SAL_OVERRIDE;

private:
    /// Handle the Persona selection
    DECL_LINK( SelectPersona, PushButton* );

    /// When 'own' is chosen, but the Persona is not chosen yet.
    DECL_LINK( ForceSelect, RadioButton* );

    /// Download the bitmaps + color settings, and copy them to user's profile.
    bool CopyPersonaToGallery( const OUString &rURL );
};

/** 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:
    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

    std::vector<OUString> m_vPersonaSettings;
    OUString m_aSelectedPersona;

public:
    SelectPersonaDialog( Window *pParent );
    ::rtl::Reference< SearchAndParseThread > m_aSearchThread;

    OUString GetSelectedPersona() const;
    void SetProgress( OUString& );
    void SetImages( std::vector<Image>&);
    void AddPersonaSetting( OUString& );

private:
    /// Handle the Search button
    DECL_LINK( SearchPersonas, PushButton* );
    DECL_LINK( SelectPersona, PushButton* );
};

class SearchAndParseThread: public salhelper::Thread
{
private:

    SelectPersonaDialog *m_pPersonaDialog;
    OUString m_aURL;

    virtual ~SearchAndParseThread();
    virtual void execute() SAL_OVERRIDE;
    void getPreviewFile( const OUString&, OUString *, OUString * );

public:

    SearchAndParseThread( SelectPersonaDialog* pDialog,
                          const OUString& rURL );
};

#endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */