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