xref: /trunk/main/sd/source/ui/dlg/dlgass.cxx (revision dad2ac5bb40510a7412898d3ea2dd7b1a0d98e74)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifdef SD_DLLIMPLEMENTATION
28cdf0e10cSrcweir #undef SD_DLLIMPLEMENTATION
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp>
31cdf0e10cSrcweir #include <vcl/svapp.hxx>
32cdf0e10cSrcweir #include <vos/mutex.hxx>
33cdf0e10cSrcweir #include <vcl/msgbox.hxx>
34cdf0e10cSrcweir #include <vcl/lstbox.hxx>
35cdf0e10cSrcweir #include <vcl/combobox.hxx>
36cdf0e10cSrcweir #include <sfx2/doctempl.hxx>
37cdf0e10cSrcweir #include <svl/lstner.hxx>
38cdf0e10cSrcweir #include <sfx2/objsh.hxx>
39cdf0e10cSrcweir #include <svtools/ehdl.hxx>
40cdf0e10cSrcweir #include <svtools/sfxecode.hxx>
41cdf0e10cSrcweir #include <tools/urlobj.hxx>
42cdf0e10cSrcweir #include <com/sun/star/presentation/FadeEffect.hpp>
43cdf0e10cSrcweir #include <fadedef.h>
44cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
45cdf0e10cSrcweir #include <svl/undo.hxx>
46cdf0e10cSrcweir #include "DrawDocShell.hxx"
47cdf0e10cSrcweir #include <vcl/gdimtf.hxx>
48cdf0e10cSrcweir #include <tools/wintypes.hxx>
49cdf0e10cSrcweir #include "docprev.hxx"
50cdf0e10cSrcweir #include <sfx2/app.hxx>
51cdf0e10cSrcweir #include <sfx2/docfile.hxx>
52cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
53cdf0e10cSrcweir #include <sfx2/request.hxx>
54cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSet.hpp>
55cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
56cdf0e10cSrcweir #include <com/sun/star/util/XCloseable.hpp>
57cdf0e10cSrcweir #include <com/sun/star/uno/RuntimeException.hpp>
58cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp>
59cdf0e10cSrcweir #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
60cdf0e10cSrcweir #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
61cdf0e10cSrcweir #include <com/sun/star/ui/XImageManager.hpp>
62cdf0e10cSrcweir #include <unotools/historyoptions.hxx>
63cdf0e10cSrcweir #include <tools/urlobj.hxx>
64cdf0e10cSrcweir #include <osl/file.hxx>
65cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
66cdf0e10cSrcweir 
67cdf0e10cSrcweir #include "sdpage.hxx"
68cdf0e10cSrcweir #include "helpids.h"
69cdf0e10cSrcweir #include "assclass.hxx"
70cdf0e10cSrcweir #include "dlgass.hrc"
71cdf0e10cSrcweir #include "dlgass.hxx"
72cdf0e10cSrcweir #include "dlgctrls.hxx"
73cdf0e10cSrcweir #ifndef _SD_CFGID_HXX
74cdf0e10cSrcweir #include "strings.hrc"
75cdf0e10cSrcweir #endif
76cdf0e10cSrcweir #ifndef _DATETIMEITEM_HXX
77cdf0e10cSrcweir #include "dlgassim.hxx"
78cdf0e10cSrcweir #endif
79cdf0e10cSrcweir #include "TemplateScanner.hxx"
80cdf0e10cSrcweir #include "WindowUpdater.hxx"
81cdf0e10cSrcweir 
82cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
83cdf0e10cSrcweir 
84cdf0e10cSrcweir using namespace ::com::sun::star;
85cdf0e10cSrcweir using namespace ::com::sun::star::uno;
86cdf0e10cSrcweir using namespace ::sd;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 
InterpolateFixedBitmap(FixedBitmap * pBitmap)89cdf0e10cSrcweir void InterpolateFixedBitmap( FixedBitmap * pBitmap )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     Bitmap aBmp( pBitmap->GetBitmap() );
92cdf0e10cSrcweir     Size aSize = pBitmap->GetSizePixel();
93*dad2ac5bSMatthias Seidel     aBmp.Scale( aSize, BMP_SCALE_BESTQUALITY );
94cdf0e10cSrcweir     pBitmap->SetBitmap( aBmp );
95cdf0e10cSrcweir }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 
98cdf0e10cSrcweir // ====================================================================
99cdf0e10cSrcweir // ====================================================================
100cdf0e10cSrcweir 
101cdf0e10cSrcweir const char* PageHelpIds[] =
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     HID_SD_AUTOPILOT_PAGE1,
104cdf0e10cSrcweir     HID_SD_AUTOPILOT_PAGE2,
105cdf0e10cSrcweir     HID_SD_AUTOPILOT_PAGE3,
106cdf0e10cSrcweir     HID_SD_AUTOPILOT_PAGE4,
107cdf0e10cSrcweir     HID_SD_AUTOPILOT_PAGE5
108cdf0e10cSrcweir };
109cdf0e10cSrcweir 
110cdf0e10cSrcweir // ====================================================================
111cdf0e10cSrcweir 
112cdf0e10cSrcweir class PasswordEntry
113cdf0e10cSrcweir {
114cdf0e10cSrcweir public:
115cdf0e10cSrcweir     String maPassword;
116cdf0e10cSrcweir     String maPath;
117cdf0e10cSrcweir };
118cdf0e10cSrcweir 
119cdf0e10cSrcweir DECLARE_LIST( PasswordEntryList, PasswordEntry * )
120cdf0e10cSrcweir 
121cdf0e10cSrcweir // ====================================================================
122cdf0e10cSrcweir 
123cdf0e10cSrcweir /** A simple wrapper that looks like a PushButton and is used to force the
12486e1cf34SPedro Giffuni     broadcasting of focus events primarily for accessibility tools.
125cdf0e10cSrcweir     Forcing focus events is achieved by using two identical PushButtons
126cdf0e10cSrcweir     which, when the focus event is requested, are exchanged and play focus
127cdf0e10cSrcweir     ping-pong by moving the focus from one to the other.
128cdf0e10cSrcweir */
129cdf0e10cSrcweir class NextButton
130cdf0e10cSrcweir {
131cdf0e10cSrcweir public:
132cdf0e10cSrcweir     NextButton (::Window* pParent, const ResId& rResId);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     void ForceFocusEventBroadcast (void);
135cdf0e10cSrcweir     void SetClickHdl (const Link& rLink);
136cdf0e10cSrcweir     bool IsEnabled (void);
137cdf0e10cSrcweir     void Enable (bool bEnable);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir private:
140cdf0e10cSrcweir     PushButton maNextButton1;
141cdf0e10cSrcweir     PushButton maNextButton2;
142cdf0e10cSrcweir     bool mbIsFirstButtonActive;
143cdf0e10cSrcweir };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 
147cdf0e10cSrcweir // ====================================================================
148cdf0e10cSrcweir 
149cdf0e10cSrcweir class AssistentDlgImpl : public SfxListener
150cdf0e10cSrcweir {
151cdf0e10cSrcweir public:
152cdf0e10cSrcweir     AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot );
153cdf0e10cSrcweir     ~AssistentDlgImpl();
154cdf0e10cSrcweir 
1552155a943Smseidel     // Local mutex used to serialize concurrent method calls.
156cdf0e10cSrcweir     ::osl::Mutex maMutex;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     SfxObjectShellLock GetDocument();
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     /** closes the current preview docshell */
161cdf0e10cSrcweir     void CloseDocShell();
162cdf0e10cSrcweir 
1632155a943Smseidel     /** Extract form the history list of recently used files the Impress
164cdf0e10cSrcweir         files and insert them into a listbox.
165cdf0e10cSrcweir     */
166cdf0e10cSrcweir     void    ScanDocmenu         (void);
167cdf0e10cSrcweir     /** Flag that is set to sal_True after the recently used files have been
168cdf0e10cSrcweir         scanned.
169cdf0e10cSrcweir     */
170cdf0e10cSrcweir     sal_Bool mbRecentDocumentsReady;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     /** When the list of templates has not been scanned already this is done
173cdf0e10cSrcweir         when this method is called. That includes requesting the whole list
1742155a943Smseidel         of templates from UCB and extracting from that list the Impress
175cdf0e10cSrcweir         templates and layouts and storing them for later use in
176cdf0e10cSrcweir         <member>maPresentList</member>. Note that the first call to this
177cdf0e10cSrcweir         method after installing a new Office may take some time.
178cdf0e10cSrcweir     */
179cdf0e10cSrcweir     void ProvideTemplates (void);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     /** This method transfers the template folders from the template scanner
182cdf0e10cSrcweir         to the internal structures of this class. On termination it sets
183cdf0e10cSrcweir         the flag <member>mbTemplatesReady</member> to <TRUE/> to indicate
184cdf0e10cSrcweir         that the templates are available.
185cdf0e10cSrcweir         @param rTemplateFolders
186cdf0e10cSrcweir             This is a list of template folders. This method takes ownership
187cdf0e10cSrcweir             of the supplied entries by removing them from the list and
188cdf0e10cSrcweir             transferring them to an internal structure.
189cdf0e10cSrcweir     */
190cdf0e10cSrcweir     void TemplateScanDone (std::vector<TemplateDir*>& rTemplateFolders);
191cdf0e10cSrcweir 
1922155a943Smseidel     /** Flag that is set to sal_True after the Impress templates have been
193cdf0e10cSrcweir         scanned.
194cdf0e10cSrcweir     */
195cdf0e10cSrcweir     sal_Bool mbTemplatesReady;
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     /** Flag used to prevent nested or concurrent calls to the
1982155a943Smseidel         <member>UpdatePreview</member> method. A <TRUE/> value indicates
199cdf0e10cSrcweir         that a preview update is currently active.
200cdf0e10cSrcweir     */
201cdf0e10cSrcweir     sal_Bool mbPreviewUpdating;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     ::Window* mpWindow;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     void SavePassword( SfxObjectShellLock xDoc, const String& rPath );
206cdf0e10cSrcweir     void RestorePassword( SfxItemSet* pSet, const String& rPath );
207cdf0e10cSrcweir     String GetPassword( const String rPath );
208cdf0e10cSrcweir     void DeletePassords();
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     PasswordEntryList maPasswordList;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     String maDocFile;
213cdf0e10cSrcweir     String maLayoutFile;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     String GetDocFileName();
216cdf0e10cSrcweir     String GetLayoutFileName();
217cdf0e10cSrcweir 
2182155a943Smseidel     // List of URLs of recently used Impress files.
219cdf0e10cSrcweir     std::vector<String*> maOpenFilesList;
220cdf0e10cSrcweir 
2212155a943Smseidel     // List of folders containing data about Impress templates.
222cdf0e10cSrcweir     std::vector<TemplateDir*> maPresentList;
223cdf0e10cSrcweir 
2242155a943Smseidel     // Currently selected template folder.
225cdf0e10cSrcweir     TemplateDir* mpTemplateRegion;
226cdf0e10cSrcweir 
2272155a943Smseidel     // Currently selected layout folder.
228cdf0e10cSrcweir     TemplateDir* mpLayoutRegion;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     // preview
231cdf0e10cSrcweir     sal_Bool mbUserDataDirty;
232cdf0e10cSrcweir     Timer maPrevTimer;
233cdf0e10cSrcweir     Timer maEffectPrevTimer;
234cdf0e10cSrcweir     Timer maUpdatePageListTimer;
235cdf0e10cSrcweir     Timer maStartScanTimer;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir     SfxObjectShellLock xDocShell;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     ::std::auto_ptr<WindowUpdater> mpWindowUpdater;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir     sal_Bool mbPreview;
242cdf0e10cSrcweir     sal_uInt16 mnShowPage;
243cdf0e10cSrcweir     sal_Bool mbDocPreview;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     sal_uLong mnTemplate;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir     String maPageListFile;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir     void UpdatePreview( sal_Bool bDocPreview );
250cdf0e10cSrcweir     void UpdatePageList();
251cdf0e10cSrcweir     void UpdateUserData();
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     sal_Bool IsOwnFormat( const String& rPath );
254cdf0e10cSrcweir 
255cdf0e10cSrcweir     // dlg status
256cdf0e10cSrcweir     void EndDialog( long nResult = 0 );
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     void SetStartType( StartType eType );
259cdf0e10cSrcweir     StartType GetStartType();
260cdf0e10cSrcweir 
261cdf0e10cSrcweir     void SelectTemplateRegion( const String& rRegion );
262cdf0e10cSrcweir     void SelectLayoutRegion( const String& rRegion );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     void UpdatePage();
265cdf0e10cSrcweir     void ChangePage();
266cdf0e10cSrcweir     void LeavePage();
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     String GetUiTextForCommand (const ::rtl::OUString& aCommandURL);
269cdf0e10cSrcweir     Image GetUiIconForCommand (const ::rtl::OUString& aCommandURL);
270cdf0e10cSrcweir 
271cdf0e10cSrcweir     DECL_LINK( StartScanHdl, void * );
272cdf0e10cSrcweir     DECL_LINK( SelectFileHdl, ListBox * );
273cdf0e10cSrcweir     DECL_LINK( SelectRegionHdl, ListBox * );
274cdf0e10cSrcweir     DECL_LINK( UpdatePreviewHdl, void * );
275cdf0e10cSrcweir     DECL_LINK( UpdatePageListHdl, void * );
276cdf0e10cSrcweir     DECL_LINK( StartTypeHdl, RadioButton * );
277cdf0e10cSrcweir     DECL_LINK( SelectTemplateHdl, ListBox * );
278cdf0e10cSrcweir     DECL_LINK( NextPageHdl, PushButton * );
279cdf0e10cSrcweir     DECL_LINK( LastPageHdl, PushButton * );
280cdf0e10cSrcweir     DECL_LINK( PreviewFlagHdl, CheckBox * );
281cdf0e10cSrcweir     DECL_LINK( EffectPreviewHdl, Button * );
282cdf0e10cSrcweir     DECL_LINK( SelectLayoutHdl, ListBox * );
283cdf0e10cSrcweir     DECL_LINK( PageSelectHdl, Control * );
284cdf0e10cSrcweir     DECL_LINK( PresTypeHdl, RadioButton * );
285cdf0e10cSrcweir     DECL_LINK( UpdateUserDataHdl, Edit* );
286cdf0e10cSrcweir     DECL_LINK( SelectEffectHdl, void* );
287cdf0e10cSrcweir     DECL_LINK( OpenButtonHdl, Button * );
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     // Common
290cdf0e10cSrcweir     Assistent           maAssistentFunc;
291cdf0e10cSrcweir     CheckBox            maPreviewFlag;
292cdf0e10cSrcweir     CheckBox            maStartWithFlag;
293cdf0e10cSrcweir     HelpButton          maHelpButton;
294cdf0e10cSrcweir     CancelButton        maCancelButton;
295cdf0e10cSrcweir     PushButton          maLastPageButton;
296cdf0e10cSrcweir     NextButton          maNextPageButton;
297cdf0e10cSrcweir     OKButton            maFinishButton;
298cdf0e10cSrcweir     SdDocPreviewWin     maPreview;
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     String              maCreateStr;
301cdf0e10cSrcweir     String              maOpenStr;
302cdf0e10cSrcweir 
3032155a943Smseidel     // Page 1
304cdf0e10cSrcweir     FixedBitmap*        mpPage1FB;
305cdf0e10cSrcweir     FixedLine*          mpPage1ArtFL;
306cdf0e10cSrcweir     RadioButton*        mpPage1EmptyRB;
307cdf0e10cSrcweir     RadioButton*        mpPage1TemplateRB;
308cdf0e10cSrcweir     ListBox*            mpPage1RegionLB;
309cdf0e10cSrcweir     ListBox*            mpPage1TemplateLB;
310cdf0e10cSrcweir     RadioButton*        mpPage1OpenRB;
311cdf0e10cSrcweir     ListBox*            mpPage1OpenLB;
312cdf0e10cSrcweir     PushButton*         mpPage1OpenPB;
313cdf0e10cSrcweir 
3142155a943Smseidel     // Page 2
315cdf0e10cSrcweir     FixedBitmap*        mpPage2FB;
316cdf0e10cSrcweir     FixedLine*          mpPage2LayoutFL;
317cdf0e10cSrcweir     ListBox*            mpPage2RegionLB;
318cdf0e10cSrcweir     ListBox*            mpPage2LayoutLB;
319cdf0e10cSrcweir     FixedLine*          mpPage2OutTypesFL;
320cdf0e10cSrcweir     RadioButton*        mpPage2Medium1RB;
321cdf0e10cSrcweir     RadioButton*        mpPage2Medium2RB;
322cdf0e10cSrcweir     RadioButton*        mpPage2Medium3RB;
323cdf0e10cSrcweir     RadioButton*        mpPage2Medium4RB;
324cdf0e10cSrcweir     RadioButton*        mpPage2Medium5RB;
325*dad2ac5bSMatthias Seidel     RadioButton*        mpPage2Medium6RB;
326cdf0e10cSrcweir 
3272155a943Smseidel     // Page 3
328cdf0e10cSrcweir     FixedBitmap*        mpPage3FB;
329cdf0e10cSrcweir     FixedLine*          mpPage3EffectFL;
330cdf0e10cSrcweir     FixedText*          mpPage3EffectFT;
331cdf0e10cSrcweir     FadeEffectLB*       mpPage3EffectLB;
332cdf0e10cSrcweir     FixedText*          mpPage3SpeedFT;
333cdf0e10cSrcweir     ListBox*            mpPage3SpeedLB;
334cdf0e10cSrcweir     FixedLine*          mpPage3PresTypeFL;
335cdf0e10cSrcweir     RadioButton*        mpPage3PresTypeLiveRB;
336cdf0e10cSrcweir     RadioButton*        mpPage3PresTypeKioskRB;
337cdf0e10cSrcweir     FixedText*          mpPage3PresTimeFT;
338cdf0e10cSrcweir     TimeField*          mpPage3PresTimeTMF;
339cdf0e10cSrcweir     FixedText*          mpPage3BreakFT;
340cdf0e10cSrcweir     TimeField*          mpPage3BreakTMF;
341cdf0e10cSrcweir     CheckBox*           mpPage3LogoCB;
342cdf0e10cSrcweir 
3432155a943Smseidel     // Page 4
344cdf0e10cSrcweir     FixedBitmap*        mpPage4FB;
345cdf0e10cSrcweir     FixedLine*          mpPage4PersonalFL;
346cdf0e10cSrcweir     FixedText*          mpPage4AskNameFT;
347cdf0e10cSrcweir     Edit*               mpPage4AskNameEDT;
348cdf0e10cSrcweir     FixedText*          mpPage4AskTopicFT;
349cdf0e10cSrcweir     Edit*               mpPage4AskTopicEDT;
350cdf0e10cSrcweir     FixedText*          mpPage4AskInfoFT;
351cdf0e10cSrcweir     MultiLineEdit*      mpPage4AskInfoEDT;
352cdf0e10cSrcweir 
3532155a943Smseidel     // Page 5
354cdf0e10cSrcweir     FixedBitmap*        mpPage5FB;
355cdf0e10cSrcweir     FixedText*          mpPage5PageListFT;
356cdf0e10cSrcweir     SdPageListControl*  mpPage5PageListCT;
357cdf0e10cSrcweir     CheckBox*           mpPage5SummaryCB;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir };
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 
363cdf0e10cSrcweir // ====================================================================
364cdf0e10cSrcweir 
AssistentDlgImpl(::Window * pWindow,const Link & rFinishLink,sal_Bool bAutoPilot)365cdf0e10cSrcweir AssistentDlgImpl::AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot ) :
366cdf0e10cSrcweir     mpTemplateRegion(NULL),
367cdf0e10cSrcweir     mpLayoutRegion(NULL),
368cdf0e10cSrcweir     mbUserDataDirty(sal_False),
369cdf0e10cSrcweir     xDocShell (NULL),
370cdf0e10cSrcweir     mpWindowUpdater (new WindowUpdater()),
371cdf0e10cSrcweir     mbPreview(sal_True),
372cdf0e10cSrcweir     mnShowPage(0),
373cdf0e10cSrcweir     mbDocPreview(sal_False),
374cdf0e10cSrcweir     maAssistentFunc(5),
375cdf0e10cSrcweir     maPreviewFlag(pWindow,SdResId(CB_PREVIEW)),
376cdf0e10cSrcweir     maStartWithFlag(pWindow,SdResId(CB_STARTWITH)),
377cdf0e10cSrcweir     maHelpButton(pWindow,SdResId(BUT_HELP)),
378cdf0e10cSrcweir     maCancelButton(pWindow,SdResId(BUT_CANCEL)),
379cdf0e10cSrcweir     maLastPageButton(pWindow,SdResId(BUT_LAST)),
380cdf0e10cSrcweir     maNextPageButton(pWindow,SdResId(BUT_NEXT)),
381cdf0e10cSrcweir     maFinishButton(pWindow,SdResId(BUT_FINISH)),
382cdf0e10cSrcweir     maPreview(pWindow,SdResId(CT_PREVIEW)),
383cdf0e10cSrcweir     maCreateStr(SdResId(STR_CREATE)),
384cdf0e10cSrcweir     maOpenStr(SdResId(STR_OPEN))
385cdf0e10cSrcweir {
386cdf0e10cSrcweir     maPageListFile += sal_Unicode('?'),
387cdf0e10cSrcweir     mbRecentDocumentsReady = sal_False;
388cdf0e10cSrcweir     mbTemplatesReady = sal_False;
389cdf0e10cSrcweir     mbPreviewUpdating = sal_False;
390cdf0e10cSrcweir 
391cdf0e10cSrcweir     mpWindow = pWindow;
392cdf0e10cSrcweir 
393cdf0e10cSrcweir     if(bAutoPilot)
394cdf0e10cSrcweir         maStartWithFlag.Hide();
395cdf0e10cSrcweir     else
396cdf0e10cSrcweir         maAssistentFunc.InsertControl(1, &maStartWithFlag );
397cdf0e10cSrcweir 
3982155a943Smseidel     // Page1 wird initialisiert und an die Assistentenfunktionalitaet
399cdf0e10cSrcweir     // uebergeben
400cdf0e10cSrcweir     maAssistentFunc.InsertControl(1, &maPreview );
401cdf0e10cSrcweir     maAssistentFunc.InsertControl(1, &maPreviewFlag );
402cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
403cdf0e10cSrcweir         mpPage1FB = new FixedBitmap(pWindow,SdResId(FB_PAGE1)));
404cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
405cdf0e10cSrcweir         mpPage1ArtFL = new FixedLine(pWindow,SdResId(FL_PAGE1_ARTGROUP)));
406cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
407cdf0e10cSrcweir         mpPage1EmptyRB=new RadioButton(pWindow,SdResId(RB_PAGE1_EMPTY)));
408cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
409cdf0e10cSrcweir         mpPage1TemplateRB=new RadioButton(pWindow,SdResId(RB_PAGE1_TEMPLATE)));
410cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
411cdf0e10cSrcweir         mpPage1OpenRB=new RadioButton(pWindow,SdResId(RB_PAGE1_OPEN)));
412cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
413cdf0e10cSrcweir         mpPage1RegionLB = new ListBox(pWindow,SdResId(LB_PAGE1_REGION)));
414cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
415cdf0e10cSrcweir         mpPage1TemplateLB=new ListBox(pWindow,SdResId(LB_PAGE1_TEMPLATES)));
416cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
417cdf0e10cSrcweir         mpPage1OpenPB=new PushButton(pWindow,SdResId(PB_PAGE1_OPEN)));
418cdf0e10cSrcweir     maAssistentFunc.InsertControl(1,
419cdf0e10cSrcweir         mpPage1OpenLB=new ListBox(pWindow,SdResId(LB_PAGE1_OPEN)));
420cdf0e10cSrcweir 
421cdf0e10cSrcweir     // Align the button and list box displayed for the "open existing file"
422cdf0e10cSrcweir     // radio button with the text of that radio button.
423cdf0e10cSrcweir     {
424cdf0e10cSrcweir         RadioButton aEmptyRB (mpWindow);
425cdf0e10cSrcweir         sal_Int32 nIndent (aEmptyRB.CalcMinimumSize(0).Width());
426cdf0e10cSrcweir         sal_Int32 nLeft (mpPage1OpenRB->GetPosPixel().X() + nIndent);
427cdf0e10cSrcweir         sal_Int32 nWidth (mpPage1OpenRB->GetSizePixel().Width() - nIndent);
428cdf0e10cSrcweir         mpPage1OpenPB->SetPosSizePixel(
429cdf0e10cSrcweir             Point(nLeft, mpPage1OpenPB->GetPosPixel().Y()),
430cdf0e10cSrcweir             Size(mpPage1OpenPB->GetSizePixel()));
431cdf0e10cSrcweir         mpPage1OpenLB->SetPosSizePixel(
432cdf0e10cSrcweir             Point(nLeft, mpPage1OpenLB->GetPosPixel().Y()),
433cdf0e10cSrcweir             Size(nWidth, mpPage1OpenLB->GetSizePixel().Height()));
434cdf0e10cSrcweir     }
435cdf0e10cSrcweir 
436cdf0e10cSrcweir     // Set text and icon of the 'Open...' button.
437cdf0e10cSrcweir     {
438cdf0e10cSrcweir         String sText (GetUiTextForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))));
439cdf0e10cSrcweir         // Remove the mnemonic and add a leading space so that icon and text
440cdf0e10cSrcweir         // are not too close together.
441cdf0e10cSrcweir         sText.SearchAndReplaceAll(String(RTL_CONSTASCII_STRINGPARAM("~")),String());
442cdf0e10cSrcweir         sText.Insert(String(RTL_CONSTASCII_STRINGPARAM(" ")),0);
443cdf0e10cSrcweir         mpPage1OpenPB->SetText(sText);
444cdf0e10cSrcweir         // Place icon left of text and both centered in the button.
445cdf0e10cSrcweir         mpPage1OpenPB->SetModeImage(
446cdf0e10cSrcweir             GetUiIconForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))),
447cdf0e10cSrcweir             BMP_COLOR_NORMAL);
448cdf0e10cSrcweir         mpPage1OpenPB->EnableImageDisplay(sal_True);
449cdf0e10cSrcweir         mpPage1OpenPB->EnableTextDisplay(sal_True);
450cdf0e10cSrcweir         mpPage1OpenPB->SetImageAlign(IMAGEALIGN_LEFT);
451cdf0e10cSrcweir         mpPage1OpenPB->SetStyle(mpPage1OpenPB->GetStyle() | WB_CENTER);
452cdf0e10cSrcweir     }
453cdf0e10cSrcweir 
454cdf0e10cSrcweir     // links&handler
455cdf0e10cSrcweir     mpPage1RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
456cdf0e10cSrcweir     mpPage1RegionLB->SetDropDownLineCount( 6 );
457cdf0e10cSrcweir     mpPage1TemplateLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectTemplateHdl));
458cdf0e10cSrcweir     mpPage1TemplateLB->InsertEntry(String(SdResId(STR_ISLOADING)));
459cdf0e10cSrcweir 
460cdf0e10cSrcweir     mpPage1EmptyRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
461cdf0e10cSrcweir     mpPage1TemplateRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
462cdf0e10cSrcweir     mpPage1OpenRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
463cdf0e10cSrcweir     mpPage1OpenLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectFileHdl));
464cdf0e10cSrcweir     mpPage1OpenLB->SetDoubleClickHdl(rFinishLink);
465cdf0e10cSrcweir     mpPage1OpenPB->SetClickHdl(LINK(this,AssistentDlgImpl,OpenButtonHdl));
466cdf0e10cSrcweir //  mpPage1OpenLB->InsertEntry(String(SdResId(STR_WIZARD_POSITION)));
467cdf0e10cSrcweir 
4682155a943Smseidel     // Page 2
469cdf0e10cSrcweir     maAssistentFunc.InsertControl(2, &maPreview );
470cdf0e10cSrcweir     maAssistentFunc.InsertControl(2, &maPreviewFlag );
471cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
472cdf0e10cSrcweir         mpPage2FB = new FixedBitmap(pWindow,SdResId(FB_PAGE2)));
473cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
474cdf0e10cSrcweir         mpPage2LayoutFL = new FixedLine( pWindow, SdResId(FL_PAGE2_LAYOUT) ));
475cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
476cdf0e10cSrcweir         mpPage2RegionLB = new ListBox(pWindow,SdResId(LB_PAGE2_REGION) ));
477cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
478cdf0e10cSrcweir         mpPage2LayoutLB = new ListBox(pWindow,SdResId(LB_PAGE2_LAYOUT) ));
479cdf0e10cSrcweir 
480cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
481cdf0e10cSrcweir         mpPage2OutTypesFL = new FixedLine( pWindow, SdResId(FL_PAGE2_OUTPUTTYPES) ));
482cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
483cdf0e10cSrcweir         mpPage2Medium5RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM5) ));
484cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
485cdf0e10cSrcweir         mpPage2Medium3RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM3) ));
486cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
487cdf0e10cSrcweir         mpPage2Medium4RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM4) ));
488cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
489cdf0e10cSrcweir         mpPage2Medium1RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM1) ));
490cdf0e10cSrcweir     maAssistentFunc.InsertControl(2,
491cdf0e10cSrcweir         mpPage2Medium2RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM2) ));
492*dad2ac5bSMatthias Seidel     maAssistentFunc.InsertControl(2,
493*dad2ac5bSMatthias Seidel         mpPage2Medium6RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM6) ));
494cdf0e10cSrcweir     mpPage2Medium5RB->Check();
495cdf0e10cSrcweir 
496cdf0e10cSrcweir     mpPage2RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
497cdf0e10cSrcweir     mpPage2RegionLB->SetDropDownLineCount( 6 );
498cdf0e10cSrcweir     mpPage2LayoutLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectLayoutHdl));
499cdf0e10cSrcweir     mpPage2LayoutLB->InsertEntry(String(SdResId(STR_ISLOADING)));
500cdf0e10cSrcweir 
5012155a943Smseidel     // Page 3
502cdf0e10cSrcweir     maAssistentFunc.InsertControl(3, &maPreview );
503cdf0e10cSrcweir     maAssistentFunc.InsertControl(3, &maPreviewFlag );
504cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
505cdf0e10cSrcweir         mpPage3FB = new FixedBitmap(pWindow,SdResId(FB_PAGE3)));
506cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
507cdf0e10cSrcweir         mpPage3EffectFL = new FixedLine( pWindow, SdResId(FL_PAGE3_EFFECT) ));
508cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
509cdf0e10cSrcweir         mpPage3EffectFT = new FixedText( pWindow, SdResId(FT_PAGE3_EFFECT) ));
510cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
511cdf0e10cSrcweir         mpPage3EffectLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_EFFECT) ));
512cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
513cdf0e10cSrcweir         mpPage3SpeedFT = new FixedText( pWindow, SdResId(FT_PAGE3_SPEED) ));
514cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
515cdf0e10cSrcweir         mpPage3SpeedLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_SPEED) ));
516cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
517cdf0e10cSrcweir         mpPage3PresTypeFL = new FixedLine( pWindow, SdResId(FL_PAGE3_PRESTYPE) ));
518cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
519cdf0e10cSrcweir         mpPage3PresTypeLiveRB = new RadioButton( pWindow, SdResId(RB_PAGE3_LIVE) ));
520cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
521cdf0e10cSrcweir         mpPage3PresTypeKioskRB = new RadioButton( pWindow, SdResId(RB_PAGE3_KIOSK) ));
522cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
523cdf0e10cSrcweir         mpPage3PresTimeFT = new FixedText( pWindow, SdResId( FT_PAGE3_TIME) ));
524cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
525cdf0e10cSrcweir         mpPage3PresTimeTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_TIME) ));
526cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
527cdf0e10cSrcweir         mpPage3BreakFT = new FixedText( pWindow, SdResId( FT_PAGE3_BREAK) ));
528cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
529cdf0e10cSrcweir         mpPage3BreakTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_BREAK) ));
530cdf0e10cSrcweir     maAssistentFunc.InsertControl(3,
531cdf0e10cSrcweir         mpPage3LogoCB = new CheckBox( pWindow, SdResId( CB_PAGE3_LOGO) ));
532cdf0e10cSrcweir 
533cdf0e10cSrcweir     mpPage3EffectLB->Fill();
534cdf0e10cSrcweir //  mpPage3EffectLB->SelectEffect( presentation::FadeEffect_NONE );
535cdf0e10cSrcweir     mpPage3EffectLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
536cdf0e10cSrcweir     mpPage3EffectLB->SetDropDownLineCount( 12 );
537cdf0e10cSrcweir 
538cdf0e10cSrcweir     mpPage3SpeedLB->InsertEntry( String( SdResId(STR_SLOW) ));
539cdf0e10cSrcweir     mpPage3SpeedLB->InsertEntry( String( SdResId(STR_MEDIUM) ));
540cdf0e10cSrcweir     mpPage3SpeedLB->InsertEntry( String( SdResId(STR_FAST) ));
541cdf0e10cSrcweir     mpPage3SpeedLB->SetDropDownLineCount( 3 );
542cdf0e10cSrcweir     mpPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
543cdf0e10cSrcweir     mpPage3SpeedLB->SelectEntryPos( 1 );
544cdf0e10cSrcweir 
545cdf0e10cSrcweir     mpPage3PresTypeLiveRB->Check();
546cdf0e10cSrcweir     mpPage3PresTypeLiveRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
547cdf0e10cSrcweir     mpPage3PresTypeKioskRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
548cdf0e10cSrcweir     mpPage3PresTimeTMF->SetFormat( TIMEF_SEC );
549cdf0e10cSrcweir     mpPage3PresTimeTMF->SetTime( Time( 0, 0, 10 ) );
550cdf0e10cSrcweir     mpPage3BreakTMF->SetFormat( TIMEF_SEC );
551cdf0e10cSrcweir     mpPage3BreakTMF->SetTime( Time( 0, 0, 10 ) );
552cdf0e10cSrcweir     mpPage3LogoCB->Check();
553cdf0e10cSrcweir 
554cdf0e10cSrcweir     // set cursor in timefield
555cdf0e10cSrcweir     Edit *pEditPage3PresTimeTMF = mpPage3PresTimeTMF->GetField();
556cdf0e10cSrcweir     Edit *pEditPage3BreakTMF = mpPage3BreakTMF->GetField();
557cdf0e10cSrcweir     Selection aSel1( pEditPage3PresTimeTMF->GetMaxTextLen(), pEditPage3PresTimeTMF->GetMaxTextLen() );
558cdf0e10cSrcweir     Selection aSel2( pEditPage3BreakTMF->GetMaxTextLen(), pEditPage3BreakTMF->GetMaxTextLen() );
559cdf0e10cSrcweir     pEditPage3PresTimeTMF->SetSelection( aSel1 );
560cdf0e10cSrcweir     pEditPage3BreakTMF->SetSelection( aSel2 );
561cdf0e10cSrcweir 
5622155a943Smseidel     // Page 4
563cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
564cdf0e10cSrcweir         mpPage4FB = new FixedBitmap(pWindow,SdResId(FB_PAGE4)));
565cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
566cdf0e10cSrcweir         mpPage4PersonalFL = new FixedLine( pWindow, SdResId(FL_PAGE4_PERSONAL) ));
567cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
568cdf0e10cSrcweir         mpPage4AskNameFT   = new FixedText( pWindow, SdResId(FT_PAGE4_ASKNAME) ));
569cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
570cdf0e10cSrcweir         mpPage4AskNameEDT  = new Edit( pWindow, SdResId(EDT_PAGE4_ASKNAME) ));
571cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
572cdf0e10cSrcweir         mpPage4AskTopicFT= new FixedText( pWindow, SdResId(FT_PAGE4_ASKTOPIC) ));
573cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
574cdf0e10cSrcweir         mpPage4AskTopicEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKTOPIC) ));
575cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
576cdf0e10cSrcweir         mpPage4AskInfoFT   = new FixedText( pWindow, SdResId(FT_PAGE4_ASKINFORMATION) ));
577cdf0e10cSrcweir     maAssistentFunc.InsertControl(4,
578cdf0e10cSrcweir         mpPage4AskInfoEDT  = new MultiLineEdit( pWindow, SdResId(EDT_PAGE4_ASKINFORMATION) ));
579cdf0e10cSrcweir 
580cdf0e10cSrcweir     mpPage4AskNameEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
581cdf0e10cSrcweir     mpPage4AskTopicEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
582cdf0e10cSrcweir     mpPage4AskInfoEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
583cdf0e10cSrcweir 
5842155a943Smseidel     // Page 5
585cdf0e10cSrcweir     maAssistentFunc.InsertControl(5, &maPreview );
586cdf0e10cSrcweir     maAssistentFunc.InsertControl(5, &maPreviewFlag );
587cdf0e10cSrcweir     maAssistentFunc.InsertControl(5,
588cdf0e10cSrcweir         mpPage5FB = new FixedBitmap(pWindow,SdResId(FB_PAGE5)));
589cdf0e10cSrcweir     maAssistentFunc.InsertControl(5,
590cdf0e10cSrcweir         mpPage5PageListFT = new FixedText( pWindow, SdResId( FT_PAGE5_PAGELIST ) ));
591cdf0e10cSrcweir     maAssistentFunc.InsertControl(5,
592cdf0e10cSrcweir         mpPage5PageListCT = new SdPageListControl( pWindow, SdResId( CT_PAGE5_PAGELIST ) ));
593cdf0e10cSrcweir     maAssistentFunc.InsertControl(5,
594cdf0e10cSrcweir         mpPage5SummaryCB  = new CheckBox( pWindow, SdResId( CB_PAGE5_SUMMARY ) ));
595cdf0e10cSrcweir 
596cdf0e10cSrcweir     mpPage5PageListCT->SetSelectHdl(LINK(this,AssistentDlgImpl, PageSelectHdl));
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 
5992155a943Smseidel     // General
600cdf0e10cSrcweir     InterpolateFixedBitmap( mpPage1FB );
601cdf0e10cSrcweir     InterpolateFixedBitmap( mpPage2FB );
602cdf0e10cSrcweir     InterpolateFixedBitmap( mpPage3FB );
603cdf0e10cSrcweir     InterpolateFixedBitmap( mpPage4FB );
604cdf0e10cSrcweir     InterpolateFixedBitmap( mpPage5FB );
605cdf0e10cSrcweir 
606cdf0e10cSrcweir     maLastPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, LastPageHdl ));
607cdf0e10cSrcweir     maNextPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, NextPageHdl ));
608cdf0e10cSrcweir 
609cdf0e10cSrcweir     maPreviewFlag.Check( mbPreview );
610cdf0e10cSrcweir     maPreviewFlag.SetClickHdl(LINK(this, AssistentDlgImpl, PreviewFlagHdl ));
611cdf0e10cSrcweir     maPreview.SetClickHdl(LINK(this,AssistentDlgImpl, EffectPreviewHdl ));
612cdf0e10cSrcweir 
613cdf0e10cSrcweir     // setzt die Ausgangsseite
614cdf0e10cSrcweir     maAssistentFunc.GotoPage(1);
615cdf0e10cSrcweir     maLastPageButton.Disable();
616cdf0e10cSrcweir 
617cdf0e10cSrcweir     maPrevTimer.SetTimeout( 200 );
618cdf0e10cSrcweir     maPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePreviewHdl));
619cdf0e10cSrcweir 
620cdf0e10cSrcweir     maEffectPrevTimer.SetTimeout( 50 );
621cdf0e10cSrcweir     maEffectPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, EffectPreviewHdl ));
622cdf0e10cSrcweir 
623cdf0e10cSrcweir     maUpdatePageListTimer.SetTimeout( 50 );
624cdf0e10cSrcweir     maUpdatePageListTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePageListHdl));
625cdf0e10cSrcweir 
626cdf0e10cSrcweir     SetStartType( ST_EMPTY );
627cdf0e10cSrcweir 
628cdf0e10cSrcweir     ChangePage();
629cdf0e10cSrcweir 
630cdf0e10cSrcweir     mpWindowUpdater->RegisterWindow (&maPreview);
631cdf0e10cSrcweir 
632cdf0e10cSrcweir     UpdatePreview( sal_True );
633cdf0e10cSrcweir 
6342155a943Smseidel     // check whether we should start with a template document initially and preselect it
635cdf0e10cSrcweir     const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) );
636cdf0e10cSrcweir     String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) );
637cdf0e10cSrcweir     if( aStandardTemplate.Len() )
638cdf0e10cSrcweir     {
639cdf0e10cSrcweir         ProvideTemplates();
640cdf0e10cSrcweir 
641cdf0e10cSrcweir         // find aStandardTemplate in maPresentList
642cdf0e10cSrcweir         TemplateDir*   pStandardTemplateDir = 0;
643cdf0e10cSrcweir         TemplateEntry* pStandardTemplateEntry = 0;
644cdf0e10cSrcweir 
645cdf0e10cSrcweir         std::vector<TemplateDir*>::iterator I;
646cdf0e10cSrcweir         for (I=maPresentList.begin(); I!=maPresentList.end(); I++)
647cdf0e10cSrcweir         {
648cdf0e10cSrcweir             TemplateDir* pDir = *I;
649cdf0e10cSrcweir             std::vector<TemplateEntry*>::iterator   J;
650cdf0e10cSrcweir             for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); J++)
651cdf0e10cSrcweir             {
652cdf0e10cSrcweir                 TemplateEntry* pEntry = *J;
653cdf0e10cSrcweir                 if(pEntry->msPath == aStandardTemplate)
654cdf0e10cSrcweir                 {
655cdf0e10cSrcweir                     pStandardTemplateDir = pDir;
656cdf0e10cSrcweir                     pStandardTemplateEntry = pEntry;
657cdf0e10cSrcweir                     break;
658cdf0e10cSrcweir                 }
659cdf0e10cSrcweir             }
660cdf0e10cSrcweir             if(pStandardTemplateDir)
661cdf0e10cSrcweir                 break;
662cdf0e10cSrcweir         }
663cdf0e10cSrcweir 
664cdf0e10cSrcweir         // preselect template
665cdf0e10cSrcweir         if( pStandardTemplateDir && pStandardTemplateEntry )
666cdf0e10cSrcweir         {
667cdf0e10cSrcweir             mpPage1RegionLB->SelectEntry( pStandardTemplateDir->msRegion );
668cdf0e10cSrcweir             SelectTemplateRegion( pStandardTemplateDir->msRegion );
669cdf0e10cSrcweir             mpPage1TemplateLB->SelectEntry( pStandardTemplateEntry->msTitle );
670cdf0e10cSrcweir             SelectTemplateHdl(mpPage1TemplateLB);
671cdf0e10cSrcweir         }
672cdf0e10cSrcweir     }
673cdf0e10cSrcweir }
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 
676cdf0e10cSrcweir 
677cdf0e10cSrcweir 
~AssistentDlgImpl()678cdf0e10cSrcweir AssistentDlgImpl::~AssistentDlgImpl()
679cdf0e10cSrcweir {
680cdf0e10cSrcweir     CloseDocShell();
681cdf0e10cSrcweir 
682cdf0e10cSrcweir     DeletePassords();
683cdf0e10cSrcweir 
684cdf0e10cSrcweir     // Delete the template file infos.
685cdf0e10cSrcweir     std::vector<TemplateDir*>::iterator I;
686cdf0e10cSrcweir     std::vector<TemplateEntry*>::iterator   J;
687cdf0e10cSrcweir     for (I=maPresentList.begin(); I!=maPresentList.end(); I++)
688cdf0e10cSrcweir     {
689cdf0e10cSrcweir         for (J=(*I)->maEntries.begin(); J!=(*I)->maEntries.end(); J++)
690cdf0e10cSrcweir             delete (*J);
691cdf0e10cSrcweir         delete (*I);
692cdf0e10cSrcweir     }
693cdf0e10cSrcweir 
6942155a943Smseidel     // Page 1
695cdf0e10cSrcweir     delete mpPage1FB;
696cdf0e10cSrcweir     delete mpPage1ArtFL;
697cdf0e10cSrcweir     delete mpPage1EmptyRB;
698cdf0e10cSrcweir     delete mpPage1TemplateRB;
699cdf0e10cSrcweir     delete mpPage1TemplateLB;
700cdf0e10cSrcweir     delete mpPage1RegionLB;
701cdf0e10cSrcweir     delete mpPage1OpenRB;
702cdf0e10cSrcweir     delete mpPage1OpenLB;
703cdf0e10cSrcweir     delete mpPage1OpenPB;
704cdf0e10cSrcweir 
7052155a943Smseidel     // Page 2
706cdf0e10cSrcweir     delete mpPage2FB;
707cdf0e10cSrcweir     delete mpPage2LayoutFL;
708cdf0e10cSrcweir     delete mpPage2RegionLB;
709cdf0e10cSrcweir     delete mpPage2LayoutLB;
710cdf0e10cSrcweir     delete mpPage2OutTypesFL;
711cdf0e10cSrcweir     delete mpPage2Medium1RB;
712cdf0e10cSrcweir     delete mpPage2Medium2RB;
713cdf0e10cSrcweir     delete mpPage2Medium3RB;
714cdf0e10cSrcweir     delete mpPage2Medium4RB;
715cdf0e10cSrcweir     delete mpPage2Medium5RB;
716*dad2ac5bSMatthias Seidel     delete mpPage2Medium6RB;
717cdf0e10cSrcweir 
7182155a943Smseidel     // Page 3
719cdf0e10cSrcweir     delete mpPage3FB;
720cdf0e10cSrcweir     delete mpPage3EffectFL;
721cdf0e10cSrcweir     delete mpPage3EffectFT;
722cdf0e10cSrcweir     delete mpPage3EffectLB;
723cdf0e10cSrcweir     delete mpPage3SpeedFT;
724cdf0e10cSrcweir     delete mpPage3SpeedLB;
725cdf0e10cSrcweir     delete mpPage3PresTypeFL;
726cdf0e10cSrcweir     delete mpPage3PresTypeLiveRB;
727cdf0e10cSrcweir     delete mpPage3PresTypeKioskRB;
728cdf0e10cSrcweir     delete mpPage3PresTimeFT;
729cdf0e10cSrcweir     delete mpPage3PresTimeTMF;
730cdf0e10cSrcweir     delete mpPage3BreakFT;
731cdf0e10cSrcweir     delete mpPage3BreakTMF;
732cdf0e10cSrcweir     delete mpPage3LogoCB;
733cdf0e10cSrcweir 
7342155a943Smseidel     // Page 4
735cdf0e10cSrcweir     delete mpPage4FB;
736cdf0e10cSrcweir     delete mpPage4PersonalFL;
737cdf0e10cSrcweir     delete mpPage4AskNameFT;
738cdf0e10cSrcweir     delete mpPage4AskNameEDT;
739cdf0e10cSrcweir     delete mpPage4AskTopicFT;
740cdf0e10cSrcweir     delete mpPage4AskTopicEDT;
741cdf0e10cSrcweir     delete mpPage4AskInfoFT;
742cdf0e10cSrcweir     delete mpPage4AskInfoEDT;
743cdf0e10cSrcweir 
7442155a943Smseidel     // Page 5
745cdf0e10cSrcweir     delete mpPage5FB;
746cdf0e10cSrcweir     delete mpPage5PageListFT;
747cdf0e10cSrcweir     delete mpPage5PageListCT;
748cdf0e10cSrcweir     delete mpPage5SummaryCB;
749cdf0e10cSrcweir 
750cdf0e10cSrcweir     // Delete the file history list.
751cdf0e10cSrcweir     std::vector<String*>::iterator  I2;
752cdf0e10cSrcweir     for (I2=maOpenFilesList.begin(); I2!=maOpenFilesList.end(); I2++)
753cdf0e10cSrcweir         delete *I2;
754cdf0e10cSrcweir }
755cdf0e10cSrcweir 
CloseDocShell()756cdf0e10cSrcweir void AssistentDlgImpl::CloseDocShell()
757cdf0e10cSrcweir {
758cdf0e10cSrcweir     if(xDocShell.Is())
759cdf0e10cSrcweir     {
760cdf0e10cSrcweir         //uno::Reference< lang::XComponent > xModel( xDocShell->GetModel(), uno::UNO_QUERY );
761cdf0e10cSrcweir         uno::Reference< util::XCloseable > xCloseable( xDocShell->GetModel(), uno::UNO_QUERY );
762cdf0e10cSrcweir         //if( xModel.is() )
763cdf0e10cSrcweir         if( xCloseable.is() )
764cdf0e10cSrcweir         {
765cdf0e10cSrcweir             xCloseable->close( sal_True );
766cdf0e10cSrcweir             xDocShell = NULL;
767cdf0e10cSrcweir             //xModel->dispose();
768cdf0e10cSrcweir         }
769cdf0e10cSrcweir         else
770cdf0e10cSrcweir         {
771cdf0e10cSrcweir             xDocShell->DoClose();
772cdf0e10cSrcweir             xDocShell = NULL;
773cdf0e10cSrcweir         }
774cdf0e10cSrcweir     }
775cdf0e10cSrcweir }
776cdf0e10cSrcweir 
EndDialog(long)777cdf0e10cSrcweir void AssistentDlgImpl::EndDialog( long )
778cdf0e10cSrcweir {
779cdf0e10cSrcweir     mpWindow = NULL;
780cdf0e10cSrcweir }
781cdf0e10cSrcweir 
782cdf0e10cSrcweir 
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 
ScanDocmenu(void)785cdf0e10cSrcweir void    AssistentDlgImpl::ScanDocmenu   (void)
786cdf0e10cSrcweir {
787cdf0e10cSrcweir     if( mbRecentDocumentsReady )
788cdf0e10cSrcweir         return;
789cdf0e10cSrcweir 
790cdf0e10cSrcweir     uno::Sequence<uno::Sequence<beans::PropertyValue> > aHistory =
791cdf0e10cSrcweir         SvtHistoryOptions().GetList (ePICKLIST);
792cdf0e10cSrcweir 
793cdf0e10cSrcweir     uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
794cdf0e10cSrcweir     uno::Reference< container::XNameAccess > xFilterFactory( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) ) ), uno::UNO_QUERY );
795cdf0e10cSrcweir 
796cdf0e10cSrcweir     Reference< ::com::sun::star::ucb::XSimpleFileAccess > xFileAccess(
797cdf0e10cSrcweir         xFactory->createInstance(
798cdf0e10cSrcweir             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))),
799cdf0e10cSrcweir         UNO_QUERY_THROW);
800cdf0e10cSrcweir 
801cdf0e10cSrcweir     sal_uInt32 nCount = aHistory.getLength();
802cdf0e10cSrcweir     for (sal_uInt32 nItem=0; nItem<nCount; ++nItem)
803cdf0e10cSrcweir     {
804cdf0e10cSrcweir         // Get the current history item's properties.
805cdf0e10cSrcweir         uno::Sequence<beans::PropertyValue> aPropertySet = aHistory[nItem];
806cdf0e10cSrcweir         rtl::OUString   sURL;
807cdf0e10cSrcweir         rtl::OUString   sFilter;
808cdf0e10cSrcweir         rtl::OUString   sTitle;
809cdf0e10cSrcweir         rtl::OUString   sPassword;
810cdf0e10cSrcweir         sal_uInt32 nPropertyCount = aPropertySet.getLength();
811cdf0e10cSrcweir         for (sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty)
812cdf0e10cSrcweir             if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_URL)
813cdf0e10cSrcweir                 aPropertySet[nProperty].Value >>= sURL;
814cdf0e10cSrcweir             else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_FILTER)
815cdf0e10cSrcweir                 aPropertySet[nProperty].Value >>= sFilter;
816cdf0e10cSrcweir             else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_TITLE)
817cdf0e10cSrcweir                 aPropertySet[nProperty].Value >>= sTitle;
818cdf0e10cSrcweir             else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_PASSWORD)
819cdf0e10cSrcweir                 aPropertySet[nProperty].Value >>= sPassword;
820cdf0e10cSrcweir 
8212155a943Smseidel         // If the entry is an Impress file then insert it into the
822cdf0e10cSrcweir         // history list and the list box.
823cdf0e10cSrcweir         uno::Sequence< beans::PropertyValue > lProps;
824cdf0e10cSrcweir         if (xFilterFactory->hasByName(sFilter))
825cdf0e10cSrcweir         {
826cdf0e10cSrcweir             uno::Any aFilterPropSet = xFilterFactory->getByName( sFilter );
827cdf0e10cSrcweir             aFilterPropSet >>= lProps;
828cdf0e10cSrcweir         }
829cdf0e10cSrcweir 
830cdf0e10cSrcweir         sal_Int32 nPropCount = lProps.getLength();
831cdf0e10cSrcweir         rtl::OUString sFactoryName;
832cdf0e10cSrcweir         for( sal_Int32 i=0; i<nPropCount; ++i )
833cdf0e10cSrcweir         {
834cdf0e10cSrcweir             if( lProps[i].Name.compareToAscii( "DocumentService" ) == 0 &&
835cdf0e10cSrcweir                 (lProps[i].Value >>= sFactoryName) &&
836cdf0e10cSrcweir                 sFactoryName.compareToAscii( "com.sun.star.presentation.PresentationDocument" ) == 0 )
837cdf0e10cSrcweir             {
8382155a943Smseidel                 // yes, it's an Impress document
839cdf0e10cSrcweir                 INetURLObject aURL;
840cdf0e10cSrcweir 
841cdf0e10cSrcweir                 // Do not include the file if it does not exist.
842cdf0e10cSrcweir                 if (xFileAccess.is() && ! xFileAccess->exists(sURL))
843cdf0e10cSrcweir                     continue;
844cdf0e10cSrcweir 
845cdf0e10cSrcweir                 aURL.SetSmartURL (sURL);
846cdf0e10cSrcweir                 // The password is set only when it is not empty.
847cdf0e10cSrcweir                 if (sPassword.getLength() > 0)
848cdf0e10cSrcweir                     aURL.SetPass (sPassword);
849cdf0e10cSrcweir                 maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE )));
850cdf0e10cSrcweir                 mpPage1OpenLB->InsertEntry (sTitle);
851cdf0e10cSrcweir                 break;
852cdf0e10cSrcweir             }
853cdf0e10cSrcweir         }
854cdf0e10cSrcweir     }
855cdf0e10cSrcweir     mbRecentDocumentsReady = sal_True;
856cdf0e10cSrcweir     try
857cdf0e10cSrcweir     {
858cdf0e10cSrcweir         UpdatePreview(sal_True);
859cdf0e10cSrcweir     }
860cdf0e10cSrcweir     catch (uno::RuntimeException& )
861cdf0e10cSrcweir     {
862cdf0e10cSrcweir         // Ignore all exceptions.
863cdf0e10cSrcweir     }
864cdf0e10cSrcweir }
865cdf0e10cSrcweir 
866cdf0e10cSrcweir 
867cdf0e10cSrcweir 
ProvideTemplates(void)868cdf0e10cSrcweir void AssistentDlgImpl::ProvideTemplates (void)
869cdf0e10cSrcweir {
870cdf0e10cSrcweir     if ( ! mbTemplatesReady)
871cdf0e10cSrcweir     {
872cdf0e10cSrcweir         TemplateScanner aScanner;
873cdf0e10cSrcweir         aScanner.Scan ();
874cdf0e10cSrcweir         TemplateScanDone (aScanner.GetFolderList());
875cdf0e10cSrcweir 
876cdf0e10cSrcweir         try
877cdf0e10cSrcweir         {
878cdf0e10cSrcweir             UpdatePreview(sal_True);
879cdf0e10cSrcweir         }
880cdf0e10cSrcweir         catch (uno::RuntimeException& e)
881cdf0e10cSrcweir         {
882cdf0e10cSrcweir             // Ignore all exceptions.
883cdf0e10cSrcweir             (void) e;
884cdf0e10cSrcweir         }
885cdf0e10cSrcweir     }
886cdf0e10cSrcweir }
887cdf0e10cSrcweir 
TemplateScanDone(std::vector<TemplateDir * > & rTemplateFolder)888cdf0e10cSrcweir void AssistentDlgImpl::TemplateScanDone (
889cdf0e10cSrcweir     std::vector<TemplateDir*>& rTemplateFolder)
890cdf0e10cSrcweir {
891cdf0e10cSrcweir     // This method is called from a thread. Therefore we get the solar mutex.
892cdf0e10cSrcweir     ::vos::OGuard aGuard (Application::GetSolarMutex());
893cdf0e10cSrcweir 
894cdf0e10cSrcweir     // Copy the contents of the given template folders to a local list.
895cdf0e10cSrcweir     maPresentList.swap (rTemplateFolder);
896cdf0e10cSrcweir 
897cdf0e10cSrcweir     // Fill in the list box on the first page.
898cdf0e10cSrcweir     int nFirstEntry = 0;
899cdf0e10cSrcweir     mpPage1RegionLB->Clear();
900cdf0e10cSrcweir     std::vector<TemplateDir*>::iterator I;
901cdf0e10cSrcweir     int i;
902cdf0e10cSrcweir     for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); I++,i++)
903cdf0e10cSrcweir     {
904cdf0e10cSrcweir         TemplateDir* pDir = *I;
905cdf0e10cSrcweir         if (pDir == NULL)
906cdf0e10cSrcweir             continue;
907cdf0e10cSrcweir 
9082155a943Smseidel         // HACK! present directory is always initially selected.
909cdf0e10cSrcweir         // We have to look at the first entry to get a URL.
910cdf0e10cSrcweir         if (!pDir->maEntries.empty() )
911cdf0e10cSrcweir         {
912cdf0e10cSrcweir             TemplateEntry* pEntry = pDir->maEntries.front();
913cdf0e10cSrcweir             if (pEntry != NULL)
914cdf0e10cSrcweir                 if (pEntry->msPath.SearchAscii("presnt") != STRING_NOTFOUND)
915cdf0e10cSrcweir                     nFirstEntry = i;
916cdf0e10cSrcweir         }
917cdf0e10cSrcweir 
918cdf0e10cSrcweir         mpPage1RegionLB->InsertEntry (pDir->msRegion);
919cdf0e10cSrcweir     }
920cdf0e10cSrcweir     mpPage1RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry);
921cdf0e10cSrcweir     mpPage1RegionLB->Update();
922cdf0e10cSrcweir     SelectTemplateRegion (mpPage1RegionLB->GetSelectEntry());
923cdf0e10cSrcweir 
924cdf0e10cSrcweir     // Fill in the list box on the second page.
925cdf0e10cSrcweir     nFirstEntry = 0;
926cdf0e10cSrcweir     mpPage2RegionLB->Clear();
927cdf0e10cSrcweir     for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); I++,i++)
928cdf0e10cSrcweir     {
929cdf0e10cSrcweir         TemplateDir* pDir = *I;
930cdf0e10cSrcweir         if (pDir == NULL)
931cdf0e10cSrcweir             continue;
932cdf0e10cSrcweir 
933cdf0e10cSrcweir         // HACK! layout directory is always initially selected.
934cdf0e10cSrcweir         // We have to look at the first entry to get a URL.
935cdf0e10cSrcweir         if (!pDir->maEntries.empty() )
936cdf0e10cSrcweir         {
937cdf0e10cSrcweir             TemplateEntry* pEntry = pDir->maEntries.front();
938cdf0e10cSrcweir             if (pEntry != NULL)
939cdf0e10cSrcweir                 if (pEntry->msPath.SearchAscii("layout") != STRING_NOTFOUND)
940cdf0e10cSrcweir                     nFirstEntry = i;
941cdf0e10cSrcweir         }
942cdf0e10cSrcweir 
943cdf0e10cSrcweir         mpPage2RegionLB->InsertEntry (pDir->msRegion);
944cdf0e10cSrcweir     }
945cdf0e10cSrcweir     mpPage2RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry);
946cdf0e10cSrcweir     mpPage2RegionLB->Update();
947cdf0e10cSrcweir     SelectLayoutRegion (mpPage2RegionLB->GetSelectEntry());
948cdf0e10cSrcweir 
949cdf0e10cSrcweir     // Make the changes visible.
950cdf0e10cSrcweir     mbTemplatesReady = sal_True;
951cdf0e10cSrcweir     if (mpWindow)
952cdf0e10cSrcweir         UpdatePage();
953cdf0e10cSrcweir }
954cdf0e10cSrcweir 
955cdf0e10cSrcweir 
956cdf0e10cSrcweir 
957cdf0e10cSrcweir 
958cdf0e10cSrcweir // ********************************************************************
9592155a943Smseidel // Status methods
960cdf0e10cSrcweir // ********************************************************************
961cdf0e10cSrcweir 
SetStartType(StartType eType)962cdf0e10cSrcweir void AssistentDlgImpl::SetStartType( StartType eType )
963cdf0e10cSrcweir {
964cdf0e10cSrcweir     mpPage1EmptyRB->SetState( eType == ST_EMPTY );
965cdf0e10cSrcweir     mpPage1TemplateRB->SetState( eType == ST_TEMPLATE );
966cdf0e10cSrcweir     mpPage1OpenRB->SetState( eType == ST_OPEN );
967cdf0e10cSrcweir     maNextPageButton.Enable( eType != ST_OPEN );
968cdf0e10cSrcweir 
969cdf0e10cSrcweir     mpPage1RegionLB->Show(eType == ST_TEMPLATE);
970cdf0e10cSrcweir     mpPage1TemplateLB->Show(eType == ST_TEMPLATE);
971cdf0e10cSrcweir     mpPage1OpenLB->Show(eType == ST_OPEN);
972cdf0e10cSrcweir     mpPage1OpenPB->Show(eType == ST_OPEN);
973cdf0e10cSrcweir 
974cdf0e10cSrcweir     if (eType == ST_OPEN)
975cdf0e10cSrcweir         maFinishButton.SetText(maOpenStr);
976cdf0e10cSrcweir     else
977cdf0e10cSrcweir         maFinishButton.SetText(maCreateStr);
978cdf0e10cSrcweir }
979cdf0e10cSrcweir 
GetStartType()980cdf0e10cSrcweir StartType AssistentDlgImpl::GetStartType()
981cdf0e10cSrcweir {
982cdf0e10cSrcweir     if( mpPage1EmptyRB->IsChecked() )
983cdf0e10cSrcweir         return ST_EMPTY;
984cdf0e10cSrcweir     else if( mpPage1TemplateRB->IsChecked() )
985cdf0e10cSrcweir         return ST_TEMPLATE;
986cdf0e10cSrcweir     else
987cdf0e10cSrcweir         return ST_OPEN;
988cdf0e10cSrcweir }
989cdf0e10cSrcweir 
GetDocFileName()990cdf0e10cSrcweir String AssistentDlgImpl::GetDocFileName()
991cdf0e10cSrcweir {
992cdf0e10cSrcweir     String aTitle;
993cdf0e10cSrcweir     if(mpWindow)
994cdf0e10cSrcweir     {
995cdf0e10cSrcweir         aTitle = mpWindow->GetText();
996cdf0e10cSrcweir         sal_uInt16 nPos = aTitle.Search(sal_Unicode('('));
997cdf0e10cSrcweir         if(nPos != STRING_NOTFOUND)
998cdf0e10cSrcweir             aTitle.Erase( nPos-1 );
999cdf0e10cSrcweir     }
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir     String aDocFile;
1002cdf0e10cSrcweir     if( GetStartType() == ST_TEMPLATE )
1003cdf0e10cSrcweir     {
1004cdf0e10cSrcweir         const sal_uInt16 nEntry = mpPage1TemplateLB->GetSelectEntryPos();
1005cdf0e10cSrcweir         TemplateEntry* pEntry = NULL;
1006cdf0e10cSrcweir         if(nEntry != (sal_uInt16)-1)
1007cdf0e10cSrcweir             pEntry = mpTemplateRegion->maEntries[nEntry];
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir         if(pEntry)
1010cdf0e10cSrcweir         {
1011cdf0e10cSrcweir             aDocFile = pEntry->msPath;
1012cdf0e10cSrcweir 
1013cdf0e10cSrcweir             aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM(  " (" ) );
1014cdf0e10cSrcweir             aTitle.Append( pEntry->msTitle );
1015cdf0e10cSrcweir             aTitle.Append( sal_Unicode(')') );
1016cdf0e10cSrcweir         }
1017cdf0e10cSrcweir     }
1018cdf0e10cSrcweir     else if( GetStartType() == ST_OPEN )
1019cdf0e10cSrcweir     {
1020cdf0e10cSrcweir         const sal_uInt16 nEntry = mpPage1OpenLB->GetSelectEntryPos();
1021cdf0e10cSrcweir         if(nEntry != (sal_uInt16)-1 )
1022cdf0e10cSrcweir             aDocFile = *maOpenFilesList[nEntry];
1023cdf0e10cSrcweir     }
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir     if(mpWindow)
1026cdf0e10cSrcweir         mpWindow->SetText(aTitle);
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir     return aDocFile;
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir 
GetLayoutFileName()1031cdf0e10cSrcweir String AssistentDlgImpl::GetLayoutFileName()
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir     String aFile;
1034cdf0e10cSrcweir     const sal_uInt16 nEntry = mpPage2LayoutLB->GetSelectEntryPos();
1035cdf0e10cSrcweir     TemplateEntry* pEntry = NULL;
1036cdf0e10cSrcweir     if(nEntry != (sal_uInt16)-1 && nEntry > 0)
1037cdf0e10cSrcweir         pEntry = mpLayoutRegion->maEntries[nEntry-1];
1038cdf0e10cSrcweir 
1039cdf0e10cSrcweir     if(pEntry)
1040cdf0e10cSrcweir         aFile = pEntry->msPath;
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir     return aFile;
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir 
GetDocument()1045cdf0e10cSrcweir SfxObjectShellLock AssistentDlgImpl::GetDocument()
1046cdf0e10cSrcweir {
1047cdf0e10cSrcweir // mbPreview = sal_False; // Document nicht anzeigen
1048cdf0e10cSrcweir     UpdatePreview(sal_False); // aber komplett laden
1049cdf0e10cSrcweir     UpdatePageList();
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir     SfxObjectShell* pShell = xDocShell;
1052cdf0e10cSrcweir     ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,pShell);
1053cdf0e10cSrcweir     SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir     if(pDoc)
1056cdf0e10cSrcweir     {
1057cdf0e10cSrcweir         const sal_uInt16 nPageCount = pDoc->GetSdPageCount(PK_STANDARD);
1058cdf0e10cSrcweir         sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
1059cdf0e10cSrcweir         sal_uInt32 nNewTime = (sal_uInt32)mpPage3PresTimeTMF->GetTime().GetMSFromTime() / 1000;
1060cdf0e10cSrcweir         if(bKiosk)
1061cdf0e10cSrcweir         {
1062cdf0e10cSrcweir             PresentationSettings& rSettings = pDoc->getPresentationSettings();
1063cdf0e10cSrcweir             rSettings.mbEndless = bKiosk;
1064cdf0e10cSrcweir             rSettings.mnPauseTimeout = (sal_Int32)mpPage3BreakTMF->GetTime().GetMSFromTime() / 1000;
1065cdf0e10cSrcweir             rSettings.mbShowPauseLogo = mpPage3LogoCB->IsChecked();
1066cdf0e10cSrcweir         }
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir         sal_uInt16 nPgAbsNum = 0;
1069cdf0e10cSrcweir         sal_uInt16 nPgRelNum = 0;
1070cdf0e10cSrcweir         while( nPgAbsNum < nPageCount )
1071cdf0e10cSrcweir         {
1072cdf0e10cSrcweir             SdPage* pPage = pDoc->GetSdPage( nPgRelNum, PK_STANDARD );
1073cdf0e10cSrcweir             if( mpPage5PageListCT->IsPageChecked(nPgAbsNum) )
1074cdf0e10cSrcweir             {
1075cdf0e10cSrcweir                 mpPage3EffectLB->applySelected(pPage);
1076cdf0e10cSrcweir                 const sal_uInt16 nPos = mpPage3SpeedLB->GetSelectEntryPos();
1077cdf0e10cSrcweir                 pPage->setTransitionDuration( (nPos == 0) ? 3.0 : (nPos == 1) ? 2.0 : 1.0 );
1078cdf0e10cSrcweir                 if(bKiosk)
1079cdf0e10cSrcweir                 {
1080cdf0e10cSrcweir                     pPage->SetPresChange( PRESCHANGE_AUTO );
1081cdf0e10cSrcweir                     pPage->SetTime(nNewTime);
1082cdf0e10cSrcweir                 }
1083cdf0e10cSrcweir                 nPgRelNum++;
1084cdf0e10cSrcweir             }
1085cdf0e10cSrcweir             else
1086cdf0e10cSrcweir             {
10872155a943Smseidel                 // delete this page
10882155a943Smseidel                 pDoc->DeletePage( (nPgRelNum << 1) + 2 ); // NotizPage loeschen
10892155a943Smseidel                 pDoc->DeletePage( (nPgRelNum << 1) + 1 ); // delete page
1090cdf0e10cSrcweir             }
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir             nPgAbsNum++;
1093cdf0e10cSrcweir         }
1094cdf0e10cSrcweir     }
1095cdf0e10cSrcweir     else
1096cdf0e10cSrcweir     {
1097cdf0e10cSrcweir         DBG_ERROR("sd::AssistentDlgImpl::GetDocument(), no template?");
1098cdf0e10cSrcweir     }
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir     SfxObjectShellLock xRet = xDocShell;
1101cdf0e10cSrcweir     xDocShell = NULL;
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir     return xRet;
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir 
LeavePage()1106cdf0e10cSrcweir void AssistentDlgImpl::LeavePage()
1107cdf0e10cSrcweir {
1108cdf0e10cSrcweir     int nPage = maAssistentFunc.GetCurrentPage();
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir     if( nPage == 4 && mbUserDataDirty )
1111cdf0e10cSrcweir         maPrevTimer.Start();
1112cdf0e10cSrcweir }
1113cdf0e10cSrcweir 
ChangePage()1114cdf0e10cSrcweir void AssistentDlgImpl::ChangePage()
1115cdf0e10cSrcweir {
1116cdf0e10cSrcweir     maNextPageButton.Enable(!maAssistentFunc.IsLastPage());
1117cdf0e10cSrcweir     maLastPageButton.Enable(!maAssistentFunc.IsFirstPage());
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir     sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage();
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir     if( mpWindow )
1122cdf0e10cSrcweir     {
1123cdf0e10cSrcweir         mpWindow->SetHelpId( PageHelpIds[nPage-1]);
1124cdf0e10cSrcweir     }
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir     UpdatePage();
1127cdf0e10cSrcweir 
1128cdf0e10cSrcweir     if( maNextPageButton.IsEnabled() )
1129cdf0e10cSrcweir     {
1130cdf0e10cSrcweir         maNextPageButton.ForceFocusEventBroadcast();
1131cdf0e10cSrcweir     }
1132cdf0e10cSrcweir     else
1133cdf0e10cSrcweir         maFinishButton.GrabFocus();
1134cdf0e10cSrcweir }
1135cdf0e10cSrcweir 
UpdatePage()1136cdf0e10cSrcweir void AssistentDlgImpl::UpdatePage()
1137cdf0e10cSrcweir {
1138cdf0e10cSrcweir     sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage();
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir     switch(nPage)
1141cdf0e10cSrcweir     {
1142cdf0e10cSrcweir     case 1:
1143cdf0e10cSrcweir         {
11442155a943Smseidel             // Elemente auf der ersten Page abhaengig vom Starttype zeigen
1145cdf0e10cSrcweir             SetStartType( GetStartType() );
1146cdf0e10cSrcweir             mpPage1TemplateRB->Enable(sal_True /*mbTemplatesReady*/);
1147cdf0e10cSrcweir             break;
1148cdf0e10cSrcweir         }
1149cdf0e10cSrcweir 
1150cdf0e10cSrcweir     case 2:
1151cdf0e10cSrcweir         {
1152cdf0e10cSrcweir             mpPage2RegionLB->Enable(mbTemplatesReady);
1153cdf0e10cSrcweir             mpPage2LayoutLB->Enable(mbTemplatesReady);
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir             if( GetStartType() != ST_EMPTY )
1156cdf0e10cSrcweir             {
1157cdf0e10cSrcweir                 mpPage2Medium5RB->Enable( sal_True );
1158cdf0e10cSrcweir             }
1159cdf0e10cSrcweir             else
1160cdf0e10cSrcweir             {
1161cdf0e10cSrcweir                 mpPage2Medium5RB->Enable( sal_False );
1162cdf0e10cSrcweir                 if(mpPage2Medium5RB->IsChecked())
1163cdf0e10cSrcweir                     mpPage2Medium1RB->Check();
1164cdf0e10cSrcweir             }
1165cdf0e10cSrcweir 
1166cdf0e10cSrcweir             break;
1167cdf0e10cSrcweir         }
1168cdf0e10cSrcweir     case 5:
1169cdf0e10cSrcweir         {
1170cdf0e10cSrcweir             if(mbDocPreview || maPageListFile != maDocFile)
1171cdf0e10cSrcweir                 mpPage5PageListCT->Clear();
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir             maUpdatePageListTimer.Start();
1174cdf0e10cSrcweir             break;
1175cdf0e10cSrcweir         }
1176cdf0e10cSrcweir 
1177cdf0e10cSrcweir     case 3:
1178cdf0e10cSrcweir         {
1179cdf0e10cSrcweir             if(GetStartType() != ST_TEMPLATE)
1180cdf0e10cSrcweir                 maNextPageButton.Enable(false);
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir             sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
1183cdf0e10cSrcweir             mpPage3PresTimeFT->Enable(bKiosk);
1184cdf0e10cSrcweir             mpPage3BreakFT->Enable(bKiosk);
1185cdf0e10cSrcweir             mpPage3PresTimeTMF->Enable(bKiosk);
1186cdf0e10cSrcweir             mpPage3BreakTMF->Enable(bKiosk);
1187cdf0e10cSrcweir             mpPage3LogoCB->Enable(bKiosk);
1188cdf0e10cSrcweir             break;
1189cdf0e10cSrcweir         }
1190cdf0e10cSrcweir     }
1191cdf0e10cSrcweir }
1192cdf0e10cSrcweir 
1193cdf0e10cSrcweir // ********************************************************************
1194cdf0e10cSrcweir // UI-Handler
1195cdf0e10cSrcweir // ********************************************************************
1196cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,SelectRegionHdl,ListBox *,pLB)1197cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, SelectRegionHdl, ListBox *, pLB )
1198cdf0e10cSrcweir {
1199cdf0e10cSrcweir     if( pLB == mpPage1RegionLB )
1200cdf0e10cSrcweir     {
1201cdf0e10cSrcweir         SelectTemplateRegion( pLB->GetSelectEntry() );
1202cdf0e10cSrcweir         SetStartType( ST_TEMPLATE );
1203cdf0e10cSrcweir         mpPage2Medium5RB->Check();
1204cdf0e10cSrcweir     }
1205cdf0e10cSrcweir     else
1206cdf0e10cSrcweir     {
1207cdf0e10cSrcweir         SelectLayoutRegion( pLB->GetSelectEntry() );
1208cdf0e10cSrcweir     }
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir     return 0;
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,SelectEffectHdl,void *,EMPTYARG)1213cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, SelectEffectHdl, void*, EMPTYARG )
1214cdf0e10cSrcweir {
1215cdf0e10cSrcweir     maEffectPrevTimer.Start();
1216cdf0e10cSrcweir     return 0;
1217cdf0e10cSrcweir }
1218cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,OpenButtonHdl,Button *,pButton)1219cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, OpenButtonHdl, Button*, pButton )
1220cdf0e10cSrcweir {
1221cdf0e10cSrcweir     // Clear the selection and forward the call.
1222cdf0e10cSrcweir     mpPage1OpenLB->SetNoSelection();
1223cdf0e10cSrcweir     return mpPage1OpenLB->GetDoubleClickHdl().Call(pButton);
1224cdf0e10cSrcweir }
1225cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,EffectPreviewHdl,Button *,EMPTYARG)1226cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, EffectPreviewHdl, Button *, EMPTYARG )
1227cdf0e10cSrcweir {
1228cdf0e10cSrcweir     if(mbPreview && xDocShell.Is() )
1229cdf0e10cSrcweir     {
1230cdf0e10cSrcweir         SfxObjectShell* pShell = xDocShell;
1231cdf0e10cSrcweir         DrawDocShell* pDocShell = dynamic_cast< DrawDocShell * >(pShell);
1232cdf0e10cSrcweir         if( pDocShell )
1233cdf0e10cSrcweir         {
1234cdf0e10cSrcweir             SdDrawDocument* pDoc = pDocShell->GetDoc();
1235cdf0e10cSrcweir             if( pDoc )
1236cdf0e10cSrcweir             {
1237cdf0e10cSrcweir                 SdPage* pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD );
1238cdf0e10cSrcweir                 if( pPage )
1239cdf0e10cSrcweir                     mpPage3EffectLB->applySelected(pPage);
1240cdf0e10cSrcweir             }
1241cdf0e10cSrcweir         }
1242cdf0e10cSrcweir         maPreview.startPreview();
1243cdf0e10cSrcweir     }
1244cdf0e10cSrcweir     return 0;
1245cdf0e10cSrcweir }
1246cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,PreviewFlagHdl,CheckBox *,EMPTYARG)1247cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, PreviewFlagHdl, CheckBox *, EMPTYARG )
1248cdf0e10cSrcweir 
1249cdf0e10cSrcweir {
1250cdf0e10cSrcweir     if( maPreviewFlag.IsChecked() != mbPreview )
1251cdf0e10cSrcweir     {
1252cdf0e10cSrcweir         mbPreview = maPreviewFlag.IsChecked();
1253cdf0e10cSrcweir         UpdatePreview(sal_True);
1254cdf0e10cSrcweir     }
1255cdf0e10cSrcweir     return 0;
1256cdf0e10cSrcweir }
1257cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,SelectTemplateHdl,ListBox *,EMPTYARG)1258cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, SelectTemplateHdl, ListBox *, EMPTYARG )
1259cdf0e10cSrcweir {
1260cdf0e10cSrcweir     SetStartType( ST_TEMPLATE );
1261cdf0e10cSrcweir     mpPage2Medium5RB->Check();
1262cdf0e10cSrcweir     mpPage2LayoutLB->SelectEntryPos(0);
1263cdf0e10cSrcweir     maPrevTimer.Start();
1264cdf0e10cSrcweir     return 0;
1265cdf0e10cSrcweir }
1266cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,SelectLayoutHdl,ListBox *,EMPTYARG)1267cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, SelectLayoutHdl, ListBox *, EMPTYARG )
1268cdf0e10cSrcweir {
1269cdf0e10cSrcweir     maPrevTimer.Start();
1270cdf0e10cSrcweir     return 0;
1271cdf0e10cSrcweir }
1272cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,SelectFileHdl,ListBox *,EMPTYARG)1273cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, SelectFileHdl, ListBox *, EMPTYARG )
1274cdf0e10cSrcweir {
1275cdf0e10cSrcweir     SetStartType( ST_OPEN );
1276cdf0e10cSrcweir     maPrevTimer.Start();
1277cdf0e10cSrcweir     return 0;
1278cdf0e10cSrcweir }
1279cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,PageSelectHdl,Control *,EMPTYARG)1280cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, PageSelectHdl, Control *, EMPTYARG )
1281cdf0e10cSrcweir {
1282cdf0e10cSrcweir     sal_uInt16 nPage = mpPage5PageListCT->GetSelectedPage();
1283cdf0e10cSrcweir     if( mnShowPage != nPage )
1284cdf0e10cSrcweir     {
1285cdf0e10cSrcweir         mnShowPage = nPage;
1286cdf0e10cSrcweir         UpdatePreview(sal_False);
1287cdf0e10cSrcweir     }
1288cdf0e10cSrcweir 
1289cdf0e10cSrcweir     return 0;
1290cdf0e10cSrcweir }
1291cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,UpdatePageListHdl,void *,EMPTYARG)1292cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, UpdatePageListHdl, void *, EMPTYARG )
1293cdf0e10cSrcweir {
1294cdf0e10cSrcweir     UpdatePageList();
1295cdf0e10cSrcweir     return 0;
1296cdf0e10cSrcweir }
1297cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,UpdatePreviewHdl,void *,EMPTYARG)1298cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, UpdatePreviewHdl, void *, EMPTYARG )
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir     UpdatePreview( sal_True );
1301cdf0e10cSrcweir     return 0;
1302cdf0e10cSrcweir }
1303cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,StartTypeHdl,RadioButton *,pButton)1304cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, StartTypeHdl, RadioButton *, pButton )
1305cdf0e10cSrcweir {
1306cdf0e10cSrcweir     StartType eType = pButton == mpPage1EmptyRB?ST_EMPTY:pButton == mpPage1TemplateRB?ST_TEMPLATE:ST_OPEN;
1307cdf0e10cSrcweir 
1308cdf0e10cSrcweir     if(eType == ST_TEMPLATE)
1309cdf0e10cSrcweir         ProvideTemplates();
1310cdf0e10cSrcweir     else if(eType == ST_OPEN)
1311cdf0e10cSrcweir         ScanDocmenu();
1312cdf0e10cSrcweir 
1313cdf0e10cSrcweir     SetStartType( eType );
1314cdf0e10cSrcweir 
1315cdf0e10cSrcweir     if(eType == ST_TEMPLATE)
1316cdf0e10cSrcweir     {
1317cdf0e10cSrcweir         mpPage1TemplateLB->SelectEntryPos(0);
1318cdf0e10cSrcweir         mpPage2Medium5RB->Check();
1319cdf0e10cSrcweir     }
1320cdf0e10cSrcweir     else if(eType == ST_OPEN)
1321cdf0e10cSrcweir         mpPage1OpenLB->SelectEntryPos(0);
1322cdf0e10cSrcweir 
1323cdf0e10cSrcweir     maPrevTimer.Start();
1324cdf0e10cSrcweir     return 0;
1325cdf0e10cSrcweir }
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,NextPageHdl,PushButton *,EMPTYARG)1328cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, NextPageHdl, PushButton *, EMPTYARG )
1329cdf0e10cSrcweir {
1330cdf0e10cSrcweir     // When changing from the first to the second page make sure that the
1331cdf0e10cSrcweir     // templates are present.
1332cdf0e10cSrcweir     if (maAssistentFunc.GetCurrentPage() == 1)
1333cdf0e10cSrcweir         ProvideTemplates();
1334cdf0e10cSrcweir 
1335cdf0e10cSrcweir     // Change to the next page.
1336cdf0e10cSrcweir     LeavePage();
1337cdf0e10cSrcweir     maAssistentFunc.NextPage();
1338cdf0e10cSrcweir     ChangePage();
1339cdf0e10cSrcweir     return 0;
1340cdf0e10cSrcweir }
1341cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,LastPageHdl,PushButton *,EMPTYARG)1342cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, LastPageHdl, PushButton *, EMPTYARG )
1343cdf0e10cSrcweir {
1344cdf0e10cSrcweir     LeavePage();
1345cdf0e10cSrcweir     maAssistentFunc.PreviousPage();
1346cdf0e10cSrcweir     ChangePage();
1347cdf0e10cSrcweir     return 0;
1348cdf0e10cSrcweir }
1349cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,PresTypeHdl,RadioButton *,EMPTYARG)1350cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, PresTypeHdl, RadioButton*, EMPTYARG )
1351cdf0e10cSrcweir {
1352cdf0e10cSrcweir     if(maDocFile.Len() == 0)
1353cdf0e10cSrcweir         {
1354cdf0e10cSrcweir             maNextPageButton.Enable(false);
1355cdf0e10cSrcweir         }
1356cdf0e10cSrcweir 
1357cdf0e10cSrcweir     sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
1358cdf0e10cSrcweir     mpPage3PresTimeFT->Enable(bKiosk);
1359cdf0e10cSrcweir     mpPage3BreakFT->Enable(bKiosk);
1360cdf0e10cSrcweir     mpPage3PresTimeTMF->Enable(bKiosk);
1361cdf0e10cSrcweir     mpPage3BreakTMF->Enable(bKiosk);
1362cdf0e10cSrcweir     mpPage3LogoCB->Enable(bKiosk);
1363cdf0e10cSrcweir     return 0;
1364cdf0e10cSrcweir }
1365cdf0e10cSrcweir 
IMPL_LINK(AssistentDlgImpl,UpdateUserDataHdl,Edit *,EMPTYARG)1366cdf0e10cSrcweir IMPL_LINK( AssistentDlgImpl, UpdateUserDataHdl, Edit*, EMPTYARG )
1367cdf0e10cSrcweir {
1368cdf0e10cSrcweir     mbUserDataDirty = sal_True;
1369cdf0e10cSrcweir     String aTopic = mpPage4AskTopicEDT->GetText();
1370cdf0e10cSrcweir     String aName  = mpPage4AskNameEDT->GetText();
1371cdf0e10cSrcweir     String aInfo  = mpPage4AskInfoEDT->GetText();
1372cdf0e10cSrcweir 
1373cdf0e10cSrcweir     if(aTopic.Len() == 0 && aName.Len() == 0 && aInfo.Len() == 0)
1374cdf0e10cSrcweir         maDocFile.Erase();
1375cdf0e10cSrcweir 
1376cdf0e10cSrcweir     return 0;
1377cdf0e10cSrcweir }
1378cdf0e10cSrcweir 
1379cdf0e10cSrcweir // ********************************************************************
1380cdf0e10cSrcweir // ********************************************************************
1381cdf0e10cSrcweir 
SelectTemplateRegion(const String & rRegion)1382cdf0e10cSrcweir void AssistentDlgImpl::SelectTemplateRegion( const String& rRegion )
1383cdf0e10cSrcweir {
1384cdf0e10cSrcweir     mpPage1TemplateLB->Clear();
1385cdf0e10cSrcweir     std::vector<TemplateDir*>::iterator I;
1386cdf0e10cSrcweir     for (I=maPresentList.begin(); I!=maPresentList.end(); I++)
1387cdf0e10cSrcweir     {
1388cdf0e10cSrcweir         TemplateDir * pDir = *I;
1389cdf0e10cSrcweir         mpTemplateRegion = *I;
1390cdf0e10cSrcweir         if (pDir->msRegion.Equals( rRegion ) )
1391cdf0e10cSrcweir         {
1392cdf0e10cSrcweir             std::vector<TemplateEntry*>::iterator   J;
1393cdf0e10cSrcweir             for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); J++)
1394cdf0e10cSrcweir                 mpPage1TemplateLB->InsertEntry ((*J)->msTitle);
1395cdf0e10cSrcweir             mpPage1TemplateLB->Update();
1396cdf0e10cSrcweir             if(GetStartType() == ST_TEMPLATE)
1397cdf0e10cSrcweir             {
1398cdf0e10cSrcweir                 mpPage1TemplateLB->SelectEntryPos( 0 );
1399cdf0e10cSrcweir                 SelectTemplateHdl(NULL);
1400cdf0e10cSrcweir             }
1401cdf0e10cSrcweir             break;
1402cdf0e10cSrcweir         }
1403cdf0e10cSrcweir     }
1404cdf0e10cSrcweir }
1405cdf0e10cSrcweir 
SelectLayoutRegion(const String & rRegion)1406cdf0e10cSrcweir void AssistentDlgImpl::SelectLayoutRegion( const String& rRegion )
1407cdf0e10cSrcweir {
1408cdf0e10cSrcweir     mpPage2LayoutLB->Clear();
1409cdf0e10cSrcweir     mpPage2LayoutLB->InsertEntry(String(SdResId(STR_WIZARD_ORIGINAL)));
1410cdf0e10cSrcweir     std::vector<TemplateDir*>::iterator I;
1411cdf0e10cSrcweir     for (I=maPresentList.begin(); I!=maPresentList.end(); I++)
1412cdf0e10cSrcweir     {
1413cdf0e10cSrcweir         TemplateDir * pDir = *I;
1414cdf0e10cSrcweir         mpLayoutRegion = *I;
1415cdf0e10cSrcweir 
1416cdf0e10cSrcweir         if (pDir->msRegion.Equals (rRegion))
1417cdf0e10cSrcweir         {
1418cdf0e10cSrcweir             std::vector<TemplateEntry*>::iterator   J;
1419cdf0e10cSrcweir             for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); J++)
1420cdf0e10cSrcweir                 mpPage2LayoutLB->InsertEntry ((*J)->msTitle);
1421cdf0e10cSrcweir             mpPage2LayoutLB->Update();
1422cdf0e10cSrcweir             break;
1423cdf0e10cSrcweir         }
1424cdf0e10cSrcweir     }
1425cdf0e10cSrcweir }
1426cdf0e10cSrcweir 
UpdateUserData()1427cdf0e10cSrcweir void AssistentDlgImpl::UpdateUserData()
1428cdf0e10cSrcweir {
1429cdf0e10cSrcweir     String aTopic = mpPage4AskTopicEDT->GetText();
1430cdf0e10cSrcweir     String aName  = mpPage4AskNameEDT->GetText();
1431cdf0e10cSrcweir     String aInfo  = mpPage4AskInfoEDT->GetText();
1432cdf0e10cSrcweir 
1433cdf0e10cSrcweir     SfxObjectShell* pShell = xDocShell;
1434cdf0e10cSrcweir     DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1435cdf0e10cSrcweir     SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1436cdf0e10cSrcweir     SdPage* pPage = pDoc?pDoc->GetSdPage(0, PK_STANDARD):NULL;
1437cdf0e10cSrcweir 
1438cdf0e10cSrcweir     if(pPage && ( aTopic.Len() != 0 || aName.Len() != 0 || aInfo.Len() != 0 ) )
1439cdf0e10cSrcweir     {
1440cdf0e10cSrcweir         if( pPage->GetAutoLayout() == AUTOLAYOUT_NONE )
1441cdf0e10cSrcweir             pPage->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True);
1442cdf0e10cSrcweir 
1443cdf0e10cSrcweir         SdrTextObj* pObj;
1444cdf0e10cSrcweir         String aEmptyString;
1445cdf0e10cSrcweir 
1446cdf0e10cSrcweir         if( aTopic.Len() )
1447cdf0e10cSrcweir         {
1448cdf0e10cSrcweir             pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TITLE ) );
1449cdf0e10cSrcweir             if( pObj )
1450cdf0e10cSrcweir             {
1451cdf0e10cSrcweir                 pPage->SetObjText( pObj, NULL, PRESOBJ_TITLE, aTopic );
1452cdf0e10cSrcweir                 pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ), sal_True );
1453cdf0e10cSrcweir                 pObj->SetEmptyPresObj(sal_False);
1454cdf0e10cSrcweir             }
1455cdf0e10cSrcweir 
1456cdf0e10cSrcweir         }
1457cdf0e10cSrcweir 
1458cdf0e10cSrcweir         if ( aName.Len() || aInfo.Len() )
1459cdf0e10cSrcweir         {
1460cdf0e10cSrcweir             String aStrTmp( aName );
1461cdf0e10cSrcweir             if( aName.Len() )
1462cdf0e10cSrcweir                 aStrTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n\n" ) );
1463cdf0e10cSrcweir             aStrTmp.Append( aInfo );
1464cdf0e10cSrcweir 
1465cdf0e10cSrcweir             pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_OUTLINE ) );
1466cdf0e10cSrcweir             if( pObj )
1467cdf0e10cSrcweir             {
1468cdf0e10cSrcweir                 pPage->SetObjText( pObj, NULL, PRESOBJ_OUTLINE, aStrTmp );
1469cdf0e10cSrcweir                 pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ), sal_True );
1470cdf0e10cSrcweir                 pObj->SetEmptyPresObj(sal_False);
1471cdf0e10cSrcweir             }
1472cdf0e10cSrcweir             else
1473cdf0e10cSrcweir             {
1474cdf0e10cSrcweir                 pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TEXT ) );
1475cdf0e10cSrcweir                 if( pObj )
1476cdf0e10cSrcweir                 {
1477cdf0e10cSrcweir                     pPage->SetObjText( pObj, NULL, PRESOBJ_TEXT, aStrTmp );
1478cdf0e10cSrcweir                     pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT ), sal_True );
1479cdf0e10cSrcweir                     pObj->SetEmptyPresObj(sal_False);
1480cdf0e10cSrcweir                 }
1481cdf0e10cSrcweir             }
1482cdf0e10cSrcweir         }
1483cdf0e10cSrcweir     }
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir     mbUserDataDirty = sal_False;
1486cdf0e10cSrcweir }
1487cdf0e10cSrcweir 
UpdatePageList()1488cdf0e10cSrcweir void AssistentDlgImpl::UpdatePageList()
1489cdf0e10cSrcweir {
1490cdf0e10cSrcweir     if(mbDocPreview || !mbPreview)
1491cdf0e10cSrcweir         UpdatePreview(sal_False);
1492cdf0e10cSrcweir     else if(maPageListFile == maDocFile)
1493cdf0e10cSrcweir         return;
1494cdf0e10cSrcweir 
1495cdf0e10cSrcweir     maPageListFile = maDocFile;
1496cdf0e10cSrcweir 
1497cdf0e10cSrcweir     SfxObjectShell* pShell = xDocShell;
1498cdf0e10cSrcweir     DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1499cdf0e10cSrcweir     SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1500cdf0e10cSrcweir 
1501cdf0e10cSrcweir     mpPage5PageListCT->Clear();
1502cdf0e10cSrcweir 
1503cdf0e10cSrcweir     if(pDoc)
1504cdf0e10cSrcweir         mpPage5PageListCT->Fill(pDoc);
1505cdf0e10cSrcweir }
1506cdf0e10cSrcweir 
UpdatePreview(sal_Bool bDocPreview)1507cdf0e10cSrcweir void AssistentDlgImpl::UpdatePreview( sal_Bool bDocPreview )
1508cdf0e10cSrcweir {
1509cdf0e10cSrcweir     // Guard against multiple concurrent execution to this method caused either
1510cdf0e10cSrcweir     // by calls from different threads or recursion.
1511cdf0e10cSrcweir     ::osl::MutexGuard aGuard (maMutex);
1512cdf0e10cSrcweir     if (mbPreviewUpdating)
1513cdf0e10cSrcweir         return;
1514cdf0e10cSrcweir     mbPreviewUpdating = sal_True;
1515cdf0e10cSrcweir 
1516cdf0e10cSrcweir     if(!mbPreview && bDocPreview)
1517cdf0e10cSrcweir     {
1518cdf0e10cSrcweir         maPreview.Invalidate();
1519cdf0e10cSrcweir         maPreview.SetObjectShell(0);
1520cdf0e10cSrcweir         mbPreviewUpdating = sal_False;
1521cdf0e10cSrcweir         return;
1522cdf0e10cSrcweir     }
1523cdf0e10cSrcweir 
1524cdf0e10cSrcweir     String aDocFile = GetDocFileName();
1525cdf0e10cSrcweir     String aLayoutFile = GetLayoutFileName();
1526cdf0e10cSrcweir     String aEmptyStr;
1527cdf0e10cSrcweir 
1528cdf0e10cSrcweir     SfxApplication *pSfxApp = SFX_APP();
1529cdf0e10cSrcweir     sal_uLong lErr;
1530cdf0e10cSrcweir     sal_Bool bChangeMaster = aLayoutFile.Len() != 0;
1531cdf0e10cSrcweir 
1532cdf0e10cSrcweir     if( aDocFile.Len() == 0 )
1533cdf0e10cSrcweir     {
1534cdf0e10cSrcweir         if( !xDocShell.Is() || maDocFile.Len() != 0 ||
1535cdf0e10cSrcweir             (maDocFile.Len() == 0 && maLayoutFile.Len() != 0 && aLayoutFile.Len() == 0 ))
1536cdf0e10cSrcweir         {
1537cdf0e10cSrcweir             CloseDocShell();
1538cdf0e10cSrcweir 
1539cdf0e10cSrcweir             DrawDocShell* pNewDocSh;
1540cdf0e10cSrcweir             xDocShell = pNewDocSh = new DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_False);
1541cdf0e10cSrcweir             pNewDocSh->DoInitNew(NULL);
1542cdf0e10cSrcweir             SdDrawDocument* pDoc = pNewDocSh->GetDoc();
1543cdf0e10cSrcweir             pDoc->CreateFirstPages();
1544cdf0e10cSrcweir             pDoc->StopWorkStartupDelay();
1545cdf0e10cSrcweir             mbDocPreview = sal_False;
1546cdf0e10cSrcweir 
1547cdf0e10cSrcweir             maDocFile = aDocFile;
1548cdf0e10cSrcweir             mbUserDataDirty = sal_True;
1549cdf0e10cSrcweir         }
1550cdf0e10cSrcweir         else
1551cdf0e10cSrcweir             bChangeMaster = (aLayoutFile.Len() != 0) && (maLayoutFile != aLayoutFile);
1552cdf0e10cSrcweir     }
1553cdf0e10cSrcweir     else if( aDocFile == maDocFile && ( mbDocPreview == bDocPreview || bDocPreview ) )
1554cdf0e10cSrcweir     {
1555cdf0e10cSrcweir         if( aLayoutFile != maLayoutFile )
1556cdf0e10cSrcweir         {
1557cdf0e10cSrcweir             SfxObjectShell* pShell = xDocShell;
1558cdf0e10cSrcweir             DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1559cdf0e10cSrcweir             ::svl::IUndoManager* pUndoMgr = pDocShell?pDocShell->GetUndoManager():NULL;
1560cdf0e10cSrcweir             if(pUndoMgr)
1561cdf0e10cSrcweir                 pUndoMgr->Undo();
1562cdf0e10cSrcweir             mbUserDataDirty = sal_True;
1563cdf0e10cSrcweir         }
1564cdf0e10cSrcweir         else
1565cdf0e10cSrcweir             bChangeMaster = sal_False;
1566cdf0e10cSrcweir     }
1567cdf0e10cSrcweir     else
1568cdf0e10cSrcweir     {
1569cdf0e10cSrcweir         CloseDocShell();
1570cdf0e10cSrcweir 
1571cdf0e10cSrcweir         ::Window *pParent = Application::GetDefDialogParent();
1572cdf0e10cSrcweir         Application::SetDefDialogParent( mpWindow );
1573cdf0e10cSrcweir 
1574cdf0e10cSrcweir         SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
1575cdf0e10cSrcweir 
1576cdf0e10cSrcweir         SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
1577cdf0e10cSrcweir         if(IsOwnFormat(aDocFile))
1578cdf0e10cSrcweir         {
1579cdf0e10cSrcweir             pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
1580cdf0e10cSrcweir             if(bDocPreview)
1581cdf0e10cSrcweir                 pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
1582cdf0e10cSrcweir             RestorePassword( pSet, aDocFile );
1583cdf0e10cSrcweir             if( (lErr = pSfxApp->LoadTemplate( xDocShell, aDocFile, sal_True, pSet )) != 0 )
1584cdf0e10cSrcweir                 ErrorHandler::HandleError(lErr);
1585cdf0e10cSrcweir             else
1586cdf0e10cSrcweir                 SavePassword( xDocShell, aDocFile );
1587cdf0e10cSrcweir         }
1588cdf0e10cSrcweir         else
1589cdf0e10cSrcweir         {
1590cdf0e10cSrcweir             const String aTargetStr( RTL_CONSTASCII_USTRINGPARAM("_default") );
1591cdf0e10cSrcweir 
1592cdf0e10cSrcweir             SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
1593cdf0e10cSrcweir             aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aDocFile ));
1594cdf0e10cSrcweir             aReq.AppendItem( SfxStringItem( SID_REFERER, aEmptyStr ) );
1595cdf0e10cSrcweir             aReq.AppendItem( SfxStringItem( SID_TARGETNAME, aTargetStr ) );
1596cdf0e10cSrcweir             aReq.AppendItem( SfxBoolItem( SID_HIDDEN, sal_True ) );
1597cdf0e10cSrcweir             aReq.AppendItem( SfxBoolItem( SID_PREVIEW, bDocPreview ) );
1598cdf0e10cSrcweir 
1599cdf0e10cSrcweir             const SfxViewFrameItem* pRet = PTR_CAST( SfxViewFrameItem, SFX_APP()->ExecuteSlot( aReq ) );
1600cdf0e10cSrcweir 
1601cdf0e10cSrcweir             if ( pRet && pRet->GetFrame() && pRet->GetFrame()->GetObjectShell() )
1602cdf0e10cSrcweir                 xDocShell = pRet->GetFrame()->GetObjectShell();
1603cdf0e10cSrcweir         }
1604cdf0e10cSrcweir 
1605cdf0e10cSrcweir 
1606cdf0e10cSrcweir         Application::SetDefDialogParent( pParent );
1607cdf0e10cSrcweir 
1608cdf0e10cSrcweir         mnShowPage = 0;
1609cdf0e10cSrcweir         mbDocPreview = bDocPreview;
1610cdf0e10cSrcweir         maDocFile = aDocFile;
1611cdf0e10cSrcweir         mbUserDataDirty = sal_True;
1612cdf0e10cSrcweir     }
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir     if(bChangeMaster && (aLayoutFile != maDocFile))
1615cdf0e10cSrcweir     {
1616cdf0e10cSrcweir         // Layoutvorlage laden
1617cdf0e10cSrcweir         SfxObjectShellLock xLayoutDocShell;
1618cdf0e10cSrcweir         SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
1619cdf0e10cSrcweir         SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
1620cdf0e10cSrcweir 
1621cdf0e10cSrcweir         ::Window *pParent = Application::GetDefDialogParent();
1622cdf0e10cSrcweir         Application::SetDefDialogParent( mpWindow );
1623cdf0e10cSrcweir 
1624cdf0e10cSrcweir         if(IsOwnFormat(aLayoutFile))
1625cdf0e10cSrcweir         {
1626cdf0e10cSrcweir             pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
1627cdf0e10cSrcweir             pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir             RestorePassword( pSet, aLayoutFile );
1630cdf0e10cSrcweir             if( (lErr = pSfxApp->LoadTemplate( xLayoutDocShell, aLayoutFile, sal_True, pSet )) != 0 )
1631cdf0e10cSrcweir                 ErrorHandler::HandleError(lErr);
1632cdf0e10cSrcweir             SavePassword( xLayoutDocShell, aLayoutFile );
1633cdf0e10cSrcweir         }
1634cdf0e10cSrcweir 
1635cdf0e10cSrcweir         Application::SetDefDialogParent( pParent );
1636cdf0e10cSrcweir 
1637cdf0e10cSrcweir         // die Implementierung ermitteln
1638cdf0e10cSrcweir         SfxObjectShell* pShell = xDocShell;
1639cdf0e10cSrcweir         DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1640cdf0e10cSrcweir         SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1641cdf0e10cSrcweir 
1642cdf0e10cSrcweir         pShell = xLayoutDocShell;
1643cdf0e10cSrcweir         pDocShell = PTR_CAST(DrawDocShell,pShell);
1644cdf0e10cSrcweir         SdDrawDocument* pLayoutDoc = pDocShell?pDocShell->GetDoc():NULL;
1645cdf0e10cSrcweir 
1646cdf0e10cSrcweir         if( pDoc && pLayoutDoc )
1647cdf0e10cSrcweir         {
1648cdf0e10cSrcweir             pDoc->SetMasterPage(0, aEmptyStr, pLayoutDoc, sal_True, sal_False );
1649cdf0e10cSrcweir         }
1650cdf0e10cSrcweir         else
1651cdf0e10cSrcweir         {
1652cdf0e10cSrcweir             DBG_ERROR("sd::AssistentDlgImpl::UpdatePreview(), no document for preview?");
1653cdf0e10cSrcweir         }
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir         mbUserDataDirty = sal_True;
1656cdf0e10cSrcweir     }
1657cdf0e10cSrcweir     maLayoutFile = aLayoutFile;
1658cdf0e10cSrcweir 
1659cdf0e10cSrcweir     if(mbUserDataDirty)
1660cdf0e10cSrcweir         UpdateUserData();
1661cdf0e10cSrcweir 
1662cdf0e10cSrcweir     if ( !xDocShell.Is() || !mbPreview )
1663cdf0e10cSrcweir         maPreview.SetObjectShell( 0 );
1664cdf0e10cSrcweir     else
1665cdf0e10cSrcweir     {
1666cdf0e10cSrcweir         maPreview.SetObjectShell( xDocShell, mnShowPage );
1667cdf0e10cSrcweir     }
1668cdf0e10cSrcweir 
1669cdf0e10cSrcweir     mbPreviewUpdating = sal_False;
1670cdf0e10cSrcweir }
1671cdf0e10cSrcweir 
SavePassword(SfxObjectShellLock xDoc,const String & rPath)1672cdf0e10cSrcweir void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPath )
1673cdf0e10cSrcweir {
1674cdf0e10cSrcweir     if(xDoc.Is())
1675cdf0e10cSrcweir     {
1676cdf0e10cSrcweir         SfxMedium * pMedium = xDoc->GetMedium();
1677cdf0e10cSrcweir         if(pMedium && pMedium->IsStorage())
1678cdf0e10cSrcweir         {
1679cdf0e10cSrcweir             SfxItemSet * pSet = pMedium->GetItemSet();
1680cdf0e10cSrcweir             const SfxPoolItem *pItem = 0;
1681cdf0e10cSrcweir             if( pSet->GetItemState(SID_PASSWORD, sal_True, &pItem) == SFX_ITEM_SET )
1682cdf0e10cSrcweir             {
1683cdf0e10cSrcweir                 // TODO/MBA: testing
1684cdf0e10cSrcweir                 String aPass( ((const SfxStringItem*)pItem)->GetValue());
1685cdf0e10cSrcweir                 if(aPass.Len() == 0)
1686cdf0e10cSrcweir                     return;
1687cdf0e10cSrcweir 
1688cdf0e10cSrcweir             PasswordEntry* pEntry = maPasswordList.First();
1689cdf0e10cSrcweir             while(pEntry)
1690cdf0e10cSrcweir             {
1691cdf0e10cSrcweir                 if(pEntry->maPath == rPath)
1692cdf0e10cSrcweir                     break;
1693cdf0e10cSrcweir 
1694cdf0e10cSrcweir                 pEntry = maPasswordList.Next();
1695cdf0e10cSrcweir 
1696cdf0e10cSrcweir             }
1697cdf0e10cSrcweir 
1698cdf0e10cSrcweir             if(pEntry == NULL)
1699cdf0e10cSrcweir             {
1700cdf0e10cSrcweir                 pEntry = new PasswordEntry();
1701cdf0e10cSrcweir                 pEntry->maPath = rPath;
1702cdf0e10cSrcweir                 maPasswordList.Insert( pEntry );
1703cdf0e10cSrcweir             }
1704cdf0e10cSrcweir 
1705cdf0e10cSrcweir             if(pEntry)
1706cdf0e10cSrcweir                 pEntry->maPassword = aPass;
1707cdf0e10cSrcweir             }
1708cdf0e10cSrcweir         }
1709cdf0e10cSrcweir     }
1710cdf0e10cSrcweir }
1711cdf0e10cSrcweir 
RestorePassword(SfxItemSet * pSet,const String & rPath)1712cdf0e10cSrcweir void AssistentDlgImpl::RestorePassword( SfxItemSet* pSet, const String& rPath )
1713cdf0e10cSrcweir {
1714cdf0e10cSrcweir     String aPassword( GetPassword( rPath ) );
1715cdf0e10cSrcweir 
1716cdf0e10cSrcweir     if(aPassword.Len())
1717cdf0e10cSrcweir         pSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) );
1718cdf0e10cSrcweir }
1719cdf0e10cSrcweir 
GetPassword(const String rPath)1720cdf0e10cSrcweir String AssistentDlgImpl::GetPassword( const String rPath )
1721cdf0e10cSrcweir {
1722cdf0e10cSrcweir     PasswordEntry* pEntry = maPasswordList.First();
1723cdf0e10cSrcweir     while(pEntry)
1724cdf0e10cSrcweir     {
1725cdf0e10cSrcweir         if(pEntry->maPath == rPath)
1726cdf0e10cSrcweir             return pEntry->maPassword;
1727cdf0e10cSrcweir 
1728cdf0e10cSrcweir         pEntry = maPasswordList.Next();
1729cdf0e10cSrcweir     }
1730cdf0e10cSrcweir 
1731cdf0e10cSrcweir     return String();
1732cdf0e10cSrcweir }
1733cdf0e10cSrcweir 
DeletePassords()1734cdf0e10cSrcweir void AssistentDlgImpl::DeletePassords()
1735cdf0e10cSrcweir {
1736cdf0e10cSrcweir     PasswordEntry* pEntry = maPasswordList.First();
1737cdf0e10cSrcweir     while(pEntry)
1738cdf0e10cSrcweir     {
1739cdf0e10cSrcweir         delete pEntry;
1740cdf0e10cSrcweir         pEntry = maPasswordList.Next();
1741cdf0e10cSrcweir     }
1742cdf0e10cSrcweir }
1743cdf0e10cSrcweir 
IsOwnFormat(const String & rPath)1744cdf0e10cSrcweir sal_Bool AssistentDlgImpl::IsOwnFormat( const String& rPath )
1745cdf0e10cSrcweir {
1746cdf0e10cSrcweir     INetURLObject   aURL( rPath );
1747cdf0e10cSrcweir     String          aExt( aURL.GetFileExtension() );
1748cdf0e10cSrcweir 
1749cdf0e10cSrcweir     DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
1750cdf0e10cSrcweir 
1751cdf0e10cSrcweir     return !aExt.EqualsIgnoreCaseAscii( "ppt" );
1752cdf0e10cSrcweir }
1753cdf0e10cSrcweir 
1754cdf0e10cSrcweir 
1755cdf0e10cSrcweir 
1756cdf0e10cSrcweir 
GetUiTextForCommand(const::rtl::OUString & sCommandURL)1757cdf0e10cSrcweir String AssistentDlgImpl::GetUiTextForCommand (const ::rtl::OUString& sCommandURL)
1758cdf0e10cSrcweir {
1759cdf0e10cSrcweir     String sLabel;
1760cdf0e10cSrcweir     Reference<container::XNameAccess> xUICommandLabels;
1761cdf0e10cSrcweir 
1762cdf0e10cSrcweir     try
1763cdf0e10cSrcweir     {
1764cdf0e10cSrcweir         do
1765cdf0e10cSrcweir         {
1766cdf0e10cSrcweir             if (sCommandURL.getLength() == 0)
1767cdf0e10cSrcweir                 break;
1768cdf0e10cSrcweir 
1769cdf0e10cSrcweir             // Retrieve popup menu labels
1770cdf0e10cSrcweir             Reference<lang::XMultiServiceFactory> xFactory (
1771cdf0e10cSrcweir                 ::comphelper::getProcessServiceFactory ());
1772cdf0e10cSrcweir             if ( ! xFactory.is())
1773cdf0e10cSrcweir                 break;
1774cdf0e10cSrcweir 
1775cdf0e10cSrcweir             ::rtl::OUString sModuleIdentifier (
1776cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
1777cdf0e10cSrcweir             Reference<container::XNameAccess> xNameAccess (
1778cdf0e10cSrcweir                 xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
1779cdf0e10cSrcweir                     "com.sun.star.frame.UICommandDescription"))),
1780cdf0e10cSrcweir                 UNO_QUERY);
1781cdf0e10cSrcweir             if ( ! xNameAccess.is())
1782cdf0e10cSrcweir                 break;
1783cdf0e10cSrcweir             Any a = xNameAccess->getByName(sModuleIdentifier);
1784cdf0e10cSrcweir             a >>= xUICommandLabels;
1785cdf0e10cSrcweir             if ( ! xUICommandLabels.is())
1786cdf0e10cSrcweir                 break;
1787cdf0e10cSrcweir 
1788cdf0e10cSrcweir             ::rtl::OUString sString;
1789cdf0e10cSrcweir             Sequence<beans::PropertyValue> aProperties;
1790cdf0e10cSrcweir             Any aAny (xUICommandLabels->getByName(sCommandURL));
1791cdf0e10cSrcweir             if (aAny >>= aProperties)
1792cdf0e10cSrcweir             {
1793cdf0e10cSrcweir                 sal_Int32 nCount (aProperties.getLength());
1794cdf0e10cSrcweir                 for (sal_Int32 i=0; i<nCount; i++)
1795cdf0e10cSrcweir                 {
1796cdf0e10cSrcweir                     ::rtl::OUString sPropertyName (aProperties[i].Name);
1797cdf0e10cSrcweir                     if (sPropertyName.equalsAscii("Label"))
1798cdf0e10cSrcweir                     {
1799cdf0e10cSrcweir                         aProperties[i].Value >>= sString;
1800cdf0e10cSrcweir                         break;
1801cdf0e10cSrcweir                     }
1802cdf0e10cSrcweir                 }
1803cdf0e10cSrcweir             }
1804cdf0e10cSrcweir             sLabel = sString;
1805cdf0e10cSrcweir         }
1806cdf0e10cSrcweir         while(false);
1807cdf0e10cSrcweir     }
1808cdf0e10cSrcweir     catch (com::sun::star::uno::Exception& rException)
1809cdf0e10cSrcweir     {
1810cdf0e10cSrcweir         (void)rException;
1811cdf0e10cSrcweir     }
1812cdf0e10cSrcweir 
1813cdf0e10cSrcweir     return sLabel;
1814cdf0e10cSrcweir }
1815cdf0e10cSrcweir 
1816cdf0e10cSrcweir 
1817cdf0e10cSrcweir 
1818cdf0e10cSrcweir 
GetUiIconForCommand(const::rtl::OUString & sCommandURL)1819cdf0e10cSrcweir Image AssistentDlgImpl::GetUiIconForCommand (const ::rtl::OUString& sCommandURL)
1820cdf0e10cSrcweir {
1821cdf0e10cSrcweir     Image aIcon;
1822cdf0e10cSrcweir     Reference<container::XNameAccess> xUICommandLabels;
1823cdf0e10cSrcweir 
1824cdf0e10cSrcweir     try
1825cdf0e10cSrcweir     {
1826cdf0e10cSrcweir         do
1827cdf0e10cSrcweir         {
1828cdf0e10cSrcweir             if (sCommandURL.getLength() == 0)
1829cdf0e10cSrcweir                 break;
1830cdf0e10cSrcweir 
1831cdf0e10cSrcweir             // Retrieve popup menu labels
1832cdf0e10cSrcweir             Reference<lang::XMultiServiceFactory> xFactory (
1833cdf0e10cSrcweir                 ::comphelper::getProcessServiceFactory ());
1834cdf0e10cSrcweir             if ( ! xFactory.is())
1835cdf0e10cSrcweir                 break;
1836cdf0e10cSrcweir 
1837cdf0e10cSrcweir             ::rtl::OUString sModuleIdentifier (
1838cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
1839cdf0e10cSrcweir 
1840cdf0e10cSrcweir             Reference<com::sun::star::ui::XModuleUIConfigurationManagerSupplier> xSupplier (
1841cdf0e10cSrcweir                 xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
1842cdf0e10cSrcweir                     "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"))),
1843cdf0e10cSrcweir                 UNO_QUERY_THROW);
1844cdf0e10cSrcweir 
1845cdf0e10cSrcweir             Reference<com::sun::star::ui::XUIConfigurationManager> xManager (
1846cdf0e10cSrcweir                 xSupplier->getUIConfigurationManager(sModuleIdentifier));
1847cdf0e10cSrcweir             if ( ! xManager.is())
1848cdf0e10cSrcweir                 break;
1849cdf0e10cSrcweir 
1850cdf0e10cSrcweir             Reference<com::sun::star::ui::XImageManager> xImageManager (
1851cdf0e10cSrcweir                 xManager->getImageManager(),
1852cdf0e10cSrcweir                 UNO_QUERY_THROW);
1853cdf0e10cSrcweir 
1854cdf0e10cSrcweir             Sequence<rtl::OUString> aCommandList(1);
1855cdf0e10cSrcweir             aCommandList[0] = sCommandURL;
1856cdf0e10cSrcweir             Sequence<Reference<graphic::XGraphic> > xIconList (
1857cdf0e10cSrcweir                 xImageManager->getImages(0,aCommandList));
1858cdf0e10cSrcweir             if ( ! xIconList.hasElements())
1859cdf0e10cSrcweir                 break;
1860cdf0e10cSrcweir 
1861cdf0e10cSrcweir             aIcon = Graphic(xIconList[0]).GetBitmapEx();
1862cdf0e10cSrcweir         }
1863cdf0e10cSrcweir         while(false);
1864cdf0e10cSrcweir     }
1865cdf0e10cSrcweir     catch (com::sun::star::uno::Exception& rException)
1866cdf0e10cSrcweir     {
1867cdf0e10cSrcweir         (void)rException;
1868cdf0e10cSrcweir     }
1869cdf0e10cSrcweir 
1870cdf0e10cSrcweir     return aIcon;
1871cdf0e10cSrcweir }
1872cdf0e10cSrcweir 
1873cdf0e10cSrcweir 
1874cdf0e10cSrcweir //////////////////////////////////////////////
1875cdf0e10cSrcweir 
AssistentDlg(Window * pParent,sal_Bool bAutoPilot)1876cdf0e10cSrcweir AssistentDlg::AssistentDlg(Window* pParent, sal_Bool bAutoPilot) :
1877cdf0e10cSrcweir     ModalDialog(pParent,SdResId(DLG_ASS))
1878cdf0e10cSrcweir {
1879cdf0e10cSrcweir     Link aFinishLink = LINK(this,AssistentDlg, FinishHdl);
1880cdf0e10cSrcweir     mpImpl = new AssistentDlgImpl( this, aFinishLink, bAutoPilot );
1881cdf0e10cSrcweir 
1882cdf0e10cSrcweir     // Buttonbelegung
1883cdf0e10cSrcweir     mpImpl->maFinishButton.SetClickHdl(LINK(this,AssistentDlg,FinishHdl));
1884cdf0e10cSrcweir 
1885cdf0e10cSrcweir     FreeResource();
1886cdf0e10cSrcweir }
1887cdf0e10cSrcweir 
IMPL_LINK(AssistentDlg,FinishHdl,OKButton *,EMPTYARG)1888cdf0e10cSrcweir IMPL_LINK( AssistentDlg, FinishHdl, OKButton *, EMPTYARG )
1889cdf0e10cSrcweir {
1890cdf0e10cSrcweir     if( GetStartType() == ST_OPEN )
1891cdf0e10cSrcweir     {
1892cdf0e10cSrcweir         // if we do not have a file here asked for one before ending the dialog
1893cdf0e10cSrcweir         String aFileToOpen = GetDocPath();
1894cdf0e10cSrcweir         if(aFileToOpen.Len() == 0)
1895cdf0e10cSrcweir         {
1896cdf0e10cSrcweir             sfx2::FileDialogHelper aFileDlg( WB_OPEN, ::String::CreateFromAscii("simpress") );
1897cdf0e10cSrcweir 
1898cdf0e10cSrcweir             if ( aFileDlg.Execute() == ERRCODE_NONE )
1899cdf0e10cSrcweir                 aFileToOpen = aFileDlg.GetPath();
1900cdf0e10cSrcweir             if( aFileToOpen.Len() == 0)
1901cdf0e10cSrcweir                 return 1;
1902cdf0e10cSrcweir             else
1903cdf0e10cSrcweir             {
1904cdf0e10cSrcweir                 //add the selected file to the recent-file-listbox and select the new entry
1905cdf0e10cSrcweir                 //this is necessary for 'GetDocPath()' returning the selected file after end of dialog
1906cdf0e10cSrcweir 
1907cdf0e10cSrcweir                 INetURLObject aURL;
1908cdf0e10cSrcweir                 aURL.SetSmartURL(aFileToOpen);
1909cdf0e10cSrcweir                 mpImpl->maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE )));
1910cdf0e10cSrcweir                 sal_uInt16 nNewPos = mpImpl->mpPage1OpenLB->InsertEntry(aURL.getName());
1911cdf0e10cSrcweir                 mpImpl->mpPage1OpenLB->SelectEntryPos(nNewPos);
1912cdf0e10cSrcweir             }
1913cdf0e10cSrcweir         }
1914cdf0e10cSrcweir     }
1915cdf0e10cSrcweir 
19162155a943Smseidel     // End
1917cdf0e10cSrcweir     mpImpl->EndDialog(RET_OK);
1918cdf0e10cSrcweir     EndDialog(RET_OK);
1919cdf0e10cSrcweir     return 0;
1920cdf0e10cSrcweir }
1921cdf0e10cSrcweir 
~AssistentDlg()1922cdf0e10cSrcweir AssistentDlg::~AssistentDlg()
1923cdf0e10cSrcweir {
1924cdf0e10cSrcweir     delete mpImpl;
1925cdf0e10cSrcweir }
1926cdf0e10cSrcweir 
1927cdf0e10cSrcweir 
GetDocument()1928cdf0e10cSrcweir SfxObjectShellLock AssistentDlg::GetDocument()
1929cdf0e10cSrcweir {
1930cdf0e10cSrcweir     return mpImpl->GetDocument();
1931cdf0e10cSrcweir }
1932cdf0e10cSrcweir 
GetOutputMedium() const1933cdf0e10cSrcweir OutputType AssistentDlg::GetOutputMedium() const
1934cdf0e10cSrcweir {
1935cdf0e10cSrcweir     if(mpImpl->mpPage2Medium1RB->IsChecked())
1936*dad2ac5bSMatthias Seidel         return OUTPUT_SCREEN_4_BY_3;
1937cdf0e10cSrcweir     else if(mpImpl->mpPage2Medium2RB->IsChecked())
1938*dad2ac5bSMatthias Seidel         return OUTPUT_SCREEN_16_BY_9;
1939*dad2ac5bSMatthias Seidel     else if(mpImpl->mpPage2Medium6RB->IsChecked())
1940*dad2ac5bSMatthias Seidel         return OUTPUT_SCREEN_16_BY_10;
1941cdf0e10cSrcweir     else if(mpImpl->mpPage2Medium3RB->IsChecked())
1942cdf0e10cSrcweir         return OUTPUT_OVERHEAD;
1943cdf0e10cSrcweir     else if(mpImpl->mpPage2Medium4RB->IsChecked())
1944cdf0e10cSrcweir         return OUTPUT_PAGE;
1945cdf0e10cSrcweir     else
1946cdf0e10cSrcweir         return OUTPUT_ORIGINAL;
1947cdf0e10cSrcweir }
1948cdf0e10cSrcweir 
IsSummary() const1949cdf0e10cSrcweir sal_Bool AssistentDlg::IsSummary() const
1950cdf0e10cSrcweir {
1951cdf0e10cSrcweir     return mpImpl->mpPage5SummaryCB->IsChecked();
1952cdf0e10cSrcweir }
1953cdf0e10cSrcweir 
GetStartType() const1954cdf0e10cSrcweir StartType AssistentDlg::GetStartType() const
1955cdf0e10cSrcweir {
1956cdf0e10cSrcweir     return mpImpl->GetStartType();
1957cdf0e10cSrcweir }
1958cdf0e10cSrcweir 
GetDocPath() const1959cdf0e10cSrcweir String AssistentDlg::GetDocPath() const
1960cdf0e10cSrcweir {
1961cdf0e10cSrcweir     return mpImpl->GetDocFileName();
1962cdf0e10cSrcweir }
1963cdf0e10cSrcweir 
GetStartWithFlag() const1964cdf0e10cSrcweir sal_Bool AssistentDlg::GetStartWithFlag() const
1965cdf0e10cSrcweir {
1966cdf0e10cSrcweir     return !mpImpl->maStartWithFlag.IsChecked();
1967cdf0e10cSrcweir }
1968cdf0e10cSrcweir 
IsDocEmpty() const1969cdf0e10cSrcweir sal_Bool AssistentDlg::IsDocEmpty() const
1970cdf0e10cSrcweir {
1971cdf0e10cSrcweir     return mpImpl->GetDocFileName().Len() == 0 &&
1972cdf0e10cSrcweir            mpImpl->GetLayoutFileName().Len() == 0;
1973cdf0e10cSrcweir }
1974cdf0e10cSrcweir 
GetPassword()1975cdf0e10cSrcweir String AssistentDlg::GetPassword()
1976cdf0e10cSrcweir {
1977cdf0e10cSrcweir     return mpImpl->GetPassword( mpImpl->maDocFile );
1978cdf0e10cSrcweir }
1979cdf0e10cSrcweir 
1980cdf0e10cSrcweir 
1981cdf0e10cSrcweir 
1982cdf0e10cSrcweir 
1983cdf0e10cSrcweir //===== NextButton ============================================================
1984cdf0e10cSrcweir 
NextButton(::Window * pParent,const ResId & rResId)1985cdf0e10cSrcweir NextButton::NextButton (::Window* pParent, const ResId& rResId)
1986cdf0e10cSrcweir     : maNextButton1(pParent, rResId),
1987cdf0e10cSrcweir       maNextButton2(pParent, rResId),
1988cdf0e10cSrcweir       mbIsFirstButtonActive(true)
1989cdf0e10cSrcweir {
1990cdf0e10cSrcweir     // Hide the unused button.
1991cdf0e10cSrcweir     maNextButton2.Hide();
1992cdf0e10cSrcweir }
1993cdf0e10cSrcweir 
1994cdf0e10cSrcweir 
1995cdf0e10cSrcweir 
1996cdf0e10cSrcweir 
ForceFocusEventBroadcast(void)1997cdf0e10cSrcweir void NextButton::ForceFocusEventBroadcast (void)
1998cdf0e10cSrcweir {
1999cdf0e10cSrcweir     // Hide the currently visible button and show and focus the other one.
2000cdf0e10cSrcweir     if (mbIsFirstButtonActive)
2001cdf0e10cSrcweir     {
2002cdf0e10cSrcweir         mbIsFirstButtonActive = false;
2003cdf0e10cSrcweir         maNextButton2.Show();
2004cdf0e10cSrcweir         maNextButton2.GrabFocus();
2005cdf0e10cSrcweir         maNextButton1.Hide();
2006cdf0e10cSrcweir     }
2007cdf0e10cSrcweir     else
2008cdf0e10cSrcweir     {
2009cdf0e10cSrcweir         mbIsFirstButtonActive = true;
2010cdf0e10cSrcweir         maNextButton1.Show();
2011cdf0e10cSrcweir         maNextButton1.GrabFocus();
2012cdf0e10cSrcweir         maNextButton2.Hide();
2013cdf0e10cSrcweir     }
2014cdf0e10cSrcweir }
2015cdf0e10cSrcweir 
2016cdf0e10cSrcweir 
2017cdf0e10cSrcweir 
2018cdf0e10cSrcweir 
SetClickHdl(const Link & rLink)2019cdf0e10cSrcweir void NextButton::SetClickHdl (const Link& rLink)
2020cdf0e10cSrcweir {
2021cdf0e10cSrcweir     // Forward the setting of the click handler to the two buttons
2022cdf0e10cSrcweir     // regardless of which one is currently visible.
2023cdf0e10cSrcweir     maNextButton1.SetClickHdl(rLink);
2024cdf0e10cSrcweir     maNextButton2.SetClickHdl(rLink);
2025cdf0e10cSrcweir }
2026cdf0e10cSrcweir 
2027cdf0e10cSrcweir 
2028cdf0e10cSrcweir 
2029cdf0e10cSrcweir 
IsEnabled(void)2030cdf0e10cSrcweir bool NextButton::IsEnabled (void)
2031cdf0e10cSrcweir {
2032cdf0e10cSrcweir     // Because the buttons are both either enabled or disabled, it is
2033cdf0e10cSrcweir     // sufficient to ask one to determine the state.
2034cdf0e10cSrcweir     return maNextButton1.IsEnabled();
2035cdf0e10cSrcweir }
2036cdf0e10cSrcweir 
2037cdf0e10cSrcweir 
2038cdf0e10cSrcweir 
2039cdf0e10cSrcweir 
Enable(bool bEnable)2040cdf0e10cSrcweir void NextButton::Enable (bool bEnable)
2041cdf0e10cSrcweir {
2042cdf0e10cSrcweir     // Enable or disable both buttons but do not change visibility or focus.
2043cdf0e10cSrcweir     maNextButton1.Enable(bEnable);
2044cdf0e10cSrcweir     maNextButton2.Enable(bEnable);
2045cdf0e10cSrcweir }
20462155a943Smseidel 
20472155a943Smseidel /* vim: set noet sw=4 ts=4: */
2048