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 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <salhelper/thread.hxx>
25 #include <tools/urlobj.hxx>
26 #include <vcl/idle.hxx>
27 #include <sfx2/tabdlg.hxx>
28 #include <svx/galctrl.hxx>
29 #include <svx/galmisc.hxx>
30 #include <com/sun/star/media/XPlayer.hpp>
31 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
33 
34 #include <string_view>
35 #include <vector>
36 
37 class GalleryTheme;
38 class SearchProgress;
39 class TakeProgress;
41 
42 typedef std::vector< sal_uLong > TokenList_impl;
43 
44 struct FilterEntry
45 {
46  OUString aFilterName;
47 };
48 
50 {
51 private:
52 
56 
57  void ImplSearch( const INetURLObject& rStartURL,
58  const std::vector< OUString >& rFormats,
59  bool bRecursive );
60 
61  virtual ~SearchThread() override;
62  virtual void execute() override;
63 
64 public:
65 
66  SearchThread(SearchProgress* pProgress,
67  TPGalleryThemeProperties* pBrowser,
68  const INetURLObject& rStartURL);
69 };
70 
72 {
73 private:
77  std::unique_ptr<weld::Label> m_xFtSearchDir;
78  std::unique_ptr<weld::Label> m_xFtSearchType;
79  std::unique_ptr<weld::Button> m_xBtnCancel;
80 
81  DECL_LINK(ClickCancelBtn, weld::Button&, void);
82 
83 public:
84  SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL);
85  void LaunchThread();
86  virtual ~SearchProgress() override;
87 
88  DECL_LINK( CleanUpHdl, void*, void );
89 
90  void SetFileType( const OUString& rType ) { m_xFtSearchType->set_label(rType); }
91  void SetDirectory( const INetURLObject& rURL ) { m_xFtSearchDir->set_label(GetReducedString(rURL, 30)); }
92 };
93 
95 {
96 private:
97 
101 
102  virtual ~TakeThread() override;
103  virtual void execute() override;
104 
105 public:
106 
107  TakeThread(
108  TakeProgress* pProgress,
109  TPGalleryThemeProperties* pBrowser,
110  TokenList_impl& rTakenList
111  );
112 };
113 
115 {
116 private:
121  std::unique_ptr<weld::Label> m_xFtTakeFile;
122  std::unique_ptr<weld::Button> m_xBtnCancel;
123 
124  DECL_LINK(ClickCancelBtn, weld::Button&, void);
125 
126 public:
127 
129  void LaunchThread();
130  virtual ~TakeProgress() override;
131 
132  DECL_LINK( CleanUpHdl, void*, void );
133 
134  void SetFile( const INetURLObject& rURL ) { m_xFtTakeFile->set_label(GetReducedString(rURL, 30)); }
135 };
136 
138 {
139 private:
143  std::unique_ptr<weld::Label> m_xFtActualizeFile;
144  std::unique_ptr<weld::Button> m_xBtnCancel;
145 
146  DECL_LINK(ClickCancelBtn, weld::Button&, void);
147  DECL_LINK(TimeoutHdl, Timer*, void);
148  DECL_LINK(ActualizeHdl, const INetURLObject&, void);
149 
150 public:
152  virtual ~ActualizeProgress() override;
153 
154  virtual short run() override;
155 };
156 
158 {
159 private:
160  std::unique_ptr<weld::Entry> m_xEdit;
161 public:
162  TitleDialog(weld::Widget* pParent, const OUString& rOldText);
163  virtual ~TitleDialog() override;
164  OUString GetTitle() const { return m_xEdit->get_text(); }
165 };
166 
168 {
169 private:
171  std::unique_ptr<weld::Button> m_xBtnOk;
172  std::unique_ptr<weld::ComboBox> m_xLbResName;
173 
174  DECL_LINK(ClickOkHdl, weld::Button&, void);
175 public:
176  GalleryIdDialog(weld::Widget* pParent, GalleryTheme* pThm);
177  virtual ~GalleryIdDialog() override;
178  sal_uInt32 GetId() const { return m_xLbResName->get_active(); }
179 };
180 
182 {
184 
185  virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
186 
187 public:
188  GalleryThemeProperties(weld::Widget* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
189 };
190 
192 {
193 private:
195 
196  std::unique_ptr<weld::Image> m_xFiMSImage;
197  std::unique_ptr<weld::Entry> m_xEdtMSName;
198  std::unique_ptr<weld::Label> m_xFtMSShowType;
199  std::unique_ptr<weld::Label> m_xFtMSShowPath;
200  std::unique_ptr<weld::Label> m_xFtMSShowContent;
201  std::unique_ptr<weld::Label> m_xFtMSShowChangeDate;
202 
203  virtual void Reset( const SfxItemSet* ) override {}
204  virtual bool FillItemSet( SfxItemSet* rSet ) override;
205 
206 public:
207  TPGalleryThemeGeneral(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
208  void SetXChgData( ExchangeData* pData );
209  static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
210 };
211 
213 {
214  friend class SearchThread;
215  friend class TakeProgress;
216  friend class TakeThread;
217 
219  std::vector<OUString> aFoundList;
220  std::vector< std::unique_ptr<FilterEntry> >
223  OUString aLastFilterName;
224  OUString aPreviewString;
228  bool bTakeAll;
230 
232  css::uno::Reference< css::media::XPlayer > xMediaPlayer;
233  css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
234 
236  std::unique_ptr<weld::ComboBox> m_xCbbFileType;
237  std::unique_ptr<weld::TreeView> m_xLbxFound;
238  std::unique_ptr<weld::Button> m_xBtnSearch;
239  std::unique_ptr<weld::Button> m_xBtnTake;
240  std::unique_ptr<weld::Button> m_xBtnTakeAll;
241  std::unique_ptr<weld::CheckButton> m_xCbxPreview;
242  std::unique_ptr<weld::CustomWeld> m_xWndPreview;
243 
244  virtual void Reset( const SfxItemSet* /*rSet*/ ) override {}
245  virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) override { return true; }
246  static OUString addExtension( const OUString&, std::u16string_view );
247  void FillFilterList();
248 
249  void SearchFiles();
250  void TakeFiles();
251  void DoPreview();
252  void EndSearchProgressHdl(sal_Int32 nResult);
253 
254  DECL_LINK(ClickPreviewHdl, weld::Toggleable&, void);
255  DECL_LINK(ClickSearchHdl, weld::Button&, void);
256  DECL_LINK(ClickTakeHdl, weld::Button&, void);
257  DECL_LINK(ClickTakeAllHdl, weld::Button&, void);
258  DECL_LINK(SelectFoundHdl, weld::TreeView&, void);
259  DECL_LINK(SelectFileTypeHdl, weld::ComboBox&, void);
260  DECL_LINK(DClickFoundHdl, weld::TreeView&, bool);
261  DECL_LINK(PreviewTimerHdl, Timer*, void);
262  DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
263 
264 public:
266  virtual ~TPGalleryThemeProperties() 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 std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
274 };
275 
276 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_xCbbFileType
Definition: cuigaldlg.hxx:236
sal_uInt32 GetId() const
Definition: cuigaldlg.hxx:178
ExchangeData * pData
Definition: cuigaldlg.hxx:183
std::unique_ptr< weld::Button > m_xBtnOk
Definition: cuigaldlg.hxx:171
OUString GetReducedString(const INetURLObject &rURL, sal_Int32 nMaxLen)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: cuigaldlg.cxx:641
DECL_LINK(ClickCancelBtn, weld::Button &, void)
GalleryThemeProperties(weld::Widget *pParent, ExchangeData *pData, SfxItemSet const *pItemSet)
Definition: cuigaldlg.cxx:476
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: cuigaldlg.hxx:79
css::uno::Reference< css::media::XPlayer > xMediaPlayer
Definition: cuigaldlg.hxx:232
const ExchangeData * GetXChgData() const
Definition: cuigaldlg.hxx:269
std::unique_ptr< weld::CheckButton > m_xCbxPreview
Definition: cuigaldlg.hxx:241
SearchProgress(weld::Window *pParent, TPGalleryThemeProperties *pTabPage, const INetURLObject &rStartURL)
Definition: cuigaldlg.cxx:191
TPGalleryThemeGeneral(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: cuigaldlg.cxx:503
virtual void Reset(const SfxItemSet *) override
Definition: cuigaldlg.hxx:203
weld::Window * m_pParent
Definition: cuigaldlg.hxx:117
std::unique_ptr< weld::Image > m_xFiMSImage
Definition: cuigaldlg.hxx:196
TPGalleryThemeProperties * mpBrowser
Definition: cuigaldlg.hxx:99
virtual short run() override
Definition: cuigaldlg.cxx:382
TakeProgress(weld::Window *pParent, TPGalleryThemeProperties *pTabPage)
Definition: cuigaldlg.cxx:292
DialogGalleryPreview m_aWndPreview
Definition: cuigaldlg.hxx:235
TakeThread(TakeProgress *pProgress, TPGalleryThemeProperties *pBrowser, TokenList_impl &rTakenList)
Definition: cuigaldlg.cxx:228
void StartSearchFiles(const OUString &_rFolderURL, short _nDlgResult)
Definition: cuigaldlg.cxx:624
void SetXChgData(ExchangeData *pData)
Definition: cuigaldlg.cxx:515
std::unique_ptr< weld::Label > m_xFtMSShowContent
Definition: cuigaldlg.hxx:200
rtl::Reference< ::svt::DialogClosedListener > xDialogListener
Definition: cuigaldlg.hxx:231
TPGalleryThemeProperties(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: cuigaldlg.cxx:578
virtual ~TitleDialog() override
Definition: cuigaldlg.cxx:424
GalleryIdDialog(weld::Widget *pParent, GalleryTheme *pThm)
Definition: cuigaldlg.cxx:428
virtual ~SearchProgress() override
Definition: cuigaldlg.cxx:203
DECL_LINK(ClickOkHdl, weld::Button &, void)
void SetFileType(const OUString &rType)
Definition: cuigaldlg.hxx:90
void SetXChgData(ExchangeData *pData)
Definition: cuigaldlg.cxx:601
std::unique_ptr< weld::Label > m_xFtMSShowChangeDate
Definition: cuigaldlg.hxx:201
ExchangeData * pData
Definition: cuigaldlg.hxx:218
ExchangeData * pData
Definition: cuigaldlg.hxx:194
rtl::Reference< TakeThread > maTakeThread
Definition: cuigaldlg.hxx:119
css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker
Definition: cuigaldlg.hxx:233
TokenList_impl & mrTakenList
Definition: cuigaldlg.hxx:100
virtual ~GalleryIdDialog() override
Definition: cuigaldlg.cxx:444
std::unique_ptr< weld::Label > m_xFtActualizeFile
Definition: cuigaldlg.hxx:143
std::unique_ptr< weld::Label > m_xFtMSShowPath
Definition: cuigaldlg.hxx:199
DECL_LINK(ClickCancelBtn, weld::Button &, void)
DECL_LINK(ClickPreviewHdl, weld::Toggleable &, void)
virtual ~ActualizeProgress() override
Definition: cuigaldlg.cxx:378
std::vector< OUString > aFoundList
Definition: cuigaldlg.hxx:219
GalleryTheme * pTheme
Definition: cuigaldlg.hxx:141
INetURLObject maStartURL
Definition: cuigaldlg.hxx:55
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: cuigaldlg.cxx:573
TPGalleryThemeProperties * mpBrowser
Definition: cuigaldlg.hxx:54
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: cuigaldlg.hxx:144
void SetDirectory(const INetURLObject &rURL)
Definition: cuigaldlg.hxx:91
TokenList_impl maTakenList
Definition: cuigaldlg.hxx:120
virtual void execute() override
Definition: cuigaldlg.cxx:80
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: cuigaldlg.hxx:122
void SetFile(const INetURLObject &rURL)
Definition: cuigaldlg.hxx:134
static OUString addExtension(const OUString &, std::u16string_view)
Definition: cuigaldlg.cxx:646
DECL_LINK(ClickCancelBtn, weld::Button &, void)
std::unique_ptr< weld::TreeView > m_xLbxFound
Definition: cuigaldlg.hxx:237
std::unique_ptr< weld::Button > m_xBtnTakeAll
Definition: cuigaldlg.hxx:240
virtual bool FillItemSet(SfxItemSet *) override
Definition: cuigaldlg.hxx:245
TPGalleryThemeProperties * m_pTabPage
Definition: cuigaldlg.hxx:75
std::unique_ptr< weld::Entry > m_xEdit
Definition: cuigaldlg.hxx:160
void LaunchThread()
Definition: cuigaldlg.cxx:221
std::unique_ptr< weld::ComboBox > m_xLbResName
Definition: cuigaldlg.hxx:172
void LaunchThread()
Definition: cuigaldlg.cxx:360
std::vector< std::unique_ptr< FilterEntry > > aFilterEntryList
Definition: cuigaldlg.hxx:221
std::unique_ptr< weld::CustomWeld > m_xWndPreview
Definition: cuigaldlg.hxx:242
virtual void execute() override
Definition: cuigaldlg.cxx:245
virtual ~TakeThread() override
Definition: cuigaldlg.cxx:241
TakeProgress * mpProgress
Definition: cuigaldlg.hxx:98
TPGalleryThemeProperties * m_pTabPage
Definition: cuigaldlg.hxx:118
TitleDialog(weld::Widget *pParent, const OUString &rOldText)
Definition: cuigaldlg.cxx:416
std::unique_ptr< weld::Button > m_xBtnSearch
Definition: cuigaldlg.hxx:238
virtual ~TPGalleryThemeProperties() override
Definition: cuigaldlg.cxx:634
std::unique_ptr< weld::Label > m_xFtTakeFile
Definition: cuigaldlg.hxx:121
std::unique_ptr< weld::Label > m_xFtSearchType
Definition: cuigaldlg.hxx:78
ActualizeProgress(weld::Widget *pWindow, GalleryTheme *pThm)
Definition: cuigaldlg.cxx:367
std::unique_ptr< weld::Entry > m_xEdtMSName
Definition: cuigaldlg.hxx:197
virtual ~TakeProgress() override
Definition: cuigaldlg.cxx:303
std::unique_ptr< weld::Label > m_xFtSearchDir
Definition: cuigaldlg.hxx:77
void EndSearchProgressHdl(sal_Int32 nResult)
Definition: cuigaldlg.cxx:983
GalleryProgress aStatusProgress
Definition: cuigaldlg.hxx:142
std::unique_ptr< weld::Button > m_xBtnTake
Definition: cuigaldlg.hxx:239
void ImplSearch(const INetURLObject &rStartURL, const std::vector< OUString > &rFormats, bool bRecursive)
Definition: cuigaldlg.cxx:108
OUString GetTitle() const
Definition: cuigaldlg.hxx:164
rtl::Reference< SearchThread > m_aSearchThread
Definition: cuigaldlg.hxx:76
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: cuigaldlg.cxx:495
SearchProgress * mpProgress
Definition: cuigaldlg.hxx:53
SearchThread(SearchProgress *pProgress, TPGalleryThemeProperties *pBrowser, const INetURLObject &rStartURL)
Definition: cuigaldlg.cxx:66
virtual ~SearchThread() override
Definition: cuigaldlg.cxx:76
GalleryTheme * m_pThm
Definition: cuigaldlg.hxx:170
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: cuigaldlg.cxx:567
virtual void Reset(const SfxItemSet *) override
Definition: cuigaldlg.hxx:244
std::unique_ptr< weld::Label > m_xFtMSShowType
Definition: cuigaldlg.hxx:198
std::vector< sal_uLong > TokenList_impl
Definition: cuigaldlg.hxx:40
INetURLObject startUrl_
Definition: cuigaldlg.hxx:74