LCOV - code coverage report
Current view: top level - cui/source/inc - cuigaldlg.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 11 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 13 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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
      21             : #define INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include <salhelper/thread.hxx>
      26             : #include <vcl/dialog.hxx>
      27             : #include <vcl/graph.hxx>
      28             : #include <vcl/fixed.hxx>
      29             : #include <vcl/button.hxx>
      30             : #include <vcl/lstbox.hxx>
      31             : #include <vcl/menu.hxx>
      32             : #include <vcl/edit.hxx>
      33             : #include <vcl/combobox.hxx>
      34             : #include <vcl/idle.hxx>
      35             : #include <svl/slstitm.hxx>
      36             : #include <svtools/transfer.hxx>
      37             : #include <svtools/grfmgr.hxx>
      38             : #include <sfx2/tabdlg.hxx>
      39             : #include <svx/galctrl.hxx>
      40             : #include <svx/galmisc.hxx>
      41             : #include <com/sun/star/media/XPlayer.hpp>
      42             : #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
      43             : #include <svtools/dialogclosedlistener.hxx>
      44             : #include <vector>
      45             : 
      46             : class GalleryTheme;
      47             : class SearchProgress;
      48             : class TakeProgress;
      49             : class TPGalleryThemeProperties;
      50             : 
      51             : typedef ::std::vector< OUString > StringList;
      52             : typedef ::std::vector< sal_uLong > TokenList_impl;
      53             : 
      54           0 : struct FilterEntry
      55             : {
      56             :     OUString  aFilterName;
      57             : };
      58             : 
      59             : class SearchThread: public salhelper::Thread
      60             : {
      61             : private:
      62             : 
      63             :     VclPtr<SearchProgress>             mpProgress;
      64             :     VclPtr<TPGalleryThemeProperties>   mpBrowser;
      65             :     INetURLObject               maStartURL;
      66             : 
      67             :     void                        ImplSearch( const INetURLObject& rStartURL,
      68             :                                             const ::std::vector< OUString >& rFormats,
      69             :                                             bool bRecursive );
      70             : 
      71             :     virtual                     ~SearchThread();
      72             :     virtual void                execute() SAL_OVERRIDE;
      73             : 
      74             : public:
      75             : 
      76             :                                 SearchThread( SearchProgress* pProgess,
      77             :                                               TPGalleryThemeProperties* pBrowser,
      78             :                                               const INetURLObject& rStartURL );
      79             : };
      80             : 
      81             : class SearchProgress : public ModalDialog
      82             : {
      83             : private:
      84             :     VclPtr<FixedText>          m_pFtSearchDir;
      85             :     VclPtr<FixedText>          m_pFtSearchType;
      86             :     VclPtr<CancelButton>       m_pBtnCancel;
      87             :     VclPtr<vcl::Window>        parent_;
      88             :     INetURLObject startUrl_;
      89             :     rtl::Reference< SearchThread > maSearchThread;
      90             : 
      91             :                         DECL_LINK( ClickCancelBtn, void* );
      92             :     void                Terminate();
      93             : 
      94             : public:
      95             :                         SearchProgress( vcl::Window* pParent, const INetURLObject& rStartURL );
      96             :     virtual             ~SearchProgress();
      97             :     virtual void        dispose() SAL_OVERRIDE;
      98             : 
      99             :                         DECL_LINK( CleanUpHdl, void* );
     100             : 
     101             :     virtual short       Execute() SAL_OVERRIDE;
     102             :     virtual void        StartExecuteModal( const Link<>& rEndDialogHdl ) SAL_OVERRIDE;
     103           0 :     void                SetFileType( const OUString& rType ) { m_pFtSearchType->SetText( rType ); }
     104           0 :     void                SetDirectory( const INetURLObject& rURL ) { m_pFtSearchDir->SetText( GetReducedString( rURL, 30 ) ); }
     105             : };
     106             : 
     107             : class TakeThread: public salhelper::Thread
     108             : {
     109             : private:
     110             : 
     111             :     VclPtr<TakeProgress>               mpProgress;
     112             :     VclPtr<TPGalleryThemeProperties>   mpBrowser;
     113             :     TokenList_impl&             mrTakenList;
     114             : 
     115             :     virtual                     ~TakeThread();
     116             :     virtual void                execute() SAL_OVERRIDE;
     117             : 
     118             : public:
     119             : 
     120             :                                 TakeThread(
     121             :                                     TakeProgress* pProgess,
     122             :                                     TPGalleryThemeProperties* pBrowser,
     123             :                                     TokenList_impl& rTakenList
     124             :                                 );
     125             : };
     126             : 
     127             : class TakeProgress : public ModalDialog
     128             : {
     129             : private:
     130             :     VclPtr<FixedText>          m_pFtTakeFile;
     131             :     VclPtr<CancelButton>       m_pBtnCancel;
     132             :     VclPtr<vcl::Window>        window_;
     133             :     rtl::Reference< TakeThread > maTakeThread;
     134             :     TokenList_impl      maTakenList;
     135             : 
     136             :     DECL_LINK( ClickCancelBtn, void* );
     137             :     void                Terminate();
     138             : 
     139             : public:
     140             : 
     141             :     TakeProgress( vcl::Window* pWindow );
     142             :     virtual ~TakeProgress();
     143             :     virtual void dispose() SAL_OVERRIDE;
     144             : 
     145             :     DECL_LINK( CleanUpHdl, void* );
     146             : 
     147           0 :     void                SetFile( const INetURLObject& rURL ) { m_pFtTakeFile->SetText( GetReducedString( rURL, 30 ) ); }
     148             :     virtual short       Execute() SAL_OVERRIDE;
     149             :     virtual void        StartExecuteModal( const Link<>& rEndDialogHdl ) SAL_OVERRIDE;
     150             : };
     151             : 
     152             : class ActualizeProgress : public ModalDialog
     153             : {
     154             : private:
     155             :     VclPtr<FixedText>          m_pFtActualizeFile;
     156             :     VclPtr<CancelButton>       m_pBtnCancel;
     157             :     Idle*               pIdle;
     158             :     GalleryTheme*       pTheme;
     159             :     GalleryProgress     aStatusProgress;
     160             : 
     161             :                         DECL_LINK( ClickCancelBtn, void* );
     162             :                         DECL_LINK_TYPED( TimeoutHdl, Idle*, void );
     163             :                         DECL_LINK( ActualizeHdl, INetURLObject* pURL );
     164             : 
     165             : public:
     166             :                         ActualizeProgress( vcl::Window* pWindow, GalleryTheme* pThm );
     167             :     virtual             ~ActualizeProgress();
     168             :     virtual void        dispose() SAL_OVERRIDE;
     169             : 
     170             :     virtual short       Execute() SAL_OVERRIDE;
     171             : };
     172             : 
     173             : class TitleDialog : public ModalDialog
     174             : {
     175             : private:
     176             :     VclPtr<Edit> m_pEdit;
     177             : public:
     178             :     TitleDialog(vcl::Window* pParent, const OUString& rOldText);
     179             :     virtual ~TitleDialog();
     180             :     virtual void dispose() SAL_OVERRIDE;
     181           0 :     OUString GetTitle() const { return m_pEdit->GetText(); }
     182             : };
     183             : 
     184             : class GalleryIdDialog : public ModalDialog
     185             : {
     186             : private:
     187             :     VclPtr<OKButton> m_pBtnOk;
     188             :     VclPtr<ListBox> m_pLbResName;
     189             :     GalleryTheme*   pThm;
     190             : 
     191             :     DECL_LINK( ClickOkHdl, void* );
     192             :     DECL_LINK( ClickResNameHdl, void* );
     193             : public:
     194             :     GalleryIdDialog( vcl::Window* pParent, GalleryTheme* pThm );
     195             :     virtual ~GalleryIdDialog();
     196             :     virtual void dispose() SAL_OVERRIDE;
     197           0 :     sal_uLong GetId() const { return m_pLbResName->GetSelectEntryPos(); }
     198             : };
     199             : 
     200           0 : class GalleryThemeProperties : public SfxTabDialog
     201             : {
     202             :     ExchangeData*   pData;
     203             : 
     204             :     sal_uInt16 m_nGeneralPageId;
     205             :     sal_uInt16 m_nFilesPageId;
     206             : 
     207             :     virtual void PageCreated(sal_uInt16 nId, SfxTabPage &rPage) SAL_OVERRIDE;
     208             : 
     209             : public:
     210             :     GalleryThemeProperties(vcl::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet);
     211             : };
     212             : 
     213             : class TPGalleryThemeGeneral : public SfxTabPage
     214             : {
     215             : private:
     216             : 
     217             :     VclPtr<FixedImage>         m_pFiMSImage;
     218             :     VclPtr<Edit>               m_pEdtMSName;
     219             :     VclPtr<FixedText>          m_pFtMSShowType;
     220             :     VclPtr<FixedText>          m_pFtMSShowPath;
     221             :     VclPtr<FixedText>          m_pFtMSShowContent;
     222             :     VclPtr<FixedText>          m_pFtMSShowChangeDate;
     223             :     ExchangeData*       pData;
     224             : 
     225           0 :     virtual void        Reset( const SfxItemSet* ) SAL_OVERRIDE {}
     226             :     virtual bool        FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
     227             : 
     228             : 
     229             : public:
     230             : 
     231             :                         TPGalleryThemeGeneral( vcl::Window* pParent, const SfxItemSet& rSet );
     232             :     virtual             ~TPGalleryThemeGeneral();
     233             :     virtual void        dispose() SAL_OVERRIDE;
     234             : 
     235             :     void                SetXChgData( ExchangeData* pData );
     236             :     const ExchangeData* GetXChgData() const { return pData; }
     237             : 
     238             :     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rSet );
     239             : };
     240             : 
     241             : typedef ::std::vector< FilterEntry* > FilterEntryList_impl;
     242             : 
     243             : class TPGalleryThemeProperties : public SfxTabPage
     244             : {
     245             :     friend class SearchThread;
     246             :     friend class TakeProgress;
     247             :     friend class TakeThread;
     248             : 
     249             :     VclPtr<ComboBox>           m_pCbbFileType;
     250             :     VclPtr<ListBox>            m_pLbxFound;
     251             :     VclPtr<PushButton>         m_pBtnSearch;
     252             :     VclPtr<PushButton>         m_pBtnTake;
     253             :     VclPtr<PushButton>         m_pBtnTakeAll;
     254             :     VclPtr<CheckBox>           m_pCbxPreview;
     255             :     VclPtr<GalleryPreview>     m_pWndPreview;
     256             : 
     257             :     ExchangeData*           pData;
     258             :     StringList              aFoundList;
     259             :     FilterEntryList_impl    aFilterEntryList;
     260             :     Timer                   aPreviewTimer;
     261             :     OUString                aLastFilterName;
     262             :     OUString                aPreviewString;
     263             :     INetURLObject           aURL;
     264             :     sal_uInt16              nCurFilterPos;
     265             :     sal_uInt16              nFirstExtFilterPos;
     266             :     bool                bEntriesFound;
     267             :     bool                bInputAllowed;
     268             :     bool                bTakeAll;
     269             :     bool                bSearchRecursive;
     270             : 
     271             :     ::com::sun::star::uno::Reference< ::svt::DialogClosedListener >                  xDialogListener;
     272             :     ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer >             xMediaPlayer;
     273             :     ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker;
     274             : 
     275           0 :     virtual void        Reset( const SfxItemSet* /*rSet*/ ) SAL_OVERRIDE {}
     276           0 :     virtual bool        FillItemSet( SfxItemSet* /*rSet*/ ) SAL_OVERRIDE { return true; }
     277             :     static OUString     addExtension( const OUString&, const OUString& );
     278             :     void                FillFilterList();
     279             : 
     280             :     void                SearchFiles();
     281             :     void                TakeFiles();
     282             :     void                DoPreview();
     283             : 
     284             :                         DECL_LINK( ClickPreviewHdl, void* );
     285             :                         DECL_LINK( ClickSearchHdl, void* );
     286             :                         DECL_LINK( ClickTakeHdl, void* );
     287             :                         DECL_LINK( ClickTakeAllHdl, void* );
     288             :                         DECL_LINK( SelectFoundHdl, void* );
     289             :                         DECL_LINK( SelectThemeHdl, void* );
     290             :                         DECL_LINK( SelectFileTypeHdl, void* );
     291             :                         DECL_LINK( DClickFoundHdl, void* );
     292             :                         DECL_LINK_TYPED( PreviewTimerHdl, Timer*, void );
     293             :                         DECL_LINK(EndSearchProgressHdl, void *);
     294             :                         DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
     295             : 
     296             : public:
     297             :                         TPGalleryThemeProperties( vcl::Window* pWindow, const SfxItemSet& rSet );
     298             :                         virtual ~TPGalleryThemeProperties();
     299             :     virtual void        dispose() SAL_OVERRIDE;
     300             : 
     301             :     void                SetXChgData( ExchangeData* pData );
     302           0 :     const ExchangeData* GetXChgData() const { return pData; }
     303             : 
     304             :     void                StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult );
     305             : 
     306             :     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rSet );
     307             : };
     308             : 
     309             : #endif // INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
     310             : 
     311             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11