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, STREAM_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, STREAM_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.WriteUChar( rDesign.m_bContentPage );
306 0 : rOut.WriteUChar( 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.WriteUChar( rDesign.m_bDownload );
320 0 : rOut.WriteUChar( rDesign.m_bCreated ); // not used
321 0 : rOut.WriteInt16( rDesign.m_nButtonThema );
322 0 : rOut.WriteUChar( 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.WriteUChar( rDesign.m_bUseAttribs );
329 0 : rOut.WriteUChar( 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.WriteUChar( rDesign.m_bAutoSlide );
338 0 : rOut.WriteUInt32( rDesign.m_nSlideDuration );
339 0 : rOut.WriteUChar( rDesign.m_bEndless );
340 0 : rOut.WriteUChar( rDesign.m_bSlideSound );
341 0 : rOut.WriteUChar( rDesign.m_bHiddenSlides );
342 :
343 0 : return rOut;
344 : }
345 :
346 : // Dialog for the entry of the name of the design
347 0 : class SdDesignNameDlg : public ModalDialog
348 : {
349 : private:
350 : Edit* m_pEdit;
351 : OKButton* m_pBtnOK;
352 :
353 : public:
354 : SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName );
355 :
356 : OUString GetDesignName();
357 : DECL_LINK(ModifyHdl, void *);
358 : };
359 :
360 : // SdPublishingDlg Methods
361 :
362 0 : SdPublishingDlg::SdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType)
363 : : ModalDialog(pWindow, "PublishingDialog", "modules/simpress/ui/publishingdialog.ui")
364 0 : , mpButtonSet( new ButtonSet() )
365 : , aAssistentFunc(NOOFPAGES)
366 : , m_bButtonsDirty(true)
367 : , m_bDesignListDirty(false)
368 0 : , m_pDesign(NULL)
369 : {
370 0 : get(pLastPageButton, "lastPageButton");
371 0 : get(pNextPageButton, "nextPageButton");
372 0 : get(pFinishButton, "finishButton");
373 :
374 0 : m_bImpress = eDocType == DOCUMENT_TYPE_IMPRESS;
375 :
376 0 : Size aSize(LogicToPixel(Size(60, 50), MAP_APPFONT));
377 0 : get(pPage2_Standard_FB, "standardFBImage");
378 0 : pPage2_Standard_FB->set_width_request(aSize.Width());
379 0 : pPage2_Standard_FB->set_height_request(aSize.Height());
380 0 : get(pPage2_Frames_FB, "framesFBImage");
381 0 : pPage2_Frames_FB->set_width_request(aSize.Width());
382 0 : pPage2_Frames_FB->set_height_request(aSize.Height());
383 0 : get(pPage2_Kiosk_FB, "kioskFBImage");
384 0 : pPage2_Kiosk_FB->set_width_request(aSize.Width());
385 0 : pPage2_Kiosk_FB->set_height_request(aSize.Height());
386 0 : get(pPage2_WebCast_FB, "webCastFBImage");
387 0 : pPage2_WebCast_FB->set_width_request(aSize.Width());
388 0 : pPage2_WebCast_FB->set_height_request(aSize.Height());
389 :
390 0 : get(pPage4_Misc, "miscTextview");
391 0 : pPage4_Misc->set_height_request(pPage4_Misc->GetTextHeight() * 8);
392 0 : pPage4_Misc->set_width_request(pPage4_Misc->approximate_char_width() * 52);
393 :
394 0 : get(pPage1_Designs, "designsTreeview");
395 0 : pPage1_Designs->set_height_request(pPage4_Misc->GetTextHeight() * 8);
396 0 : pPage1_Designs->set_width_request(pPage4_Misc->approximate_char_width() * 52);
397 :
398 : //Lock down the preferred size based on the
399 : //initial max-size configuration
400 0 : aSize = get_preferred_size();
401 0 : set_width_request(aSize.Width());
402 0 : set_height_request(aSize.Height());
403 :
404 0 : CreatePages();
405 0 : Load();
406 :
407 : // sets the output page
408 0 : aAssistentFunc.GotoPage(1);
409 0 : pLastPageButton->Disable();
410 :
411 : // button assignment
412 0 : pFinishButton->SetClickHdl(LINK(this,SdPublishingDlg,FinishHdl));
413 0 : pLastPageButton->SetClickHdl(LINK(this,SdPublishingDlg,LastPageHdl));
414 0 : pNextPageButton->SetClickHdl(LINK(this,SdPublishingDlg,NextPageHdl));
415 :
416 0 : pPage1_NewDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
417 0 : pPage1_OldDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl));
418 0 : pPage1_Designs->SetSelectHdl(LINK(this,SdPublishingDlg,DesignSelectHdl));
419 0 : pPage1_DelDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignDeleteHdl));
420 :
421 0 : pPage2_Standard->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
422 0 : pPage2_Standard_FB->SetBorderStyle(WindowBorderStyle::MONO);
423 0 : pPage2_Frames->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
424 0 : pPage2_Frames_FB->SetBorderStyle(WindowBorderStyle::MONO);
425 0 : pPage2_SingleDocument->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
426 0 : pPage2_Kiosk->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
427 0 : pPage2_Kiosk_FB->SetBorderStyle(WindowBorderStyle::MONO);
428 0 : pPage2_WebCast->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl));
429 0 : pPage2_WebCast_FB->SetBorderStyle(WindowBorderStyle::MONO);
430 :
431 0 : pPage2_Content->SetClickHdl(LINK(this,SdPublishingDlg,ContentHdl));
432 :
433 0 : pPage2_ASP->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
434 0 : pPage2_PERL->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl));
435 0 : pPage2_Index->SetText("index" + SD_RESSTR(STR_HTMLEXP_DEFAULT_EXTENSION));
436 0 : pPage2_CGI->SetText( OUString( "/cgi-bin/" ) );
437 :
438 0 : pPage3_Png->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
439 0 : pPage3_Gif->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
440 0 : pPage3_Jpg->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl));
441 0 : pPage3_Quality->Enable(false);
442 :
443 0 : pPage3_Resolution_1->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
444 0 : pPage3_Resolution_2->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
445 0 : pPage3_Resolution_3->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl ));
446 :
447 0 : pPage2_ChgDefault->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
448 0 : pPage2_ChgAuto->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl));
449 0 : pPage2_Duration->SetFormat( TimeFieldFormat::F_SEC );
450 :
451 0 : pPage5_Buttons->SetSelectHdl(LINK(this,SdPublishingDlg, ButtonsHdl ));
452 0 : pPage5_Buttons->SetStyle( pPage5_Buttons->GetStyle() | WB_VSCROLL );
453 :
454 0 : pPage6_Back->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
455 0 : pPage6_Text->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
456 0 : pPage6_Link->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
457 0 : pPage6_VLink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
458 0 : pPage6_ALink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl ));
459 :
460 0 : pPage6_DocColors->Check();
461 :
462 0 : pPage3_Quality->InsertEntry( OUString( "25%" ) );
463 0 : pPage3_Quality->InsertEntry( OUString( "50%" ) );
464 0 : pPage3_Quality->InsertEntry( OUString( "75%" ) );
465 0 : pPage3_Quality->InsertEntry( OUString( "100%" ) );
466 :
467 0 : pPage5_Buttons->SetColCount( 1 );
468 0 : pPage5_Buttons->SetLineCount( 4 );
469 0 : pPage5_Buttons->SetExtraSpacing( 1 );
470 :
471 0 : boost::ptr_vector<SdPublishingDesign>::iterator it;
472 0 : for( it = m_aDesignList.begin(); it != m_aDesignList.end(); ++it )
473 0 : pPage1_Designs->InsertEntry(it->m_aDesignName);
474 :
475 0 : pPage6_Preview->SetBorderStyle(WindowBorderStyle::MONO);
476 :
477 0 : SetDefaults();
478 :
479 0 : SetHelpId(aPageHelpIds[0]);
480 :
481 0 : pNextPageButton->GrabFocus();
482 0 : }
483 :
484 0 : SdPublishingDlg::~SdPublishingDlg()
485 : {
486 0 : }
487 :
488 : // Generate dialog controls and embed them in the pages
489 0 : void SdPublishingDlg::CreatePages()
490 : {
491 : // Page 1
492 0 : get(pPage1, "page1");
493 0 : get(pPage1_Titel, "assignLabel");
494 0 : get(pPage1_NewDesign, "newDesignRadiobutton");
495 0 : get(pPage1_OldDesign, "oldDesignRadiobutton");
496 0 : get(pPage1_DelDesign, "delDesingButton");
497 0 : get(pPage1_Desc, "descLabel");
498 0 : aAssistentFunc.InsertControl(1, pPage1);
499 0 : aAssistentFunc.InsertControl(1, pPage1_Titel);
500 0 : aAssistentFunc.InsertControl(1, pPage1_NewDesign);
501 0 : aAssistentFunc.InsertControl(1, pPage1_OldDesign);
502 0 : aAssistentFunc.InsertControl(1, pPage1_Designs);
503 0 : aAssistentFunc.InsertControl(1, pPage1_DelDesign);
504 0 : aAssistentFunc.InsertControl(1, pPage1_Desc);
505 :
506 : // Page 2
507 0 : get(pPage2, "page2");
508 0 : get(pPage2Frame2, "page2.2");
509 0 : get(pPage2Frame3, "page2.3");
510 0 : get(pPage2Frame4, "page2.4");
511 0 : get(pPage2_Titel, "publicationLabel");
512 0 : get(pPage2_Standard, "standardRadiobutton");
513 0 : get(pPage2_Frames, "framesRadiobutton");
514 0 : get(pPage2_SingleDocument, "singleDocumentRadiobutton");
515 0 : get(pPage2_Kiosk, "kioskRadiobutton");
516 0 : get(pPage2_WebCast, "webCastRadiobutton");
517 0 : aAssistentFunc.InsertControl(2, pPage2);
518 0 : aAssistentFunc.InsertControl(2, pPage2Frame2);
519 0 : aAssistentFunc.InsertControl(2, pPage2Frame3);
520 0 : aAssistentFunc.InsertControl(2, pPage2Frame4);
521 0 : aAssistentFunc.InsertControl(2, pPage2_Titel);
522 0 : aAssistentFunc.InsertControl(2, pPage2_Standard);
523 0 : aAssistentFunc.InsertControl(2, pPage2_Frames);
524 0 : aAssistentFunc.InsertControl(2, pPage2_SingleDocument);
525 0 : aAssistentFunc.InsertControl(2, pPage2_Kiosk);
526 0 : aAssistentFunc.InsertControl(2, pPage2_WebCast);
527 0 : aAssistentFunc.InsertControl(2, pPage2_Standard_FB);
528 0 : aAssistentFunc.InsertControl(2, pPage2_Frames_FB);
529 0 : aAssistentFunc.InsertControl(2, pPage2_Kiosk_FB);
530 0 : aAssistentFunc.InsertControl(2, pPage2_WebCast_FB);
531 :
532 0 : get(pPage2_Titel_Html, "htmlOptionsLabel");
533 0 : get(pPage2_Content, "contentCheckbutton");
534 0 : get(pPage2_Notes, "notesCheckbutton");
535 0 : aAssistentFunc.InsertControl(2, pPage2_Titel_Html);
536 0 : aAssistentFunc.InsertControl(2, pPage2_Content);
537 0 : if(m_bImpress)
538 0 : aAssistentFunc.InsertControl(2, pPage2_Notes);
539 :
540 0 : get(pPage2_Titel_WebCast, "webCastLabel");
541 0 : get(pPage2_ASP, "ASPRadiobutton");
542 0 : get(pPage2_PERL, "perlRadiobutton");
543 0 : get(pPage2_URL_txt, "URLTxtLabel");
544 0 : get(pPage2_URL, "URLEntry");
545 0 : get(pPage2_CGI_txt, "CGITxtLabel");
546 0 : get(pPage2_CGI, "CGIEntry");
547 0 : get(pPage2_Index_txt, "indexTxtLabel");
548 0 : get(pPage2_Index, "indexEntry");
549 0 : get(pPage2_Titel_Kiosk, "kioskLabel");
550 0 : get(pPage2_ChgDefault, "chgDefaultRadiobutton");
551 0 : get(pPage2_ChgAuto, "chgAutoRadiobutton");
552 0 : get(pPage2_Duration_txt, "durationTxtLabel");
553 0 : get(pPage2_Duration, "durationSpinbutton");
554 0 : get(pPage2_Endless, "endlessCheckbutton");
555 0 : aAssistentFunc.InsertControl(2, pPage2_Titel_WebCast);
556 0 : aAssistentFunc.InsertControl(2, pPage2_Index_txt);
557 0 : aAssistentFunc.InsertControl(2, pPage2_Index);
558 0 : aAssistentFunc.InsertControl(2, pPage2_ASP);
559 0 : aAssistentFunc.InsertControl(2, pPage2_PERL);
560 0 : aAssistentFunc.InsertControl(2, pPage2_URL_txt);
561 0 : aAssistentFunc.InsertControl(2, pPage2_URL);
562 0 : aAssistentFunc.InsertControl(2, pPage2_CGI_txt);
563 0 : aAssistentFunc.InsertControl(2, pPage2_CGI);
564 0 : aAssistentFunc.InsertControl(2, pPage2_Titel_Kiosk);
565 0 : aAssistentFunc.InsertControl(2, pPage2_ChgDefault);
566 0 : aAssistentFunc.InsertControl(2, pPage2_ChgAuto);
567 0 : aAssistentFunc.InsertControl(2, pPage2_Duration_txt);
568 0 : aAssistentFunc.InsertControl(2, pPage2_Duration);
569 0 : aAssistentFunc.InsertControl(2, pPage2_Endless);
570 :
571 : // Page 3
572 0 : get(pPage3, "page3");
573 0 : get(pPage3_Titel1, "saveImgAsLabel");
574 0 : get(pPage3_Png, "pngRadiobutton");
575 0 : get(pPage3_Gif, "gifRadiobutton");
576 0 : get(pPage3_Jpg, "jpgRadiobutton");
577 0 : get(pPage3_Quality_txt, "qualityTxtLabel");
578 0 : get(pPage3_Quality, "qualityCombobox");
579 0 : get(pPage3_Titel2, "monitorResolutionLabel");
580 0 : get(pPage3_Resolution_1, "resolution1Radiobutton");
581 0 : get(pPage3_Resolution_2, "resolution2Radiobutton");
582 0 : get(pPage3_Resolution_3, "resolution3Radiobutton");
583 0 : get(pPage3_Titel3, "effectsLabel");
584 0 : get(pPage3_SldSound, "sldSoundCheckbutton");
585 0 : get(pPage3_HiddenSlides, "hiddenSlidesCheckbutton");
586 0 : aAssistentFunc.InsertControl(3, pPage3);
587 0 : aAssistentFunc.InsertControl(3, pPage3_Titel1);
588 0 : aAssistentFunc.InsertControl(3, pPage3_Png);
589 0 : aAssistentFunc.InsertControl(3, pPage3_Gif);
590 0 : aAssistentFunc.InsertControl(3, pPage3_Jpg);
591 0 : aAssistentFunc.InsertControl(3, pPage3_Quality_txt);
592 0 : aAssistentFunc.InsertControl(3, pPage3_Quality);
593 0 : aAssistentFunc.InsertControl(3, pPage3_Titel2);
594 0 : aAssistentFunc.InsertControl(3, pPage3_Resolution_1);
595 0 : aAssistentFunc.InsertControl(3, pPage3_Resolution_2);
596 0 : aAssistentFunc.InsertControl(3, pPage3_Resolution_3);
597 0 : aAssistentFunc.InsertControl(3, pPage3_Titel3);
598 0 : aAssistentFunc.InsertControl(3, pPage3_SldSound);
599 0 : aAssistentFunc.InsertControl(3, pPage3_HiddenSlides);
600 :
601 : // Page 4
602 0 : get(pPage4, "page4");
603 0 : get(pPage4_Titel1, "infTitlePageLabel");
604 0 : get(pPage4_Author_txt, "authorTxtLabel");
605 0 : get(pPage4_Author, "authorEntry");
606 0 : get(pPage4_Email_txt, "emailTxtLabel");
607 0 : get(pPage4_Email, "emailEntry");
608 0 : get(pPage4_WWW_txt, "wwwTxtLabel");
609 0 : get(pPage4_WWW, "wwwEntry");
610 0 : get(pPage4_Titel2, "addInformLabel");
611 0 : get(pPage4_Download, "downloadCheckbutton");
612 0 : aAssistentFunc.InsertControl(4, pPage4);
613 0 : aAssistentFunc.InsertControl(4, pPage4_Titel1);
614 0 : aAssistentFunc.InsertControl(4, pPage4_Author_txt);
615 0 : aAssistentFunc.InsertControl(4, pPage4_Author);
616 0 : aAssistentFunc.InsertControl(4, pPage4_Email_txt);
617 0 : aAssistentFunc.InsertControl(4, pPage4_Email);
618 0 : aAssistentFunc.InsertControl(4, pPage4_WWW_txt);
619 0 : aAssistentFunc.InsertControl(4, pPage4_WWW);
620 0 : aAssistentFunc.InsertControl(4, pPage4_Titel2);
621 0 : aAssistentFunc.InsertControl(4, pPage4_Misc);
622 0 : if(m_bImpress)
623 0 : aAssistentFunc.InsertControl(4, pPage4_Download);
624 :
625 : // Page 5
626 0 : get(pPage5, "page5");
627 0 : get(pPage5_Titel, "buttonStyleLabel");
628 0 : get(pPage5_TextOnly, "textOnlyCheckbutton");
629 0 : get(pPage5_Buttons, "buttonsDrawingarea");
630 0 : aAssistentFunc.InsertControl(5, pPage5);
631 0 : aAssistentFunc.InsertControl(5, pPage5_Titel);
632 0 : aAssistentFunc.InsertControl(5, pPage5_TextOnly);
633 0 : aAssistentFunc.InsertControl(5, pPage5_Buttons);
634 :
635 : // Page 6
636 0 : get(pPage6, "page6");
637 0 : get(pPage6_Titel, "selectColorLabel");
638 0 : get(pPage6_Default, "defaultRadiobutton");
639 0 : get(pPage6_User, "userRadiobutton");
640 0 : get(pPage6_Back, "backButton");
641 0 : get(pPage6_Text, "textButton");
642 0 : get(pPage6_Link, "linkButton");
643 0 : get(pPage6_VLink, "vLinkButton");
644 0 : get(pPage6_ALink, "aLinkButton");
645 0 : get(pPage6_DocColors, "docColorsRadiobutton");
646 0 : get(pPage6_Preview, "previewDrawingarea");
647 0 : aAssistentFunc.InsertControl(6, pPage6);
648 0 : aAssistentFunc.InsertControl(6, pPage6_Titel);
649 0 : aAssistentFunc.InsertControl(6, pPage6_DocColors);
650 0 : aAssistentFunc.InsertControl(6, pPage6_Default);
651 0 : aAssistentFunc.InsertControl(6, pPage6_User);
652 0 : aAssistentFunc.InsertControl(6, pPage6_Text);
653 0 : aAssistentFunc.InsertControl(6, pPage6_Link);
654 0 : aAssistentFunc.InsertControl(6, pPage6_ALink);
655 0 : aAssistentFunc.InsertControl(6, pPage6_VLink);
656 0 : aAssistentFunc.InsertControl(6, pPage6_Back);
657 0 : aAssistentFunc.InsertControl(6, pPage6_Preview);
658 0 : }
659 :
660 : // Initialize dialog with default-values
661 0 : void SdPublishingDlg::SetDefaults()
662 : {
663 0 : SdPublishingDesign aDefault;
664 0 : SetDesign(&aDefault);
665 :
666 0 : pPage1_NewDesign->Check(true);
667 0 : pPage1_OldDesign->Check(false);
668 0 : UpdatePage();
669 0 : }
670 :
671 : // Feed the SfxItemSet with the settings of the dialog
672 0 : void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
673 : {
674 0 : std::vector< PropertyValue > aProps;
675 :
676 0 : PropertyValue aValue;
677 :
678 : // Page 2
679 0 : aValue.Name = "PublishMode";
680 :
681 : HtmlPublishMode ePublishMode;
682 0 : if (pPage2_Frames->IsChecked())
683 0 : ePublishMode = PUBLISH_FRAMES;
684 0 : else if (pPage2_SingleDocument->IsChecked())
685 0 : ePublishMode = PUBLISH_SINGLE_DOCUMENT;
686 0 : else if (pPage2_Kiosk->IsChecked())
687 0 : ePublishMode = PUBLISH_KIOSK;
688 0 : else if (pPage2_WebCast->IsChecked())
689 0 : ePublishMode = PUBLISH_WEBCAST;
690 : else
691 0 : ePublishMode = PUBLISH_HTML;
692 :
693 0 : aValue.Value <<= (sal_Int32) ePublishMode;
694 0 : aProps.push_back( aValue );
695 :
696 0 : aValue.Name = "IsExportContentsPage";
697 0 : aValue.Value <<= pPage2_Content->IsChecked();
698 0 : aProps.push_back( aValue );
699 :
700 0 : if(m_bImpress)
701 : {
702 0 : aValue.Name = "IsExportNotes";
703 0 : aValue.Value <<= pPage2_Notes->IsChecked();
704 0 : aProps.push_back( aValue );
705 : }
706 :
707 0 : if( pPage2_WebCast->IsChecked() )
708 : {
709 0 : aValue.Name = "WebCastScriptLanguage";
710 0 : if( pPage2_ASP->IsChecked() )
711 0 : aValue.Value <<= OUString( "asp" );
712 : else
713 0 : aValue.Value <<= OUString( "perl" );
714 0 : aProps.push_back( aValue );
715 :
716 0 : aValue.Name = "WebCastCGIURL";
717 0 : aValue.Value <<= OUString( pPage2_CGI->GetText() );
718 0 : aProps.push_back( aValue );
719 :
720 0 : aValue.Name = "WebCastTargetURL";
721 0 : aValue.Value <<= OUString( pPage2_URL->GetText() );
722 0 : aProps.push_back( aValue );
723 : }
724 0 : aValue.Name = "IndexURL";
725 0 : aValue.Value <<= OUString( pPage2_Index->GetText() );
726 0 : aProps.push_back( aValue );
727 :
728 0 : if( pPage2_Kiosk->IsChecked() && pPage2_ChgAuto->IsChecked() )
729 : {
730 0 : aValue.Name = "KioskSlideDuration";
731 0 : aValue.Value <<= (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
732 0 : aProps.push_back( aValue );
733 :
734 0 : aValue.Name = "KioskEndless";
735 0 : aValue.Value <<= pPage2_Endless->IsChecked();
736 0 : aProps.push_back( aValue );
737 : }
738 :
739 : // Page 3
740 :
741 0 : aValue.Name = "Width";
742 0 : sal_Int32 nTmpWidth = 640;
743 0 : if( pPage3_Resolution_2->IsChecked() )
744 0 : nTmpWidth = 800;
745 0 : else if( pPage3_Resolution_3->IsChecked() )
746 0 : nTmpWidth = 1024;
747 :
748 0 : aValue.Value <<= nTmpWidth;
749 0 : aProps.push_back( aValue );
750 :
751 0 : aValue.Name = "Compression";
752 0 : aValue.Value <<= OUString( pPage3_Quality->GetText() );
753 0 : aProps.push_back( aValue );
754 :
755 0 : aValue.Name = "Format";
756 : sal_Int32 nFormat;
757 0 : if( pPage3_Png->IsChecked() )
758 0 : nFormat = static_cast<sal_Int32>(FORMAT_PNG);
759 0 : else if( pPage3_Gif->IsChecked() )
760 0 : nFormat = static_cast<sal_Int32>(FORMAT_GIF);
761 : else
762 0 : nFormat = static_cast<sal_Int32>(FORMAT_JPG);
763 0 : aValue.Value <<= nFormat;
764 0 : aProps.push_back( aValue );
765 :
766 0 : aValue.Name = "SlideSound";
767 0 : aValue.Value <<= pPage3_SldSound->IsChecked() ? sal_True : sal_False;
768 0 : aProps.push_back( aValue );
769 :
770 0 : aValue.Name = "HiddenSlides";
771 0 : aValue.Value <<= pPage3_HiddenSlides->IsChecked() ? sal_True : sal_False;
772 0 : aProps.push_back( aValue );
773 :
774 : // Page 4
775 0 : aValue.Name = "Author";
776 0 : aValue.Value <<= OUString( pPage4_Author->GetText() );
777 0 : aProps.push_back( aValue );
778 :
779 0 : aValue.Name = "EMail";
780 0 : aValue.Value <<= OUString( pPage4_Email->GetText() );
781 0 : aProps.push_back( aValue );
782 :
783 : // try to guess protocol for user's homepage
784 0 : INetURLObject aHomeURL( pPage4_WWW->GetText(),
785 : INET_PROT_HTTP, // default proto is HTTP
786 0 : INetURLObject::ENCODE_ALL );
787 :
788 0 : aValue.Name = "HomepageURL";
789 0 : aValue.Value <<= OUString( aHomeURL.GetMainURL( INetURLObject::NO_DECODE ) );
790 0 : aProps.push_back( aValue );
791 :
792 0 : aValue.Name = "UserText";
793 0 : aValue.Value <<= OUString( pPage4_Misc->GetText() );
794 0 : aProps.push_back( aValue );
795 :
796 0 : if( m_bImpress )
797 : {
798 0 : aValue.Name = "EnableDownload";
799 0 : aValue.Value <<= pPage4_Download->IsChecked();
800 0 : aProps.push_back( aValue );
801 : }
802 :
803 : // Page 5
804 0 : if( !pPage5_TextOnly->IsChecked() )
805 : {
806 0 : aValue.Name = "UseButtonSet";
807 0 : aValue.Value <<= (sal_Int32)(pPage5_Buttons->GetSelectItemId() - 1);
808 0 : aProps.push_back( aValue );
809 : }
810 :
811 : // Page 6
812 0 : if( pPage6_User->IsChecked() )
813 : {
814 0 : aValue.Name = "BackColor";
815 0 : aValue.Value <<= (sal_Int32)m_aBackColor.GetColor();
816 0 : aProps.push_back( aValue );
817 :
818 0 : aValue.Name = "TextColor";
819 0 : aValue.Value <<= (sal_Int32)m_aTextColor.GetColor();
820 0 : aProps.push_back( aValue );
821 :
822 0 : aValue.Name = "LinkColor";
823 0 : aValue.Value <<= (sal_Int32)m_aLinkColor.GetColor();
824 0 : aProps.push_back( aValue );
825 :
826 0 : aValue.Name = "VLinkColor";
827 0 : aValue.Value <<= (sal_Int32)m_aVLinkColor.GetColor();
828 0 : aProps.push_back( aValue );
829 :
830 0 : aValue.Name = "ALinkColor";
831 0 : aValue.Value <<= (sal_Int32)m_aALinkColor.GetColor();
832 0 : aProps.push_back( aValue );
833 : }
834 :
835 0 : if( pPage6_DocColors->IsChecked() )
836 : {
837 0 : aValue.Name = "IsUseDocumentColors";
838 0 : aValue.Value <<= true;
839 0 : aProps.push_back( aValue );
840 : }
841 :
842 0 : rParams.realloc( aProps.size() );
843 0 : PropertyValue* pParams = rParams.getArray();
844 :
845 0 : for( std::vector< PropertyValue >::iterator i = aProps.begin(); i != aProps.end(); ++i )
846 : {
847 0 : *pParams++ = (*i);
848 0 : }
849 0 : }
850 :
851 : // Clickhandler for the radiobuttons of the design-selection
852 0 : IMPL_LINK( SdPublishingDlg, DesignHdl, RadioButton *, pButton )
853 : {
854 0 : if(pButton == pPage1_NewDesign)
855 : {
856 0 : pPage1_NewDesign->Check(true); // because of DesignDeleteHdl
857 0 : pPage1_OldDesign->Check(false);
858 0 : pPage1_Designs->Disable();
859 0 : pPage1_DelDesign->Disable();
860 0 : m_pDesign = NULL;
861 :
862 0 : SdPublishingDesign aDefault;
863 0 : SetDesign(&aDefault);
864 : }
865 : else
866 : {
867 0 : pPage1_NewDesign->Check(false);
868 0 : pPage1_Designs->Enable();
869 0 : pPage1_DelDesign->Enable();
870 :
871 0 : if(pPage1_Designs->GetSelectEntryCount() == 0)
872 0 : pPage1_Designs->SelectEntryPos(0);
873 :
874 0 : sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
875 0 : m_pDesign = &m_aDesignList[nPos];
876 : DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
877 :
878 0 : if(m_pDesign)
879 0 : SetDesign(m_pDesign);
880 : }
881 :
882 0 : return 0;
883 : }
884 :
885 : // Clickhandler for the choice of one design
886 0 : IMPL_LINK_NOARG(SdPublishingDlg, DesignSelectHdl)
887 : {
888 0 : sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
889 0 : m_pDesign = &m_aDesignList[nPos];
890 : DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
891 :
892 0 : if(m_pDesign)
893 0 : SetDesign(m_pDesign);
894 :
895 0 : UpdatePage();
896 :
897 0 : return 0;
898 : }
899 :
900 : // Clickhandler for the delete of one design
901 0 : IMPL_LINK_NOARG(SdPublishingDlg, DesignDeleteHdl)
902 : {
903 0 : sal_uInt16 nPos = pPage1_Designs->GetSelectEntryPos();
904 :
905 0 : boost::ptr_vector<SdPublishingDesign>::iterator iter = m_aDesignList.begin()+nPos;
906 :
907 : DBG_ASSERT(iter != m_aDesignList.end(), "No Design? That's not allowed (CL)");
908 :
909 0 : pPage1_Designs->RemoveEntry(nPos);
910 :
911 0 : if(m_pDesign == &(*iter))
912 0 : DesignHdl( pPage1_NewDesign );
913 :
914 0 : m_aDesignList.erase(iter);
915 :
916 0 : m_bDesignListDirty = true;
917 :
918 0 : UpdatePage();
919 :
920 0 : return 0;
921 : }
922 :
923 : // Clickhandler for the other servertypess
924 0 : IMPL_LINK( SdPublishingDlg, WebServerHdl, RadioButton *, pButton )
925 : {
926 0 : bool bASP = pButton == pPage2_ASP;
927 :
928 0 : pPage2_ASP->Check( bASP );
929 0 : pPage2_PERL->Check( !bASP );
930 0 : UpdatePage();
931 :
932 0 : return 0;
933 : }
934 :
935 : // Clickhandler for the Radiobuttons of the graphicformat choice
936 0 : IMPL_LINK( SdPublishingDlg, GfxFormatHdl, RadioButton *, pButton )
937 : {
938 0 : pPage3_Png->Check( pButton == pPage3_Png );
939 0 : pPage3_Gif->Check( pButton == pPage3_Gif );
940 0 : pPage3_Jpg->Check( pButton == pPage3_Jpg );
941 0 : pPage3_Quality->Enable(pButton == pPage3_Jpg);
942 0 : return 0;
943 : }
944 :
945 : // Clickhandler for the Radiobuttons Standard/Frames
946 0 : IMPL_LINK_NOARG(SdPublishingDlg, BaseHdl)
947 : {
948 0 : UpdatePage();
949 :
950 0 : return 0;
951 : }
952 :
953 : // Clickhandler for the Checkbox of the Title page
954 0 : IMPL_LINK_NOARG(SdPublishingDlg, ContentHdl)
955 : {
956 0 : if(pPage2_Content->IsChecked())
957 : {
958 0 : if(!aAssistentFunc.IsEnabled(4))
959 : {
960 0 : aAssistentFunc.EnablePage(4);
961 0 : UpdatePage();
962 : }
963 : }
964 : else
965 : {
966 0 : if(aAssistentFunc.IsEnabled(4))
967 : {
968 0 : aAssistentFunc.DisablePage(4);
969 0 : UpdatePage();
970 : }
971 : }
972 0 : return 0;
973 : }
974 :
975 : // Clickhandler for the Resolution Radiobuttons
976 0 : IMPL_LINK( SdPublishingDlg, ResolutionHdl, RadioButton *, pButton )
977 : {
978 0 : pPage3_Resolution_1->Check(pButton == pPage3_Resolution_1);
979 0 : pPage3_Resolution_2->Check(pButton == pPage3_Resolution_2);
980 0 : pPage3_Resolution_3->Check(pButton == pPage3_Resolution_3);
981 :
982 0 : return 0;
983 : }
984 :
985 : // Clickhandler for the ValueSet with the bitmap-buttons
986 0 : IMPL_LINK_NOARG(SdPublishingDlg, ButtonsHdl)
987 : {
988 : // if one bitmap-button is chosen, then disable TextOnly
989 0 : pPage5_TextOnly->Check(false);
990 0 : return 0;
991 : }
992 :
993 : // Fill the SfxItemSet with the settings of the dialog
994 0 : IMPL_LINK( SdPublishingDlg, ColorHdl, PushButton *, pButton)
995 : {
996 0 : SvColorDialog aDlg(this);
997 :
998 0 : if(pButton == pPage6_Back)
999 : {
1000 0 : aDlg.SetColor( m_aBackColor );
1001 0 : if(aDlg.Execute() == RET_OK )
1002 0 : m_aBackColor = aDlg.GetColor();
1003 : }
1004 0 : else if(pButton == pPage6_Text)
1005 : {
1006 0 : aDlg.SetColor( m_aTextColor );
1007 0 : if(aDlg.Execute() == RET_OK )
1008 0 : m_aTextColor = aDlg.GetColor();
1009 : }
1010 0 : else if(pButton == pPage6_Link)
1011 : {
1012 0 : aDlg.SetColor( m_aLinkColor );
1013 0 : if(aDlg.Execute() == RET_OK )
1014 0 : m_aLinkColor = aDlg.GetColor();
1015 : }
1016 0 : else if(pButton == pPage6_VLink)
1017 : {
1018 0 : aDlg.SetColor( m_aVLinkColor );
1019 0 : if(aDlg.Execute() == RET_OK )
1020 0 : m_aVLinkColor = aDlg.GetColor();
1021 : }
1022 0 : else if(pButton == pPage6_ALink)
1023 : {
1024 0 : aDlg.SetColor( m_aALinkColor );
1025 0 : if(aDlg.Execute() == RET_OK )
1026 0 : m_aALinkColor = aDlg.GetColor();
1027 : }
1028 :
1029 0 : pPage6_User->Check(true);
1030 : pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1031 0 : m_aVLinkColor, m_aALinkColor );
1032 0 : pPage6_Preview->Invalidate();
1033 0 : return 0;
1034 : }
1035 :
1036 0 : IMPL_LINK_NOARG(SdPublishingDlg, SlideChgHdl)
1037 : {
1038 0 : UpdatePage();
1039 0 : return 0;
1040 : }
1041 :
1042 : // Clickhandler for the Ok Button
1043 0 : IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl)
1044 : {
1045 : //End
1046 0 : SdPublishingDesign* pDesign = new SdPublishingDesign();
1047 0 : GetDesign(pDesign);
1048 :
1049 0 : bool bSave = false;
1050 :
1051 0 : if(pPage1_OldDesign->IsChecked() && m_pDesign)
1052 : {
1053 : // are there changes?
1054 0 : if(!(*pDesign == *m_pDesign))
1055 0 : bSave = true;
1056 : }
1057 : else
1058 : {
1059 0 : SdPublishingDesign aDefaultDesign;
1060 0 : if(!(aDefaultDesign == *pDesign))
1061 0 : bSave = true;
1062 : }
1063 :
1064 0 : if(bSave)
1065 : {
1066 0 : OUString aName;
1067 0 : if(m_pDesign)
1068 0 : aName = m_pDesign->m_aDesignName;
1069 :
1070 : bool bRetry;
1071 0 : do
1072 : {
1073 0 : bRetry = false;
1074 :
1075 0 : SdDesignNameDlg aDlg(this, aName );
1076 :
1077 0 : if ( aDlg.Execute() == RET_OK )
1078 : {
1079 0 : pDesign->m_aDesignName = aDlg.GetDesignName();
1080 :
1081 0 : boost::ptr_vector<SdPublishingDesign>::iterator iter;
1082 0 : for (iter = m_aDesignList.begin(); iter != m_aDesignList.end(); ++iter)
1083 : {
1084 0 : if (iter->m_aDesignName == pDesign->m_aDesignName)
1085 0 : break;
1086 : }
1087 :
1088 0 : if (iter != m_aDesignList.end())
1089 : {
1090 : MessageDialog aErrorBox(this, SD_RESSTR(STR_PUBDLG_SAMENAME),
1091 0 : VCL_MESSAGE_ERROR, VCL_BUTTONS_YES_NO);
1092 0 : bRetry = aErrorBox.Execute() == RET_NO;
1093 :
1094 0 : if(!bRetry)
1095 0 : m_aDesignList.erase(iter);
1096 : }
1097 :
1098 0 : if(!bRetry)
1099 : {
1100 0 : m_aDesignList.push_back(pDesign);
1101 0 : m_bDesignListDirty = true;
1102 0 : pDesign = NULL;
1103 : }
1104 0 : }
1105 : }
1106 0 : while(bRetry);
1107 : }
1108 :
1109 0 : delete pDesign;
1110 :
1111 0 : if(m_bDesignListDirty)
1112 0 : Save();
1113 :
1114 0 : EndDialog(RET_OK);
1115 0 : return 0;
1116 : }
1117 :
1118 : // Refresh the dialogs when changing from pages
1119 0 : void SdPublishingDlg::ChangePage()
1120 : {
1121 0 : int nPage = aAssistentFunc.GetCurrentPage();
1122 0 : SetHelpId(aPageHelpIds[nPage-1]);
1123 :
1124 0 : UpdatePage();
1125 :
1126 0 : if( pNextPageButton->IsEnabled() )
1127 0 : pNextPageButton->GrabFocus();
1128 : else
1129 0 : pFinishButton->GrabFocus();
1130 0 : }
1131 :
1132 0 : void SdPublishingDlg::UpdatePage()
1133 : {
1134 0 : pNextPageButton->Enable(!aAssistentFunc.IsLastPage());
1135 0 : pLastPageButton->Enable(!aAssistentFunc.IsFirstPage());
1136 :
1137 0 : int nPage = aAssistentFunc.GetCurrentPage();
1138 :
1139 0 : switch( nPage )
1140 : {
1141 : case 1:
1142 0 : if(pPage1_NewDesign->IsChecked())
1143 : {
1144 0 : pPage1_Designs->Disable();
1145 0 : pPage1_DelDesign->Disable();
1146 : }
1147 :
1148 0 : if(m_aDesignList.empty())
1149 0 : pPage1_OldDesign->Disable();
1150 0 : break;
1151 : case 2:
1152 0 : pPage2_Frames_FB->Show(pPage2_Frames->IsChecked());
1153 0 : pPage2_Standard_FB->Show(pPage2_Standard->IsChecked());
1154 0 : pPage2_Kiosk_FB->Show(pPage2_Kiosk->IsChecked());
1155 0 : pPage2_WebCast_FB->Show(pPage2_WebCast->IsChecked());
1156 :
1157 0 : if( pPage2_WebCast->IsChecked() )
1158 : {
1159 0 : pPage2Frame4->Show();
1160 0 : pPage2_Titel_WebCast->Show();
1161 0 : pPage2_ASP->Show();
1162 0 : pPage2_PERL->Show();
1163 0 : pPage2_URL_txt->Show();
1164 0 : pPage2_URL->Show();
1165 0 : pPage2_CGI_txt->Show();
1166 0 : pPage2_CGI->Show();
1167 0 : pPage2_Index_txt->Show();
1168 0 : pPage2_Index->Show();
1169 :
1170 0 : bool bPerl = pPage2_PERL->IsChecked();
1171 0 : pPage2_Index->Enable(bPerl);
1172 0 : pPage2_Index_txt->Enable(bPerl);
1173 0 : pPage2_URL_txt->Enable(bPerl);
1174 0 : pPage2_URL->Enable(bPerl);
1175 0 : pPage2_CGI_txt->Enable(bPerl);
1176 0 : pPage2_CGI->Enable(bPerl);
1177 : }
1178 : else
1179 : {
1180 0 : pPage2Frame4->Hide();
1181 0 : pPage2_Titel_WebCast->Hide();
1182 0 : pPage2_ASP->Hide();
1183 0 : pPage2_PERL->Hide();
1184 0 : pPage2_URL_txt->Hide();
1185 0 : pPage2_URL->Hide();
1186 0 : pPage2_CGI_txt->Hide();
1187 0 : pPage2_CGI->Hide();
1188 0 : pPage2_Index->Hide();
1189 0 : pPage2_Index_txt->Hide();
1190 : }
1191 :
1192 0 : if( pPage2_Kiosk->IsChecked() )
1193 : {
1194 0 : pPage2Frame3->Show();
1195 0 : pPage2_Titel_Kiosk->Show();
1196 0 : pPage2_ChgDefault->Show();
1197 0 : pPage2_ChgAuto->Show();
1198 0 : pPage2_Duration_txt->Show();
1199 0 : pPage2_Duration->Show();
1200 0 : pPage2_Endless->Show();
1201 0 : bool bAuto = pPage2_ChgAuto->IsChecked();
1202 0 : pPage2_Duration->Enable(bAuto);
1203 0 : pPage2_Endless->Enable(bAuto);
1204 : }
1205 : else
1206 : {
1207 0 : pPage2Frame3->Hide();
1208 0 : pPage2_Titel_Kiosk->Hide();
1209 0 : pPage2_ChgDefault->Hide();
1210 0 : pPage2_ChgAuto->Hide();
1211 0 : pPage2_Duration->Hide();
1212 0 : pPage2_Duration_txt->Hide();
1213 0 : pPage2_Endless->Hide();
1214 : }
1215 :
1216 0 : if( pPage2_Standard->IsChecked() || pPage2_Frames->IsChecked() )
1217 : {
1218 0 : pPage2Frame2->Show();
1219 0 : pPage2_Titel_Html->Show();
1220 0 : pPage2_Content->Show();
1221 0 : if(m_bImpress)
1222 0 : pPage2_Notes->Show();
1223 : }
1224 : else
1225 : {
1226 0 : pPage2Frame2->Hide();
1227 0 : pPage2_Titel_Html->Hide();
1228 0 : pPage2_Content->Hide();
1229 0 : if(m_bImpress)
1230 0 : pPage2_Notes->Hide();
1231 : }
1232 0 : break;
1233 : case 3:
1234 0 : if( pPage2_Kiosk->IsChecked() || pPage2_WebCast->IsChecked() )
1235 0 : pNextPageButton->Disable();
1236 :
1237 0 : if( pPage2_WebCast->IsChecked() )
1238 0 : pPage3_SldSound->Disable();
1239 :
1240 0 : pPage3_Quality->Enable(pPage3_Jpg->IsChecked());
1241 :
1242 0 : break;
1243 : case 5:
1244 0 : if( m_bButtonsDirty )
1245 0 : LoadPreviewButtons();
1246 0 : break;
1247 : }
1248 0 : }
1249 :
1250 : /** loads the html buttons from the button sets, creates a preview and fills the
1251 : itemset for page 5
1252 : */
1253 0 : void SdPublishingDlg::LoadPreviewButtons()
1254 : {
1255 0 : if( mpButtonSet.get() )
1256 : {
1257 0 : const int nButtonCount = 8;
1258 : static const char *pButtonNames[nButtonCount] =
1259 : {
1260 : "first.png",
1261 : "left.png",
1262 : "right.png",
1263 : "last.png",
1264 : "home.png",
1265 : "text.png",
1266 : "expand.png",
1267 : "collapse.png",
1268 : };
1269 :
1270 0 : std::vector< OUString > aButtonNames;
1271 0 : for( int i = 0; i < nButtonCount; ++i )
1272 0 : aButtonNames.push_back( OUString::createFromAscii( pButtonNames[i] ) );
1273 :
1274 0 : int nSetCount = mpButtonSet->getCount();
1275 :
1276 0 : int nHeight = 32;
1277 0 : Image aImage;
1278 0 : for( int nSet = 0; nSet < nSetCount; ++nSet )
1279 : {
1280 0 : if( mpButtonSet->getPreview( nSet, aButtonNames, aImage ) )
1281 : {
1282 0 : pPage5_Buttons->InsertItem( (sal_uInt16)nSet+1, aImage );
1283 0 : if( nHeight < aImage.GetSizePixel().Height() )
1284 0 : nHeight = aImage.GetSizePixel().Height();
1285 : }
1286 : }
1287 :
1288 0 : pPage5_Buttons->SetItemHeight( nHeight );
1289 0 : m_bButtonsDirty = false;
1290 : }
1291 0 : }
1292 :
1293 : // Clickhandler for the Forward Button
1294 0 : IMPL_LINK_NOARG(SdPublishingDlg, NextPageHdl)
1295 : {
1296 0 : aAssistentFunc.NextPage();
1297 0 : ChangePage();
1298 0 : return 0;
1299 : }
1300 :
1301 : // Sets the Controlls in the dialog to the settings in the design
1302 0 : void SdPublishingDlg::SetDesign( SdPublishingDesign* pDesign )
1303 : {
1304 0 : if(!pDesign)
1305 0 : return;
1306 :
1307 0 : pPage2_Standard->Check(pDesign->m_eMode == PUBLISH_HTML);
1308 0 : pPage2_Frames->Check(pDesign->m_eMode == PUBLISH_FRAMES);
1309 0 : pPage2_Kiosk->Check(pDesign->m_eMode == PUBLISH_KIOSK );
1310 0 : pPage2_WebCast->Check(pDesign->m_eMode == PUBLISH_WEBCAST );
1311 :
1312 0 : pPage2_Content->Check(pDesign->m_bContentPage);
1313 0 : if(pDesign->m_bContentPage)
1314 0 : aAssistentFunc.EnablePage(4);
1315 : else
1316 0 : aAssistentFunc.DisablePage(4);
1317 :
1318 0 : if(m_bImpress)
1319 0 : pPage2_Notes->Check(pDesign->m_bNotes);
1320 :
1321 0 : pPage2_ASP->Check(pDesign->m_eScript == SCRIPT_ASP);
1322 0 : pPage2_PERL->Check(pDesign->m_eScript == SCRIPT_PERL);
1323 0 : pPage2_CGI->SetText(pDesign->m_aCGI);
1324 0 : pPage2_URL->SetText(pDesign->m_aURL);
1325 :
1326 0 : pPage2_ChgDefault->Check( !pDesign->m_bAutoSlide );
1327 0 : pPage2_ChgAuto->Check( pDesign->m_bAutoSlide );
1328 :
1329 0 : tools::Time aTime( tools::Time::EMPTY );
1330 0 : aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 );
1331 0 : pPage2_Duration->SetTime( aTime );
1332 :
1333 0 : pPage2_Endless->Check( pDesign->m_bEndless );
1334 :
1335 0 : pPage3_Png->Check(pDesign->m_eFormat == FORMAT_PNG);
1336 0 : pPage3_Gif->Check(pDesign->m_eFormat == FORMAT_GIF);
1337 0 : pPage3_Jpg->Check(pDesign->m_eFormat == FORMAT_JPG);
1338 0 : pPage3_Quality->Enable(pDesign->m_eFormat == FORMAT_JPG);
1339 :
1340 0 : pPage3_Quality->SetText(pDesign->m_aCompression);
1341 0 : pPage3_Resolution_1->Check(pDesign->m_nResolution == PUB_LOWRES_WIDTH);
1342 0 : pPage3_Resolution_2->Check(pDesign->m_nResolution == PUB_MEDRES_WIDTH);
1343 0 : pPage3_Resolution_3->Check(pDesign->m_nResolution == PUB_HIGHRES_WIDTH);
1344 :
1345 0 : pPage3_SldSound->Check( pDesign->m_bSlideSound );
1346 0 : pPage3_HiddenSlides->Check( pDesign->m_bHiddenSlides );
1347 :
1348 0 : pPage4_Author->SetText(pDesign->m_aAuthor);
1349 0 : pPage4_Email->SetText(pDesign->m_aEMail);
1350 0 : pPage4_WWW->SetText(pDesign->m_aWWW);
1351 0 : pPage4_Misc->SetText(pDesign->m_aMisc);
1352 0 : if(m_bImpress)
1353 0 : pPage4_Download->Check(pDesign->m_bDownload);
1354 :
1355 0 : pPage5_TextOnly->Check(pDesign->m_nButtonThema == -1);
1356 0 : if(pDesign->m_nButtonThema != -1)
1357 : {
1358 0 : if(m_bButtonsDirty)
1359 0 : LoadPreviewButtons();
1360 0 : pPage5_Buttons->SelectItem(pDesign->m_nButtonThema + 1);
1361 : }
1362 : else
1363 0 : pPage5_Buttons->SetNoSelection();
1364 :
1365 0 : pPage6_User->Check(pDesign->m_bUserAttr);
1366 0 : m_aBackColor = pDesign->m_aBackColor;
1367 0 : m_aTextColor = pDesign->m_aTextColor;
1368 0 : m_aLinkColor = pDesign->m_aLinkColor;
1369 0 : m_aVLinkColor = pDesign->m_aVLinkColor;
1370 0 : m_aALinkColor = pDesign->m_aALinkColor;
1371 :
1372 0 : pPage6_DocColors->Check(pDesign->m_bUseColor);
1373 :
1374 : pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1375 0 : m_aVLinkColor, m_aALinkColor );
1376 0 : pPage6_Preview->Invalidate();
1377 :
1378 0 : UpdatePage();
1379 : }
1380 :
1381 : // Transfer the status of the Design Dialog Controls
1382 0 : void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign )
1383 : {
1384 0 : if(!pDesign)
1385 0 : return;
1386 :
1387 0 : pDesign->m_eMode = pPage2_Standard->IsChecked()?PUBLISH_HTML:
1388 0 : pPage2_Frames->IsChecked()?PUBLISH_FRAMES:
1389 0 : pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:
1390 0 : PUBLISH_WEBCAST;
1391 :
1392 0 : pDesign->m_bContentPage = pPage2_Content->IsChecked();
1393 0 : if(m_bImpress)
1394 0 : pDesign->m_bNotes = pPage2_Notes->IsChecked();
1395 :
1396 0 : if( pPage3_Gif->IsChecked() )
1397 0 : pDesign->m_eFormat = FORMAT_GIF;
1398 0 : else if( pPage3_Jpg->IsChecked() )
1399 0 : pDesign->m_eFormat = FORMAT_JPG;
1400 : else
1401 0 : pDesign->m_eFormat = FORMAT_PNG;
1402 :
1403 0 : pDesign->m_aCompression = pPage3_Quality->GetText();
1404 :
1405 0 : pDesign->m_nResolution = pPage3_Resolution_1->IsChecked()?PUB_LOWRES_WIDTH:
1406 0 : (pPage3_Resolution_2->IsChecked()?PUB_MEDRES_WIDTH:PUB_HIGHRES_WIDTH);
1407 :
1408 0 : pDesign->m_bSlideSound = pPage3_SldSound->IsChecked();
1409 0 : pDesign->m_bHiddenSlides = pPage3_HiddenSlides->IsChecked();
1410 :
1411 0 : pDesign->m_aAuthor = pPage4_Author->GetText();
1412 0 : pDesign->m_aEMail = pPage4_Email->GetText();
1413 0 : pDesign->m_aWWW = pPage4_WWW->GetText();
1414 0 : pDesign->m_aMisc = pPage4_Misc->GetText();
1415 0 : pDesign->m_bDownload = m_bImpress?pPage4_Download->IsChecked():sal_False;
1416 :
1417 0 : if(pPage5_TextOnly->IsChecked())
1418 0 : pDesign->m_nButtonThema = -1;
1419 : else
1420 0 : pDesign->m_nButtonThema = pPage5_Buttons->GetSelectItemId() - 1;
1421 :
1422 0 : pDesign->m_bUserAttr = pPage6_User->IsChecked();
1423 0 : pDesign->m_aBackColor = m_aBackColor;
1424 0 : pDesign->m_aTextColor = m_aTextColor;
1425 0 : pDesign->m_aLinkColor = m_aLinkColor;
1426 0 : pDesign->m_aVLinkColor = m_aVLinkColor;
1427 0 : pDesign->m_aALinkColor = m_aALinkColor;
1428 0 : pDesign->m_bUseColor = pPage6_DocColors->IsChecked();
1429 :
1430 0 : pDesign->m_eScript = pPage2_ASP->IsChecked()?SCRIPT_ASP:SCRIPT_PERL;
1431 0 : pDesign->m_aCGI = pPage2_CGI->GetText();
1432 0 : pDesign->m_aURL = pPage2_URL->GetText();
1433 :
1434 0 : pDesign->m_bAutoSlide = pPage2_ChgAuto->IsChecked();
1435 0 : pDesign->m_nSlideDuration = (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000;
1436 0 : pDesign->m_bEndless = pPage2_Endless->IsChecked();
1437 : }
1438 :
1439 : // Clickhandler for the back Button
1440 0 : IMPL_LINK_NOARG(SdPublishingDlg, LastPageHdl)
1441 : {
1442 0 : aAssistentFunc.PreviousPage();
1443 0 : ChangePage();
1444 0 : return 0;
1445 : }
1446 :
1447 : // Load Designs
1448 0 : bool SdPublishingDlg::Load()
1449 : {
1450 0 : m_bDesignListDirty = false;
1451 :
1452 0 : INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1453 0 : aURL.Append( OUString( "designs.sod" ) );
1454 :
1455 : // check if file exists, SfxMedium shows an errorbox else
1456 : {
1457 0 : com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler;
1458 0 : SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler );
1459 :
1460 0 : bool bOk = pIStm && ( pIStm->GetError() == 0);
1461 :
1462 0 : if( pIStm )
1463 0 : delete pIStm;
1464 :
1465 0 : if( !bOk )
1466 0 : return false;
1467 : }
1468 :
1469 0 : SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ | STREAM_NOCREATE );
1470 :
1471 0 : SvStream* pStream = aMedium.GetInStream();
1472 :
1473 0 : if( !pStream )
1474 0 : return false;
1475 :
1476 : sal_uInt16 aCheck;
1477 0 : pStream->ReadUInt16( aCheck );
1478 :
1479 0 : if(aCheck != nMagic)
1480 0 : return false;
1481 :
1482 0 : SdIOCompat aIO(*pStream, STREAM_READ);
1483 :
1484 : sal_uInt16 nDesigns;
1485 0 : pStream->ReadUInt16( nDesigns );
1486 :
1487 0 : for( sal_uInt16 nIndex = 0;
1488 0 : pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1489 : nIndex++ )
1490 : {
1491 0 : SdPublishingDesign* pDesign = new SdPublishingDesign();
1492 0 : *pStream >> *pDesign;
1493 :
1494 0 : m_aDesignList.push_back(pDesign);
1495 : }
1496 :
1497 0 : return( pStream->GetError() == SVSTREAM_OK );
1498 : }
1499 :
1500 : // Save Designs
1501 0 : bool SdPublishingDlg::Save()
1502 : {
1503 0 : INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1504 0 : aURL.Append( OUString( "designs.sod" ) );
1505 0 : SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
1506 :
1507 0 : SvStream* pStream = aMedium.GetOutStream();
1508 :
1509 0 : if( !pStream )
1510 0 : return false;
1511 :
1512 0 : sal_uInt16 aCheck = nMagic;
1513 0 : pStream->WriteUInt16( aCheck );
1514 :
1515 : // Destroys the SdIOCompat before the Stream is being destributed
1516 : {
1517 0 : SdIOCompat aIO(*pStream, STREAM_WRITE, 0);
1518 :
1519 0 : sal_uInt16 nDesigns = (sal_uInt16) m_aDesignList.size();
1520 0 : pStream->WriteUInt16( nDesigns );
1521 :
1522 0 : for( sal_uInt16 nIndex = 0;
1523 0 : pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns;
1524 : nIndex++ )
1525 0 : WriteSdPublishingDesign( *pStream, m_aDesignList[nIndex] );
1526 : }
1527 :
1528 0 : aMedium.Close();
1529 0 : aMedium.Commit();
1530 :
1531 0 : return( aMedium.GetError() == 0 );
1532 : }
1533 :
1534 : // SdDesignNameDlg Methods
1535 0 : SdDesignNameDlg::SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName)
1536 0 : : ModalDialog(pWindow, "NameDesignDialog", "modules/sdraw/ui/namedesign.ui")
1537 : {
1538 0 : get(m_pEdit, "entry");
1539 0 : get(m_pBtnOK, "ok");
1540 0 : m_pEdit->SetModifyHdl(LINK(this, SdDesignNameDlg, ModifyHdl ));
1541 0 : m_pEdit->SetText(aName);
1542 0 : m_pBtnOK->Enable(!aName.isEmpty());
1543 0 : }
1544 :
1545 0 : OUString SdDesignNameDlg::GetDesignName()
1546 : {
1547 0 : return m_pEdit->GetText();
1548 : }
1549 :
1550 0 : IMPL_LINK_NOARG(SdDesignNameDlg, ModifyHdl)
1551 : {
1552 0 : m_pBtnOK->Enable(!m_pEdit->GetText().isEmpty());
1553 :
1554 0 : return 0;
1555 0 : }
1556 :
1557 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|