fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / dlg / dlgass.cxx
blob787d9f3c9a83787b79b5049a52838fce1635b213
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/presentation/ClickAction.hpp>
21 #include <vcl/svapp.hxx>
22 #include <osl/mutex.hxx>
23 #include <vcl/msgbox.hxx>
24 #include <vcl/lstbox.hxx>
25 #include <vcl/combobox.hxx>
26 #include <sfx2/doctempl.hxx>
27 #include <svl/lstner.hxx>
28 #include <sfx2/objsh.hxx>
29 #include <svtools/ehdl.hxx>
30 #include <svtools/sfxecode.hxx>
31 #include <tools/urlobj.hxx>
32 #include <com/sun/star/presentation/FadeEffect.hpp>
33 #include <fadedef.h>
34 #include <sfx2/sfxsids.hrc>
35 #include <svl/undo.hxx>
36 #include "DrawDocShell.hxx"
37 #include <vcl/gdimtf.hxx>
38 #include <tools/wintypes.hxx>
39 #include "docprev.hxx"
40 #include <sfx2/app.hxx>
41 #include <sfx2/docfile.hxx>
42 #include <sfx2/dispatch.hxx>
43 #include <sfx2/request.hxx>
44 #include <com/sun/star/sdbc/XResultSet.hpp>
45 #include <com/sun/star/lang/XComponent.hpp>
46 #include <com/sun/star/util/XCloseable.hpp>
47 #include <com/sun/star/uno/RuntimeException.hpp>
48 #include <com/sun/star/frame/XModuleManager.hpp>
49 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
50 #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
51 #include <com/sun/star/ui/XImageManager.hpp>
52 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
53 #include <com/sun/star/frame/UICommandDescription.hpp>
54 #include <unotools/historyoptions.hxx>
55 #include <osl/file.hxx>
56 #include <sfx2/filedlghelper.hxx>
58 #include "sdpage.hxx"
59 #include "helpids.h"
60 #include "assclass.hxx"
61 #include "dlgass.hrc"
62 #include "dlgass.hxx"
63 #include "dlgctrls.hxx"
64 #include "strings.hrc"
65 #include "dlgassim.hxx"
66 #include "TemplateScanner.hxx"
67 #include "WindowUpdater.hxx"
69 #include <comphelper/processfactory.hxx>
70 #include <vector>
71 #include <boost/ptr_container/ptr_vector.hpp>
73 using namespace ::com::sun::star;
74 using namespace ::com::sun::star::uno;
75 using namespace ::sd;
77 using ::std::vector;
79 void InterpolateFixedBitmap( FixedBitmap * pBitmap )
81 Bitmap aBmp( pBitmap->GetBitmap() );
82 Size aSize = pBitmap->GetSizePixel();
83 aBmp.Scale( aSize, BMP_SCALE_BESTQUALITY );
84 pBitmap->SetBitmap( aBmp );
88 // ====================================================================
89 // ====================================================================
91 const char* PageHelpIds[] =
93 HID_SD_AUTOPILOT_PAGE1,
94 HID_SD_AUTOPILOT_PAGE2,
95 HID_SD_AUTOPILOT_PAGE3,
96 HID_SD_AUTOPILOT_PAGE4,
97 HID_SD_AUTOPILOT_PAGE5
100 // ====================================================================
102 class PasswordEntry
104 public:
105 uno::Sequence< beans::NamedValue > aEncryptionData;
106 String maPath;
109 // ====================================================================
111 /** A simple wrapper that looks like a PushButton and is used to force the
112 broadcasting of focus events primarly for accessibility tools.
113 Forcing focus events is achieved by using two identical PushButtons
114 which, when the focus event is requested, are exchanged and play focus
115 ping-pong by moving the focus from one to the other.
117 class NextButton
119 public:
120 NextButton (::Window* pParent, const ResId& rResId);
122 void ForceFocusEventBroadcast (void);
123 void SetClickHdl (const Link& rLink);
124 bool IsEnabled (void);
125 void Enable (bool bEnable);
127 private:
128 PushButton maNextButton1;
129 PushButton maNextButton2;
130 bool mbIsFirstButtonActive;
135 // ====================================================================
137 class AssistentDlgImpl : public SfxListener
139 public:
140 AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot );
141 ~AssistentDlgImpl();
143 /// Local mutex used to serialize concurrent method calls.
144 ::osl::Mutex maMutex;
146 SfxObjectShellLock GetDocument();
148 /** closes the current preview docshell */
149 void CloseDocShell();
151 /** Extract form the history list of recently used files the impress
152 files and insert them into a listbox.
154 void ScanDocmenu (void);
155 /** Flag that is set to sal_True after the recently used files have been
156 scanned.
158 sal_Bool mbRecentDocumentsReady;
160 /** When the list of templates has not been scanned already this is done
161 when this method is called. That includes requesting the whole list
162 of templates from UCB and extracting from that list the impress
163 templates and layouts and storing them for later use in
164 <member>maPresentList</member>. Note that the first call to this
165 method after installing a new Office may take some time.
167 void ProvideTemplates (void);
169 /** This method transfers the template folders from the template scanner
170 to the internal structures of this class. On termination it sets
171 the flag <member>mbTemplatesReady</member> to <TRUE/> to indicate
172 that the templates are available.
173 @param rTemplateFolders
174 This is a list of template folders. This method takes ownership
175 of the supplied entries by removing them from the list and
176 transferring them to an internal structure.
178 void TemplateScanDone (std::vector<TemplateDir*>& rTemplateFolders);
180 /** Flag that is set to sal_True after the impress templates have been
181 scanned.
183 sal_Bool mbTemplatesReady;
185 /** Flag used to prevent nested or concurrent calls to the
186 <member>UpdatePreview</memember> method. A <TRUE/> value indicates
187 that a preview update is currently active.
189 sal_Bool mbPreviewUpdating;
191 ::Window* mpWindow;
193 void SavePassword( SfxObjectShellLock xDoc, const String& rPath );
194 void RestorePassword( SfxItemSet* pSet, const String& rPath );
195 uno::Sequence < beans::NamedValue > GetPassword( const String rPath );
196 void DeletePasswords();
198 boost::ptr_vector< PasswordEntry > maPasswordList;
200 String maDocFile;
201 String maLayoutFile;
203 String GetDocFileName();
204 String GetLayoutFileName();
206 /// List of URLs of recently used impress files.
207 std::vector<String*> maOpenFilesList;
209 /// List of folders containing data about impress templates.
210 std::vector<TemplateDir*> maPresentList;
212 /// Currently selected template folder.
213 TemplateDir* mpTemplateRegion;
215 /// Currently selected layout folder.
216 TemplateDir* mpLayoutRegion;
218 // preview
219 sal_Bool mbUserDataDirty;
220 Timer maPrevTimer;
221 Timer maEffectPrevTimer;
222 Timer maUpdatePageListTimer;
223 Timer maStartScanTimer;
225 SfxObjectShellLock xDocShell;
227 ::std::auto_ptr<WindowUpdater> mpWindowUpdater;
229 sal_Bool mbPreview;
230 sal_uInt16 mnShowPage;
231 sal_Bool mbDocPreview;
233 sal_uLong mnTemplate;
235 String maPageListFile;
237 void UpdatePreview( sal_Bool bDocPreview );
238 void UpdatePageList();
239 void UpdateUserData();
241 sal_Bool IsOwnFormat( const String& rPath );
243 // dlg status
244 void EndDialog( long nResult = 0 );
246 void SetStartType( StartType eType );
247 StartType GetStartType();
249 void SelectTemplateRegion( const String& rRegion );
250 void SelectLayoutRegion( const String& rRegion );
252 void UpdatePage();
253 void ChangePage();
254 void LeavePage();
256 String GetUiTextForCommand (const OUString& aCommandURL);
257 Image GetUiIconForCommand (const OUString& aCommandURL);
259 DECL_LINK( StartScanHdl, void * );
260 DECL_LINK( SelectFileHdl, void * );
261 DECL_LINK( SelectRegionHdl, ListBox * );
262 DECL_LINK( UpdatePreviewHdl, void * );
263 DECL_LINK( UpdatePageListHdl, void * );
264 DECL_LINK( StartTypeHdl, RadioButton * );
265 DECL_LINK( SelectTemplateHdl, void * );
266 DECL_LINK( NextPageHdl, void * );
267 DECL_LINK( LastPageHdl, void * );
268 DECL_LINK( PreviewFlagHdl, void * );
269 DECL_LINK( EffectPreviewHdl, void * );
270 DECL_LINK( SelectLayoutHdl, void * );
271 DECL_LINK( PageSelectHdl, void * );
272 DECL_LINK( PresTypeHdl, void * );
273 DECL_LINK( UpdateUserDataHdl, void * );
274 DECL_LINK( SelectEffectHdl, void* );
275 DECL_LINK( OpenButtonHdl, Button * );
277 // Common
278 Assistent maAssistentFunc;
279 CheckBox maPreviewFlag;
280 CheckBox maStartWithFlag;
281 HelpButton maHelpButton;
282 CancelButton maCancelButton;
283 PushButton maLastPageButton;
284 NextButton maNextPageButton;
285 OKButton maFinishButton;
286 SdDocPreviewWin maPreview;
288 String maCreateStr;
289 String maOpenStr;
291 // page 1
292 FixedBitmap* mpPage1FB;
293 FixedLine* mpPage1ArtFL;
294 RadioButton* mpPage1EmptyRB;
295 RadioButton* mpPage1TemplateRB;
296 ListBox* mpPage1RegionLB;
297 ListBox* mpPage1TemplateLB;
298 RadioButton* mpPage1OpenRB;
299 ListBox* mpPage1OpenLB;
300 PushButton* mpPage1OpenPB;
302 // page 2
303 FixedBitmap* mpPage2FB;
304 FixedLine* mpPage2LayoutFL;
305 ListBox* mpPage2RegionLB;
306 ListBox* mpPage2LayoutLB;
307 FixedLine* mpPage2OutTypesFL;
308 RadioButton* mpPage2Medium1RB;
309 RadioButton* mpPage2Medium2RB;
310 RadioButton* mpPage2Medium3RB;
311 RadioButton* mpPage2Medium4RB;
312 RadioButton* mpPage2Medium5RB;
313 RadioButton* mpPage2Medium6RB;
315 // page 3
316 FixedBitmap* mpPage3FB;
317 FixedLine* mpPage3EffectFL;
318 FixedText* mpPage3EffectFT;
319 FadeEffectLB* mpPage3EffectLB;
320 FixedText* mpPage3SpeedFT;
321 ListBox* mpPage3SpeedLB;
322 FixedLine* mpPage3PresTypeFL;
323 RadioButton* mpPage3PresTypeLiveRB;
324 RadioButton* mpPage3PresTypeKioskRB;
325 FixedText* mpPage3PresTimeFT;
326 TimeField* mpPage3PresTimeTMF;
327 FixedText* mpPage3BreakFT;
328 TimeField* mpPage3BreakTMF;
329 CheckBox* mpPage3LogoCB;
331 // page 4
332 FixedBitmap* mpPage4FB;
333 FixedLine* mpPage4PersonalFL;
334 FixedText* mpPage4AskNameFT;
335 Edit* mpPage4AskNameEDT;
336 FixedText* mpPage4AskTopicFT;
337 Edit* mpPage4AskTopicEDT;
338 FixedText* mpPage4AskInfoFT;
339 MultiLineEdit* mpPage4AskInfoEDT;
341 // page 5
342 FixedBitmap* mpPage5FB;
343 FixedText* mpPage5PageListFT;
344 SdPageListControl* mpPage5PageListCT;
345 CheckBox* mpPage5SummaryCB;
351 // ====================================================================
353 AssistentDlgImpl::AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot ) :
354 mpTemplateRegion(NULL),
355 mpLayoutRegion(NULL),
356 mbUserDataDirty(sal_False),
357 xDocShell (NULL),
358 mpWindowUpdater (new WindowUpdater()),
359 mbPreview(sal_True),
360 mnShowPage(0),
361 mbDocPreview(sal_False),
362 maAssistentFunc(5),
363 maPreviewFlag(pWindow,SdResId(CB_PREVIEW)),
364 maStartWithFlag(pWindow,SdResId(CB_STARTWITH)),
365 maHelpButton(pWindow,SdResId(BUT_HELP)),
366 maCancelButton(pWindow,SdResId(BUT_CANCEL)),
367 maLastPageButton(pWindow,SdResId(BUT_LAST)),
368 maNextPageButton(pWindow,SdResId(BUT_NEXT)),
369 maFinishButton(pWindow,SdResId(BUT_FINISH)),
370 maPreview(pWindow,SdResId(CT_PREVIEW)),
371 maCreateStr(SdResId(STR_CREATE)),
372 maOpenStr(SdResId(STR_OPEN))
374 maPageListFile += sal_Unicode('?'),
375 mbRecentDocumentsReady = sal_False;
376 mbTemplatesReady = sal_False;
377 mbPreviewUpdating = sal_False;
379 mpWindow = pWindow;
381 if(bAutoPilot)
382 maStartWithFlag.Hide();
383 else
384 maAssistentFunc.InsertControl(1, &maStartWithFlag );
386 // initialize page1 and give it to the assistant functionality
387 maAssistentFunc.InsertControl(1, &maPreview );
388 maAssistentFunc.InsertControl(1, &maPreviewFlag );
389 maAssistentFunc.InsertControl(1,
390 mpPage1FB = new FixedBitmap(pWindow,SdResId(FB_PAGE1)));
391 maAssistentFunc.InsertControl(1,
392 mpPage1ArtFL = new FixedLine(pWindow,SdResId(FL_PAGE1_ARTGROUP)));
393 maAssistentFunc.InsertControl(1,
394 mpPage1EmptyRB=new RadioButton(pWindow,SdResId(RB_PAGE1_EMPTY)));
395 maAssistentFunc.InsertControl(1,
396 mpPage1TemplateRB=new RadioButton(pWindow,SdResId(RB_PAGE1_TEMPLATE)));
397 maAssistentFunc.InsertControl(1,
398 mpPage1OpenRB=new RadioButton(pWindow,SdResId(RB_PAGE1_OPEN)));
399 maAssistentFunc.InsertControl(1,
400 mpPage1RegionLB = new ListBox(pWindow,SdResId(LB_PAGE1_REGION)));
401 maAssistentFunc.InsertControl(1,
402 mpPage1TemplateLB=new ListBox(pWindow,SdResId(LB_PAGE1_TEMPLATES)));
403 maAssistentFunc.InsertControl(1,
404 mpPage1OpenPB=new PushButton(pWindow,SdResId(PB_PAGE1_OPEN)));
405 maAssistentFunc.InsertControl(1,
406 mpPage1OpenLB=new ListBox(pWindow,SdResId(LB_PAGE1_OPEN)));
408 // Align the button and list box displayed for the "open existing file"
409 // radio button with the text of that radio button.
411 RadioButton aEmptyRB (mpWindow);
412 sal_Int32 nIndent (aEmptyRB.CalcMinimumSize(0).Width());
413 sal_Int32 nLeft (mpPage1OpenRB->GetPosPixel().X() + nIndent);
414 sal_Int32 nWidth (mpPage1OpenRB->GetSizePixel().Width() - nIndent);
415 mpPage1OpenPB->SetPosSizePixel(
416 Point(nLeft, mpPage1OpenPB->GetPosPixel().Y()),
417 Size(mpPage1OpenPB->GetSizePixel()));
418 mpPage1OpenLB->SetPosSizePixel(
419 Point(nLeft, mpPage1OpenLB->GetPosPixel().Y()),
420 Size(nWidth, mpPage1OpenLB->GetSizePixel().Height()));
423 // Set text and icon of the 'Open...' button.
425 String sText (GetUiTextForCommand(".uno:Open"));
426 // Remove the mnemonic and add a leading space so that icon and text
427 // are not too close together.
428 sText.SearchAndReplaceAll(OUString("~"),String());
429 sText.Insert(OUString(" "),0);
430 mpPage1OpenPB->SetText(sText);
431 // Place icon left of text and both centered in the button.
432 mpPage1OpenPB->SetModeImage(
433 GetUiIconForCommand(".uno:Open")
435 mpPage1OpenPB->EnableImageDisplay(sal_True);
436 mpPage1OpenPB->EnableTextDisplay(sal_True);
437 mpPage1OpenPB->SetImageAlign(IMAGEALIGN_LEFT);
438 mpPage1OpenPB->SetStyle(mpPage1OpenPB->GetStyle() | WB_CENTER);
441 // links&handler
442 mpPage1RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
443 mpPage1RegionLB->SetDropDownLineCount( 6 );
444 mpPage1TemplateLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectTemplateHdl));
445 mpPage1TemplateLB->SetStyle(mpPage1TemplateLB->GetStyle() | WB_SORT);
446 mpPage1TemplateLB->InsertEntry(String(SdResId(STR_ISLOADING)));
448 mpPage1EmptyRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
449 mpPage1TemplateRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
450 mpPage1OpenRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
451 mpPage1OpenLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectFileHdl));
452 mpPage1OpenLB->SetDoubleClickHdl(rFinishLink);
453 mpPage1OpenPB->SetClickHdl(LINK(this,AssistentDlgImpl,OpenButtonHdl));
455 // page 2
456 maAssistentFunc.InsertControl(2, &maPreview );
457 maAssistentFunc.InsertControl(2, &maPreviewFlag );
458 maAssistentFunc.InsertControl(2,
459 mpPage2FB = new FixedBitmap(pWindow,SdResId(FB_PAGE2)));
460 maAssistentFunc.InsertControl(2,
461 mpPage2LayoutFL = new FixedLine( pWindow, SdResId(FL_PAGE2_LAYOUT) ));
462 maAssistentFunc.InsertControl(2,
463 mpPage2RegionLB = new ListBox(pWindow,SdResId(LB_PAGE2_REGION) ));
464 maAssistentFunc.InsertControl(2,
465 mpPage2LayoutLB = new ListBox(pWindow,SdResId(LB_PAGE2_LAYOUT) ));
467 maAssistentFunc.InsertControl(2,
468 mpPage2OutTypesFL = new FixedLine( pWindow, SdResId(FL_PAGE2_OUTPUTTYPES) ));
469 maAssistentFunc.InsertControl(2,
470 mpPage2Medium5RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM5) ));
471 maAssistentFunc.InsertControl(2,
472 mpPage2Medium3RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM3) ));
473 maAssistentFunc.InsertControl(2,
474 mpPage2Medium4RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM4) ));
475 maAssistentFunc.InsertControl(2,
476 mpPage2Medium1RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM1) ));
477 maAssistentFunc.InsertControl(2,
478 mpPage2Medium2RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM2) ));
479 maAssistentFunc.InsertControl(2,
480 mpPage2Medium6RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM6) ));
481 mpPage2Medium5RB->Check();
483 mpPage2RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
484 mpPage2RegionLB->SetDropDownLineCount( 6 );
485 mpPage2LayoutLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectLayoutHdl));
486 mpPage2LayoutLB->SetStyle(mpPage2LayoutLB->GetStyle() | WB_SORT);
487 mpPage2LayoutLB->InsertEntry(String(SdResId(STR_ISLOADING)));
489 // page 3
490 maAssistentFunc.InsertControl(3, &maPreview );
491 maAssistentFunc.InsertControl(3, &maPreviewFlag );
492 maAssistentFunc.InsertControl(3,
493 mpPage3FB = new FixedBitmap(pWindow,SdResId(FB_PAGE3)));
494 maAssistentFunc.InsertControl(3,
495 mpPage3EffectFL = new FixedLine( pWindow, SdResId(FL_PAGE3_EFFECT) ));
496 maAssistentFunc.InsertControl(3,
497 mpPage3EffectFT = new FixedText( pWindow, SdResId(FT_PAGE3_EFFECT) ));
498 maAssistentFunc.InsertControl(3,
499 mpPage3EffectLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_EFFECT) ));
500 maAssistentFunc.InsertControl(3,
501 mpPage3SpeedFT = new FixedText( pWindow, SdResId(FT_PAGE3_SPEED) ));
502 maAssistentFunc.InsertControl(3,
503 mpPage3SpeedLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_SPEED) ));
504 maAssistentFunc.InsertControl(3,
505 mpPage3PresTypeFL = new FixedLine( pWindow, SdResId(FL_PAGE3_PRESTYPE) ));
506 maAssistentFunc.InsertControl(3,
507 mpPage3PresTypeLiveRB = new RadioButton( pWindow, SdResId(RB_PAGE3_LIVE) ));
508 maAssistentFunc.InsertControl(3,
509 mpPage3PresTypeKioskRB = new RadioButton( pWindow, SdResId(RB_PAGE3_KIOSK) ));
510 maAssistentFunc.InsertControl(3,
511 mpPage3PresTimeFT = new FixedText( pWindow, SdResId( FT_PAGE3_TIME) ));
512 maAssistentFunc.InsertControl(3,
513 mpPage3PresTimeTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_TIME) ));
514 maAssistentFunc.InsertControl(3,
515 mpPage3BreakFT = new FixedText( pWindow, SdResId( FT_PAGE3_BREAK) ));
516 maAssistentFunc.InsertControl(3,
517 mpPage3BreakTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_BREAK) ));
518 maAssistentFunc.InsertControl(3,
519 mpPage3LogoCB = new CheckBox( pWindow, SdResId( CB_PAGE3_LOGO) ));
521 mpPage3EffectLB->Fill();
522 mpPage3EffectLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
523 mpPage3EffectLB->SetDropDownLineCount( 12 );
525 mpPage3SpeedLB->InsertEntry( String( SdResId(STR_SLOW) ));
526 mpPage3SpeedLB->InsertEntry( String( SdResId(STR_MEDIUM) ));
527 mpPage3SpeedLB->InsertEntry( String( SdResId(STR_FAST) ));
528 mpPage3SpeedLB->SetDropDownLineCount( 3 );
529 mpPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
530 mpPage3SpeedLB->SelectEntryPos( 1 );
532 mpPage3PresTypeLiveRB->Check();
533 mpPage3PresTypeLiveRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
534 mpPage3PresTypeKioskRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
535 mpPage3PresTimeTMF->SetFormat( TIMEF_SEC );
536 mpPage3PresTimeTMF->SetTime( Time( 0, 0, 10 ) );
537 mpPage3BreakTMF->SetFormat( TIMEF_SEC );
538 mpPage3BreakTMF->SetTime( Time( 0, 0, 10 ) );
539 mpPage3LogoCB->Check();
541 // set cursor in timefield
542 Edit *pEditPage3PresTimeTMF = mpPage3PresTimeTMF->GetField();
543 Edit *pEditPage3BreakTMF = mpPage3BreakTMF->GetField();
544 Selection aSel1( pEditPage3PresTimeTMF->GetMaxTextLen(), pEditPage3PresTimeTMF->GetMaxTextLen() );
545 Selection aSel2( pEditPage3BreakTMF->GetMaxTextLen(), pEditPage3BreakTMF->GetMaxTextLen() );
546 pEditPage3PresTimeTMF->SetSelection( aSel1 );
547 pEditPage3BreakTMF->SetSelection( aSel2 );
549 // page 4
550 maAssistentFunc.InsertControl(4,
551 mpPage4FB = new FixedBitmap(pWindow,SdResId(FB_PAGE4)));
552 maAssistentFunc.InsertControl(4,
553 mpPage4PersonalFL = new FixedLine( pWindow, SdResId(FL_PAGE4_PERSONAL) ));
554 maAssistentFunc.InsertControl(4,
555 mpPage4AskNameFT = new FixedText( pWindow, SdResId(FT_PAGE4_ASKNAME) ));
556 maAssistentFunc.InsertControl(4,
557 mpPage4AskNameEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKNAME) ));
558 maAssistentFunc.InsertControl(4,
559 mpPage4AskTopicFT= new FixedText( pWindow, SdResId(FT_PAGE4_ASKTOPIC) ));
560 maAssistentFunc.InsertControl(4,
561 mpPage4AskTopicEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKTOPIC) ));
562 maAssistentFunc.InsertControl(4,
563 mpPage4AskInfoFT = new FixedText( pWindow, SdResId(FT_PAGE4_ASKINFORMATION) ));
564 maAssistentFunc.InsertControl(4,
565 mpPage4AskInfoEDT = new MultiLineEdit( pWindow, SdResId(EDT_PAGE4_ASKINFORMATION) ));
567 mpPage4AskNameEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
568 mpPage4AskTopicEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
569 mpPage4AskInfoEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
571 // page 5
572 maAssistentFunc.InsertControl(5, &maPreview );
573 maAssistentFunc.InsertControl(5, &maPreviewFlag );
574 maAssistentFunc.InsertControl(5,
575 mpPage5FB = new FixedBitmap(pWindow,SdResId(FB_PAGE5)));
576 maAssistentFunc.InsertControl(5,
577 mpPage5PageListFT = new FixedText( pWindow, SdResId( FT_PAGE5_PAGELIST ) ));
578 maAssistentFunc.InsertControl(5,
579 mpPage5PageListCT = new SdPageListControl( pWindow, SdResId( CT_PAGE5_PAGELIST ) ));
580 maAssistentFunc.InsertControl(5,
581 mpPage5SummaryCB = new CheckBox( pWindow, SdResId( CB_PAGE5_SUMMARY ) ));
583 mpPage5PageListCT->SetSelectHdl(LINK(this,AssistentDlgImpl, PageSelectHdl));
586 // general
587 InterpolateFixedBitmap( mpPage1FB );
588 InterpolateFixedBitmap( mpPage2FB );
589 InterpolateFixedBitmap( mpPage3FB );
590 InterpolateFixedBitmap( mpPage4FB );
591 InterpolateFixedBitmap( mpPage5FB );
593 maLastPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, LastPageHdl ));
594 maNextPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, NextPageHdl ));
596 maPreviewFlag.Check( mbPreview );
597 maPreviewFlag.SetClickHdl(LINK(this, AssistentDlgImpl, PreviewFlagHdl ));
598 maPreview.SetClickHdl(LINK(this,AssistentDlgImpl, EffectPreviewHdl ));
600 // sets the exit page
601 maAssistentFunc.GotoPage(1);
602 maLastPageButton.Disable();
604 maPrevTimer.SetTimeout( 200 );
605 maPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePreviewHdl));
607 maEffectPrevTimer.SetTimeout( 50 );
608 maEffectPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, EffectPreviewHdl ));
610 maUpdatePageListTimer.SetTimeout( 50 );
611 maUpdatePageListTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePageListHdl));
613 SetStartType( ST_EMPTY );
615 ChangePage();
617 mpWindowUpdater->RegisterWindow (&maPreview);
619 UpdatePreview( sal_True );
621 //check whether we should start with a template document initialy and preselect it
622 const OUString aServiceName( "com.sun.star.presentation.PresentationDocument" );
623 String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) );
624 if( aStandardTemplate.Len() )
626 ProvideTemplates();
628 //find aStandardTemplate in maPresentList
629 TemplateDir* pStandardTemplateDir = 0;
630 TemplateEntry* pStandardTemplateEntry = 0;
632 std::vector<TemplateDir*>::iterator I;
633 for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
635 TemplateDir* pDir = *I;
636 std::vector<TemplateEntry*>::iterator J;
637 for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J)
639 TemplateEntry* pEntry = *J;
640 if(pEntry->msPath == aStandardTemplate)
642 pStandardTemplateDir = pDir;
643 pStandardTemplateEntry = pEntry;
644 break;
647 if(pStandardTemplateDir)
648 break;
651 //preselect template
652 if( pStandardTemplateDir && pStandardTemplateEntry )
654 mpPage1RegionLB->SelectEntry( pStandardTemplateDir->msRegion );
655 SelectTemplateRegion( pStandardTemplateDir->msRegion );
656 mpPage1TemplateLB->SelectEntry( pStandardTemplateEntry->msTitle );
657 SelectTemplateHdl(mpPage1TemplateLB);
665 AssistentDlgImpl::~AssistentDlgImpl()
667 CloseDocShell();
669 DeletePasswords();
671 // Delete the template file infos.
672 std::vector<TemplateDir*>::iterator I;
673 std::vector<TemplateEntry*>::iterator J;
674 for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
676 for (J=(*I)->maEntries.begin(); J!=(*I)->maEntries.end(); ++J)
677 delete (*J);
678 delete (*I);
681 // page 1
682 delete mpPage1FB;
683 delete mpPage1ArtFL;
684 delete mpPage1EmptyRB;
685 delete mpPage1TemplateRB;
686 delete mpPage1TemplateLB;
687 delete mpPage1RegionLB;
688 delete mpPage1OpenRB;
689 delete mpPage1OpenLB;
690 delete mpPage1OpenPB;
692 // page 2
693 delete mpPage2FB;
694 delete mpPage2LayoutFL;
695 delete mpPage2RegionLB;
696 delete mpPage2LayoutLB;
697 delete mpPage2OutTypesFL;
698 delete mpPage2Medium1RB;
699 delete mpPage2Medium2RB;
700 delete mpPage2Medium3RB;
701 delete mpPage2Medium4RB;
702 delete mpPage2Medium5RB;
703 delete mpPage2Medium6RB;
705 // page 3
706 delete mpPage3FB;
707 delete mpPage3EffectFL;
708 delete mpPage3EffectFT;
709 delete mpPage3EffectLB;
710 delete mpPage3SpeedFT;
711 delete mpPage3SpeedLB;
712 delete mpPage3PresTypeFL;
713 delete mpPage3PresTypeLiveRB;
714 delete mpPage3PresTypeKioskRB;
715 delete mpPage3PresTimeFT;
716 delete mpPage3PresTimeTMF;
717 delete mpPage3BreakFT;
718 delete mpPage3BreakTMF;
719 delete mpPage3LogoCB;
721 // page 4
722 delete mpPage4FB;
723 delete mpPage4PersonalFL;
724 delete mpPage4AskNameFT;
725 delete mpPage4AskNameEDT;
726 delete mpPage4AskTopicFT;
727 delete mpPage4AskTopicEDT;
728 delete mpPage4AskInfoFT;
729 delete mpPage4AskInfoEDT;
731 // page 5
732 delete mpPage5FB;
733 delete mpPage5PageListFT;
734 delete mpPage5PageListCT;
735 delete mpPage5SummaryCB;
737 // Delete the file history list.
738 std::vector<String*>::iterator I2;
739 for (I2=maOpenFilesList.begin(); I2!=maOpenFilesList.end(); ++I2)
740 delete *I2;
743 void AssistentDlgImpl::CloseDocShell()
745 if(xDocShell.Is())
747 uno::Reference< util::XCloseable > xCloseable( xDocShell->GetModel(), uno::UNO_QUERY );
748 if( xCloseable.is() )
750 xCloseable->close( sal_True );
751 xDocShell = NULL;
753 else
755 xDocShell->DoClose();
756 xDocShell = NULL;
761 void AssistentDlgImpl::EndDialog( long )
763 mpWindow = NULL;
769 void AssistentDlgImpl::ScanDocmenu (void)
771 if( mbRecentDocumentsReady )
772 return;
774 uno::Sequence<uno::Sequence<beans::PropertyValue> > aHistory =
775 SvtHistoryOptions().GetList (ePICKLIST);
777 uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
778 uno::Reference< container::XNameAccess > xFilterFactory( xFactory->createInstance( "com.sun.star.document.FilterFactory" ), uno::UNO_QUERY );
780 uno::Reference<ucb::XSimpleFileAccess3> xFileAccess(ucb::SimpleFileAccess::create(::comphelper::getProcessComponentContext()));
782 sal_uInt32 nCount = aHistory.getLength();
783 for (sal_uInt32 nItem=0; nItem<nCount; ++nItem)
785 // Get the current history item's properties.
786 uno::Sequence<beans::PropertyValue> aPropertySet = aHistory[nItem];
787 OUString sURL;
788 OUString sFilter;
789 OUString sTitle;
790 OUString sPassword;
791 sal_uInt32 nPropertyCount = aPropertySet.getLength();
792 for (sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty)
793 if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_URL)
794 aPropertySet[nProperty].Value >>= sURL;
795 else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_FILTER)
796 aPropertySet[nProperty].Value >>= sFilter;
797 else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_TITLE)
798 aPropertySet[nProperty].Value >>= sTitle;
799 else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_PASSWORD)
800 aPropertySet[nProperty].Value >>= sPassword;
802 // If the entry is an impress file then insert it into the
803 // history list and the list box.
804 uno::Sequence< beans::PropertyValue > lProps;
805 if (xFilterFactory->hasByName(sFilter))
807 uno::Any aFilterPropSet = xFilterFactory->getByName( sFilter );
808 aFilterPropSet >>= lProps;
811 sal_Int32 nPropCount = lProps.getLength();
812 OUString sFactoryName;
813 for( sal_Int32 i=0; i<nPropCount; ++i )
815 if( lProps[i].Name.compareToAscii( "DocumentService" ) == 0 &&
816 (lProps[i].Value >>= sFactoryName) &&
817 sFactoryName.compareToAscii( "com.sun.star.presentation.PresentationDocument" ) == 0 )
819 // yes, it's an impress document
820 INetURLObject aURL;
822 // Do not include the file if it does not exist.
823 if (xFileAccess.is() && ! xFileAccess->exists(sURL))
824 continue;
826 aURL.SetSmartURL (sURL);
827 // The password is set only when it is not empty.
828 if (!sPassword.isEmpty())
829 aURL.SetPass (sPassword);
830 maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE )));
831 mpPage1OpenLB->InsertEntry (sTitle);
832 break;
836 mbRecentDocumentsReady = sal_True;
839 UpdatePreview(sal_True);
841 catch (uno::RuntimeException& )
843 // Ignore all exceptions.
849 void AssistentDlgImpl::ProvideTemplates (void)
851 if ( ! mbTemplatesReady)
853 TemplateScanner aScanner;
854 aScanner.EnableEntrySorting();
855 aScanner.Scan ();
856 TemplateScanDone (aScanner.GetFolderList());
860 UpdatePreview(sal_True);
862 catch (uno::RuntimeException& )
864 // Ignore all exceptions.
869 void AssistentDlgImpl::TemplateScanDone (
870 std::vector<TemplateDir*>& rTemplateFolder)
872 // This method is called from a thread. Therefore we get the solar mutex.
873 SolarMutexGuard aGuard;
875 // Copy the contents of the given template folders to a local list.
876 maPresentList.swap (rTemplateFolder);
878 // Fill in the list box on the first page.
879 int nFirstEntry = 0;
880 mpPage1RegionLB->Clear();
881 std::vector<TemplateDir*>::iterator I;
882 int i;
883 for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); ++I,++i)
885 TemplateDir* pDir = *I;
886 if (pDir == NULL)
887 continue;
889 // HACK! presnt directory is always initially selected.
890 // We have to look at the first entry to get a URL.
891 if (!pDir->maEntries.empty() )
893 TemplateEntry* pEntry = pDir->maEntries.front();
894 if (pEntry != NULL)
895 if (pEntry->msPath.SearchAscii("presnt") != STRING_NOTFOUND)
896 nFirstEntry = i;
899 mpPage1RegionLB->InsertEntry (pDir->msRegion);
901 mpPage1RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry);
902 mpPage1RegionLB->Update();
903 SelectTemplateRegion (mpPage1RegionLB->GetSelectEntry());
905 // Fill in the list box on the second page.
906 nFirstEntry = 0;
907 mpPage2RegionLB->Clear();
908 for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); ++I,++i)
910 TemplateDir* pDir = *I;
911 if (pDir == NULL)
912 continue;
914 // HACK! layout directory is always initially selected.
915 // We have to look at the first entry to get a URL.
916 if (!pDir->maEntries.empty() )
918 TemplateEntry* pEntry = pDir->maEntries.front();
919 if (pEntry != NULL)
920 if (pEntry->msPath.SearchAscii("layout") != STRING_NOTFOUND)
921 nFirstEntry = i;
924 mpPage2RegionLB->InsertEntry (pDir->msRegion);
926 mpPage2RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry);
927 mpPage2RegionLB->Update();
928 SelectLayoutRegion (mpPage2RegionLB->GetSelectEntry());
930 // Make the changes visible.
931 mbTemplatesReady = sal_True;
932 if (mpWindow)
933 UpdatePage();
939 // ********************************************************************
940 // state methods
941 // ********************************************************************
943 void AssistentDlgImpl::SetStartType( StartType eType )
945 mpPage1EmptyRB->SetState( eType == ST_EMPTY );
946 mpPage1TemplateRB->SetState( eType == ST_TEMPLATE );
947 mpPage1OpenRB->SetState( eType == ST_OPEN );
948 maNextPageButton.Enable( eType != ST_OPEN );
950 mpPage1RegionLB->Show(eType == ST_TEMPLATE);
951 mpPage1TemplateLB->Show(eType == ST_TEMPLATE);
952 mpPage1OpenLB->Show(eType == ST_OPEN);
953 mpPage1OpenPB->Show(eType == ST_OPEN);
955 if (eType == ST_OPEN)
956 maFinishButton.SetText(maOpenStr);
957 else
958 maFinishButton.SetText(maCreateStr);
961 StartType AssistentDlgImpl::GetStartType()
963 if( mpPage1EmptyRB->IsChecked() )
964 return ST_EMPTY;
965 else if( mpPage1TemplateRB->IsChecked() )
966 return ST_TEMPLATE;
967 else
968 return ST_OPEN;
971 String AssistentDlgImpl::GetDocFileName()
973 String aTitle;
974 if(mpWindow)
976 aTitle = mpWindow->GetText();
977 sal_uInt16 nPos = aTitle.Search(sal_Unicode('('));
978 if(nPos != STRING_NOTFOUND)
979 aTitle.Erase( nPos-1 );
982 String aDocFile;
983 if( GetStartType() == ST_TEMPLATE )
985 const sal_uInt16 nEntry = mpPage1TemplateLB->GetSelectEntryPos();
986 TemplateEntry* pEntry = NULL;
987 if(nEntry != (sal_uInt16)-1)
988 pEntry = mpTemplateRegion->maEntries[nEntry];
990 if(pEntry)
992 aDocFile = pEntry->msPath;
994 aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) );
995 aTitle.Append( pEntry->msTitle );
996 aTitle.Append( sal_Unicode(')') );
999 else if( GetStartType() == ST_OPEN )
1001 const sal_uInt16 nEntry = mpPage1OpenLB->GetSelectEntryPos();
1002 if(nEntry != (sal_uInt16)-1 )
1003 aDocFile = *maOpenFilesList[nEntry];
1006 if(mpWindow)
1007 mpWindow->SetText(aTitle);
1009 return aDocFile;
1012 String AssistentDlgImpl::GetLayoutFileName()
1014 String aFile;
1015 const sal_uInt16 nEntry = mpPage2LayoutLB->GetSelectEntryPos();
1016 TemplateEntry* pEntry = NULL;
1017 if(nEntry != (sal_uInt16)-1 && nEntry > 0)
1018 pEntry = mpLayoutRegion->maEntries[nEntry-1];
1020 if(pEntry)
1021 aFile = pEntry->msPath;
1023 return aFile;
1026 SfxObjectShellLock AssistentDlgImpl::GetDocument()
1028 UpdatePreview(sal_False); // but load completely
1029 UpdatePageList();
1031 SfxObjectShell* pShell = xDocShell;
1032 ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,pShell);
1033 SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1035 if(pDoc)
1037 const sal_uInt16 nPageCount = pDoc->GetSdPageCount(PK_STANDARD);
1038 sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
1039 double fNewTime = (double)mpPage3PresTimeTMF->GetTime().GetMSFromTime() / 1000.0;
1040 if(bKiosk)
1042 PresentationSettings& rSettings = pDoc->getPresentationSettings();
1043 rSettings.mbEndless = bKiosk;
1044 rSettings.mnPauseTimeout = (sal_Int32)mpPage3BreakTMF->GetTime().GetMSFromTime() / 1000;
1045 rSettings.mbShowPauseLogo = mpPage3LogoCB->IsChecked();
1048 sal_uInt16 nPgAbsNum = 0;
1049 sal_uInt16 nPgRelNum = 0;
1050 while( nPgAbsNum < nPageCount )
1052 SdPage* pPage = pDoc->GetSdPage( nPgRelNum, PK_STANDARD );
1053 if( mpPage5PageListCT->IsPageChecked(nPgAbsNum) )
1055 mpPage3EffectLB->applySelected(pPage);
1056 const sal_uInt16 nPos = mpPage3SpeedLB->GetSelectEntryPos();
1057 pPage->setTransitionDuration( (nPos == 0) ? 3.0 : (nPos == 1) ? 2.0 : 1.0 );
1058 if(bKiosk)
1060 pPage->SetPresChange( PRESCHANGE_AUTO );
1061 pPage->SetTime(fNewTime);
1063 nPgRelNum++;
1065 else
1067 // delete this page
1068 pDoc->DeletePage( (nPgRelNum << 1) + 2 ); // delete not page
1069 pDoc->DeletePage( (nPgRelNum << 1) + 1 ); // delete page
1072 nPgAbsNum++;
1075 else
1077 OSL_FAIL("sd::AssistentDlgImpl::GetDocument(), no template?");
1080 SfxObjectShellLock xRet = xDocShell;
1081 xDocShell = NULL;
1083 return xRet;
1086 void AssistentDlgImpl::LeavePage()
1088 int nPage = maAssistentFunc.GetCurrentPage();
1090 if( nPage == 4 && mbUserDataDirty )
1091 maPrevTimer.Start();
1094 void AssistentDlgImpl::ChangePage()
1096 maNextPageButton.Enable(!maAssistentFunc.IsLastPage());
1097 maLastPageButton.Enable(!maAssistentFunc.IsFirstPage());
1099 sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage();
1101 if( mpWindow )
1103 mpWindow->SetHelpId( PageHelpIds[nPage-1]);
1106 UpdatePage();
1108 if( maNextPageButton.IsEnabled() )
1110 maNextPageButton.ForceFocusEventBroadcast();
1112 else
1113 maFinishButton.GrabFocus();
1116 void AssistentDlgImpl::UpdatePage()
1118 sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage();
1120 switch(nPage)
1122 case 1:
1124 // Show elements on first page depending of start type
1125 SetStartType( GetStartType() );
1126 mpPage1TemplateRB->Enable(sal_True /*mbTemplatesReady*/);
1127 break;
1130 case 2:
1132 mpPage2RegionLB->Enable(mbTemplatesReady);
1133 mpPage2LayoutLB->Enable(mbTemplatesReady);
1135 if( GetStartType() != ST_EMPTY )
1137 mpPage2Medium5RB->Enable( sal_True );
1139 else
1141 mpPage2Medium5RB->Enable( sal_False );
1142 if(mpPage2Medium5RB->IsChecked())
1143 mpPage2Medium1RB->Check();
1146 break;
1148 case 5:
1150 if(mbDocPreview || maPageListFile != maDocFile)
1151 mpPage5PageListCT->Clear();
1153 maUpdatePageListTimer.Start();
1154 break;
1157 case 3:
1159 if(GetStartType() != ST_TEMPLATE)
1160 maNextPageButton.Enable(false);
1162 sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
1163 mpPage3PresTimeFT->Enable(bKiosk);
1164 mpPage3BreakFT->Enable(bKiosk);
1165 mpPage3PresTimeTMF->Enable(bKiosk);
1166 mpPage3BreakTMF->Enable(bKiosk);
1167 mpPage3LogoCB->Enable(bKiosk);
1168 break;
1173 // ********************************************************************
1174 // UI-Handler
1175 // ********************************************************************
1177 IMPL_LINK( AssistentDlgImpl, SelectRegionHdl, ListBox *, pLB )
1179 if( pLB == mpPage1RegionLB )
1181 SelectTemplateRegion( pLB->GetSelectEntry() );
1182 SetStartType( ST_TEMPLATE );
1183 mpPage2Medium5RB->Check();
1185 else
1187 SelectLayoutRegion( pLB->GetSelectEntry() );
1190 return 0;
1193 IMPL_LINK_NOARG(AssistentDlgImpl, SelectEffectHdl)
1195 maEffectPrevTimer.Start();
1196 return 0;
1199 IMPL_LINK( AssistentDlgImpl, OpenButtonHdl, Button*, pButton )
1201 // Clear the selection and forward the call.
1202 mpPage1OpenLB->SetNoSelection();
1203 return mpPage1OpenLB->GetDoubleClickHdl().Call(pButton);
1206 IMPL_LINK_NOARG(AssistentDlgImpl, EffectPreviewHdl)
1208 if(mbPreview && xDocShell.Is() )
1210 SfxObjectShell* pShell = xDocShell;
1211 DrawDocShell* pDocShell = dynamic_cast< DrawDocShell * >(pShell);
1212 if( pDocShell )
1214 SdDrawDocument* pDoc = pDocShell->GetDoc();
1215 if( pDoc )
1217 SdPage* pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD );
1218 if( pPage )
1219 mpPage3EffectLB->applySelected(pPage);
1222 maPreview.startPreview();
1224 return 0;
1227 IMPL_LINK_NOARG(AssistentDlgImpl, PreviewFlagHdl)
1230 if( maPreviewFlag.IsChecked() != mbPreview )
1232 mbPreview = maPreviewFlag.IsChecked();
1233 UpdatePreview(sal_True);
1235 return 0;
1238 IMPL_LINK_NOARG(AssistentDlgImpl, SelectTemplateHdl)
1240 SetStartType( ST_TEMPLATE );
1241 mpPage2Medium5RB->Check();
1242 mpPage2LayoutLB->SelectEntryPos(0);
1243 maPrevTimer.Start();
1244 return 0;
1247 IMPL_LINK_NOARG(AssistentDlgImpl, SelectLayoutHdl)
1249 maPrevTimer.Start();
1250 return 0;
1253 IMPL_LINK_NOARG(AssistentDlgImpl, SelectFileHdl)
1255 SetStartType( ST_OPEN );
1256 maPrevTimer.Start();
1257 return 0;
1260 IMPL_LINK_NOARG(AssistentDlgImpl, PageSelectHdl)
1262 sal_uInt16 nPage = mpPage5PageListCT->GetSelectedPage();
1263 if( mnShowPage != nPage )
1265 mnShowPage = nPage;
1266 UpdatePreview(sal_False);
1269 return 0;
1272 IMPL_LINK_NOARG(AssistentDlgImpl, UpdatePageListHdl)
1274 UpdatePageList();
1275 return 0;
1278 IMPL_LINK_NOARG(AssistentDlgImpl, UpdatePreviewHdl)
1280 UpdatePreview( sal_True );
1281 return 0;
1284 IMPL_LINK( AssistentDlgImpl, StartTypeHdl, RadioButton *, pButton )
1286 StartType eType = pButton == mpPage1EmptyRB?ST_EMPTY:pButton == mpPage1TemplateRB?ST_TEMPLATE:ST_OPEN;
1288 if(eType == ST_TEMPLATE)
1289 ProvideTemplates();
1290 else if(eType == ST_OPEN)
1291 ScanDocmenu();
1293 SetStartType( eType );
1295 if(eType == ST_TEMPLATE)
1297 mpPage1TemplateLB->SelectEntryPos(0);
1298 mpPage2Medium5RB->Check();
1300 else if(eType == ST_OPEN)
1301 mpPage1OpenLB->SelectEntryPos(0);
1303 maPrevTimer.Start();
1304 return 0;
1308 IMPL_LINK_NOARG(AssistentDlgImpl, NextPageHdl)
1310 // When changing from the first to the second page make sure that the
1311 // templates are present.
1312 if (maAssistentFunc.GetCurrentPage() == 1)
1313 ProvideTemplates();
1315 // Change to the next page.
1316 LeavePage();
1317 maAssistentFunc.NextPage();
1318 ChangePage();
1319 return 0;
1322 IMPL_LINK_NOARG(AssistentDlgImpl, LastPageHdl)
1324 LeavePage();
1325 maAssistentFunc.PreviousPage();
1326 ChangePage();
1327 return 0;
1330 IMPL_LINK_NOARG(AssistentDlgImpl, PresTypeHdl)
1332 if(maDocFile.Len() == 0)
1334 maNextPageButton.Enable(false);
1337 sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
1338 mpPage3PresTimeFT->Enable(bKiosk);
1339 mpPage3BreakFT->Enable(bKiosk);
1340 mpPage3PresTimeTMF->Enable(bKiosk);
1341 mpPage3BreakTMF->Enable(bKiosk);
1342 mpPage3LogoCB->Enable(bKiosk);
1343 return 0;
1346 IMPL_LINK_NOARG(AssistentDlgImpl, UpdateUserDataHdl)
1348 mbUserDataDirty = sal_True;
1349 String aTopic = mpPage4AskTopicEDT->GetText();
1350 String aName = mpPage4AskNameEDT->GetText();
1351 String aInfo = mpPage4AskInfoEDT->GetText();
1353 if(aTopic.Len() == 0 && aName.Len() == 0 && aInfo.Len() == 0)
1354 maDocFile.Erase();
1356 return 0;
1359 // ********************************************************************
1360 // ********************************************************************
1362 void AssistentDlgImpl::SelectTemplateRegion( const String& rRegion )
1364 mpPage1TemplateLB->Clear();
1365 std::vector<TemplateDir*>::iterator I;
1366 for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
1368 TemplateDir * pDir = *I;
1369 mpTemplateRegion = *I;
1370 if (pDir->msRegion.Equals( rRegion ) )
1372 std::vector<TemplateEntry*>::iterator J;
1373 for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J)
1374 mpPage1TemplateLB->InsertEntry ((*J)->msTitle);
1375 mpPage1TemplateLB->Update();
1376 if(GetStartType() == ST_TEMPLATE)
1378 mpPage1TemplateLB->SelectEntryPos( 0 );
1379 SelectTemplateHdl(NULL);
1381 break;
1386 void AssistentDlgImpl::SelectLayoutRegion( const String& rRegion )
1388 mpPage2LayoutLB->Clear();
1389 mpPage2LayoutLB->InsertEntry(String(SdResId(STR_WIZARD_ORIGINAL)));
1390 std::vector<TemplateDir*>::iterator I;
1391 for (I=maPresentList.begin(); I!=maPresentList.end(); ++I)
1393 TemplateDir * pDir = *I;
1394 mpLayoutRegion = *I;
1396 if (pDir->msRegion.Equals (rRegion))
1398 std::vector<TemplateEntry*>::iterator J;
1399 for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J)
1400 mpPage2LayoutLB->InsertEntry ((*J)->msTitle);
1401 mpPage2LayoutLB->Update();
1402 break;
1407 void AssistentDlgImpl::UpdateUserData()
1409 String aTopic = mpPage4AskTopicEDT->GetText();
1410 String aName = mpPage4AskNameEDT->GetText();
1411 String aInfo = mpPage4AskInfoEDT->GetText();
1413 SfxObjectShell* pShell = xDocShell;
1414 DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1415 SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1416 SdPage* pPage = pDoc?pDoc->GetSdPage(0, PK_STANDARD):NULL;
1418 if(pPage && ( aTopic.Len() != 0 || aName.Len() != 0 || aInfo.Len() != 0 ) )
1420 if( pPage->GetAutoLayout() == AUTOLAYOUT_NONE )
1421 pPage->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True);
1423 SdrTextObj* pObj;
1425 if( aTopic.Len() )
1427 pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TITLE ) );
1428 if( pObj )
1430 pPage->SetObjText( pObj, NULL, PRESOBJ_TITLE, aTopic );
1431 pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ), sal_True );
1432 pObj->SetEmptyPresObj(sal_False);
1437 if ( aName.Len() || aInfo.Len() )
1439 String aStrTmp( aName );
1440 if( aName.Len() )
1441 aStrTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n\n" ) );
1442 aStrTmp.Append( aInfo );
1444 pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_OUTLINE ) );
1445 if( pObj )
1447 pPage->SetObjText( pObj, NULL, PRESOBJ_OUTLINE, aStrTmp );
1448 pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ), sal_True );
1449 pObj->SetEmptyPresObj(sal_False);
1451 else
1453 pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TEXT ) );
1454 if( pObj )
1456 pPage->SetObjText( pObj, NULL, PRESOBJ_TEXT, aStrTmp );
1457 pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT ), sal_True );
1458 pObj->SetEmptyPresObj(sal_False);
1464 mbUserDataDirty = sal_False;
1467 void AssistentDlgImpl::UpdatePageList()
1469 if(mbDocPreview || !mbPreview)
1470 UpdatePreview(sal_False);
1471 else if(maPageListFile == maDocFile)
1472 return;
1474 maPageListFile = maDocFile;
1476 SfxObjectShell* pShell = xDocShell;
1477 DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1478 SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1480 mpPage5PageListCT->Clear();
1482 if(pDoc)
1483 mpPage5PageListCT->Fill(pDoc);
1486 void AssistentDlgImpl::UpdatePreview( sal_Bool bDocPreview )
1488 // Guard against multiple concurrent execution to this method caused either
1489 // by calls from different threads or recursion.
1490 ::osl::MutexGuard aGuard (maMutex);
1491 if (mbPreviewUpdating)
1492 return;
1493 mbPreviewUpdating = sal_True;
1495 if(!mbPreview && bDocPreview)
1497 maPreview.Invalidate();
1498 maPreview.SetObjectShell(0);
1499 mbPreviewUpdating = sal_False;
1500 return;
1503 String aDocFile = GetDocFileName();
1504 String aLayoutFile = GetLayoutFileName();
1505 String aEmptyStr;
1507 SfxApplication *pSfxApp = SFX_APP();
1508 sal_uLong lErr;
1509 sal_Bool bChangeMaster = aLayoutFile.Len() != 0;
1511 if( aDocFile.Len() == 0 )
1513 if( !xDocShell.Is() || maDocFile.Len() != 0 ||
1514 (maDocFile.Len() == 0 && maLayoutFile.Len() != 0 && aLayoutFile.Len() == 0 ))
1516 CloseDocShell();
1518 DrawDocShell* pNewDocSh;
1519 xDocShell = pNewDocSh = new DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_False);
1520 pNewDocSh->DoInitNew(NULL);
1521 SdDrawDocument* pDoc = pNewDocSh->GetDoc();
1522 pDoc->CreateFirstPages();
1523 pDoc->StopWorkStartupDelay();
1524 mbDocPreview = sal_False;
1526 maDocFile = aDocFile;
1527 mbUserDataDirty = sal_True;
1529 else
1530 bChangeMaster = (aLayoutFile.Len() != 0) && (maLayoutFile != aLayoutFile);
1532 else if( aDocFile == maDocFile && ( mbDocPreview == bDocPreview || bDocPreview ) )
1534 if( aLayoutFile != maLayoutFile )
1536 SfxObjectShell* pShell = xDocShell;
1537 DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1538 ::svl::IUndoManager* pUndoMgr = pDocShell?pDocShell->GetUndoManager():NULL;
1539 if(pUndoMgr)
1540 pUndoMgr->Undo();
1541 mbUserDataDirty = sal_True;
1543 else
1544 bChangeMaster = sal_False;
1546 else
1548 CloseDocShell();
1550 ::Window *pParent = Application::GetDefDialogParent();
1551 Application::SetDefDialogParent( mpWindow );
1553 SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
1555 if(IsOwnFormat(aDocFile))
1557 SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
1558 pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
1559 if(bDocPreview)
1560 pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
1561 RestorePassword( pSet, aDocFile );
1562 if( (lErr = pSfxApp->LoadTemplate( xDocShell, aDocFile, sal_True, pSet )) != 0 )
1563 ErrorHandler::HandleError(lErr);
1564 else
1565 SavePassword( xDocShell, aDocFile );
1567 else
1569 SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
1570 aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aDocFile ));
1571 aReq.AppendItem( SfxStringItem( SID_REFERER, aEmptyStr ) );
1572 aReq.AppendItem( SfxStringItem( SID_TARGETNAME, OUString("_default") ) );
1573 aReq.AppendItem( SfxBoolItem( SID_HIDDEN, sal_True ) );
1574 aReq.AppendItem( SfxBoolItem( SID_PREVIEW, bDocPreview ) );
1576 const SfxViewFrameItem* pRet = PTR_CAST( SfxViewFrameItem, SFX_APP()->ExecuteSlot( aReq ) );
1578 if ( pRet && pRet->GetFrame() && pRet->GetFrame()->GetObjectShell() )
1579 xDocShell = pRet->GetFrame()->GetObjectShell();
1583 Application::SetDefDialogParent( pParent );
1585 mnShowPage = 0;
1586 mbDocPreview = bDocPreview;
1587 maDocFile = aDocFile;
1588 mbUserDataDirty = sal_True;
1591 if(bChangeMaster && (aLayoutFile != maDocFile))
1593 // load layout template
1594 SfxObjectShellLock xLayoutDocShell;
1595 SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow);
1597 ::Window *pParent = Application::GetDefDialogParent();
1598 Application::SetDefDialogParent( mpWindow );
1600 if(IsOwnFormat(aLayoutFile))
1602 SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
1603 pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
1604 pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
1606 RestorePassword( pSet, aLayoutFile );
1607 if( (lErr = pSfxApp->LoadTemplate( xLayoutDocShell, aLayoutFile, sal_True, pSet )) != 0 )
1608 ErrorHandler::HandleError(lErr);
1609 SavePassword( xLayoutDocShell, aLayoutFile );
1612 Application::SetDefDialogParent( pParent );
1614 // determine the implementation
1615 SfxObjectShell* pShell = xDocShell;
1616 DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell);
1617 SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL;
1619 pShell = xLayoutDocShell;
1620 pDocShell = PTR_CAST(DrawDocShell,pShell);
1621 SdDrawDocument* pLayoutDoc = pDocShell?pDocShell->GetDoc():NULL;
1623 if( pDoc && pLayoutDoc )
1625 pDoc->SetMasterPage(0, aEmptyStr, pLayoutDoc, sal_True, sal_False );
1627 else
1629 OSL_FAIL("sd::AssistentDlgImpl::UpdatePreview(), no document for preview?");
1632 mbUserDataDirty = sal_True;
1634 maLayoutFile = aLayoutFile;
1636 if(mbUserDataDirty)
1637 UpdateUserData();
1639 if ( !xDocShell.Is() || !mbPreview )
1640 maPreview.SetObjectShell( 0 );
1641 else
1643 maPreview.SetObjectShell( xDocShell, mnShowPage );
1646 mbPreviewUpdating = sal_False;
1649 void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPath )
1651 if(xDoc.Is())
1653 SfxMedium * pMedium = xDoc->GetMedium();
1654 if(pMedium && pMedium->IsStorage())
1656 SfxItemSet * pSet = pMedium->GetItemSet();
1657 SFX_ITEMSET_ARG( pSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False);
1658 uno::Sequence < beans::NamedValue > aEncryptionData;
1659 if (pEncryptionDataItem)
1660 pEncryptionDataItem->GetValue() >>= aEncryptionData;
1661 else
1662 return;
1663 if( aEncryptionData.getLength() )
1666 PasswordEntry* pEntry = NULL;
1667 for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
1669 if ( maPasswordList[ i ].maPath == rPath )
1671 pEntry = &maPasswordList[ i ];
1672 break;
1676 if(pEntry == NULL)
1678 pEntry = new PasswordEntry();
1679 pEntry->maPath = rPath;
1680 maPasswordList.push_back( pEntry );
1683 if(pEntry)
1684 pEntry->aEncryptionData = aEncryptionData;
1690 void AssistentDlgImpl::RestorePassword( SfxItemSet* pSet, const String& rPath )
1692 uno::Sequence < beans::NamedValue > aEncryptionData( GetPassword( rPath ) );
1694 if(aEncryptionData.getLength())
1695 pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) );
1698 uno::Sequence < beans::NamedValue > AssistentDlgImpl::GetPassword( const String rPath )
1700 for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i )
1702 PasswordEntry* pEntry = &maPasswordList[ i ];
1703 if(pEntry->maPath == rPath)
1704 return pEntry->aEncryptionData;
1706 return uno::Sequence < beans::NamedValue > ();;
1709 void AssistentDlgImpl::DeletePasswords()
1711 maPasswordList.clear();
1714 sal_Bool AssistentDlgImpl::IsOwnFormat( const String& rPath )
1716 INetURLObject aURL( rPath );
1717 String aExt( aURL.GetFileExtension() );
1719 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
1721 return !aExt.EqualsIgnoreCaseAscii( "ppt" );
1727 String AssistentDlgImpl::GetUiTextForCommand (const OUString& sCommandURL)
1729 String sLabel;
1730 Reference<container::XNameAccess> xUICommandLabels;
1736 if (sCommandURL.isEmpty())
1737 break;
1739 // Retrieve popup menu labels
1740 Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
1741 if ( ! xContext.is())
1742 break;
1744 Reference<container::XNameAccess> const xNameAccess(
1745 frame::UICommandDescription::create(xContext) );
1746 Any a = xNameAccess->getByName(
1747 "com.sun.star.presentation.PresentationDocument");
1748 a >>= xUICommandLabels;
1749 if ( ! xUICommandLabels.is())
1750 break;
1752 OUString sString;
1753 Sequence<beans::PropertyValue> aProperties;
1754 Any aAny (xUICommandLabels->getByName(sCommandURL));
1755 if (aAny >>= aProperties)
1757 sal_Int32 nCount (aProperties.getLength());
1758 for (sal_Int32 i=0; i<nCount; i++)
1760 OUString sPropertyName (aProperties[i].Name);
1761 if ( sPropertyName == "Label" )
1763 aProperties[i].Value >>= sString;
1764 break;
1768 sLabel = sString;
1770 while(false);
1772 catch (com::sun::star::uno::Exception& )
1776 return sLabel;
1782 Image AssistentDlgImpl::GetUiIconForCommand (const OUString& sCommandURL)
1784 Image aIcon;
1785 Reference<container::XNameAccess> xUICommandLabels;
1791 if (sCommandURL.isEmpty())
1792 break;
1794 // Retrieve popup menu labels
1795 Reference<uno::XComponentContext> xContext ( ::comphelper::getProcessComponentContext() );
1796 if ( ! xContext.is())
1797 break;
1799 Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier (
1800 ui::ModuleUIConfigurationManagerSupplier::create(xContext));
1802 Reference<com::sun::star::ui::XUIConfigurationManager> xManager (
1803 xSupplier->getUIConfigurationManager(
1804 "com.sun.star.presentation.PresentationDocument"));
1805 if ( ! xManager.is())
1806 break;
1808 Reference<com::sun::star::ui::XImageManager> xImageManager (
1809 xManager->getImageManager(),
1810 UNO_QUERY_THROW);
1812 Sequence<OUString> aCommandList(1);
1813 aCommandList[0] = sCommandURL;
1814 Sequence<Reference<graphic::XGraphic> > xIconList (
1815 xImageManager->getImages(0,aCommandList));
1816 if ( ! xIconList.hasElements())
1817 break;
1819 aIcon = Graphic(xIconList[0]).GetBitmapEx();
1821 while(false);
1823 catch (com::sun::star::uno::Exception& )
1827 return aIcon;
1831 //////////////////////////////////////////////
1833 AssistentDlg::AssistentDlg(Window* pParent, sal_Bool bAutoPilot) :
1834 ModalDialog(pParent,SdResId(DLG_ASS))
1836 Link aFinishLink = LINK(this,AssistentDlg, FinishHdl);
1837 mpImpl = new AssistentDlgImpl( this, aFinishLink, bAutoPilot );
1839 // button assigmnent
1840 mpImpl->maFinishButton.SetClickHdl(LINK(this,AssistentDlg,FinishHdl));
1842 FreeResource();
1845 IMPL_LINK_NOARG(AssistentDlg, FinishHdl)
1847 if( GetStartType() == ST_OPEN )
1849 //if we do not have a file here asked for one before ending the dialog
1850 String aFileToOpen = GetDocPath();
1851 if(aFileToOpen.Len() == 0)
1853 sfx2::FileDialogHelper aFileDlg(
1854 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0,
1855 OUString("simpress") );
1857 if ( aFileDlg.Execute() == ERRCODE_NONE )
1858 aFileToOpen = aFileDlg.GetPath();
1859 if( aFileToOpen.Len() == 0)
1860 return 1;
1861 else
1863 //add the selected file to the recent-file-listbox and select the new entry
1864 //this is necessary for 'GetDocPath()' returning the selected file after end of dialog
1866 INetURLObject aURL;
1867 aURL.SetSmartURL(aFileToOpen);
1868 mpImpl->maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE )));
1869 sal_uInt16 nNewPos = mpImpl->mpPage1OpenLB->InsertEntry(aURL.getName());
1870 mpImpl->mpPage1OpenLB->SelectEntryPos(nNewPos);
1875 // end
1876 mpImpl->EndDialog(RET_OK);
1877 EndDialog(RET_OK);
1878 return 0;
1881 AssistentDlg::~AssistentDlg()
1883 delete mpImpl;
1887 SfxObjectShellLock AssistentDlg::GetDocument()
1889 return mpImpl->GetDocument();
1892 OutputType AssistentDlg::GetOutputMedium() const
1894 if(mpImpl->mpPage2Medium1RB->IsChecked())
1895 return OUTPUT_PRESENTATION;
1896 else if(mpImpl->mpPage2Medium2RB->IsChecked())
1897 return OUTPUT_SLIDE;
1898 else if(mpImpl->mpPage2Medium3RB->IsChecked())
1899 return OUTPUT_OVERHEAD;
1900 else if(mpImpl->mpPage2Medium4RB->IsChecked())
1901 return OUTPUT_PAGE;
1902 else if(mpImpl->mpPage2Medium6RB->IsChecked())
1903 return OUTPUT_WIDESCREEN;
1904 else
1905 return OUTPUT_ORIGINAL;
1908 sal_Bool AssistentDlg::IsSummary() const
1910 return mpImpl->mpPage5SummaryCB->IsChecked();
1913 StartType AssistentDlg::GetStartType() const
1915 return mpImpl->GetStartType();
1918 String AssistentDlg::GetDocPath() const
1920 return mpImpl->GetDocFileName();
1923 sal_Bool AssistentDlg::GetStartWithFlag() const
1925 return !mpImpl->maStartWithFlag.IsChecked();
1928 sal_Bool AssistentDlg::IsDocEmpty() const
1930 return mpImpl->GetDocFileName().Len() == 0 &&
1931 mpImpl->GetLayoutFileName().Len() == 0;
1934 uno::Sequence< beans::NamedValue > AssistentDlg::GetPassword()
1936 return mpImpl->GetPassword( mpImpl->maDocFile );
1942 //===== NextButton ============================================================
1944 NextButton::NextButton (::Window* pParent, const ResId& rResId)
1945 : maNextButton1(pParent, rResId),
1946 maNextButton2(pParent, rResId),
1947 mbIsFirstButtonActive(true)
1949 // Hide the unused button.
1950 maNextButton2.Hide();
1956 void NextButton::ForceFocusEventBroadcast (void)
1958 // Hide the currently visible button and show and focus the other one.
1959 if (mbIsFirstButtonActive)
1961 mbIsFirstButtonActive = false;
1962 maNextButton2.Show();
1963 maNextButton2.GrabFocus();
1964 maNextButton1.Hide();
1966 else
1968 mbIsFirstButtonActive = true;
1969 maNextButton1.Show();
1970 maNextButton1.GrabFocus();
1971 maNextButton2.Hide();
1978 void NextButton::SetClickHdl (const Link& rLink)
1980 // Forward the setting of the click handler to the two buttons
1981 // regardless of which one is currently visible.
1982 maNextButton1.SetClickHdl(rLink);
1983 maNextButton2.SetClickHdl(rLink);
1989 bool NextButton::IsEnabled (void)
1991 // Because the buttons are both either enabled or disabled, it is
1992 // sufficient to ask one to determine the state.
1993 return maNextButton1.IsEnabled();
1999 void NextButton::Enable (bool bEnable)
2001 // Enable or disable both buttons but do not change visibility or focus.
2002 maNextButton1.Enable(bEnable);
2003 maNextButton2.Enable(bEnable);
2006 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */