Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
45 :
46 : #include "sdresid.hxx"
47 : #include "sdattr.hxx"
48 : #include "pubdlg.hxx"
49 : #include "htmlattr.hxx"
50 : #include "htmlex.hxx"
51 : #include "htmlpublishmode.hxx"
52 : #include "helpids.h"
53 : #include "buttonset.hxx"
54 :
55 : using namespace std;
56 : using namespace com::sun::star::uno;
57 : using namespace com::sun::star::beans;
58 :
59 : #define NOOFPAGES 6
60 :
61 : //ID for the config-data with the HTML-settings
62 : const sal_uInt16 nMagic = (sal_uInt16)0x1977;
63 :
64 : // Key for the soffice.ini
65 : #define KEY_QUALITY "JPG-EXPORT-QUALITY"
66 :
67 : // The Help-IDs of the pages
68 : const char* aPageHelpIds[NOOFPAGES] =
69 : {
70 : HID_SD_HTMLEXPORT_PAGE1,
71 : HID_SD_HTMLEXPORT_PAGE2,
72 : HID_SD_HTMLEXPORT_PAGE3,
73 : HID_SD_HTMLEXPORT_PAGE4,
74 : HID_SD_HTMLEXPORT_PAGE5,
75 : HID_SD_HTMLEXPORT_PAGE6
76 : };
77 :
78 : // This class has all the settings for the HTML-export autopilot
79 0 : class SdPublishingDesign
80 : {
81 : public:
82 : OUString m_aDesignName;
83 :
84 : HtmlPublishMode m_eMode;
85 :
86 : // special WebCast options
87 : PublishingScript m_eScript;
88 : OUString m_aCGI;
89 : OUString m_aURL;
90 :
91 : // special Kiosk options
92 : bool m_bAutoSlide;
93 : sal_uInt32 m_nSlideDuration;
94 : bool m_bEndless;
95 :
96 : // special HTML options
97 : bool m_bContentPage;
98 : bool m_bNotes;
99 :
100 : // misc options
101 : sal_uInt16 m_nResolution;
102 : OUString m_aCompression;
103 : PublishingFormat m_eFormat;
104 : bool m_bSlideSound;
105 : bool m_bHiddenSlides;
106 :
107 : // title page information
108 : OUString m_aAuthor;
109 : OUString m_aEMail;
110 : OUString m_aWWW;
111 : OUString m_aMisc;
112 : bool m_bDownload;
113 : bool m_bCreated; // not used
114 :
115 : // buttons and colorscheme
116 : sal_Int16 m_nButtonThema;
117 : bool m_bUserAttr;
118 : Color m_aBackColor;
119 : Color m_aTextColor;
120 : Color m_aLinkColor;
121 : Color m_aVLinkColor;
122 : Color m_aALinkColor;
123 : bool m_bUseAttribs;
124 : bool m_bUseColor;
125 :
126 : SdPublishingDesign();
127 :
128 : bool operator ==(const SdPublishingDesign & rDesign) const;
129 : friend SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign);
130 : friend SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDesign);
131 : };
132 :
133 : // load Default-settings
134 0 : SdPublishingDesign::SdPublishingDesign()
135 0 : : m_bCreated(false)
136 : {
137 0 : m_eMode = PUBLISH_HTML;
138 0 : m_bContentPage = true;
139 0 : m_bNotes = true;
140 :
141 0 : m_eFormat = FORMAT_PNG;
142 :
143 0 : FilterConfigItem aFilterConfigItem("Office.Common/Filter/Graphic/Export/JPG");
144 0 : sal_Int32 nCompression = aFilterConfigItem.ReadInt32( OUString( KEY_QUALITY ), 75 );
145 0 : m_aCompression = OUString::number(nCompression) + "%";
146 :
147 0 : SvtUserOptions aUserOptions;
148 :
149 0 : m_nResolution = PUB_LOWRES_WIDTH;
150 0 : m_aAuthor = aUserOptions.GetFirstName();
151 0 : if (!m_aAuthor.isEmpty() && !aUserOptions.GetLastName().isEmpty())
152 0 : m_aAuthor += " ";
153 0 : m_aAuthor += aUserOptions.GetLastName();
154 0 : m_aEMail = aUserOptions.GetEmail();
155 0 : m_bDownload = false;
156 0 : m_nButtonThema = -1;
157 :
158 0 : m_bUserAttr = false;
159 0 : m_bUseAttribs = true;
160 0 : m_bUseColor = true;
161 :
162 0 : m_aBackColor = COL_WHITE;
163 0 : m_aTextColor = COL_BLACK;
164 0 : m_aLinkColor = COL_BLUE;
165 0 : m_aVLinkColor = COL_LIGHTBLUE;
166 0 : m_aALinkColor = COL_GRAY;
167 :
168 0 : m_eScript = SCRIPT_ASP;
169 :
170 0 : m_bAutoSlide = true;
171 0 : m_nSlideDuration = 15;
172 0 : m_bEndless = true;
173 :
174 0 : m_bSlideSound = true;
175 0 : m_bHiddenSlides = false;
176 0 : }
177 :
178 : // Compares the values without paying attention to the name
179 0 : bool SdPublishingDesign::operator ==(const SdPublishingDesign & rDesign) const
180 : {
181 : return
182 : (
183 0 : m_eMode == rDesign.m_eMode &&
184 0 : m_nResolution == rDesign.m_nResolution &&
185 0 : m_aCompression == rDesign.m_aCompression &&
186 0 : m_eFormat == rDesign.m_eFormat &&
187 0 : m_bHiddenSlides == rDesign.m_bHiddenSlides &&
188 : ( // compare html options
189 0 : (m_eMode != PUBLISH_HTML && m_eMode != PUBLISH_FRAMES) ||
190 : (
191 0 : m_bContentPage == rDesign.m_bContentPage &&
192 0 : m_bNotes == rDesign.m_bNotes &&
193 0 : m_aAuthor == rDesign.m_aAuthor &&
194 0 : m_aEMail == rDesign.m_aEMail &&
195 0 : m_aWWW == rDesign.m_aWWW &&
196 0 : m_aMisc == rDesign.m_aMisc &&
197 0 : m_bDownload == rDesign.m_bDownload &&
198 0 : m_nButtonThema == rDesign.m_nButtonThema &&
199 0 : m_bUserAttr == rDesign.m_bUserAttr &&
200 0 : m_aBackColor == rDesign.m_aBackColor &&
201 0 : m_aTextColor == rDesign.m_aTextColor &&
202 0 : m_aLinkColor == rDesign.m_aLinkColor &&
203 0 : m_aVLinkColor == rDesign.m_aVLinkColor &&
204 0 : m_aALinkColor == rDesign.m_aALinkColor &&
205 0 : m_bUseAttribs == rDesign.m_bUseAttribs &&
206 0 : m_bSlideSound == rDesign.m_bSlideSound &&
207 0 : m_bUseColor == rDesign.m_bUseColor
208 : )
209 0 : ) &&
210 : ( // compare kiosk options
211 0 : (m_eMode != PUBLISH_KIOSK) ||
212 : (
213 0 : m_bAutoSlide == rDesign.m_bAutoSlide &&
214 0 : m_bSlideSound == rDesign.m_bSlideSound &&
215 : (
216 0 : !m_bAutoSlide ||
217 : (
218 0 : m_nSlideDuration == rDesign.m_nSlideDuration &&
219 0 : m_bEndless == rDesign.m_bEndless
220 : )
221 : )
222 : )
223 0 : ) &&
224 : ( // compare WebCast options
225 0 : (m_eMode != PUBLISH_WEBCAST) ||
226 : (
227 0 : m_eScript == rDesign.m_eScript &&
228 : (
229 0 : m_eScript != SCRIPT_PERL ||
230 : (
231 0 : m_aURL == rDesign.m_aURL &&
232 0 : m_aCGI == rDesign.m_aCGI
233 : )
234 : )
235 : )
236 : )
237 0 : );
238 : }
239 :
240 : // Load the design from the stream
241 0 : SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign)
242 : {
243 0 : SdIOCompat aIO(rIn, StreamMode::READ);
244 :
245 : sal_uInt16 nTemp16;
246 :
247 0 : rDesign.m_aDesignName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
248 0 : RTL_TEXTENCODING_UTF8);
249 0 : rIn.ReadUInt16( nTemp16 );
250 0 : rDesign.m_eMode = (HtmlPublishMode)nTemp16;
251 0 : rIn.ReadCharAsBool( rDesign.m_bContentPage );
252 0 : rIn.ReadCharAsBool( rDesign.m_bNotes );
253 0 : rIn.ReadUInt16( rDesign.m_nResolution );
254 0 : rDesign.m_aCompression = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
255 0 : RTL_TEXTENCODING_UTF8);
256 0 : rIn.ReadUInt16( nTemp16 );
257 0 : rDesign.m_eFormat = (PublishingFormat)nTemp16;
258 0 : rDesign.m_aAuthor = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
259 0 : RTL_TEXTENCODING_UTF8);
260 0 : rDesign.m_aEMail = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
261 0 : RTL_TEXTENCODING_UTF8);
262 0 : rDesign.m_aWWW = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
263 0 : RTL_TEXTENCODING_UTF8);
264 0 : rDesign.m_aMisc = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
265 0 : RTL_TEXTENCODING_UTF8);
266 0 : rIn.ReadCharAsBool( rDesign.m_bDownload );
267 0 : rIn.ReadCharAsBool( rDesign.m_bCreated ); // not used
268 0 : rIn.ReadInt16( rDesign.m_nButtonThema );
269 0 : rIn.ReadCharAsBool( rDesign.m_bUserAttr );
270 0 : ReadColor( rIn, rDesign.m_aBackColor );
271 0 : ReadColor( rIn, rDesign.m_aTextColor );
272 0 : ReadColor( rIn, rDesign.m_aLinkColor );
273 0 : ReadColor( rIn, rDesign.m_aVLinkColor );
274 0 : ReadColor( rIn, rDesign.m_aALinkColor );
275 0 : rIn.ReadCharAsBool( rDesign.m_bUseAttribs );
276 0 : rIn.ReadCharAsBool( rDesign.m_bUseColor );
277 :
278 0 : rIn.ReadUInt16( nTemp16 );
279 0 : rDesign.m_eScript = (PublishingScript)nTemp16;
280 0 : rDesign.m_aURL = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
281 0 : RTL_TEXTENCODING_UTF8);
282 0 : rDesign.m_aCGI = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
283 0 : RTL_TEXTENCODING_UTF8);
284 :
285 0 : rIn.ReadCharAsBool( rDesign.m_bAutoSlide );
286 0 : rIn.ReadUInt32( rDesign.m_nSlideDuration );
287 0 : rIn.ReadCharAsBool( rDesign.m_bEndless );
288 0 : rIn.ReadCharAsBool( rDesign.m_bSlideSound );
289 0 : rIn.ReadCharAsBool( rDesign.m_bHiddenSlides );
290 :
291 0 : return rIn;
292 : }
293 :
294 : // Set the design to the stream
295 0 : SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDesign)
296 : {
297 : // The last parameter is the versionnumber of the code
298 0 : SdIOCompat aIO(rOut, StreamMode::WRITE, 0);
299 :
300 : // Name
301 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aDesignName,
302 0 : RTL_TEXTENCODING_UTF8);
303 :
304 0 : rOut.WriteUInt16( rDesign.m_eMode );
305 0 : rOut.WriteBool( rDesign.m_bContentPage );
306 0 : rOut.WriteBool( rDesign.m_bNotes );
307 0 : rOut.WriteUInt16( rDesign.m_nResolution );
308 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aCompression,
309 0 : RTL_TEXTENCODING_UTF8);
310 0 : rOut.WriteUInt16( rDesign.m_eFormat );
311 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aAuthor,
312 0 : RTL_TEXTENCODING_UTF8);
313 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aEMail,
314 0 : RTL_TEXTENCODING_UTF8);
315 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aWWW,
316 0 : RTL_TEXTENCODING_UTF8);
317 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aMisc,
318 0 : RTL_TEXTENCODING_UTF8);
319 0 : rOut.WriteBool( rDesign.m_bDownload );
320 0 : rOut.WriteBool( rDesign.m_bCreated ); // not used
321 0 : rOut.WriteInt16( rDesign.m_nButtonThema );
322 0 : rOut.WriteBool( rDesign.m_bUserAttr );
323 0 : WriteColor( rOut, rDesign.m_aBackColor );
324 0 : WriteColor( rOut, rDesign.m_aTextColor );
325 0 : WriteColor( rOut, rDesign.m_aLinkColor );
326 0 : WriteColor( rOut, rDesign.m_aVLinkColor );
327 0 : WriteColor( rOut, rDesign.m_aALinkColor );
328 0 : rOut.WriteBool( rDesign.m_bUseAttribs );
329 0 : rOut.WriteBool( rDesign.m_bUseColor );
330 :
331 0 : rOut.WriteUInt16( rDesign.m_eScript );
332 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aURL,
333 0 : RTL_TEXTENCODING_UTF8);
334 : write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aCGI,
335 0 : RTL_TEXTENCODING_UTF8);
336 :
337 0 : rOut.WriteBool( rDesign.m_bAutoSlide );
338 0 : rOut.WriteUInt32( rDesign.m_nSlideDuration );
339 0 : rOut.WriteBool( rDesign.m_bEndless );
340 0 : rOut.WriteBool( rDesign.m_bSlideSound );
341 0 : rOut.WriteBool( rDesign.m_bHiddenSlides );
342 :
343 0 : return rOut;
344 : }
345 :
346 : // Dialog for the entry of the name of the design
347 : class SdDesignNameDlg : public ModalDialog
348 : {
349 : private:
350 : VclPtr<Edit> m_pEdit;
351 : VclPtr<OKButton> m_pBtnOK;
352 :
353 : public:
354 : SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName );
355 : virtual ~SdDesignNameDlg();
356 : virtual void dispose() SAL_OVERRIDE;
357 : OUString GetDesignName();
358 : DECL_LINK(ModifyHdl, void *);
359 : };
360 :
361 : // SdPublishingDlg Methods
362 :
363 0 : SdPublishingDlg::SdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType)
364 : : ModalDialog(pWindow, "PublishingDialog", "modules/simpress/ui/publishingdialog.ui")
365 0 : , mpButtonSet( new ButtonSet() )
366 : , aAssistentFunc(NOOFPAGES)
367 : , m_bButtonsDirty(true)
368 : , m_bDesignListDirty(false)
369 0 : , m_pDesign(NULL)
370 : {
371 0 : get(pLastPageButton, "lastPageButton");
372 0 : get(pNextPageButton, "nextPageButton");
373 0 : get(pFinishButton, "finishButton");
374 :
375 0 : m_bImpress = eDocType == DOCUMENT_TYPE_IMPRESS;
376 :
377 0 : Size aSize(LogicToPixel(Size(60, 50), MAP_APPFONT));
378 0 : get(pPage2_Standard_FB, "standardFBImage");
379 0 : pPage2_Standard_FB->set_width_request(aSize.Width());
380 0 : pPage2_Standard_FB->set_height_request(aSize.Height());
381 0 : get(pPage2_Frames_FB, "framesFBImage");
382 0 : pPage2_Frames_FB->set_width_request(aSize.Width());
383 0 : pPage2_Frames_FB->set_height_request(aSize.Height());
384 0 : get(pPage2_Kiosk_FB, "kioskFBImage");
385 0 : pPage2_Kiosk_FB->set_width_request(aSize.Width());
386 0 : pPage2_Kiosk_FB->set_height_request(aSize.Height());
387 0 : get(pPage2_WebCast_FB, "webCastFBImage");
388 0 : pPage2_WebCast_FB->set_width_request(aSize.Width());
389 0 : pPage2_WebCast_FB->set_height_request(aSize.Height());
390 :
391 0 : get(pPage4_Misc, "miscTextview");
392 0 : pPage4_Misc->set_height_request(pPage4_Misc->GetTextHeight() * 8);
393 0 : pPage4_Misc->set_width_request(pPage4_Misc->approximate_char_width() * 52);
394 :
395 0 : get(pPage1_Designs, "designsTreeview");
396 0 : pPage1_Designs->set_height_request(pPage4_Misc->GetTextHeight() * 8);
397 0 : pPage1_Designs->set_width_request(pPage4_Misc->approximate_char_width() * 52);
398 :
399 : //Lock down the preferred size based on the
400 : //initial max-size configuration
401 0 : aSize = get_preferred_size();
402 0 : set_width_request(aSize.Width());
403 0 : set_height_request(aSize.Height());
404 :
405 0 : CreatePages();
406 0 : Load();
407 :
408 : // sets the output page
409 0 : aAssistentFunc.GotoPage(1);
410 0 : pLastPageButton->Disable();
411 :
412 : // button assignment
413 0 : pFinishButton->SetClickHdl(LINK(this,SdPublishingDlg,FinishHdl));
414 0 : pLastPageButton->SetClickHdl(LINK(this,SdPublishingDlg,LastPageHdl));
415 0 : pNextPageButton->SetClickHdl(LINK(this,SdPublishingDlg,NextPageHdl));
416 :
417 0 : pPage1_NewDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
418 0 : pPage1_OldDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
419 0 : pPage1_Designs->SetSelectHdl(LINK(this,SdPublishingDlg,DesignSelectHdl));
420 0 : pPage1_DelDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignDeleteHdl));
421 :
422 0 : pPage2_Standard->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
423 0 : pPage2_Standard_FB->SetBorderStyle(WindowBorderStyle::MONO);
424 0 : pPage2_Frames->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
425 0 : pPage2_Frames_FB->SetBorderStyle(WindowBorderStyle::MONO);
426 0 : pPage2_SingleDocument->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
427 0 : pPage2_Kiosk->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
428 0 : pPage2_Kiosk_FB->SetBorderStyle(WindowBorderStyle::MONO);
429 0 : pPage2_WebCast->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
430 0 : pPage2_WebCast_FB->SetBorderStyle(WindowBorderStyle::MONO);
431 :
432 0 : pPage2_Content->SetClickHdl(LINK(this,SdPublishingDlg,ContentHdl));
433 :
434 0 : pPage2_ASP->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
435 0 : pPage2_PERL->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
436 0 : pPage2_Index->SetText("index" + SD_RESSTR(STR_HTMLEXP_DEFAULT_EXTENSION));
437 0 : pPage2_CGI->SetText( OUString( "/cgi-bin/" ) );
438 :
439 0 : pPage3_Png->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
440 0 : pPage3_Gif->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
441 0 : pPage3_Jpg->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
442 0 : pPage3_Quality->Enable(false);
443 :
444 0 : pPage3_Resolution_1->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
445 0 : pPage3_Resolution_2->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
446 0 : pPage3_Resolution_3->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
447 :
448 0 : pPage2_ChgDefault->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
449 0 : pPage2_ChgAuto->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
450 0 : pPage2_Duration->SetFormat( TimeFieldFormat::F_SEC );
451 :
452 0 : pPage5_Buttons->SetSelectHdl(LINK(this,SdPublishingDlg, ButtonsHdl ));
453 0 : pPage5_Buttons->SetStyle( pPage5_Buttons->GetStyle() | WB_VSCROLL );
454 :
455 0 : pPage6_Back->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
456 0 : pPage6_Text->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
457 0 : pPage6_Link->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
458 0 : pPage6_VLink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
459 0 : pPage6_ALink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
460 :
461 0 : pPage6_DocColors->Check();
462 :
463 0 : pPage3_Quality->InsertEntry( OUString( "25%" ) );
464 0 : pPage3_Quality->InsertEntry( OUString( "50%" ) );
465 0 : pPage3_Quality->InsertEntry( OUString( "75%" ) );
466 0 : pPage3_Quality->InsertEntry( OUString( "100%" ) );
467 :
468 0 : pPage5_Buttons->SetColCount( 1 );
469 0 : pPage5_Buttons->SetLineCount( 4 );
470 0 : pPage5_Buttons->SetExtraSpacing( 1 );
471 :
472 0 : boost::ptr_vector<SdPublishingDesign>::iterator it;
473 0 : for( it = m_aDesignList.begin(); it != m_aDesignList.end(); ++it )
474 0 : pPage1_Designs->InsertEntry(it->m_aDesignName);
475 :
476 0 : pPage6_Preview->SetBorderStyle(WindowBorderStyle::MONO);
477 :
478 0 : SetDefaults();
479 :
480 0 : SetHelpId(aPageHelpIds[0]);
481 :
482 0 : pNextPageButton->GrabFocus();
483 0 : }
484 :
485 0 : SdPublishingDlg::~SdPublishingDlg()
486 : {
487 0 : disposeOnce();
488 0 : }
489 :
490 0 : void SdPublishingDlg::dispose()
491 : {
492 0 : pPage1.clear();
493 0 : pPage1_Titel.clear();
494 0 : pPage1_NewDesign.clear();
495 0 : pPage1_OldDesign.clear();
496 0 : pPage1_Designs.clear();
497 0 : pPage1_DelDesign.clear();
498 0 : pPage1_Desc.clear();
499 0 : pPage2.clear();
500 0 : pPage2Frame2.clear();
501 0 : pPage2Frame3.clear();
502 0 : pPage2Frame4.clear();
503 0 : pPage2_Titel.clear();
504 0 : pPage2_Standard.clear();
505 0 : pPage2_Frames.clear();
506 0 : pPage2_SingleDocument.clear();
507 0 : pPage2_Kiosk.clear();
508 0 : pPage2_WebCast.clear();
509 0 : pPage2_Standard_FB.clear();
510 0 : pPage2_Frames_FB.clear();
511 0 : pPage2_Kiosk_FB.clear();
512 0 : pPage2_WebCast_FB.clear();
513 0 : pPage2_Titel_Html.clear();
514 0 : pPage2_Content.clear();
515 0 : pPage2_Notes.clear();
516 0 : pPage2_Titel_WebCast.clear();
517 0 : pPage2_ASP.clear();
518 0 : pPage2_PERL.clear();
519 0 : pPage2_URL_txt.clear();
520 0 : pPage2_URL.clear();
521 0 : pPage2_CGI_txt.clear();
522 0 : pPage2_CGI.clear();
523 0 : pPage2_Index_txt.clear();
524 0 : pPage2_Index.clear();
525 0 : pPage2_Titel_Kiosk.clear();
526 0 : pPage2_ChgDefault.clear();
527 0 : pPage2_ChgAuto.clear();
528 0 : pPage2_Duration_txt.clear();
529 0 : pPage2_Duration.clear();
530 0 : pPage2_Endless.clear();
531 0 : pPage3.clear();
532 0 : pPage3_Titel1.clear();
533 0 : pPage3_Png.clear();
534 0 : pPage3_Gif.clear();
535 0 : pPage3_Jpg.clear();
536 0 : pPage3_Quality_txt.clear();
537 0 : pPage3_Quality.clear();
538 0 : pPage3_Titel2.clear();
539 0 : pPage3_Resolution_1.clear();
540 0 : pPage3_Resolution_2.clear();
541 0 : pPage3_Resolution_3.clear();
542 0 : pPage3_Titel3.clear();
543 0 : pPage3_SldSound.clear();
544 0 : pPage3_HiddenSlides.clear();
545 0 : pPage4.clear();
546 0 : pPage4_Titel1.clear();
547 0 : pPage4_Author_txt.clear();
548 0 : pPage4_Author.clear();
549 0 : pPage4_Email_txt.clear();
550 0 : pPage4_Email.clear();
551 0 : pPage4_WWW_txt.clear();
552 0 : pPage4_WWW.clear();
553 0 : pPage4_Titel2.clear();
554 0 : pPage4_Misc.clear();
555 0 : pPage4_Download.clear();
556 0 : pPage5.clear();
557 0 : pPage5_Titel.clear();
558 0 : pPage5_TextOnly.clear();
559 0 : pPage5_Buttons.clear();
560 0 : pPage6.clear();
561 0 : pPage6_Titel.clear();
562 0 : pPage6_Default.clear();
563 0 : pPage6_User.clear();
564 0 : pPage6_Back.clear();
565 0 : pPage6_Text.clear();
566 0 : pPage6_Link.clear();
567 0 : pPage6_VLink.clear();
568 0 : pPage6_ALink.clear();
569 0 : pPage6_DocColors.clear();
570 0 : pPage6_Preview.clear();
571 0 : pLastPageButton.clear();
572 0 : pNextPageButton.clear();
573 0 : pFinishButton.clear();
574 0 : ModalDialog::dispose();
575 0 : }
576 :
577 :
578 : // Generate dialog controls and embed them in the pages
579 0 : void SdPublishingDlg::CreatePages()
580 : {
581 : // Page 1
582 0 : get(pPage1, "page1");
583 0 : get(pPage1_Titel, "assignLabel");
584 0 : get(pPage1_NewDesign, "newDesignRadiobutton");
585 0 : get(pPage1_OldDesign, "oldDesignRadiobutton");
586 0 : get(pPage1_DelDesign, "delDesingButton");
587 0 : get(pPage1_Desc, "descLabel");
588 0 : aAssistentFunc.InsertControl(1, pPage1);
589 0 : aAssistentFunc.InsertControl(1, pPage1_Titel);
590 0 : aAssistentFunc.InsertControl(1, pPage1_NewDesign);
591 0 : aAssistentFunc.InsertControl(1, pPage1_OldDesign);
592 0 : aAssistentFunc.InsertControl(1, pPage1_Designs);
593 0 : aAssistentFunc.InsertControl(1, pPage1_DelDesign);
594 0 : aAssistentFunc.InsertControl(1, pPage1_Desc);
595 :
596 : // Page 2
597 0 : get(pPage2, "page2");
598 0 : get(pPage2Frame2, "page2.2");
599 0 : get(pPage2Frame3, "page2.3");
600 0 : get(pPage2Frame4, "page2.4");
601 0 : get(pPage2_Titel, "publicationLabel");
602 0 : get(pPage2_Standard, "standardRadiobutton");
603 0 : get(pPage2_Frames, "framesRadiobutton");
604 0 : get(pPage2_SingleDocument, "singleDocumentRadiobutton");
605 0 : get(pPage2_Kiosk, "kioskRadiobutton");
606 0 : get(pPage2_WebCast, "webCastRadiobutton");
607 0 : aAssistentFunc.InsertControl(2, pPage2);
608 0 : aAssistentFunc.InsertControl(2, pPage2Frame2);
609 0 : aAssistentFunc.InsertControl(2, pPage2Frame3);
610 0 : aAssistentFunc.InsertControl(2, pPage2Frame4);
611 0 : aAssistentFunc.InsertControl(2, pPage2_Titel);
612 0 : aAssistentFunc.InsertControl(2, pPage2_Standard);
613 0 : aAssistentFunc.InsertControl(2, pPage2_Frames);
614 0 : aAssistentFunc.InsertControl(2, pPage2_SingleDocument);
615 0 : aAssistentFunc.InsertControl(2, pPage2_Kiosk);
616 0 : aAssistentFunc.InsertControl(2, pPage2_WebCast);
617 0 : aAssistentFunc.InsertControl(2, pPage2_Standard_FB);
618 0 : aAssistentFunc.InsertControl(2, pPage2_Frames_FB);
619 0 : aAssistentFunc.InsertControl(2, pPage2_Kiosk_FB);
620 0 : aAssistentFunc.InsertControl(2, pPage2_WebCast_FB);
621 :
622 0 : get(pPage2_Titel_Html, "htmlOptionsLabel");
623 0 : get(pPage2_Content, "contentCheckbutton");
624 0 : get(pPage2_Notes, "notesCheckbutton");
625 0 : aAssistentFunc.InsertControl(2, pPage2_Titel_Html);
626 0 : aAssistentFunc.InsertControl(2, pPage2_Content);
627 0 : if(m_bImpress)
628 0 : aAssistentFunc.InsertControl(2, pPage2_Notes);
629 :
630 0 : get(pPage2_Titel_WebCast, "webCastLabel");
631 0 : get(pPage2_ASP, "ASPRadiobutton");
632 0 : get(pPage2_PERL, "perlRadiobutton");
633 0 : get(pPage2_URL_txt, "URLTxtLabel");
634 0 : get(pPage2_URL, "URLEntry");
635 0 : get(pPage2_CGI_txt, "CGITxtLabel");
636 0 : get(pPage2_CGI, "CGIEntry");
637 0 : get(pPage2_Index_txt, "indexTxtLabel");
638 0 : get(pPage2_Index, "indexEntry");
639 0 : get(pPage2_Titel_Kiosk, "kioskLabel");
640 0 : get(pPage2_ChgDefault, "chgDefaultRadiobutton");
641 0 : get(pPage2_ChgAuto, "chgAutoRadiobutton");
642 0 : get(pPage2_Duration_txt, "durationTxtLabel");
643 0 : get(pPage2_Duration, "durationSpinbutton");
644 0 : get(pPage2_Endless, "endlessCheckbutton");
645 0 : aAssistentFunc.InsertControl(2, pPage2_Titel_WebCast);
646 0 : aAssistentFunc.InsertControl(2, pPage2_Index_txt);
647 0 : aAssistentFunc.InsertControl(2, pPage2_Index);
648 0 : aAssistentFunc.InsertControl(2, pPage2_ASP);
649 0 : aAssistentFunc.InsertControl(2, pPage2_PERL);
650 0 : aAssistentFunc.InsertControl(2, pPage2_URL_txt);
651 0 : aAssistentFunc.InsertControl(2, pPage2_URL);
652 0 : aAssistentFunc.InsertControl(2, pPage2_CGI_txt);
653 0 : aAssistentFunc.InsertControl(2, pPage2_CGI);
654 0 : aAssistentFunc.InsertControl(2, pPage2_Titel_Kiosk);
655 0 : aAssistentFunc.InsertControl(2, pPage2_ChgDefault);
656 0 : aAssistentFunc.InsertControl(2, pPage2_ChgAuto);
657 0 : aAssistentFunc.InsertControl(2, pPage2_Duration_txt);
658 0 : aAssistentFunc.InsertControl(2, pPage2_Duration);
659 0 : aAssistentFunc.InsertControl(2, pPage2_Endless);
660 :
661 : // Page 3
662 0 : get(pPage3, "page3");
663 0 : get(pPage3_Titel1, "saveImgAsLabel");
664 0 : get(pPage3_Png, "pngRadiobutton");
665 0 : get(pPage3_Gif, "gifRadiobutton");
666 0 : get(pPage3_Jpg, "jpgRadiobutton");
667 0 : get(pPage3_Quality_txt, "qualityTxtLabel");
668 0 : get(pPage3_Quality, "qualityCombobox");
669 0 : get(pPage3_Titel2, "monitorResolutionLabel");
670 0 : get(pPage3_Resolution_1, "resolution1Radiobutton");
671 0 : get(pPage3_Resolution_2, "resolution2Radiobutton");
672 0 : get(pPage3_Resolution_3, "resolution3Radiobutton");
673 0 : get(pPage3_Titel3, "effectsLabel");
674 0 : get(pPage3_SldSound, "sldSoundCheckbutton");
675 0 : get(pPage3_HiddenSlides, "hiddenSlidesCheckbutton");
676 0 : aAssistentFunc.InsertControl(3, pPage3);
677 0 : aAssistentFunc.InsertControl(3, pPage3_Titel1);
678 0 : aAssistentFunc.InsertControl(3, pPage3_Png);
679 0 : aAssistentFunc.InsertControl(3, pPage3_Gif);
680 0 : aAssistentFunc.InsertControl(3, pPage3_Jpg);
681 0 : aAssistentFunc.InsertControl(3, pPage3_Quality_txt);
682 0 : aAssistentFunc.InsertControl(3, pPage3_Quality);
683 0 : aAssistentFunc.InsertControl(3, pPage3_Titel2);
684 0 : aAssistentFunc.InsertControl(3, pPage3_Resolution_1);
685 0 : aAssistentFunc.InsertControl(3, pPage3_Resolution_2);
686 0 : aAssistentFunc.InsertControl(3, pPage3_Resolution_3);
687 0 : aAssistentFunc.InsertControl(3, pPage3_Titel3);
688 0 : aAssistentFunc.InsertControl(3, pPage3_SldSound);
689 0 : aAssistentFunc.InsertControl(3, pPage3_HiddenSlides);
690 :
691 : // Page 4
692 0 : get(pPage4, "page4");
693 0 : get(pPage4_Titel1, "infTitlePageLabel");
694 0 : get(pPage4_Author_txt, "authorTxtLabel");
695 0 : get(pPage4_Author, "authorEntry");
696 0 : get(pPage4_Email_txt, "emailTxtLabel");
697 0 : get(pPage4_Email, "emailEntry");
698 0 : get(pPage4_WWW_txt, "wwwTxtLabel");
699 0 : get(pPage4_WWW, "wwwEntry");
700 0 : get(pPage4_Titel2, "addInformLabel");
701 0 : get(pPage4_Download, "downloadCheckbutton");
702 0 : aAssistentFunc.InsertControl(4, pPage4);
703 0 : aAssistentFunc.InsertControl(4, pPage4_Titel1);
704 0 : aAssistentFunc.InsertControl(4, pPage4_Author_txt);
705 0 : aAssistentFunc.InsertControl(4, pPage4_Author);
706 0 : aAssistentFunc.InsertControl(4, pPage4_Email_txt);
707 0 : aAssistentFunc.InsertControl(4, pPage4_Email);
708 0 : aAssistentFunc.InsertControl(4, pPage4_WWW_txt);
709 0 : aAssistentFunc.InsertControl(4, pPage4_WWW);
710 0 : aAssistentFunc.InsertControl(4, pPage4_Titel2);
711 0 : aAssistentFunc.InsertControl(4, pPage4_Misc);
712 0 : if(m_bImpress)
713 0 : aAssistentFunc.InsertControl(4, pPage4_Download);
714 :
715 : // Page 5
716 0 : get(pPage5, "page5");
717 0 : get(pPage5_Titel, "buttonStyleLabel");
718 0 : get(pPage5_TextOnly, "textOnlyCheckbutton");
719 0 : get(pPage5_Buttons, "buttonsDrawingarea");
720 0 : aAssistentFunc.InsertControl(5, pPage5);
721 0 : aAssistentFunc.InsertControl(5, pPage5_Titel);
722 0 : aAssistentFunc.InsertControl(5, pPage5_TextOnly);
723 0 : aAssistentFunc.InsertControl(5, pPage5_Buttons);
724 :
725 : // Page 6
726 0 : get(pPage6, "page6");
727 0 : get(pPage6_Titel, "selectColorLabel");
728 0 : get(pPage6_Default, "defaultRadiobutton");
729 0 : get(pPage6_User, "userRadiobutton");
730 0 : get(pPage6_Back, "backButton");
731 0 : get(pPage6_Text, "textButton");
732 0 : get(pPage6_Link, "linkButton");
733 0 : get(pPage6_VLink, "vLinkButton");
734 0 : get(pPage6_ALink, "aLinkButton");
735 0 : get(pPage6_DocColors, "docColorsRadiobutton");
736 0 : get(pPage6_Preview, "previewDrawingarea");
737 0 : aAssistentFunc.InsertControl(6, pPage6);
738 0 : aAssistentFunc.InsertControl(6, pPage6_Titel);
739 0 : aAssistentFunc.InsertControl(6, pPage6_DocColors);
740 0 : aAssistentFunc.InsertControl(6, pPage6_Default);
741 0 : aAssistentFunc.InsertControl(6, pPage6_User);
742 0 : aAssistentFunc.InsertControl(6, pPage6_Text);
743 0 : aAssistentFunc.InsertControl(6, pPage6_Link);
744 0 : aAssistentFunc.InsertControl(6, pPage6_ALink);
745 0 : aAssistentFunc.InsertControl(6, pPage6_VLink);
746 0 : aAssistentFunc.InsertControl(6, pPage6_Back);
747 0 : aAssistentFunc.InsertControl(6, pPage6_Preview);
748 0 : }
749 :
750 : // Initialize dialog with default-values
751 0 : void SdPublishingDlg::SetDefaults()
752 : {
753 0 : SdPublishingDesign aDefault;
754 0 : SetDesign(&aDefault);
755 :
756 0 : pPage1_NewDesign->Check(true);
757 0 : pPage1_OldDesign->Check(false);
758 0 : UpdatePage();
759 0 : }
760 :
761 : // Feed the SfxItemSet with the settings of the dialog
762 0 : void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
763 : {
764 0 : std::vector< PropertyValue > aProps;
765 :
766 0 : PropertyValue aValue;
767 :
768 : // Page 2
769 0 : aValue.Name = "PublishMode";
770 :
771 : HtmlPublishMode ePublishMode;
772 0 : if (pPage2_Frames->IsChecked())
773 0 : ePublishMode = PUBLISH_FRAMES;
774 0 : else if (pPage2_SingleDocument->IsChecked())
775 0 : ePublishMode = PUBLISH_SINGLE_DOCUMENT;
776 0 : else if (pPage2_Kiosk->IsChecked())
777 0 : ePublishMode = PUBLISH_KIOSK;
778 0 : else if (pPage2_WebCast->IsChecked())
779 0 : ePublishMode = PUBLISH_WEBCAST;
780 : else
781 0 : ePublishMode = PUBLISH_HTML;
782 :
783 0 : aValue.Value <<= (sal_Int32) ePublishMode;
784 0 : aProps.push_back( aValue );
785 :
786 0 : aValue.Name = "IsExportContentsPage";
787 0 : aValue.Value <<= pPage2_Content->IsChecked();
788 0 : aProps.push_back( aValue );
789 :
790 0 : if(m_bImpress)
791 : {
792 0 : aValue.Name = "IsExportNotes";
793 0 : aValue.Value <<= pPage2_Notes->IsChecked();
794 0 : aProps.push_back( aValue );
795 : }
796 :
797 0 : if( pPage2_WebCast->IsChecked() )
798 : {
799 0 : aValue.Name = "WebCastScriptLanguage";
800 0 : if( pPage2_ASP->IsChecked() )
801 0 : aValue.Value <<= OUString( "asp" );
802 : else
803 0 : aValue.Value <<= OUString( "perl" );
804 0 : aProps.push_back( aValue );
805 :
806 0 : aValue.Name = "WebCastCGIURL";
807 0 : aValue.Value <<= OUString( pPage2_CGI->GetText() );
808 0 : aProps.push_back( aValue );
809 :
810 0 : aValue.Name = "WebCastTargetURL";
811 0 : aValue.Value <<= OUString( pPage2_URL->GetText() );
812 0 : aProps.push_back( aValue );
813 : }
814 0 : aValue.Name = "IndexURL";
815 0 : aValue.Value <<= OUString( pPage2_Index->GetText() );
816 0 : aProps.push_back( aValue );
817 :
818 0 : if( pPage2_Kiosk->IsChecked() && pPage2_ChgAuto->IsChecked() )
819 : {
820 0 : aValue.Name = "KioskSlideDuration";
821 0 : aValue.Value <<= (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
822 0 : aProps.push_back( aValue );
823 :
824 0 : aValue.Name = "KioskEndless";
825 0 : aValue.Value <<= pPage2_Endless->IsChecked();
826 0 : aProps.push_back( aValue );
827 : }
828 :
829 : // Page 3
830 :
831 0 : aValue.Name = "Width";
832 0 : sal_Int32 nTmpWidth = 640;
833 0 : if( pPage3_Resolution_2->IsChecked() )
834 0 : nTmpWidth = 800;
835 0 : else if( pPage3_Resolution_3->IsChecked() )
836 0 : nTmpWidth = 1024;
837 :
838 0 : aValue.Value <<= nTmpWidth;
839 0 : aProps.push_back( aValue );
840 :
841 0 : aValue.Name = "Compression";
842 0 : aValue.Value <<= OUString( pPage3_Quality->GetText() );
843 0 : aProps.push_back( aValue );
844 :
845 0 : aValue.Name = "Format";
846 : sal_Int32 nFormat;
847 0 : if( pPage3_Png->IsChecked() )
848 0 : nFormat = static_cast<sal_Int32>(FORMAT_PNG);
849 0 : else if( pPage3_Gif->IsChecked() )
850 0 : nFormat = static_cast<sal_Int32>(FORMAT_GIF);
851 : else
852 0 : nFormat = static_cast<sal_Int32>(FORMAT_JPG);
853 0 : aValue.Value <<= nFormat;
854 0 : aProps.push_back( aValue );
855 :
856 0 : aValue.Name = "SlideSound";
857 0 : aValue.Value <<= pPage3_SldSound->IsChecked() ? sal_True : sal_False;
858 0 : aProps.push_back( aValue );
859 :
860 0 : aValue.Name = "HiddenSlides";
861 0 : aValue.Value <<= pPage3_HiddenSlides->IsChecked() ? sal_True : sal_False;
862 0 : aProps.push_back( aValue );
863 :
864 : // Page 4
865 0 : aValue.Name = "Author";
866 0 : aValue.Value <<= OUString( pPage4_Author->GetText() );
867 0 : aProps.push_back( aValue );
868 :
869 0 : aValue.Name = "EMail";
870 0 : aValue.Value <<= OUString( pPage4_Email->GetText() );
871 0 : aProps.push_back( aValue );
872 :
873 : // try to guess protocol for user's homepage
874 0 : INetURLObject aHomeURL( pPage4_WWW->GetText(),
875 : INetProtocol::Http, // default proto is HTTP
876 0 : INetURLObject::ENCODE_ALL );
877 :
878 0 : aValue.Name = "HomepageURL";
879 0 : aValue.Value <<= OUString( aHomeURL.GetMainURL( INetURLObject::NO_DECODE ) );
880 0 : aProps.push_back( aValue );
881 :
882 0 : aValue.Name = "UserText";
883 0 : aValue.Value <<= OUString( pPage4_Misc->GetText() );
884 0 : aProps.push_back( aValue );
885 :
886 0 : if( m_bImpress )
887 : {
888 0 : aValue.Name = "EnableDownload";
889 0 : aValue.Value <<= pPage4_Download->IsChecked();
890 0 : aProps.push_back( aValue );
891 : }
892 :
893 : // Page 5
894 0 : if( !pPage5_TextOnly->IsChecked() )
895 : {
896 0 : aValue.Name = "UseButtonSet";
897 0 : aValue.Value <<= (sal_Int32)(pPage5_Buttons->GetSelectItemId() - 1);
898 0 : aProps.push_back( aValue );
899 : }
900 :
901 : // Page 6
902 0 : if( pPage6_User->IsChecked() )
903 : {
904 0 : aValue.Name = "BackColor";
905 0 : aValue.Value <<= (sal_Int32)m_aBackColor.GetColor();
906 0 : aProps.push_back( aValue );
907 :
908 0 : aValue.Name = "TextColor";
909 0 : aValue.Value <<= (sal_Int32)m_aTextColor.GetColor();
910 0 : aProps.push_back( aValue );
911 :
912 0 : aValue.Name = "LinkColor";
913 0 : aValue.Value <<= (sal_Int32)m_aLinkColor.GetColor();
914 0 : aProps.push_back( aValue );
915 :
916 0 : aValue.Name = "VLinkColor";
917 0 : aValue.Value <<= (sal_Int32)m_aVLinkColor.GetColor();
918 0 : aProps.push_back( aValue );
919 :
920 0 : aValue.Name = "ALinkColor";
921 0 : aValue.Value <<= (sal_Int32)m_aALinkColor.GetColor();
922 0 : aProps.push_back( aValue );
923 : }
924 :
925 0 : if( pPage6_DocColors->IsChecked() )
926 : {
927 0 : aValue.Name = "IsUseDocumentColors";
928 0 : aValue.Value <<= true;
929 0 : aProps.push_back( aValue );
930 : }
931 :
932 0 : rParams.realloc( aProps.size() );
933 0 : PropertyValue* pParams = rParams.getArray();
934 :
935 0 : for( std::vector< PropertyValue >::iterator i = aProps.begin(); i != aProps.end(); ++i )
936 : {
937 0 : *pParams++ = (*i);
938 0 : }
939 0 : }
940 :
941 : // Clickhandler for the radiobuttons of the design-selection
942 0 : IMPL_LINK( SdPublishingDlg, DesignHdl, RadioButton *, pButton )
943 : {
944 0 : if(pButton == pPage1_NewDesign)
945 : {
946 0 : pPage1_NewDesign->Check(true); // because of DesignDeleteHdl
947 0 : pPage1_OldDesign->Check(false);
948 0 : pPage1_Designs->Disable();
949 0 : pPage1_DelDesign->Disable();
950 0 : m_pDesign = NULL;
951 :
952 0 : SdPublishingDesign aDefault;
953 0 : SetDesign(&aDefault);
954 : }
955 : else
956 : {
957 0 : pPage1_NewDesign->Check(false);
958 0 : pPage1_Designs->Enable();
959 0 : pPage1_DelDesign->Enable();
960 :
961 0 : if(pPage1_Designs->GetSelectEntryCount() == 0)
962 0 : pPage1_Designs->SelectEntryPos(0);
963 :
964 0 : sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
965 0 : m_pDesign = &m_aDesignList[nPos];
966 : DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
967 :
968 0 : if(m_pDesign)
969 0 : SetDesign(m_pDesign);
970 : }
971 :
972 0 : return 0;
973 : }
974 :
975 : // Clickhandler for the choice of one design
976 0 : IMPL_LINK_NOARG(SdPublishingDlg, DesignSelectHdl)
977 : {
978 0 : sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
979 0 : m_pDesign = &m_aDesignList[nPos];
980 : DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
981 :
982 0 : if(m_pDesign)
983 0 : SetDesign(m_pDesign);
984 :
985 0 : UpdatePage();
986 :
987 0 : return 0;
988 : }
989 :
990 : // Clickhandler for the delete of one design
991 0 : IMPL_LINK_NOARG(SdPublishingDlg, DesignDeleteHdl)
992 : {
993 0 : sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
994 :
995 0 : boost::ptr_vector<SdPublishingDesign>::iterator iter = m_aDesignList.begin()+nPos;
996 :
997 : DBG_ASSERT(iter != m_aDesignList.end(), "No Design? That's not allowed (CL)");
998 :
999 0 : pPage1_Designs->RemoveEntry(nPos);
1000 :
1001 0 : if(m_pDesign == &(*iter))
1002 0 : DesignHdl( pPage1_NewDesign );
1003 :
1004 0 : m_aDesignList.erase(iter);
1005 :
1006 0 : m_bDesignListDirty = true;
1007 :
1008 0 : UpdatePage();
1009 :
1010 0 : return 0;
1011 : }
1012 :
1013 : // Clickhandler for the other servertypess
1014 0 : IMPL_LINK( SdPublishingDlg, WebServerHdl, RadioButton *, pButton )
1015 : {
1016 0 : bool bASP = pButton == pPage2_ASP;
1017 :
1018 0 : pPage2_ASP->Check( bASP );
1019 0 : pPage2_PERL->Check( !bASP );
1020 0 : UpdatePage();
1021 :
1022 0 : return 0;
1023 : }
1024 :
1025 : // Clickhandler for the Radiobuttons of the graphicformat choice
1026 0 : IMPL_LINK( SdPublishingDlg, GfxFormatHdl, RadioButton *, pButton )
1027 : {
1028 0 : pPage3_Png->Check( pButton == pPage3_Png );
1029 0 : pPage3_Gif->Check( pButton == pPage3_Gif );
1030 0 : pPage3_Jpg->Check( pButton == pPage3_Jpg );
1031 0 : pPage3_Quality->Enable(pButton == pPage3_Jpg);
1032 0 : return 0;
1033 : }
1034 :
1035 : // Clickhandler for the Radiobuttons Standard/Frames
1036 0 : IMPL_LINK_NOARG(SdPublishingDlg, BaseHdl)
1037 : {
1038 0 : UpdatePage();
1039 :
1040 0 : return 0;
1041 : }
1042 :
1043 : // Clickhandler for the Checkbox of the Title page
1044 0 : IMPL_LINK_NOARG(SdPublishingDlg, ContentHdl)
1045 : {
1046 0 : if(pPage2_Content->IsChecked())
1047 : {
1048 0 : if(!aAssistentFunc.IsEnabled(4))
1049 : {
1050 0 : aAssistentFunc.EnablePage(4);
1051 0 : UpdatePage();
1052 : }
1053 : }
1054 : else
1055 : {
1056 0 : if(aAssistentFunc.IsEnabled(4))
1057 : {
1058 0 : aAssistentFunc.DisablePage(4);
1059 0 : UpdatePage();
1060 : }
1061 : }
1062 0 : return 0;
1063 : }
1064 :
1065 : // Clickhandler for the Resolution Radiobuttons
1066 0 : IMPL_LINK( SdPublishingDlg, ResolutionHdl, RadioButton *, pButton )
1067 : {
1068 0 : pPage3_Resolution_1->Check(pButton == pPage3_Resolution_1);
1069 0 : pPage3_Resolution_2->Check(pButton == pPage3_Resolution_2);
1070 0 : pPage3_Resolution_3->Check(pButton == pPage3_Resolution_3);
1071 :
1072 0 : return 0;
1073 : }
1074 :
1075 : // Clickhandler for the ValueSet with the bitmap-buttons
1076 0 : IMPL_LINK_NOARG(SdPublishingDlg, ButtonsHdl)
1077 : {
1078 : // if one bitmap-button is chosen, then disable TextOnly
1079 0 : pPage5_TextOnly->Check(false);
1080 0 : return 0;
1081 : }
1082 :
1083 : // Fill the SfxItemSet with the settings of the dialog
1084 0 : IMPL_LINK( SdPublishingDlg, ColorHdl, PushButton *, pButton)
1085 : {
1086 0 : SvColorDialog aDlg(this);
1087 :
1088 0 : if(pButton == pPage6_Back)
1089 : {
1090 0 : aDlg.SetColor( m_aBackColor );
1091 0 : if(aDlg.Execute() == RET_OK )
1092 0 : m_aBackColor = aDlg.GetColor();
1093 : }
1094 0 : else if(pButton == pPage6_Text)
1095 : {
1096 0 : aDlg.SetColor( m_aTextColor );
1097 0 : if(aDlg.Execute() == RET_OK )
1098 0 : m_aTextColor = aDlg.GetColor();
1099 : }
1100 0 : else if(pButton == pPage6_Link)
1101 : {
1102 0 : aDlg.SetColor( m_aLinkColor );
1103 0 : if(aDlg.Execute() == RET_OK )
1104 0 : m_aLinkColor = aDlg.GetColor();
1105 : }
1106 0 : else if(pButton == pPage6_VLink)
1107 : {
1108 0 : aDlg.SetColor( m_aVLinkColor );
1109 0 : if(aDlg.Execute() == RET_OK )
1110 0 : m_aVLinkColor = aDlg.GetColor();
1111 : }
1112 0 : else if(pButton == pPage6_ALink)
1113 : {
1114 0 : aDlg.SetColor( m_aALinkColor );
1115 0 : if(aDlg.Execute() == RET_OK )
1116 0 : m_aALinkColor = aDlg.GetColor();
1117 : }
1118 :
1119 0 : pPage6_User->Check(true);
1120 : pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1121 0 : m_aVLinkColor, m_aALinkColor );
1122 0 : pPage6_Preview->Invalidate();
1123 0 : return 0;
1124 : }
1125 :
1126 0 : IMPL_LINK_NOARG(SdPublishingDlg, SlideChgHdl)
1127 : {
1128 0 : UpdatePage();
1129 0 : return 0;
1130 : }
1131 :
1132 : // Clickhandler for the Ok Button
1133 0 : IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl)
1134 : {
1135 : //End
1136 0 : SdPublishingDesign* pDesign = new SdPublishingDesign();
1137 0 : GetDesign(pDesign);
1138 :
1139 0 : bool bSave = false;
1140 :
1141 0 : if(pPage1_OldDesign->IsChecked() && m_pDesign)
1142 : {
1143 : // are there changes?
1144 0 : if(!(*pDesign == *m_pDesign))
1145 0 : bSave = true;
1146 : }
1147 : else
1148 : {
1149 0 : SdPublishingDesign aDefaultDesign;
1150 0 : if(!(aDefaultDesign == *pDesign))
1151 0 : bSave = true;
1152 : }
1153 :
1154 0 : if(bSave)
1155 : {
1156 0 : OUString aName;
1157 0 : if(m_pDesign)
1158 0 : aName = m_pDesign->m_aDesignName;
1159 :
1160 : bool bRetry;
1161 0 : do
1162 : {
1163 0 : bRetry = false;
1164 :
1165 0 : ScopedVclPtrInstance< SdDesignNameDlg > aDlg(this, aName );
1166 :
1167 0 : if ( aDlg->Execute() == RET_OK )
1168 : {
1169 0 : pDesign->m_aDesignName = aDlg->GetDesignName();
1170 :
1171 0 : boost::ptr_vector<SdPublishingDesign>::iterator iter;
1172 0 : for (iter = m_aDesignList.begin(); iter != m_aDesignList.end(); ++iter)
1173 : {
1174 0 : if (iter->m_aDesignName == pDesign->m_aDesignName)
1175 0 : break;
1176 : }
1177 :
1178 0 : if (iter != m_aDesignList.end())
1179 : {
1180 : ScopedVclPtrInstance<MessageDialog> aErrorBox(this, SD_RESSTR(STR_PUBDLG_SAMENAME),
1181 0 : VCL_MESSAGE_ERROR, VCL_BUTTONS_YES_NO);
1182 0 : bRetry = aErrorBox->Execute() == RET_NO;
1183 :
1184 0 : if(!bRetry)
1185 0 : m_aDesignList.erase(iter);
1186 : }
1187 :
1188 0 : if(!bRetry)
1189 : {
1190 0 : m_aDesignList.push_back(pDesign);
1191 0 : m_bDesignListDirty = true;
1192 0 : pDesign = NULL;
1193 : }
1194 0 : }
1195 : }
1196 0 : while(bRetry);
1197 : }
1198 :
1199 0 : delete pDesign;
1200 :
1201 0 : if(m_bDesignListDirty)
1202 0 : Save();
1203 :
1204 0 : EndDialog(RET_OK);
1205 0 : return 0;
1206 : }
1207 :
1208 : // Refresh the dialogs when changing from pages
1209 0 : void SdPublishingDlg::ChangePage()
1210 : {
1211 0 : int nPage = aAssistentFunc.GetCurrentPage();
1212 0 : SetHelpId(aPageHelpIds[nPage-1]);
1213 :
1214 0 : UpdatePage();
1215 :
1216 0 : if( pNextPageButton->IsEnabled() )
1217 0 : pNextPageButton->GrabFocus();
1218 : else
1219 0 : pFinishButton->GrabFocus();
1220 0 : }
1221 :
1222 0 : void SdPublishingDlg::UpdatePage()
1223 : {
1224 0 : pNextPageButton->Enable(!aAssistentFunc.IsLastPage());
1225 0 : pLastPageButton->Enable(!aAssistentFunc.IsFirstPage());
1226 :
1227 0 : int nPage = aAssistentFunc.GetCurrentPage();
1228 :
1229 0 : switch( nPage )
1230 : {
1231 : case 1:
1232 0 : if(pPage1_NewDesign->IsChecked())
1233 : {
1234 0 : pPage1_Designs->Disable();
1235 0 : pPage1_DelDesign->Disable();
1236 : }
1237 :
1238 0 : if(m_aDesignList.empty())
1239 0 : pPage1_OldDesign->Disable();
1240 0 : break;
1241 : case 2:
1242 0 : pPage2_Frames_FB->Show(pPage2_Frames->IsChecked());
1243 0 : pPage2_Standard_FB->Show(pPage2_Standard->IsChecked());
1244 0 : pPage2_Kiosk_FB->Show(pPage2_Kiosk->IsChecked());
1245 0 : pPage2_WebCast_FB->Show(pPage2_WebCast->IsChecked());
1246 :
1247 0 : if( pPage2_WebCast->IsChecked() )
1248 : {
1249 0 : pPage2Frame4->Show();
1250 0 : pPage2_Titel_WebCast->Show();
1251 0 : pPage2_ASP->Show();
1252 0 : pPage2_PERL->Show();
1253 0 : pPage2_URL_txt->Show();
1254 0 : pPage2_URL->Show();
1255 0 : pPage2_CGI_txt->Show();
1256 0 : pPage2_CGI->Show();
1257 0 : pPage2_Index_txt->Show();
1258 0 : pPage2_Index->Show();
1259 :
1260 0 : bool bPerl = pPage2_PERL->IsChecked();
1261 0 : pPage2_Index->Enable(bPerl);
1262 0 : pPage2_Index_txt->Enable(bPerl);
1263 0 : pPage2_URL_txt->Enable(bPerl);
1264 0 : pPage2_URL->Enable(bPerl);
1265 0 : pPage2_CGI_txt->Enable(bPerl);
1266 0 : pPage2_CGI->Enable(bPerl);
1267 : }
1268 : else
1269 : {
1270 0 : pPage2Frame4->Hide();
1271 0 : pPage2_Titel_WebCast->Hide();
1272 0 : pPage2_ASP->Hide();
1273 0 : pPage2_PERL->Hide();
1274 0 : pPage2_URL_txt->Hide();
1275 0 : pPage2_URL->Hide();
1276 0 : pPage2_CGI_txt->Hide();
1277 0 : pPage2_CGI->Hide();
1278 0 : pPage2_Index->Hide();
1279 0 : pPage2_Index_txt->Hide();
1280 : }
1281 :
1282 0 : if( pPage2_Kiosk->IsChecked() )
1283 : {
1284 0 : pPage2Frame3->Show();
1285 0 : pPage2_Titel_Kiosk->Show();
1286 0 : pPage2_ChgDefault->Show();
1287 0 : pPage2_ChgAuto->Show();
1288 0 : pPage2_Duration_txt->Show();
1289 0 : pPage2_Duration->Show();
1290 0 : pPage2_Endless->Show();
1291 0 : bool bAuto = pPage2_ChgAuto->IsChecked();
1292 0 : pPage2_Duration->Enable(bAuto);
1293 0 : pPage2_Endless->Enable(bAuto);
1294 : }
1295 : else
1296 : {
1297 0 : pPage2Frame3->Hide();
1298 0 : pPage2_Titel_Kiosk->Hide();
1299 0 : pPage2_ChgDefault->Hide();
1300 0 : pPage2_ChgAuto->Hide();
1301 0 : pPage2_Duration->Hide();
1302 0 : pPage2_Duration_txt->Hide();
1303 0 : pPage2_Endless->Hide();
1304 : }
1305 :
1306 0 : if( pPage2_Standard->IsChecked() || pPage2_Frames->IsChecked() )
1307 : {
1308 0 : pPage2Frame2->Show();
1309 0 : pPage2_Titel_Html->Show();
1310 0 : pPage2_Content->Show();
1311 0 : if(m_bImpress)
1312 0 : pPage2_Notes->Show();
1313 : }
1314 : else
1315 : {
1316 0 : pPage2Frame2->Hide();
1317 0 : pPage2_Titel_Html->Hide();
1318 0 : pPage2_Content->Hide();
1319 0 : if(m_bImpress)
1320 0 : pPage2_Notes->Hide();
1321 : }
1322 0 : break;
1323 : case 3:
1324 0 : if( pPage2_Kiosk->IsChecked() || pPage2_WebCast->IsChecked() )
1325 0 : pNextPageButton->Disable();
1326 :
1327 0 : if( pPage2_WebCast->IsChecked() )
1328 0 : pPage3_SldSound->Disable();
1329 :
1330 0 : pPage3_Quality->Enable(pPage3_Jpg->IsChecked());
1331 :
1332 0 : break;
1333 : case 5:
1334 0 : if( m_bButtonsDirty )
1335 0 : LoadPreviewButtons();
1336 0 : break;
1337 : }
1338 0 : }
1339 :
1340 : /** loads the html buttons from the button sets, creates a preview and fills the
1341 : itemset for page 5
1342 : */
1343 0 : void SdPublishingDlg::LoadPreviewButtons()
1344 : {
1345 0 : if( mpButtonSet.get() )
1346 : {
1347 0 : const int nButtonCount = 8;
1348 : static const char *pButtonNames[nButtonCount] =
1349 : {
1350 : "first.png",
1351 : "left.png",
1352 : "right.png",
1353 : "last.png",
1354 : "home.png",
1355 : "text.png",
1356 : "expand.png",
1357 : "collapse.png",
1358 : };
1359 :
1360 0 : std::vector< OUString > aButtonNames;
1361 0 : for( int i = 0; i < nButtonCount; ++i )
1362 0 : aButtonNames.push_back( OUString::createFromAscii( pButtonNames[i] ) );
1363 :
1364 0 : int nSetCount = mpButtonSet->getCount();
1365 :
1366 0 : int nHeight = 32;
1367 0 : Image aImage;
1368 0 : for( int nSet = 0; nSet < nSetCount; ++nSet )
1369 : {
1370 0 : if( mpButtonSet->getPreview( nSet, aButtonNames, aImage ) )
1371 : {
1372 0 : pPage5_Buttons->InsertItem( (sal_uInt16)nSet+1, aImage );
1373 0 : if( nHeight < aImage.GetSizePixel().Height() )
1374 0 : nHeight = aImage.GetSizePixel().Height();
1375 : }
1376 : }
1377 :
1378 0 : pPage5_Buttons->SetItemHeight( nHeight );
1379 0 : m_bButtonsDirty = false;
1380 : }
1381 0 : }
1382 :
1383 : // Clickhandler for the Forward Button
1384 0 : IMPL_LINK_NOARG(SdPublishingDlg, NextPageHdl)
1385 : {
1386 0 : aAssistentFunc.NextPage();
1387 0 : ChangePage();
1388 0 : return 0;
1389 : }
1390 :
1391 : // Sets the Controls in the dialog to the settings in the design
1392 0 : void SdPublishingDlg::SetDesign( SdPublishingDesign* pDesign )
1393 : {
1394 0 : if(!pDesign)
1395 0 : return;
1396 :
1397 0 : pPage2_Standard->Check(pDesign->m_eMode == PUBLISH_HTML);
1398 0 : pPage2_Frames->Check(pDesign->m_eMode == PUBLISH_FRAMES);
1399 0 : pPage2_Kiosk->Check(pDesign->m_eMode == PUBLISH_KIOSK );
1400 0 : pPage2_WebCast->Check(pDesign->m_eMode == PUBLISH_WEBCAST );
1401 :
1402 0 : pPage2_Content->Check(pDesign->m_bContentPage);
1403 0 : if(pDesign->m_bContentPage)
1404 0 : aAssistentFunc.EnablePage(4);
1405 : else
1406 0 : aAssistentFunc.DisablePage(4);
1407 :
1408 0 : if(m_bImpress)
1409 0 : pPage2_Notes->Check(pDesign->m_bNotes);
1410 :
1411 0 : pPage2_ASP->Check(pDesign->m_eScript == SCRIPT_ASP);
1412 0 : pPage2_PERL->Check(pDesign->m_eScript == SCRIPT_PERL);
1413 0 : pPage2_CGI->SetText(pDesign->m_aCGI);
1414 0 : pPage2_URL->SetText(pDesign->m_aURL);
1415 :
1416 0 : pPage2_ChgDefault->Check( !pDesign->m_bAutoSlide );
1417 0 : pPage2_ChgAuto->Check( pDesign->m_bAutoSlide );
1418 :
1419 0 : tools::Time aTime( tools::Time::EMPTY );
1420 0 : aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 );
1421 0 : pPage2_Duration->SetTime( aTime );
1422 :
1423 0 : pPage2_Endless->Check( pDesign->m_bEndless );
1424 :
1425 0 : pPage3_Png->Check(pDesign->m_eFormat == FORMAT_PNG);
1426 0 : pPage3_Gif->Check(pDesign->m_eFormat == FORMAT_GIF);
1427 0 : pPage3_Jpg->Check(pDesign->m_eFormat == FORMAT_JPG);
1428 0 : pPage3_Quality->Enable(pDesign->m_eFormat == FORMAT_JPG);
1429 :
1430 0 : pPage3_Quality->SetText(pDesign->m_aCompression);
1431 0 : pPage3_Resolution_1->Check(pDesign->m_nResolution == PUB_LOWRES_WIDTH);
1432 0 : pPage3_Resolution_2->Check(pDesign->m_nResolution == PUB_MEDRES_WIDTH);
1433 0 : pPage3_Resolution_3->Check(pDesign->m_nResolution == PUB_HIGHRES_WIDTH);
1434 :
1435 0 : pPage3_SldSound->Check( pDesign->m_bSlideSound );
1436 0 : pPage3_HiddenSlides->Check( pDesign->m_bHiddenSlides );
1437 :
1438 0 : pPage4_Author->SetText(pDesign->m_aAuthor);
1439 0 : pPage4_Email->SetText(pDesign->m_aEMail);
1440 0 : pPage4_WWW->SetText(pDesign->m_aWWW);
1441 0 : pPage4_Misc->SetText(pDesign->m_aMisc);
1442 0 : if(m_bImpress)
1443 0 : pPage4_Download->Check(pDesign->m_bDownload);
1444 :
1445 0 : pPage5_TextOnly->Check(pDesign->m_nButtonThema == -1);
1446 0 : if(pDesign->m_nButtonThema != -1)
1447 : {
1448 0 : if(m_bButtonsDirty)
1449 0 : LoadPreviewButtons();
1450 0 : pPage5_Buttons->SelectItem(pDesign->m_nButtonThema + 1);
1451 : }
1452 : else
1453 0 : pPage5_Buttons->SetNoSelection();
1454 :
1455 0 : pPage6_User->Check(pDesign->m_bUserAttr);
1456 0 : m_aBackColor = pDesign->m_aBackColor;
1457 0 : m_aTextColor = pDesign->m_aTextColor;
1458 0 : m_aLinkColor = pDesign->m_aLinkColor;
1459 0 : m_aVLinkColor = pDesign->m_aVLinkColor;
1460 0 : m_aALinkColor = pDesign->m_aALinkColor;
1461 :
1462 0 : pPage6_DocColors->Check(pDesign->m_bUseColor);
1463 :
1464 : pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1465 0 : m_aVLinkColor, m_aALinkColor );
1466 0 : pPage6_Preview->Invalidate();
1467 :
1468 0 : UpdatePage();
1469 : }
1470 :
1471 : // Transfer the status of the Design Dialog Controls
1472 0 : void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign )
1473 : {
1474 0 : if(!pDesign)
1475 0 : return;
1476 :
1477 0 : pDesign->m_eMode = pPage2_Standard->IsChecked()?PUBLISH_HTML:
1478 0 : pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
1479 0 : pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:
1480 0 : PUBLISH_WEBCAST;
1481 :
1482 0 : pDesign->m_bContentPage = pPage2_Content->IsChecked();
1483 0 : if(m_bImpress)
1484 0 : pDesign->m_bNotes = pPage2_Notes->IsChecked();
1485 :
1486 0 : if( pPage3_Gif->IsChecked() )
1487 0 : pDesign->m_eFormat = FORMAT_GIF;
1488 0 : else if( pPage3_Jpg->IsChecked() )
1489 0 : pDesign->m_eFormat = FORMAT_JPG;
1490 : else
1491 0 : pDesign->m_eFormat = FORMAT_PNG;
1492 :
1493 0 : pDesign->m_aCompression = pPage3_Quality->GetText();
1494 :
1495 0 : pDesign->m_nResolution = pPage3_Resolution_1->IsChecked()?PUB_LOWRES_WIDTH:
1496 0 : (pPage3_Resolution_2->IsChecked()?PUB_MEDRES_WIDTH:PUB_HIGHRES_WIDTH);
1497 :
1498 0 : pDesign->m_bSlideSound = pPage3_SldSound->IsChecked();
1499 0 : pDesign->m_bHiddenSlides = pPage3_HiddenSlides->IsChecked();
1500 :
1501 0 : pDesign->m_aAuthor = pPage4_Author->GetText();
1502 0 : pDesign->m_aEMail = pPage4_Email->GetText();
1503 0 : pDesign->m_aWWW = pPage4_WWW->GetText();
1504 0 : pDesign->m_aMisc = pPage4_Misc->GetText();
1505 0 : pDesign->m_bDownload = m_bImpress && pPage4_Download->IsChecked();
1506 :
1507 0 : if(pPage5_TextOnly->IsChecked())
1508 0 : pDesign->m_nButtonThema = -1;
1509 : else
1510 0 : pDesign->m_nButtonThema = pPage5_Buttons->GetSelectItemId() - 1;
1511 :
1512 0 : pDesign->m_bUserAttr = pPage6_User->IsChecked();
1513 0 : pDesign->m_aBackColor = m_aBackColor;
1514 0 : pDesign->m_aTextColor = m_aTextColor;
1515 0 : pDesign->m_aLinkColor = m_aLinkColor;
1516 0 : pDesign->m_aVLinkColor = m_aVLinkColor;
1517 0 : pDesign->m_aALinkColor = m_aALinkColor;
1518 0 : pDesign->m_bUseColor = pPage6_DocColors->IsChecked();
1519 :
1520 0 : pDesign->m_eScript = pPage2_ASP->IsChecked()?SCRIPT_ASP:SCRIPT_PERL;
1521 0 : pDesign->m_aCGI = pPage2_CGI->GetText();
1522 0 : pDesign->m_aURL = pPage2_URL->GetText();
1523 :
1524 0 : pDesign->m_bAutoSlide = pPage2_ChgAuto->IsChecked();
1525 0 : pDesign->m_nSlideDuration = (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
1526 0 : pDesign->m_bEndless = pPage2_Endless->IsChecked();
1527 : }
1528 :
1529 : // Clickhandler for the back Button
1530 0 : IMPL_LINK_NOARG(SdPublishingDlg, LastPageHdl)
1531 : {
1532 0 : aAssistentFunc.PreviousPage();
1533 0 : ChangePage();
1534 0 : return 0;
1535 : }
1536 :
1537 : // Load Designs
1538 0 : bool SdPublishingDlg::Load()
1539 : {
1540 0 : m_bDesignListDirty = false;
1541 :
1542 0 : INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1543 0 : aURL.Append( OUString( "designs.sod" ) );
1544 :
1545 : // check if file exists, SfxMedium shows an errorbox else
1546 : {
1547 0 : com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler;
1548 0 : SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::READ, xHandler );
1549 :
1550 0 : bool bOk = pIStm && ( pIStm->GetError() == 0);
1551 :
1552 0 : if( pIStm )
1553 0 : delete pIStm;
1554 :
1555 0 : if( !bOk )
1556 0 : return false;
1557 : }
1558 :
1559 0 : SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::READ | StreamMode::NOCREATE );
1560 :
1561 0 : SvStream* pStream = aMedium.GetInStream();
1562 :
1563 0 : if( !pStream )
1564 0 : return false;
1565 :
1566 : sal_uInt16 aCheck;
1567 0 : pStream->ReadUInt16( aCheck );
1568 :
1569 0 : if(aCheck != nMagic)
1570 0 : return false;
1571 :
1572 0 : SdIOCompat aIO(*pStream, StreamMode::READ);
1573 :
1574 : sal_uInt16 nDesigns;
1575 0 : pStream->ReadUInt16( nDesigns );
1576 :
1577 0 : for( sal_uInt16 nIndex = 0;
1578 0 : pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1579 : nIndex++ )
1580 : {
1581 0 : SdPublishingDesign* pDesign = new SdPublishingDesign();
1582 0 : *pStream >> *pDesign;
1583 :
1584 0 : m_aDesignList.push_back(pDesign);
1585 : }
1586 :
1587 0 : return( pStream->GetError() == SVSTREAM_OK );
1588 : }
1589 :
1590 : // Save Designs
1591 0 : bool SdPublishingDlg::Save()
1592 : {
1593 0 : INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1594 0 : aURL.Append( OUString( "designs.sod" ) );
1595 0 : SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::WRITE | StreamMode::TRUNC );
1596 :
1597 0 : SvStream* pStream = aMedium.GetOutStream();
1598 :
1599 0 : if( !pStream )
1600 0 : return false;
1601 :
1602 0 : sal_uInt16 aCheck = nMagic;
1603 0 : pStream->WriteUInt16( aCheck );
1604 :
1605 : // Destroys the SdIOCompat before the Stream is being destributed
1606 : {
1607 0 : SdIOCompat aIO(*pStream, StreamMode::WRITE, 0);
1608 :
1609 0 : sal_uInt16 nDesigns = (sal_uInt16) m_aDesignList.size();
1610 0 : pStream->WriteUInt16( nDesigns );
1611 :
1612 0 : for( sal_uInt16 nIndex = 0;
1613 0 : pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1614 : nIndex++ )
1615 0 : WriteSdPublishingDesign( *pStream, m_aDesignList[nIndex] );
1616 : }
1617 :
1618 0 : aMedium.Close();
1619 0 : aMedium.Commit();
1620 :
1621 0 : return( aMedium.GetError() == 0 );
1622 : }
1623 :
1624 : // SdDesignNameDlg Methods
1625 0 : SdDesignNameDlg::SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName)
1626 0 : : ModalDialog(pWindow, "NameDesignDialog", "modules/sdraw/ui/namedesign.ui")
1627 : {
1628 0 : get(m_pEdit, "entry");
1629 0 : get(m_pBtnOK, "ok");
1630 0 : m_pEdit->SetModifyHdl(LINK(this, SdDesignNameDlg, ModifyHdl ));
1631 0 : m_pEdit->SetText(aName);
1632 0 : m_pBtnOK->Enable(!aName.isEmpty());
1633 0 : }
1634 :
1635 0 : SdDesignNameDlg::~SdDesignNameDlg()
1636 : {
1637 0 : disposeOnce();
1638 0 : }
1639 :
1640 0 : void SdDesignNameDlg::dispose()
1641 : {
1642 0 : m_pEdit.clear();
1643 0 : m_pBtnOK.clear();
1644 0 : ModalDialog::dispose();
1645 0 : }
1646 :
1647 0 : OUString SdDesignNameDlg::GetDesignName()
1648 : {
1649 0 : return m_pEdit->GetText();
1650 : }
1651 :
1652 0 : IMPL_LINK_NOARG(SdDesignNameDlg, ModifyHdl)
1653 : {
1654 0 : m_pBtnOK->Enable(!m_pEdit->GetText().isEmpty());
1655 :
1656 0 : return 0;
1657 0 : }
1658 :
1659 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|