1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26
27 #ifdef SD_DLLIMPLEMENTATION
28 #undef SD_DLLIMPLEMENTATION
29 #endif
30 #include <com/sun/star/beans/PropertyValue.hpp>
31 #include <unotools/ucbstreamhelper.hxx>
32 #include <vcl/lstbox.hxx>
33 #include <svtools/FilterConfigItem.hxx>
34 #ifndef _SV_BUTTON_HXX
35 #include <vcl/button.hxx>
36 #endif
37 #include <vcl/fixed.hxx>
38 #include <vcl/combobox.hxx>
39 #include <svtools/svmedit.hxx>
40 #include <svl/intitem.hxx>
41 #include <svl/aeitem.hxx>
42 #include <svl/itemset.hxx>
43 #include <svl/stritem.hxx>
44 #include <vcl/msgbox.hxx>
45 #include <svtools/valueset.hxx>
46 #include <vcl/graph.hxx>
47 #include <svl/eitem.hxx>
48 #include <svtools/colrdlg.hxx>
49 #include <editeng/colritem.hxx>
50 #include <tools/urlobj.hxx>
51 #include <tools/list.hxx>
52 #include <sdiocmpt.hxx>
53 #include <sfx2/docfile.hxx>
54 #include <sfx2/app.hxx>
55 #include <pres.hxx>
56 #include <unotools/useroptions.hxx>
57 #include <unotools/pathoptions.hxx>
58
59 #include "sdresid.hxx"
60 #include "sdattr.hxx"
61 #include "pubdlg.hrc"
62 #include "htmlattr.hxx"
63 #include "htmlex.hxx"
64 #include "helpids.h"
65 #include "buttonset.hxx"
66
67 using namespace std;
68 using namespace rtl;
69 using namespace com::sun::star::uno;
70 using namespace com::sun::star::beans;
71
72 extern void InterpolateFixedBitmap( FixedBitmap * pBitmap );
73
74 // Kennung fuer die Config Datei mit den Html Einstellungen
75 const sal_uInt16 nMagic = (sal_uInt16)0x1977;
76
77 // Key fuer die soffice.ini
78 #define KEY_QUALITY "JPG-EXPORT-QUALITY"
79
80 // Die Help Ids der einzelnen Seiten
81 const char* aPageHelpIds[NOOFPAGES] =
82 {
83 HID_SD_HTMLEXPORT_PAGE1,
84 HID_SD_HTMLEXPORT_PAGE2,
85 HID_SD_HTMLEXPORT_PAGE3,
86 HID_SD_HTMLEXPORT_PAGE4,
87 HID_SD_HTMLEXPORT_PAGE5,
88 HID_SD_HTMLEXPORT_PAGE6
89 };
90
91 // *********************************************************************
92 // Diese Klasse enthaelt alle Einstellungen des Html-Export Autopiloten
93 // *********************************************************************
94 class SdPublishingDesign
95 {
96 public:
97 String m_aDesignName;
98
99 HtmlPublishMode m_eMode;
100
101 // special WebCast options
102 PublishingScript m_eScript;
103 String m_aCGI;
104 String m_aURL;
105
106 // special Kiosk options
107 sal_Bool m_bAutoSlide;
108 sal_uInt32 m_nSlideDuration;
109 sal_Bool m_bEndless;
110
111 // special HTML options
112 sal_Bool m_bContentPage;
113 sal_Bool m_bNotes;
114
115 // misc options
116 sal_uInt16 m_nResolution;
117 String m_aCompression;
118 PublishingFormat m_eFormat;
119 sal_Bool m_bSlideSound;
120 sal_Bool m_bHiddenSlides;
121
122 // titel page information
123 String m_aAuthor;
124 String m_aEMail;
125 String m_aWWW;
126 String m_aMisc;
127 sal_Bool m_bDownload;
128 sal_Bool m_bCreated; // not used
129
130 // buttons and colorscheme
131 sal_Int16 m_nButtonThema;
132 sal_Bool m_bUserAttr;
133 Color m_aBackColor;
134 Color m_aTextColor;
135 Color m_aLinkColor;
136 Color m_aVLinkColor;
137 Color m_aALinkColor;
138 sal_Bool m_bUseAttribs;
139 sal_Bool m_bUseColor;
140
141 SdPublishingDesign();
142
143 int operator ==(const SdPublishingDesign & rDesign) const;
144 friend SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign);
145 friend SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign);
146 };
147
148 // =====================================================================
149 // Default Einstellungen erzeugen
150 // =====================================================================
SdPublishingDesign()151 SdPublishingDesign::SdPublishingDesign()
152 {
153 m_eMode = PUBLISH_HTML;
154 m_bContentPage = sal_True;
155 m_bNotes = sal_True;
156
157 m_eFormat = FORMAT_PNG;
158
159 String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/JPG" ) );
160 FilterConfigItem aFilterConfigItem( aFilterConfigPath );
161 sal_Int32 nCompression = aFilterConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), 75 );
162 m_aCompression = UniString::CreateFromInt32( nCompression );
163 m_aCompression.Append( sal_Unicode('%') );
164
165 SvtUserOptions aUserOptions;
166
167 m_nResolution = PUB_LOWRES_WIDTH;
168 m_aAuthor = aUserOptions.GetFirstName();
169 if( m_aAuthor.Len() && aUserOptions.GetLastName().getLength() )
170 m_aAuthor += sal_Unicode(' ');
171 m_aAuthor += (String)aUserOptions.GetLastName();
172 m_aEMail = aUserOptions.GetEmail();
173 m_bDownload = sal_False;
174 //-/ m_bCreated = sal_True;
175 m_nButtonThema = -1;
176
177 m_bUserAttr = sal_False;
178 m_bUseAttribs = sal_True;
179 m_bUseColor = sal_True;
180
181 m_aBackColor = COL_WHITE;
182 m_aTextColor = COL_BLACK;
183 m_aLinkColor = COL_BLUE;
184 m_aVLinkColor = COL_LIGHTBLUE;
185 m_aALinkColor = COL_GRAY;
186
187 m_eScript = SCRIPT_ASP;
188
189 m_bAutoSlide = sal_True;
190 m_nSlideDuration = 15;
191 m_bEndless = sal_True;
192
193 m_bSlideSound = sal_True;
194 m_bHiddenSlides = sal_False;
195 }
196
197 // =====================================================================
198 // Vergleicht die Member ohne den Namen zu beachten
199 // =====================================================================
operator ==(const SdPublishingDesign & rDesign) const200 int SdPublishingDesign::operator ==(const SdPublishingDesign & rDesign) const
201 {
202 return
203 (
204 m_eMode == rDesign.m_eMode &&
205 m_nResolution == rDesign.m_nResolution &&
206 m_aCompression == rDesign.m_aCompression &&
207 m_eFormat == rDesign.m_eFormat &&
208 m_bHiddenSlides == rDesign.m_bHiddenSlides &&
209 ( // compare html options
210 (m_eMode != PUBLISH_HTML && m_eMode != PUBLISH_FRAMES) ||
211 (
212 m_bContentPage == rDesign.m_bContentPage &&
213 m_bNotes == rDesign.m_bNotes &&
214 m_aAuthor == rDesign.m_aAuthor &&
215 m_aEMail == rDesign.m_aEMail &&
216 m_aWWW == rDesign.m_aWWW &&
217 m_aMisc == rDesign.m_aMisc &&
218 m_bDownload == rDesign.m_bDownload &&
219 //-/ m_bCreated == rDesign.m_bCreated &&
220 m_nButtonThema == rDesign.m_nButtonThema &&
221 m_bUserAttr == rDesign.m_bUserAttr &&
222 m_aBackColor == rDesign.m_aBackColor &&
223 m_aTextColor == rDesign.m_aTextColor &&
224 m_aLinkColor == rDesign.m_aLinkColor &&
225 m_aVLinkColor == rDesign.m_aVLinkColor &&
226 m_aALinkColor == rDesign.m_aALinkColor &&
227 m_bUseAttribs == rDesign.m_bUseAttribs &&
228 m_bSlideSound == rDesign.m_bSlideSound &&
229 m_bUseColor == rDesign.m_bUseColor
230 )
231 ) &&
232 ( // compare kiosk options
233 (m_eMode != PUBLISH_KIOSK) ||
234 (
235 m_bAutoSlide == rDesign.m_bAutoSlide &&
236 m_bSlideSound == rDesign.m_bSlideSound &&
237 (
238 !m_bAutoSlide ||
239 (
240 m_nSlideDuration == rDesign.m_nSlideDuration &&
241 m_bEndless == rDesign.m_bEndless
242 )
243 )
244 )
245 ) &&
246 ( // compare WebCast options
247 (m_eMode != PUBLISH_WEBCAST) ||
248 (
249 m_eScript == rDesign.m_eScript &&
250 (
251 m_eScript != SCRIPT_PERL ||
252 (
253 m_aURL == rDesign.m_aURL &&
254 m_aCGI == rDesign.m_aCGI
255 )
256 )
257 )
258 )
259 );
260 }
261
262 // =====================================================================
263 // Dieses Design aus Stream laden
264 // =====================================================================
operator >>(SvStream & rIn,SdPublishingDesign & rDesign)265 SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign)
266 {
267 SdIOCompat aIO(rIn, STREAM_READ);
268
269 sal_uInt16 nTemp16;
270
271 rIn.ReadByteString( rDesign.m_aDesignName, RTL_TEXTENCODING_UTF8 );
272 rIn >> nTemp16;
273 rDesign.m_eMode = (HtmlPublishMode)nTemp16;
274 rIn >> rDesign.m_bContentPage;
275 rIn >> rDesign.m_bNotes;
276 rIn >> rDesign.m_nResolution;
277 rIn.ReadByteString( rDesign.m_aCompression, RTL_TEXTENCODING_UTF8 );
278 rIn >> nTemp16;
279 rDesign.m_eFormat = (PublishingFormat)nTemp16;
280 rIn.ReadByteString( rDesign.m_aAuthor, RTL_TEXTENCODING_UTF8 );
281 rIn.ReadByteString( rDesign.m_aEMail, RTL_TEXTENCODING_UTF8 );
282 rIn.ReadByteString( rDesign.m_aWWW, RTL_TEXTENCODING_UTF8 );
283 rIn.ReadByteString( rDesign.m_aMisc, RTL_TEXTENCODING_UTF8 );
284 rIn >> rDesign.m_bDownload;
285 rIn >> rDesign.m_bCreated; // not used
286 rIn >> rDesign.m_nButtonThema;
287 rIn >> rDesign.m_bUserAttr;
288 rIn >> rDesign.m_aBackColor;
289 rIn >> rDesign.m_aTextColor;
290 rIn >> rDesign.m_aLinkColor;
291 rIn >> rDesign.m_aVLinkColor;
292 rIn >> rDesign.m_aALinkColor;
293 rIn >> rDesign.m_bUseAttribs;
294 rIn >> rDesign.m_bUseColor;
295
296 rIn >> nTemp16;
297 rDesign.m_eScript = (PublishingScript)nTemp16;
298 rIn.ReadByteString( rDesign.m_aURL, RTL_TEXTENCODING_UTF8 );
299 rIn.ReadByteString( rDesign.m_aCGI, RTL_TEXTENCODING_UTF8 );
300
301 rIn >> rDesign.m_bAutoSlide;
302 rIn >> rDesign.m_nSlideDuration;
303 rIn >> rDesign.m_bEndless;
304 rIn >> rDesign.m_bSlideSound;
305 rIn >> rDesign.m_bHiddenSlides;
306
307 return rIn;
308 }
309
310 // =====================================================================
311 // Dieses Design in Stream speichern
312 // =====================================================================
operator <<(SvStream & rOut,const SdPublishingDesign & rDesign)313 SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign)
314 {
315 // Letzter Parameter ist die aktuelle Versionsnummer des Codes
316 SdIOCompat aIO(rOut, STREAM_WRITE, 0);
317
318 // Name
319 rOut.WriteByteString( rDesign.m_aDesignName, RTL_TEXTENCODING_UTF8 );
320
321 rOut << (sal_uInt16)rDesign.m_eMode;
322 rOut << rDesign.m_bContentPage;
323 rOut << rDesign.m_bNotes;
324 rOut << rDesign.m_nResolution;
325 rOut.WriteByteString( rDesign.m_aCompression, RTL_TEXTENCODING_UTF8 );
326 rOut << (sal_uInt16)rDesign.m_eFormat;
327 rOut.WriteByteString( rDesign.m_aAuthor, RTL_TEXTENCODING_UTF8 );
328 rOut.WriteByteString( rDesign.m_aEMail, RTL_TEXTENCODING_UTF8 );
329 rOut.WriteByteString( rDesign.m_aWWW, RTL_TEXTENCODING_UTF8 );
330 rOut.WriteByteString( rDesign.m_aMisc, RTL_TEXTENCODING_UTF8 );
331 rOut << rDesign.m_bDownload;
332 rOut << rDesign.m_bCreated; // not used
333 rOut << rDesign.m_nButtonThema;
334 rOut << rDesign.m_bUserAttr;
335 rOut << rDesign.m_aBackColor;
336 rOut << rDesign.m_aTextColor;
337 rOut << rDesign.m_aLinkColor;
338 rOut << rDesign.m_aVLinkColor;
339 rOut << rDesign.m_aALinkColor;
340 rOut << rDesign.m_bUseAttribs;
341 rOut << rDesign.m_bUseColor;
342
343 rOut << (sal_uInt16)rDesign.m_eScript;
344 rOut.WriteByteString( rDesign.m_aURL, RTL_TEXTENCODING_UTF8 );
345 rOut.WriteByteString( rDesign.m_aCGI, RTL_TEXTENCODING_UTF8 );
346
347 rOut << rDesign.m_bAutoSlide;
348 rOut << rDesign.m_nSlideDuration;
349 rOut << rDesign.m_bEndless;
350 rOut << rDesign.m_bSlideSound;
351 rOut << rDesign.m_bHiddenSlides;
352
353 return rOut;
354 }
355
356 // *********************************************************************
357 // Dialog zur eingabe eines Namens fuer ein Design
358 // *********************************************************************
359 class SdDesignNameDlg : public ModalDialog
360 {
361 private:
362 Edit m_aEdit;
363 OKButton m_aBtnOK;
364 CancelButton m_aBtnCancel;
365
366 public:
367 SdDesignNameDlg(Window* pWindow, const String& aName );
368
369 String GetDesignName();
370 DECL_LINK( ModifyHdl, Edit* );
371 };
372
373 // *********************************************************************
374 // SdPublishingDlg Methoden
375 // *********************************************************************
376
377 // =====================================================================
378 // Konstruktor des Dialogs
379 // =====================================================================
SdPublishingDlg(Window * pWindow,DocumentType eDocType)380 SdPublishingDlg::SdPublishingDlg(Window* pWindow, DocumentType eDocType)
381 : ModalDialog(pWindow, SdResId( DLG_PUBLISHING ))
382 , mpButtonSet( new ButtonSet() )
383 , aBottomLine( this, SdResId( BOTTOM_LINE ) )
384 , aHelpButton(this,SdResId(BUT_HELP))
385 , aCancelButton(this,SdResId(BUT_CANCEL))
386 , aLastPageButton(this,SdResId(BUT_LAST))
387 , aNextPageButton(this,SdResId(BUT_NEXT))
388 , aFinishButton(this,SdResId(BUT_FINISH))
389 , aAssistentFunc(NOOFPAGES)
390 , m_bButtonsDirty(sal_True)
391 , m_bDesignListDirty(sal_False)
392 , m_pDesign(NULL)
393 {
394 m_bImpress = eDocType == DOCUMENT_TYPE_IMPRESS;
395
396 CreatePages();
397 Load();
398
399 //setzt die Ausgangsseite
400 aAssistentFunc.GotoPage(1);
401 aLastPageButton.Disable();
402
403 //Buttonbelegung
404 aFinishButton.SetClickHdl(LINK(this,SdPublishingDlg,FinishHdl));
405 aLastPageButton.SetClickHdl(LINK(this,SdPublishingDlg,LastPageHdl));
406 aNextPageButton.SetClickHdl(LINK(this,SdPublishingDlg,NextPageHdl));
407
408 pPage1_NewDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
409 pPage1_OldDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
410 pPage1_Designs->SetSelectHdl(LINK(this,SdPublishingDlg,DesignSelectHdl));
411 pPage1_DelDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignDeleteHdl));
412
413 pPage2_Standard->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
414 pPage2_Standard_FB->SetBorderStyle(WINDOW_BORDER_MONO);
415 pPage2_Frames->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
416 pPage2_Frames_FB->SetBorderStyle(WINDOW_BORDER_MONO);
417 pPage2_Kiosk->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
418 pPage2_Kiosk_FB->SetBorderStyle(WINDOW_BORDER_MONO);
419 pPage2_WebCast->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
420 pPage2_WebCast_FB->SetBorderStyle(WINDOW_BORDER_MONO);
421
422 pPage2_Content->SetClickHdl(LINK(this,SdPublishingDlg,ContentHdl));
423
424 pPage2_ASP->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
425 pPage2_PERL->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
426 String aText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("index")) );
427 aText += String(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION));
428 pPage2_Index->SetText(aText);
429 pPage2_CGI->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "/cgi-bin/" ) ) );
430
431 pPage3_Png->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
432 pPage3_Gif->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
433 pPage3_Jpg->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
434 pPage3_Quality->Enable(sal_False);
435
436 pPage3_Resolution_1->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
437 pPage3_Resolution_2->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
438 pPage3_Resolution_3->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
439
440 pPage2_ChgDefault->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
441 pPage2_ChgAuto->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
442 pPage2_Duration->SetFormat( TIMEF_SEC );
443
444 pPage5_Buttons->SetSelectHdl(LINK(this,SdPublishingDlg, ButtonsHdl ));
445 pPage5_Buttons->SetStyle( pPage5_Buttons->GetStyle() | WB_VSCROLL );
446
447 pPage6_Back->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
448 pPage6_Text->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
449 pPage6_Link->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
450 pPage6_VLink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
451 pPage6_ALink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
452
453 pPage6_DocColors->Check();
454
455 FreeResource();
456
457 pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "25%" ) ) );
458 pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "50%" ) ) );
459 pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "75%" ) ) );
460 pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "100%" ) ) );
461
462 pPage5_Buttons->SetColCount( 1 );
463 pPage5_Buttons->SetLineCount( 4 );
464 pPage5_Buttons->SetExtraSpacing( 1 );
465
466 for( sal_uInt16 nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ )
467 {
468 SdPublishingDesign *pDesign = (SdPublishingDesign*)
469 m_pDesignList->GetObject(nIndex);
470
471 pPage1_Designs->InsertEntry(pDesign->m_aDesignName);
472 }
473
474 pPage6_Preview->SetBorderStyle(WINDOW_BORDER_MONO);
475
476 SetDefaults();
477
478 SetHelpId(aPageHelpIds[0]);
479
480 aNextPageButton.GrabFocus();
481 }
482
483 // =====================================================================
484 // Destruktor
485 // =====================================================================
~SdPublishingDlg()486 SdPublishingDlg::~SdPublishingDlg()
487 {
488 if( m_pDesignList )
489 {
490 for( sal_uInt16 nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ )
491 delete (SdPublishingDesign*)m_pDesignList->GetObject(nIndex);
492 }
493
494 delete m_pDesignList;
495 RemovePages();
496 }
497
498 // =====================================================================
499 // Dialog Controls erzeugen und in die Seiten des Assistenten einbinden
500 // =====================================================================
CreatePages()501 void SdPublishingDlg::CreatePages()
502 {
503 // Page 1
504 aAssistentFunc.InsertControl(1,
505 pPage1_Bmp = new FixedBitmap(this,SdResId(PAGE1_BMP)));
506 aAssistentFunc.InsertControl(1,
507 pPage1_Titel = new FixedLine(this,SdResId(PAGE1_TITEL)));
508 aAssistentFunc.InsertControl(1,
509 pPage1_NewDesign = new RadioButton(this,SdResId(PAGE1_NEW_DESIGN)));
510 aAssistentFunc.InsertControl(1,
511 pPage1_OldDesign = new RadioButton(this,SdResId(PAGE1_OLD_DESIGN)));
512 aAssistentFunc.InsertControl(1,
513 pPage1_Designs = new ListBox(this,SdResId(PAGE1_DESIGNS)));
514 aAssistentFunc.InsertControl(1,
515 pPage1_DelDesign = new PushButton(this,SdResId(PAGE1_DEL_DESIGN)));
516 aAssistentFunc.InsertControl(1,
517 pPage1_Desc = new FixedText(this,SdResId(PAGE1_DESC)));
518
519
520 // Page 2
521 aAssistentFunc.InsertControl(2,
522 pPage2_Bmp = new FixedBitmap(this,SdResId(PAGE2_BMP)));
523 aAssistentFunc.InsertControl(2,
524 pPage2_Titel = new FixedLine(this,SdResId(PAGE2_TITEL )));
525 aAssistentFunc.InsertControl(2,
526 pPage2_Standard = new RadioButton(this,SdResId(PAGE2_STANDARD)));
527 aAssistentFunc.InsertControl(2,
528 pPage2_Frames = new RadioButton(this,SdResId(PAGE2_FRAMES)));
529 aAssistentFunc.InsertControl(2,
530 pPage2_Kiosk = new RadioButton(this,SdResId(PAGE2_KIOSK)));
531 aAssistentFunc.InsertControl(2,
532 pPage2_WebCast = new RadioButton(this,SdResId(PAGE2_WEBCAST)));
533 aAssistentFunc.InsertControl(2,
534 pPage2_Standard_FB = new FixedBitmap(this,SdResId(PAGE2_NOFRAMES_FB)));
535 aAssistentFunc.InsertControl(2,
536 pPage2_Frames_FB = new FixedBitmap(this,SdResId(PAGE2_FRAMES_FB)));
537 aAssistentFunc.InsertControl(2,
538 pPage2_Kiosk_FB = new FixedBitmap(this,SdResId(PAGE2_KIOSK_FB)));
539 aAssistentFunc.InsertControl(2,
540 pPage2_WebCast_FB = new FixedBitmap(this,SdResId(PAGE2_WEBCAST_FB)));
541
542 aAssistentFunc.InsertControl(2,
543 pPage2_Titel_Html = new FixedLine(this,SdResId(PAGE2_TITEL_HTML)));
544 aAssistentFunc.InsertControl(2,
545 pPage2_Content = new CheckBox(this,SdResId(PAGE2_CONTENT)));
546 if(m_bImpress)
547 aAssistentFunc.InsertControl(2,
548 pPage2_Notes = new CheckBox(this,SdResId(PAGE2_NOTES)));
549
550 aAssistentFunc.InsertControl(2,
551 pPage2_Titel_WebCast = new FixedLine(this,SdResId(PAGE2_TITEL_WEBCAST)));
552 aAssistentFunc.InsertControl(2,
553 pPage2_Index_txt = new FixedText(this,SdResId(PAGE2_INDEX_TXT)));
554 aAssistentFunc.InsertControl(2,
555 pPage2_Index = new Edit(this,SdResId(PAGE2_INDEX)));
556 aAssistentFunc.InsertControl(2,
557 pPage2_ASP = new RadioButton(this,SdResId(PAGE2_ASP)));
558 aAssistentFunc.InsertControl(2,
559 pPage2_PERL = new RadioButton(this,SdResId(PAGE2_PERL)));
560 aAssistentFunc.InsertControl(2,
561 pPage2_URL_txt = new FixedText(this,SdResId(PAGE2_URL_TXT)));
562 aAssistentFunc.InsertControl(2,
563 pPage2_URL = new Edit(this,SdResId(PAGE2_URL)));
564 aAssistentFunc.InsertControl(2,
565 pPage2_CGI_txt = new FixedText(this,SdResId(PAGE2_CGI_TXT)));
566 aAssistentFunc.InsertControl(2,
567 pPage2_CGI = new Edit(this,SdResId(PAGE2_CGI)));
568 aAssistentFunc.InsertControl(2,
569 pPage2_Vert = new FixedLine( this,SdResId( PAGE2_VERT )));
570 aAssistentFunc.InsertControl(2,
571 pPage2_Titel_Kiosk = new FixedLine(this,SdResId(PAGE2_TITEL_KIOSK)));
572 aAssistentFunc.InsertControl(2,
573 pPage2_ChgDefault = new RadioButton(this,SdResId(PAGE2_CHG_DEFAULT)));
574 aAssistentFunc.InsertControl(2,
575 pPage2_ChgAuto = new RadioButton(this,SdResId(PAGE2_CHG_AUTO)));
576 aAssistentFunc.InsertControl(2,
577 pPage2_Duration_txt = new FixedText(this,SdResId(PAGE2_DURATION_TXT)));
578 aAssistentFunc.InsertControl(2,
579 pPage2_Duration = new TimeField(this,SdResId(PAGE2_DURATION_TMF)));
580 aAssistentFunc.InsertControl(2,
581 pPage2_Endless = new CheckBox(this,SdResId(PAGE2_ENDLESS)));
582
583 // Page 3
584 aAssistentFunc.InsertControl(3,
585 pPage3_Bmp = new FixedBitmap(this,SdResId(PAGE3_BMP)));
586 aAssistentFunc.InsertControl(3,
587 pPage3_Titel1 = new FixedLine(this,SdResId(PAGE3_TITEL_1)));
588 aAssistentFunc.InsertControl(3,
589 pPage3_Png = new RadioButton(this,SdResId(PAGE3_PNG)));
590 aAssistentFunc.InsertControl(3,
591 pPage3_Gif = new RadioButton(this,SdResId(PAGE3_GIF)));
592 aAssistentFunc.InsertControl(3,
593 pPage3_Jpg = new RadioButton(this,SdResId(PAGE3_JPG)));
594 aAssistentFunc.InsertControl(3,
595 pPage3_Quality_txt = new FixedText(this,SdResId(PAGE3_QUALITY_TXT)));
596 aAssistentFunc.InsertControl(3,
597 pPage3_Quality = new ComboBox(this,SdResId(PAGE3_QUALITY)));
598 aAssistentFunc.InsertControl(3,
599 pPage3_Vert = new FixedLine( this,SdResId( PAGE3_VERT )));
600 aAssistentFunc.InsertControl(3,
601 pPage3_Titel2 = new FixedLine(this,SdResId(PAGE3_TITEL_2)));
602 aAssistentFunc.InsertControl(3,
603 pPage3_Resolution_1 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_1)));
604 aAssistentFunc.InsertControl(3,
605 pPage3_Resolution_2 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_2)));
606 aAssistentFunc.InsertControl(3,
607 pPage3_Resolution_3 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_3)));
608 aAssistentFunc.InsertControl(3,
609 pPage3_Titel3 = new FixedLine(this,SdResId(PAGE3_TITEL_3)));
610 aAssistentFunc.InsertControl(3,
611 pPage3_SldSound = new CheckBox(this,SdResId(PAGE3_SLD_SOUND)));
612 aAssistentFunc.InsertControl(3,
613 pPage3_HiddenSlides = new CheckBox(this,SdResId(PAGE3_HIDDEN_SLIDES)));
614
615 // Seite 4
616 aAssistentFunc.InsertControl(4,
617 pPage4_Bmp = new FixedBitmap(this,SdResId(PAGE4_BMP)));
618 aAssistentFunc.InsertControl(4,
619 pPage4_Titel1 = new FixedLine(this,SdResId(PAGE4_TITEL_1)));
620 aAssistentFunc.InsertControl(4,
621 pPage4_Author_txt = new FixedText(this,SdResId(PAGE4_AUTHOR_TXT)));
622 aAssistentFunc.InsertControl(4,
623 pPage4_Author = new Edit(this,SdResId(PAGE4_AUTHOR)));
624 aAssistentFunc.InsertControl(4,
625 pPage4_Email_txt = new FixedText(this,SdResId(PAGE4_EMAIL_TXT)));
626 aAssistentFunc.InsertControl(4,
627 pPage4_Email = new Edit(this,SdResId(PAGE4_EMAIL_EDIT)));
628 aAssistentFunc.InsertControl(4,
629 pPage4_WWW_txt = new FixedText(this,SdResId(PAGE4_WWW_TXT)));
630 aAssistentFunc.InsertControl(4,
631 pPage4_WWW = new Edit(this,SdResId(PAGE4_WWW_EDIT)));
632 aAssistentFunc.InsertControl(4,
633 pPage4_Titel2 = new FixedText(this,SdResId(PAGE4_TITEL_2)));
634 aAssistentFunc.InsertControl(4,
635 pPage4_Misc = new MultiLineEdit(this,SdResId(PAGE4_MISC)));
636 if(m_bImpress)
637 aAssistentFunc.InsertControl(4,
638 pPage4_Download = new CheckBox(this,SdResId(PAGE4_DOWNLOAD)));
639 //-/ aAssistentFunc.InsertControl(4,
640 //-/ pPage4_Created = new CheckBox(this,SdResId(PAGE4_CREATED)));
641
642 // Seite 5
643 aAssistentFunc.InsertControl(5,
644 pPage5_Bmp = new FixedBitmap(this,SdResId(PAGE5_BMP)));
645 aAssistentFunc.InsertControl(5,
646 pPage5_Titel = new FixedLine(this,SdResId(PAGE5_TITEL)));
647 aAssistentFunc.InsertControl(5,
648 pPage5_TextOnly = new CheckBox(this, SdResId(PAGE5_TEXTONLY)));
649 aAssistentFunc.InsertControl(5,
650 pPage5_Buttons = new ValueSet(this,SdResId(PAGE5_BUTTONS)));
651
652 // Seite 6
653 aAssistentFunc.InsertControl(6,
654 pPage6_Bmp = new FixedBitmap(this,SdResId(PAGE6_BMP)));
655 aAssistentFunc.InsertControl(6,
656 pPage6_Titel = new FixedLine(this,SdResId(PAGE6_TITEL)));
657 aAssistentFunc.InsertControl(6,
658 pPage6_DocColors = new RadioButton(this,SdResId(PAGE6_DOCCOLORS)));
659 aAssistentFunc.InsertControl(6,
660 pPage6_Default = new RadioButton(this,SdResId(PAGE6_DEFAULT)));
661 aAssistentFunc.InsertControl(6,
662 pPage6_User = new RadioButton(this,SdResId(PAGE6_USER)));
663 aAssistentFunc.InsertControl(6,
664 pPage6_Text = new PushButton(this,SdResId(PAGE6_TEXT)));
665 aAssistentFunc.InsertControl(6,
666 pPage6_Link = new PushButton(this,SdResId(PAGE6_LINK)));
667 aAssistentFunc.InsertControl(6,
668 pPage6_ALink = new PushButton(this,SdResId(PAGE6_ALINK)));
669 aAssistentFunc.InsertControl(6,
670 pPage6_VLink = new PushButton(this,SdResId(PAGE6_VLINK)));
671 aAssistentFunc.InsertControl(6,
672 pPage6_Back = new PushButton(this,SdResId(PAGE6_BACK)));
673 aAssistentFunc.InsertControl(6,
674 pPage6_Preview = new SdHtmlAttrPreview(this,SdResId(PAGE6_PREVIEW)));
675
676 InterpolateFixedBitmap(pPage1_Bmp);
677
678 InterpolateFixedBitmap(pPage2_Bmp);
679 InterpolateFixedBitmap(pPage2_Standard_FB);
680 InterpolateFixedBitmap(pPage2_Frames_FB);
681 InterpolateFixedBitmap(pPage2_Kiosk_FB);
682 InterpolateFixedBitmap(pPage2_WebCast_FB);
683
684 InterpolateFixedBitmap(pPage3_Bmp);
685 InterpolateFixedBitmap(pPage4_Bmp);
686
687 InterpolateFixedBitmap(pPage5_Bmp);
688 InterpolateFixedBitmap(pPage6_Bmp);
689 }
690
691 // =====================================================================
692 // Dialog Controls wieder entfernen
693 // =====================================================================
RemovePages()694 void SdPublishingDlg::RemovePages()
695 {
696 delete pPage1_Bmp;
697 delete pPage1_Titel;
698 delete pPage1_NewDesign;
699 delete pPage1_OldDesign;
700 delete pPage1_Designs;
701 delete pPage1_DelDesign;
702 delete pPage1_Desc;
703
704 delete pPage2_Bmp;
705 delete pPage2_Titel;
706 delete pPage2_Standard;
707 delete pPage2_Frames;
708 delete pPage2_Kiosk;
709 delete pPage2_WebCast;
710 delete pPage2_Standard_FB;
711 delete pPage2_Frames_FB;
712 delete pPage2_Kiosk_FB;
713 delete pPage2_WebCast_FB;
714
715 delete pPage2_Titel_Html;
716 delete pPage2_Content;
717 if(m_bImpress)
718 delete pPage2_Notes;
719
720 delete pPage2_Vert;
721 delete pPage2_Titel_WebCast;
722 delete pPage2_Index_txt;
723 delete pPage2_Index;
724 delete pPage2_ASP;
725 delete pPage2_PERL;
726 delete pPage2_URL_txt;
727 delete pPage2_URL;
728 delete pPage2_CGI_txt;
729 delete pPage2_CGI;
730
731 delete pPage2_Titel_Kiosk;
732 delete pPage2_ChgDefault;
733 delete pPage2_ChgAuto;
734 delete pPage2_Duration_txt;
735 delete pPage2_Duration;
736 delete pPage2_Endless;
737
738 delete pPage3_Bmp;
739 delete pPage3_Titel1;
740 delete pPage3_Png;
741 delete pPage3_Gif;
742 delete pPage3_Jpg;
743 delete pPage3_Quality_txt;
744 delete pPage3_Quality;
745 delete pPage3_Vert;
746 delete pPage3_Titel2;
747 delete pPage3_Resolution_1;
748 delete pPage3_Resolution_2;
749 delete pPage3_Resolution_3;
750 delete pPage3_Titel3;
751 delete pPage3_SldSound;
752 delete pPage3_HiddenSlides;
753
754 delete pPage4_Bmp;
755 delete pPage4_Titel1;
756 delete pPage4_Author_txt;
757 delete pPage4_Author;
758 delete pPage4_Email_txt;
759 delete pPage4_Email;
760 delete pPage4_WWW_txt;
761 delete pPage4_WWW;
762 delete pPage4_Titel2;
763 delete pPage4_Misc;
764 if(m_bImpress)
765 delete pPage4_Download;
766 //-/ delete pPage4_Created;
767
768 delete pPage5_Bmp;
769 delete pPage5_Titel;
770 delete pPage5_TextOnly;
771 delete pPage5_Buttons;
772
773 delete pPage6_Bmp;
774 delete pPage6_Titel;
775 delete pPage6_Default;
776 delete pPage6_User;
777 delete pPage6_Back;
778 delete pPage6_Text;
779 delete pPage6_Link;
780 delete pPage6_VLink;
781 delete pPage6_ALink;
782 delete pPage6_DocColors;
783 delete pPage6_Preview;
784 }
785
786 // =====================================================================
787 // Dialog mit defaultwerten initialisieren
788 // =====================================================================
SetDefaults()789 void SdPublishingDlg::SetDefaults()
790 {
791 SdPublishingDesign aDefault;
792 SetDesign(&aDefault);
793
794 pPage1_NewDesign->Check(sal_True);
795 pPage1_OldDesign->Check(sal_False);
796 UpdatePage();
797 }
798
799 // =====================================================================
800 // Das SfxItemSet mit den Einstellungen des Dialogs fuettern
801 // =====================================================================
GetParameterSequence(Sequence<PropertyValue> & rParams)802 void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
803 {
804 std::vector< PropertyValue > aProps;
805
806 PropertyValue aValue;
807
808
809 // Page 2
810 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PublishMode" ) );
811 aValue.Value <<= (sal_Int32)(pPage2_Standard->IsChecked()?PUBLISH_HTML:
812 pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
813 pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:PUBLISH_WEBCAST);
814 aProps.push_back( aValue );
815
816 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsExportContentsPage" ) );
817 aValue.Value <<= (sal_Bool)pPage2_Content->IsChecked();
818 aProps.push_back( aValue );
819
820 if(m_bImpress)
821 {
822 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsExportNotes" ) );
823 aValue.Value <<= (sal_Bool)pPage2_Notes->IsChecked();
824 aProps.push_back( aValue );
825 }
826
827 if( pPage2_WebCast->IsChecked() )
828 {
829 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastScriptLanguage" ) );
830 if( pPage2_ASP->IsChecked() )
831 aValue.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "asp" ) );
832 else
833 aValue.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "perl" ) );
834 aProps.push_back( aValue );
835
836 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastCGIURL" ) );
837 aValue.Value <<= OUString( pPage2_CGI->GetText() );
838 aProps.push_back( aValue );
839
840 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastTargetURL" ) );
841 aValue.Value <<= OUString( pPage2_URL->GetText() );
842 aProps.push_back( aValue );
843 }
844 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IndexURL" ) );
845 aValue.Value <<= OUString( pPage2_Index->GetText() );
846 aProps.push_back( aValue );
847
848
849 if( pPage2_Kiosk->IsChecked() && pPage2_ChgAuto->IsChecked() )
850 {
851 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "KioskSlideDuration" ) );
852 aValue.Value <<= (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
853 aProps.push_back( aValue );
854
855 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "KioskEndless" ) );
856 aValue.Value <<= (sal_Bool)pPage2_Endless->IsChecked();
857 aProps.push_back( aValue );
858 }
859
860 // Page 3
861
862 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
863 sal_Int32 nTmpWidth = 512;
864 if( pPage3_Resolution_2->IsChecked() )
865 nTmpWidth = 640;
866 else if( pPage3_Resolution_3->IsChecked() )
867 nTmpWidth = 800;
868
869 aValue.Value <<= nTmpWidth;
870 aProps.push_back( aValue );
871
872 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) );
873 aValue.Value <<= OUString( pPage3_Quality->GetText() );
874 aProps.push_back( aValue );
875
876 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Format" ) );
877 sal_Int32 nFormat;
878 if( pPage3_Png->IsChecked() )
879 nFormat = static_cast<sal_Int32>(FORMAT_PNG);
880 else if( pPage3_Gif->IsChecked() )
881 nFormat = static_cast<sal_Int32>(FORMAT_GIF);
882 else
883 nFormat = static_cast<sal_Int32>(FORMAT_JPG);
884 aValue.Value <<= nFormat;
885 aProps.push_back( aValue );
886
887 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SlideSound" ) );
888 aValue.Value <<= pPage3_SldSound->IsChecked() ? sal_True : sal_False;
889 aProps.push_back( aValue );
890
891 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "HiddenSlides" ) );
892 aValue.Value <<= pPage3_HiddenSlides->IsChecked() ? sal_True : sal_False;
893 aProps.push_back( aValue );
894
895 // Page 4
896 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Author" ) );
897 aValue.Value <<= OUString( pPage4_Author->GetText() );
898 aProps.push_back( aValue );
899
900 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EMail" ) );
901 aValue.Value <<= OUString( pPage4_Email->GetText() );
902 aProps.push_back( aValue );
903
904 // #92433# try to guess protocol for user's homepage
905 INetURLObject aHomeURL( pPage4_WWW->GetText(),
906 INET_PROT_HTTP, // default proto is HTTP
907 INetURLObject::ENCODE_ALL );
908
909 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "HomepageURL" ) );
910 aValue.Value <<= OUString( aHomeURL.GetMainURL( INetURLObject::NO_DECODE ) );
911 aProps.push_back( aValue );
912
913 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserText" ) );
914 aValue.Value <<= OUString( pPage4_Misc->GetText() );
915 aProps.push_back( aValue );
916
917 if( m_bImpress )
918 {
919 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableDownload" ) );
920 aValue.Value <<= (sal_Bool)pPage4_Download->IsChecked();
921 aProps.push_back( aValue );
922 }
923
924 // Page 5
925 if( !pPage5_TextOnly->IsChecked() )
926 {
927 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UseButtonSet" ) );
928 aValue.Value <<= (sal_Int32)(pPage5_Buttons->GetSelectItemId() - 1);
929 aProps.push_back( aValue );
930 }
931
932 // Page 6
933 if( pPage6_User->IsChecked() )
934 {
935 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "BackColor" ) );
936 aValue.Value <<= (sal_Int32)m_aBackColor.GetColor();
937 aProps.push_back( aValue );
938
939 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) );
940 aValue.Value <<= (sal_Int32)m_aTextColor.GetColor();
941 aProps.push_back( aValue );
942
943 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "LinkColor" ) );
944 aValue.Value <<= (sal_Int32)m_aLinkColor.GetColor();
945 aProps.push_back( aValue );
946
947 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "VLinkColor" ) );
948 aValue.Value <<= (sal_Int32)m_aVLinkColor.GetColor();
949 aProps.push_back( aValue );
950
951 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ALinkColor" ) );
952 aValue.Value <<= (sal_Int32)m_aALinkColor.GetColor();
953 aProps.push_back( aValue );
954 }
955
956 if( pPage6_DocColors->IsChecked() )
957 {
958 aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsUseDocumentColors" ) );
959 aValue.Value <<= (sal_Bool)sal_True;
960 aProps.push_back( aValue );
961 }
962
963 // Seite 6
964 // aSet.Put(SfxBoolItem(ATTR_PUBLISH_SLIDESOUND,pPage6_Sound->IsChecked()));
965
966
967 rParams.realloc( aProps.size() );
968 PropertyValue* pParams = rParams.getArray();
969
970 for( std::vector< PropertyValue >::iterator i = aProps.begin(); i != aProps.end(); i++ )
971 {
972 *pParams++ = (*i);
973 }
974 }
975
976 // =====================================================================
977 // Clickhandler fuer die Radiobuttons zur Designauswahl
978 // =====================================================================
IMPL_LINK(SdPublishingDlg,DesignHdl,RadioButton *,pButton)979 IMPL_LINK( SdPublishingDlg, DesignHdl, RadioButton *, pButton )
980 {
981 if(pButton == pPage1_NewDesign)
982 {
983 pPage1_NewDesign->Check(sal_True); // wegen DesignDeleteHdl
984 pPage1_OldDesign->Check(sal_False);
985 pPage1_Designs->Disable();
986 pPage1_DelDesign->Disable();
987 m_pDesign = NULL;
988
989 SdPublishingDesign aDefault;
990 SetDesign(&aDefault);
991 }
992 else
993 {
994 pPage1_NewDesign->Check(sal_False);
995 pPage1_Designs->Enable();
996 pPage1_DelDesign->Enable();
997
998 if(pPage1_Designs->GetSelectEntryCount() == 0)
999 pPage1_Designs->SelectEntryPos(0);
1000
1001 sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
1002 m_pDesign = (SdPublishingDesign*)m_pDesignList->GetObject(nPos);
1003 DBG_ASSERT(m_pDesign, "Kein Design? Das darf nicht sein! (CL)");
1004
1005 if(m_pDesign)
1006 SetDesign(m_pDesign);
1007 }
1008
1009 return 0;
1010 }
1011
1012 // =====================================================================
1013 // Clickhandler fuer die auswahl eines Designs
1014 // =====================================================================
IMPL_LINK(SdPublishingDlg,DesignSelectHdl,ListBox *,EMPTYARG)1015 IMPL_LINK( SdPublishingDlg, DesignSelectHdl, ListBox *, EMPTYARG )
1016 {
1017 sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
1018 m_pDesign = (SdPublishingDesign*)m_pDesignList->GetObject(nPos);
1019 DBG_ASSERT(m_pDesign, "Kein Design? Das darf nicht sein! (CL)");
1020
1021 if(m_pDesign)
1022 SetDesign(m_pDesign);
1023
1024 UpdatePage();
1025
1026 return 0;
1027 }
1028
1029 // =====================================================================
1030 // Clickhandler fuer das loeschen eines Designs
1031 // =====================================================================
IMPL_LINK(SdPublishingDlg,DesignDeleteHdl,PushButton *,EMPTYARG)1032 IMPL_LINK( SdPublishingDlg, DesignDeleteHdl, PushButton *, EMPTYARG )
1033 {
1034 sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
1035 SdPublishingDesign* pDesign = (SdPublishingDesign*)
1036 m_pDesignList->GetObject(nPos);
1037 DBG_ASSERT(pDesign, "Kein Design? Das darf nicht sein! (CL)");
1038
1039 if(pDesign)
1040 {
1041 m_pDesignList->Remove(pDesign);
1042 pPage1_Designs->RemoveEntry(nPos);
1043 }
1044
1045 if(m_pDesign == pDesign)
1046 DesignHdl( pPage1_NewDesign );
1047
1048 delete pDesign;
1049
1050 m_bDesignListDirty = sal_True;
1051
1052 UpdatePage();
1053
1054 return 0;
1055 }
1056
1057 // =====================================================================
1058 // Clickhandler fuer das �ndern des Servertyps
1059 // =====================================================================
IMPL_LINK(SdPublishingDlg,WebServerHdl,RadioButton *,pButton)1060 IMPL_LINK( SdPublishingDlg, WebServerHdl, RadioButton *, pButton )
1061 {
1062 sal_Bool bASP = pButton == pPage2_ASP;
1063
1064 pPage2_ASP->Check( bASP );
1065 pPage2_PERL->Check( !bASP );
1066 UpdatePage();
1067
1068 return 0;
1069 }
1070
1071 // =====================================================================
1072 // Clickhandler fuer die Radiobuttons der Auswahl des Grafikformates
1073 // =====================================================================
IMPL_LINK(SdPublishingDlg,GfxFormatHdl,RadioButton *,pButton)1074 IMPL_LINK( SdPublishingDlg, GfxFormatHdl, RadioButton *, pButton )
1075 {
1076 pPage3_Png->Check( pButton == pPage3_Png );
1077 pPage3_Gif->Check( pButton == pPage3_Gif );
1078 pPage3_Jpg->Check( pButton == pPage3_Jpg );
1079 pPage3_Quality->Enable(pButton == pPage3_Jpg);
1080 return 0;
1081 }
1082
1083 // =====================================================================
1084 // Clickhandler fuer die Radiobuttons Stanrard/Frames
1085 // =====================================================================
IMPL_LINK(SdPublishingDlg,BaseHdl,RadioButton *,EMPTYARG)1086 IMPL_LINK( SdPublishingDlg, BaseHdl, RadioButton *, EMPTYARG )
1087 {
1088 /*
1089 if(pButton == pPage3_Standard)
1090 pPage3_Frames->Check( pButton == pPage3 );
1091 else
1092 pPage3_Standard->Check(sal_False);
1093 */
1094 UpdatePage();
1095
1096 return 0;
1097 }
1098
1099 // =====================================================================
1100 // Clickhandler fuer die CheckBox der Titelseite
1101 // =====================================================================
IMPL_LINK(SdPublishingDlg,ContentHdl,RadioButton *,EMPTYARG)1102 IMPL_LINK( SdPublishingDlg, ContentHdl, RadioButton *, EMPTYARG )
1103 {
1104 if(pPage2_Content->IsChecked())
1105 {
1106 if(!aAssistentFunc.IsEnabled(4))
1107 {
1108 aAssistentFunc.EnablePage(4);
1109 UpdatePage();
1110 }
1111 }
1112 else
1113 {
1114 if(aAssistentFunc.IsEnabled(4))
1115 {
1116 aAssistentFunc.DisablePage(4);
1117 UpdatePage();
1118 }
1119 }
1120 return 0;
1121 }
1122
1123 // =====================================================================
1124 // Clickhandler fuer die Radiobuttons Aufloesung
1125 // =====================================================================
IMPL_LINK(SdPublishingDlg,ResolutionHdl,RadioButton *,pButton)1126 IMPL_LINK( SdPublishingDlg, ResolutionHdl, RadioButton *, pButton )
1127 {
1128 pPage3_Resolution_1->Check(pButton == pPage3_Resolution_1);
1129 pPage3_Resolution_2->Check(pButton == pPage3_Resolution_2);
1130 pPage3_Resolution_3->Check(pButton == pPage3_Resolution_3);
1131
1132 return 0;
1133 }
1134
1135 // =====================================================================
1136 // Clickhandler fuer das ValueSet mit den Bitmap Schaltflaechen
1137 // =====================================================================
IMPL_LINK(SdPublishingDlg,ButtonsHdl,ValueSet *,EMPTYARG)1138 IMPL_LINK( SdPublishingDlg, ButtonsHdl, ValueSet *, EMPTYARG )
1139 {
1140 // wird eine Bitmap Schaltflaeche gewaehlt, TexOnly ausschalten
1141 pPage5_TextOnly->Check(sal_False);
1142 return 0;
1143 }
1144
1145 // =====================================================================
1146 // Das SfxItemSet mit den Einstellungen des Dialogs fuettern
1147 // =====================================================================
IMPL_LINK(SdPublishingDlg,ColorHdl,PushButton *,pButton)1148 IMPL_LINK( SdPublishingDlg, ColorHdl, PushButton *, pButton)
1149 {
1150 SvColorDialog aDlg(this);
1151
1152 if(pButton == pPage6_Back)
1153 {
1154 aDlg.SetColor( m_aBackColor );
1155 if(aDlg.Execute() == RET_OK )
1156 m_aBackColor = aDlg.GetColor();
1157 }
1158 else if(pButton == pPage6_Text)
1159 {
1160 aDlg.SetColor( m_aTextColor );
1161 if(aDlg.Execute() == RET_OK )
1162 m_aTextColor = aDlg.GetColor();
1163 }
1164 else if(pButton == pPage6_Link)
1165 {
1166 aDlg.SetColor( m_aLinkColor );
1167 if(aDlg.Execute() == RET_OK )
1168 m_aLinkColor = aDlg.GetColor();
1169 }
1170 else if(pButton == pPage6_VLink)
1171 {
1172 aDlg.SetColor( m_aVLinkColor );
1173 if(aDlg.Execute() == RET_OK )
1174 m_aVLinkColor = aDlg.GetColor();
1175 }
1176 else if(pButton == pPage6_ALink)
1177 {
1178 aDlg.SetColor( m_aALinkColor );
1179 if(aDlg.Execute() == RET_OK )
1180 m_aALinkColor = aDlg.GetColor();
1181 }
1182
1183 pPage6_User->Check(sal_True);
1184 pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1185 m_aVLinkColor, m_aALinkColor );
1186 pPage6_Preview->Invalidate();
1187 return 0;
1188 }
1189
IMPL_LINK(SdPublishingDlg,SlideChgHdl,RadioButton *,EMPTYARG)1190 IMPL_LINK( SdPublishingDlg, SlideChgHdl, RadioButton*, EMPTYARG )
1191 {
1192 UpdatePage();
1193 return 0;
1194 }
1195
1196 // =====================================================================
1197 // Clickhandler fuer den Ok Button
1198 // =====================================================================
IMPL_LINK(SdPublishingDlg,FinishHdl,OKButton *,EMPTYARG)1199 IMPL_LINK( SdPublishingDlg, FinishHdl, OKButton *, EMPTYARG )
1200 {
1201 //Ende
1202 SdPublishingDesign* pDesign = new SdPublishingDesign();
1203 GetDesign(pDesign);
1204
1205 sal_Bool bSave = sal_False;
1206
1207 if(pPage1_OldDesign->IsChecked() && m_pDesign)
1208 {
1209 // aenderungen??
1210 if(!(*pDesign == *m_pDesign))
1211 bSave = sal_True;
1212 }
1213 else
1214 {
1215 SdPublishingDesign aDefaultDesign;
1216 if(!(aDefaultDesign == *pDesign))
1217 bSave = sal_True;
1218 }
1219
1220 if(bSave)
1221 {
1222 String aName;
1223 if(m_pDesign)
1224 aName = m_pDesign->m_aDesignName;
1225
1226 sal_Bool bRetry;
1227 do
1228 {
1229 bRetry = sal_False;
1230
1231 SdDesignNameDlg aDlg(this, aName );
1232
1233 if ( aDlg.Execute() == RET_OK )
1234 {
1235 pDesign->m_aDesignName = aDlg.GetDesignName();
1236
1237 SdPublishingDesign* pSameNameDes = NULL;
1238 sal_uInt16 nIndex;
1239 for( nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ )
1240 {
1241 pSameNameDes = (SdPublishingDesign*)
1242 m_pDesignList->GetObject(nIndex);
1243 if(pSameNameDes->m_aDesignName == pDesign->m_aDesignName)
1244 break;
1245 }
1246
1247 if(nIndex < m_pDesignList->Count())
1248 {
1249 ErrorBox aErrorBox(this, WB_YES_NO,
1250 String(SdResId(STR_PUBDLG_SAMENAME)));
1251 bRetry = aErrorBox.Execute() == RET_NO;
1252
1253 if(!bRetry)
1254 {
1255 m_pDesignList->Remove(pSameNameDes);
1256 delete pSameNameDes;
1257 }
1258 }
1259
1260 if(!bRetry)
1261 {
1262 m_pDesignList->Insert(pDesign);
1263 m_bDesignListDirty = sal_True;
1264 pDesign = NULL;
1265 }
1266 }
1267 }
1268 while(bRetry);
1269 }
1270
1271 delete pDesign;
1272
1273 if(m_bDesignListDirty)
1274 Save();
1275
1276 EndDialog(RET_OK);
1277 return 0;
1278 }
1279
1280 // =====================================================================
1281 // Refresh des Dialogs beim wechsel der Seite
1282 // =====================================================================
ChangePage()1283 void SdPublishingDlg::ChangePage()
1284 {
1285 int nPage = aAssistentFunc.GetCurrentPage();
1286 SetHelpId(aPageHelpIds[nPage-1]);
1287
1288 UpdatePage();
1289
1290 if( aNextPageButton.IsEnabled() )
1291 aNextPageButton.GrabFocus();
1292 else
1293 aFinishButton.GrabFocus();
1294 }
1295
UpdatePage()1296 void SdPublishingDlg::UpdatePage()
1297 {
1298 aNextPageButton.Enable(!aAssistentFunc.IsLastPage());
1299 aLastPageButton.Enable(!aAssistentFunc.IsFirstPage());
1300
1301 int nPage = aAssistentFunc.GetCurrentPage();
1302
1303 switch( nPage )
1304 {
1305 case 1:
1306 if(pPage1_NewDesign->IsChecked())
1307 {
1308 pPage1_Designs->Disable();
1309 pPage1_DelDesign->Disable();
1310 }
1311
1312 if(m_pDesignList && m_pDesignList->Count() == 0)
1313 pPage1_OldDesign->Disable();
1314 break;
1315 case 2:
1316 pPage2_Frames_FB->Show(pPage2_Frames->IsChecked());
1317 pPage2_Standard_FB->Show(pPage2_Standard->IsChecked());
1318 pPage2_Kiosk_FB->Show(pPage2_Kiosk->IsChecked());
1319 pPage2_WebCast_FB->Show(pPage2_WebCast->IsChecked());
1320
1321 if( pPage2_WebCast->IsChecked() )
1322 {
1323 pPage2_Titel_WebCast->Show();
1324 pPage2_ASP->Show();
1325 pPage2_PERL->Show();
1326 pPage2_URL_txt->Show();
1327 pPage2_URL->Show();
1328 pPage2_CGI_txt->Show();
1329 pPage2_CGI->Show();
1330 pPage2_Index_txt->Show();
1331 pPage2_Index->Show();
1332
1333 sal_Bool bPerl = pPage2_PERL->IsChecked();
1334 pPage2_Index->Enable(bPerl);
1335 pPage2_Index_txt->Enable(bPerl);
1336 pPage2_URL_txt->Enable(bPerl);
1337 pPage2_URL->Enable(bPerl);
1338 pPage2_CGI_txt->Enable(bPerl);
1339 pPage2_CGI->Enable(bPerl);
1340 }
1341 else
1342 {
1343 pPage2_Titel_WebCast->Hide();
1344 pPage2_ASP->Hide();
1345 pPage2_PERL->Hide();
1346 pPage2_URL_txt->Hide();
1347 pPage2_URL->Hide();
1348 pPage2_CGI_txt->Hide();
1349 pPage2_CGI->Hide();
1350 pPage2_Index->Hide();
1351 pPage2_Index_txt->Hide();
1352 }
1353
1354 if( pPage2_Kiosk->IsChecked() )
1355 {
1356 pPage2_Titel_Kiosk->Show();
1357 pPage2_ChgDefault->Show();
1358 pPage2_ChgAuto->Show();
1359 pPage2_Duration_txt->Show();
1360 pPage2_Duration->Show();
1361 pPage2_Endless->Show();
1362 sal_Bool bAuto = pPage2_ChgAuto->IsChecked();
1363 pPage2_Duration->Enable(bAuto);
1364 pPage2_Endless->Enable(bAuto);
1365 }
1366 else
1367 {
1368 pPage2_Titel_Kiosk->Hide();
1369 pPage2_ChgDefault->Hide();
1370 pPage2_ChgAuto->Hide();
1371 pPage2_Duration->Hide();
1372 pPage2_Duration_txt->Hide();
1373 pPage2_Endless->Hide();
1374 }
1375
1376 if( pPage2_Standard->IsChecked() || pPage2_Frames->IsChecked() )
1377 {
1378 pPage2_Titel_Html->Show();
1379 pPage2_Content->Show();
1380 if(m_bImpress)
1381 pPage2_Notes->Show();
1382 }
1383 else
1384 {
1385 pPage2_Titel_Html->Hide();
1386 pPage2_Content->Hide();
1387 if(m_bImpress)
1388 pPage2_Notes->Hide();
1389 }
1390 break;
1391 case 3:
1392 if( pPage2_Kiosk->IsChecked() || pPage2_WebCast->IsChecked() )
1393 aNextPageButton.Disable();
1394
1395 if( pPage2_WebCast->IsChecked() )
1396 pPage3_SldSound->Disable();
1397
1398 pPage3_Quality->Enable(pPage3_Jpg->IsChecked());
1399
1400 break;
1401 case 5:
1402 if( m_bButtonsDirty )
1403 LoadPreviewButtons();
1404 break;
1405 }
1406 }
1407
1408 /** loads the html buttons from the button sets, creates a preview and fills the
1409 itemset for page 5
1410 */
LoadPreviewButtons()1411 void SdPublishingDlg::LoadPreviewButtons()
1412 {
1413 if( mpButtonSet.get() )
1414 {
1415 const int nButtonCount = 8;
1416 static const char *pButtonNames[nButtonCount] =
1417 {
1418 "first.png",
1419 "left.png",
1420 "right.png",
1421 "last.png",
1422 "home.png",
1423 "text.png",
1424 "expand.png",
1425 "collapse.png",
1426 };
1427
1428 std::vector< rtl::OUString > aButtonNames;
1429 for( int i = 0; i < nButtonCount; ++i )
1430 aButtonNames.push_back( rtl::OUString::createFromAscii( pButtonNames[i] ) );
1431
1432 int nSetCount = mpButtonSet->getCount();
1433
1434 int nHeight = 32;
1435 Image aImage;
1436 for( int nSet = 0; nSet < nSetCount; ++nSet )
1437 {
1438 if( mpButtonSet->getPreview( nSet, aButtonNames, aImage ) )
1439 {
1440 pPage5_Buttons->InsertItem( (sal_uInt16)nSet+1, aImage );
1441 if( nHeight < aImage.GetSizePixel().Height() )
1442 nHeight = aImage.GetSizePixel().Height();
1443 }
1444 }
1445
1446 pPage5_Buttons->SetItemHeight( nHeight );
1447 m_bButtonsDirty = sal_False;
1448 }
1449 }
1450
1451 // =====================================================================
1452 // Clickhandler fuer den Weiter Button
1453 // =====================================================================
IMPL_LINK(SdPublishingDlg,NextPageHdl,PushButton *,EMPTYARG)1454 IMPL_LINK( SdPublishingDlg, NextPageHdl, PushButton *, EMPTYARG )
1455 {
1456 aAssistentFunc.NextPage();
1457 ChangePage();
1458 return 0;
1459 }
1460
1461 // =====================================================================
1462 // Setzt die Controlls im Dialog gemaess den Einstellungen im Design
1463 // =====================================================================
SetDesign(SdPublishingDesign * pDesign)1464 void SdPublishingDlg::SetDesign( SdPublishingDesign* pDesign )
1465 {
1466 if(!pDesign)
1467 return;
1468
1469 pPage2_Standard->Check(pDesign->m_eMode == PUBLISH_HTML);
1470 pPage2_Frames->Check(pDesign->m_eMode == PUBLISH_FRAMES);
1471 pPage2_Kiosk->Check(pDesign->m_eMode == PUBLISH_KIOSK );
1472 pPage2_WebCast->Check(pDesign->m_eMode == PUBLISH_WEBCAST );
1473
1474 pPage2_Content->Check(pDesign->m_bContentPage);
1475 if(pDesign->m_bContentPage)
1476 aAssistentFunc.EnablePage(4);
1477 else
1478 aAssistentFunc.DisablePage(4);
1479
1480 if(m_bImpress)
1481 pPage2_Notes->Check(pDesign->m_bNotes);
1482
1483 pPage2_ASP->Check(pDesign->m_eScript == SCRIPT_ASP);
1484 pPage2_PERL->Check(pDesign->m_eScript == SCRIPT_PERL);
1485 pPage2_CGI->SetText(pDesign->m_aCGI);
1486 pPage2_URL->SetText(pDesign->m_aURL);
1487
1488 pPage2_ChgDefault->Check( !pDesign->m_bAutoSlide );
1489 pPage2_ChgAuto->Check( pDesign->m_bAutoSlide );
1490
1491 Time aTime;
1492 aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 );
1493 pPage2_Duration->SetTime( aTime );
1494
1495 pPage2_Endless->Check( pDesign->m_bEndless );
1496
1497 pPage3_Png->Check(pDesign->m_eFormat == FORMAT_PNG);
1498 pPage3_Gif->Check(pDesign->m_eFormat == FORMAT_GIF);
1499 pPage3_Jpg->Check(pDesign->m_eFormat == FORMAT_JPG);
1500 pPage3_Quality->Enable(pDesign->m_eFormat == FORMAT_JPG);
1501
1502 pPage3_Quality->SetText(pDesign->m_aCompression);
1503 pPage3_Resolution_1->Check(pDesign->m_nResolution == PUB_LOWRES_WIDTH);
1504 pPage3_Resolution_2->Check(pDesign->m_nResolution == PUB_MEDRES_WIDTH);
1505 pPage3_Resolution_3->Check(pDesign->m_nResolution == PUB_HIGHRES_WIDTH);
1506
1507 pPage3_SldSound->Check( pDesign->m_bSlideSound );
1508 pPage3_HiddenSlides->Check( pDesign->m_bHiddenSlides );
1509
1510 pPage4_Author->SetText(pDesign->m_aAuthor);
1511 pPage4_Email->SetText(pDesign->m_aEMail);
1512 pPage4_WWW->SetText(pDesign->m_aWWW);
1513 pPage4_Misc->SetText(pDesign->m_aMisc);
1514 if(m_bImpress)
1515 pPage4_Download->Check(pDesign->m_bDownload);
1516 //-/ pPage4_Created->Check(pDesign->m_bCreated);
1517
1518 pPage5_TextOnly->Check(pDesign->m_nButtonThema == -1);
1519 if(pDesign->m_nButtonThema != -1)
1520 {
1521 if(m_bButtonsDirty)
1522 LoadPreviewButtons();
1523 pPage5_Buttons->SelectItem(pDesign->m_nButtonThema + 1);
1524 }
1525 else
1526 pPage5_Buttons->SetNoSelection();
1527
1528 pPage6_User->Check(pDesign->m_bUserAttr);
1529 m_aBackColor = pDesign->m_aBackColor;
1530 m_aTextColor = pDesign->m_aTextColor;
1531 m_aLinkColor = pDesign->m_aLinkColor;
1532 m_aVLinkColor = pDesign->m_aVLinkColor;
1533 m_aALinkColor = pDesign->m_aALinkColor;
1534
1535 pPage6_DocColors->Check(pDesign->m_bUseColor);
1536
1537 pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1538 m_aVLinkColor, m_aALinkColor );
1539 pPage6_Preview->Invalidate();
1540
1541 UpdatePage();
1542 }
1543
1544 // =====================================================================
1545 // Uebertraegt den Status der Dialog Controlls in das Design
1546 // =====================================================================
GetDesign(SdPublishingDesign * pDesign)1547 void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign )
1548 {
1549 if(!pDesign)
1550 return;
1551
1552 pDesign->m_eMode = pPage2_Standard->IsChecked()?PUBLISH_HTML:
1553 pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
1554 pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:
1555 PUBLISH_WEBCAST;
1556
1557 pDesign->m_bContentPage = pPage2_Content->IsChecked();
1558 if(m_bImpress)
1559 pDesign->m_bNotes = pPage2_Notes->IsChecked();
1560
1561 if( pPage3_Gif->IsChecked() )
1562 pDesign->m_eFormat = FORMAT_GIF;
1563 else if( pPage3_Jpg->IsChecked() )
1564 pDesign->m_eFormat = FORMAT_JPG;
1565 else
1566 pDesign->m_eFormat = FORMAT_PNG;
1567
1568 pDesign->m_aCompression = pPage3_Quality->GetText();
1569
1570 pDesign->m_nResolution = pPage3_Resolution_1->IsChecked()?PUB_LOWRES_WIDTH:
1571 (pPage3_Resolution_2->IsChecked()?PUB_MEDRES_WIDTH:PUB_HIGHRES_WIDTH);
1572
1573 pDesign->m_bSlideSound = pPage3_SldSound->IsChecked();
1574 pDesign->m_bHiddenSlides = pPage3_HiddenSlides->IsChecked();
1575
1576 pDesign->m_aAuthor = pPage4_Author->GetText();
1577 pDesign->m_aEMail = pPage4_Email->GetText();
1578 pDesign->m_aWWW = pPage4_WWW->GetText();
1579 pDesign->m_aMisc = pPage4_Misc->GetText();
1580 pDesign->m_bDownload = m_bImpress?pPage4_Download->IsChecked():sal_False;
1581 //-/ pDesign->m_bCreated = pPage4_Created->IsChecked();
1582
1583 if(pPage5_TextOnly->IsChecked())
1584 pDesign->m_nButtonThema = -1;
1585 else
1586 pDesign->m_nButtonThema = pPage5_Buttons->GetSelectItemId() - 1;
1587
1588 pDesign->m_bUserAttr = pPage6_User->IsChecked();
1589 pDesign->m_aBackColor = m_aBackColor;
1590 pDesign->m_aTextColor = m_aTextColor;
1591 pDesign->m_aLinkColor = m_aLinkColor;
1592 pDesign->m_aVLinkColor = m_aVLinkColor;
1593 pDesign->m_aALinkColor = m_aALinkColor;
1594 pDesign->m_bUseColor = pPage6_DocColors->IsChecked();
1595
1596
1597 pDesign->m_eScript = pPage2_ASP->IsChecked()?SCRIPT_ASP:SCRIPT_PERL;
1598 pDesign->m_aCGI = pPage2_CGI->GetText();
1599 pDesign->m_aURL = pPage2_URL->GetText();
1600
1601 pDesign->m_bAutoSlide = pPage2_ChgAuto->IsChecked();
1602 pDesign->m_nSlideDuration = (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
1603 pDesign->m_bEndless = pPage2_Endless->IsChecked();
1604 }
1605
1606 // =====================================================================
1607 // Clickhandler fuer den Zurueck Button
1608 // =====================================================================
IMPL_LINK(SdPublishingDlg,LastPageHdl,PushButton *,EMPTYARG)1609 IMPL_LINK( SdPublishingDlg, LastPageHdl, PushButton *, EMPTYARG )
1610 {
1611 aAssistentFunc.PreviousPage();
1612 ChangePage();
1613 return 0;
1614 }
1615
1616 // =====================================================================
1617 // Designs laden
1618 // =====================================================================
Load()1619 sal_Bool SdPublishingDlg::Load()
1620 {
1621 m_bDesignListDirty = sal_False;
1622
1623 m_pDesignList = new List();
1624
1625 INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1626 aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "designs.sod" ) ) );
1627
1628 // check if file exists, SfxMedium shows an errorbox else
1629 {
1630 com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler;
1631 SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler );
1632
1633 sal_Bool bOk = pIStm && ( pIStm->GetError() == 0);
1634
1635 if( pIStm )
1636 delete pIStm;
1637
1638 if( !bOk )
1639 return sal_False;
1640 }
1641
1642 SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ | STREAM_NOCREATE, sal_True );
1643
1644 SvStream* pStream = aMedium.GetInStream();
1645
1646 if( !pStream )
1647 return( sal_False );
1648
1649 sal_uInt16 aCheck;
1650 *pStream >> aCheck;
1651
1652 if(aCheck != nMagic)
1653 return sal_False;
1654
1655 SdIOCompat aIO(*pStream, STREAM_READ);
1656
1657 sal_uInt16 nDesigns;
1658 *pStream >> nDesigns;
1659
1660 for( sal_uInt16 nIndex = 0;
1661 pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1662 nIndex++ )
1663 {
1664 SdPublishingDesign* pDesign = new SdPublishingDesign();
1665 *pStream >> *pDesign;
1666
1667 m_pDesignList->Insert(pDesign);
1668 }
1669
1670 return( pStream->GetError() == SVSTREAM_OK );
1671 }
1672
1673 // =====================================================================
1674 // Designs speichern
1675 // =====================================================================
Save()1676 sal_Bool SdPublishingDlg::Save()
1677 {
1678 INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1679 aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "designs.sod" ) ) );
1680 SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC, sal_False );
1681 aMedium.IsRemote();
1682
1683 SvStream* pStream = aMedium.GetOutStream();
1684
1685 if( !pStream )
1686 return( sal_False );
1687
1688 sal_uInt16 aCheck = nMagic;
1689 *pStream << aCheck;
1690
1691 // damit SdIOCompat vor dem Stream destruiert wird
1692 {
1693 SdIOCompat aIO(*pStream, STREAM_WRITE, 0);
1694
1695 sal_uInt16 nDesigns = (sal_uInt16) m_pDesignList->Count();
1696 *pStream << nDesigns;
1697
1698 for( sal_uInt16 nIndex = 0;
1699 pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1700 nIndex++ )
1701 {
1702 SdPublishingDesign* pDesign = (SdPublishingDesign*)
1703 m_pDesignList->GetObject(nIndex);
1704 *pStream << *pDesign;
1705 }
1706 }
1707
1708 aMedium.Close();
1709 aMedium.Commit();
1710
1711 return( aMedium.GetError() == 0 );
1712 }
1713
1714 // *********************************************************************
1715 // SdDesignNameDlg Methoden
1716 // *********************************************************************
1717
1718 // =====================================================================
1719 //
1720 // =====================================================================
SdDesignNameDlg(Window * pWindow,const String & aName)1721 SdDesignNameDlg::SdDesignNameDlg(Window* pWindow, const String& aName):
1722 ModalDialog (pWindow, SdResId( DLG_DESIGNNAME )),
1723 m_aEdit (this, SdResId(EDT_NAME)),
1724 m_aBtnOK (this, SdResId(BTN_SAVE)),
1725 m_aBtnCancel (this, SdResId(BTN_NOSAVE))
1726 {
1727 FreeResource();
1728 m_aEdit.SetModifyHdl(LINK(this, SdDesignNameDlg, ModifyHdl ));
1729 m_aEdit.SetText(aName);
1730 m_aBtnOK.Enable(aName.Len() != 0);
1731 }
1732
1733 // =====================================================================
1734 //
1735 // =====================================================================
GetDesignName()1736 String SdDesignNameDlg::GetDesignName()
1737 {
1738 return m_aEdit.GetText();
1739 }
1740
1741 // =====================================================================
1742 //
1743 // =====================================================================
IMPL_LINK(SdDesignNameDlg,ModifyHdl,Edit *,EMPTYARG)1744 IMPL_LINK( SdDesignNameDlg, ModifyHdl, Edit*, EMPTYARG )
1745 {
1746 m_aBtnOK.Enable(m_aEdit.GetText().Len() != 0);
1747
1748 return 0;
1749 }
1750
1751
1752
1753