bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / filter / html / pubdlg.cxx
blob2a3975815e9ead14721e6900a5ccd7c36a50e8ee
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/beans/PropertyValue.hpp>
21 #include <unotools/ucbstreamhelper.hxx>
22 #include <vcl/lstbox.hxx>
23 #include <vcl/FilterConfigItem.hxx>
24 #include <vcl/button.hxx>
25 #include <vcl/fixed.hxx>
26 #include <vcl/combobox.hxx>
27 #include <svtools/svmedit.hxx>
28 #include <svl/intitem.hxx>
29 #include <svl/aeitem.hxx>
30 #include <svl/itemset.hxx>
31 #include <svl/stritem.hxx>
32 #include <vcl/msgbox.hxx>
33 #include <svtools/valueset.hxx>
34 #include <vcl/graph.hxx>
35 #include <svl/eitem.hxx>
36 #include <svtools/colrdlg.hxx>
37 #include <editeng/colritem.hxx>
38 #include <tools/urlobj.hxx>
39 #include <sdiocmpt.hxx>
40 #include <sfx2/docfile.hxx>
41 #include <sfx2/app.hxx>
42 #include <pres.hxx>
43 #include <unotools/useroptions.hxx>
44 #include <unotools/pathoptions.hxx>
46 #include "sdresid.hxx"
47 #include "sdattr.hxx"
48 #include "pubdlg.hrc"
49 #include "pubdlg.hxx"
50 #include "htmlattr.hxx"
51 #include "htmlex.hxx"
52 #include "htmlpublishmode.hxx"
53 #include "helpids.h"
54 #include "buttonset.hxx"
56 using namespace std;
57 using namespace com::sun::star::uno;
58 using namespace com::sun::star::beans;
61 #define NOOFPAGES 6
63 extern void InterpolateFixedBitmap( FixedBitmap * pBitmap );
65 //ID for the config-data with the HTML-settings
66 const sal_uInt16 nMagic = (sal_uInt16)0x1977;
68 // Key for the soffice.ini
69 #define KEY_QUALITY "JPG-EXPORT-QUALITY"
71 // The Help-IDs of the pages
72 const char* aPageHelpIds[NOOFPAGES] =
74 HID_SD_HTMLEXPORT_PAGE1,
75 HID_SD_HTMLEXPORT_PAGE2,
76 HID_SD_HTMLEXPORT_PAGE3,
77 HID_SD_HTMLEXPORT_PAGE4,
78 HID_SD_HTMLEXPORT_PAGE5,
79 HID_SD_HTMLEXPORT_PAGE6
82 // This class has all the settings for the HTML-export autopilot
83 class SdPublishingDesign
85 public:
86 String m_aDesignName;
88 HtmlPublishMode m_eMode;
90 // special WebCast options
91 PublishingScript m_eScript;
92 String m_aCGI;
93 String m_aURL;
95 // special Kiosk options
96 sal_Bool m_bAutoSlide;
97 sal_uInt32 m_nSlideDuration;
98 sal_Bool m_bEndless;
100 // special HTML options
101 sal_Bool m_bContentPage;
102 sal_Bool m_bNotes;
104 // misc options
105 sal_uInt16 m_nResolution;
106 String m_aCompression;
107 PublishingFormat m_eFormat;
108 sal_Bool m_bSlideSound;
109 sal_Bool m_bHiddenSlides;
111 // titel page information
112 String m_aAuthor;
113 String m_aEMail;
114 String m_aWWW;
115 String m_aMisc;
116 sal_Bool m_bDownload;
117 sal_Bool m_bCreated; // not used
119 // buttons and colorscheme
120 sal_Int16 m_nButtonThema;
121 sal_Bool m_bUserAttr;
122 Color m_aBackColor;
123 Color m_aTextColor;
124 Color m_aLinkColor;
125 Color m_aVLinkColor;
126 Color m_aALinkColor;
127 sal_Bool m_bUseAttribs;
128 sal_Bool m_bUseColor;
130 SdPublishingDesign();
132 int operator ==(const SdPublishingDesign & rDesign) const;
133 friend SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign);
134 friend SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign);
137 // load Default-settings
138 SdPublishingDesign::SdPublishingDesign()
140 m_eMode = PUBLISH_HTML;
141 m_bContentPage = sal_True;
142 m_bNotes = sal_True;
144 m_eFormat = FORMAT_PNG;
146 String aFilterConfigPath( "Office.Common/Filter/Graphic/Export/JPG" );
147 FilterConfigItem aFilterConfigItem( aFilterConfigPath );
148 sal_Int32 nCompression = aFilterConfigItem.ReadInt32( OUString( KEY_QUALITY ), 75 );
149 m_aCompression = OUString::valueOf( nCompression );
150 m_aCompression.Append( sal_Unicode('%') );
152 SvtUserOptions aUserOptions;
154 m_nResolution = PUB_LOWRES_WIDTH;
155 m_aAuthor = aUserOptions.GetFirstName();
156 if( m_aAuthor.Len() && !aUserOptions.GetLastName().isEmpty() )
157 m_aAuthor += sal_Unicode(' ');
158 m_aAuthor += (String)aUserOptions.GetLastName();
159 m_aEMail = aUserOptions.GetEmail();
160 m_bDownload = sal_False;
161 m_nButtonThema = -1;
163 m_bUserAttr = sal_False;
164 m_bUseAttribs = sal_True;
165 m_bUseColor = sal_True;
167 m_aBackColor = COL_WHITE;
168 m_aTextColor = COL_BLACK;
169 m_aLinkColor = COL_BLUE;
170 m_aVLinkColor = COL_LIGHTBLUE;
171 m_aALinkColor = COL_GRAY;
173 m_eScript = SCRIPT_ASP;
175 m_bAutoSlide = sal_True;
176 m_nSlideDuration = 15;
177 m_bEndless = sal_True;
179 m_bSlideSound = sal_True;
180 m_bHiddenSlides = sal_False;
183 // Compares the values without paying attention to the name
184 int SdPublishingDesign::operator ==(const SdPublishingDesign & rDesign) const
186 return
188 m_eMode == rDesign.m_eMode &&
189 m_nResolution == rDesign.m_nResolution &&
190 m_aCompression == rDesign.m_aCompression &&
191 m_eFormat == rDesign.m_eFormat &&
192 m_bHiddenSlides == rDesign.m_bHiddenSlides &&
193 ( // compare html options
194 (m_eMode != PUBLISH_HTML && m_eMode != PUBLISH_FRAMES) ||
196 m_bContentPage == rDesign.m_bContentPage &&
197 m_bNotes == rDesign.m_bNotes &&
198 m_aAuthor == rDesign.m_aAuthor &&
199 m_aEMail == rDesign.m_aEMail &&
200 m_aWWW == rDesign.m_aWWW &&
201 m_aMisc == rDesign.m_aMisc &&
202 m_bDownload == rDesign.m_bDownload &&
203 m_nButtonThema == rDesign.m_nButtonThema &&
204 m_bUserAttr == rDesign.m_bUserAttr &&
205 m_aBackColor == rDesign.m_aBackColor &&
206 m_aTextColor == rDesign.m_aTextColor &&
207 m_aLinkColor == rDesign.m_aLinkColor &&
208 m_aVLinkColor == rDesign.m_aVLinkColor &&
209 m_aALinkColor == rDesign.m_aALinkColor &&
210 m_bUseAttribs == rDesign.m_bUseAttribs &&
211 m_bSlideSound == rDesign.m_bSlideSound &&
212 m_bUseColor == rDesign.m_bUseColor
214 ) &&
215 ( // compare kiosk options
216 (m_eMode != PUBLISH_KIOSK) ||
218 m_bAutoSlide == rDesign.m_bAutoSlide &&
219 m_bSlideSound == rDesign.m_bSlideSound &&
221 !m_bAutoSlide ||
223 m_nSlideDuration == rDesign.m_nSlideDuration &&
224 m_bEndless == rDesign.m_bEndless
228 ) &&
229 ( // compare WebCast options
230 (m_eMode != PUBLISH_WEBCAST) ||
232 m_eScript == rDesign.m_eScript &&
234 m_eScript != SCRIPT_PERL ||
236 m_aURL == rDesign.m_aURL &&
237 m_aCGI == rDesign.m_aCGI
245 // Load the design from the stream
246 SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign)
248 SdIOCompat aIO(rIn, STREAM_READ);
250 sal_uInt16 nTemp16;
252 rDesign.m_aDesignName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
253 RTL_TEXTENCODING_UTF8);
254 rIn >> nTemp16;
255 rDesign.m_eMode = (HtmlPublishMode)nTemp16;
256 rIn >> rDesign.m_bContentPage;
257 rIn >> rDesign.m_bNotes;
258 rIn >> rDesign.m_nResolution;
259 rDesign.m_aCompression = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
260 RTL_TEXTENCODING_UTF8);
261 rIn >> nTemp16;
262 rDesign.m_eFormat = (PublishingFormat)nTemp16;
263 rDesign.m_aAuthor = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
264 RTL_TEXTENCODING_UTF8);
265 rDesign.m_aEMail = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
266 RTL_TEXTENCODING_UTF8);
267 rDesign.m_aWWW = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
268 RTL_TEXTENCODING_UTF8);
269 rDesign.m_aMisc = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
270 RTL_TEXTENCODING_UTF8);
271 rIn >> rDesign.m_bDownload;
272 rIn >> rDesign.m_bCreated; // not used
273 rIn >> rDesign.m_nButtonThema;
274 rIn >> rDesign.m_bUserAttr;
275 rIn >> rDesign.m_aBackColor;
276 rIn >> rDesign.m_aTextColor;
277 rIn >> rDesign.m_aLinkColor;
278 rIn >> rDesign.m_aVLinkColor;
279 rIn >> rDesign.m_aALinkColor;
280 rIn >> rDesign.m_bUseAttribs;
281 rIn >> rDesign.m_bUseColor;
283 rIn >> nTemp16;
284 rDesign.m_eScript = (PublishingScript)nTemp16;
285 rDesign.m_aURL = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
286 RTL_TEXTENCODING_UTF8);
287 rDesign.m_aCGI = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn,
288 RTL_TEXTENCODING_UTF8);
290 rIn >> rDesign.m_bAutoSlide;
291 rIn >> rDesign.m_nSlideDuration;
292 rIn >> rDesign.m_bEndless;
293 rIn >> rDesign.m_bSlideSound;
294 rIn >> rDesign.m_bHiddenSlides;
296 return rIn;
299 // Set the design to the stream
300 SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign)
302 // The last parameter is the versionnumber of the code
303 SdIOCompat aIO(rOut, STREAM_WRITE, 0);
305 // Name
306 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aDesignName,
307 RTL_TEXTENCODING_UTF8);
309 rOut << (sal_uInt16)rDesign.m_eMode;
310 rOut << rDesign.m_bContentPage;
311 rOut << rDesign.m_bNotes;
312 rOut << rDesign.m_nResolution;
313 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aCompression,
314 RTL_TEXTENCODING_UTF8);
315 rOut << (sal_uInt16)rDesign.m_eFormat;
316 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aAuthor,
317 RTL_TEXTENCODING_UTF8);
318 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aEMail,
319 RTL_TEXTENCODING_UTF8);
320 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aWWW,
321 RTL_TEXTENCODING_UTF8);
322 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aMisc,
323 RTL_TEXTENCODING_UTF8);
324 rOut << rDesign.m_bDownload;
325 rOut << rDesign.m_bCreated; // not used
326 rOut << rDesign.m_nButtonThema;
327 rOut << rDesign.m_bUserAttr;
328 rOut << rDesign.m_aBackColor;
329 rOut << rDesign.m_aTextColor;
330 rOut << rDesign.m_aLinkColor;
331 rOut << rDesign.m_aVLinkColor;
332 rOut << rDesign.m_aALinkColor;
333 rOut << rDesign.m_bUseAttribs;
334 rOut << rDesign.m_bUseColor;
336 rOut << (sal_uInt16)rDesign.m_eScript;
337 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aURL,
338 RTL_TEXTENCODING_UTF8);
339 write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rDesign.m_aCGI,
340 RTL_TEXTENCODING_UTF8);
342 rOut << rDesign.m_bAutoSlide;
343 rOut << rDesign.m_nSlideDuration;
344 rOut << rDesign.m_bEndless;
345 rOut << rDesign.m_bSlideSound;
346 rOut << rDesign.m_bHiddenSlides;
348 return rOut;
351 // Dialog for the entry of the name of the design
352 class SdDesignNameDlg : public ModalDialog
354 private:
355 Edit m_aEdit;
356 OKButton m_aBtnOK;
357 CancelButton m_aBtnCancel;
359 public:
360 SdDesignNameDlg(Window* pWindow, const String& aName );
362 String GetDesignName();
363 DECL_LINK(ModifyHdl, void *);
366 // SdPublishingDlg Methods
368 SdPublishingDlg::SdPublishingDlg(Window* pWindow, DocumentType eDocType)
369 : ModalDialog(pWindow, SdResId( DLG_PUBLISHING ))
370 , mpButtonSet( new ButtonSet() )
371 , aBottomLine( this, SdResId( BOTTOM_LINE ) )
372 , aHelpButton(this,SdResId(BUT_HELP))
373 , aCancelButton(this,SdResId(BUT_CANCEL))
374 , aLastPageButton(this,SdResId(BUT_LAST))
375 , aNextPageButton(this,SdResId(BUT_NEXT))
376 , aFinishButton(this,SdResId(BUT_FINISH))
377 , aAssistentFunc(NOOFPAGES)
378 , m_bButtonsDirty(sal_True)
379 , m_bDesignListDirty(sal_False)
380 , m_pDesign(NULL)
382 m_bImpress = eDocType == DOCUMENT_TYPE_IMPRESS;
384 CreatePages();
385 Load();
387 // sets the output page
388 aAssistentFunc.GotoPage(1);
389 aLastPageButton.Disable();
391 // button assignment
392 aFinishButton.SetClickHdl(LINK(this,SdPublishingDlg,FinishHdl));
393 aLastPageButton.SetClickHdl(LINK(this,SdPublishingDlg,LastPageHdl));
394 aNextPageButton.SetClickHdl(LINK(this,SdPublishingDlg,NextPageHdl));
396 pPage1_NewDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
397 pPage1_OldDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
398 pPage1_Designs->SetSelectHdl(LINK(this,SdPublishingDlg,DesignSelectHdl));
399 pPage1_DelDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignDeleteHdl));
401 pPage2_Standard->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
402 pPage2_Standard_FB->SetBorderStyle(WINDOW_BORDER_MONO);
403 pPage2_Frames->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
404 pPage2_Frames_FB->SetBorderStyle(WINDOW_BORDER_MONO);
405 pPage2_Kiosk->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
406 pPage2_Kiosk_FB->SetBorderStyle(WINDOW_BORDER_MONO);
407 pPage2_WebCast->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
408 pPage2_WebCast_FB->SetBorderStyle(WINDOW_BORDER_MONO);
410 pPage2_Content->SetClickHdl(LINK(this,SdPublishingDlg,ContentHdl));
412 pPage2_ASP->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
413 pPage2_PERL->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
414 String aText( OUString("index") );
415 aText += String(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION));
416 pPage2_Index->SetText(aText);
417 pPage2_CGI->SetText( OUString( "/cgi-bin/" ) );
419 pPage3_Png->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
420 pPage3_Gif->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
421 pPage3_Jpg->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
422 pPage3_Quality->Enable(sal_False);
424 pPage3_Resolution_1->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
425 pPage3_Resolution_2->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
426 pPage3_Resolution_3->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
428 pPage2_ChgDefault->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
429 pPage2_ChgAuto->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
430 pPage2_Duration->SetFormat( TIMEF_SEC );
432 pPage5_Buttons->SetSelectHdl(LINK(this,SdPublishingDlg, ButtonsHdl ));
433 pPage5_Buttons->SetStyle( pPage5_Buttons->GetStyle() | WB_VSCROLL );
435 pPage6_Back->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
436 pPage6_Text->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
437 pPage6_Link->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
438 pPage6_VLink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
439 pPage6_ALink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
441 pPage6_DocColors->Check();
443 FreeResource();
445 pPage3_Quality->InsertEntry( OUString( "25%" ) );
446 pPage3_Quality->InsertEntry( OUString( "50%" ) );
447 pPage3_Quality->InsertEntry( OUString( "75%" ) );
448 pPage3_Quality->InsertEntry( OUString( "100%" ) );
450 pPage5_Buttons->SetColCount( 1 );
451 pPage5_Buttons->SetLineCount( 4 );
452 pPage5_Buttons->SetExtraSpacing( 1 );
454 boost::ptr_vector<SdPublishingDesign>::iterator it;
455 for( it = m_aDesignList.begin(); it != m_aDesignList.end(); ++it )
456 pPage1_Designs->InsertEntry(it->m_aDesignName);
458 pPage6_Preview->SetBorderStyle(WINDOW_BORDER_MONO);
460 SetDefaults();
462 SetHelpId(aPageHelpIds[0]);
464 aNextPageButton.GrabFocus();
467 SdPublishingDlg::~SdPublishingDlg()
469 RemovePages();
472 // Generate dialog controls and embed them in the pages
473 void SdPublishingDlg::CreatePages()
475 // Page 1
476 aAssistentFunc.InsertControl(1,
477 pPage1_Titel = new FixedLine(this,SdResId(PAGE1_TITEL)));
478 aAssistentFunc.InsertControl(1,
479 pPage1_NewDesign = new RadioButton(this,SdResId(PAGE1_NEW_DESIGN)));
480 aAssistentFunc.InsertControl(1,
481 pPage1_OldDesign = new RadioButton(this,SdResId(PAGE1_OLD_DESIGN)));
482 aAssistentFunc.InsertControl(1,
483 pPage1_Designs = new ListBox(this,SdResId(PAGE1_DESIGNS)));
484 aAssistentFunc.InsertControl(1,
485 pPage1_DelDesign = new PushButton(this,SdResId(PAGE1_DEL_DESIGN)));
486 aAssistentFunc.InsertControl(1,
487 pPage1_Desc = new FixedText(this,SdResId(PAGE1_DESC)));
490 // Page 2
491 aAssistentFunc.InsertControl(2,
492 pPage2_Titel = new FixedLine(this,SdResId(PAGE2_TITEL )));
493 aAssistentFunc.InsertControl(2,
494 pPage2_Standard = new RadioButton(this,SdResId(PAGE2_STANDARD)));
495 aAssistentFunc.InsertControl(2,
496 pPage2_Frames = new RadioButton(this,SdResId(PAGE2_FRAMES)));
497 aAssistentFunc.InsertControl(2,
498 pPage2_Kiosk = new RadioButton(this,SdResId(PAGE2_KIOSK)));
499 aAssistentFunc.InsertControl(2,
500 pPage2_WebCast = new RadioButton(this,SdResId(PAGE2_WEBCAST)));
501 aAssistentFunc.InsertControl(2,
502 pPage2_Standard_FB = new FixedBitmap(this,SdResId(PAGE2_NOFRAMES_FB)));
503 aAssistentFunc.InsertControl(2,
504 pPage2_Frames_FB = new FixedBitmap(this,SdResId(PAGE2_FRAMES_FB)));
505 aAssistentFunc.InsertControl(2,
506 pPage2_Kiosk_FB = new FixedBitmap(this,SdResId(PAGE2_KIOSK_FB)));
507 aAssistentFunc.InsertControl(2,
508 pPage2_WebCast_FB = new FixedBitmap(this,SdResId(PAGE2_WEBCAST_FB)));
510 aAssistentFunc.InsertControl(2,
511 pPage2_Titel_Html = new FixedLine(this,SdResId(PAGE2_TITEL_HTML)));
512 aAssistentFunc.InsertControl(2,
513 pPage2_Content = new CheckBox(this,SdResId(PAGE2_CONTENT)));
514 if(m_bImpress)
515 aAssistentFunc.InsertControl(2,
516 pPage2_Notes = new CheckBox(this,SdResId(PAGE2_NOTES)));
518 aAssistentFunc.InsertControl(2,
519 pPage2_Titel_WebCast = new FixedLine(this,SdResId(PAGE2_TITEL_WEBCAST)));
520 aAssistentFunc.InsertControl(2,
521 pPage2_Index_txt = new FixedText(this,SdResId(PAGE2_INDEX_TXT)));
522 aAssistentFunc.InsertControl(2,
523 pPage2_Index = new Edit(this,SdResId(PAGE2_INDEX)));
524 aAssistentFunc.InsertControl(2,
525 pPage2_ASP = new RadioButton(this,SdResId(PAGE2_ASP)));
526 aAssistentFunc.InsertControl(2,
527 pPage2_PERL = new RadioButton(this,SdResId(PAGE2_PERL)));
528 aAssistentFunc.InsertControl(2,
529 pPage2_URL_txt = new FixedText(this,SdResId(PAGE2_URL_TXT)));
530 aAssistentFunc.InsertControl(2,
531 pPage2_URL = new Edit(this,SdResId(PAGE2_URL)));
532 aAssistentFunc.InsertControl(2,
533 pPage2_CGI_txt = new FixedText(this,SdResId(PAGE2_CGI_TXT)));
534 aAssistentFunc.InsertControl(2,
535 pPage2_CGI = new Edit(this,SdResId(PAGE2_CGI)));
536 aAssistentFunc.InsertControl(2,
537 pPage2_Vert = new FixedLine( this,SdResId( PAGE2_VERT )));
538 aAssistentFunc.InsertControl(2,
539 pPage2_Titel_Kiosk = new FixedLine(this,SdResId(PAGE2_TITEL_KIOSK)));
540 aAssistentFunc.InsertControl(2,
541 pPage2_ChgDefault = new RadioButton(this,SdResId(PAGE2_CHG_DEFAULT)));
542 aAssistentFunc.InsertControl(2,
543 pPage2_ChgAuto = new RadioButton(this,SdResId(PAGE2_CHG_AUTO)));
544 aAssistentFunc.InsertControl(2,
545 pPage2_Duration_txt = new FixedText(this,SdResId(PAGE2_DURATION_TXT)));
546 aAssistentFunc.InsertControl(2,
547 pPage2_Duration = new TimeField(this,SdResId(PAGE2_DURATION_TMF)));
548 aAssistentFunc.InsertControl(2,
549 pPage2_Endless = new CheckBox(this,SdResId(PAGE2_ENDLESS)));
551 // Page 3
552 aAssistentFunc.InsertControl(3,
553 pPage3_Titel1 = new FixedLine(this,SdResId(PAGE3_TITEL_1)));
554 aAssistentFunc.InsertControl(3,
555 pPage3_Png = new RadioButton(this,SdResId(PAGE3_PNG)));
556 aAssistentFunc.InsertControl(3,
557 pPage3_Gif = new RadioButton(this,SdResId(PAGE3_GIF)));
558 aAssistentFunc.InsertControl(3,
559 pPage3_Jpg = new RadioButton(this,SdResId(PAGE3_JPG)));
560 aAssistentFunc.InsertControl(3,
561 pPage3_Quality_txt = new FixedText(this,SdResId(PAGE3_QUALITY_TXT)));
562 aAssistentFunc.InsertControl(3,
563 pPage3_Quality = new ComboBox(this,SdResId(PAGE3_QUALITY)));
564 aAssistentFunc.InsertControl(3,
565 pPage3_Vert = new FixedLine( this,SdResId( PAGE3_VERT )));
566 aAssistentFunc.InsertControl(3,
567 pPage3_Titel2 = new FixedLine(this,SdResId(PAGE3_TITEL_2)));
568 aAssistentFunc.InsertControl(3,
569 pPage3_Resolution_1 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_1)));
570 aAssistentFunc.InsertControl(3,
571 pPage3_Resolution_2 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_2)));
572 aAssistentFunc.InsertControl(3,
573 pPage3_Resolution_3 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_3)));
574 aAssistentFunc.InsertControl(3,
575 pPage3_Titel3 = new FixedLine(this,SdResId(PAGE3_TITEL_3)));
576 aAssistentFunc.InsertControl(3,
577 pPage3_SldSound = new CheckBox(this,SdResId(PAGE3_SLD_SOUND)));
578 aAssistentFunc.InsertControl(3,
579 pPage3_HiddenSlides = new CheckBox(this,SdResId(PAGE3_HIDDEN_SLIDES)));
581 // Page 4
582 aAssistentFunc.InsertControl(4,
583 pPage4_Titel1 = new FixedLine(this,SdResId(PAGE4_TITEL_1)));
584 aAssistentFunc.InsertControl(4,
585 pPage4_Author_txt = new FixedText(this,SdResId(PAGE4_AUTHOR_TXT)));
586 aAssistentFunc.InsertControl(4,
587 pPage4_Author = new Edit(this,SdResId(PAGE4_AUTHOR)));
588 aAssistentFunc.InsertControl(4,
589 pPage4_Email_txt = new FixedText(this,SdResId(PAGE4_EMAIL_TXT)));
590 aAssistentFunc.InsertControl(4,
591 pPage4_Email = new Edit(this,SdResId(PAGE4_EMAIL_EDIT)));
592 aAssistentFunc.InsertControl(4,
593 pPage4_WWW_txt = new FixedText(this,SdResId(PAGE4_WWW_TXT)));
594 aAssistentFunc.InsertControl(4,
595 pPage4_WWW = new Edit(this,SdResId(PAGE4_WWW_EDIT)));
596 aAssistentFunc.InsertControl(4,
597 pPage4_Titel2 = new FixedText(this,SdResId(PAGE4_TITEL_2)));
598 aAssistentFunc.InsertControl(4,
599 pPage4_Misc = new MultiLineEdit(this,SdResId(PAGE4_MISC)));
600 if(m_bImpress)
601 aAssistentFunc.InsertControl(4,
602 pPage4_Download = new CheckBox(this,SdResId(PAGE4_DOWNLOAD)));
604 // Page 5
605 aAssistentFunc.InsertControl(5,
606 pPage5_Titel = new FixedLine(this,SdResId(PAGE5_TITEL)));
607 aAssistentFunc.InsertControl(5,
608 pPage5_TextOnly = new CheckBox(this, SdResId(PAGE5_TEXTONLY)));
609 aAssistentFunc.InsertControl(5,
610 pPage5_Buttons = new ValueSet(this,SdResId(PAGE5_BUTTONS)));
612 // Page 6
613 aAssistentFunc.InsertControl(6,
614 pPage6_Titel = new FixedLine(this,SdResId(PAGE6_TITEL)));
615 aAssistentFunc.InsertControl(6,
616 pPage6_DocColors = new RadioButton(this,SdResId(PAGE6_DOCCOLORS)));
617 aAssistentFunc.InsertControl(6,
618 pPage6_Default = new RadioButton(this,SdResId(PAGE6_DEFAULT)));
619 aAssistentFunc.InsertControl(6,
620 pPage6_User = new RadioButton(this,SdResId(PAGE6_USER)));
621 aAssistentFunc.InsertControl(6,
622 pPage6_Text = new PushButton(this,SdResId(PAGE6_TEXT)));
623 aAssistentFunc.InsertControl(6,
624 pPage6_Link = new PushButton(this,SdResId(PAGE6_LINK)));
625 aAssistentFunc.InsertControl(6,
626 pPage6_ALink = new PushButton(this,SdResId(PAGE6_ALINK)));
627 aAssistentFunc.InsertControl(6,
628 pPage6_VLink = new PushButton(this,SdResId(PAGE6_VLINK)));
629 aAssistentFunc.InsertControl(6,
630 pPage6_Back = new PushButton(this,SdResId(PAGE6_BACK)));
631 aAssistentFunc.InsertControl(6,
632 pPage6_Preview = new SdHtmlAttrPreview(this,SdResId(PAGE6_PREVIEW)));
634 InterpolateFixedBitmap(pPage2_Standard_FB);
635 InterpolateFixedBitmap(pPage2_Frames_FB);
636 InterpolateFixedBitmap(pPage2_Kiosk_FB);
637 InterpolateFixedBitmap(pPage2_WebCast_FB);
640 // Delete the controls of the dialog
641 void SdPublishingDlg::RemovePages()
643 delete pPage1_Titel;
644 delete pPage1_NewDesign;
645 delete pPage1_OldDesign;
646 delete pPage1_Designs;
647 delete pPage1_DelDesign;
648 delete pPage1_Desc;
650 delete pPage2_Titel;
651 delete pPage2_Standard;
652 delete pPage2_Frames;
653 delete pPage2_Kiosk;
654 delete pPage2_WebCast;
655 delete pPage2_Standard_FB;
656 delete pPage2_Frames_FB;
657 delete pPage2_Kiosk_FB;
658 delete pPage2_WebCast_FB;
660 delete pPage2_Titel_Html;
661 delete pPage2_Content;
662 if(m_bImpress)
663 delete pPage2_Notes;
665 delete pPage2_Vert;
666 delete pPage2_Titel_WebCast;
667 delete pPage2_Index_txt;
668 delete pPage2_Index;
669 delete pPage2_ASP;
670 delete pPage2_PERL;
671 delete pPage2_URL_txt;
672 delete pPage2_URL;
673 delete pPage2_CGI_txt;
674 delete pPage2_CGI;
676 delete pPage2_Titel_Kiosk;
677 delete pPage2_ChgDefault;
678 delete pPage2_ChgAuto;
679 delete pPage2_Duration_txt;
680 delete pPage2_Duration;
681 delete pPage2_Endless;
683 delete pPage3_Titel1;
684 delete pPage3_Png;
685 delete pPage3_Gif;
686 delete pPage3_Jpg;
687 delete pPage3_Quality_txt;
688 delete pPage3_Quality;
689 delete pPage3_Vert;
690 delete pPage3_Titel2;
691 delete pPage3_Resolution_1;
692 delete pPage3_Resolution_2;
693 delete pPage3_Resolution_3;
694 delete pPage3_Titel3;
695 delete pPage3_SldSound;
696 delete pPage3_HiddenSlides;
698 delete pPage4_Titel1;
699 delete pPage4_Author_txt;
700 delete pPage4_Author;
701 delete pPage4_Email_txt;
702 delete pPage4_Email;
703 delete pPage4_WWW_txt;
704 delete pPage4_WWW;
705 delete pPage4_Titel2;
706 delete pPage4_Misc;
707 if(m_bImpress)
708 delete pPage4_Download;
710 delete pPage5_Titel;
711 delete pPage5_TextOnly;
712 delete pPage5_Buttons;
714 delete pPage6_Titel;
715 delete pPage6_Default;
716 delete pPage6_User;
717 delete pPage6_Back;
718 delete pPage6_Text;
719 delete pPage6_Link;
720 delete pPage6_VLink;
721 delete pPage6_ALink;
722 delete pPage6_DocColors;
723 delete pPage6_Preview;
726 // Initialize dialog with default-values
727 void SdPublishingDlg::SetDefaults()
729 SdPublishingDesign aDefault;
730 SetDesign(&aDefault);
732 pPage1_NewDesign->Check(sal_True);
733 pPage1_OldDesign->Check(sal_False);
734 UpdatePage();
737 // Feed the SfxItemSet with the settings of the dialog
738 void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
740 std::vector< PropertyValue > aProps;
742 PropertyValue aValue;
745 // Page 2
746 aValue.Name = "PublishMode";
747 aValue.Value <<= (sal_Int32)(pPage2_Standard->IsChecked()?PUBLISH_HTML:
748 pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
749 pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:PUBLISH_WEBCAST);
750 aProps.push_back( aValue );
752 aValue.Name = "IsExportContentsPage";
753 aValue.Value <<= (sal_Bool)pPage2_Content->IsChecked();
754 aProps.push_back( aValue );
756 if(m_bImpress)
758 aValue.Name = "IsExportNotes";
759 aValue.Value <<= (sal_Bool)pPage2_Notes->IsChecked();
760 aProps.push_back( aValue );
763 if( pPage2_WebCast->IsChecked() )
765 aValue.Name = "WebCastScriptLanguage";
766 if( pPage2_ASP->IsChecked() )
767 aValue.Value <<= OUString( "asp" );
768 else
769 aValue.Value <<= OUString( "perl" );
770 aProps.push_back( aValue );
772 aValue.Name = "WebCastCGIURL";
773 aValue.Value <<= OUString( pPage2_CGI->GetText() );
774 aProps.push_back( aValue );
776 aValue.Name = "WebCastTargetURL";
777 aValue.Value <<= OUString( pPage2_URL->GetText() );
778 aProps.push_back( aValue );
780 aValue.Name = "IndexURL";
781 aValue.Value <<= OUString( pPage2_Index->GetText() );
782 aProps.push_back( aValue );
785 if( pPage2_Kiosk->IsChecked() && pPage2_ChgAuto->IsChecked() )
787 aValue.Name = "KioskSlideDuration";
788 aValue.Value <<= (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
789 aProps.push_back( aValue );
791 aValue.Name = "KioskEndless";
792 aValue.Value <<= (sal_Bool)pPage2_Endless->IsChecked();
793 aProps.push_back( aValue );
796 // Page 3
798 aValue.Name = "Width";
799 sal_Int32 nTmpWidth = 512;
800 if( pPage3_Resolution_2->IsChecked() )
801 nTmpWidth = 640;
802 else if( pPage3_Resolution_3->IsChecked() )
803 nTmpWidth = 800;
805 aValue.Value <<= nTmpWidth;
806 aProps.push_back( aValue );
808 aValue.Name = "Compression";
809 aValue.Value <<= OUString( pPage3_Quality->GetText() );
810 aProps.push_back( aValue );
812 aValue.Name = "Format";
813 sal_Int32 nFormat;
814 if( pPage3_Png->IsChecked() )
815 nFormat = static_cast<sal_Int32>(FORMAT_PNG);
816 else if( pPage3_Gif->IsChecked() )
817 nFormat = static_cast<sal_Int32>(FORMAT_GIF);
818 else
819 nFormat = static_cast<sal_Int32>(FORMAT_JPG);
820 aValue.Value <<= nFormat;
821 aProps.push_back( aValue );
823 aValue.Name = "SlideSound";
824 aValue.Value <<= pPage3_SldSound->IsChecked() ? sal_True : sal_False;
825 aProps.push_back( aValue );
827 aValue.Name = "HiddenSlides";
828 aValue.Value <<= pPage3_HiddenSlides->IsChecked() ? sal_True : sal_False;
829 aProps.push_back( aValue );
831 // Page 4
832 aValue.Name = "Author";
833 aValue.Value <<= OUString( pPage4_Author->GetText() );
834 aProps.push_back( aValue );
836 aValue.Name = "EMail";
837 aValue.Value <<= OUString( pPage4_Email->GetText() );
838 aProps.push_back( aValue );
840 // try to guess protocol for user's homepage
841 INetURLObject aHomeURL( pPage4_WWW->GetText(),
842 INET_PROT_HTTP, // default proto is HTTP
843 INetURLObject::ENCODE_ALL );
845 aValue.Name = "HomepageURL";
846 aValue.Value <<= OUString( aHomeURL.GetMainURL( INetURLObject::NO_DECODE ) );
847 aProps.push_back( aValue );
849 aValue.Name = "UserText";
850 aValue.Value <<= OUString( pPage4_Misc->GetText() );
851 aProps.push_back( aValue );
853 if( m_bImpress )
855 aValue.Name = "EnableDownload";
856 aValue.Value <<= (sal_Bool)pPage4_Download->IsChecked();
857 aProps.push_back( aValue );
860 // Page 5
861 if( !pPage5_TextOnly->IsChecked() )
863 aValue.Name = "UseButtonSet";
864 aValue.Value <<= (sal_Int32)(pPage5_Buttons->GetSelectItemId() - 1);
865 aProps.push_back( aValue );
868 // Page 6
869 if( pPage6_User->IsChecked() )
871 aValue.Name = "BackColor";
872 aValue.Value <<= (sal_Int32)m_aBackColor.GetColor();
873 aProps.push_back( aValue );
875 aValue.Name = "TextColor";
876 aValue.Value <<= (sal_Int32)m_aTextColor.GetColor();
877 aProps.push_back( aValue );
879 aValue.Name = "LinkColor";
880 aValue.Value <<= (sal_Int32)m_aLinkColor.GetColor();
881 aProps.push_back( aValue );
883 aValue.Name = "VLinkColor";
884 aValue.Value <<= (sal_Int32)m_aVLinkColor.GetColor();
885 aProps.push_back( aValue );
887 aValue.Name = "ALinkColor";
888 aValue.Value <<= (sal_Int32)m_aALinkColor.GetColor();
889 aProps.push_back( aValue );
892 if( pPage6_DocColors->IsChecked() )
894 aValue.Name = "IsUseDocumentColors";
895 aValue.Value <<= (sal_Bool)sal_True;
896 aProps.push_back( aValue );
899 rParams.realloc( aProps.size() );
900 PropertyValue* pParams = rParams.getArray();
902 for( std::vector< PropertyValue >::iterator i = aProps.begin(); i != aProps.end(); ++i )
904 *pParams++ = (*i);
908 // Clickhandler for the radiobuttons of the design-selection
909 IMPL_LINK( SdPublishingDlg, DesignHdl, RadioButton *, pButton )
911 if(pButton == pPage1_NewDesign)
913 pPage1_NewDesign->Check(sal_True); // because of DesignDeleteHdl
914 pPage1_OldDesign->Check(sal_False);
915 pPage1_Designs->Disable();
916 pPage1_DelDesign->Disable();
917 m_pDesign = NULL;
919 SdPublishingDesign aDefault;
920 SetDesign(&aDefault);
922 else
924 pPage1_NewDesign->Check(sal_False);
925 pPage1_Designs->Enable();
926 pPage1_DelDesign->Enable();
928 if(pPage1_Designs->GetSelectEntryCount() == 0)
929 pPage1_Designs->SelectEntryPos(0);
931 sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
932 m_pDesign = &m_aDesignList[nPos];
933 DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
935 if(m_pDesign)
936 SetDesign(m_pDesign);
939 return 0;
942 // Clickhandler for the choise of one design
943 IMPL_LINK_NOARG(SdPublishingDlg, DesignSelectHdl)
945 sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
946 m_pDesign = &m_aDesignList[nPos];
947 DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
949 if(m_pDesign)
950 SetDesign(m_pDesign);
952 UpdatePage();
954 return 0;
957 // Clickhandler for the delete of one design
958 IMPL_LINK_NOARG(SdPublishingDlg, DesignDeleteHdl)
960 sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
962 boost::ptr_vector<SdPublishingDesign>::iterator iter = m_aDesignList.begin()+nPos;
964 DBG_ASSERT(iter != m_aDesignList.end(), "No Design? That's not allowed (CL)");
966 pPage1_Designs->RemoveEntry(nPos);
968 if(m_pDesign == &(*iter))
969 DesignHdl( pPage1_NewDesign );
971 m_aDesignList.erase(iter);
973 m_bDesignListDirty = sal_True;
975 UpdatePage();
977 return 0;
980 // Clickhandler for the other servertypess
981 IMPL_LINK( SdPublishingDlg, WebServerHdl, RadioButton *, pButton )
983 sal_Bool bASP = pButton == pPage2_ASP;
985 pPage2_ASP->Check( bASP );
986 pPage2_PERL->Check( !bASP );
987 UpdatePage();
989 return 0;
992 // Clickhandler for the Radiobuttons of the graphicformat choice
993 IMPL_LINK( SdPublishingDlg, GfxFormatHdl, RadioButton *, pButton )
995 pPage3_Png->Check( pButton == pPage3_Png );
996 pPage3_Gif->Check( pButton == pPage3_Gif );
997 pPage3_Jpg->Check( pButton == pPage3_Jpg );
998 pPage3_Quality->Enable(pButton == pPage3_Jpg);
999 return 0;
1002 // Clickhandler for the Radiobuttons Standard/Frames
1003 IMPL_LINK_NOARG(SdPublishingDlg, BaseHdl)
1005 UpdatePage();
1007 return 0;
1010 // Clickhandler for the Checkbox of the Title page
1011 IMPL_LINK_NOARG(SdPublishingDlg, ContentHdl)
1013 if(pPage2_Content->IsChecked())
1015 if(!aAssistentFunc.IsEnabled(4))
1017 aAssistentFunc.EnablePage(4);
1018 UpdatePage();
1021 else
1023 if(aAssistentFunc.IsEnabled(4))
1025 aAssistentFunc.DisablePage(4);
1026 UpdatePage();
1029 return 0;
1032 // Clickhandler for the Resolution Radiobuttons
1033 IMPL_LINK( SdPublishingDlg, ResolutionHdl, RadioButton *, pButton )
1035 pPage3_Resolution_1->Check(pButton == pPage3_Resolution_1);
1036 pPage3_Resolution_2->Check(pButton == pPage3_Resolution_2);
1037 pPage3_Resolution_3->Check(pButton == pPage3_Resolution_3);
1039 return 0;
1042 // Clickhandler for the ValueSet with the bitmap-buttons
1043 IMPL_LINK_NOARG(SdPublishingDlg, ButtonsHdl)
1045 // if one bitmap-button is chosen, then disable TextOnly
1046 pPage5_TextOnly->Check(sal_False);
1047 return 0;
1050 // Fill the SfxItemSet with the settings of the dialog
1051 IMPL_LINK( SdPublishingDlg, ColorHdl, PushButton *, pButton)
1053 SvColorDialog aDlg(this);
1055 if(pButton == pPage6_Back)
1057 aDlg.SetColor( m_aBackColor );
1058 if(aDlg.Execute() == RET_OK )
1059 m_aBackColor = aDlg.GetColor();
1061 else if(pButton == pPage6_Text)
1063 aDlg.SetColor( m_aTextColor );
1064 if(aDlg.Execute() == RET_OK )
1065 m_aTextColor = aDlg.GetColor();
1067 else if(pButton == pPage6_Link)
1069 aDlg.SetColor( m_aLinkColor );
1070 if(aDlg.Execute() == RET_OK )
1071 m_aLinkColor = aDlg.GetColor();
1073 else if(pButton == pPage6_VLink)
1075 aDlg.SetColor( m_aVLinkColor );
1076 if(aDlg.Execute() == RET_OK )
1077 m_aVLinkColor = aDlg.GetColor();
1079 else if(pButton == pPage6_ALink)
1081 aDlg.SetColor( m_aALinkColor );
1082 if(aDlg.Execute() == RET_OK )
1083 m_aALinkColor = aDlg.GetColor();
1086 pPage6_User->Check(sal_True);
1087 pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1088 m_aVLinkColor, m_aALinkColor );
1089 pPage6_Preview->Invalidate();
1090 return 0;
1093 IMPL_LINK_NOARG(SdPublishingDlg, SlideChgHdl)
1095 UpdatePage();
1096 return 0;
1099 // Clickhandler for the Ok Button
1100 IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl)
1102 //End
1103 SdPublishingDesign* pDesign = new SdPublishingDesign();
1104 GetDesign(pDesign);
1106 sal_Bool bSave = sal_False;
1108 if(pPage1_OldDesign->IsChecked() && m_pDesign)
1110 // are there changes?
1111 if(!(*pDesign == *m_pDesign))
1112 bSave = sal_True;
1114 else
1116 SdPublishingDesign aDefaultDesign;
1117 if(!(aDefaultDesign == *pDesign))
1118 bSave = sal_True;
1121 if(bSave)
1123 String aName;
1124 if(m_pDesign)
1125 aName = m_pDesign->m_aDesignName;
1127 sal_Bool bRetry;
1130 bRetry = sal_False;
1132 SdDesignNameDlg aDlg(this, aName );
1134 if ( aDlg.Execute() == RET_OK )
1136 pDesign->m_aDesignName = aDlg.GetDesignName();
1138 boost::ptr_vector<SdPublishingDesign>::iterator iter;
1139 for (iter = m_aDesignList.begin(); iter != m_aDesignList.end(); ++iter)
1141 if (iter->m_aDesignName == pDesign->m_aDesignName)
1142 break;
1145 if (iter != m_aDesignList.end())
1147 ErrorBox aErrorBox(this, WB_YES_NO,
1148 String(SdResId(STR_PUBDLG_SAMENAME)));
1149 bRetry = aErrorBox.Execute() == RET_NO;
1151 if(!bRetry)
1152 m_aDesignList.erase(iter);
1155 if(!bRetry)
1157 m_aDesignList.push_back(pDesign);
1158 m_bDesignListDirty = sal_True;
1159 pDesign = NULL;
1163 while(bRetry);
1166 delete pDesign;
1168 if(m_bDesignListDirty)
1169 Save();
1171 EndDialog(RET_OK);
1172 return 0;
1175 // Refresh the dialogs when changing from pages
1176 void SdPublishingDlg::ChangePage()
1178 int nPage = aAssistentFunc.GetCurrentPage();
1179 SetHelpId(aPageHelpIds[nPage-1]);
1181 UpdatePage();
1183 if( aNextPageButton.IsEnabled() )
1184 aNextPageButton.GrabFocus();
1185 else
1186 aFinishButton.GrabFocus();
1189 void SdPublishingDlg::UpdatePage()
1191 aNextPageButton.Enable(!aAssistentFunc.IsLastPage());
1192 aLastPageButton.Enable(!aAssistentFunc.IsFirstPage());
1194 int nPage = aAssistentFunc.GetCurrentPage();
1196 switch( nPage )
1198 case 1:
1199 if(pPage1_NewDesign->IsChecked())
1201 pPage1_Designs->Disable();
1202 pPage1_DelDesign->Disable();
1205 if(m_aDesignList.empty())
1206 pPage1_OldDesign->Disable();
1207 break;
1208 case 2:
1209 pPage2_Frames_FB->Show(pPage2_Frames->IsChecked());
1210 pPage2_Standard_FB->Show(pPage2_Standard->IsChecked());
1211 pPage2_Kiosk_FB->Show(pPage2_Kiosk->IsChecked());
1212 pPage2_WebCast_FB->Show(pPage2_WebCast->IsChecked());
1214 if( pPage2_WebCast->IsChecked() )
1216 pPage2_Titel_WebCast->Show();
1217 pPage2_ASP->Show();
1218 pPage2_PERL->Show();
1219 pPage2_URL_txt->Show();
1220 pPage2_URL->Show();
1221 pPage2_CGI_txt->Show();
1222 pPage2_CGI->Show();
1223 pPage2_Index_txt->Show();
1224 pPage2_Index->Show();
1226 sal_Bool bPerl = pPage2_PERL->IsChecked();
1227 pPage2_Index->Enable(bPerl);
1228 pPage2_Index_txt->Enable(bPerl);
1229 pPage2_URL_txt->Enable(bPerl);
1230 pPage2_URL->Enable(bPerl);
1231 pPage2_CGI_txt->Enable(bPerl);
1232 pPage2_CGI->Enable(bPerl);
1234 else
1236 pPage2_Titel_WebCast->Hide();
1237 pPage2_ASP->Hide();
1238 pPage2_PERL->Hide();
1239 pPage2_URL_txt->Hide();
1240 pPage2_URL->Hide();
1241 pPage2_CGI_txt->Hide();
1242 pPage2_CGI->Hide();
1243 pPage2_Index->Hide();
1244 pPage2_Index_txt->Hide();
1247 if( pPage2_Kiosk->IsChecked() )
1249 pPage2_Titel_Kiosk->Show();
1250 pPage2_ChgDefault->Show();
1251 pPage2_ChgAuto->Show();
1252 pPage2_Duration_txt->Show();
1253 pPage2_Duration->Show();
1254 pPage2_Endless->Show();
1255 sal_Bool bAuto = pPage2_ChgAuto->IsChecked();
1256 pPage2_Duration->Enable(bAuto);
1257 pPage2_Endless->Enable(bAuto);
1259 else
1261 pPage2_Titel_Kiosk->Hide();
1262 pPage2_ChgDefault->Hide();
1263 pPage2_ChgAuto->Hide();
1264 pPage2_Duration->Hide();
1265 pPage2_Duration_txt->Hide();
1266 pPage2_Endless->Hide();
1269 if( pPage2_Standard->IsChecked() || pPage2_Frames->IsChecked() )
1271 pPage2_Titel_Html->Show();
1272 pPage2_Content->Show();
1273 if(m_bImpress)
1274 pPage2_Notes->Show();
1276 else
1278 pPage2_Titel_Html->Hide();
1279 pPage2_Content->Hide();
1280 if(m_bImpress)
1281 pPage2_Notes->Hide();
1283 break;
1284 case 3:
1285 if( pPage2_Kiosk->IsChecked() || pPage2_WebCast->IsChecked() )
1286 aNextPageButton.Disable();
1288 if( pPage2_WebCast->IsChecked() )
1289 pPage3_SldSound->Disable();
1291 pPage3_Quality->Enable(pPage3_Jpg->IsChecked());
1293 break;
1294 case 5:
1295 if( m_bButtonsDirty )
1296 LoadPreviewButtons();
1297 break;
1301 /** loads the html buttons from the button sets, creates a preview and fills the
1302 itemset for page 5
1304 void SdPublishingDlg::LoadPreviewButtons()
1306 if( mpButtonSet.get() )
1308 const int nButtonCount = 8;
1309 static const char *pButtonNames[nButtonCount] =
1311 "first.png",
1312 "left.png",
1313 "right.png",
1314 "last.png",
1315 "home.png",
1316 "text.png",
1317 "expand.png",
1318 "collapse.png",
1321 std::vector< OUString > aButtonNames;
1322 for( int i = 0; i < nButtonCount; ++i )
1323 aButtonNames.push_back( OUString::createFromAscii( pButtonNames[i] ) );
1325 int nSetCount = mpButtonSet->getCount();
1327 int nHeight = 32;
1328 Image aImage;
1329 for( int nSet = 0; nSet < nSetCount; ++nSet )
1331 if( mpButtonSet->getPreview( nSet, aButtonNames, aImage ) )
1333 pPage5_Buttons->InsertItem( (sal_uInt16)nSet+1, aImage );
1334 if( nHeight < aImage.GetSizePixel().Height() )
1335 nHeight = aImage.GetSizePixel().Height();
1339 pPage5_Buttons->SetItemHeight( nHeight );
1340 m_bButtonsDirty = sal_False;
1344 // Clickhandler for the Forward Button
1345 IMPL_LINK_NOARG(SdPublishingDlg, NextPageHdl)
1347 aAssistentFunc.NextPage();
1348 ChangePage();
1349 return 0;
1352 // Sets the Controlls in the dialog to the settings in the design
1353 void SdPublishingDlg::SetDesign( SdPublishingDesign* pDesign )
1355 if(!pDesign)
1356 return;
1358 pPage2_Standard->Check(pDesign->m_eMode == PUBLISH_HTML);
1359 pPage2_Frames->Check(pDesign->m_eMode == PUBLISH_FRAMES);
1360 pPage2_Kiosk->Check(pDesign->m_eMode == PUBLISH_KIOSK );
1361 pPage2_WebCast->Check(pDesign->m_eMode == PUBLISH_WEBCAST );
1363 pPage2_Content->Check(pDesign->m_bContentPage);
1364 if(pDesign->m_bContentPage)
1365 aAssistentFunc.EnablePage(4);
1366 else
1367 aAssistentFunc.DisablePage(4);
1369 if(m_bImpress)
1370 pPage2_Notes->Check(pDesign->m_bNotes);
1372 pPage2_ASP->Check(pDesign->m_eScript == SCRIPT_ASP);
1373 pPage2_PERL->Check(pDesign->m_eScript == SCRIPT_PERL);
1374 pPage2_CGI->SetText(pDesign->m_aCGI);
1375 pPage2_URL->SetText(pDesign->m_aURL);
1377 pPage2_ChgDefault->Check( !pDesign->m_bAutoSlide );
1378 pPage2_ChgAuto->Check( pDesign->m_bAutoSlide );
1380 Time aTime( Time::EMPTY );
1381 aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 );
1382 pPage2_Duration->SetTime( aTime );
1384 pPage2_Endless->Check( pDesign->m_bEndless );
1386 pPage3_Png->Check(pDesign->m_eFormat == FORMAT_PNG);
1387 pPage3_Gif->Check(pDesign->m_eFormat == FORMAT_GIF);
1388 pPage3_Jpg->Check(pDesign->m_eFormat == FORMAT_JPG);
1389 pPage3_Quality->Enable(pDesign->m_eFormat == FORMAT_JPG);
1391 pPage3_Quality->SetText(pDesign->m_aCompression);
1392 pPage3_Resolution_1->Check(pDesign->m_nResolution == PUB_LOWRES_WIDTH);
1393 pPage3_Resolution_2->Check(pDesign->m_nResolution == PUB_MEDRES_WIDTH);
1394 pPage3_Resolution_3->Check(pDesign->m_nResolution == PUB_HIGHRES_WIDTH);
1396 pPage3_SldSound->Check( pDesign->m_bSlideSound );
1397 pPage3_HiddenSlides->Check( pDesign->m_bHiddenSlides );
1399 pPage4_Author->SetText(pDesign->m_aAuthor);
1400 pPage4_Email->SetText(pDesign->m_aEMail);
1401 pPage4_WWW->SetText(pDesign->m_aWWW);
1402 pPage4_Misc->SetText(pDesign->m_aMisc);
1403 if(m_bImpress)
1404 pPage4_Download->Check(pDesign->m_bDownload);
1406 pPage5_TextOnly->Check(pDesign->m_nButtonThema == -1);
1407 if(pDesign->m_nButtonThema != -1)
1409 if(m_bButtonsDirty)
1410 LoadPreviewButtons();
1411 pPage5_Buttons->SelectItem(pDesign->m_nButtonThema + 1);
1413 else
1414 pPage5_Buttons->SetNoSelection();
1416 pPage6_User->Check(pDesign->m_bUserAttr);
1417 m_aBackColor = pDesign->m_aBackColor;
1418 m_aTextColor = pDesign->m_aTextColor;
1419 m_aLinkColor = pDesign->m_aLinkColor;
1420 m_aVLinkColor = pDesign->m_aVLinkColor;
1421 m_aALinkColor = pDesign->m_aALinkColor;
1423 pPage6_DocColors->Check(pDesign->m_bUseColor);
1425 pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1426 m_aVLinkColor, m_aALinkColor );
1427 pPage6_Preview->Invalidate();
1429 UpdatePage();
1432 // Transfer the status of the Design Dialog Controls
1433 void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign )
1435 if(!pDesign)
1436 return;
1438 pDesign->m_eMode = pPage2_Standard->IsChecked()?PUBLISH_HTML:
1439 pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
1440 pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:
1441 PUBLISH_WEBCAST;
1443 pDesign->m_bContentPage = pPage2_Content->IsChecked();
1444 if(m_bImpress)
1445 pDesign->m_bNotes = pPage2_Notes->IsChecked();
1447 if( pPage3_Gif->IsChecked() )
1448 pDesign->m_eFormat = FORMAT_GIF;
1449 else if( pPage3_Jpg->IsChecked() )
1450 pDesign->m_eFormat = FORMAT_JPG;
1451 else
1452 pDesign->m_eFormat = FORMAT_PNG;
1454 pDesign->m_aCompression = pPage3_Quality->GetText();
1456 pDesign->m_nResolution = pPage3_Resolution_1->IsChecked()?PUB_LOWRES_WIDTH:
1457 (pPage3_Resolution_2->IsChecked()?PUB_MEDRES_WIDTH:PUB_HIGHRES_WIDTH);
1459 pDesign->m_bSlideSound = pPage3_SldSound->IsChecked();
1460 pDesign->m_bHiddenSlides = pPage3_HiddenSlides->IsChecked();
1462 pDesign->m_aAuthor = pPage4_Author->GetText();
1463 pDesign->m_aEMail = pPage4_Email->GetText();
1464 pDesign->m_aWWW = pPage4_WWW->GetText();
1465 pDesign->m_aMisc = pPage4_Misc->GetText();
1466 pDesign->m_bDownload = m_bImpress?pPage4_Download->IsChecked():sal_False;
1468 if(pPage5_TextOnly->IsChecked())
1469 pDesign->m_nButtonThema = -1;
1470 else
1471 pDesign->m_nButtonThema = pPage5_Buttons->GetSelectItemId() - 1;
1473 pDesign->m_bUserAttr = pPage6_User->IsChecked();
1474 pDesign->m_aBackColor = m_aBackColor;
1475 pDesign->m_aTextColor = m_aTextColor;
1476 pDesign->m_aLinkColor = m_aLinkColor;
1477 pDesign->m_aVLinkColor = m_aVLinkColor;
1478 pDesign->m_aALinkColor = m_aALinkColor;
1479 pDesign->m_bUseColor = pPage6_DocColors->IsChecked();
1482 pDesign->m_eScript = pPage2_ASP->IsChecked()?SCRIPT_ASP:SCRIPT_PERL;
1483 pDesign->m_aCGI = pPage2_CGI->GetText();
1484 pDesign->m_aURL = pPage2_URL->GetText();
1486 pDesign->m_bAutoSlide = pPage2_ChgAuto->IsChecked();
1487 pDesign->m_nSlideDuration = (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
1488 pDesign->m_bEndless = pPage2_Endless->IsChecked();
1491 // Clickhandler for the back Button
1492 IMPL_LINK_NOARG(SdPublishingDlg, LastPageHdl)
1494 aAssistentFunc.PreviousPage();
1495 ChangePage();
1496 return 0;
1499 // Load Designs
1500 sal_Bool SdPublishingDlg::Load()
1502 m_bDesignListDirty = sal_False;
1504 INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1505 aURL.Append( OUString( "designs.sod" ) );
1507 // check if file exists, SfxMedium shows an errorbox else
1509 com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler;
1510 SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler );
1512 sal_Bool bOk = pIStm && ( pIStm->GetError() == 0);
1514 if( pIStm )
1515 delete pIStm;
1517 if( !bOk )
1518 return sal_False;
1521 SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ | STREAM_NOCREATE );
1523 SvStream* pStream = aMedium.GetInStream();
1525 if( !pStream )
1526 return( sal_False );
1528 sal_uInt16 aCheck;
1529 *pStream >> aCheck;
1531 if(aCheck != nMagic)
1532 return sal_False;
1534 SdIOCompat aIO(*pStream, STREAM_READ);
1536 sal_uInt16 nDesigns;
1537 *pStream >> nDesigns;
1539 for( sal_uInt16 nIndex = 0;
1540 pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1541 nIndex++ )
1543 SdPublishingDesign* pDesign = new SdPublishingDesign();
1544 *pStream >> *pDesign;
1546 m_aDesignList.push_back(pDesign);
1549 return( pStream->GetError() == SVSTREAM_OK );
1552 // Save Designs
1553 sal_Bool SdPublishingDlg::Save()
1555 INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1556 aURL.Append( OUString( "designs.sod" ) );
1557 SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
1558 aMedium.IsRemote();
1560 SvStream* pStream = aMedium.GetOutStream();
1562 if( !pStream )
1563 return( sal_False );
1565 sal_uInt16 aCheck = nMagic;
1566 *pStream << aCheck;
1568 // Destroys the SdIOCompat before the Stream is being destributed
1570 SdIOCompat aIO(*pStream, STREAM_WRITE, 0);
1572 sal_uInt16 nDesigns = (sal_uInt16) m_aDesignList.size();
1573 *pStream << nDesigns;
1575 for( sal_uInt16 nIndex = 0;
1576 pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1577 nIndex++ )
1578 *pStream << m_aDesignList[nIndex];
1581 aMedium.Close();
1582 aMedium.Commit();
1584 return( aMedium.GetError() == 0 );
1587 // SdDesignNameDlg Methods
1588 SdDesignNameDlg::SdDesignNameDlg(Window* pWindow, const String& aName):
1589 ModalDialog (pWindow, SdResId( DLG_DESIGNNAME )),
1590 m_aEdit (this, SdResId(EDT_NAME)),
1591 m_aBtnOK (this, SdResId(BTN_SAVE)),
1592 m_aBtnCancel (this, SdResId(BTN_NOSAVE))
1594 FreeResource();
1595 m_aEdit.SetModifyHdl(LINK(this, SdDesignNameDlg, ModifyHdl ));
1596 m_aEdit.SetText(aName);
1597 m_aBtnOK.Enable(aName.Len() != 0);
1600 String SdDesignNameDlg::GetDesignName()
1602 return m_aEdit.GetText();
1605 IMPL_LINK_NOARG(SdDesignNameDlg, ModifyHdl)
1607 m_aBtnOK.Enable(!m_aEdit.GetText().isEmpty());
1609 return 0;
1614 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */