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