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 <comphelper/sequence.hxx>
22 #include <unotools/ucbstreamhelper.hxx>
23 #include <vcl/FilterConfigItem.hxx>
24 #include <vcl/image.hxx>
25 #include <vcl/svapp.hxx>
26 #include <vcl/weld.hxx>
27 #include <sal/log.hxx>
28 #include <svtools/valueset.hxx>
29 #include <svtools/colrdlg.hxx>
30 #include <tools/debug.hxx>
31 #include <tools/urlobj.hxx>
32 #include <tools/GenericTypeSerializer.hxx>
33 #include <sdiocmpt.hxx>
34 #include <sfx2/docfile.hxx>
35 #include <pres.hxx>
36 #include <unotools/useroptions.hxx>
37 #include <unotools/pathoptions.hxx>
38
39 #include <sdresid.hxx>
40 #include <strings.hrc>
41 #include <pubdlg.hxx>
42 #include "htmlattr.hxx"
43 #include "htmlex.hxx"
44 #include "htmlpublishmode.hxx"
45 #include <helpids.h>
46 #include "buttonset.hxx"
47 #include <strings.hxx>
48
49 using namespace std;
50 using namespace com::sun::star::uno;
51 using namespace com::sun::star::beans;
52
53 #define NOOFPAGES 6
54
55 //ID for the config-data with the HTML-settings
56 const sal_uInt16 nMagic = sal_uInt16(0x1977);
57
58 // Key for the soffice.ini
59 #define KEY_QUALITY "JPG-EXPORT-QUALITY"
60
61 // The Help-IDs of the pages
62 const char* const aPageHelpIds[NOOFPAGES] =
63 {
64 HID_SD_HTMLEXPORT_PAGE1,
65 HID_SD_HTMLEXPORT_PAGE2,
66 HID_SD_HTMLEXPORT_PAGE3,
67 HID_SD_HTMLEXPORT_PAGE4,
68 HID_SD_HTMLEXPORT_PAGE5,
69 HID_SD_HTMLEXPORT_PAGE6
70 };
71
72 static SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign);
73
74 static SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDesign);
75
76 // This class has all the settings for the HTML-export autopilot
77 class SdPublishingDesign
78 {
79 public:
80 OUString m_aDesignName;
81
82 HtmlPublishMode m_eMode;
83
84 // special WebCast options
85 PublishingScript m_eScript;
86 OUString m_aCGI;
87 OUString m_aURL;
88
89 // special Kiosk options
90 bool m_bAutoSlide;
91 sal_uInt32 m_nSlideDuration;
92 bool m_bEndless;
93
94 // special HTML options
95 bool m_bContentPage;
96 bool m_bNotes;
97
98 // misc options
99 sal_uInt16 m_nResolution;
100 OUString m_aCompression;
101 PublishingFormat m_eFormat;
102 bool m_bSlideSound;
103 bool m_bHiddenSlides;
104
105 // title page information
106 OUString m_aAuthor;
107 OUString m_aEMail;
108 OUString m_aWWW;
109 OUString m_aMisc;
110 bool m_bDownload;
111 bool m_bCreated; // not used
112
113 // buttons and colorscheme
114 sal_Int16 m_nButtonThema;
115 bool m_bUserAttr;
116 Color m_aBackColor;
117 Color m_aTextColor;
118 Color m_aLinkColor;
119 Color m_aVLinkColor;
120 Color m_aALinkColor;
121 bool m_bUseAttribs;
122 bool m_bUseColor;
123
124 SdPublishingDesign();
125
126 bool operator ==(const SdPublishingDesign & rDesign) const;
127 friend SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign);
128 friend SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDesign);
129 };
130
131 // load Default-settings
SdPublishingDesign()132 SdPublishingDesign::SdPublishingDesign()
133 : m_eMode(PUBLISH_HTML)
134 , m_eScript(SCRIPT_ASP)
135 , m_bAutoSlide(true)
136 , m_nSlideDuration(15)
137 , m_bEndless(true)
138 , m_bContentPage(true)
139 , m_bNotes(true)
140 , m_nResolution(PUB_LOWRES_WIDTH)
141 , m_eFormat(FORMAT_PNG)
142 , m_bSlideSound(true)
143 , m_bHiddenSlides(false)
144 , m_bDownload(false)
145 , m_bCreated(false)
146 , m_nButtonThema(-1)
147 , m_bUserAttr(false)
148 , m_aBackColor(COL_WHITE)
149 , m_aTextColor(COL_BLACK)
150 , m_aLinkColor(COL_BLUE)
151 , m_aVLinkColor(COL_LIGHTGRAY)
152 , m_aALinkColor(COL_GRAY)
153 , m_bUseAttribs(true)
154 , m_bUseColor(true)
155 {
156 FilterConfigItem aFilterConfigItem(u"Office.Common/Filter/Graphic/Export/JPG");
157 sal_Int32 nCompression = aFilterConfigItem.ReadInt32( KEY_QUALITY, 75 );
158 m_aCompression = OUString::number(nCompression) + "%";
159
160 SvtUserOptions aUserOptions;
161 m_aAuthor = aUserOptions.GetFirstName();
162 if (!m_aAuthor.isEmpty() && !aUserOptions.GetLastName().isEmpty())
163 m_aAuthor += " ";
164 m_aAuthor += aUserOptions.GetLastName();
165 m_aEMail = aUserOptions.GetEmail();
166 }
167
168 // Compares the values without paying attention to the name
operator ==(const SdPublishingDesign & rDesign) const169 bool SdPublishingDesign::operator ==(const SdPublishingDesign & rDesign) const
170 {
171 return
172 (
173 m_eMode == rDesign.m_eMode &&
174 m_nResolution == rDesign.m_nResolution &&
175 m_aCompression == rDesign.m_aCompression &&
176 m_eFormat == rDesign.m_eFormat &&
177 m_bHiddenSlides == rDesign.m_bHiddenSlides &&
178 ( // compare html options
179 (m_eMode != PUBLISH_HTML && m_eMode != PUBLISH_FRAMES) ||
180 (
181 m_bContentPage == rDesign.m_bContentPage &&
182 m_bNotes == rDesign.m_bNotes &&
183 m_aAuthor == rDesign.m_aAuthor &&
184 m_aEMail == rDesign.m_aEMail &&
185 m_aWWW == rDesign.m_aWWW &&
186 m_aMisc == rDesign.m_aMisc &&
187 m_bDownload == rDesign.m_bDownload &&
188 m_nButtonThema == rDesign.m_nButtonThema &&
189 m_bUserAttr == rDesign.m_bUserAttr &&
190 m_aBackColor == rDesign.m_aBackColor &&
191 m_aTextColor == rDesign.m_aTextColor &&
192 m_aLinkColor == rDesign.m_aLinkColor &&
193 m_aVLinkColor == rDesign.m_aVLinkColor &&
194 m_aALinkColor == rDesign.m_aALinkColor &&
195 m_bUseAttribs == rDesign.m_bUseAttribs &&
196 m_bSlideSound == rDesign.m_bSlideSound &&
197 m_bUseColor == rDesign.m_bUseColor
198 )
199 ) &&
200 ( // compare kiosk options
201 (m_eMode != PUBLISH_KIOSK) ||
202 (
203 m_bAutoSlide == rDesign.m_bAutoSlide &&
204 m_bSlideSound == rDesign.m_bSlideSound &&
205 (
206 !m_bAutoSlide ||
207 (
208 m_nSlideDuration == rDesign.m_nSlideDuration &&
209 m_bEndless == rDesign.m_bEndless
210 )
211 )
212 )
213 ) &&
214 ( // compare WebCast options
215 (m_eMode != PUBLISH_WEBCAST) ||
216 (
217 m_eScript == rDesign.m_eScript &&
218 (
219 m_eScript != SCRIPT_PERL ||
220 (
221 m_aURL == rDesign.m_aURL &&
222 m_aCGI == rDesign.m_aCGI
223 )
224 )
225 )
226 )
227 );
228 }
229
230 // Load the design from the stream
operator >>(SvStream & rIn,SdPublishingDesign & rDesign)231 SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign)
232 {
233 SdIOCompat aIO(rIn, StreamMode::READ);
234
235 sal_uInt16 nTemp16;
236 tools::GenericTypeSerializer aSerializer(rIn);
237
238 rDesign.m_aDesignName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
239 RTL_TEXTENCODING_UTF8);
240 rIn.ReadUInt16( nTemp16 );
241 rDesign.m_eMode = static_cast<HtmlPublishMode>(nTemp16);
242 rIn.ReadCharAsBool( rDesign.m_bContentPage );
243 rIn.ReadCharAsBool( rDesign.m_bNotes );
244 rIn.ReadUInt16( rDesign.m_nResolution );
245 rDesign.m_aCompression = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
246 RTL_TEXTENCODING_UTF8);
247 rIn.ReadUInt16( nTemp16 );
248 rDesign.m_eFormat = static_cast<PublishingFormat>(nTemp16);
249 rDesign.m_aAuthor = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
250 RTL_TEXTENCODING_UTF8);
251 rDesign.m_aEMail = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
252 RTL_TEXTENCODING_UTF8);
253 rDesign.m_aWWW = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
254 RTL_TEXTENCODING_UTF8);
255 rDesign.m_aMisc = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
256 RTL_TEXTENCODING_UTF8);
257 rIn.ReadCharAsBool( rDesign.m_bDownload );
258 rIn.ReadCharAsBool( rDesign.m_bCreated ); // not used
259 rIn.ReadInt16( rDesign.m_nButtonThema );
260 rIn.ReadCharAsBool( rDesign.m_bUserAttr );
261 aSerializer.readColor(rDesign.m_aBackColor);
262 aSerializer.readColor(rDesign.m_aTextColor);
263 aSerializer.readColor(rDesign.m_aLinkColor);
264 aSerializer.readColor(rDesign.m_aVLinkColor);
265 aSerializer.readColor(rDesign.m_aALinkColor);
266 rIn.ReadCharAsBool( rDesign.m_bUseAttribs );
267 rIn.ReadCharAsBool( rDesign.m_bUseColor );
268
269 rIn.ReadUInt16( nTemp16 );
270 rDesign.m_eScript = static_cast<PublishingScript>(nTemp16);
271 rDesign.m_aURL = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
272 RTL_TEXTENCODING_UTF8);
273 rDesign.m_aCGI = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn,
274 RTL_TEXTENCODING_UTF8);
275
276 rIn.ReadCharAsBool( rDesign.m_bAutoSlide );
277 rIn.ReadUInt32( rDesign.m_nSlideDuration );
278 rIn.ReadCharAsBool( rDesign.m_bEndless );
279 rIn.ReadCharAsBool( rDesign.m_bSlideSound );
280 rIn.ReadCharAsBool( rDesign.m_bHiddenSlides );
281
282 return rIn;
283 }
284
285 // Set the design to the stream
WriteSdPublishingDesign(SvStream & rOut,const SdPublishingDesign & rDesign)286 SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDesign)
287 {
288 // The last parameter is the versionnumber of the code
289 SdIOCompat aIO(rOut, StreamMode::WRITE, 0);
290
291 tools::GenericTypeSerializer aSerializer(rOut);
292
293 // Name
294 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aDesignName,
295 RTL_TEXTENCODING_UTF8);
296
297 rOut.WriteUInt16( rDesign.m_eMode );
298 rOut.WriteBool( rDesign.m_bContentPage );
299 rOut.WriteBool( rDesign.m_bNotes );
300 rOut.WriteUInt16( rDesign.m_nResolution );
301 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aCompression,
302 RTL_TEXTENCODING_UTF8);
303 rOut.WriteUInt16( rDesign.m_eFormat );
304 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aAuthor,
305 RTL_TEXTENCODING_UTF8);
306 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aEMail,
307 RTL_TEXTENCODING_UTF8);
308 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aWWW,
309 RTL_TEXTENCODING_UTF8);
310 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aMisc,
311 RTL_TEXTENCODING_UTF8);
312 rOut.WriteBool( rDesign.m_bDownload );
313 rOut.WriteBool( rDesign.m_bCreated ); // not used
314 rOut.WriteInt16( rDesign.m_nButtonThema );
315 rOut.WriteBool( rDesign.m_bUserAttr );
316 aSerializer.writeColor(rDesign.m_aBackColor);
317 aSerializer.writeColor(rDesign.m_aTextColor);
318 aSerializer.writeColor(rDesign.m_aLinkColor);
319 aSerializer.writeColor(rDesign.m_aVLinkColor);
320 aSerializer.writeColor(rDesign.m_aALinkColor);
321 rOut.WriteBool( rDesign.m_bUseAttribs );
322 rOut.WriteBool( rDesign.m_bUseColor );
323
324 rOut.WriteUInt16( rDesign.m_eScript );
325 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aURL,
326 RTL_TEXTENCODING_UTF8);
327 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, rDesign.m_aCGI,
328 RTL_TEXTENCODING_UTF8);
329
330 rOut.WriteBool( rDesign.m_bAutoSlide );
331 rOut.WriteUInt32( rDesign.m_nSlideDuration );
332 rOut.WriteBool( rDesign.m_bEndless );
333 rOut.WriteBool( rDesign.m_bSlideSound );
334 rOut.WriteBool( rDesign.m_bHiddenSlides );
335
336 return rOut;
337 }
338
339 namespace {
340
341 // Dialog for the entry of the name of the design
342 class SdDesignNameDlg : public weld::GenericDialogController
343 {
344 private:
345 std::unique_ptr<weld::Entry> m_xEdit;
346 std::unique_ptr<weld::Button> m_xBtnOK;
347
348 public:
349 SdDesignNameDlg(weld::Window* pWindow, const OUString& aName );
350 OUString GetDesignName() const;
351 DECL_LINK(ModifyHdl, weld::Entry&, void);
352 };
353
354 }
355
356 // SdPublishingDlg Methods
357
SdPublishingDlg(weld::Window * pWindow,DocumentType eDocType)358 SdPublishingDlg::SdPublishingDlg(weld::Window* pWindow, DocumentType eDocType)
359 : GenericDialogController(pWindow, "modules/simpress/ui/publishingdialog.ui", "PublishingDialog")
360 , m_xPage1_Designs(m_xBuilder->weld_tree_view("designsTreeview"))
361 , m_xPage2_Standard_FB(m_xBuilder->weld_image("standardFBImage"))
362 , m_xPage2_Frames_FB(m_xBuilder->weld_image("framesFBImage"))
363 , m_xPage2_Kiosk_FB(m_xBuilder->weld_image("kioskFBImage"))
364 , m_xPage2_WebCast_FB(m_xBuilder->weld_image("webCastFBImage"))
365 , m_xPage4_Misc(m_xBuilder->weld_text_view("miscTextview"))
366 , m_xButtonSet(new ButtonSet())
367 , m_xLastPageButton(m_xBuilder->weld_button("lastPageButton"))
368 , m_xNextPageButton(m_xBuilder->weld_button("nextPageButton"))
369 , m_xFinishButton(m_xBuilder->weld_button("finishButton"))
370 , aAssistentFunc(NOOFPAGES)
371 , m_bButtonsDirty(true)
372 , m_bDesignListDirty(false)
373 , m_pDesign(nullptr)
374 {
375 m_bImpress = eDocType == DocumentType::Impress;
376
377 Size aSize(m_xPage2_Standard_FB->get_approximate_digit_width() * 12,
378 m_xPage2_Standard_FB->get_text_height() * 6);
379 m_xPage2_Standard_FB->set_size_request(aSize.Width(), aSize.Height());
380 m_xPage2_Frames_FB->set_size_request(aSize.Width(), aSize.Height());
381 m_xPage2_Kiosk_FB->set_size_request(aSize.Width(), aSize.Height());
382 m_xPage2_WebCast_FB->set_size_request(aSize.Width(), aSize.Height());
383
384 m_xPage4_Misc->set_size_request(m_xPage4_Misc->get_approximate_digit_width() * 40,
385 m_xPage4_Misc->get_height_rows(8));
386
387 m_xPage1_Designs->set_size_request(m_xPage4_Misc->get_approximate_digit_width() * 40,
388 m_xPage4_Misc->get_height_rows(8));
389
390 //Lock down the preferred size based on the
391 //initial max-size configuration
392 aSize = m_xDialog->get_preferred_size();
393 m_xDialog->set_size_request(aSize.Width(), aSize.Height());
394
395 CreatePages();
396 Load();
397
398 // sets the output page
399 aAssistentFunc.GotoPage(1);
400 m_xLastPageButton->set_sensitive(false);
401
402 // button assignment
403 m_xFinishButton->connect_clicked(LINK(this,SdPublishingDlg,FinishHdl));
404 m_xLastPageButton->connect_clicked(LINK(this,SdPublishingDlg,LastPageHdl));
405 m_xNextPageButton->connect_clicked(LINK(this,SdPublishingDlg,NextPageHdl));
406
407 m_xPage1_NewDesign->connect_toggled(LINK(this,SdPublishingDlg,DesignHdl));
408 m_xPage1_OldDesign->connect_toggled(LINK(this,SdPublishingDlg,DesignHdl));
409 m_xPage1_Designs->connect_changed(LINK(this,SdPublishingDlg,DesignSelectHdl));
410 m_xPage1_DelDesign->connect_clicked(LINK(this,SdPublishingDlg,DesignDeleteHdl));
411
412 m_xPage2_Standard->connect_toggled(LINK(this,SdPublishingDlg,BaseHdl));
413 m_xPage2_Frames->connect_toggled(LINK(this,SdPublishingDlg,BaseHdl));
414 m_xPage2_SingleDocument->connect_toggled(LINK(this,SdPublishingDlg,BaseHdl));
415 m_xPage2_Kiosk->connect_toggled(LINK(this,SdPublishingDlg,BaseHdl));
416 m_xPage2_WebCast->connect_toggled(LINK(this,SdPublishingDlg,BaseHdl));
417
418 m_xPage2_Content->connect_toggled(LINK(this,SdPublishingDlg,ContentHdl));
419
420 m_xPage2_ASP->connect_toggled(LINK(this,SdPublishingDlg,WebServerHdl));
421 m_xPage2_PERL->connect_toggled(LINK(this,SdPublishingDlg,WebServerHdl));
422 m_xPage2_Index->set_text("index" STR_HTMLEXP_DEFAULT_EXTENSION);
423 m_xPage2_CGI->set_text("/cgi-bin/");
424
425 m_xPage3_Png->connect_toggled(LINK(this,SdPublishingDlg, GfxFormatHdl));
426 m_xPage3_Gif->connect_toggled(LINK(this,SdPublishingDlg, GfxFormatHdl));
427 m_xPage3_Jpg->connect_toggled(LINK(this,SdPublishingDlg, GfxFormatHdl));
428 m_xPage3_Quality->set_sensitive(false);
429
430 m_xPage3_Resolution_1->connect_toggled(LINK(this,SdPublishingDlg, ResolutionHdl ));
431 m_xPage3_Resolution_2->connect_toggled(LINK(this,SdPublishingDlg, ResolutionHdl ));
432 m_xPage3_Resolution_3->connect_toggled(LINK(this,SdPublishingDlg, ResolutionHdl ));
433 m_xPage3_Resolution_4->connect_toggled(LINK(this, SdPublishingDlg, ResolutionHdl));
434
435 m_xPage2_ChgDefault->connect_toggled(LINK(this,SdPublishingDlg, SlideChgHdl));
436 m_xPage2_ChgAuto->connect_toggled(LINK(this,SdPublishingDlg, SlideChgHdl));
437
438 m_xPage5_Buttons->SetSelectHdl(LINK(this,SdPublishingDlg, ButtonsHdl ));
439 m_xPage5_Buttons->SetStyle( m_xPage5_Buttons->GetStyle() | WB_VSCROLL );
440
441 m_xPage6_Back->connect_clicked(LINK(this,SdPublishingDlg, ColorHdl ));
442 m_xPage6_Text->connect_clicked(LINK(this,SdPublishingDlg, ColorHdl ));
443 m_xPage6_Link->connect_clicked(LINK(this,SdPublishingDlg, ColorHdl ));
444 m_xPage6_VLink->connect_clicked(LINK(this,SdPublishingDlg, ColorHdl ));
445 m_xPage6_ALink->connect_clicked(LINK(this,SdPublishingDlg, ColorHdl ));
446
447 m_xPage6_DocColors->set_active(true);
448
449 m_xPage3_Quality->append_text( "25%" );
450 m_xPage3_Quality->append_text( "50%" );
451 m_xPage3_Quality->append_text( "75%" );
452 m_xPage3_Quality->append_text( "100%" );
453
454 m_xPage5_Buttons->SetColCount();
455 m_xPage5_Buttons->SetLineCount( 4 );
456 m_xPage5_Buttons->SetExtraSpacing( 1 );
457
458 for( const auto& rDesign : m_aDesignList )
459 m_xPage1_Designs->append_text(rDesign.m_aDesignName);
460
461 SetDefaults();
462
463 m_xDialog->set_help_id(aPageHelpIds[0]);
464
465 m_xNextPageButton->grab_focus();
466 }
467
~SdPublishingDlg()468 SdPublishingDlg::~SdPublishingDlg()
469 {
470 }
471
472 // Generate dialog controls and embed them in the pages
CreatePages()473 void SdPublishingDlg::CreatePages()
474 {
475 // Page 1
476 m_xPage1 = m_xBuilder->weld_container("page1");
477 m_xPage1_Title = m_xBuilder->weld_label("assignLabel");
478 m_xPage1_NewDesign = m_xBuilder->weld_radio_button("newDesignRadiobutton");
479 m_xPage1_OldDesign = m_xBuilder->weld_radio_button("oldDesignRadiobutton");
480 m_xPage1_DelDesign = m_xBuilder->weld_button("delDesingButton");
481 m_xPage1_Desc = m_xBuilder->weld_label("descLabel");
482 aAssistentFunc.InsertControl(1, m_xPage1.get());
483 aAssistentFunc.InsertControl(1, m_xPage1_Title.get());
484 aAssistentFunc.InsertControl(1, m_xPage1_NewDesign.get());
485 aAssistentFunc.InsertControl(1, m_xPage1_OldDesign.get());
486 aAssistentFunc.InsertControl(1, m_xPage1_Designs.get());
487 aAssistentFunc.InsertControl(1, m_xPage1_DelDesign.get());
488 aAssistentFunc.InsertControl(1, m_xPage1_Desc.get());
489
490 // Page 2
491 m_xPage2 = m_xBuilder->weld_container("page2");
492 m_xPage2Frame2 = m_xBuilder->weld_container("page2.2");
493 m_xPage2Frame3 = m_xBuilder->weld_container("page2.3");
494 m_xPage2Frame4 = m_xBuilder->weld_container("page2.4");
495 m_xPage2_Title = m_xBuilder->weld_label("publicationLabel");
496 m_xPage2_Standard = m_xBuilder->weld_radio_button("standardRadiobutton");
497 m_xPage2_Frames = m_xBuilder->weld_radio_button("framesRadiobutton");
498 m_xPage2_SingleDocument = m_xBuilder->weld_radio_button("singleDocumentRadiobutton");
499 m_xPage2_Kiosk = m_xBuilder->weld_radio_button("kioskRadiobutton");
500 m_xPage2_WebCast = m_xBuilder->weld_radio_button("webCastRadiobutton");
501 aAssistentFunc.InsertControl(2, m_xPage2.get());
502 aAssistentFunc.InsertControl(2, m_xPage2Frame2.get());
503 aAssistentFunc.InsertControl(2, m_xPage2Frame3.get());
504 aAssistentFunc.InsertControl(2, m_xPage2Frame4.get());
505 aAssistentFunc.InsertControl(2, m_xPage2_Title.get());
506 aAssistentFunc.InsertControl(2, m_xPage2_Standard.get());
507 aAssistentFunc.InsertControl(2, m_xPage2_Frames.get());
508 aAssistentFunc.InsertControl(2, m_xPage2_SingleDocument.get());
509 aAssistentFunc.InsertControl(2, m_xPage2_Kiosk.get());
510 aAssistentFunc.InsertControl(2, m_xPage2_WebCast.get());
511 aAssistentFunc.InsertControl(2, m_xPage2_Standard_FB.get());
512 aAssistentFunc.InsertControl(2, m_xPage2_Frames_FB.get());
513 aAssistentFunc.InsertControl(2, m_xPage2_Kiosk_FB.get());
514 aAssistentFunc.InsertControl(2, m_xPage2_WebCast_FB.get());
515
516 m_xPage2_Title_Html = m_xBuilder->weld_label( "htmlOptionsLabel");
517 m_xPage2_Content = m_xBuilder->weld_check_button("contentCheckbutton");
518 m_xPage2_Notes = m_xBuilder->weld_check_button("notesCheckbutton");
519 aAssistentFunc.InsertControl(2, m_xPage2_Title_Html.get());
520 aAssistentFunc.InsertControl(2, m_xPage2_Content.get());
521 if (m_bImpress)
522 aAssistentFunc.InsertControl(2, m_xPage2_Notes.get());
523
524 m_xPage2_Title_WebCast = m_xBuilder->weld_label("webCastLabel");
525 m_xPage2_ASP = m_xBuilder->weld_radio_button("ASPRadiobutton");
526 m_xPage2_PERL = m_xBuilder->weld_radio_button("perlRadiobutton");
527 m_xPage2_URL_txt = m_xBuilder->weld_label("URLTxtLabel");
528 m_xPage2_URL = m_xBuilder->weld_entry("URLEntry");
529 m_xPage2_CGI_txt = m_xBuilder->weld_label("CGITxtLabel");
530 m_xPage2_CGI = m_xBuilder->weld_entry("CGIEntry");
531 m_xPage2_Index_txt = m_xBuilder->weld_label("indexTxtLabel");
532 m_xPage2_Index = m_xBuilder->weld_entry("indexEntry");
533 m_xPage2_Title_Kiosk = m_xBuilder->weld_label("kioskLabel");
534 m_xPage2_ChgDefault = m_xBuilder->weld_radio_button("chgDefaultRadiobutton");
535 m_xPage2_ChgAuto = m_xBuilder->weld_radio_button("chgAutoRadiobutton");
536 m_xPage2_Duration_txt = m_xBuilder->weld_label("durationTxtLabel");
537 m_xPage2_Duration = m_xBuilder->weld_formatted_spin_button("durationSpinbutton");
538 m_xFormatter.reset(new weld::TimeFormatter(*m_xPage2_Duration));
539 m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
540 m_xPage2_Endless = m_xBuilder->weld_check_button("endlessCheckbutton");
541 aAssistentFunc.InsertControl(2, m_xPage2_Title_WebCast.get());
542 aAssistentFunc.InsertControl(2, m_xPage2_Index_txt.get());
543 aAssistentFunc.InsertControl(2, m_xPage2_Index.get());
544 aAssistentFunc.InsertControl(2, m_xPage2_ASP.get());
545 aAssistentFunc.InsertControl(2, m_xPage2_PERL.get());
546 aAssistentFunc.InsertControl(2, m_xPage2_URL_txt.get());
547 aAssistentFunc.InsertControl(2, m_xPage2_URL.get());
548 aAssistentFunc.InsertControl(2, m_xPage2_CGI_txt.get());
549 aAssistentFunc.InsertControl(2, m_xPage2_CGI.get());
550 aAssistentFunc.InsertControl(2, m_xPage2_Title_Kiosk.get());
551 aAssistentFunc.InsertControl(2, m_xPage2_ChgDefault.get());
552 aAssistentFunc.InsertControl(2, m_xPage2_ChgAuto.get());
553 aAssistentFunc.InsertControl(2, m_xPage2_Duration_txt.get());
554 aAssistentFunc.InsertControl(2, m_xPage2_Duration.get());
555 aAssistentFunc.InsertControl(2, m_xPage2_Endless.get());
556
557 // Page 3
558 m_xPage3 = m_xBuilder->weld_container("page3");
559 m_xPage3_Title1 = m_xBuilder->weld_label("saveImgAsLabel");
560 m_xPage3_Png = m_xBuilder->weld_radio_button("pngRadiobutton");
561 m_xPage3_Gif = m_xBuilder->weld_radio_button("gifRadiobutton");
562 m_xPage3_Jpg = m_xBuilder->weld_radio_button("jpgRadiobutton");
563 m_xPage3_Quality_txt = m_xBuilder->weld_label("qualityTxtLabel");
564 m_xPage3_Quality= m_xBuilder->weld_combo_box("qualityCombobox");
565 m_xPage3_Title2 = m_xBuilder->weld_label("monitorResolutionLabel");
566 m_xPage3_Resolution_1 = m_xBuilder->weld_radio_button("resolution1Radiobutton");
567 m_xPage3_Resolution_2 = m_xBuilder->weld_radio_button("resolution2Radiobutton");
568 m_xPage3_Resolution_3 = m_xBuilder->weld_radio_button("resolution3Radiobutton");
569 m_xPage3_Resolution_4 = m_xBuilder->weld_radio_button("resolution4Radiobutton");
570 m_xPage3_Title3 = m_xBuilder->weld_label("effectsLabel");
571 m_xPage3_SldSound = m_xBuilder->weld_check_button("sldSoundCheckbutton");
572 m_xPage3_HiddenSlides = m_xBuilder->weld_check_button("hiddenSlidesCheckbutton");
573 aAssistentFunc.InsertControl(3, m_xPage3.get());
574 aAssistentFunc.InsertControl(3, m_xPage3_Title1.get());
575 aAssistentFunc.InsertControl(3, m_xPage3_Png.get());
576 aAssistentFunc.InsertControl(3, m_xPage3_Gif.get());
577 aAssistentFunc.InsertControl(3, m_xPage3_Jpg.get());
578 aAssistentFunc.InsertControl(3, m_xPage3_Quality_txt.get());
579 aAssistentFunc.InsertControl(3, m_xPage3_Quality.get());
580 aAssistentFunc.InsertControl(3, m_xPage3_Title2.get());
581 aAssistentFunc.InsertControl(3, m_xPage3_Resolution_1.get());
582 aAssistentFunc.InsertControl(3, m_xPage3_Resolution_2.get());
583 aAssistentFunc.InsertControl(3, m_xPage3_Resolution_3.get());
584 aAssistentFunc.InsertControl(3, m_xPage3_Resolution_4.get());
585 aAssistentFunc.InsertControl(3, m_xPage3_Title3.get());
586 aAssistentFunc.InsertControl(3, m_xPage3_SldSound.get());
587 aAssistentFunc.InsertControl(3, m_xPage3_HiddenSlides.get());
588
589 // Page 4
590 m_xPage4 = m_xBuilder->weld_container("page4");
591 m_xPage4_Title1 = m_xBuilder->weld_label("infTitlePageLabel");
592 m_xPage4_Author_txt = m_xBuilder->weld_label("authorTxtLabel");
593 m_xPage4_Author = m_xBuilder->weld_entry("authorEntry");
594 m_xPage4_Email_txt = m_xBuilder->weld_label("emailTxtLabel");
595 m_xPage4_Email = m_xBuilder->weld_entry("emailEntry");
596 m_xPage4_WWW_txt = m_xBuilder->weld_label("wwwTxtLabel");
597 m_xPage4_WWW = m_xBuilder->weld_entry("wwwEntry");
598 m_xPage4_Title2 = m_xBuilder->weld_label("addInformLabel");
599 m_xPage4_Download = m_xBuilder->weld_check_button("downloadCheckbutton");
600 aAssistentFunc.InsertControl(4, m_xPage4.get());
601 aAssistentFunc.InsertControl(4, m_xPage4_Title1.get());
602 aAssistentFunc.InsertControl(4, m_xPage4_Author_txt.get());
603 aAssistentFunc.InsertControl(4, m_xPage4_Author.get());
604 aAssistentFunc.InsertControl(4, m_xPage4_Email_txt.get());
605 aAssistentFunc.InsertControl(4, m_xPage4_Email.get());
606 aAssistentFunc.InsertControl(4, m_xPage4_WWW_txt.get());
607 aAssistentFunc.InsertControl(4, m_xPage4_WWW.get());
608 aAssistentFunc.InsertControl(4, m_xPage4_Title2.get());
609 aAssistentFunc.InsertControl(4, m_xPage4_Misc.get());
610 if(m_bImpress)
611 aAssistentFunc.InsertControl(4, m_xPage4_Download.get());
612
613 // Page 5
614 m_xPage5 = m_xBuilder->weld_container("page5");
615 m_xPage5_Title = m_xBuilder->weld_label("buttonStyleLabel");
616 m_xPage5_TextOnly = m_xBuilder->weld_check_button("textOnlyCheckbutton");
617 m_xPage5_Buttons.reset(new ValueSet(m_xBuilder->weld_scrolled_window("buttonsDrawingareawin", true)));
618 m_xPage5_ButtonsWnd.reset(new weld::CustomWeld(*m_xBuilder, "buttonsDrawingarea", *m_xPage5_Buttons));
619 aAssistentFunc.InsertControl(5, m_xPage5.get());
620 aAssistentFunc.InsertControl(5, m_xPage5_Title.get());
621 aAssistentFunc.InsertControl(5, m_xPage5_TextOnly.get());
622 aAssistentFunc.InsertControl(5, m_xPage5_Buttons->GetDrawingArea());
623
624 // Page 6
625 m_xPage6 = m_xBuilder->weld_container("page6");
626 m_xPage6_Title = m_xBuilder->weld_label("selectColorLabel");
627 m_xPage6_Default = m_xBuilder->weld_radio_button("defaultRadiobutton");
628 m_xPage6_User = m_xBuilder->weld_radio_button("userRadiobutton");
629 m_xPage6_Back = m_xBuilder->weld_button("backButton");
630 m_xPage6_Text = m_xBuilder->weld_button("textButton");
631 m_xPage6_Link = m_xBuilder->weld_button("linkButton");
632 m_xPage6_VLink = m_xBuilder->weld_button("vLinkButton");
633 m_xPage6_ALink = m_xBuilder->weld_button("aLinkButton");
634 m_xPage6_DocColors = m_xBuilder->weld_radio_button("docColorsRadiobutton");
635 m_xPage6_Preview.reset(new SdHtmlAttrPreview);
636 m_xPage6_PreviewWnd.reset(new weld::CustomWeld(*m_xBuilder, "previewDrawingarea", *m_xPage6_Preview));
637 aAssistentFunc.InsertControl(6, m_xPage6.get());
638 aAssistentFunc.InsertControl(6, m_xPage6_Title.get());
639 aAssistentFunc.InsertControl(6, m_xPage6_DocColors.get());
640 aAssistentFunc.InsertControl(6, m_xPage6_Default.get());
641 aAssistentFunc.InsertControl(6, m_xPage6_User.get());
642 aAssistentFunc.InsertControl(6, m_xPage6_Text.get());
643 aAssistentFunc.InsertControl(6, m_xPage6_Link.get());
644 aAssistentFunc.InsertControl(6, m_xPage6_ALink.get());
645 aAssistentFunc.InsertControl(6, m_xPage6_VLink.get());
646 aAssistentFunc.InsertControl(6, m_xPage6_Back.get());
647 aAssistentFunc.InsertControl(6, m_xPage6_Preview->GetDrawingArea());
648 }
649
650 // Initialize dialog with default-values
SetDefaults()651 void SdPublishingDlg::SetDefaults()
652 {
653 SdPublishingDesign aDefault;
654 SetDesign(&aDefault);
655
656 m_xPage1_NewDesign->set_active(true);
657 m_xPage1_OldDesign->set_active(false);
658 UpdatePage();
659 }
660
661 // Feed the SfxItemSet with the settings of the dialog
GetParameterSequence(Sequence<PropertyValue> & rParams)662 void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
663 {
664 std::vector< PropertyValue > aProps;
665
666 PropertyValue aValue;
667
668 // Page 2
669 aValue.Name = "PublishMode";
670
671 HtmlPublishMode ePublishMode;
672 if (m_xPage2_Frames->get_active())
673 ePublishMode = PUBLISH_FRAMES;
674 else if (m_xPage2_SingleDocument->get_active())
675 ePublishMode = PUBLISH_SINGLE_DOCUMENT;
676 else if (m_xPage2_Kiosk->get_active())
677 ePublishMode = PUBLISH_KIOSK;
678 else if (m_xPage2_WebCast->get_active())
679 ePublishMode = PUBLISH_WEBCAST;
680 else
681 ePublishMode = PUBLISH_HTML;
682
683 aValue.Value <<= static_cast<sal_Int32>(ePublishMode);
684 aProps.push_back( aValue );
685
686 aValue.Name = "IsExportContentsPage";
687 aValue.Value <<= m_xPage2_Content->get_active();
688 aProps.push_back( aValue );
689
690 if(m_bImpress)
691 {
692 aValue.Name = "IsExportNotes";
693 aValue.Value <<= m_xPage2_Notes->get_active();
694 aProps.push_back( aValue );
695 }
696
697 if( m_xPage2_WebCast->get_active() )
698 {
699 aValue.Name = "WebCastScriptLanguage";
700 if( m_xPage2_ASP->get_active() )
701 aValue.Value <<= OUString( "asp" );
702 else
703 aValue.Value <<= OUString( "perl" );
704 aProps.push_back( aValue );
705
706 aValue.Name = "WebCastCGIURL";
707 aValue.Value <<= m_xPage2_CGI->get_text();
708 aProps.push_back( aValue );
709
710 aValue.Name = "WebCastTargetURL";
711 aValue.Value <<= m_xPage2_URL->get_text();
712 aProps.push_back( aValue );
713 }
714 aValue.Name = "IndexURL";
715 aValue.Value <<= m_xPage2_Index->get_text();
716 aProps.push_back( aValue );
717
718 if( m_xPage2_Kiosk->get_active() && m_xPage2_ChgAuto->get_active() )
719 {
720 aValue.Name = "KioskSlideDuration";
721 aValue.Value <<= static_cast<sal_uInt32>(m_xFormatter->GetTime().GetMSFromTime()) / 1000;
722 aProps.push_back( aValue );
723
724 aValue.Name = "KioskEndless";
725 aValue.Value <<= m_xPage2_Endless->get_active();
726 aProps.push_back( aValue );
727 }
728
729 // Page 3
730
731 aValue.Name = "Width";
732 sal_Int32 nTmpWidth = PUB_LOWRES_WIDTH;
733 if( m_xPage3_Resolution_2->get_active() )
734 nTmpWidth = PUB_MEDRES_WIDTH;
735 else if( m_xPage3_Resolution_3->get_active() )
736 nTmpWidth = PUB_HIGHRES_WIDTH;
737 else if (m_xPage3_Resolution_4->get_active())
738 nTmpWidth = PUB_FHDRES_WIDTH;
739
740 aValue.Value <<= nTmpWidth;
741 aProps.push_back( aValue );
742
743 aValue.Name = "Compression";
744 aValue.Value <<= m_xPage3_Quality->get_active_text();
745 aProps.push_back( aValue );
746
747 aValue.Name = "Format";
748 sal_Int32 nFormat;
749 if( m_xPage3_Png->get_active() )
750 nFormat = static_cast<sal_Int32>(FORMAT_PNG);
751 else if( m_xPage3_Gif->get_active() )
752 nFormat = static_cast<sal_Int32>(FORMAT_GIF);
753 else
754 nFormat = static_cast<sal_Int32>(FORMAT_JPG);
755 aValue.Value <<= nFormat;
756 aProps.push_back( aValue );
757
758 aValue.Name = "SlideSound";
759 aValue.Value <<= m_xPage3_SldSound->get_active();
760 aProps.push_back( aValue );
761
762 aValue.Name = "HiddenSlides";
763 aValue.Value <<= m_xPage3_HiddenSlides->get_active();
764 aProps.push_back( aValue );
765
766 // Page 4
767 aValue.Name = "Author";
768 aValue.Value <<= m_xPage4_Author->get_text();
769 aProps.push_back( aValue );
770
771 aValue.Name = "EMail";
772 aValue.Value <<= m_xPage4_Email->get_text();
773 aProps.push_back( aValue );
774
775 // try to guess protocol for user's homepage
776 INetURLObject aHomeURL( m_xPage4_WWW->get_text(),
777 INetProtocol::Http, // default proto is HTTP
778 INetURLObject::EncodeMechanism::All );
779
780 aValue.Name = "HomepageURL";
781 aValue.Value <<= aHomeURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
782 aProps.push_back( aValue );
783
784 aValue.Name = "UserText";
785 aValue.Value <<= m_xPage4_Misc->get_text();
786 aProps.push_back( aValue );
787
788 if( m_bImpress )
789 {
790 aValue.Name = "EnableDownload";
791 aValue.Value <<= m_xPage4_Download->get_active();
792 aProps.push_back( aValue );
793 }
794
795 // Page 5
796 if( !m_xPage5_TextOnly->get_active() )
797 {
798 aValue.Name = "UseButtonSet";
799 aValue.Value <<= static_cast<sal_Int32>(m_xPage5_Buttons->GetSelectedItemId() - 1);
800 aProps.push_back( aValue );
801 }
802
803 // Page 6
804 if( m_xPage6_User->get_active() )
805 {
806 aValue.Name = "BackColor";
807 aValue.Value <<= m_aBackColor;
808 aProps.push_back( aValue );
809
810 aValue.Name = "TextColor";
811 aValue.Value <<= m_aTextColor;
812 aProps.push_back( aValue );
813
814 aValue.Name = "LinkColor";
815 aValue.Value <<= m_aLinkColor;
816 aProps.push_back( aValue );
817
818 aValue.Name = "VLinkColor";
819 aValue.Value <<= m_aVLinkColor;
820 aProps.push_back( aValue );
821
822 aValue.Name = "ALinkColor";
823 aValue.Value <<= m_aALinkColor;
824 aProps.push_back( aValue );
825 }
826
827 if( m_xPage6_DocColors->get_active() )
828 {
829 aValue.Name = "IsUseDocumentColors";
830 aValue.Value <<= true;
831 aProps.push_back( aValue );
832 }
833
834 rParams = comphelper::containerToSequence(aProps);
835 }
836
837 // Clickhandler for the radiobuttons of the design-selection
IMPL_LINK(SdPublishingDlg,DesignHdl,weld::Toggleable &,rButton,void)838 IMPL_LINK( SdPublishingDlg, DesignHdl, weld::Toggleable&, rButton, void )
839 {
840 if (!rButton.get_active())
841 return;
842
843 if (m_xPage1_NewDesign->get_active())
844 {
845 m_xPage1_NewDesign->set_active(true); // because of DesignDeleteHdl
846 m_xPage1_OldDesign->set_active(false);
847 m_xPage1_Designs->set_sensitive(false);
848 m_xPage1_DelDesign->set_sensitive(false);
849 m_pDesign = nullptr;
850
851 SdPublishingDesign aDefault;
852 SetDesign(&aDefault);
853 }
854 else
855 {
856 m_xPage1_NewDesign->set_active(false);
857 m_xPage1_Designs->set_sensitive(true);
858 m_xPage1_DelDesign->set_sensitive(true);
859
860 if (m_xPage1_Designs->get_selected_index() == -1)
861 m_xPage1_Designs->select(0);
862
863 const sal_Int32 nPos = m_xPage1_Designs->get_selected_index();
864 m_pDesign = &m_aDesignList[nPos];
865 DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
866
867 if(m_pDesign)
868 SetDesign(m_pDesign);
869 }
870 }
871
872 // Clickhandler for the choice of one design
IMPL_LINK_NOARG(SdPublishingDlg,DesignSelectHdl,weld::TreeView &,void)873 IMPL_LINK_NOARG(SdPublishingDlg, DesignSelectHdl, weld::TreeView&, void)
874 {
875 const sal_Int32 nPos = m_xPage1_Designs->get_selected_index();
876 m_pDesign = &m_aDesignList[nPos];
877 DBG_ASSERT(m_pDesign, "No Design? That's not allowed (CL)");
878
879 if(m_pDesign)
880 SetDesign(m_pDesign);
881
882 UpdatePage();
883 }
884
885 // Clickhandler for the delete of one design
IMPL_LINK_NOARG(SdPublishingDlg,DesignDeleteHdl,weld::Button &,void)886 IMPL_LINK_NOARG(SdPublishingDlg, DesignDeleteHdl, weld::Button&, void)
887 {
888 const sal_Int32 nPos = m_xPage1_Designs->get_selected_index();
889
890 std::vector<SdPublishingDesign>::iterator iter = m_aDesignList.begin()+nPos;
891
892 DBG_ASSERT(iter != m_aDesignList.end(), "No Design? That's not allowed (CL)");
893
894 m_xPage1_Designs->remove(nPos);
895
896 if(m_pDesign == &(*iter))
897 DesignHdl(*m_xPage1_NewDesign);
898
899 m_aDesignList.erase(iter);
900
901 m_bDesignListDirty = true;
902
903 UpdatePage();
904 }
905
906 // Clickhandler for the other servertypes
IMPL_LINK(SdPublishingDlg,WebServerHdl,weld::Toggleable &,rButton,void)907 IMPL_LINK(SdPublishingDlg, WebServerHdl, weld::Toggleable&, rButton, void)
908 {
909 if (!rButton.get_active())
910 return;
911
912 bool bASP = m_xPage2_ASP->get_active();
913 m_xPage2_ASP->set_sensitive( bASP );
914 m_xPage2_PERL->set_sensitive( !bASP );
915 UpdatePage();
916 }
917
918 // Clickhandler for the Radiobuttons of the graphicformat choice
IMPL_LINK(SdPublishingDlg,GfxFormatHdl,weld::Toggleable &,rButton,void)919 IMPL_LINK(SdPublishingDlg, GfxFormatHdl, weld::Toggleable&, rButton, void)
920 {
921 if (!rButton.get_active())
922 return;
923
924 m_xPage3_Png->set_sensitive(m_xPage3_Png->get_active());
925 m_xPage3_Gif->set_sensitive(m_xPage3_Gif->get_active());
926 m_xPage3_Jpg->set_sensitive(m_xPage3_Jpg->get_active());
927 m_xPage3_Quality->set_sensitive(m_xPage3_Jpg->get_active());
928 }
929
930 // Clickhandler for the Radiobuttons Standard/Frames
IMPL_LINK(SdPublishingDlg,BaseHdl,weld::Toggleable &,rButton,void)931 IMPL_LINK(SdPublishingDlg, BaseHdl, weld::Toggleable&, rButton, void)
932 {
933 if (!rButton.get_active())
934 return;
935
936 UpdatePage();
937 }
938
939 // Clickhandler for the Checkbox of the Title page
IMPL_LINK_NOARG(SdPublishingDlg,ContentHdl,weld::Toggleable &,void)940 IMPL_LINK_NOARG(SdPublishingDlg, ContentHdl, weld::Toggleable&, void)
941 {
942 if(m_xPage2_Content->get_active())
943 {
944 if(!aAssistentFunc.IsEnabled(4))
945 {
946 aAssistentFunc.EnablePage(4);
947 UpdatePage();
948 }
949 }
950 else
951 {
952 if(aAssistentFunc.IsEnabled(4))
953 {
954 aAssistentFunc.DisablePage(4);
955 UpdatePage();
956 }
957 }
958 }
959
960 // Clickhandler for the Resolution Radiobuttons
IMPL_LINK(SdPublishingDlg,ResolutionHdl,weld::Toggleable &,rButton,void)961 IMPL_LINK( SdPublishingDlg, ResolutionHdl, weld::Toggleable&, rButton, void )
962 {
963 if (!rButton.get_active())
964 return;
965 m_xPage3_Resolution_1->set_sensitive(m_xPage3_Resolution_1->get_active());
966 m_xPage3_Resolution_2->set_sensitive(m_xPage3_Resolution_2->get_active());
967 m_xPage3_Resolution_3->set_sensitive(m_xPage3_Resolution_3->get_active());
968 m_xPage3_Resolution_4->set_sensitive(m_xPage3_Resolution_4->get_active());
969 }
970
971 // Clickhandler for the ValueSet with the bitmap-buttons
IMPL_LINK_NOARG(SdPublishingDlg,ButtonsHdl,ValueSet *,void)972 IMPL_LINK_NOARG(SdPublishingDlg, ButtonsHdl, ValueSet*, void)
973 {
974 // if one bitmap-button is chosen, then disable TextOnly
975 m_xPage5_TextOnly->set_active(false);
976 }
977
978 // Fill the SfxItemSet with the settings of the dialog
IMPL_LINK(SdPublishingDlg,ColorHdl,weld::Button &,rButton,void)979 IMPL_LINK( SdPublishingDlg, ColorHdl, weld::Button&, rButton, void)
980 {
981 SvColorDialog aDlg;
982
983 if (&rButton == m_xPage6_Back.get())
984 {
985 aDlg.SetColor( m_aBackColor );
986 if(aDlg.Execute(m_xDialog.get()) == RET_OK )
987 m_aBackColor = aDlg.GetColor();
988 }
989 else if (&rButton == m_xPage6_Text.get())
990 {
991 aDlg.SetColor( m_aTextColor );
992 if(aDlg.Execute(m_xDialog.get()) == RET_OK )
993 m_aTextColor = aDlg.GetColor();
994 }
995 else if (&rButton == m_xPage6_Link.get())
996 {
997 aDlg.SetColor( m_aLinkColor );
998 if(aDlg.Execute(m_xDialog.get()) == RET_OK )
999 m_aLinkColor = aDlg.GetColor();
1000 }
1001 else if (&rButton == m_xPage6_VLink.get())
1002 {
1003 aDlg.SetColor( m_aVLinkColor );
1004 if(aDlg.Execute(m_xDialog.get()) == RET_OK )
1005 m_aVLinkColor = aDlg.GetColor();
1006 }
1007 else if (&rButton == m_xPage6_ALink.get())
1008 {
1009 aDlg.SetColor( m_aALinkColor );
1010 if(aDlg.Execute(m_xDialog.get()) == RET_OK )
1011 m_aALinkColor = aDlg.GetColor();
1012 }
1013
1014 m_xPage6_User->set_active(true);
1015 m_xPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1016 m_aVLinkColor, m_aALinkColor );
1017 m_xPage6_Preview->Invalidate();
1018 }
1019
IMPL_LINK(SdPublishingDlg,SlideChgHdl,weld::Toggleable &,rButton,void)1020 IMPL_LINK(SdPublishingDlg, SlideChgHdl, weld::Toggleable&, rButton, void)
1021 {
1022 if (!rButton.get_active())
1023 return;
1024 UpdatePage();
1025 }
1026
1027 // Clickhandler for the Ok Button
IMPL_LINK_NOARG(SdPublishingDlg,FinishHdl,weld::Button &,void)1028 IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl, weld::Button&, void)
1029 {
1030 //End
1031 SdPublishingDesign aDesign;
1032 GetDesign(&aDesign);
1033
1034 bool bSave = false;
1035
1036 if(m_xPage1_OldDesign->get_active() && m_pDesign)
1037 {
1038 // are there changes?
1039 if(!(aDesign == *m_pDesign))
1040 bSave = true;
1041 }
1042 else
1043 {
1044 SdPublishingDesign aDefaultDesign;
1045 if(!(aDefaultDesign == aDesign))
1046 bSave = true;
1047 }
1048
1049 if(bSave)
1050 {
1051 OUString aName;
1052 if(m_pDesign)
1053 aName = m_pDesign->m_aDesignName;
1054
1055 bool bRetry;
1056 do
1057 {
1058 bRetry = false;
1059
1060 SdDesignNameDlg aDlg(m_xDialog.get(), aName);
1061
1062 if (aDlg.run() == RET_OK)
1063 {
1064 aDesign.m_aDesignName = aDlg.GetDesignName();
1065
1066 auto iter = std::find_if(m_aDesignList.begin(), m_aDesignList.end(),
1067 [&aDesign](const SdPublishingDesign& rDesign) { return rDesign.m_aDesignName == aDesign.m_aDesignName; });
1068
1069 if (iter != m_aDesignList.end())
1070 {
1071 std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
1072 VclMessageType::Error, VclButtonsType::YesNo,
1073 SdResId(STR_PUBDLG_SAMENAME)));
1074 bRetry = xErrorBox->run() == RET_NO;
1075
1076 if(!bRetry)
1077 m_aDesignList.erase(iter);
1078 }
1079
1080 if(!bRetry)
1081 {
1082 m_aDesignList.push_back(aDesign);
1083 m_bDesignListDirty = true;
1084 }
1085 }
1086 }
1087 while(bRetry);
1088 }
1089
1090 if(m_bDesignListDirty)
1091 Save();
1092
1093 m_xDialog->response(RET_OK);
1094 }
1095
1096 // Refresh the dialogs when changing from pages
ChangePage()1097 void SdPublishingDlg::ChangePage()
1098 {
1099 int nPage = aAssistentFunc.GetCurrentPage();
1100 m_xDialog->set_help_id(aPageHelpIds[nPage-1]);
1101
1102 UpdatePage();
1103
1104 if (m_xNextPageButton->get_sensitive())
1105 m_xNextPageButton->grab_focus();
1106 else
1107 m_xFinishButton->grab_focus();
1108 }
1109
UpdatePage()1110 void SdPublishingDlg::UpdatePage()
1111 {
1112 m_xNextPageButton->set_sensitive(!aAssistentFunc.IsLastPage());
1113 m_xLastPageButton->set_sensitive(!aAssistentFunc.IsFirstPage());
1114
1115 int nPage = aAssistentFunc.GetCurrentPage();
1116
1117 switch( nPage )
1118 {
1119 case 1:
1120 if(m_xPage1_NewDesign->get_active())
1121 {
1122 m_xPage1_Designs->set_sensitive(false);
1123 m_xPage1_DelDesign->set_sensitive(false);
1124 }
1125
1126 if(m_aDesignList.empty())
1127 m_xPage1_OldDesign->set_sensitive(false);
1128 break;
1129 case 2:
1130 m_xPage2_Frames_FB->set_visible(m_xPage2_Frames->get_active());
1131 m_xPage2_Standard_FB->set_visible(m_xPage2_Standard->get_active());
1132 m_xPage2_Kiosk_FB->set_visible(m_xPage2_Kiosk->get_active());
1133 m_xPage2_WebCast_FB->set_visible(m_xPage2_WebCast->get_active());
1134
1135 if( m_xPage2_WebCast->get_active() )
1136 {
1137 m_xPage2Frame4->show();
1138 m_xPage2_Title_WebCast->show();
1139 m_xPage2_ASP->show();
1140 m_xPage2_PERL->show();
1141 m_xPage2_URL_txt->show();
1142 m_xPage2_URL->show();
1143 m_xPage2_CGI_txt->show();
1144 m_xPage2_CGI->show();
1145 m_xPage2_Index_txt->show();
1146 m_xPage2_Index->show();
1147
1148 bool bPerl = m_xPage2_PERL->get_active();
1149 m_xPage2_Index->set_sensitive(bPerl);
1150 m_xPage2_Index_txt->set_sensitive(bPerl);
1151 m_xPage2_URL_txt->set_sensitive(bPerl);
1152 m_xPage2_URL->set_sensitive(bPerl);
1153 m_xPage2_CGI_txt->set_sensitive(bPerl);
1154 m_xPage2_CGI->set_sensitive(bPerl);
1155 }
1156 else
1157 {
1158 m_xPage2Frame4->hide();
1159 m_xPage2_Title_WebCast->hide();
1160 m_xPage2_ASP->hide();
1161 m_xPage2_PERL->hide();
1162 m_xPage2_URL_txt->hide();
1163 m_xPage2_URL->hide();
1164 m_xPage2_CGI_txt->hide();
1165 m_xPage2_CGI->hide();
1166 m_xPage2_Index->hide();
1167 m_xPage2_Index_txt->hide();
1168 }
1169
1170 if( m_xPage2_Kiosk->get_active() )
1171 {
1172 m_xPage2Frame3->show();
1173 m_xPage2_Title_Kiosk->show();
1174 m_xPage2_ChgDefault->show();
1175 m_xPage2_ChgAuto->show();
1176 m_xPage2_Duration_txt->show();
1177 m_xPage2_Duration->show();
1178 m_xPage2_Endless->show();
1179 bool bAuto = m_xPage2_ChgAuto->get_active();
1180 m_xPage2_Duration->set_sensitive(bAuto);
1181 m_xPage2_Endless->set_sensitive(bAuto);
1182 }
1183 else
1184 {
1185 m_xPage2Frame3->hide();
1186 m_xPage2_Title_Kiosk->hide();
1187 m_xPage2_ChgDefault->hide();
1188 m_xPage2_ChgAuto->hide();
1189 m_xPage2_Duration->hide();
1190 m_xPage2_Duration_txt->hide();
1191 m_xPage2_Endless->hide();
1192 }
1193
1194 if( m_xPage2_Standard->get_active() || m_xPage2_Frames->get_active() )
1195 {
1196 m_xPage2Frame2->show();
1197 m_xPage2_Title_Html->show();
1198 m_xPage2_Content->show();
1199 if(m_bImpress)
1200 m_xPage2_Notes->show();
1201 }
1202 else
1203 {
1204 m_xPage2Frame2->hide();
1205 m_xPage2_Title_Html->hide();
1206 m_xPage2_Content->hide();
1207 if(m_bImpress)
1208 m_xPage2_Notes->hide();
1209 }
1210 break;
1211 case 3:
1212 if( m_xPage2_Kiosk->get_active() || m_xPage2_WebCast->get_active() )
1213 m_xNextPageButton->set_sensitive(false);
1214
1215 if( m_xPage2_WebCast->get_active() )
1216 m_xPage3_SldSound->set_sensitive(false);
1217
1218 m_xPage3_Quality->set_sensitive(m_xPage3_Jpg->get_active());
1219
1220 break;
1221 case 5:
1222 if( m_bButtonsDirty )
1223 LoadPreviewButtons();
1224 break;
1225 }
1226 }
1227
1228 /** loads the html buttons from the button sets, creates a preview and fills the
1229 itemset for page 5
1230 */
LoadPreviewButtons()1231 void SdPublishingDlg::LoadPreviewButtons()
1232 {
1233 if (!m_xButtonSet)
1234 return;
1235
1236 const int nButtonCount = 8;
1237 static const char *pButtonNames[nButtonCount] =
1238 {
1239 "first.png",
1240 "left.png",
1241 "right.png",
1242 "last.png",
1243 "home.png",
1244 "text.png",
1245 "expand.png",
1246 "collapse.png",
1247 };
1248
1249 std::vector< OUString > aButtonNames;
1250 for(const char * p : pButtonNames)
1251 aButtonNames.push_back( OUString::createFromAscii( p ) );
1252
1253 int nSetCount = m_xButtonSet->getCount();
1254
1255 int nHeight = 32;
1256 Image aImage;
1257 for( int nSet = 0; nSet < nSetCount; ++nSet )
1258 {
1259 if( m_xButtonSet->getPreview( nSet, aButtonNames, aImage ) )
1260 {
1261 m_xPage5_Buttons->InsertItem( static_cast<sal_uInt16>(nSet)+1, aImage );
1262 if( nHeight < aImage.GetSizePixel().Height() )
1263 nHeight = aImage.GetSizePixel().Height();
1264 }
1265 }
1266
1267 m_xPage5_Buttons->SetItemHeight( nHeight );
1268 m_bButtonsDirty = false;
1269 }
1270
1271 // Clickhandler for the Forward Button
IMPL_LINK_NOARG(SdPublishingDlg,NextPageHdl,weld::Button &,void)1272 IMPL_LINK_NOARG(SdPublishingDlg, NextPageHdl, weld::Button&, void)
1273 {
1274 aAssistentFunc.NextPage();
1275 ChangePage();
1276 }
1277
1278 // Sets the Controls in the dialog to the settings in the design
SetDesign(SdPublishingDesign const * pDesign)1279 void SdPublishingDlg::SetDesign( SdPublishingDesign const * pDesign )
1280 {
1281 if(!pDesign)
1282 return;
1283
1284 m_xPage2_Standard->set_sensitive(pDesign->m_eMode == PUBLISH_HTML);
1285 m_xPage2_Frames->set_sensitive(pDesign->m_eMode == PUBLISH_FRAMES);
1286 m_xPage2_Kiosk->set_sensitive(pDesign->m_eMode == PUBLISH_KIOSK );
1287 m_xPage2_WebCast->set_sensitive(pDesign->m_eMode == PUBLISH_WEBCAST );
1288
1289 m_xPage2_Content->set_sensitive(pDesign->m_bContentPage);
1290 if(pDesign->m_bContentPage)
1291 aAssistentFunc.EnablePage(4);
1292 else
1293 aAssistentFunc.DisablePage(4);
1294
1295 if(m_bImpress)
1296 m_xPage2_Notes->set_sensitive(pDesign->m_bNotes);
1297
1298 m_xPage2_ASP->set_sensitive(pDesign->m_eScript == SCRIPT_ASP);
1299 m_xPage2_PERL->set_sensitive(pDesign->m_eScript == SCRIPT_PERL);
1300 m_xPage2_CGI->set_text(pDesign->m_aCGI);
1301 m_xPage2_URL->set_text(pDesign->m_aURL);
1302
1303 m_xPage2_ChgDefault->set_sensitive( !pDesign->m_bAutoSlide );
1304 m_xPage2_ChgAuto->set_sensitive( pDesign->m_bAutoSlide );
1305
1306 tools::Time aTime( tools::Time::EMPTY );
1307 aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 );
1308 m_xFormatter->SetTime(aTime);
1309
1310 m_xPage2_Endless->set_sensitive( pDesign->m_bEndless );
1311
1312 m_xPage3_Png->set_sensitive(pDesign->m_eFormat == FORMAT_PNG);
1313 m_xPage3_Gif->set_sensitive(pDesign->m_eFormat == FORMAT_GIF);
1314 m_xPage3_Jpg->set_sensitive(pDesign->m_eFormat == FORMAT_JPG);
1315 m_xPage3_Quality->set_sensitive(pDesign->m_eFormat == FORMAT_JPG);
1316
1317 m_xPage3_Quality->set_entry_text(pDesign->m_aCompression);
1318 m_xPage3_Resolution_1->set_sensitive(pDesign->m_nResolution == PUB_LOWRES_WIDTH);
1319 m_xPage3_Resolution_2->set_sensitive(pDesign->m_nResolution == PUB_MEDRES_WIDTH);
1320 m_xPage3_Resolution_3->set_sensitive(pDesign->m_nResolution == PUB_HIGHRES_WIDTH);
1321 m_xPage3_Resolution_4->set_sensitive(pDesign->m_nResolution == PUB_FHDRES_WIDTH);
1322
1323 m_xPage3_SldSound->set_sensitive( pDesign->m_bSlideSound );
1324 m_xPage3_HiddenSlides->set_sensitive( pDesign->m_bHiddenSlides );
1325
1326 m_xPage4_Author->set_text(pDesign->m_aAuthor);
1327 m_xPage4_Email->set_text(pDesign->m_aEMail);
1328 m_xPage4_WWW->set_text(pDesign->m_aWWW);
1329 m_xPage4_Misc->set_text(pDesign->m_aMisc);
1330 if(m_bImpress)
1331 m_xPage4_Download->set_sensitive(pDesign->m_bDownload);
1332
1333 m_xPage5_TextOnly->set_sensitive(pDesign->m_nButtonThema == -1);
1334 if(pDesign->m_nButtonThema != -1)
1335 {
1336 if(m_bButtonsDirty)
1337 LoadPreviewButtons();
1338 m_xPage5_Buttons->SelectItem(pDesign->m_nButtonThema + 1);
1339 }
1340 else
1341 m_xPage5_Buttons->SetNoSelection();
1342
1343 m_xPage6_User->set_sensitive(pDesign->m_bUserAttr);
1344 m_aBackColor = pDesign->m_aBackColor;
1345 m_aTextColor = pDesign->m_aTextColor;
1346 m_aLinkColor = pDesign->m_aLinkColor;
1347 m_aVLinkColor = pDesign->m_aVLinkColor;
1348 m_aALinkColor = pDesign->m_aALinkColor;
1349
1350 m_xPage6_DocColors->set_sensitive(pDesign->m_bUseColor);
1351
1352 m_xPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor,
1353 m_aVLinkColor, m_aALinkColor );
1354 m_xPage6_Preview->Invalidate();
1355
1356 UpdatePage();
1357 }
1358
1359 // Transfer the status of the Design Dialog Controls
GetDesign(SdPublishingDesign * pDesign)1360 void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign )
1361 {
1362 if(!pDesign)
1363 return;
1364
1365 pDesign->m_eMode = m_xPage2_Standard->get_active()?PUBLISH_HTML:
1366 m_xPage2_Frames->get_active()?PUBLISH_FRAMES:
1367 m_xPage2_Kiosk->get_active()?PUBLISH_KIOSK:
1368 PUBLISH_WEBCAST;
1369
1370 pDesign->m_bContentPage = m_xPage2_Content->get_active();
1371 if(m_bImpress)
1372 pDesign->m_bNotes = m_xPage2_Notes->get_active();
1373
1374 if( m_xPage3_Gif->get_active() )
1375 pDesign->m_eFormat = FORMAT_GIF;
1376 else if( m_xPage3_Jpg->get_active() )
1377 pDesign->m_eFormat = FORMAT_JPG;
1378 else
1379 pDesign->m_eFormat = FORMAT_PNG;
1380
1381 pDesign->m_aCompression = m_xPage3_Quality->get_active_text();
1382
1383 if (m_xPage3_Resolution_1->get_active())
1384 pDesign->m_nResolution = PUB_LOWRES_WIDTH;
1385 else if (m_xPage3_Resolution_2->get_active())
1386 pDesign->m_nResolution = PUB_MEDRES_WIDTH;
1387 else if (m_xPage3_Resolution_3->get_active())
1388 pDesign->m_nResolution = PUB_HIGHRES_WIDTH;
1389 else
1390 pDesign->m_nResolution = PUB_FHDRES_WIDTH;
1391
1392 pDesign->m_bSlideSound = m_xPage3_SldSound->get_active();
1393 pDesign->m_bHiddenSlides = m_xPage3_HiddenSlides->get_active();
1394
1395 pDesign->m_aAuthor = m_xPage4_Author->get_text();
1396 pDesign->m_aEMail = m_xPage4_Email->get_text();
1397 pDesign->m_aWWW = m_xPage4_WWW->get_text();
1398 pDesign->m_aMisc = m_xPage4_Misc->get_text();
1399 pDesign->m_bDownload = m_bImpress && m_xPage4_Download->get_active();
1400
1401 if(m_xPage5_TextOnly->get_active())
1402 pDesign->m_nButtonThema = -1;
1403 else
1404 pDesign->m_nButtonThema = m_xPage5_Buttons->GetSelectedItemId() - 1;
1405
1406 pDesign->m_bUserAttr = m_xPage6_User->get_active();
1407 pDesign->m_aBackColor = m_aBackColor;
1408 pDesign->m_aTextColor = m_aTextColor;
1409 pDesign->m_aLinkColor = m_aLinkColor;
1410 pDesign->m_aVLinkColor = m_aVLinkColor;
1411 pDesign->m_aALinkColor = m_aALinkColor;
1412 pDesign->m_bUseColor = m_xPage6_DocColors->get_active();
1413
1414 pDesign->m_eScript = m_xPage2_ASP->get_active()?SCRIPT_ASP:SCRIPT_PERL;
1415 pDesign->m_aCGI = m_xPage2_CGI->get_text();
1416 pDesign->m_aURL = m_xPage2_URL->get_text();
1417
1418 pDesign->m_bAutoSlide = m_xPage2_ChgAuto->get_active();
1419 pDesign->m_nSlideDuration = static_cast<sal_uInt32>(m_xFormatter->GetTime().GetMSFromTime()) / 1000;
1420 pDesign->m_bEndless = m_xPage2_Endless->get_active();
1421 }
1422
1423 // Clickhandler for the back Button
IMPL_LINK_NOARG(SdPublishingDlg,LastPageHdl,weld::Button &,void)1424 IMPL_LINK_NOARG(SdPublishingDlg, LastPageHdl, weld::Button&, void)
1425 {
1426 aAssistentFunc.PreviousPage();
1427 ChangePage();
1428 }
1429
1430 // Load Designs
Load()1431 void SdPublishingDlg::Load()
1432 {
1433 m_bDesignListDirty = false;
1434
1435 INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1436 aURL.Append( u"designs.sod" );
1437
1438 // check if file exists, SfxMedium shows an errorbox else
1439 {
1440 std::unique_ptr<SvStream> pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ );
1441
1442 bool bOk = pIStm && ( pIStm->GetError() == ERRCODE_NONE);
1443
1444 if( !bOk )
1445 return;
1446 }
1447
1448 SfxMedium aMedium( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ | StreamMode::NOCREATE );
1449
1450 SvStream* pStream = aMedium.GetInStream();
1451
1452 if( !pStream )
1453 return;
1454
1455 sal_uInt16 aCheck;
1456 pStream->ReadUInt16( aCheck );
1457
1458 if(aCheck != nMagic)
1459 return;
1460
1461 SdIOCompat aIO(*pStream, StreamMode::READ);
1462
1463 sal_uInt16 nDesigns(0);
1464 pStream->ReadUInt16(nDesigns);
1465
1466 // there has to at least be a sal_uInt16 header in each design
1467 const size_t nMaxRecords = pStream->remainingSize() / sizeof(sal_uInt16);
1468 if (nDesigns > nMaxRecords)
1469 {
1470 SAL_WARN("sd", "Parsing error: " << nMaxRecords <<
1471 " max possible entries, but " << nDesigns << " claimed, truncating");
1472 nDesigns = nMaxRecords;
1473 }
1474
1475 for( sal_uInt16 nIndex = 0;
1476 pStream->GetError() == ERRCODE_NONE && nIndex < nDesigns;
1477 nIndex++ )
1478 {
1479 SdPublishingDesign aDesign;
1480 *pStream >> aDesign;
1481
1482 m_aDesignList.push_back(aDesign);
1483 }
1484 }
1485
1486 // Save Designs
Save()1487 bool SdPublishingDlg::Save()
1488 {
1489 INetURLObject aURL( SvtPathOptions().GetUserConfigPath() );
1490 aURL.Append( u"designs.sod" );
1491 SfxMedium aMedium( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE | StreamMode::TRUNC );
1492
1493 SvStream* pStream = aMedium.GetOutStream();
1494
1495 if( !pStream )
1496 return false;
1497
1498 pStream->WriteUInt16( nMagic );
1499
1500 // Destroys the SdIOCompat before the Stream is being distributed
1501 {
1502 SdIOCompat aIO(*pStream, StreamMode::WRITE, 0);
1503
1504 sal_uInt16 nDesigns = static_cast<sal_uInt16>(m_aDesignList.size());
1505 pStream->WriteUInt16( nDesigns );
1506
1507 for( sal_uInt16 nIndex = 0;
1508 pStream->GetError() == ERRCODE_NONE && nIndex < nDesigns;
1509 nIndex++ )
1510 WriteSdPublishingDesign( *pStream, m_aDesignList[nIndex] );
1511 }
1512
1513 aMedium.Close();
1514 aMedium.Commit();
1515
1516 return( aMedium.GetError() == ERRCODE_NONE );
1517 }
1518
1519 // SdDesignNameDlg Methods
SdDesignNameDlg(weld::Window * pWindow,const OUString & rName)1520 SdDesignNameDlg::SdDesignNameDlg(weld::Window* pWindow, const OUString& rName)
1521 : GenericDialogController(pWindow, "modules/sdraw/ui/namedesign.ui", "NameDesignDialog")
1522 , m_xEdit(m_xBuilder->weld_entry("entry"))
1523 , m_xBtnOK(m_xBuilder->weld_button("ok"))
1524 {
1525 m_xEdit->connect_changed(LINK(this, SdDesignNameDlg, ModifyHdl ));
1526 m_xEdit->set_text(rName);
1527 m_xBtnOK->set_sensitive(!rName.isEmpty());
1528 }
1529
GetDesignName() const1530 OUString SdDesignNameDlg::GetDesignName() const
1531 {
1532 return m_xEdit->get_text();
1533 }
1534
IMPL_LINK_NOARG(SdDesignNameDlg,ModifyHdl,weld::Entry &,void)1535 IMPL_LINK_NOARG(SdDesignNameDlg, ModifyHdl, weld::Entry&, void)
1536 {
1537 m_xBtnOK->set_sensitive(!m_xEdit->get_text().isEmpty());
1538 }
1539
1540 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1541