LibreOffice Module cui (master)  1
cuigaldlg.hxx
Go to the documentation of this file.
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 <tools/urlobj.hxx>
27 #include <vcl/idle.hxx>
28 #include <sfx2/tabdlg.hxx>
29 #include <svx/galctrl.hxx>
30 #include <svx/galmisc.hxx>
31 #include <com/sun/star/media/XPlayer.hpp>
32 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
34 #include <vector>
35 
36 class GalleryTheme;
37 class SearchProgress;
38 class TakeProgress;
40 
41 typedef std::vector< sal_uLong > TokenList_impl;
42 
43 struct FilterEntry
44 {
45  OUString aFilterName;
46 };
47 
49 {
50 private:
51 
55 
56  void ImplSearch( const INetURLObject& rStartURL,
57  const std::vector< OUString >& rFormats,
58  bool bRecursive );
59 
60  virtual ~SearchThread() override;
61  virtual void execute() override;
62 
63 public:
64 
65  SearchThread(SearchProgress* pProgress,
66  TPGalleryThemeProperties* pBrowser,
67  const INetURLObject& rStartURL);
68 };
69 
71 {
72 private:
76  std::unique_ptr<weld::Label> m_xFtSearchDir;
77  std::unique_ptr<weld::Label> m_xFtSearchType;
78  std::unique_ptr<weld::Button> m_xBtnCancel;
79 
80  DECL_LINK(ClickCancelBtn, weld::Button&, void);
81 
82 public:
83  SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL);
84  void LaunchThread();
85  virtual ~SearchProgress() override;
86 
87  DECL_LINK( CleanUpHdl, void*, void );
88 
89  void SetFileType( const OUString& rType ) { m_xFtSearchType->set_label(rType); }
90  void SetDirectory( const INetURLObject& rURL ) { m_xFtSearchDir->set_label(GetReducedString(rURL, 30)); }
91 };
92 
94 {
95 private:
96 
100 
101  virtual ~TakeThread() override;
102  virtual void execute() override;
103 
104 public:
105 
106  TakeThread(
107  TakeProgress* pProgress,
108  TPGalleryThemeProperties* pBrowser,
109  TokenList_impl& rTakenList
110  );
111 };
112 
114 {
115 private:
120  std::unique_ptr<weld::Label> m_xFtTakeFile;
121  std::unique_ptr<weld::Button> m_xBtnCancel;
122 
123  DECL_LINK(ClickCancelBtn, weld::Button&, void);
124 
125 public:
126 
128  void LaunchThread();
129  virtual ~TakeProgress() override;
130 
131  DECL_LINK( CleanUpHdl, void*, void );
132 
133  void SetFile( const INetURLObject& rURL ) { m_xFtTakeFile->set_label(GetReducedString(rURL, 30)); }
134 };
135 
137 {
138 private:
142  std::unique_ptr<weld::Label> m_xFtActualizeFile;
143  std::unique_ptr<weld::Button> m_xBtnCancel;
144 
145  DECL_LINK(ClickCancelBtn, weld::Button&, void);
146  DECL_LINK(TimeoutHdl, Timer*, void);
147  DECL_LINK(ActualizeHdl, const INetURLObject&, void);
148 
149 public:
151  virtual ~ActualizeProgress() override;
152 
153  virtual short run() override;
154 };
155 
157 {
158 private:
159  std::unique_ptr<weld::Entry> m_xEdit;
160 public:
161  TitleDialog(weld::Window* pParent, const OUString& rOldText);
162  virtual ~TitleDialog() override;
163  OUString GetTitle() const { return m_xEdit->get_text(); }
164 };
165 
167 {
168 private:
170  std::unique_ptr<weld::Button> m_xBtnOk;
171  std::unique_ptr<weld::ComboBox> m_xLbResName;
172 
173  DECL_LINK(ClickOkHdl, weld::Button&, void);
174 public:
175  GalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm);
176  virtual ~GalleryIdDialog() override;
177  sal_uInt32 GetId() const { return m_xLbResName->get_active(); }
178 };
179 
181 {
183 
184  virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
185 
186 public:
187  GalleryThemeProperties(weld::Window* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
188 };
189 
191 {
192 private:
194 
195  std::unique_ptr<weld::Image> m_xFiMSImage;
196  std::unique_ptr<weld::Entry> m_xEdtMSName;
197  std::unique_ptr<weld::Label> m_xFtMSShowType;
198  std::unique_ptr<weld::Label> m_xFtMSShowPath;
199  std::unique_ptr<weld::Label> m_xFtMSShowContent;
200  std::unique_ptr<weld::Label> m_xFtMSShowChangeDate;
201 
202  virtual void Reset( const SfxItemSet* ) override {}
203  virtual bool FillItemSet( SfxItemSet* rSet ) override;
204 
205 public:
206  TPGalleryThemeGeneral(TabPageParent pParent, const SfxItemSet& rSet);
207  void SetXChgData( ExchangeData* pData );
208  static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet );
209 };
210 
212 {
213  friend class SearchThread;
214  friend class TakeProgress;
215  friend class TakeThread;
216 
218  std::vector<OUString> aFoundList;
219  std::vector< std::unique_ptr<FilterEntry> >
222  OUString aLastFilterName;
223  OUString aPreviewString;
227  bool bTakeAll;
229 
231  css::uno::Reference< css::media::XPlayer > xMediaPlayer;
232  css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
233 
235  std::unique_ptr<weld::ComboBox> m_xCbbFileType;
236  std::unique_ptr<weld::TreeView> m_xLbxFound;
237  std::unique_ptr<weld::Button> m_xBtnSearch;
238  std::unique_ptr<weld::Button> m_xBtnTake;
239  std::unique_ptr<weld::Button> m_xBtnTakeAll;
240  std::unique_ptr<weld::CheckButton> m_xCbxPreview;
241  std::unique_ptr<weld::CustomWeld> m_xWndPreview;
242 
243  virtual void Reset( const SfxItemSet* /*rSet*/ ) override {}
244  virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) override { return true; }
245  static OUString addExtension( const OUString&, const OUString& );
246  void FillFilterList();
247 
248  void SearchFiles();
249  void TakeFiles();
250  void DoPreview();
251  void EndSearchProgressHdl(sal_Int32 nResult);
252 
253  DECL_LINK(ClickPreviewHdl, weld::ToggleButton&, void);
254  DECL_LINK(ClickSearchHdl, weld::Button&, void);
255  DECL_LINK(ClickTakeHdl, weld::Button&, void);
256  DECL_LINK(ClickTakeAllHdl, weld::Button&, void);
257  DECL_LINK(SelectFoundHdl, weld::TreeView&, void);
258  DECL_LINK(SelectFileTypeHdl, weld::ComboBox&, void);
259  DECL_LINK(DClickFoundHdl, weld::TreeView&, void);
260  DECL_LINK(PreviewTimerHdl, Timer*, void);
261  DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
262 
263 public:
264  TPGalleryThemeProperties(TabPageParent pWindow, const SfxItemSet& rSet);
265  virtual ~TPGalleryThemeProperties() override;
266  virtual void dispose() override;
267 
268  void SetXChgData( ExchangeData* pData );
269  const ExchangeData* GetXChgData() const { return pData; }
270 
271  void StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult );
272 
273  static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet);
274 };
275 
276 #endif // INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
277 
278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_xCbbFileType
Definition: cuigaldlg.hxx:235
sal_uInt32 GetId() const
Definition: cuigaldlg.hxx:177
ExchangeData * pData
Definition: cuigaldlg.hxx:182
std::unique_ptr< weld::Button > m_xBtnOk
Definition: cuigaldlg.hxx:170
OUString GetReducedString(const INetURLObject &rURL, sal_Int32 nMaxLen)
DECL_LINK(ClickCancelBtn, weld::Button &, void)
TitleDialog(weld::Window *pParent, const OUString &rOldText)
Definition: cuigaldlg.cxx:419
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: cuigaldlg.hxx:78
css::uno::Reference< css::media::XPlayer > xMediaPlayer
Definition: cuigaldlg.hxx:231
const ExchangeData * GetXChgData() const
Definition: cuigaldlg.hxx:269
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: cuigaldlg.cxx:650
std::unique_ptr< weld::CheckButton > m_xCbxPreview
Definition: cuigaldlg.hxx:240
SearchProgress(weld::Window *pParent, TPGalleryThemeProperties *pTabPage, const INetURLObject &rStartURL)
Definition: cuigaldlg.cxx:189
SvxGalleryPreview m_aWndPreview
Definition: cuigaldlg.hxx:234
virtual void Reset(const SfxItemSet *) override
Definition: cuigaldlg.hxx:202
weld::Window * m_pParent
Definition: cuigaldlg.hxx:116
VclPtr< TPGalleryThemeProperties > m_xTabPage
Definition: cuigaldlg.hxx:117
std::unique_ptr< weld::Image > m_xFiMSImage
Definition: cuigaldlg.hxx:195
virtual short run() override
Definition: cuigaldlg.cxx:385
TakeProgress(weld::Window *pParent, TPGalleryThemeProperties *pTabPage)
Definition: cuigaldlg.cxx:290
TakeThread(TakeProgress *pProgress, TPGalleryThemeProperties *pBrowser, TokenList_impl &rTakenList)
Definition: cuigaldlg.cxx:226
void StartSearchFiles(const OUString &_rFolderURL, short _nDlgResult)
Definition: cuigaldlg.cxx:627
TPGalleryThemeProperties(TabPageParent pWindow, const SfxItemSet &rSet)
Definition: cuigaldlg.cxx:582
void SetXChgData(ExchangeData *pData)
Definition: cuigaldlg.cxx:519
std::unique_ptr< weld::Label > m_xFtMSShowContent
Definition: cuigaldlg.hxx:199
rtl::Reference< ::svt::DialogClosedListener > xDialogListener
Definition: cuigaldlg.hxx:230
TPGalleryThemeGeneral(TabPageParent pParent, const SfxItemSet &rSet)
Definition: cuigaldlg.cxx:507
virtual ~TitleDialog() override
Definition: cuigaldlg.cxx:427
virtual ~SearchProgress() override
Definition: cuigaldlg.cxx:201
DECL_LINK(ClickOkHdl, weld::Button &, void)
void SetFileType(const OUString &rType)
Definition: cuigaldlg.hxx:89
void SetXChgData(ExchangeData *pData)
Definition: cuigaldlg.cxx:604
std::unique_ptr< weld::Label > m_xFtMSShowChangeDate
Definition: cuigaldlg.hxx:200
ExchangeData * pData
Definition: cuigaldlg.hxx:217
ExchangeData * pData
Definition: cuigaldlg.hxx:193
rtl::Reference< TakeThread > maTakeThread
Definition: cuigaldlg.hxx:118
css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker
Definition: cuigaldlg.hxx:232
TokenList_impl & mrTakenList
Definition: cuigaldlg.hxx:99
virtual ~GalleryIdDialog() override
Definition: cuigaldlg.cxx:447
std::unique_ptr< weld::Label > m_xFtActualizeFile
Definition: cuigaldlg.hxx:142
DECL_LINK(ClickPreviewHdl, weld::ToggleButton &, void)
std::unique_ptr< weld::Label > m_xFtMSShowPath
Definition: cuigaldlg.hxx:198
DECL_LINK(ClickCancelBtn, weld::Button &, void)
static OUString addExtension(const OUString &, const OUString &)
Definition: cuigaldlg.cxx:655
virtual ~ActualizeProgress() override
Definition: cuigaldlg.cxx:381
std::vector< OUString > aFoundList
Definition: cuigaldlg.hxx:218
GalleryTheme * pTheme
Definition: cuigaldlg.hxx:140
INetURLObject maStartURL
Definition: cuigaldlg.hxx:54
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: cuigaldlg.hxx:143
void SetDirectory(const INetURLObject &rURL)
Definition: cuigaldlg.hxx:90
TokenList_impl maTakenList
Definition: cuigaldlg.hxx:119
VclPtr< TPGalleryThemeProperties > m_xTabPage
Definition: cuigaldlg.hxx:74
virtual void execute() override
Definition: cuigaldlg.cxx:78
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: cuigaldlg.hxx:121
void SetFile(const INetURLObject &rURL)
Definition: cuigaldlg.hxx:133
VclPtr< TPGalleryThemeProperties > mpBrowser
Definition: cuigaldlg.hxx:53
DECL_LINK(ClickCancelBtn, weld::Button &, void)
std::unique_ptr< weld::TreeView > m_xLbxFound
Definition: cuigaldlg.hxx:236
std::unique_ptr< weld::Button > m_xBtnTakeAll
Definition: cuigaldlg.hxx:239
virtual bool FillItemSet(SfxItemSet *) override
Definition: cuigaldlg.hxx:244
std::unique_ptr< weld::Entry > m_xEdit
Definition: cuigaldlg.hxx:159
ActualizeProgress(weld::Window *pWindow, GalleryTheme *pThm)
Definition: cuigaldlg.cxx:370
void LaunchThread()
Definition: cuigaldlg.cxx:219
std::unique_ptr< weld::ComboBox > m_xLbResName
Definition: cuigaldlg.hxx:171
void LaunchThread()
Definition: cuigaldlg.cxx:363
std::vector< std::unique_ptr< FilterEntry > > aFilterEntryList
Definition: cuigaldlg.hxx:220
std::unique_ptr< weld::CustomWeld > m_xWndPreview
Definition: cuigaldlg.hxx:241
virtual void execute() override
Definition: cuigaldlg.cxx:243
virtual ~TakeThread() override
Definition: cuigaldlg.cxx:239
TakeProgress * mpProgress
Definition: cuigaldlg.hxx:97
std::unique_ptr< weld::Button > m_xBtnSearch
Definition: cuigaldlg.hxx:237
GalleryThemeProperties(weld::Window *pParent, ExchangeData *pData, SfxItemSet const *pItemSet)
Definition: cuigaldlg.cxx:480
virtual void dispose() override
Definition: cuigaldlg.cxx:642
virtual ~TPGalleryThemeProperties() override
Definition: cuigaldlg.cxx:637
GalleryIdDialog(weld::Window *pParent, GalleryTheme *pThm)
Definition: cuigaldlg.cxx:431
std::unique_ptr< weld::Label > m_xFtTakeFile
Definition: cuigaldlg.hxx:120
std::unique_ptr< weld::Label > m_xFtSearchType
Definition: cuigaldlg.hxx:77
std::unique_ptr< weld::Entry > m_xEdtMSName
Definition: cuigaldlg.hxx:196
virtual ~TakeProgress() override
Definition: cuigaldlg.cxx:301
std::unique_ptr< weld::Label > m_xFtSearchDir
Definition: cuigaldlg.hxx:76
void EndSearchProgressHdl(sal_Int32 nResult)
Definition: cuigaldlg.cxx:993
GalleryProgress aStatusProgress
Definition: cuigaldlg.hxx:141
std::unique_ptr< weld::Button > m_xBtnTake
Definition: cuigaldlg.hxx:238
void ImplSearch(const INetURLObject &rStartURL, const std::vector< OUString > &rFormats, bool bRecursive)
Definition: cuigaldlg.cxx:106
OUString GetTitle() const
Definition: cuigaldlg.hxx:163
rtl::Reference< SearchThread > m_aSearchThread
Definition: cuigaldlg.hxx:75
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: cuigaldlg.cxx:499
SearchProgress * mpProgress
Definition: cuigaldlg.hxx:52
SearchThread(SearchProgress *pProgress, TPGalleryThemeProperties *pBrowser, const INetURLObject &rStartURL)
Definition: cuigaldlg.cxx:64
virtual ~SearchThread() override
Definition: cuigaldlg.cxx:74
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: cuigaldlg.cxx:577
GalleryTheme * m_pThm
Definition: cuigaldlg.hxx:169
VclPtr< TPGalleryThemeProperties > mpBrowser
Definition: cuigaldlg.hxx:98
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: cuigaldlg.cxx:571
virtual void Reset(const SfxItemSet *) override
Definition: cuigaldlg.hxx:243
std::unique_ptr< weld::Label > m_xFtMSShowType
Definition: cuigaldlg.hxx:197
std::vector< sal_uLong > TokenList_impl
Definition: cuigaldlg.hxx:39
INetURLObject startUrl_
Definition: cuigaldlg.hxx:73