xref: /trunk/main/cui/source/inc/cuigaldlg.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _CUI_GALDLG_HXX_
29*cdf0e10cSrcweir #define _CUI_GALDLG_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vos/thread.hxx>
32*cdf0e10cSrcweir #include <vcl/dialog.hxx>
33*cdf0e10cSrcweir #include <vcl/graph.hxx>
34*cdf0e10cSrcweir #include <vcl/fixed.hxx>
35*cdf0e10cSrcweir #include <vcl/button.hxx>
36*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
37*cdf0e10cSrcweir #include <vcl/menu.hxx>
38*cdf0e10cSrcweir #include <vcl/edit.hxx>
39*cdf0e10cSrcweir #include <vcl/combobox.hxx>
40*cdf0e10cSrcweir #include <svl/slstitm.hxx>
41*cdf0e10cSrcweir #include <svtools/transfer.hxx>
42*cdf0e10cSrcweir #include <svtools/grfmgr.hxx>
43*cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
44*cdf0e10cSrcweir #include <svx/galctrl.hxx>
45*cdf0e10cSrcweir #include <svx/galmisc.hxx>
46*cdf0e10cSrcweir #include <com/sun/star/media/XPlayer.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
48*cdf0e10cSrcweir #include <svtools/dialogclosedlistener.hxx>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir DECLARE_LIST( StringList, String* )
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir // ------------
53*cdf0e10cSrcweir // - Forwards -
54*cdf0e10cSrcweir // ------------
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir class Gallery;
57*cdf0e10cSrcweir class GalleryTheme;
58*cdf0e10cSrcweir class SearchProgress;
59*cdf0e10cSrcweir class TakeProgress;
60*cdf0e10cSrcweir class TPGalleryThemeProperties;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir // ---------------
63*cdf0e10cSrcweir // - FilterEntry -
64*cdf0e10cSrcweir // ---------------
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir struct FilterEntry
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir     String  aFilterName;
69*cdf0e10cSrcweir };
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir // ----------------
72*cdf0e10cSrcweir // - SearchThread -
73*cdf0e10cSrcweir // ----------------
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir class SearchThread : public ::vos::OThread
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir private:
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     SearchProgress*             mpProgress;
80*cdf0e10cSrcweir     TPGalleryThemeProperties*   mpBrowser;
81*cdf0e10cSrcweir     INetURLObject               maStartURL;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     void                        ImplSearch( const INetURLObject& rStartURL,
84*cdf0e10cSrcweir                                             const ::std::vector< String >& rFormats,
85*cdf0e10cSrcweir                                             sal_Bool bRecursive );
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     virtual void SAL_CALL       run();
88*cdf0e10cSrcweir     virtual void SAL_CALL       onTerminated();
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir public:
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir                                 SearchThread( SearchProgress* pProgess,
93*cdf0e10cSrcweir                                               TPGalleryThemeProperties* pBrowser,
94*cdf0e10cSrcweir                                               const INetURLObject& rStartURL );
95*cdf0e10cSrcweir     virtual                     ~SearchThread();
96*cdf0e10cSrcweir };
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir // ------------------
99*cdf0e10cSrcweir // - SearchProgress -
100*cdf0e10cSrcweir // ------------------
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir class SearchProgress : public ModalDialog
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir private:
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     FixedText           aFtSearchDir;
107*cdf0e10cSrcweir     FixedLine           aFLSearchDir;
108*cdf0e10cSrcweir     FixedText           aFtSearchType;
109*cdf0e10cSrcweir     FixedLine           aFLSearchType;
110*cdf0e10cSrcweir     CancelButton        aBtnCancel;
111*cdf0e10cSrcweir     SearchThread        maSearchThread;
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir                         DECL_LINK( ClickCancelBtn, void* );
114*cdf0e10cSrcweir     void                Terminate();
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir public:
117*cdf0e10cSrcweir                         SearchProgress( Window* pParent, const INetURLObject& rStartURL );
118*cdf0e10cSrcweir                         ~SearchProgress() {};
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir                         DECL_LINK( CleanUpHdl, void* );
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     virtual short       Execute();
123*cdf0e10cSrcweir     virtual void        StartExecuteModal( const Link& rEndDialogHdl );
124*cdf0e10cSrcweir     void                SetFileType( const String& rType ) { aFtSearchType.SetText( rType ); }
125*cdf0e10cSrcweir     void                SetDirectory( const INetURLObject& rURL ) { aFtSearchDir.SetText( GetReducedString( rURL, 30 ) ); }
126*cdf0e10cSrcweir };
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir // --------------
129*cdf0e10cSrcweir // - TakeThread -
130*cdf0e10cSrcweir // --------------
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir class TakeThread : public ::vos::OThread
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir private:
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     TakeProgress*               mpProgress;
137*cdf0e10cSrcweir     TPGalleryThemeProperties*   mpBrowser;
138*cdf0e10cSrcweir     List&                       mrTakenList;
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     virtual void SAL_CALL       run();
141*cdf0e10cSrcweir     virtual void SAL_CALL       onTerminated();
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir public:
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir                                 TakeThread( TakeProgress* pProgess, TPGalleryThemeProperties* pBrowser, List& rTakenList );
146*cdf0e10cSrcweir     virtual                     ~TakeThread();
147*cdf0e10cSrcweir };
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir // ----------------
150*cdf0e10cSrcweir // - TakeProgress -
151*cdf0e10cSrcweir // ----------------
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir class TakeProgress : public ModalDialog
154*cdf0e10cSrcweir {
155*cdf0e10cSrcweir private:
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     FixedText           aFtTakeFile;
158*cdf0e10cSrcweir     FixedLine           aFLTakeProgress;
159*cdf0e10cSrcweir     CancelButton        aBtnCancel;
160*cdf0e10cSrcweir     TakeThread          maTakeThread;
161*cdf0e10cSrcweir     List                maTakenList;
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir                         DECL_LINK( ClickCancelBtn, void* );
164*cdf0e10cSrcweir     void                Terminate();
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir public:
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir                         TakeProgress( Window* pWindow );
169*cdf0e10cSrcweir                         ~TakeProgress() {};
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir                         DECL_LINK( CleanUpHdl, void* );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir     void                SetFile( const INetURLObject& rURL ) { aFtTakeFile.SetText( GetReducedString( rURL, 30 ) ); }
174*cdf0e10cSrcweir     virtual short       Execute();
175*cdf0e10cSrcweir     virtual void        StartExecuteModal( const Link& rEndDialogHdl );
176*cdf0e10cSrcweir };
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir // ---------------------
179*cdf0e10cSrcweir // - ActualizeProgress -
180*cdf0e10cSrcweir // ---------------------
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir class ActualizeProgress : public ModalDialog
183*cdf0e10cSrcweir {
184*cdf0e10cSrcweir private:
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     FixedText           aFtActualizeFile;
187*cdf0e10cSrcweir     FixedLine           aFLActualizeProgress;
188*cdf0e10cSrcweir     CancelButton        aBtnCancel;
189*cdf0e10cSrcweir     Timer*              pTimer;
190*cdf0e10cSrcweir     GalleryTheme*       pTheme;
191*cdf0e10cSrcweir     GalleryProgress     aStatusProgress;
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir                         DECL_LINK( ClickCancelBtn, void* );
194*cdf0e10cSrcweir                         DECL_LINK( TimeoutHdl, Timer* );
195*cdf0e10cSrcweir                         DECL_LINK( ActualizeHdl, INetURLObject* pURL );
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir public:
198*cdf0e10cSrcweir                         ActualizeProgress( Window* pWindow, GalleryTheme* pThm );
199*cdf0e10cSrcweir                         ~ActualizeProgress() {};
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     virtual short       Execute();
202*cdf0e10cSrcweir };
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir // ---------------
205*cdf0e10cSrcweir // - TitleDialog -
206*cdf0e10cSrcweir // ---------------
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir class TitleDialog : public ModalDialog
209*cdf0e10cSrcweir {
210*cdf0e10cSrcweir private:
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     OKButton            maOk;
213*cdf0e10cSrcweir     CancelButton        maCancel;
214*cdf0e10cSrcweir     HelpButton          maHelp;
215*cdf0e10cSrcweir     FixedLine           maFL;
216*cdf0e10cSrcweir     Edit                maEdit;
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir public:
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir                         TitleDialog( Window* pParent, const String& rOldText );
221*cdf0e10cSrcweir     String              GetTitle() const { return maEdit.GetText(); }
222*cdf0e10cSrcweir };
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir // -------------------
225*cdf0e10cSrcweir // - GalleryIdDialog -
226*cdf0e10cSrcweir // -------------------
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir class GalleryIdDialog : public ModalDialog
229*cdf0e10cSrcweir {
230*cdf0e10cSrcweir private:
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir     OKButton        aBtnOk;
233*cdf0e10cSrcweir     CancelButton    aBtnCancel;
234*cdf0e10cSrcweir     FixedLine       aFLId;
235*cdf0e10cSrcweir     ListBox         aLbResName;
236*cdf0e10cSrcweir     GalleryTheme*   pThm;
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir                     DECL_LINK( ClickOkHdl, void* );
239*cdf0e10cSrcweir                     DECL_LINK( ClickResNameHdl, void* );
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir public:
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir                     GalleryIdDialog( Window* pParent, GalleryTheme* pThm );
244*cdf0e10cSrcweir                     ~GalleryIdDialog() {}
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir     sal_uLong           GetId() const { return aLbResName.GetSelectEntryPos(); }
247*cdf0e10cSrcweir };
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir // --------------------------
250*cdf0e10cSrcweir // - GalleryThemeProperties -
251*cdf0e10cSrcweir // --------------------------
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir class GalleryThemeProperties : public SfxTabDialog
254*cdf0e10cSrcweir {
255*cdf0e10cSrcweir     ExchangeData*   pData;
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir     virtual void    PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir public:
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir                     GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet  );
262*cdf0e10cSrcweir                     ~GalleryThemeProperties() {}
263*cdf0e10cSrcweir };
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir // -------------------------
266*cdf0e10cSrcweir // - TPGalleryThemeGeneral -
267*cdf0e10cSrcweir // -------------------------
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir class TPGalleryThemeGeneral : public SfxTabPage
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir private:
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir     FixedImage          aFiMSImage;
274*cdf0e10cSrcweir     Edit                aEdtMSName;
275*cdf0e10cSrcweir     FixedLine           aFlMSGeneralFirst;
276*cdf0e10cSrcweir     FixedText           aFtMSType;
277*cdf0e10cSrcweir     FixedText           aFtMSShowType;
278*cdf0e10cSrcweir     FixedText           aFtMSPath;
279*cdf0e10cSrcweir     FixedText           aFtMSShowPath;
280*cdf0e10cSrcweir     FixedText           aFtMSContent;
281*cdf0e10cSrcweir     FixedText           aFtMSShowContent;
282*cdf0e10cSrcweir     FixedLine           aFlMSGeneralSecond;
283*cdf0e10cSrcweir     FixedText           aFtMSChangeDate;
284*cdf0e10cSrcweir     FixedText           aFtMSShowChangeDate;
285*cdf0e10cSrcweir     ExchangeData*       pData;
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir     virtual void        Reset( const SfxItemSet& ) {}
288*cdf0e10cSrcweir     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir public:
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir                         TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet );
294*cdf0e10cSrcweir                         ~TPGalleryThemeGeneral() {}
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir     void                SetXChgData( ExchangeData* pData );
297*cdf0e10cSrcweir     const ExchangeData* GetXChgData() const { return pData; }
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir     static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
300*cdf0e10cSrcweir };
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir // ----------------------------
303*cdf0e10cSrcweir // - TPGalleryThemeProperties -
304*cdf0e10cSrcweir // ----------------------------
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir class TPGalleryThemeProperties : public SfxTabPage
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir     friend class SearchThread;
309*cdf0e10cSrcweir     friend class TakeProgress;
310*cdf0e10cSrcweir     friend class TakeThread;
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     FixedText           aFtFileType;
313*cdf0e10cSrcweir     ComboBox            aCbbFileType;
314*cdf0e10cSrcweir     MultiListBox        aLbxFound;
315*cdf0e10cSrcweir     PushButton          aBtnSearch;
316*cdf0e10cSrcweir     PushButton          aBtnTake;
317*cdf0e10cSrcweir     PushButton          aBtnTakeAll;
318*cdf0e10cSrcweir     CheckBox            aCbxPreview;
319*cdf0e10cSrcweir     GalleryPreview      aWndPreview;
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir     ExchangeData*       pData;
322*cdf0e10cSrcweir     StringList          aFoundList;
323*cdf0e10cSrcweir     List                aFilterEntryList;
324*cdf0e10cSrcweir     Timer               aPreviewTimer;
325*cdf0e10cSrcweir     String              aLastFilterName;
326*cdf0e10cSrcweir     String              aPreviewString;
327*cdf0e10cSrcweir     INetURLObject       aURL;
328*cdf0e10cSrcweir     sal_uInt16              nCurFilterPos;
329*cdf0e10cSrcweir     sal_uInt16              nFirstExtFilterPos;
330*cdf0e10cSrcweir     sal_Bool                bEntriesFound;
331*cdf0e10cSrcweir     sal_Bool                bInputAllowed;
332*cdf0e10cSrcweir     sal_Bool                bTakeAll;
333*cdf0e10cSrcweir     sal_Bool                bSearchRecursive;
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::svt::DialogClosedListener >                  xDialogListener;
336*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer >             xMediaPlayer;
337*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir     virtual void        Reset( const SfxItemSet& /*rSet*/ ) {}
340*cdf0e10cSrcweir     virtual sal_Bool        FillItemSet( SfxItemSet& /*rSet*/ ) { return sal_True; }
341*cdf0e10cSrcweir     ::rtl::OUString     addExtension( const ::rtl::OUString&, const ::rtl::OUString& );
342*cdf0e10cSrcweir     void                FillFilterList();
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir     void                SearchFiles();
345*cdf0e10cSrcweir     void                TakeFiles();
346*cdf0e10cSrcweir     void                DoPreview();
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir                         DECL_LINK( ClickPreviewHdl, void* );
349*cdf0e10cSrcweir                         DECL_LINK( ClickCloseBrowserHdl, void* );
350*cdf0e10cSrcweir                         DECL_LINK( ClickSearchHdl, void* );
351*cdf0e10cSrcweir                         DECL_LINK( ClickTakeHdl, void* );
352*cdf0e10cSrcweir                         DECL_LINK( ClickTakeAllHdl, void* );
353*cdf0e10cSrcweir                         DECL_LINK( SelectFoundHdl, void* );
354*cdf0e10cSrcweir                         DECL_LINK( SelectThemeHdl, void* );
355*cdf0e10cSrcweir                         DECL_LINK( SelectFileTypeHdl, void* );
356*cdf0e10cSrcweir                         DECL_LINK( DClickFoundHdl, void* );
357*cdf0e10cSrcweir                         DECL_LINK( PreviewTimerHdl, void* );
358*cdf0e10cSrcweir                         DECL_LINK( EndSearchProgressHdl, SearchProgress* );
359*cdf0e10cSrcweir                         DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir public:
362*cdf0e10cSrcweir                         TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet );
363*cdf0e10cSrcweir                         ~TPGalleryThemeProperties();
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir     void                SetXChgData( ExchangeData* pData );
366*cdf0e10cSrcweir     const ExchangeData* GetXChgData() const { return pData; }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir     void                StartSearchFiles( const String& _rFolderURL, short _nDlgResult );
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir     static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
371*cdf0e10cSrcweir };
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir #endif // _CUI_GALDLG_HXX_
374