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/lstbox.hxx>
24 #include <vcl/FilterConfigItem.hxx>
25 #include <vcl/button.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/vclmedit.hxx>
28 #include <vcl/weld.hxx>
29 #include <svtools/valueset.hxx>
30 #include <svtools/colrdlg.hxx>
31 #include <tools/debug.hxx>
32 #include <tools/urlobj.hxx>
33 #include <tools/GenericTypeSerializer.hxx>
34 #include <sdiocmpt.hxx>
35 #include <sfx2/docfile.hxx>
37 #include <unotools/useroptions.hxx>
38 #include <unotools/pathoptions.hxx>
40 #include <sdresid.hxx>
41 #include <strings.hrc>
43 #include "htmlattr.hxx"
45 #include "htmlpublishmode.hxx"
47 #include "buttonset.hxx"
48 #include <strings.hxx>
51 using namespace com::sun::star::uno
;
52 using namespace com::sun::star::beans
;
56 //ID for the config-data with the HTML-settings
57 const sal_uInt16 nMagic
= sal_uInt16(0x1977);
59 // Key for the soffice.ini
60 #define KEY_QUALITY "JPG-EXPORT-QUALITY"
62 // The Help-IDs of the pages
63 const char* const aPageHelpIds
[NOOFPAGES
] =
65 HID_SD_HTMLEXPORT_PAGE1
,
66 HID_SD_HTMLEXPORT_PAGE2
,
67 HID_SD_HTMLEXPORT_PAGE3
,
68 HID_SD_HTMLEXPORT_PAGE4
,
69 HID_SD_HTMLEXPORT_PAGE5
,
70 HID_SD_HTMLEXPORT_PAGE6
73 static SvStream
& operator >> (SvStream
& rIn
, SdPublishingDesign
& rDesign
);
75 static SvStream
& WriteSdPublishingDesign(SvStream
& rOut
, const SdPublishingDesign
& rDesign
);
77 // This class has all the settings for the HTML-export autopilot
78 class SdPublishingDesign
81 OUString m_aDesignName
;
83 HtmlPublishMode m_eMode
;
85 // special WebCast options
86 PublishingScript m_eScript
;
90 // special Kiosk options
92 sal_uInt32 m_nSlideDuration
;
95 // special HTML options
100 sal_uInt16 m_nResolution
;
101 OUString m_aCompression
;
102 PublishingFormat m_eFormat
;
104 bool m_bHiddenSlides
;
106 // title page information
112 bool m_bCreated
; // not used
114 // buttons and colorscheme
115 sal_Int16 m_nButtonThema
;
125 SdPublishingDesign();
127 bool operator ==(const SdPublishingDesign
& rDesign
) const;
128 friend SvStream
& operator >> (SvStream
& rIn
, SdPublishingDesign
& rDesign
);
129 friend SvStream
& WriteSdPublishingDesign(SvStream
& rOut
, const SdPublishingDesign
& rDesign
);
132 // load Default-settings
133 SdPublishingDesign::SdPublishingDesign()
134 : m_eMode(PUBLISH_HTML
)
135 , m_eScript(SCRIPT_ASP
)
137 , m_nSlideDuration(15)
139 , m_bContentPage(true)
141 , m_nResolution(PUB_LOWRES_WIDTH
)
142 , m_eFormat(FORMAT_PNG
)
143 , m_bSlideSound(true)
144 , m_bHiddenSlides(false)
149 , m_aBackColor(COL_WHITE
)
150 , m_aTextColor(COL_BLACK
)
151 , m_aLinkColor(COL_BLUE
)
152 , m_aVLinkColor(COL_LIGHTGRAY
)
153 , m_aALinkColor(COL_GRAY
)
154 , m_bUseAttribs(true)
157 FilterConfigItem
aFilterConfigItem("Office.Common/Filter/Graphic/Export/JPG");
158 sal_Int32 nCompression
= aFilterConfigItem
.ReadInt32( KEY_QUALITY
, 75 );
159 m_aCompression
= OUString::number(nCompression
) + "%";
161 SvtUserOptions aUserOptions
;
162 m_aAuthor
= aUserOptions
.GetFirstName();
163 if (!m_aAuthor
.isEmpty() && !aUserOptions
.GetLastName().isEmpty())
165 m_aAuthor
+= aUserOptions
.GetLastName();
166 m_aEMail
= aUserOptions
.GetEmail();
169 // Compares the values without paying attention to the name
170 bool SdPublishingDesign::operator ==(const SdPublishingDesign
& rDesign
) const
174 m_eMode
== rDesign
.m_eMode
&&
175 m_nResolution
== rDesign
.m_nResolution
&&
176 m_aCompression
== rDesign
.m_aCompression
&&
177 m_eFormat
== rDesign
.m_eFormat
&&
178 m_bHiddenSlides
== rDesign
.m_bHiddenSlides
&&
179 ( // compare html options
180 (m_eMode
!= PUBLISH_HTML
&& m_eMode
!= PUBLISH_FRAMES
) ||
182 m_bContentPage
== rDesign
.m_bContentPage
&&
183 m_bNotes
== rDesign
.m_bNotes
&&
184 m_aAuthor
== rDesign
.m_aAuthor
&&
185 m_aEMail
== rDesign
.m_aEMail
&&
186 m_aWWW
== rDesign
.m_aWWW
&&
187 m_aMisc
== rDesign
.m_aMisc
&&
188 m_bDownload
== rDesign
.m_bDownload
&&
189 m_nButtonThema
== rDesign
.m_nButtonThema
&&
190 m_bUserAttr
== rDesign
.m_bUserAttr
&&
191 m_aBackColor
== rDesign
.m_aBackColor
&&
192 m_aTextColor
== rDesign
.m_aTextColor
&&
193 m_aLinkColor
== rDesign
.m_aLinkColor
&&
194 m_aVLinkColor
== rDesign
.m_aVLinkColor
&&
195 m_aALinkColor
== rDesign
.m_aALinkColor
&&
196 m_bUseAttribs
== rDesign
.m_bUseAttribs
&&
197 m_bSlideSound
== rDesign
.m_bSlideSound
&&
198 m_bUseColor
== rDesign
.m_bUseColor
201 ( // compare kiosk options
202 (m_eMode
!= PUBLISH_KIOSK
) ||
204 m_bAutoSlide
== rDesign
.m_bAutoSlide
&&
205 m_bSlideSound
== rDesign
.m_bSlideSound
&&
209 m_nSlideDuration
== rDesign
.m_nSlideDuration
&&
210 m_bEndless
== rDesign
.m_bEndless
215 ( // compare WebCast options
216 (m_eMode
!= PUBLISH_WEBCAST
) ||
218 m_eScript
== rDesign
.m_eScript
&&
220 m_eScript
!= SCRIPT_PERL
||
222 m_aURL
== rDesign
.m_aURL
&&
223 m_aCGI
== rDesign
.m_aCGI
231 // Load the design from the stream
232 SvStream
& operator >> (SvStream
& rIn
, SdPublishingDesign
& rDesign
)
234 SdIOCompat
aIO(rIn
, StreamMode::READ
);
237 tools::GenericTypeSerializer
aSerializer(rIn
);
239 rDesign
.m_aDesignName
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
240 RTL_TEXTENCODING_UTF8
);
241 rIn
.ReadUInt16( nTemp16
);
242 rDesign
.m_eMode
= static_cast<HtmlPublishMode
>(nTemp16
);
243 rIn
.ReadCharAsBool( rDesign
.m_bContentPage
);
244 rIn
.ReadCharAsBool( rDesign
.m_bNotes
);
245 rIn
.ReadUInt16( rDesign
.m_nResolution
);
246 rDesign
.m_aCompression
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
247 RTL_TEXTENCODING_UTF8
);
248 rIn
.ReadUInt16( nTemp16
);
249 rDesign
.m_eFormat
= static_cast<PublishingFormat
>(nTemp16
);
250 rDesign
.m_aAuthor
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
251 RTL_TEXTENCODING_UTF8
);
252 rDesign
.m_aEMail
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
253 RTL_TEXTENCODING_UTF8
);
254 rDesign
.m_aWWW
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
255 RTL_TEXTENCODING_UTF8
);
256 rDesign
.m_aMisc
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
257 RTL_TEXTENCODING_UTF8
);
258 rIn
.ReadCharAsBool( rDesign
.m_bDownload
);
259 rIn
.ReadCharAsBool( rDesign
.m_bCreated
); // not used
260 rIn
.ReadInt16( rDesign
.m_nButtonThema
);
261 rIn
.ReadCharAsBool( rDesign
.m_bUserAttr
);
262 aSerializer
.readColor(rDesign
.m_aBackColor
);
263 aSerializer
.readColor(rDesign
.m_aTextColor
);
264 aSerializer
.readColor(rDesign
.m_aLinkColor
);
265 aSerializer
.readColor(rDesign
.m_aVLinkColor
);
266 aSerializer
.readColor(rDesign
.m_aALinkColor
);
267 rIn
.ReadCharAsBool( rDesign
.m_bUseAttribs
);
268 rIn
.ReadCharAsBool( rDesign
.m_bUseColor
);
270 rIn
.ReadUInt16( nTemp16
);
271 rDesign
.m_eScript
= static_cast<PublishingScript
>(nTemp16
);
272 rDesign
.m_aURL
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
273 RTL_TEXTENCODING_UTF8
);
274 rDesign
.m_aCGI
= read_uInt16_lenPrefixed_uInt8s_ToOUString(rIn
,
275 RTL_TEXTENCODING_UTF8
);
277 rIn
.ReadCharAsBool( rDesign
.m_bAutoSlide
);
278 rIn
.ReadUInt32( rDesign
.m_nSlideDuration
);
279 rIn
.ReadCharAsBool( rDesign
.m_bEndless
);
280 rIn
.ReadCharAsBool( rDesign
.m_bSlideSound
);
281 rIn
.ReadCharAsBool( rDesign
.m_bHiddenSlides
);
286 // Set the design to the stream
287 SvStream
& WriteSdPublishingDesign(SvStream
& rOut
, const SdPublishingDesign
& rDesign
)
289 // The last parameter is the versionnumber of the code
290 SdIOCompat
aIO(rOut
, StreamMode::WRITE
, 0);
292 tools::GenericTypeSerializer
aSerializer(rOut
);
295 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aDesignName
,
296 RTL_TEXTENCODING_UTF8
);
298 rOut
.WriteUInt16( rDesign
.m_eMode
);
299 rOut
.WriteBool( rDesign
.m_bContentPage
);
300 rOut
.WriteBool( rDesign
.m_bNotes
);
301 rOut
.WriteUInt16( rDesign
.m_nResolution
);
302 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aCompression
,
303 RTL_TEXTENCODING_UTF8
);
304 rOut
.WriteUInt16( rDesign
.m_eFormat
);
305 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aAuthor
,
306 RTL_TEXTENCODING_UTF8
);
307 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aEMail
,
308 RTL_TEXTENCODING_UTF8
);
309 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aWWW
,
310 RTL_TEXTENCODING_UTF8
);
311 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aMisc
,
312 RTL_TEXTENCODING_UTF8
);
313 rOut
.WriteBool( rDesign
.m_bDownload
);
314 rOut
.WriteBool( rDesign
.m_bCreated
); // not used
315 rOut
.WriteInt16( rDesign
.m_nButtonThema
);
316 rOut
.WriteBool( rDesign
.m_bUserAttr
);
317 aSerializer
.writeColor(rDesign
.m_aBackColor
);
318 aSerializer
.writeColor(rDesign
.m_aTextColor
);
319 aSerializer
.writeColor(rDesign
.m_aLinkColor
);
320 aSerializer
.writeColor(rDesign
.m_aVLinkColor
);
321 aSerializer
.writeColor(rDesign
.m_aALinkColor
);
322 rOut
.WriteBool( rDesign
.m_bUseAttribs
);
323 rOut
.WriteBool( rDesign
.m_bUseColor
);
325 rOut
.WriteUInt16( rDesign
.m_eScript
);
326 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aURL
,
327 RTL_TEXTENCODING_UTF8
);
328 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut
, rDesign
.m_aCGI
,
329 RTL_TEXTENCODING_UTF8
);
331 rOut
.WriteBool( rDesign
.m_bAutoSlide
);
332 rOut
.WriteUInt32( rDesign
.m_nSlideDuration
);
333 rOut
.WriteBool( rDesign
.m_bEndless
);
334 rOut
.WriteBool( rDesign
.m_bSlideSound
);
335 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();
350 DECL_LINK(ModifyHdl
, weld::Entry
&, void);
353 // SdPublishingDlg Methods
355 SdPublishingDlg::SdPublishingDlg(vcl::Window
* pWindow
, DocumentType eDocType
)
356 : ModalDialog(pWindow
, "PublishingDialog", "modules/simpress/ui/publishingdialog.ui")
357 , mpButtonSet( new ButtonSet() )
358 , aAssistentFunc(NOOFPAGES
)
359 , m_bButtonsDirty(true)
360 , m_bDesignListDirty(false)
363 get(pLastPageButton
, "lastPageButton");
364 get(pNextPageButton
, "nextPageButton");
365 get(pFinishButton
, "finishButton");
367 m_bImpress
= eDocType
== DocumentType::Impress
;
369 Size
aSize(LogicToPixel(Size(60, 50), MapMode(MapUnit::MapAppFont
)));
370 get(pPage2_Standard_FB
, "standardFBImage");
371 pPage2_Standard_FB
->set_width_request(aSize
.Width());
372 pPage2_Standard_FB
->set_height_request(aSize
.Height());
373 get(pPage2_Frames_FB
, "framesFBImage");
374 pPage2_Frames_FB
->set_width_request(aSize
.Width());
375 pPage2_Frames_FB
->set_height_request(aSize
.Height());
376 get(pPage2_Kiosk_FB
, "kioskFBImage");
377 pPage2_Kiosk_FB
->set_width_request(aSize
.Width());
378 pPage2_Kiosk_FB
->set_height_request(aSize
.Height());
379 get(pPage2_WebCast_FB
, "webCastFBImage");
380 pPage2_WebCast_FB
->set_width_request(aSize
.Width());
381 pPage2_WebCast_FB
->set_height_request(aSize
.Height());
383 get(pPage4_Misc
, "miscTextview");
384 pPage4_Misc
->set_height_request(pPage4_Misc
->GetTextHeight() * 8);
385 pPage4_Misc
->set_width_request(pPage4_Misc
->approximate_char_width() * 52);
387 get(pPage1_Designs
, "designsTreeview");
388 pPage1_Designs
->set_height_request(pPage4_Misc
->GetTextHeight() * 8);
389 pPage1_Designs
->set_width_request(pPage4_Misc
->approximate_char_width() * 52);
391 //Lock down the preferred size based on the
392 //initial max-size configuration
393 aSize
= get_preferred_size();
394 set_width_request(aSize
.Width());
395 set_height_request(aSize
.Height());
400 // sets the output page
401 aAssistentFunc
.GotoPage(1);
402 pLastPageButton
->Disable();
405 pFinishButton
->SetClickHdl(LINK(this,SdPublishingDlg
,FinishHdl
));
406 pLastPageButton
->SetClickHdl(LINK(this,SdPublishingDlg
,LastPageHdl
));
407 pNextPageButton
->SetClickHdl(LINK(this,SdPublishingDlg
,NextPageHdl
));
409 pPage1_NewDesign
->SetClickHdl(LINK(this,SdPublishingDlg
,DesignHdl
));
410 pPage1_OldDesign
->SetClickHdl(LINK(this,SdPublishingDlg
,DesignHdl
));
411 pPage1_Designs
->SetSelectHdl(LINK(this,SdPublishingDlg
,DesignSelectHdl
));
412 pPage1_DelDesign
->SetClickHdl(LINK(this,SdPublishingDlg
,DesignDeleteHdl
));
414 pPage2_Standard
->SetClickHdl(LINK(this,SdPublishingDlg
,BaseHdl
));
415 pPage2_Standard_FB
->SetBorderStyle(WindowBorderStyle::MONO
);
416 pPage2_Frames
->SetClickHdl(LINK(this,SdPublishingDlg
,BaseHdl
));
417 pPage2_Frames_FB
->SetBorderStyle(WindowBorderStyle::MONO
);
418 pPage2_SingleDocument
->SetClickHdl(LINK(this,SdPublishingDlg
,BaseHdl
));
419 pPage2_Kiosk
->SetClickHdl(LINK(this,SdPublishingDlg
,BaseHdl
));
420 pPage2_Kiosk_FB
->SetBorderStyle(WindowBorderStyle::MONO
);
421 pPage2_WebCast
->SetClickHdl(LINK(this,SdPublishingDlg
,BaseHdl
));
422 pPage2_WebCast_FB
->SetBorderStyle(WindowBorderStyle::MONO
);
424 pPage2_Content
->SetClickHdl(LINK(this,SdPublishingDlg
,ContentHdl
));
426 pPage2_ASP
->SetClickHdl(LINK(this,SdPublishingDlg
,WebServerHdl
));
427 pPage2_PERL
->SetClickHdl(LINK(this,SdPublishingDlg
,WebServerHdl
));
428 pPage2_Index
->SetText("index" STR_HTMLEXP_DEFAULT_EXTENSION
);
429 pPage2_CGI
->SetText( "/cgi-bin/" );
431 pPage3_Png
->SetClickHdl(LINK(this,SdPublishingDlg
, GfxFormatHdl
));
432 pPage3_Gif
->SetClickHdl(LINK(this,SdPublishingDlg
, GfxFormatHdl
));
433 pPage3_Jpg
->SetClickHdl(LINK(this,SdPublishingDlg
, GfxFormatHdl
));
434 pPage3_Quality
->Enable(false);
436 pPage3_Resolution_1
->SetClickHdl(LINK(this,SdPublishingDlg
, ResolutionHdl
));
437 pPage3_Resolution_2
->SetClickHdl(LINK(this,SdPublishingDlg
, ResolutionHdl
));
438 pPage3_Resolution_3
->SetClickHdl(LINK(this,SdPublishingDlg
, ResolutionHdl
));
440 pPage2_ChgDefault
->SetClickHdl(LINK(this,SdPublishingDlg
, SlideChgHdl
));
441 pPage2_ChgAuto
->SetClickHdl(LINK(this,SdPublishingDlg
, SlideChgHdl
));
442 pPage2_Duration
->SetFormat( TimeFieldFormat::F_SEC
);
444 pPage5_Buttons
->SetSelectHdl(LINK(this,SdPublishingDlg
, ButtonsHdl
));
445 pPage5_Buttons
->SetStyle( pPage5_Buttons
->GetStyle() | WB_VSCROLL
);
447 pPage6_Back
->SetClickHdl(LINK(this,SdPublishingDlg
, ColorHdl
));
448 pPage6_Text
->SetClickHdl(LINK(this,SdPublishingDlg
, ColorHdl
));
449 pPage6_Link
->SetClickHdl(LINK(this,SdPublishingDlg
, ColorHdl
));
450 pPage6_VLink
->SetClickHdl(LINK(this,SdPublishingDlg
, ColorHdl
));
451 pPage6_ALink
->SetClickHdl(LINK(this,SdPublishingDlg
, ColorHdl
));
453 pPage6_DocColors
->Check();
455 pPage3_Quality
->InsertEntry( "25%" );
456 pPage3_Quality
->InsertEntry( "50%" );
457 pPage3_Quality
->InsertEntry( "75%" );
458 pPage3_Quality
->InsertEntry( "100%" );
460 pPage5_Buttons
->SetColCount();
461 pPage5_Buttons
->SetLineCount( 4 );
462 pPage5_Buttons
->SetExtraSpacing( 1 );
464 for( const auto& rDesign
: m_aDesignList
)
465 pPage1_Designs
->InsertEntry(rDesign
.m_aDesignName
);
467 pPage6_Preview
->SetBorderStyle(WindowBorderStyle::MONO
);
471 SetHelpId(aPageHelpIds
[0]);
473 pNextPageButton
->GrabFocus();
476 SdPublishingDlg::~SdPublishingDlg()
481 void SdPublishingDlg::dispose()
484 pPage1_Title
.clear();
485 pPage1_NewDesign
.clear();
486 pPage1_OldDesign
.clear();
487 pPage1_Designs
.clear();
488 pPage1_DelDesign
.clear();
491 pPage2Frame2
.clear();
492 pPage2Frame3
.clear();
493 pPage2Frame4
.clear();
494 pPage2_Title
.clear();
495 pPage2_Standard
.clear();
496 pPage2_Frames
.clear();
497 pPage2_SingleDocument
.clear();
498 pPage2_Kiosk
.clear();
499 pPage2_WebCast
.clear();
500 pPage2_Standard_FB
.clear();
501 pPage2_Frames_FB
.clear();
502 pPage2_Kiosk_FB
.clear();
503 pPage2_WebCast_FB
.clear();
504 pPage2_Title_Html
.clear();
505 pPage2_Content
.clear();
506 pPage2_Notes
.clear();
507 pPage2_Title_WebCast
.clear();
510 pPage2_URL_txt
.clear();
512 pPage2_CGI_txt
.clear();
514 pPage2_Index_txt
.clear();
515 pPage2_Index
.clear();
516 pPage2_Title_Kiosk
.clear();
517 pPage2_ChgDefault
.clear();
518 pPage2_ChgAuto
.clear();
519 pPage2_Duration_txt
.clear();
520 pPage2_Duration
.clear();
521 pPage2_Endless
.clear();
523 pPage3_Title1
.clear();
527 pPage3_Quality_txt
.clear();
528 pPage3_Quality
.clear();
529 pPage3_Title2
.clear();
530 pPage3_Resolution_1
.clear();
531 pPage3_Resolution_2
.clear();
532 pPage3_Resolution_3
.clear();
533 pPage3_Title3
.clear();
534 pPage3_SldSound
.clear();
535 pPage3_HiddenSlides
.clear();
537 pPage4_Title1
.clear();
538 pPage4_Author_txt
.clear();
539 pPage4_Author
.clear();
540 pPage4_Email_txt
.clear();
541 pPage4_Email
.clear();
542 pPage4_WWW_txt
.clear();
544 pPage4_Title2
.clear();
546 pPage4_Download
.clear();
548 pPage5_Title
.clear();
549 pPage5_TextOnly
.clear();
550 pPage5_Buttons
.clear();
552 pPage6_Title
.clear();
553 pPage6_Default
.clear();
558 pPage6_VLink
.clear();
559 pPage6_ALink
.clear();
560 pPage6_DocColors
.clear();
561 pPage6_Preview
.clear();
562 pLastPageButton
.clear();
563 pNextPageButton
.clear();
564 pFinishButton
.clear();
565 ModalDialog::dispose();
569 // Generate dialog controls and embed them in the pages
570 void SdPublishingDlg::CreatePages()
573 get(pPage1
, "page1");
574 get(pPage1_Title
, "assignLabel");
575 get(pPage1_NewDesign
, "newDesignRadiobutton");
576 get(pPage1_OldDesign
, "oldDesignRadiobutton");
577 get(pPage1_DelDesign
, "delDesingButton");
578 get(pPage1_Desc
, "descLabel");
579 aAssistentFunc
.InsertControl(1, pPage1
);
580 aAssistentFunc
.InsertControl(1, pPage1_Title
);
581 aAssistentFunc
.InsertControl(1, pPage1_NewDesign
);
582 aAssistentFunc
.InsertControl(1, pPage1_OldDesign
);
583 aAssistentFunc
.InsertControl(1, pPage1_Designs
);
584 aAssistentFunc
.InsertControl(1, pPage1_DelDesign
);
585 aAssistentFunc
.InsertControl(1, pPage1_Desc
);
588 get(pPage2
, "page2");
589 get(pPage2Frame2
, "page2.2");
590 get(pPage2Frame3
, "page2.3");
591 get(pPage2Frame4
, "page2.4");
592 get(pPage2_Title
, "publicationLabel");
593 get(pPage2_Standard
, "standardRadiobutton");
594 get(pPage2_Frames
, "framesRadiobutton");
595 get(pPage2_SingleDocument
, "singleDocumentRadiobutton");
596 get(pPage2_Kiosk
, "kioskRadiobutton");
597 get(pPage2_WebCast
, "webCastRadiobutton");
598 aAssistentFunc
.InsertControl(2, pPage2
);
599 aAssistentFunc
.InsertControl(2, pPage2Frame2
);
600 aAssistentFunc
.InsertControl(2, pPage2Frame3
);
601 aAssistentFunc
.InsertControl(2, pPage2Frame4
);
602 aAssistentFunc
.InsertControl(2, pPage2_Title
);
603 aAssistentFunc
.InsertControl(2, pPage2_Standard
);
604 aAssistentFunc
.InsertControl(2, pPage2_Frames
);
605 aAssistentFunc
.InsertControl(2, pPage2_SingleDocument
);
606 aAssistentFunc
.InsertControl(2, pPage2_Kiosk
);
607 aAssistentFunc
.InsertControl(2, pPage2_WebCast
);
608 aAssistentFunc
.InsertControl(2, pPage2_Standard_FB
);
609 aAssistentFunc
.InsertControl(2, pPage2_Frames_FB
);
610 aAssistentFunc
.InsertControl(2, pPage2_Kiosk_FB
);
611 aAssistentFunc
.InsertControl(2, pPage2_WebCast_FB
);
613 get(pPage2_Title_Html
, "htmlOptionsLabel");
614 get(pPage2_Content
, "contentCheckbutton");
615 get(pPage2_Notes
, "notesCheckbutton");
616 aAssistentFunc
.InsertControl(2, pPage2_Title_Html
);
617 aAssistentFunc
.InsertControl(2, pPage2_Content
);
619 aAssistentFunc
.InsertControl(2, pPage2_Notes
);
621 get(pPage2_Title_WebCast
, "webCastLabel");
622 get(pPage2_ASP
, "ASPRadiobutton");
623 get(pPage2_PERL
, "perlRadiobutton");
624 get(pPage2_URL_txt
, "URLTxtLabel");
625 get(pPage2_URL
, "URLEntry");
626 get(pPage2_CGI_txt
, "CGITxtLabel");
627 get(pPage2_CGI
, "CGIEntry");
628 get(pPage2_Index_txt
, "indexTxtLabel");
629 get(pPage2_Index
, "indexEntry");
630 get(pPage2_Title_Kiosk
, "kioskLabel");
631 get(pPage2_ChgDefault
, "chgDefaultRadiobutton");
632 get(pPage2_ChgAuto
, "chgAutoRadiobutton");
633 get(pPage2_Duration_txt
, "durationTxtLabel");
634 get(pPage2_Duration
, "durationSpinbutton");
635 get(pPage2_Endless
, "endlessCheckbutton");
636 aAssistentFunc
.InsertControl(2, pPage2_Title_WebCast
);
637 aAssistentFunc
.InsertControl(2, pPage2_Index_txt
);
638 aAssistentFunc
.InsertControl(2, pPage2_Index
);
639 aAssistentFunc
.InsertControl(2, pPage2_ASP
);
640 aAssistentFunc
.InsertControl(2, pPage2_PERL
);
641 aAssistentFunc
.InsertControl(2, pPage2_URL_txt
);
642 aAssistentFunc
.InsertControl(2, pPage2_URL
);
643 aAssistentFunc
.InsertControl(2, pPage2_CGI_txt
);
644 aAssistentFunc
.InsertControl(2, pPage2_CGI
);
645 aAssistentFunc
.InsertControl(2, pPage2_Title_Kiosk
);
646 aAssistentFunc
.InsertControl(2, pPage2_ChgDefault
);
647 aAssistentFunc
.InsertControl(2, pPage2_ChgAuto
);
648 aAssistentFunc
.InsertControl(2, pPage2_Duration_txt
);
649 aAssistentFunc
.InsertControl(2, pPage2_Duration
);
650 aAssistentFunc
.InsertControl(2, pPage2_Endless
);
653 get(pPage3
, "page3");
654 get(pPage3_Title1
, "saveImgAsLabel");
655 get(pPage3_Png
, "pngRadiobutton");
656 get(pPage3_Gif
, "gifRadiobutton");
657 get(pPage3_Jpg
, "jpgRadiobutton");
658 get(pPage3_Quality_txt
, "qualityTxtLabel");
659 get(pPage3_Quality
, "qualityCombobox");
660 get(pPage3_Title2
, "monitorResolutionLabel");
661 get(pPage3_Resolution_1
, "resolution1Radiobutton");
662 get(pPage3_Resolution_2
, "resolution2Radiobutton");
663 get(pPage3_Resolution_3
, "resolution3Radiobutton");
664 get(pPage3_Title3
, "effectsLabel");
665 get(pPage3_SldSound
, "sldSoundCheckbutton");
666 get(pPage3_HiddenSlides
, "hiddenSlidesCheckbutton");
667 aAssistentFunc
.InsertControl(3, pPage3
);
668 aAssistentFunc
.InsertControl(3, pPage3_Title1
);
669 aAssistentFunc
.InsertControl(3, pPage3_Png
);
670 aAssistentFunc
.InsertControl(3, pPage3_Gif
);
671 aAssistentFunc
.InsertControl(3, pPage3_Jpg
);
672 aAssistentFunc
.InsertControl(3, pPage3_Quality_txt
);
673 aAssistentFunc
.InsertControl(3, pPage3_Quality
);
674 aAssistentFunc
.InsertControl(3, pPage3_Title2
);
675 aAssistentFunc
.InsertControl(3, pPage3_Resolution_1
);
676 aAssistentFunc
.InsertControl(3, pPage3_Resolution_2
);
677 aAssistentFunc
.InsertControl(3, pPage3_Resolution_3
);
678 aAssistentFunc
.InsertControl(3, pPage3_Title3
);
679 aAssistentFunc
.InsertControl(3, pPage3_SldSound
);
680 aAssistentFunc
.InsertControl(3, pPage3_HiddenSlides
);
683 get(pPage4
, "page4");
684 get(pPage4_Title1
, "infTitlePageLabel");
685 get(pPage4_Author_txt
, "authorTxtLabel");
686 get(pPage4_Author
, "authorEntry");
687 get(pPage4_Email_txt
, "emailTxtLabel");
688 get(pPage4_Email
, "emailEntry");
689 get(pPage4_WWW_txt
, "wwwTxtLabel");
690 get(pPage4_WWW
, "wwwEntry");
691 get(pPage4_Title2
, "addInformLabel");
692 get(pPage4_Download
, "downloadCheckbutton");
693 aAssistentFunc
.InsertControl(4, pPage4
);
694 aAssistentFunc
.InsertControl(4, pPage4_Title1
);
695 aAssistentFunc
.InsertControl(4, pPage4_Author_txt
);
696 aAssistentFunc
.InsertControl(4, pPage4_Author
);
697 aAssistentFunc
.InsertControl(4, pPage4_Email_txt
);
698 aAssistentFunc
.InsertControl(4, pPage4_Email
);
699 aAssistentFunc
.InsertControl(4, pPage4_WWW_txt
);
700 aAssistentFunc
.InsertControl(4, pPage4_WWW
);
701 aAssistentFunc
.InsertControl(4, pPage4_Title2
);
702 aAssistentFunc
.InsertControl(4, pPage4_Misc
);
704 aAssistentFunc
.InsertControl(4, pPage4_Download
);
707 get(pPage5
, "page5");
708 get(pPage5_Title
, "buttonStyleLabel");
709 get(pPage5_TextOnly
, "textOnlyCheckbutton");
710 get(pPage5_Buttons
, "buttonsDrawingarea");
711 aAssistentFunc
.InsertControl(5, pPage5
);
712 aAssistentFunc
.InsertControl(5, pPage5_Title
);
713 aAssistentFunc
.InsertControl(5, pPage5_TextOnly
);
714 aAssistentFunc
.InsertControl(5, pPage5_Buttons
);
717 get(pPage6
, "page6");
718 get(pPage6_Title
, "selectColorLabel");
719 get(pPage6_Default
, "defaultRadiobutton");
720 get(pPage6_User
, "userRadiobutton");
721 get(pPage6_Back
, "backButton");
722 get(pPage6_Text
, "textButton");
723 get(pPage6_Link
, "linkButton");
724 get(pPage6_VLink
, "vLinkButton");
725 get(pPage6_ALink
, "aLinkButton");
726 get(pPage6_DocColors
, "docColorsRadiobutton");
727 get(pPage6_Preview
, "previewDrawingarea");
728 aAssistentFunc
.InsertControl(6, pPage6
);
729 aAssistentFunc
.InsertControl(6, pPage6_Title
);
730 aAssistentFunc
.InsertControl(6, pPage6_DocColors
);
731 aAssistentFunc
.InsertControl(6, pPage6_Default
);
732 aAssistentFunc
.InsertControl(6, pPage6_User
);
733 aAssistentFunc
.InsertControl(6, pPage6_Text
);
734 aAssistentFunc
.InsertControl(6, pPage6_Link
);
735 aAssistentFunc
.InsertControl(6, pPage6_ALink
);
736 aAssistentFunc
.InsertControl(6, pPage6_VLink
);
737 aAssistentFunc
.InsertControl(6, pPage6_Back
);
738 aAssistentFunc
.InsertControl(6, pPage6_Preview
);
741 // Initialize dialog with default-values
742 void SdPublishingDlg::SetDefaults()
744 SdPublishingDesign aDefault
;
745 SetDesign(&aDefault
);
747 pPage1_NewDesign
->Check();
748 pPage1_OldDesign
->Check(false);
752 // Feed the SfxItemSet with the settings of the dialog
753 void SdPublishingDlg::GetParameterSequence( Sequence
< PropertyValue
>& rParams
)
755 std::vector
< PropertyValue
> aProps
;
757 PropertyValue aValue
;
760 aValue
.Name
= "PublishMode";
762 HtmlPublishMode ePublishMode
;
763 if (pPage2_Frames
->IsChecked())
764 ePublishMode
= PUBLISH_FRAMES
;
765 else if (pPage2_SingleDocument
->IsChecked())
766 ePublishMode
= PUBLISH_SINGLE_DOCUMENT
;
767 else if (pPage2_Kiosk
->IsChecked())
768 ePublishMode
= PUBLISH_KIOSK
;
769 else if (pPage2_WebCast
->IsChecked())
770 ePublishMode
= PUBLISH_WEBCAST
;
772 ePublishMode
= PUBLISH_HTML
;
774 aValue
.Value
<<= static_cast<sal_Int32
>(ePublishMode
);
775 aProps
.push_back( aValue
);
777 aValue
.Name
= "IsExportContentsPage";
778 aValue
.Value
<<= pPage2_Content
->IsChecked();
779 aProps
.push_back( aValue
);
783 aValue
.Name
= "IsExportNotes";
784 aValue
.Value
<<= pPage2_Notes
->IsChecked();
785 aProps
.push_back( aValue
);
788 if( pPage2_WebCast
->IsChecked() )
790 aValue
.Name
= "WebCastScriptLanguage";
791 if( pPage2_ASP
->IsChecked() )
792 aValue
.Value
<<= OUString( "asp" );
794 aValue
.Value
<<= OUString( "perl" );
795 aProps
.push_back( aValue
);
797 aValue
.Name
= "WebCastCGIURL";
798 aValue
.Value
<<= pPage2_CGI
->GetText();
799 aProps
.push_back( aValue
);
801 aValue
.Name
= "WebCastTargetURL";
802 aValue
.Value
<<= pPage2_URL
->GetText();
803 aProps
.push_back( aValue
);
805 aValue
.Name
= "IndexURL";
806 aValue
.Value
<<= pPage2_Index
->GetText();
807 aProps
.push_back( aValue
);
809 if( pPage2_Kiosk
->IsChecked() && pPage2_ChgAuto
->IsChecked() )
811 aValue
.Name
= "KioskSlideDuration";
812 aValue
.Value
<<= static_cast<sal_uInt32
>(pPage2_Duration
->GetTime().GetMSFromTime()) / 1000;
813 aProps
.push_back( aValue
);
815 aValue
.Name
= "KioskEndless";
816 aValue
.Value
<<= pPage2_Endless
->IsChecked();
817 aProps
.push_back( aValue
);
822 aValue
.Name
= "Width";
823 sal_Int32 nTmpWidth
= 640;
824 if( pPage3_Resolution_2
->IsChecked() )
826 else if( pPage3_Resolution_3
->IsChecked() )
829 aValue
.Value
<<= nTmpWidth
;
830 aProps
.push_back( aValue
);
832 aValue
.Name
= "Compression";
833 aValue
.Value
<<= pPage3_Quality
->GetText();
834 aProps
.push_back( aValue
);
836 aValue
.Name
= "Format";
838 if( pPage3_Png
->IsChecked() )
839 nFormat
= static_cast<sal_Int32
>(FORMAT_PNG
);
840 else if( pPage3_Gif
->IsChecked() )
841 nFormat
= static_cast<sal_Int32
>(FORMAT_GIF
);
843 nFormat
= static_cast<sal_Int32
>(FORMAT_JPG
);
844 aValue
.Value
<<= nFormat
;
845 aProps
.push_back( aValue
);
847 aValue
.Name
= "SlideSound";
848 aValue
.Value
<<= pPage3_SldSound
->IsChecked();
849 aProps
.push_back( aValue
);
851 aValue
.Name
= "HiddenSlides";
852 aValue
.Value
<<= pPage3_HiddenSlides
->IsChecked();
853 aProps
.push_back( aValue
);
856 aValue
.Name
= "Author";
857 aValue
.Value
<<= pPage4_Author
->GetText();
858 aProps
.push_back( aValue
);
860 aValue
.Name
= "EMail";
861 aValue
.Value
<<= pPage4_Email
->GetText();
862 aProps
.push_back( aValue
);
864 // try to guess protocol for user's homepage
865 INetURLObject
aHomeURL( pPage4_WWW
->GetText(),
866 INetProtocol::Http
, // default proto is HTTP
867 INetURLObject::EncodeMechanism::All
);
869 aValue
.Name
= "HomepageURL";
870 aValue
.Value
<<= aHomeURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
871 aProps
.push_back( aValue
);
873 aValue
.Name
= "UserText";
874 aValue
.Value
<<= pPage4_Misc
->GetText();
875 aProps
.push_back( aValue
);
879 aValue
.Name
= "EnableDownload";
880 aValue
.Value
<<= pPage4_Download
->IsChecked();
881 aProps
.push_back( aValue
);
885 if( !pPage5_TextOnly
->IsChecked() )
887 aValue
.Name
= "UseButtonSet";
888 aValue
.Value
<<= static_cast<sal_Int32
>(pPage5_Buttons
->GetSelectedItemId() - 1);
889 aProps
.push_back( aValue
);
893 if( pPage6_User
->IsChecked() )
895 aValue
.Name
= "BackColor";
896 aValue
.Value
<<= m_aBackColor
;
897 aProps
.push_back( aValue
);
899 aValue
.Name
= "TextColor";
900 aValue
.Value
<<= m_aTextColor
;
901 aProps
.push_back( aValue
);
903 aValue
.Name
= "LinkColor";
904 aValue
.Value
<<= m_aLinkColor
;
905 aProps
.push_back( aValue
);
907 aValue
.Name
= "VLinkColor";
908 aValue
.Value
<<= m_aVLinkColor
;
909 aProps
.push_back( aValue
);
911 aValue
.Name
= "ALinkColor";
912 aValue
.Value
<<= m_aALinkColor
;
913 aProps
.push_back( aValue
);
916 if( pPage6_DocColors
->IsChecked() )
918 aValue
.Name
= "IsUseDocumentColors";
919 aValue
.Value
<<= true;
920 aProps
.push_back( aValue
);
923 rParams
= comphelper::containerToSequence(aProps
);
926 // Clickhandler for the radiobuttons of the design-selection
927 IMPL_LINK( SdPublishingDlg
, DesignHdl
, Button
*, pButton
, void )
929 if(pButton
== pPage1_NewDesign
)
931 pPage1_NewDesign
->Check(); // because of DesignDeleteHdl
932 pPage1_OldDesign
->Check(false);
933 pPage1_Designs
->Disable();
934 pPage1_DelDesign
->Disable();
937 SdPublishingDesign aDefault
;
938 SetDesign(&aDefault
);
942 pPage1_NewDesign
->Check(false);
943 pPage1_Designs
->Enable();
944 pPage1_DelDesign
->Enable();
946 if(pPage1_Designs
->GetSelectedEntryCount() == 0)
947 pPage1_Designs
->SelectEntryPos(0);
949 const sal_Int32 nPos
= pPage1_Designs
->GetSelectedEntryPos();
950 m_pDesign
= &m_aDesignList
[nPos
];
951 DBG_ASSERT(m_pDesign
, "No Design? That's not allowed (CL)");
954 SetDesign(m_pDesign
);
958 // Clickhandler for the choice of one design
959 IMPL_LINK_NOARG(SdPublishingDlg
, DesignSelectHdl
, ListBox
&, void)
961 const sal_Int32 nPos
= pPage1_Designs
->GetSelectedEntryPos();
962 m_pDesign
= &m_aDesignList
[nPos
];
963 DBG_ASSERT(m_pDesign
, "No Design? That's not allowed (CL)");
966 SetDesign(m_pDesign
);
971 // Clickhandler for the delete of one design
972 IMPL_LINK_NOARG(SdPublishingDlg
, DesignDeleteHdl
, Button
*, void)
974 const sal_Int32 nPos
= pPage1_Designs
->GetSelectedEntryPos();
976 std::vector
<SdPublishingDesign
>::iterator iter
= m_aDesignList
.begin()+nPos
;
978 DBG_ASSERT(iter
!= m_aDesignList
.end(), "No Design? That's not allowed (CL)");
980 pPage1_Designs
->RemoveEntry(nPos
);
982 if(m_pDesign
== &(*iter
))
983 DesignHdl( pPage1_NewDesign
);
985 m_aDesignList
.erase(iter
);
987 m_bDesignListDirty
= true;
992 // Clickhandler for the other servertypes
993 IMPL_LINK( SdPublishingDlg
, WebServerHdl
, Button
*, pButton
, void )
995 bool bASP
= pButton
== pPage2_ASP
;
997 pPage2_ASP
->Check( bASP
);
998 pPage2_PERL
->Check( !bASP
);
1002 // Clickhandler for the Radiobuttons of the graphicformat choice
1003 IMPL_LINK( SdPublishingDlg
, GfxFormatHdl
, Button
*, pButton
, void )
1005 pPage3_Png
->Check( pButton
== pPage3_Png
);
1006 pPage3_Gif
->Check( pButton
== pPage3_Gif
);
1007 pPage3_Jpg
->Check( pButton
== pPage3_Jpg
);
1008 pPage3_Quality
->Enable(pButton
== pPage3_Jpg
);
1011 // Clickhandler for the Radiobuttons Standard/Frames
1012 IMPL_LINK_NOARG(SdPublishingDlg
, BaseHdl
, Button
*, void)
1017 // Clickhandler for the Checkbox of the Title page
1018 IMPL_LINK_NOARG(SdPublishingDlg
, ContentHdl
, Button
*, void)
1020 if(pPage2_Content
->IsChecked())
1022 if(!aAssistentFunc
.IsEnabled(4))
1024 aAssistentFunc
.EnablePage(4);
1030 if(aAssistentFunc
.IsEnabled(4))
1032 aAssistentFunc
.DisablePage(4);
1038 // Clickhandler for the Resolution Radiobuttons
1039 IMPL_LINK( SdPublishingDlg
, ResolutionHdl
, Button
*, pButton
, void )
1041 pPage3_Resolution_1
->Check(pButton
== pPage3_Resolution_1
);
1042 pPage3_Resolution_2
->Check(pButton
== pPage3_Resolution_2
);
1043 pPage3_Resolution_3
->Check(pButton
== pPage3_Resolution_3
);
1046 // Clickhandler for the ValueSet with the bitmap-buttons
1047 IMPL_LINK_NOARG(SdPublishingDlg
, ButtonsHdl
, ValueSet
*, void)
1049 // if one bitmap-button is chosen, then disable TextOnly
1050 pPage5_TextOnly
->Check(false);
1053 // Fill the SfxItemSet with the settings of the dialog
1054 IMPL_LINK( SdPublishingDlg
, ColorHdl
, Button
*, pButton
, void)
1058 if(pButton
== pPage6_Back
)
1060 aDlg
.SetColor( m_aBackColor
);
1061 if(aDlg
.Execute(GetFrameWeld()) == RET_OK
)
1062 m_aBackColor
= aDlg
.GetColor();
1064 else if(pButton
== pPage6_Text
)
1066 aDlg
.SetColor( m_aTextColor
);
1067 if(aDlg
.Execute(GetFrameWeld()) == RET_OK
)
1068 m_aTextColor
= aDlg
.GetColor();
1070 else if(pButton
== pPage6_Link
)
1072 aDlg
.SetColor( m_aLinkColor
);
1073 if(aDlg
.Execute(GetFrameWeld()) == RET_OK
)
1074 m_aLinkColor
= aDlg
.GetColor();
1076 else if(pButton
== pPage6_VLink
)
1078 aDlg
.SetColor( m_aVLinkColor
);
1079 if(aDlg
.Execute(GetFrameWeld()) == RET_OK
)
1080 m_aVLinkColor
= aDlg
.GetColor();
1082 else if(pButton
== pPage6_ALink
)
1084 aDlg
.SetColor( m_aALinkColor
);
1085 if(aDlg
.Execute(GetFrameWeld()) == RET_OK
)
1086 m_aALinkColor
= aDlg
.GetColor();
1089 pPage6_User
->Check();
1090 pPage6_Preview
->SetColors( m_aBackColor
, m_aTextColor
, m_aLinkColor
,
1091 m_aVLinkColor
, m_aALinkColor
);
1092 pPage6_Preview
->Invalidate();
1095 IMPL_LINK_NOARG(SdPublishingDlg
, SlideChgHdl
, Button
*, void)
1100 // Clickhandler for the Ok Button
1101 IMPL_LINK_NOARG(SdPublishingDlg
, FinishHdl
, Button
*, void)
1104 SdPublishingDesign aDesign
;
1105 GetDesign(&aDesign
);
1109 if(pPage1_OldDesign
->IsChecked() && m_pDesign
)
1111 // are there changes?
1112 if(!(aDesign
== *m_pDesign
))
1117 SdPublishingDesign aDefaultDesign
;
1118 if(!(aDefaultDesign
== aDesign
))
1126 aName
= m_pDesign
->m_aDesignName
;
1133 SdDesignNameDlg
aDlg(GetFrameWeld(), aName
);
1135 if (aDlg
.run() == RET_OK
)
1137 aDesign
.m_aDesignName
= aDlg
.GetDesignName();
1139 auto iter
= std::find_if(m_aDesignList
.begin(), m_aDesignList
.end(),
1140 [&aDesign
](const SdPublishingDesign
& rDesign
) { return rDesign
.m_aDesignName
== aDesign
.m_aDesignName
; });
1142 if (iter
!= m_aDesignList
.end())
1144 std::unique_ptr
<weld::MessageDialog
> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
1145 VclMessageType::Error
, VclButtonsType::YesNo
,
1146 SdResId(STR_PUBDLG_SAMENAME
)));
1147 bRetry
= xErrorBox
->run() == RET_NO
;
1150 m_aDesignList
.erase(iter
);
1155 m_aDesignList
.push_back(aDesign
);
1156 m_bDesignListDirty
= true;
1163 if(m_bDesignListDirty
)
1169 // Refresh the dialogs when changing from pages
1170 void SdPublishingDlg::ChangePage()
1172 int nPage
= aAssistentFunc
.GetCurrentPage();
1173 SetHelpId(aPageHelpIds
[nPage
-1]);
1177 if( pNextPageButton
->IsEnabled() )
1178 pNextPageButton
->GrabFocus();
1180 pFinishButton
->GrabFocus();
1183 void SdPublishingDlg::UpdatePage()
1185 pNextPageButton
->Enable(!aAssistentFunc
.IsLastPage());
1186 pLastPageButton
->Enable(!aAssistentFunc
.IsFirstPage());
1188 int nPage
= aAssistentFunc
.GetCurrentPage();
1193 if(pPage1_NewDesign
->IsChecked())
1195 pPage1_Designs
->Disable();
1196 pPage1_DelDesign
->Disable();
1199 if(m_aDesignList
.empty())
1200 pPage1_OldDesign
->Disable();
1203 pPage2_Frames_FB
->Show(pPage2_Frames
->IsChecked());
1204 pPage2_Standard_FB
->Show(pPage2_Standard
->IsChecked());
1205 pPage2_Kiosk_FB
->Show(pPage2_Kiosk
->IsChecked());
1206 pPage2_WebCast_FB
->Show(pPage2_WebCast
->IsChecked());
1208 if( pPage2_WebCast
->IsChecked() )
1210 pPage2Frame4
->Show();
1211 pPage2_Title_WebCast
->Show();
1213 pPage2_PERL
->Show();
1214 pPage2_URL_txt
->Show();
1216 pPage2_CGI_txt
->Show();
1218 pPage2_Index_txt
->Show();
1219 pPage2_Index
->Show();
1221 bool bPerl
= pPage2_PERL
->IsChecked();
1222 pPage2_Index
->Enable(bPerl
);
1223 pPage2_Index_txt
->Enable(bPerl
);
1224 pPage2_URL_txt
->Enable(bPerl
);
1225 pPage2_URL
->Enable(bPerl
);
1226 pPage2_CGI_txt
->Enable(bPerl
);
1227 pPage2_CGI
->Enable(bPerl
);
1231 pPage2Frame4
->Hide();
1232 pPage2_Title_WebCast
->Hide();
1234 pPage2_PERL
->Hide();
1235 pPage2_URL_txt
->Hide();
1237 pPage2_CGI_txt
->Hide();
1239 pPage2_Index
->Hide();
1240 pPage2_Index_txt
->Hide();
1243 if( pPage2_Kiosk
->IsChecked() )
1245 pPage2Frame3
->Show();
1246 pPage2_Title_Kiosk
->Show();
1247 pPage2_ChgDefault
->Show();
1248 pPage2_ChgAuto
->Show();
1249 pPage2_Duration_txt
->Show();
1250 pPage2_Duration
->Show();
1251 pPage2_Endless
->Show();
1252 bool bAuto
= pPage2_ChgAuto
->IsChecked();
1253 pPage2_Duration
->Enable(bAuto
);
1254 pPage2_Endless
->Enable(bAuto
);
1258 pPage2Frame3
->Hide();
1259 pPage2_Title_Kiosk
->Hide();
1260 pPage2_ChgDefault
->Hide();
1261 pPage2_ChgAuto
->Hide();
1262 pPage2_Duration
->Hide();
1263 pPage2_Duration_txt
->Hide();
1264 pPage2_Endless
->Hide();
1267 if( pPage2_Standard
->IsChecked() || pPage2_Frames
->IsChecked() )
1269 pPage2Frame2
->Show();
1270 pPage2_Title_Html
->Show();
1271 pPage2_Content
->Show();
1273 pPage2_Notes
->Show();
1277 pPage2Frame2
->Hide();
1278 pPage2_Title_Html
->Hide();
1279 pPage2_Content
->Hide();
1281 pPage2_Notes
->Hide();
1285 if( pPage2_Kiosk
->IsChecked() || pPage2_WebCast
->IsChecked() )
1286 pNextPageButton
->Disable();
1288 if( pPage2_WebCast
->IsChecked() )
1289 pPage3_SldSound
->Disable();
1291 pPage3_Quality
->Enable(pPage3_Jpg
->IsChecked());
1295 if( m_bButtonsDirty
)
1296 LoadPreviewButtons();
1301 /** loads the html buttons from the button sets, creates a preview and fills the
1304 void SdPublishingDlg::LoadPreviewButtons()
1309 const int nButtonCount
= 8;
1310 static const char *pButtonNames
[nButtonCount
] =
1322 std::vector
< OUString
> aButtonNames
;
1323 for(const char * p
: pButtonNames
)
1324 aButtonNames
.push_back( OUString::createFromAscii( p
) );
1326 int nSetCount
= mpButtonSet
->getCount();
1330 for( int nSet
= 0; nSet
< nSetCount
; ++nSet
)
1332 if( mpButtonSet
->getPreview( nSet
, aButtonNames
, aImage
) )
1334 pPage5_Buttons
->InsertItem( static_cast<sal_uInt16
>(nSet
)+1, aImage
);
1335 if( nHeight
< aImage
.GetSizePixel().Height() )
1336 nHeight
= aImage
.GetSizePixel().Height();
1340 pPage5_Buttons
->SetItemHeight( nHeight
);
1341 m_bButtonsDirty
= false;
1344 // Clickhandler for the Forward Button
1345 IMPL_LINK_NOARG(SdPublishingDlg
, NextPageHdl
, Button
*, void)
1347 aAssistentFunc
.NextPage();
1351 // Sets the Controls in the dialog to the settings in the design
1352 void SdPublishingDlg::SetDesign( SdPublishingDesign
const * pDesign
)
1357 pPage2_Standard
->Check(pDesign
->m_eMode
== PUBLISH_HTML
);
1358 pPage2_Frames
->Check(pDesign
->m_eMode
== PUBLISH_FRAMES
);
1359 pPage2_Kiosk
->Check(pDesign
->m_eMode
== PUBLISH_KIOSK
);
1360 pPage2_WebCast
->Check(pDesign
->m_eMode
== PUBLISH_WEBCAST
);
1362 pPage2_Content
->Check(pDesign
->m_bContentPage
);
1363 if(pDesign
->m_bContentPage
)
1364 aAssistentFunc
.EnablePage(4);
1366 aAssistentFunc
.DisablePage(4);
1369 pPage2_Notes
->Check(pDesign
->m_bNotes
);
1371 pPage2_ASP
->Check(pDesign
->m_eScript
== SCRIPT_ASP
);
1372 pPage2_PERL
->Check(pDesign
->m_eScript
== SCRIPT_PERL
);
1373 pPage2_CGI
->SetText(pDesign
->m_aCGI
);
1374 pPage2_URL
->SetText(pDesign
->m_aURL
);
1376 pPage2_ChgDefault
->Check( !pDesign
->m_bAutoSlide
);
1377 pPage2_ChgAuto
->Check( pDesign
->m_bAutoSlide
);
1379 tools::Time
aTime( tools::Time::EMPTY
);
1380 aTime
.MakeTimeFromMS( pDesign
->m_nSlideDuration
* 1000 );
1381 pPage2_Duration
->SetTime( aTime
);
1383 pPage2_Endless
->Check( pDesign
->m_bEndless
);
1385 pPage3_Png
->Check(pDesign
->m_eFormat
== FORMAT_PNG
);
1386 pPage3_Gif
->Check(pDesign
->m_eFormat
== FORMAT_GIF
);
1387 pPage3_Jpg
->Check(pDesign
->m_eFormat
== FORMAT_JPG
);
1388 pPage3_Quality
->Enable(pDesign
->m_eFormat
== FORMAT_JPG
);
1390 pPage3_Quality
->SetText(pDesign
->m_aCompression
);
1391 pPage3_Resolution_1
->Check(pDesign
->m_nResolution
== PUB_LOWRES_WIDTH
);
1392 pPage3_Resolution_2
->Check(pDesign
->m_nResolution
== PUB_MEDRES_WIDTH
);
1393 pPage3_Resolution_3
->Check(pDesign
->m_nResolution
== PUB_HIGHRES_WIDTH
);
1395 pPage3_SldSound
->Check( pDesign
->m_bSlideSound
);
1396 pPage3_HiddenSlides
->Check( pDesign
->m_bHiddenSlides
);
1398 pPage4_Author
->SetText(pDesign
->m_aAuthor
);
1399 pPage4_Email
->SetText(pDesign
->m_aEMail
);
1400 pPage4_WWW
->SetText(pDesign
->m_aWWW
);
1401 pPage4_Misc
->SetText(pDesign
->m_aMisc
);
1403 pPage4_Download
->Check(pDesign
->m_bDownload
);
1405 pPage5_TextOnly
->Check(pDesign
->m_nButtonThema
== -1);
1406 if(pDesign
->m_nButtonThema
!= -1)
1409 LoadPreviewButtons();
1410 pPage5_Buttons
->SelectItem(pDesign
->m_nButtonThema
+ 1);
1413 pPage5_Buttons
->SetNoSelection();
1415 pPage6_User
->Check(pDesign
->m_bUserAttr
);
1416 m_aBackColor
= pDesign
->m_aBackColor
;
1417 m_aTextColor
= pDesign
->m_aTextColor
;
1418 m_aLinkColor
= pDesign
->m_aLinkColor
;
1419 m_aVLinkColor
= pDesign
->m_aVLinkColor
;
1420 m_aALinkColor
= pDesign
->m_aALinkColor
;
1422 pPage6_DocColors
->Check(pDesign
->m_bUseColor
);
1424 pPage6_Preview
->SetColors( m_aBackColor
, m_aTextColor
, m_aLinkColor
,
1425 m_aVLinkColor
, m_aALinkColor
);
1426 pPage6_Preview
->Invalidate();
1431 // Transfer the status of the Design Dialog Controls
1432 void SdPublishingDlg::GetDesign( SdPublishingDesign
* pDesign
)
1437 pDesign
->m_eMode
= pPage2_Standard
->IsChecked()?PUBLISH_HTML
:
1438 pPage2_Frames
->IsChecked()?PUBLISH_FRAMES
:
1439 pPage2_Kiosk
->IsChecked()?PUBLISH_KIOSK
:
1442 pDesign
->m_bContentPage
= pPage2_Content
->IsChecked();
1444 pDesign
->m_bNotes
= pPage2_Notes
->IsChecked();
1446 if( pPage3_Gif
->IsChecked() )
1447 pDesign
->m_eFormat
= FORMAT_GIF
;
1448 else if( pPage3_Jpg
->IsChecked() )
1449 pDesign
->m_eFormat
= FORMAT_JPG
;
1451 pDesign
->m_eFormat
= FORMAT_PNG
;
1453 pDesign
->m_aCompression
= pPage3_Quality
->GetText();
1455 pDesign
->m_nResolution
= pPage3_Resolution_1
->IsChecked()?PUB_LOWRES_WIDTH
:
1456 (pPage3_Resolution_2
->IsChecked()?PUB_MEDRES_WIDTH
:PUB_HIGHRES_WIDTH
);
1458 pDesign
->m_bSlideSound
= pPage3_SldSound
->IsChecked();
1459 pDesign
->m_bHiddenSlides
= pPage3_HiddenSlides
->IsChecked();
1461 pDesign
->m_aAuthor
= pPage4_Author
->GetText();
1462 pDesign
->m_aEMail
= pPage4_Email
->GetText();
1463 pDesign
->m_aWWW
= pPage4_WWW
->GetText();
1464 pDesign
->m_aMisc
= pPage4_Misc
->GetText();
1465 pDesign
->m_bDownload
= m_bImpress
&& pPage4_Download
->IsChecked();
1467 if(pPage5_TextOnly
->IsChecked())
1468 pDesign
->m_nButtonThema
= -1;
1470 pDesign
->m_nButtonThema
= pPage5_Buttons
->GetSelectedItemId() - 1;
1472 pDesign
->m_bUserAttr
= pPage6_User
->IsChecked();
1473 pDesign
->m_aBackColor
= m_aBackColor
;
1474 pDesign
->m_aTextColor
= m_aTextColor
;
1475 pDesign
->m_aLinkColor
= m_aLinkColor
;
1476 pDesign
->m_aVLinkColor
= m_aVLinkColor
;
1477 pDesign
->m_aALinkColor
= m_aALinkColor
;
1478 pDesign
->m_bUseColor
= pPage6_DocColors
->IsChecked();
1480 pDesign
->m_eScript
= pPage2_ASP
->IsChecked()?SCRIPT_ASP
:SCRIPT_PERL
;
1481 pDesign
->m_aCGI
= pPage2_CGI
->GetText();
1482 pDesign
->m_aURL
= pPage2_URL
->GetText();
1484 pDesign
->m_bAutoSlide
= pPage2_ChgAuto
->IsChecked();
1485 pDesign
->m_nSlideDuration
= static_cast<sal_uInt32
>(pPage2_Duration
->GetTime().GetMSFromTime()) / 1000;
1486 pDesign
->m_bEndless
= pPage2_Endless
->IsChecked();
1489 // Clickhandler for the back Button
1490 IMPL_LINK_NOARG(SdPublishingDlg
, LastPageHdl
, Button
*, void)
1492 aAssistentFunc
.PreviousPage();
1497 void SdPublishingDlg::Load()
1499 m_bDesignListDirty
= false;
1501 INetURLObject
aURL( SvtPathOptions().GetUserConfigPath() );
1502 aURL
.Append( "designs.sod" );
1504 // check if file exists, SfxMedium shows an errorbox else
1506 std::unique_ptr
<SvStream
> pIStm
= ::utl::UcbStreamHelper::CreateStream( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), StreamMode::READ
);
1508 bool bOk
= pIStm
&& ( pIStm
->GetError() == ERRCODE_NONE
);
1514 SfxMedium
aMedium( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), StreamMode::READ
| StreamMode::NOCREATE
);
1516 SvStream
* pStream
= aMedium
.GetInStream();
1522 pStream
->ReadUInt16( aCheck
);
1524 if(aCheck
!= nMagic
)
1527 SdIOCompat
aIO(*pStream
, StreamMode::READ
);
1529 sal_uInt16 nDesigns
;
1530 pStream
->ReadUInt16( nDesigns
);
1532 for( sal_uInt16 nIndex
= 0;
1533 pStream
->GetError() == ERRCODE_NONE
&& nIndex
< nDesigns
;
1536 SdPublishingDesign aDesign
;
1537 *pStream
>> aDesign
;
1539 m_aDesignList
.push_back(aDesign
);
1544 bool SdPublishingDlg::Save()
1546 INetURLObject
aURL( SvtPathOptions().GetUserConfigPath() );
1547 aURL
.Append( "designs.sod" );
1548 SfxMedium
aMedium( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), StreamMode::WRITE
| StreamMode::TRUNC
);
1550 SvStream
* pStream
= aMedium
.GetOutStream();
1555 pStream
->WriteUInt16( nMagic
);
1557 // Destroys the SdIOCompat before the Stream is being distributed
1559 SdIOCompat
aIO(*pStream
, StreamMode::WRITE
, 0);
1561 sal_uInt16 nDesigns
= static_cast<sal_uInt16
>(m_aDesignList
.size());
1562 pStream
->WriteUInt16( nDesigns
);
1564 for( sal_uInt16 nIndex
= 0;
1565 pStream
->GetError() == ERRCODE_NONE
&& nIndex
< nDesigns
;
1567 WriteSdPublishingDesign( *pStream
, m_aDesignList
[nIndex
] );
1573 return( aMedium
.GetError() == ERRCODE_NONE
);
1576 std::vector
<OString
> SdPublishingDlg::getAllPageUIXMLDescriptions() const
1578 // this dialog has a hard number of pages
1579 std::vector
<OString
> aRetval
;
1581 for (sal_uInt32
a(0); a
< 6; a
++)
1583 aRetval
.push_back(OString::number(a
));
1589 bool SdPublishingDlg::selectPageByUIXMLDescription(const OString
& rUIXMLDescription
)
1591 // rUIXMLDescription contains one of the values above, make use of it
1592 const sal_uInt32
nPage(rUIXMLDescription
.toUInt32());
1596 aAssistentFunc
.GotoPage(nPage
+ 1);
1603 // SdDesignNameDlg Methods
1604 SdDesignNameDlg::SdDesignNameDlg(weld::Window
* pWindow
, const OUString
& rName
)
1605 : GenericDialogController(pWindow
, "modules/sdraw/ui/namedesign.ui", "NameDesignDialog")
1606 , m_xEdit(m_xBuilder
->weld_entry("entry"))
1607 , m_xBtnOK(m_xBuilder
->weld_button("ok"))
1609 m_xEdit
->connect_changed(LINK(this, SdDesignNameDlg
, ModifyHdl
));
1610 m_xEdit
->set_text(rName
);
1611 m_xBtnOK
->set_sensitive(!rName
.isEmpty());
1614 OUString
SdDesignNameDlg::GetDesignName()
1616 return m_xEdit
->get_text();
1619 IMPL_LINK_NOARG(SdDesignNameDlg
, ModifyHdl
, weld::Entry
&, void)
1621 m_xBtnOK
->set_sensitive(!m_xEdit
->get_text().isEmpty());
1624 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */