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