1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
36 #include <unotools/useroptions.hxx>
37 #include <unotools/pathoptions.hxx>
39 #include <sdresid.hxx>
40 #include <strings.hrc>
42 #include "htmlattr.hxx"
44 #include "htmlpublishmode.hxx"
46 #include "buttonset.hxx"
47 #include <strings.hxx>
49 using namespace com::sun::star::uno
;
50 using namespace com::sun::star::beans
;
54 //ID for the config-data with the HTML-settings
55 const sal_uInt16 nMagic
= sal_uInt16(0x1977);
57 // Key for the soffice.ini
58 constexpr OUStringLiteral KEY_QUALITY
= u
"JPG-EXPORT-QUALITY";
60 // The Help-IDs of the pages
61 constexpr rtl::OUStringConstExpr aPageHelpIds
[NOOFPAGES
] =
63 HID_SD_HTMLEXPORT_PAGE1
,
64 HID_SD_HTMLEXPORT_PAGE2
,
65 HID_SD_HTMLEXPORT_PAGE3
,
66 HID_SD_HTMLEXPORT_PAGE4
,
67 HID_SD_HTMLEXPORT_PAGE5
,
68 HID_SD_HTMLEXPORT_PAGE6
71 static SvStream
& operator >> (SvStream
& rIn
, SdPublishingDesign
& rDesign
);
73 static SvStream
& WriteSdPublishingDesign(SvStream
& rOut
, const SdPublishingDesign
& rDesign
);
75 // This class has all the settings for the HTML-export autopilot
76 class SdPublishingDesign
79 OUString m_aDesignName
;
81 HtmlPublishMode m_eMode
;
83 // special WebCast options
84 PublishingScript m_eScript
;
88 // special Kiosk options
90 sal_uInt32 m_nSlideDuration
;
93 // special HTML options
98 sal_uInt16 m_nResolution
;
99 OUString m_aCompression
;
100 PublishingFormat m_eFormat
;
102 bool m_bHiddenSlides
;
104 // title page information
110 bool m_bCreated
; // not used
112 // buttons and colorscheme
113 sal_Int16 m_nButtonThema
;
123 SdPublishingDesign();
125 bool operator ==(const SdPublishingDesign
& rDesign
) const;
126 friend SvStream
& operator >> (SvStream
& rIn
, SdPublishingDesign
& rDesign
);
127 friend SvStream
& WriteSdPublishingDesign(SvStream
& rOut
, const SdPublishingDesign
& rDesign
);
130 // load Default-settings
131 SdPublishingDesign::SdPublishingDesign()
132 : m_eMode(PUBLISH_HTML
)
133 , m_eScript(SCRIPT_ASP
)
135 , m_nSlideDuration(15)
137 , m_bContentPage(true)
139 , m_nResolution(PUB_LOWRES_WIDTH
)
140 , m_eFormat(FORMAT_PNG
)
141 , m_bSlideSound(true)
142 , m_bHiddenSlides(false)
147 , m_aBackColor(COL_WHITE
)
148 , m_aTextColor(COL_BLACK
)
149 , m_aLinkColor(COL_BLUE
)
150 , m_aVLinkColor(COL_LIGHTGRAY
)
151 , m_aALinkColor(COL_GRAY
)
152 , m_bUseAttribs(true)
155 FilterConfigItem
aFilterConfigItem(u
"Office.Common/Filter/Graphic/Export/JPG");
156 sal_Int32 nCompression
= aFilterConfigItem
.ReadInt32( KEY_QUALITY
, 75 );
157 m_aCompression
= OUString::number(nCompression
) + "%";
159 SvtUserOptions aUserOptions
;
160 m_aAuthor
= aUserOptions
.GetFirstName();
161 if (!m_aAuthor
.isEmpty() && !aUserOptions
.GetLastName().isEmpty())
163 m_aAuthor
+= aUserOptions
.GetLastName();
164 m_aEMail
= aUserOptions
.GetEmail();
167 // Compares the values without paying attention to the name
168 bool SdPublishingDesign::operator ==(const SdPublishingDesign
& rDesign
) const
172 m_eMode
== rDesign
.m_eMode
&&
173 m_nResolution
== rDesign
.m_nResolution
&&
174 m_aCompression
== rDesign
.m_aCompression
&&
175 m_eFormat
== rDesign
.m_eFormat
&&
176 m_bHiddenSlides
== rDesign
.m_bHiddenSlides
&&
177 ( // compare html options
178 (m_eMode
!= PUBLISH_HTML
&& m_eMode
!= PUBLISH_FRAMES
) ||
180 m_bContentPage
== rDesign
.m_bContentPage
&&
181 m_bNotes
== rDesign
.m_bNotes
&&
182 m_aAuthor
== rDesign
.m_aAuthor
&&
183 m_aEMail
== rDesign
.m_aEMail
&&
184 m_aWWW
== rDesign
.m_aWWW
&&
185 m_aMisc
== rDesign
.m_aMisc
&&
186 m_bDownload
== rDesign
.m_bDownload
&&
187 m_nButtonThema
== rDesign
.m_nButtonThema
&&
188 m_bUserAttr
== rDesign
.m_bUserAttr
&&
189 m_aBackColor
== rDesign
.m_aBackColor
&&
190 m_aTextColor
== rDesign
.m_aTextColor
&&
191 m_aLinkColor
== rDesign
.m_aLinkColor
&&
192 m_aVLinkColor
== rDesign
.m_aVLinkColor
&&
193 m_aALinkColor
== rDesign
.m_aALinkColor
&&
194 m_bUseAttribs
== rDesign
.m_bUseAttribs
&&
195 m_bSlideSound
== rDesign
.m_bSlideSound
&&
196 m_bUseColor
== rDesign
.m_bUseColor
199 ( // compare kiosk options
200 (m_eMode
!= PUBLISH_KIOSK
) ||
202 m_bAutoSlide
== rDesign
.m_bAutoSlide
&&
203 m_bSlideSound
== rDesign
.m_bSlideSound
&&
207 m_nSlideDuration
== rDesign
.m_nSlideDuration
&&
208 m_bEndless
== rDesign
.m_bEndless
213 ( // compare WebCast options
214 (m_eMode
!= PUBLISH_WEBCAST
) ||
216 m_eScript
== rDesign
.m_eScript
&&
218 m_eScript
!= SCRIPT_PERL
||
220 m_aURL
== rDesign
.m_aURL
&&
221 m_aCGI
== rDesign
.m_aCGI
229 // Load the design from the stream
230 SvStream
& operator >> (SvStream
& rIn
, SdPublishingDesign
& rDesign
)
232 SdIOCompat
aIO(rIn
, StreamMode::READ
);
235 tools::GenericTypeSerializer
aSerializer(rIn
);
237 rDesign
.m_aDesignName
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
238 RTL_TEXTENCODING_UTF8
);
239 rIn
.ReadUInt16( nTemp16
);
240 rDesign
.m_eMode
= static_cast<HtmlPublishMode
>(nTemp16
);
241 rIn
.ReadCharAsBool( rDesign
.m_bContentPage
);
242 rIn
.ReadCharAsBool( rDesign
.m_bNotes
);
243 rIn
.ReadUInt16( rDesign
.m_nResolution
);
244 rDesign
.m_aCompression
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
245 RTL_TEXTENCODING_UTF8
);
246 rIn
.ReadUInt16( nTemp16
);
247 rDesign
.m_eFormat
= static_cast<PublishingFormat
>(nTemp16
);
248 rDesign
.m_aAuthor
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
249 RTL_TEXTENCODING_UTF8
);
250 rDesign
.m_aEMail
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
251 RTL_TEXTENCODING_UTF8
);
252 rDesign
.m_aWWW
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
253 RTL_TEXTENCODING_UTF8
);
254 rDesign
.m_aMisc
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
255 RTL_TEXTENCODING_UTF8
);
256 rIn
.ReadCharAsBool( rDesign
.m_bDownload
);
257 rIn
.ReadCharAsBool( rDesign
.m_bCreated
); // not used
258 rIn
.ReadInt16( rDesign
.m_nButtonThema
);
259 rIn
.ReadCharAsBool( rDesign
.m_bUserAttr
);
260 aSerializer
.readColor(rDesign
.m_aBackColor
);
261 aSerializer
.readColor(rDesign
.m_aTextColor
);
262 aSerializer
.readColor(rDesign
.m_aLinkColor
);
263 aSerializer
.readColor(rDesign
.m_aVLinkColor
);
264 aSerializer
.readColor(rDesign
.m_aALinkColor
);
265 rIn
.ReadCharAsBool( rDesign
.m_bUseAttribs
);
266 rIn
.ReadCharAsBool( rDesign
.m_bUseColor
);
268 rIn
.ReadUInt16( nTemp16
);
269 rDesign
.m_eScript
= static_cast<PublishingScript
>(nTemp16
);
270 rDesign
.m_aURL
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
271 RTL_TEXTENCODING_UTF8
);
272 rDesign
.m_aCGI
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
273 RTL_TEXTENCODING_UTF8
);
275 rIn
.ReadCharAsBool( rDesign
.m_bAutoSlide
);
276 rIn
.ReadUInt32( rDesign
.m_nSlideDuration
);
277 rIn
.ReadCharAsBool( rDesign
.m_bEndless
);
278 rIn
.ReadCharAsBool( rDesign
.m_bSlideSound
);
279 rIn
.ReadCharAsBool( rDesign
.m_bHiddenSlides
);
284 // Set the design to the stream
285 SvStream
& WriteSdPublishingDesign(SvStream
& rOut
, const SdPublishingDesign
& rDesign
)
287 // The last parameter is the versionnumber of the code
288 SdIOCompat
aIO(rOut
, StreamMode::WRITE
, 0);
290 tools::GenericTypeSerializer
aSerializer(rOut
);
293 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aDesignName
,
294 RTL_TEXTENCODING_UTF8
);
296 rOut
.WriteUInt16( rDesign
.m_eMode
);
297 rOut
.WriteBool( rDesign
.m_bContentPage
);
298 rOut
.WriteBool( rDesign
.m_bNotes
);
299 rOut
.WriteUInt16( rDesign
.m_nResolution
);
300 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aCompression
,
301 RTL_TEXTENCODING_UTF8
);
302 rOut
.WriteUInt16( rDesign
.m_eFormat
);
303 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aAuthor
,
304 RTL_TEXTENCODING_UTF8
);
305 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aEMail
,
306 RTL_TEXTENCODING_UTF8
);
307 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aWWW
,
308 RTL_TEXTENCODING_UTF8
);
309 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aMisc
,
310 RTL_TEXTENCODING_UTF8
);
311 rOut
.WriteBool( rDesign
.m_bDownload
);
312 rOut
.WriteBool( rDesign
.m_bCreated
); // not used
313 rOut
.WriteInt16( rDesign
.m_nButtonThema
);
314 rOut
.WriteBool( rDesign
.m_bUserAttr
);
315 aSerializer
.writeColor(rDesign
.m_aBackColor
);
316 aSerializer
.writeColor(rDesign
.m_aTextColor
);
317 aSerializer
.writeColor(rDesign
.m_aLinkColor
);
318 aSerializer
.writeColor(rDesign
.m_aVLinkColor
);
319 aSerializer
.writeColor(rDesign
.m_aALinkColor
);
320 rOut
.WriteBool( rDesign
.m_bUseAttribs
);
321 rOut
.WriteBool( rDesign
.m_bUseColor
);
323 rOut
.WriteUInt16( rDesign
.m_eScript
);
324 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aURL
,
325 RTL_TEXTENCODING_UTF8
);
326 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aCGI
,
327 RTL_TEXTENCODING_UTF8
);
329 rOut
.WriteBool( rDesign
.m_bAutoSlide
);
330 rOut
.WriteUInt32( rDesign
.m_nSlideDuration
);
331 rOut
.WriteBool( rDesign
.m_bEndless
);
332 rOut
.WriteBool( rDesign
.m_bSlideSound
);
333 rOut
.WriteBool( rDesign
.m_bHiddenSlides
);
340 // Dialog for the entry of the name of the design
341 class SdDesignNameDlg
: public weld::GenericDialogController
344 std::unique_ptr
<weld::Entry
> m_xEdit
;
345 std::unique_ptr
<weld::Button
> m_xBtnOK
;
348 SdDesignNameDlg(weld::Window
* pWindow
, const OUString
& aName
);
349 OUString
GetDesignName() const;
350 DECL_LINK(ModifyHdl
, weld::Entry
&, void);
355 // SdPublishingDlg Methods
357 SdPublishingDlg::SdPublishingDlg(weld::Window
* pWindow
, DocumentType eDocType
)
358 : GenericDialogController(pWindow
, "modules/simpress/ui/publishingdialog.ui", "PublishingDialog")
359 , m_xPage1_Designs(m_xBuilder
->weld_tree_view("designsTreeview"))
360 , m_xPage2_Standard_FB(m_xBuilder
->weld_image("standardFBImage"))
361 , m_xPage2_Frames_FB(m_xBuilder
->weld_image("framesFBImage"))
362 , m_xPage2_Kiosk_FB(m_xBuilder
->weld_image("kioskFBImage"))
363 , m_xPage2_WebCast_FB(m_xBuilder
->weld_image("webCastFBImage"))
364 , m_xPage4_Misc(m_xBuilder
->weld_text_view("miscTextview"))
365 , m_xButtonSet(new ButtonSet())
366 , m_xLastPageButton(m_xBuilder
->weld_button("lastPageButton"))
367 , m_xNextPageButton(m_xBuilder
->weld_button("nextPageButton"))
368 , m_xFinishButton(m_xBuilder
->weld_button("finishButton"))
369 , aAssistentFunc(NOOFPAGES
)
370 , m_bButtonsDirty(true)
371 , m_bDesignListDirty(false)
374 m_bImpress
= eDocType
== DocumentType::Impress
;
376 Size
aSize(m_xPage2_Standard_FB
->get_approximate_digit_width() * 12,
377 m_xPage2_Standard_FB
->get_text_height() * 6);
378 m_xPage2_Standard_FB
->set_size_request(aSize
.Width(), aSize
.Height());
379 m_xPage2_Frames_FB
->set_size_request(aSize
.Width(), aSize
.Height());
380 m_xPage2_Kiosk_FB
->set_size_request(aSize
.Width(), aSize
.Height());
381 m_xPage2_WebCast_FB
->set_size_request(aSize
.Width(), aSize
.Height());
383 m_xPage4_Misc
->set_size_request(m_xPage4_Misc
->get_approximate_digit_width() * 40,
384 m_xPage4_Misc
->get_height_rows(8));
386 m_xPage1_Designs
->set_size_request(m_xPage4_Misc
->get_approximate_digit_width() * 40,
387 m_xPage4_Misc
->get_height_rows(8));
389 //Lock down the preferred size based on the
390 //initial max-size configuration
391 aSize
= m_xDialog
->get_preferred_size();
392 m_xDialog
->set_size_request(aSize
.Width(), aSize
.Height());
397 // sets the output page
398 aAssistentFunc
.GotoPage(1);
399 m_xLastPageButton
->set_sensitive(false);
402 m_xFinishButton
->connect_clicked(LINK(this,SdPublishingDlg
,FinishHdl
));
403 m_xLastPageButton
->connect_clicked(LINK(this,SdPublishingDlg
,LastPageHdl
));
404 m_xNextPageButton
->connect_clicked(LINK(this,SdPublishingDlg
,NextPageHdl
));
406 m_xPage1_NewDesign
->connect_toggled(LINK(this,SdPublishingDlg
,DesignHdl
));
407 m_xPage1_OldDesign
->connect_toggled(LINK(this,SdPublishingDlg
,DesignHdl
));
408 m_xPage1_Designs
->connect_changed(LINK(this,SdPublishingDlg
,DesignSelectHdl
));
409 m_xPage1_DelDesign
->connect_clicked(LINK(this,SdPublishingDlg
,DesignDeleteHdl
));
411 m_xPage2_Standard
->connect_toggled(LINK(this,SdPublishingDlg
,BaseHdl
));
412 m_xPage2_Frames
->connect_toggled(LINK(this,SdPublishingDlg
,BaseHdl
));
413 m_xPage2_SingleDocument
->connect_toggled(LINK(this,SdPublishingDlg
,BaseHdl
));
414 m_xPage2_Kiosk
->connect_toggled(LINK(this,SdPublishingDlg
,BaseHdl
));
415 m_xPage2_WebCast
->connect_toggled(LINK(this,SdPublishingDlg
,BaseHdl
));
417 m_xPage2_Content
->connect_toggled(LINK(this,SdPublishingDlg
,ContentHdl
));
419 m_xPage2_ASP
->connect_toggled(LINK(this,SdPublishingDlg
,WebServerHdl
));
420 m_xPage2_PERL
->connect_toggled(LINK(this,SdPublishingDlg
,WebServerHdl
));
421 m_xPage2_Index
->set_text("index" STR_HTMLEXP_DEFAULT_EXTENSION
);
422 m_xPage2_CGI
->set_text("/cgi-bin/");
424 m_xPage3_Png
->connect_toggled(LINK(this,SdPublishingDlg
, GfxFormatHdl
));
425 m_xPage3_Gif
->connect_toggled(LINK(this,SdPublishingDlg
, GfxFormatHdl
));
426 m_xPage3_Jpg
->connect_toggled(LINK(this,SdPublishingDlg
, GfxFormatHdl
));
427 m_xPage3_Quality
->set_sensitive(false);
429 m_xPage3_Resolution_1
->connect_toggled(LINK(this,SdPublishingDlg
, ResolutionHdl
));
430 m_xPage3_Resolution_2
->connect_toggled(LINK(this,SdPublishingDlg
, ResolutionHdl
));
431 m_xPage3_Resolution_3
->connect_toggled(LINK(this,SdPublishingDlg
, ResolutionHdl
));
432 m_xPage3_Resolution_4
->connect_toggled(LINK(this, SdPublishingDlg
, ResolutionHdl
));
434 m_xPage2_ChgDefault
->connect_toggled(LINK(this,SdPublishingDlg
, SlideChgHdl
));
435 m_xPage2_ChgAuto
->connect_toggled(LINK(this,SdPublishingDlg
, SlideChgHdl
));
437 m_xPage5_Buttons
->SetSelectHdl(LINK(this,SdPublishingDlg
, ButtonsHdl
));
438 m_xPage5_Buttons
->SetStyle( m_xPage5_Buttons
->GetStyle() | WB_VSCROLL
);
440 m_xPage6_Back
->connect_clicked(LINK(this,SdPublishingDlg
, ColorHdl
));
441 m_xPage6_Text
->connect_clicked(LINK(this,SdPublishingDlg
, ColorHdl
));
442 m_xPage6_Link
->connect_clicked(LINK(this,SdPublishingDlg
, ColorHdl
));
443 m_xPage6_VLink
->connect_clicked(LINK(this,SdPublishingDlg
, ColorHdl
));
444 m_xPage6_ALink
->connect_clicked(LINK(this,SdPublishingDlg
, ColorHdl
));
446 m_xPage6_DocColors
->set_active(true);
448 m_xPage3_Quality
->append_text( "25%" );
449 m_xPage3_Quality
->append_text( "50%" );
450 m_xPage3_Quality
->append_text( "75%" );
451 m_xPage3_Quality
->append_text( "100%" );
453 m_xPage5_Buttons
->SetColCount();
454 m_xPage5_Buttons
->SetLineCount( 4 );
455 m_xPage5_Buttons
->SetExtraSpacing( 1 );
457 for( const auto& rDesign
: m_aDesignList
)
458 m_xPage1_Designs
->append_text(rDesign
.m_aDesignName
);
462 m_xDialog
->set_help_id(aPageHelpIds
[0]);
464 m_xNextPageButton
->grab_focus();
467 SdPublishingDlg::~SdPublishingDlg()
471 // Generate dialog controls and embed them in the pages
472 void SdPublishingDlg::CreatePages()
475 m_xPage1
= m_xBuilder
->weld_container("page1");
476 m_xPage1_Title
= m_xBuilder
->weld_label("assignLabel");
477 m_xPage1_NewDesign
= m_xBuilder
->weld_radio_button("newDesignRadiobutton");
478 m_xPage1_OldDesign
= m_xBuilder
->weld_radio_button("oldDesignRadiobutton");
479 m_xPage1_DelDesign
= m_xBuilder
->weld_button("delDesingButton");
480 m_xPage1_Desc
= m_xBuilder
->weld_label("descLabel");
481 aAssistentFunc
.InsertControl(1, m_xPage1
.get());
482 aAssistentFunc
.InsertControl(1, m_xPage1_Title
.get());
483 aAssistentFunc
.InsertControl(1, m_xPage1_NewDesign
.get());
484 aAssistentFunc
.InsertControl(1, m_xPage1_OldDesign
.get());
485 aAssistentFunc
.InsertControl(1, m_xPage1_Designs
.get());
486 aAssistentFunc
.InsertControl(1, m_xPage1_DelDesign
.get());
487 aAssistentFunc
.InsertControl(1, m_xPage1_Desc
.get());
490 m_xPage2
= m_xBuilder
->weld_container("page2");
491 m_xPage2Frame2
= m_xBuilder
->weld_container("page2.2");
492 m_xPage2Frame3
= m_xBuilder
->weld_container("page2.3");
493 m_xPage2Frame4
= m_xBuilder
->weld_container("page2.4");
494 m_xPage2_Title
= m_xBuilder
->weld_label("publicationLabel");
495 m_xPage2_Standard
= m_xBuilder
->weld_radio_button("standardRadiobutton");
496 m_xPage2_Frames
= m_xBuilder
->weld_radio_button("framesRadiobutton");
497 m_xPage2_SingleDocument
= m_xBuilder
->weld_radio_button("singleDocumentRadiobutton");
498 m_xPage2_Kiosk
= m_xBuilder
->weld_radio_button("kioskRadiobutton");
499 m_xPage2_WebCast
= m_xBuilder
->weld_radio_button("webCastRadiobutton");
500 aAssistentFunc
.InsertControl(2, m_xPage2
.get());
501 aAssistentFunc
.InsertControl(2, m_xPage2Frame2
.get());
502 aAssistentFunc
.InsertControl(2, m_xPage2Frame3
.get());
503 aAssistentFunc
.InsertControl(2, m_xPage2Frame4
.get());
504 aAssistentFunc
.InsertControl(2, m_xPage2_Title
.get());
505 aAssistentFunc
.InsertControl(2, m_xPage2_Standard
.get());
506 aAssistentFunc
.InsertControl(2, m_xPage2_Frames
.get());
507 aAssistentFunc
.InsertControl(2, m_xPage2_SingleDocument
.get());
508 aAssistentFunc
.InsertControl(2, m_xPage2_Kiosk
.get());
509 aAssistentFunc
.InsertControl(2, m_xPage2_WebCast
.get());
510 aAssistentFunc
.InsertControl(2, m_xPage2_Standard_FB
.get());
511 aAssistentFunc
.InsertControl(2, m_xPage2_Frames_FB
.get());
512 aAssistentFunc
.InsertControl(2, m_xPage2_Kiosk_FB
.get());
513 aAssistentFunc
.InsertControl(2, m_xPage2_WebCast_FB
.get());
515 m_xPage2_Title_Html
= m_xBuilder
->weld_label( "htmlOptionsLabel");
516 m_xPage2_Content
= m_xBuilder
->weld_check_button("contentCheckbutton");
517 m_xPage2_Notes
= m_xBuilder
->weld_check_button("notesCheckbutton");
518 aAssistentFunc
.InsertControl(2, m_xPage2_Title_Html
.get());
519 aAssistentFunc
.InsertControl(2, m_xPage2_Content
.get());
521 aAssistentFunc
.InsertControl(2, m_xPage2_Notes
.get());
523 m_xPage2_Title_WebCast
= m_xBuilder
->weld_label("webCastLabel");
524 m_xPage2_ASP
= m_xBuilder
->weld_radio_button("ASPRadiobutton");
525 m_xPage2_PERL
= m_xBuilder
->weld_radio_button("perlRadiobutton");
526 m_xPage2_URL_txt
= m_xBuilder
->weld_label("URLTxtLabel");
527 m_xPage2_URL
= m_xBuilder
->weld_entry("URLEntry");
528 m_xPage2_CGI_txt
= m_xBuilder
->weld_label("CGITxtLabel");
529 m_xPage2_CGI
= m_xBuilder
->weld_entry("CGIEntry");
530 m_xPage2_Index_txt
= m_xBuilder
->weld_label("indexTxtLabel");
531 m_xPage2_Index
= m_xBuilder
->weld_entry("indexEntry");
532 m_xPage2_Title_Kiosk
= m_xBuilder
->weld_label("kioskLabel");
533 m_xPage2_ChgDefault
= m_xBuilder
->weld_radio_button("chgDefaultRadiobutton");
534 m_xPage2_ChgAuto
= m_xBuilder
->weld_radio_button("chgAutoRadiobutton");
535 m_xPage2_Duration_txt
= m_xBuilder
->weld_label("durationTxtLabel");
536 m_xPage2_Duration
= m_xBuilder
->weld_formatted_spin_button("durationSpinbutton");
537 m_xFormatter
.reset(new weld::TimeFormatter(*m_xPage2_Duration
));
538 m_xFormatter
->SetExtFormat(ExtTimeFieldFormat::LongDuration
);
539 m_xPage2_Endless
= m_xBuilder
->weld_check_button("endlessCheckbutton");
540 aAssistentFunc
.InsertControl(2, m_xPage2_Title_WebCast
.get());
541 aAssistentFunc
.InsertControl(2, m_xPage2_Index_txt
.get());
542 aAssistentFunc
.InsertControl(2, m_xPage2_Index
.get());
543 aAssistentFunc
.InsertControl(2, m_xPage2_ASP
.get());
544 aAssistentFunc
.InsertControl(2, m_xPage2_PERL
.get());
545 aAssistentFunc
.InsertControl(2, m_xPage2_URL_txt
.get());
546 aAssistentFunc
.InsertControl(2, m_xPage2_URL
.get());
547 aAssistentFunc
.InsertControl(2, m_xPage2_CGI_txt
.get());
548 aAssistentFunc
.InsertControl(2, m_xPage2_CGI
.get());
549 aAssistentFunc
.InsertControl(2, m_xPage2_Title_Kiosk
.get());
550 aAssistentFunc
.InsertControl(2, m_xPage2_ChgDefault
.get());
551 aAssistentFunc
.InsertControl(2, m_xPage2_ChgAuto
.get());
552 aAssistentFunc
.InsertControl(2, m_xPage2_Duration_txt
.get());
553 aAssistentFunc
.InsertControl(2, m_xPage2_Duration
.get());
554 aAssistentFunc
.InsertControl(2, m_xPage2_Endless
.get());
557 m_xPage3
= m_xBuilder
->weld_container("page3");
558 m_xPage3_Title1
= m_xBuilder
->weld_label("saveImgAsLabel");
559 m_xPage3_Png
= m_xBuilder
->weld_radio_button("pngRadiobutton");
560 m_xPage3_Gif
= m_xBuilder
->weld_radio_button("gifRadiobutton");
561 m_xPage3_Jpg
= m_xBuilder
->weld_radio_button("jpgRadiobutton");
562 m_xPage3_Quality_txt
= m_xBuilder
->weld_label("qualityTxtLabel");
563 m_xPage3_Quality
= m_xBuilder
->weld_combo_box("qualityCombobox");
564 m_xPage3_Title2
= m_xBuilder
->weld_label("monitorResolutionLabel");
565 m_xPage3_Resolution_1
= m_xBuilder
->weld_radio_button("resolution1Radiobutton");
566 m_xPage3_Resolution_2
= m_xBuilder
->weld_radio_button("resolution2Radiobutton");
567 m_xPage3_Resolution_3
= m_xBuilder
->weld_radio_button("resolution3Radiobutton");
568 m_xPage3_Resolution_4
= m_xBuilder
->weld_radio_button("resolution4Radiobutton");
569 m_xPage3_Title3
= m_xBuilder
->weld_label("effectsLabel");
570 m_xPage3_SldSound
= m_xBuilder
->weld_check_button("sldSoundCheckbutton");
571 m_xPage3_HiddenSlides
= m_xBuilder
->weld_check_button("hiddenSlidesCheckbutton");
572 aAssistentFunc
.InsertControl(3, m_xPage3
.get());
573 aAssistentFunc
.InsertControl(3, m_xPage3_Title1
.get());
574 aAssistentFunc
.InsertControl(3, m_xPage3_Png
.get());
575 aAssistentFunc
.InsertControl(3, m_xPage3_Gif
.get());
576 aAssistentFunc
.InsertControl(3, m_xPage3_Jpg
.get());
577 aAssistentFunc
.InsertControl(3, m_xPage3_Quality_txt
.get());
578 aAssistentFunc
.InsertControl(3, m_xPage3_Quality
.get());
579 aAssistentFunc
.InsertControl(3, m_xPage3_Title2
.get());
580 aAssistentFunc
.InsertControl(3, m_xPage3_Resolution_1
.get());
581 aAssistentFunc
.InsertControl(3, m_xPage3_Resolution_2
.get());
582 aAssistentFunc
.InsertControl(3, m_xPage3_Resolution_3
.get());
583 aAssistentFunc
.InsertControl(3, m_xPage3_Resolution_4
.get());
584 aAssistentFunc
.InsertControl(3, m_xPage3_Title3
.get());
585 aAssistentFunc
.InsertControl(3, m_xPage3_SldSound
.get());
586 aAssistentFunc
.InsertControl(3, m_xPage3_HiddenSlides
.get());
589 m_xPage4
= m_xBuilder
->weld_container("page4");
590 m_xPage4_Title1
= m_xBuilder
->weld_label("infTitlePageLabel");
591 m_xPage4_Author_txt
= m_xBuilder
->weld_label("authorTxtLabel");
592 m_xPage4_Author
= m_xBuilder
->weld_entry("authorEntry");
593 m_xPage4_Email_txt
= m_xBuilder
->weld_label("emailTxtLabel");
594 m_xPage4_Email
= m_xBuilder
->weld_entry("emailEntry");
595 m_xPage4_WWW_txt
= m_xBuilder
->weld_label("wwwTxtLabel");
596 m_xPage4_WWW
= m_xBuilder
->weld_entry("wwwEntry");
597 m_xPage4_Title2
= m_xBuilder
->weld_label("addInformLabel");
598 m_xPage4_Download
= m_xBuilder
->weld_check_button("downloadCheckbutton");
599 aAssistentFunc
.InsertControl(4, m_xPage4
.get());
600 aAssistentFunc
.InsertControl(4, m_xPage4_Title1
.get());
601 aAssistentFunc
.InsertControl(4, m_xPage4_Author_txt
.get());
602 aAssistentFunc
.InsertControl(4, m_xPage4_Author
.get());
603 aAssistentFunc
.InsertControl(4, m_xPage4_Email_txt
.get());
604 aAssistentFunc
.InsertControl(4, m_xPage4_Email
.get());
605 aAssistentFunc
.InsertControl(4, m_xPage4_WWW_txt
.get());
606 aAssistentFunc
.InsertControl(4, m_xPage4_WWW
.get());
607 aAssistentFunc
.InsertControl(4, m_xPage4_Title2
.get());
608 aAssistentFunc
.InsertControl(4, m_xPage4_Misc
.get());
610 aAssistentFunc
.InsertControl(4, m_xPage4_Download
.get());
613 m_xPage5
= m_xBuilder
->weld_container("page5");
614 m_xPage5_Title
= m_xBuilder
->weld_label("buttonStyleLabel");
615 m_xPage5_TextOnly
= m_xBuilder
->weld_check_button("textOnlyCheckbutton");
616 m_xPage5_Buttons
.reset(new ValueSet(m_xBuilder
->weld_scrolled_window("buttonsDrawingareawin", true)));
617 m_xPage5_ButtonsWnd
.reset(new weld::CustomWeld(*m_xBuilder
, "buttonsDrawingarea", *m_xPage5_Buttons
));
618 aAssistentFunc
.InsertControl(5, m_xPage5
.get());
619 aAssistentFunc
.InsertControl(5, m_xPage5_Title
.get());
620 aAssistentFunc
.InsertControl(5, m_xPage5_TextOnly
.get());
621 aAssistentFunc
.InsertControl(5, m_xPage5_Buttons
->GetDrawingArea());
624 m_xPage6
= m_xBuilder
->weld_container("page6");
625 m_xPage6_Title
= m_xBuilder
->weld_label("selectColorLabel");
626 m_xPage6_Default
= m_xBuilder
->weld_radio_button("defaultRadiobutton");
627 m_xPage6_User
= m_xBuilder
->weld_radio_button("userRadiobutton");
628 m_xPage6_Back
= m_xBuilder
->weld_button("backButton");
629 m_xPage6_Text
= m_xBuilder
->weld_button("textButton");
630 m_xPage6_Link
= m_xBuilder
->weld_button("linkButton");
631 m_xPage6_VLink
= m_xBuilder
->weld_button("vLinkButton");
632 m_xPage6_ALink
= m_xBuilder
->weld_button("aLinkButton");
633 m_xPage6_DocColors
= m_xBuilder
->weld_radio_button("docColorsRadiobutton");
634 m_xPage6_Preview
.reset(new SdHtmlAttrPreview
);
635 m_xPage6_PreviewWnd
.reset(new weld::CustomWeld(*m_xBuilder
, "previewDrawingarea", *m_xPage6_Preview
));
636 aAssistentFunc
.InsertControl(6, m_xPage6
.get());
637 aAssistentFunc
.InsertControl(6, m_xPage6_Title
.get());
638 aAssistentFunc
.InsertControl(6, m_xPage6_DocColors
.get());
639 aAssistentFunc
.InsertControl(6, m_xPage6_Default
.get());
640 aAssistentFunc
.InsertControl(6, m_xPage6_User
.get());
641 aAssistentFunc
.InsertControl(6, m_xPage6_Text
.get());
642 aAssistentFunc
.InsertControl(6, m_xPage6_Link
.get());
643 aAssistentFunc
.InsertControl(6, m_xPage6_ALink
.get());
644 aAssistentFunc
.InsertControl(6, m_xPage6_VLink
.get());
645 aAssistentFunc
.InsertControl(6, m_xPage6_Back
.get());
646 aAssistentFunc
.InsertControl(6, m_xPage6_Preview
->GetDrawingArea());
649 // Initialize dialog with default-values
650 void SdPublishingDlg::SetDefaults()
652 SdPublishingDesign aDefault
;
653 SetDesign(&aDefault
);
655 m_xPage1_NewDesign
->set_active(true);
656 m_xPage1_OldDesign
->set_active(false);
660 // Feed the SfxItemSet with the settings of the dialog
661 void SdPublishingDlg::GetParameterSequence( Sequence
< PropertyValue
>& rParams
)
663 std::vector
< PropertyValue
> aProps
;
665 PropertyValue aValue
;
668 aValue
.Name
= "PublishMode";
670 HtmlPublishMode ePublishMode
;
671 if (m_xPage2_Frames
->get_active())
672 ePublishMode
= PUBLISH_FRAMES
;
673 else if (m_xPage2_SingleDocument
->get_active())
674 ePublishMode
= PUBLISH_SINGLE_DOCUMENT
;
675 else if (m_xPage2_Kiosk
->get_active())
676 ePublishMode
= PUBLISH_KIOSK
;
677 else if (m_xPage2_WebCast
->get_active())
678 ePublishMode
= PUBLISH_WEBCAST
;
680 ePublishMode
= PUBLISH_HTML
;
682 aValue
.Value
<<= static_cast<sal_Int32
>(ePublishMode
);
683 aProps
.push_back( aValue
);
685 aValue
.Name
= "IsExportContentsPage";
686 aValue
.Value
<<= m_xPage2_Content
->get_active();
687 aProps
.push_back( aValue
);
691 aValue
.Name
= "IsExportNotes";
692 aValue
.Value
<<= m_xPage2_Notes
->get_active();
693 aProps
.push_back( aValue
);
696 if( m_xPage2_WebCast
->get_active() )
698 aValue
.Name
= "WebCastScriptLanguage";
699 if( m_xPage2_ASP
->get_active() )
700 aValue
.Value
<<= OUString( "asp" );
702 aValue
.Value
<<= OUString( "perl" );
703 aProps
.push_back( aValue
);
705 aValue
.Name
= "WebCastCGIURL";
706 aValue
.Value
<<= m_xPage2_CGI
->get_text();
707 aProps
.push_back( aValue
);
709 aValue
.Name
= "WebCastTargetURL";
710 aValue
.Value
<<= m_xPage2_URL
->get_text();
711 aProps
.push_back( aValue
);
713 aValue
.Name
= "IndexURL";
714 aValue
.Value
<<= m_xPage2_Index
->get_text();
715 aProps
.push_back( aValue
);
717 if( m_xPage2_Kiosk
->get_active() && m_xPage2_ChgAuto
->get_active() )
719 aValue
.Name
= "KioskSlideDuration";
720 aValue
.Value
<<= static_cast<sal_uInt32
>(m_xFormatter
->GetTime().GetMSFromTime()) / 1000;
721 aProps
.push_back( aValue
);
723 aValue
.Name
= "KioskEndless";
724 aValue
.Value
<<= m_xPage2_Endless
->get_active();
725 aProps
.push_back( aValue
);
730 aValue
.Name
= "Width";
731 sal_Int32 nTmpWidth
= PUB_LOWRES_WIDTH
;
732 if( m_xPage3_Resolution_2
->get_active() )
733 nTmpWidth
= PUB_MEDRES_WIDTH
;
734 else if( m_xPage3_Resolution_3
->get_active() )
735 nTmpWidth
= PUB_HIGHRES_WIDTH
;
736 else if (m_xPage3_Resolution_4
->get_active())
737 nTmpWidth
= PUB_FHDRES_WIDTH
;
739 aValue
.Value
<<= nTmpWidth
;
740 aProps
.push_back( aValue
);
742 aValue
.Name
= "Compression";
743 aValue
.Value
<<= m_xPage3_Quality
->get_active_text();
744 aProps
.push_back( aValue
);
746 aValue
.Name
= "Format";
748 if( m_xPage3_Png
->get_active() )
749 nFormat
= static_cast<sal_Int32
>(FORMAT_PNG
);
750 else if( m_xPage3_Gif
->get_active() )
751 nFormat
= static_cast<sal_Int32
>(FORMAT_GIF
);
753 nFormat
= static_cast<sal_Int32
>(FORMAT_JPG
);
754 aValue
.Value
<<= nFormat
;
755 aProps
.push_back( aValue
);
757 aValue
.Name
= "SlideSound";
758 aValue
.Value
<<= m_xPage3_SldSound
->get_active();
759 aProps
.push_back( aValue
);
761 aValue
.Name
= "HiddenSlides";
762 aValue
.Value
<<= m_xPage3_HiddenSlides
->get_active();
763 aProps
.push_back( aValue
);
766 aValue
.Name
= "Author";
767 aValue
.Value
<<= m_xPage4_Author
->get_text();
768 aProps
.push_back( aValue
);
770 aValue
.Name
= "EMail";
771 aValue
.Value
<<= m_xPage4_Email
->get_text();
772 aProps
.push_back( aValue
);
774 // try to guess protocol for user's homepage
775 INetURLObject
aHomeURL( m_xPage4_WWW
->get_text(),
776 INetProtocol::Http
, // default proto is HTTP
777 INetURLObject::EncodeMechanism::All
);
779 aValue
.Name
= "HomepageURL";
780 aValue
.Value
<<= aHomeURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
781 aProps
.push_back( aValue
);
783 aValue
.Name
= "UserText";
784 aValue
.Value
<<= m_xPage4_Misc
->get_text();
785 aProps
.push_back( aValue
);
789 aValue
.Name
= "EnableDownload";
790 aValue
.Value
<<= m_xPage4_Download
->get_active();
791 aProps
.push_back( aValue
);
795 if( !m_xPage5_TextOnly
->get_active() )
797 aValue
.Name
= "UseButtonSet";
798 aValue
.Value
<<= static_cast<sal_Int32
>(m_xPage5_Buttons
->GetSelectedItemId() - 1);
799 aProps
.push_back( aValue
);
803 if( m_xPage6_User
->get_active() )
805 aValue
.Name
= "BackColor";
806 aValue
.Value
<<= m_aBackColor
;
807 aProps
.push_back( aValue
);
809 aValue
.Name
= "TextColor";
810 aValue
.Value
<<= m_aTextColor
;
811 aProps
.push_back( aValue
);
813 aValue
.Name
= "LinkColor";
814 aValue
.Value
<<= m_aLinkColor
;
815 aProps
.push_back( aValue
);
817 aValue
.Name
= "VLinkColor";
818 aValue
.Value
<<= m_aVLinkColor
;
819 aProps
.push_back( aValue
);
821 aValue
.Name
= "ALinkColor";
822 aValue
.Value
<<= m_aALinkColor
;
823 aProps
.push_back( aValue
);
826 if( m_xPage6_DocColors
->get_active() )
828 aValue
.Name
= "IsUseDocumentColors";
829 aValue
.Value
<<= true;
830 aProps
.push_back( aValue
);
833 rParams
= comphelper::containerToSequence(aProps
);
836 // Clickhandler for the radiobuttons of the design-selection
837 IMPL_LINK( SdPublishingDlg
, DesignHdl
, weld::Toggleable
&, rButton
, void )
839 if (!rButton
.get_active())
842 if (m_xPage1_NewDesign
->get_active())
844 m_xPage1_NewDesign
->set_active(true); // because of DesignDeleteHdl
845 m_xPage1_OldDesign
->set_active(false);
846 m_xPage1_Designs
->set_sensitive(false);
847 m_xPage1_DelDesign
->set_sensitive(false);
850 SdPublishingDesign aDefault
;
851 SetDesign(&aDefault
);
855 m_xPage1_NewDesign
->set_active(false);
856 m_xPage1_Designs
->set_sensitive(true);
857 m_xPage1_DelDesign
->set_sensitive(true);
859 if (m_xPage1_Designs
->get_selected_index() == -1)
860 m_xPage1_Designs
->select(0);
862 const sal_Int32 nPos
= m_xPage1_Designs
->get_selected_index();
863 m_pDesign
= &m_aDesignList
[nPos
];
864 DBG_ASSERT(m_pDesign
, "No Design? That's not allowed (CL)");
867 SetDesign(m_pDesign
);
871 // Clickhandler for the choice of one design
872 IMPL_LINK_NOARG(SdPublishingDlg
, DesignSelectHdl
, weld::TreeView
&, void)
874 const sal_Int32 nPos
= m_xPage1_Designs
->get_selected_index();
875 m_pDesign
= &m_aDesignList
[nPos
];
876 DBG_ASSERT(m_pDesign
, "No Design? That's not allowed (CL)");
879 SetDesign(m_pDesign
);
884 // Clickhandler for the delete of one design
885 IMPL_LINK_NOARG(SdPublishingDlg
, DesignDeleteHdl
, weld::Button
&, void)
887 const sal_Int32 nPos
= m_xPage1_Designs
->get_selected_index();
889 std::vector
<SdPublishingDesign
>::iterator iter
= m_aDesignList
.begin()+nPos
;
891 DBG_ASSERT(iter
!= m_aDesignList
.end(), "No Design? That's not allowed (CL)");
893 m_xPage1_Designs
->remove(nPos
);
895 if(m_pDesign
== &(*iter
))
896 DesignHdl(*m_xPage1_NewDesign
);
898 m_aDesignList
.erase(iter
);
900 m_bDesignListDirty
= true;
905 // Clickhandler for the other servertypes
906 IMPL_LINK(SdPublishingDlg
, WebServerHdl
, weld::Toggleable
&, rButton
, void)
908 if (!rButton
.get_active())
911 bool bASP
= m_xPage2_ASP
->get_active();
912 m_xPage2_ASP
->set_sensitive( bASP
);
913 m_xPage2_PERL
->set_sensitive( !bASP
);
917 // Clickhandler for the Radiobuttons of the graphicformat choice
918 IMPL_LINK(SdPublishingDlg
, GfxFormatHdl
, weld::Toggleable
&, rButton
, void)
920 if (!rButton
.get_active())
923 m_xPage3_Png
->set_sensitive(m_xPage3_Png
->get_active());
924 m_xPage3_Gif
->set_sensitive(m_xPage3_Gif
->get_active());
925 m_xPage3_Jpg
->set_sensitive(m_xPage3_Jpg
->get_active());
926 m_xPage3_Quality
->set_sensitive(m_xPage3_Jpg
->get_active());
929 // Clickhandler for the Radiobuttons Standard/Frames
930 IMPL_LINK(SdPublishingDlg
, BaseHdl
, weld::Toggleable
&, rButton
, void)
932 if (!rButton
.get_active())
938 // Clickhandler for the Checkbox of the Title page
939 IMPL_LINK_NOARG(SdPublishingDlg
, ContentHdl
, weld::Toggleable
&, void)
941 if(m_xPage2_Content
->get_active())
943 if(!aAssistentFunc
.IsEnabled(4))
945 aAssistentFunc
.EnablePage(4);
951 if(aAssistentFunc
.IsEnabled(4))
953 aAssistentFunc
.DisablePage(4);
959 // Clickhandler for the Resolution Radiobuttons
960 IMPL_LINK( SdPublishingDlg
, ResolutionHdl
, weld::Toggleable
&, rButton
, void )
962 if (!rButton
.get_active())
964 m_xPage3_Resolution_1
->set_sensitive(m_xPage3_Resolution_1
->get_active());
965 m_xPage3_Resolution_2
->set_sensitive(m_xPage3_Resolution_2
->get_active());
966 m_xPage3_Resolution_3
->set_sensitive(m_xPage3_Resolution_3
->get_active());
967 m_xPage3_Resolution_4
->set_sensitive(m_xPage3_Resolution_4
->get_active());
970 // Clickhandler for the ValueSet with the bitmap-buttons
971 IMPL_LINK_NOARG(SdPublishingDlg
, ButtonsHdl
, ValueSet
*, void)
973 // if one bitmap-button is chosen, then disable TextOnly
974 m_xPage5_TextOnly
->set_active(false);
977 // Fill the SfxItemSet with the settings of the dialog
978 IMPL_LINK( SdPublishingDlg
, ColorHdl
, weld::Button
&, rButton
, void)
982 if (&rButton
== m_xPage6_Back
.get())
984 aDlg
.SetColor( m_aBackColor
);
985 if(aDlg
.Execute(m_xDialog
.get()) == RET_OK
)
986 m_aBackColor
= aDlg
.GetColor();
988 else if (&rButton
== m_xPage6_Text
.get())
990 aDlg
.SetColor( m_aTextColor
);
991 if(aDlg
.Execute(m_xDialog
.get()) == RET_OK
)
992 m_aTextColor
= aDlg
.GetColor();
994 else if (&rButton
== m_xPage6_Link
.get())
996 aDlg
.SetColor( m_aLinkColor
);
997 if(aDlg
.Execute(m_xDialog
.get()) == RET_OK
)
998 m_aLinkColor
= aDlg
.GetColor();
1000 else if (&rButton
== m_xPage6_VLink
.get())
1002 aDlg
.SetColor( m_aVLinkColor
);
1003 if(aDlg
.Execute(m_xDialog
.get()) == RET_OK
)
1004 m_aVLinkColor
= aDlg
.GetColor();
1006 else if (&rButton
== m_xPage6_ALink
.get())
1008 aDlg
.SetColor( m_aALinkColor
);
1009 if(aDlg
.Execute(m_xDialog
.get()) == RET_OK
)
1010 m_aALinkColor
= aDlg
.GetColor();
1013 m_xPage6_User
->set_active(true);
1014 m_xPage6_Preview
->SetColors( m_aBackColor
, m_aTextColor
, m_aLinkColor
,
1015 m_aVLinkColor
, m_aALinkColor
);
1016 m_xPage6_Preview
->Invalidate();
1019 IMPL_LINK(SdPublishingDlg
, SlideChgHdl
, weld::Toggleable
&, rButton
, void)
1021 if (!rButton
.get_active())
1026 // Clickhandler for the Ok Button
1027 IMPL_LINK_NOARG(SdPublishingDlg
, FinishHdl
, weld::Button
&, void)
1030 SdPublishingDesign aDesign
;
1031 GetDesign(&aDesign
);
1035 if(m_xPage1_OldDesign
->get_active() && m_pDesign
)
1037 // are there changes?
1038 if(!(aDesign
== *m_pDesign
))
1043 SdPublishingDesign aDefaultDesign
;
1044 if(!(aDefaultDesign
== aDesign
))
1052 aName
= m_pDesign
->m_aDesignName
;
1059 SdDesignNameDlg
aDlg(m_xDialog
.get(), aName
);
1061 if (aDlg
.run() == RET_OK
)
1063 aDesign
.m_aDesignName
= aDlg
.GetDesignName();
1065 auto iter
= std::find_if(m_aDesignList
.begin(), m_aDesignList
.end(),
1066 [&aDesign
](const SdPublishingDesign
& rDesign
) { return rDesign
.m_aDesignName
== aDesign
.m_aDesignName
; });
1068 if (iter
!= m_aDesignList
.end())
1070 std::unique_ptr
<weld::MessageDialog
> xErrorBox(Application::CreateMessageDialog(m_xDialog
.get(),
1071 VclMessageType::Error
, VclButtonsType::YesNo
,
1072 SdResId(STR_PUBDLG_SAMENAME
)));
1073 bRetry
= xErrorBox
->run() == RET_NO
;
1076 m_aDesignList
.erase(iter
);
1081 m_aDesignList
.push_back(aDesign
);
1082 m_bDesignListDirty
= true;
1089 if(m_bDesignListDirty
)
1092 m_xDialog
->response(RET_OK
);
1095 // Refresh the dialogs when changing from pages
1096 void SdPublishingDlg::ChangePage()
1098 int nPage
= aAssistentFunc
.GetCurrentPage();
1099 m_xDialog
->set_help_id(aPageHelpIds
[nPage
-1]);
1103 if (m_xNextPageButton
->get_sensitive())
1104 m_xNextPageButton
->grab_focus();
1106 m_xFinishButton
->grab_focus();
1109 void SdPublishingDlg::UpdatePage()
1111 m_xNextPageButton
->set_sensitive(!aAssistentFunc
.IsLastPage());
1112 m_xLastPageButton
->set_sensitive(!aAssistentFunc
.IsFirstPage());
1114 int nPage
= aAssistentFunc
.GetCurrentPage();
1119 if(m_xPage1_NewDesign
->get_active())
1121 m_xPage1_Designs
->set_sensitive(false);
1122 m_xPage1_DelDesign
->set_sensitive(false);
1125 if(m_aDesignList
.empty())
1126 m_xPage1_OldDesign
->set_sensitive(false);
1129 m_xPage2_Frames_FB
->set_visible(m_xPage2_Frames
->get_active());
1130 m_xPage2_Standard_FB
->set_visible(m_xPage2_Standard
->get_active());
1131 m_xPage2_Kiosk_FB
->set_visible(m_xPage2_Kiosk
->get_active());
1132 m_xPage2_WebCast_FB
->set_visible(m_xPage2_WebCast
->get_active());
1134 if( m_xPage2_WebCast
->get_active() )
1136 m_xPage2Frame4
->show();
1137 m_xPage2_Title_WebCast
->show();
1138 m_xPage2_ASP
->show();
1139 m_xPage2_PERL
->show();
1140 m_xPage2_URL_txt
->show();
1141 m_xPage2_URL
->show();
1142 m_xPage2_CGI_txt
->show();
1143 m_xPage2_CGI
->show();
1144 m_xPage2_Index_txt
->show();
1145 m_xPage2_Index
->show();
1147 bool bPerl
= m_xPage2_PERL
->get_active();
1148 m_xPage2_Index
->set_sensitive(bPerl
);
1149 m_xPage2_Index_txt
->set_sensitive(bPerl
);
1150 m_xPage2_URL_txt
->set_sensitive(bPerl
);
1151 m_xPage2_URL
->set_sensitive(bPerl
);
1152 m_xPage2_CGI_txt
->set_sensitive(bPerl
);
1153 m_xPage2_CGI
->set_sensitive(bPerl
);
1157 m_xPage2Frame4
->hide();
1158 m_xPage2_Title_WebCast
->hide();
1159 m_xPage2_ASP
->hide();
1160 m_xPage2_PERL
->hide();
1161 m_xPage2_URL_txt
->hide();
1162 m_xPage2_URL
->hide();
1163 m_xPage2_CGI_txt
->hide();
1164 m_xPage2_CGI
->hide();
1165 m_xPage2_Index
->hide();
1166 m_xPage2_Index_txt
->hide();
1169 if( m_xPage2_Kiosk
->get_active() )
1171 m_xPage2Frame3
->show();
1172 m_xPage2_Title_Kiosk
->show();
1173 m_xPage2_ChgDefault
->show();
1174 m_xPage2_ChgAuto
->show();
1175 m_xPage2_Duration_txt
->show();
1176 m_xPage2_Duration
->show();
1177 m_xPage2_Endless
->show();
1178 bool bAuto
= m_xPage2_ChgAuto
->get_active();
1179 m_xPage2_Duration
->set_sensitive(bAuto
);
1180 m_xPage2_Endless
->set_sensitive(bAuto
);
1184 m_xPage2Frame3
->hide();
1185 m_xPage2_Title_Kiosk
->hide();
1186 m_xPage2_ChgDefault
->hide();
1187 m_xPage2_ChgAuto
->hide();
1188 m_xPage2_Duration
->hide();
1189 m_xPage2_Duration_txt
->hide();
1190 m_xPage2_Endless
->hide();
1193 if( m_xPage2_Standard
->get_active() || m_xPage2_Frames
->get_active() )
1195 m_xPage2Frame2
->show();
1196 m_xPage2_Title_Html
->show();
1197 m_xPage2_Content
->show();
1199 m_xPage2_Notes
->show();
1203 m_xPage2Frame2
->hide();
1204 m_xPage2_Title_Html
->hide();
1205 m_xPage2_Content
->hide();
1207 m_xPage2_Notes
->hide();
1211 if( m_xPage2_Kiosk
->get_active() || m_xPage2_WebCast
->get_active() )
1212 m_xNextPageButton
->set_sensitive(false);
1214 if( m_xPage2_WebCast
->get_active() )
1215 m_xPage3_SldSound
->set_sensitive(false);
1217 m_xPage3_Quality
->set_sensitive(m_xPage3_Jpg
->get_active());
1221 if( m_bButtonsDirty
)
1222 LoadPreviewButtons();
1227 /** loads the html buttons from the button sets, creates a preview and fills the
1230 void SdPublishingDlg::LoadPreviewButtons()
1235 const int nButtonCount
= 8;
1236 static const char *pButtonNames
[nButtonCount
] =
1248 std::vector
< OUString
> aButtonNames
;
1249 for(const char * p
: pButtonNames
)
1250 aButtonNames
.push_back( OUString::createFromAscii( p
) );
1252 int nSetCount
= m_xButtonSet
->getCount();
1256 for( int nSet
= 0; nSet
< nSetCount
; ++nSet
)
1258 if( m_xButtonSet
->getPreview( nSet
, aButtonNames
, aImage
) )
1260 m_xPage5_Buttons
->InsertItem( static_cast<sal_uInt16
>(nSet
)+1, aImage
);
1261 if( nHeight
< aImage
.GetSizePixel().Height() )
1262 nHeight
= aImage
.GetSizePixel().Height();
1266 m_xPage5_Buttons
->SetItemHeight( nHeight
);
1267 m_bButtonsDirty
= false;
1270 // Clickhandler for the Forward Button
1271 IMPL_LINK_NOARG(SdPublishingDlg
, NextPageHdl
, weld::Button
&, void)
1273 aAssistentFunc
.NextPage();
1277 // Sets the Controls in the dialog to the settings in the design
1278 void SdPublishingDlg::SetDesign( SdPublishingDesign
const * pDesign
)
1283 m_xPage2_Standard
->set_sensitive(pDesign
->m_eMode
== PUBLISH_HTML
);
1284 m_xPage2_Frames
->set_sensitive(pDesign
->m_eMode
== PUBLISH_FRAMES
);
1285 m_xPage2_Kiosk
->set_sensitive(pDesign
->m_eMode
== PUBLISH_KIOSK
);
1286 m_xPage2_WebCast
->set_sensitive(pDesign
->m_eMode
== PUBLISH_WEBCAST
);
1288 m_xPage2_Content
->set_sensitive(pDesign
->m_bContentPage
);
1289 if(pDesign
->m_bContentPage
)
1290 aAssistentFunc
.EnablePage(4);
1292 aAssistentFunc
.DisablePage(4);
1295 m_xPage2_Notes
->set_sensitive(pDesign
->m_bNotes
);
1297 m_xPage2_ASP
->set_sensitive(pDesign
->m_eScript
== SCRIPT_ASP
);
1298 m_xPage2_PERL
->set_sensitive(pDesign
->m_eScript
== SCRIPT_PERL
);
1299 m_xPage2_CGI
->set_text(pDesign
->m_aCGI
);
1300 m_xPage2_URL
->set_text(pDesign
->m_aURL
);
1302 m_xPage2_ChgDefault
->set_sensitive( !pDesign
->m_bAutoSlide
);
1303 m_xPage2_ChgAuto
->set_sensitive( pDesign
->m_bAutoSlide
);
1305 tools::Time
aTime( tools::Time::EMPTY
);
1306 aTime
.MakeTimeFromMS( pDesign
->m_nSlideDuration
* 1000 );
1307 m_xFormatter
->SetTime(aTime
);
1309 m_xPage2_Endless
->set_sensitive( pDesign
->m_bEndless
);
1311 m_xPage3_Png
->set_sensitive(pDesign
->m_eFormat
== FORMAT_PNG
);
1312 m_xPage3_Gif
->set_sensitive(pDesign
->m_eFormat
== FORMAT_GIF
);
1313 m_xPage3_Jpg
->set_sensitive(pDesign
->m_eFormat
== FORMAT_JPG
);
1314 m_xPage3_Quality
->set_sensitive(pDesign
->m_eFormat
== FORMAT_JPG
);
1316 m_xPage3_Quality
->set_entry_text(pDesign
->m_aCompression
);
1317 m_xPage3_Resolution_1
->set_sensitive(pDesign
->m_nResolution
== PUB_LOWRES_WIDTH
);
1318 m_xPage3_Resolution_2
->set_sensitive(pDesign
->m_nResolution
== PUB_MEDRES_WIDTH
);
1319 m_xPage3_Resolution_3
->set_sensitive(pDesign
->m_nResolution
== PUB_HIGHRES_WIDTH
);
1320 m_xPage3_Resolution_4
->set_sensitive(pDesign
->m_nResolution
== PUB_FHDRES_WIDTH
);
1322 m_xPage3_SldSound
->set_sensitive( pDesign
->m_bSlideSound
);
1323 m_xPage3_HiddenSlides
->set_sensitive( pDesign
->m_bHiddenSlides
);
1325 m_xPage4_Author
->set_text(pDesign
->m_aAuthor
);
1326 m_xPage4_Email
->set_text(pDesign
->m_aEMail
);
1327 m_xPage4_WWW
->set_text(pDesign
->m_aWWW
);
1328 m_xPage4_Misc
->set_text(pDesign
->m_aMisc
);
1330 m_xPage4_Download
->set_sensitive(pDesign
->m_bDownload
);
1332 m_xPage5_TextOnly
->set_sensitive(pDesign
->m_nButtonThema
== -1);
1333 if(pDesign
->m_nButtonThema
!= -1)
1336 LoadPreviewButtons();
1337 m_xPage5_Buttons
->SelectItem(pDesign
->m_nButtonThema
+ 1);
1340 m_xPage5_Buttons
->SetNoSelection();
1342 m_xPage6_User
->set_sensitive(pDesign
->m_bUserAttr
);
1343 m_aBackColor
= pDesign
->m_aBackColor
;
1344 m_aTextColor
= pDesign
->m_aTextColor
;
1345 m_aLinkColor
= pDesign
->m_aLinkColor
;
1346 m_aVLinkColor
= pDesign
->m_aVLinkColor
;
1347 m_aALinkColor
= pDesign
->m_aALinkColor
;
1349 m_xPage6_DocColors
->set_sensitive(pDesign
->m_bUseColor
);
1351 m_xPage6_Preview
->SetColors( m_aBackColor
, m_aTextColor
, m_aLinkColor
,
1352 m_aVLinkColor
, m_aALinkColor
);
1353 m_xPage6_Preview
->Invalidate();
1358 // Transfer the status of the Design Dialog Controls
1359 void SdPublishingDlg::GetDesign( SdPublishingDesign
* pDesign
)
1364 pDesign
->m_eMode
= m_xPage2_Standard
->get_active()?PUBLISH_HTML
:
1365 m_xPage2_Frames
->get_active()?PUBLISH_FRAMES
:
1366 m_xPage2_Kiosk
->get_active()?PUBLISH_KIOSK
:
1369 pDesign
->m_bContentPage
= m_xPage2_Content
->get_active();
1371 pDesign
->m_bNotes
= m_xPage2_Notes
->get_active();
1373 if( m_xPage3_Gif
->get_active() )
1374 pDesign
->m_eFormat
= FORMAT_GIF
;
1375 else if( m_xPage3_Jpg
->get_active() )
1376 pDesign
->m_eFormat
= FORMAT_JPG
;
1378 pDesign
->m_eFormat
= FORMAT_PNG
;
1380 pDesign
->m_aCompression
= m_xPage3_Quality
->get_active_text();
1382 if (m_xPage3_Resolution_1
->get_active())
1383 pDesign
->m_nResolution
= PUB_LOWRES_WIDTH
;
1384 else if (m_xPage3_Resolution_2
->get_active())
1385 pDesign
->m_nResolution
= PUB_MEDRES_WIDTH
;
1386 else if (m_xPage3_Resolution_3
->get_active())
1387 pDesign
->m_nResolution
= PUB_HIGHRES_WIDTH
;
1389 pDesign
->m_nResolution
= PUB_FHDRES_WIDTH
;
1391 pDesign
->m_bSlideSound
= m_xPage3_SldSound
->get_active();
1392 pDesign
->m_bHiddenSlides
= m_xPage3_HiddenSlides
->get_active();
1394 pDesign
->m_aAuthor
= m_xPage4_Author
->get_text();
1395 pDesign
->m_aEMail
= m_xPage4_Email
->get_text();
1396 pDesign
->m_aWWW
= m_xPage4_WWW
->get_text();
1397 pDesign
->m_aMisc
= m_xPage4_Misc
->get_text();
1398 pDesign
->m_bDownload
= m_bImpress
&& m_xPage4_Download
->get_active();
1400 if(m_xPage5_TextOnly
->get_active())
1401 pDesign
->m_nButtonThema
= -1;
1403 pDesign
->m_nButtonThema
= m_xPage5_Buttons
->GetSelectedItemId() - 1;
1405 pDesign
->m_bUserAttr
= m_xPage6_User
->get_active();
1406 pDesign
->m_aBackColor
= m_aBackColor
;
1407 pDesign
->m_aTextColor
= m_aTextColor
;
1408 pDesign
->m_aLinkColor
= m_aLinkColor
;
1409 pDesign
->m_aVLinkColor
= m_aVLinkColor
;
1410 pDesign
->m_aALinkColor
= m_aALinkColor
;
1411 pDesign
->m_bUseColor
= m_xPage6_DocColors
->get_active();
1413 pDesign
->m_eScript
= m_xPage2_ASP
->get_active()?SCRIPT_ASP
:SCRIPT_PERL
;
1414 pDesign
->m_aCGI
= m_xPage2_CGI
->get_text();
1415 pDesign
->m_aURL
= m_xPage2_URL
->get_text();
1417 pDesign
->m_bAutoSlide
= m_xPage2_ChgAuto
->get_active();
1418 pDesign
->m_nSlideDuration
= static_cast<sal_uInt32
>(m_xFormatter
->GetTime().GetMSFromTime()) / 1000;
1419 pDesign
->m_bEndless
= m_xPage2_Endless
->get_active();
1422 // Clickhandler for the back Button
1423 IMPL_LINK_NOARG(SdPublishingDlg
, LastPageHdl
, weld::Button
&, void)
1425 aAssistentFunc
.PreviousPage();
1430 void SdPublishingDlg::Load()
1432 m_bDesignListDirty
= false;
1434 INetURLObject
aURL( SvtPathOptions().GetUserConfigPath() );
1435 aURL
.Append( u
"designs.sod" );
1437 // check if file exists, SfxMedium shows an errorbox else
1439 std::unique_ptr
<SvStream
> pIStm
= ::utl::UcbStreamHelper::CreateStream( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), StreamMode::READ
);
1441 bool bOk
= pIStm
&& ( pIStm
->GetError() == ERRCODE_NONE
);
1447 SfxMedium
aMedium( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), StreamMode::READ
| StreamMode::NOCREATE
);
1449 SvStream
* pStream
= aMedium
.GetInStream();
1455 pStream
->ReadUInt16( aCheck
);
1457 if(aCheck
!= nMagic
)
1460 SdIOCompat
aIO(*pStream
, StreamMode::READ
);
1462 sal_uInt16
nDesigns(0);
1463 pStream
->ReadUInt16(nDesigns
);
1465 // there has to at least be a sal_uInt16 header in each design
1466 const size_t nMaxRecords
= pStream
->remainingSize() / sizeof(sal_uInt16
);
1467 if (nDesigns
> nMaxRecords
)
1469 SAL_WARN("sd", "Parsing error: " << nMaxRecords
<<
1470 " max possible entries, but " << nDesigns
<< " claimed, truncating");
1471 nDesigns
= nMaxRecords
;
1474 for( sal_uInt16 nIndex
= 0;
1475 pStream
->GetError() == ERRCODE_NONE
&& nIndex
< nDesigns
;
1478 SdPublishingDesign aDesign
;
1479 *pStream
>> aDesign
;
1481 m_aDesignList
.push_back(aDesign
);
1486 bool SdPublishingDlg::Save()
1488 INetURLObject
aURL( SvtPathOptions().GetUserConfigPath() );
1489 aURL
.Append( u
"designs.sod" );
1490 SfxMedium
aMedium( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), StreamMode::WRITE
| StreamMode::TRUNC
);
1492 SvStream
* pStream
= aMedium
.GetOutStream();
1497 pStream
->WriteUInt16( nMagic
);
1499 // Destroys the SdIOCompat before the Stream is being distributed
1501 SdIOCompat
aIO(*pStream
, StreamMode::WRITE
, 0);
1503 sal_uInt16 nDesigns
= static_cast<sal_uInt16
>(m_aDesignList
.size());
1504 pStream
->WriteUInt16( nDesigns
);
1506 for( sal_uInt16 nIndex
= 0;
1507 pStream
->GetError() == ERRCODE_NONE
&& nIndex
< nDesigns
;
1509 WriteSdPublishingDesign( *pStream
, m_aDesignList
[nIndex
] );
1515 return( aMedium
.GetError() == ERRCODE_NONE
);
1518 // SdDesignNameDlg Methods
1519 SdDesignNameDlg::SdDesignNameDlg(weld::Window
* pWindow
, const OUString
& rName
)
1520 : GenericDialogController(pWindow
, "modules/sdraw/ui/namedesign.ui", "NameDesignDialog")
1521 , m_xEdit(m_xBuilder
->weld_entry("entry"))
1522 , m_xBtnOK(m_xBuilder
->weld_button("ok"))
1524 m_xEdit
->connect_changed(LINK(this, SdDesignNameDlg
, ModifyHdl
));
1525 m_xEdit
->set_text(rName
);
1526 m_xBtnOK
->set_sensitive(!rName
.isEmpty());
1529 OUString
SdDesignNameDlg::GetDesignName() const
1531 return m_xEdit
->get_text();
1534 IMPL_LINK_NOARG(SdDesignNameDlg
, ModifyHdl
, weld::Entry
&, void)
1536 m_xBtnOK
->set_sensitive(!m_xEdit
->get_text().isEmpty());
1539 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */