tdf#144694 In direct SQL dialog, activate options 'Run SQL command
[LibreOffice.git] / cui / source / inc / cuigaldlg.hxx
blob1dcf6504459e7d28a4395775963273172dfc9460
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <sal/config.h>
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>
32 #include <svtools/dialogclosedlistener.hxx>
34 #include <string_view>
35 #include <vector>
37 class GalleryTheme;
38 class SearchProgress;
39 class TakeProgress;
40 class TPGalleryThemeProperties;
42 typedef std::vector< sal_Int32 > TokenList_impl;
44 class SearchThread: public salhelper::Thread
46 private:
48 SearchProgress* mpProgress;
49 TPGalleryThemeProperties* mpBrowser;
50 INetURLObject maStartURL;
52 void ImplSearch( const INetURLObject& rStartURL,
53 const std::vector< OUString >& rFormats,
54 bool bRecursive );
56 virtual ~SearchThread() override;
57 virtual void execute() override;
59 public:
61 SearchThread(SearchProgress* pProgress,
62 TPGalleryThemeProperties* pBrowser,
63 INetURLObject aStartURL);
66 class SearchProgress : public weld::GenericDialogController
68 private:
69 INetURLObject startUrl_;
70 TPGalleryThemeProperties* m_pTabPage;
71 rtl::Reference< SearchThread > m_aSearchThread;
72 std::unique_ptr<weld::Label> m_xFtSearchDir;
73 std::unique_ptr<weld::Label> m_xFtSearchType;
74 std::unique_ptr<weld::Button> m_xBtnCancel;
76 DECL_LINK(ClickCancelBtn, weld::Button&, void);
78 public:
79 SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, INetURLObject aStartURL);
80 void LaunchThread();
81 virtual ~SearchProgress() override;
83 DECL_LINK( CleanUpHdl, void*, void );
85 void SetFileType( const OUString& rType ) { m_xFtSearchType->set_label(rType); }
86 void SetDirectory( const INetURLObject& rURL ) { m_xFtSearchDir->set_label(GetReducedString(rURL, 30)); }
89 class TakeThread: public salhelper::Thread
91 private:
93 TakeProgress* mpProgress;
94 TPGalleryThemeProperties* mpBrowser;
95 TokenList_impl& mrTakenList;
97 virtual ~TakeThread() override;
98 virtual void execute() override;
100 public:
102 TakeThread(
103 TakeProgress* pProgress,
104 TPGalleryThemeProperties* pBrowser,
105 TokenList_impl& rTakenList
109 class TakeProgress : public weld::GenericDialogController
111 private:
112 weld::Window* m_pParent;
113 TPGalleryThemeProperties* m_pTabPage;
114 rtl::Reference< TakeThread > maTakeThread;
115 TokenList_impl maTakenList;
116 std::unique_ptr<weld::Label> m_xFtTakeFile;
117 std::unique_ptr<weld::Button> m_xBtnCancel;
119 DECL_LINK(ClickCancelBtn, weld::Button&, void);
121 public:
123 TakeProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage);
124 void LaunchThread();
125 virtual ~TakeProgress() override;
127 DECL_LINK( CleanUpHdl, void*, void );
129 void SetFile( const INetURLObject& rURL ) { m_xFtTakeFile->set_label(GetReducedString(rURL, 30)); }
132 class ActualizeProgress : public weld::GenericDialogController
134 private:
135 Idle* pIdle;
136 GalleryTheme* pTheme;
137 GalleryProgress aStatusProgress;
138 std::unique_ptr<weld::Label> m_xFtActualizeFile;
139 std::unique_ptr<weld::Button> m_xBtnCancel;
141 DECL_LINK(ClickCancelBtn, weld::Button&, void);
142 DECL_LINK(TimeoutHdl, Timer*, void);
143 DECL_LINK(ActualizeHdl, const INetURLObject&, void);
145 public:
146 ActualizeProgress(weld::Widget* pWindow, GalleryTheme* pThm);
147 virtual ~ActualizeProgress() override;
149 virtual short run() override;
152 class TitleDialog : public weld::GenericDialogController
154 private:
155 std::unique_ptr<weld::Entry> m_xEdit;
156 public:
157 TitleDialog(weld::Widget* pParent, const OUString& rOldText);
158 virtual ~TitleDialog() override;
159 OUString GetTitle() const { return m_xEdit->get_text(); }
162 class GalleryIdDialog : public weld::GenericDialogController
164 private:
165 GalleryTheme* m_pThm;
166 std::unique_ptr<weld::Button> m_xBtnOk;
167 std::unique_ptr<weld::ComboBox> m_xLbResName;
169 DECL_LINK(ClickOkHdl, weld::Button&, void);
170 public:
171 GalleryIdDialog(weld::Widget* pParent, GalleryTheme* pThm);
172 virtual ~GalleryIdDialog() override;
173 sal_uInt32 GetId() const { return m_xLbResName->get_active(); }
176 class GalleryThemeProperties : public SfxTabDialogController
178 ExchangeData* pData;
180 virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
182 public:
183 GalleryThemeProperties(weld::Widget* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
186 class TPGalleryThemeGeneral : public SfxTabPage
188 private:
189 ExchangeData* pData;
191 std::unique_ptr<weld::Image> m_xFiMSImage;
192 std::unique_ptr<weld::Entry> m_xEdtMSName;
193 std::unique_ptr<weld::Label> m_xFtMSShowType;
194 std::unique_ptr<weld::Label> m_xFtMSShowPath;
195 std::unique_ptr<weld::Label> m_xFtMSShowContent;
196 std::unique_ptr<weld::Label> m_xFtMSShowChangeDate;
198 virtual void Reset( const SfxItemSet* ) override {}
199 virtual bool FillItemSet( SfxItemSet* rSet ) override;
201 public:
202 TPGalleryThemeGeneral(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
203 void SetXChgData( ExchangeData* pData );
204 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
207 class TPGalleryThemeProperties : public SfxTabPage
209 friend class SearchThread;
210 friend class TakeProgress;
211 friend class TakeThread;
213 ExchangeData* pData;
214 std::vector<OUString> aFoundList;
215 std::vector<OUString> aFilterEntryList;
216 Timer aPreviewTimer;
217 OUString aLastFilterName;
218 OUString aPreviewString;
219 INetURLObject aURL;
220 bool bEntriesFound;
221 bool bInputAllowed;
222 bool bTakeAll;
223 bool bSearchRecursive;
225 rtl::Reference< ::svt::DialogClosedListener > xDialogListener;
226 css::uno::Reference< css::media::XPlayer > xMediaPlayer;
227 css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
229 DialogGalleryPreview m_aWndPreview;
230 std::unique_ptr<weld::ComboBox> m_xCbbFileType;
231 std::unique_ptr<weld::TreeView> m_xLbxFound;
232 std::unique_ptr<weld::Button> m_xBtnSearch;
233 std::unique_ptr<weld::Button> m_xBtnTake;
234 std::unique_ptr<weld::Button> m_xBtnTakeAll;
235 std::unique_ptr<weld::CheckButton> m_xCbxPreview;
236 std::unique_ptr<weld::CustomWeld> m_xWndPreview;
238 virtual void Reset( const SfxItemSet* /*rSet*/ ) override {}
239 virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) override { return true; }
240 static OUString addExtension( const OUString&, std::u16string_view );
241 void FillFilterList();
243 void SearchFiles();
244 void TakeFiles();
245 void DoPreview();
246 void EndSearchProgressHdl(sal_Int32 nResult);
248 DECL_LINK(ClickPreviewHdl, weld::Toggleable&, void);
249 DECL_LINK(ClickSearchHdl, weld::Button&, void);
250 DECL_LINK(ClickTakeHdl, weld::Button&, void);
251 DECL_LINK(ClickTakeAllHdl, weld::Button&, void);
252 DECL_LINK(SelectFoundHdl, weld::TreeView&, void);
253 DECL_LINK(SelectFileTypeHdl, weld::ComboBox&, void);
254 DECL_LINK(DClickFoundHdl, weld::TreeView&, bool);
255 DECL_LINK(PreviewTimerHdl, Timer*, void);
256 DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
258 public:
259 TPGalleryThemeProperties(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
260 virtual ~TPGalleryThemeProperties() override;
262 void SetXChgData( ExchangeData* pData );
263 const ExchangeData* GetXChgData() const { return pData; }
265 void StartSearchFiles( std::u16string_view _rFolderURL, short _nDlgResult );
267 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */