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