LCOV - code coverage report
Current view: top level - cui/source/options - personalization.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 1 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          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             :     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
      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             :     virtual void dispose() SAL_OVERRIDE;
      46             : 
      47             :     static VclPtr<SfxTabPage> Create( vcl::Window *pParent, const SfxItemSet *rSet );
      48             : 
      49             :     /// Apply the settings ([OK] button).
      50             :     virtual bool FillItemSet( SfxItemSet *rSet ) SAL_OVERRIDE;
      51             : 
      52             :     /// Reset to default settings ([Revert] button).
      53             :     virtual void Reset( const SfxItemSet *rSet ) SAL_OVERRIDE;
      54             : 
      55             :     void SetPersonaSettings( const OUString& );
      56             : 
      57             :     void LoadDefaultImages();
      58             :     void LoadExtensionThemes();
      59             : 
      60             : private:
      61             :     /// Handle the Persona selection
      62             :     DECL_LINK( SelectPersona, PushButton* );
      63             : 
      64             :     /// When 'own' is chosen, but the Persona is not chosen yet.
      65             :     DECL_LINK( ForceSelect, RadioButton* );
      66             : 
      67             :     /// Handle the default Persona selection
      68             :     DECL_LINK( DefaultPersona, PushButton* );
      69             : 
      70             :     /// Handle the Personas installed through extensions selection
      71             :     DECL_LINK( SelectInstalledPersona, ListBox* );
      72             : };
      73             : 
      74             : /** Dialog that will allow the user to choose a Persona to use.
      75             : 
      76             : So far there is no better possibility than just to paste the URL from
      77             : https://addons.mozilla.org/firefox/themes ...
      78             : */
      79             : class SelectPersonaDialog : public ModalDialog
      80             : {
      81             : private:
      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
      89             : 
      90             :     std::vector<OUString> m_vPersonaSettings;
      91             :     OUString m_aSelectedPersona;
      92             :     OUString m_aAppliedPersona;
      93             : 
      94             : public:
      95             :     SelectPersonaDialog( vcl::Window *pParent );
      96             :     virtual ~SelectPersonaDialog();
      97             :     virtual void dispose() SAL_OVERRIDE;
      98             :     ::rtl::Reference< SearchAndParseThread > m_rSearchThread;
      99             : 
     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;
     107             : 
     108             : private:
     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* );
     114             : };
     115             : 
     116             : class SearchAndParseThread: public salhelper::Thread
     117             : {
     118             : private:
     119             : 
     120             :     VclPtr<SelectPersonaDialog> m_pPersonaDialog;
     121             :     OUString m_aURL;
     122             :     bool m_bExecute;
     123             : 
     124             :     virtual ~SearchAndParseThread();
     125             :     virtual void execute() SAL_OVERRIDE;
     126             :     void getPreviewFile( const OUString&, OUString *, OUString * );
     127             : 
     128             : public:
     129             : 
     130             :     SearchAndParseThread( SelectPersonaDialog* pDialog,
     131             :                           const OUString& rURL );
     132             : 
     133           0 :     void StopExecution() { m_bExecute = false; }
     134             : };
     135             : 
     136             : #endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11