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