LibreOffice Module sd (master) 1
htmlex.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "htmlex.hxx"
21#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
22#include <com/sun/star/drawing/GraphicExportFilter.hpp>
23#include <com/sun/star/frame/XModel.hpp>
24#include <com/sun/star/ucb/SimpleFileAccess.hpp>
25
26#include <sal/log.hxx>
27#include <rtl/tencinfo.h>
31#include <o3tl/safeint.hxx>
32#include <osl/file.hxx>
35#include <com/sun/star/frame/XStorable.hpp>
36#include <sfx2/frmhtmlw.hxx>
37#include <sfx2/progress.hxx>
38#include <utility>
39#include <vcl/svapp.hxx>
40#include <vcl/weld.hxx>
41#include <svx/svditer.hxx>
42#include <vcl/imaprect.hxx>
43#include <vcl/imapcirc.hxx>
44#include <vcl/imappoly.hxx>
45#include <editeng/eeitem.hxx>
46#include <editeng/outlobj.hxx>
47#include <editeng/editobj.hxx>
48#include <svx/svdopath.hxx>
49#include <svtools/htmlout.hxx>
50#include <svtools/colorcfg.hxx>
51#include <editeng/colritem.hxx>
52#include <editeng/editeng.hxx>
53#include <editeng/wghtitem.hxx>
54#include <editeng/udlnitem.hxx>
55#include <editeng/postitem.hxx>
57#include <editeng/flditem.hxx>
58#include <svl/style.hxx>
60#include <svx/svdoutl.hxx>
61#include <svx/svdogrp.hxx>
62#include <svx/svdotable.hxx>
63#include <svx/ImageMapInfo.hxx>
64#include <tools/urlobj.hxx>
65#include <svtools/sfxecode.hxx>
67#include <tools/debug.hxx>
69
70#include <drawdoc.hxx>
71#include <DrawDocShell.hxx>
72#include "htmlpublishmode.hxx"
73#include <Outliner.hxx>
74#include <sdpage.hxx>
75#include <strings.hrc>
76#include <strings.hxx>
77#include <anminfo.hxx>
78#include <sdresid.hxx>
79#include "buttonset.hxx"
80
81using namespace ::com::sun::star;
82using namespace ::com::sun::star::uno;
83using namespace ::com::sun::star::beans;
84using namespace ::com::sun::star::frame;
85using namespace ::com::sun::star::lang;
86using namespace ::com::sun::star::document;
87
88using namespace sdr::table;
89
90// get parameter from Itemset
91#define RESTOHTML( res ) StringToHTMLString(SdResId(res))
92
93const char * const pButtonNames[] =
94{
95 "first-inactive.png",
96 "first.png",
97 "left-inactive.png",
98 "left.png",
99 "right-inactive.png",
100 "right.png",
101 "last-inactive.png",
102 "last.png",
103 "home.png",
104 "text.png",
105 "expand.png",
106 "collapse.png",
107};
108
109#define BTN_FIRST_0 0
110#define BTN_FIRST_1 1
111#define BTN_PREV_0 2
112#define BTN_PREV_1 3
113#define BTN_NEXT_0 4
114#define BTN_NEXT_1 5
115#define BTN_LAST_0 6
116#define BTN_LAST_1 7
117#define BTN_INDEX 8
118#define BTN_TEXT 9
119#define BTN_MORE 10
120#define BTN_LESS 11
121
122namespace {
123
124// Helper class for the simple creation of files local/remote
125class EasyFile
126{
127private:
128 std::unique_ptr<SvStream> pOStm;
129 bool bOpen;
130
131public:
132
133 EasyFile();
134 ~EasyFile();
135
136 ErrCode createStream( const OUString& rUrl, SvStream*& rpStr );
137 void createFileName( const OUString& rUrl, OUString& rFileName );
138 void close();
139};
140
141}
142
143// Helper class for the embedding of text attributes into the html output
145{
146private:
152 bool mbLink;
155 OUString maLink;
156 OUString maTarget;
157
158public:
159 explicit HtmlState( Color aDefColor );
160
161 OUString SetWeight( bool bWeight );
162 OUString SetItalic( bool bItalic );
163 OUString SetUnderline( bool bUnderline );
164 OUString SetColor( Color aColor );
165 OUString SetStrikeout( bool bStrike );
166 OUString SetLink( const OUString& aLink, const OUString& aTarget );
167 OUString Flush();
168};
169
170// close all still open tags
172{
173 OUString aStr = SetWeight(false)
174 + SetItalic(false)
175 + SetUnderline(false)
176 + SetStrikeout(false)
178 + SetLink("","");
179
180 return aStr;
181}
182
183// c'tor with default color for the page
185 : mbColor(false),
186 mbWeight(false),
187 mbItalic(false),
188 mbUnderline(false),
189 mbStrike(false),
190 mbLink(false),
191 maDefColor(aDefColor)
192{
193}
194
195// enables/disables bold print
196OUString HtmlState::SetWeight( bool bWeight )
197{
198 OUString aStr;
199
200 if(bWeight && !mbWeight)
201 aStr = "<b>";
202 else if(!bWeight && mbWeight)
203 aStr = "</b>";
204
205 mbWeight = bWeight;
206 return aStr;
207}
208
209// enables/disables italic
210
211OUString HtmlState::SetItalic( bool bItalic )
212{
213 OUString aStr;
214
215 if(bItalic && !mbItalic)
216 aStr = "<i>";
217 else if(!bItalic && mbItalic)
218 aStr = "</i>";
219
220 mbItalic = bItalic;
221 return aStr;
222}
223
224// enables/disables underlines
225
226OUString HtmlState::SetUnderline( bool bUnderline )
227{
228 OUString aStr;
229
230 if(bUnderline && !mbUnderline)
231 aStr = "<u>";
232 else if(!bUnderline && mbUnderline)
233 aStr = "</u>";
234
235 mbUnderline = bUnderline;
236 return aStr;
237}
238
239// enables/disables strike through
240OUString HtmlState::SetStrikeout( bool bStrike )
241{
242 OUString aStr;
243
244 if(bStrike && !mbStrike)
245 aStr = "<strike>";
246 else if(!bStrike && mbStrike)
247 aStr = "</strike>";
248
249 mbStrike = bStrike;
250 return aStr;
251}
252
253// Sets the specified text color
254OUString HtmlState::SetColor( Color aColor )
255{
256 OUString aStr;
257
258 if(mbColor && aColor == maColor)
259 return aStr;
260
261 if(mbColor)
262 {
263 aStr = "</font>";
264 mbColor = false;
265 }
266
267 if(aColor != maDefColor)
268 {
269 maColor = aColor;
270 aStr += "<font color=\"" + HtmlExport::ColorToHTMLString(aColor) + "\">";
271 mbColor = true;
272 }
273
274 return aStr;
275}
276
277// enables/disables a hyperlink
278OUString HtmlState::SetLink( const OUString& aLink, const OUString& aTarget )
279{
280 OUString aStr;
281
282 if(mbLink&&maLink == aLink&&maTarget==aTarget)
283 return aStr;
284
285 if(mbLink)
286 {
287 aStr = "</a>";
288 mbLink = false;
289 }
290
291 if (!aLink.isEmpty())
292 {
293 aStr += "<a href=\"" + comphelper::string::encodeForXml(aLink);
294 if (!aTarget.isEmpty())
295 {
296 aStr += "\" target=\"" + comphelper::string::encodeForXml(aTarget);
297 }
298 aStr += "\">";
299 mbLink = true;
300 maLink = aLink;
301 maTarget = aTarget;
302 }
303
304 return aStr;
305}
306namespace
307{
308
309OUString getParagraphStyle( const SdrOutliner* pOutliner, sal_Int32 nPara )
310{
311 SfxItemSet aParaSet( pOutliner->GetParaAttribs( nPara ) );
312
313 OUString sStyle;
314
315 if( aParaSet.GetItem<SvxFrameDirectionItem>( EE_PARA_WRITINGDIR )->GetValue() == SvxFrameDirection::Horizontal_RL_TB )
316 {
317
318 sStyle = "direction: rtl;";
319 }
320 else
321 {
322 // This is the default so don't write it out
323 // sStyle += "direction: ltr;";
324 }
325 return sStyle;
326}
327
328void lclAppendStyle(OUStringBuffer& aBuffer, std::u16string_view aTag, std::u16string_view aStyle)
329{
330 if (aStyle.empty())
331 aBuffer.append(OUString::Concat("<") + aTag + ">");
332 else
333 aBuffer.append(OUString::Concat("<") + aTag + " style=\"" + aStyle + "\">");
334}
335
336} // anonymous namespace
337
338constexpr OUStringLiteral gaHTMLHeader(
339 u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"
340 " \"http://www.w3.org/TR/html4/transitional.dtd\">\r\n"
341 "<html>\r\n<head>\r\n" );
342
343constexpr OUStringLiteral gaHTMLExtension = u"" STR_HTMLEXP_DEFAULT_EXTENSION;
344
345// constructor for the html export helper classes
347 OUString aPath,
348 const Sequence< PropertyValue >& rParams,
349 SdDrawDocument* pExpDoc,
350 sd::DrawDocShell* pDocShell )
351 : maPath(std::move( aPath )),
352 mpDoc(pExpDoc),
353 mpDocSh( pDocShell ),
355 mbContentsPage(false),
356 mnButtonThema(-1),
357 mnWidthPixel( PUB_MEDRES_WIDTH ),
358 meFormat( FORMAT_JPG ),
359 mbNotes(false),
360 mnCompression( -1 ),
361 mbDownload( false ),
362 mbSlideSound(true),
363 mbHiddenSlides(true),
364 mbUserAttr(false),
365 maTextColor(COL_BLACK),
366 maBackColor(COL_WHITE),
367 mbDocColors(false),
368 maIndexUrl("index"),
369 meScript( SCRIPT_ASP ),
370 mpButtonSet( new ButtonSet() )
371{
372 bool bChange = mpDoc->IsChanged();
373
375
376 InitExportParameters( rParams );
377
378 switch( meMode )
379 {
380 case PUBLISH_HTML:
381 case PUBLISH_FRAMES:
382 ExportHtml();
383 break;
384 case PUBLISH_WEBCAST:
386 break;
387 case PUBLISH_KIOSK:
388 ExportKiosk();
389 break;
392 break;
393 }
394
395 mpDoc->SetChanged(bChange);
396}
397
399{
400}
401
402// get common export parameters from item set
403void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams )
404{
406
407 OUString aStr;
408 for( const PropertyValue& rParam : rParams )
409 {
410 if ( rParam.Name == "PublishMode" )
411 {
412 sal_Int32 temp = 0;
413 rParam.Value >>= temp;
414 meMode = static_cast<HtmlPublishMode>(temp);
415 }
416 else if ( rParam.Name == "IndexURL" )
417 {
418 rParam.Value >>= aStr;
420 }
421 else if ( rParam.Name == "Format" )
422 {
423 sal_Int32 temp = 0;
424 rParam.Value >>= temp;
425 meFormat = static_cast<PublishingFormat>(temp);
426 }
427 else if ( rParam.Name == "Compression" )
428 {
429 rParam.Value >>= aStr;
430 OUString aTmp( aStr );
431 if(!aTmp.isEmpty())
432 {
433 aTmp = aTmp.replaceFirst("%", "");
434 mnCompression = static_cast<sal_Int16>(aTmp.toInt32());
435 }
436 }
437 else if ( rParam.Name == "Width" )
438 {
439 sal_Int32 temp = 0;
440 rParam.Value >>= temp;
441 mnWidthPixel = static_cast<sal_uInt16>(temp);
442 }
443 else if ( rParam.Name == "UseButtonSet" )
444 {
445 sal_Int32 temp = 0;
446 rParam.Value >>= temp;
447 mnButtonThema = static_cast<sal_Int16>(temp);
448 }
449 else if ( rParam.Name == "IsExportNotes" )
450 {
451 if( mbImpress )
452 {
453 bool temp = false;
454 rParam.Value >>= temp;
455 mbNotes = temp;
456 }
457 }
458 else if ( rParam.Name == "IsExportContentsPage" )
459 {
460 bool temp = false;
461 rParam.Value >>= temp;
462 mbContentsPage = temp;
463 }
464 else if ( rParam.Name == "Author" )
465 {
466 rParam.Value >>= aStr;
467 maAuthor = aStr;
468 }
469 else if ( rParam.Name == "EMail" )
470 {
471 rParam.Value >>= aStr;
472 maEMail = aStr;
473 }
474 else if ( rParam.Name == "HomepageURL" )
475 {
476 rParam.Value >>= aStr;
478 }
479 else if ( rParam.Name == "UserText" )
480 {
481 rParam.Value >>= aStr;
482 maInfo = aStr;
483 }
484 else if ( rParam.Name == "EnableDownload" )
485 {
486 bool temp = false;
487 rParam.Value >>= temp;
488 mbDownload = temp;
489 }
490 else if ( rParam.Name == "SlideSound" )
491 {
492 bool temp = true;
493 rParam.Value >>= temp;
494 mbSlideSound = temp;
495 }
496 else if ( rParam.Name == "HiddenSlides" )
497 {
498 bool temp = true;
499 rParam.Value >>= temp;
500 mbHiddenSlides = temp;
501 }
502 else if ( rParam.Name == "BackColor" )
503 {
504 Color temp;
505 rParam.Value >>= temp;
506 maBackColor = temp;
507 mbUserAttr = true;
508 }
509 else if ( rParam.Name == "TextColor" )
510 {
511 Color temp;
512 rParam.Value >>= temp;
513 maTextColor = temp;
514 mbUserAttr = true;
515 }
516 else if ( rParam.Name == "LinkColor" )
517 {
518 Color temp ;
519 rParam.Value >>= temp;
520 maLinkColor = temp;
521 mbUserAttr = true;
522 }
523 else if ( rParam.Name == "VLinkColor" )
524 {
525 Color temp;
526 rParam.Value >>= temp;
527 maVLinkColor = temp;
528 mbUserAttr = true;
529 }
530 else if ( rParam.Name == "ALinkColor" )
531 {
532 Color temp;
533 rParam.Value >>= temp;
534 maALinkColor = temp;
535 mbUserAttr = true;
536 }
537 else if ( rParam.Name == "IsUseDocumentColors" )
538 {
539 bool temp = false;
540 rParam.Value >>= temp;
541 mbDocColors = temp;
542 }
543 else if ( rParam.Name == "KioskSlideDuration" )
544 {
545 double temp = 0.0;
546 rParam.Value >>= temp;
547 mfSlideDuration = temp;
548 mbAutoSlide = true;
549 }
550 else if ( rParam.Name == "KioskEndless" )
551 {
552 bool temp = false;
553 rParam.Value >>= temp;
554 mbEndless = temp;
555 }
556 else if ( rParam.Name == "WebCastCGIURL" )
557 {
558 rParam.Value >>= aStr;
559 maCGIPath = aStr;
560 }
561 else if ( rParam.Name == "WebCastTargetURL" )
562 {
563 rParam.Value >>= aStr;
564 maURLPath = aStr;
565 }
566 else if ( rParam.Name == "WebCastScriptLanguage" )
567 {
568 rParam.Value >>= aStr;
569 if ( aStr == "asp" )
570 {
572 }
573 else
574 {
576 }
577 }
578 else
579 {
580 OSL_FAIL("Unknown property for html export detected!");
581 }
582 }
583
584 if( meMode == PUBLISH_KIOSK )
585 {
586 mbContentsPage = false;
587 mbNotes = false;
588
589 }
590
591 // calculate image sizes
593 Size aTmpSize( pPage->GetSize() );
594 double dRatio=static_cast<double>(aTmpSize.Width())/aTmpSize.Height();
595
596 mnHeightPixel = static_cast<sal_uInt16>(mnWidthPixel/dRatio);
597
598 // we come up with a destination...
599
600 INetURLObject aINetURLObj( maPath );
601 DBG_ASSERT( aINetURLObj.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
602
603 maExportPath = aINetURLObj.GetPartBeforeLastName(); // with trailing '/'
604 maIndex = aINetURLObj.GetLastName();
605
607 for( sal_uInt16 nPage = 0; nPage < mnSdPageCount; nPage++ )
608 {
609 pPage = mpDoc->GetSdPage( nPage, PageKind::Standard );
610
611 if( mbHiddenSlides || !pPage->IsExcluded() )
612 {
613 maPages.push_back( pPage );
614 maNotesPages.push_back( mpDoc->GetSdPage( nPage, PageKind::Notes ) );
615 }
616 }
617 mnSdPageCount = maPages.size();
618
620
622}
623
625{
626 SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
627
629
630 mnPagesWritten = 0;
632
633 OUStringBuffer aStr(gaHTMLHeader
635 + "\r\n"
636 "</head>\r\n"
637 + CreateBodyTag());
638
639 for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; ++nSdPage)
640 {
641 SdPage* pPage = maPages[nSdPage];
642 maPageNames[nSdPage] = pPage->GetName();
643
644 if( mbDocColors )
645 {
646 SetDocColors( pPage );
647 }
648
649 // page title
650 OUString sTitleText(CreateTextForTitle(pOutliner, pPage, pPage->GetPageBackgroundColor()));
651 OUString sStyle;
652
653 if (nSdPage != 0) // First page - no need for a page break here
654 sStyle += "page-break-before:always; ";
655 sStyle += getParagraphStyle(pOutliner, 0);
656
657 lclAppendStyle(aStr, u"h1", sStyle);
658
659 aStr.append(sTitleText + "</h1>\r\n");
660
661 // write outline text
662 aStr.append(CreateTextForPage( pOutliner, pPage, true, pPage->GetPageBackgroundColor() ));
663
664 // notes
665 if(mbNotes)
666 {
667 SdPage* pNotesPage = maNotesPages[ nSdPage ];
668 OUString aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, maBackColor) );
669
670 if (!aNotesStr.isEmpty())
671 {
672 aStr.append("<br>\r\n<h3>"
673 + RESTOHTML(STR_HTMLEXP_NOTES)
674 + ":</h3>\r\n"
675 + aNotesStr);
676 }
677 }
678
679 if (mpProgress)
680 mpProgress->SetState(++mnPagesWritten);
681
682 }
683
684 // close page
685 aStr.append("</body>\r\n</html>");
686
688
689 pOutliner->Clear();
691}
692
693// exports the (in the c'tor specified impress document) to html
695{
696 if(mbUserAttr)
697 {
698 if( maTextColor == COL_AUTO )
699 {
700 if( !maBackColor.IsDark() )
702 }
703 }
704 else if( mbDocColors )
705 {
706 // default colors for the color schema 'From Document'
707 SetDocColors();
709 }
710
711 // get name for downloadable presentation if needed
712 if( mbDownload )
713 {
714 // fade out separator search and extension
715 sal_Int32 nSepPos = maDocFileName.indexOf('.');
716 if (nSepPos != -1)
717 maDocFileName = maDocFileName.copy(0, nSepPos);
718
719 maDocFileName += ".odp";
720 }
721
722 sal_uInt16 nProgrCount = mnSdPageCount;
723 nProgrCount += mbImpress?mnSdPageCount:0;
724 nProgrCount += mbContentsPage?1:0;
725 nProgrCount += (mbFrames && mbNotes)?mnSdPageCount:0;
726 nProgrCount += mbFrames ? 8 : 0;
727 InitProgress( nProgrCount );
728
729 mpDocSh->SetWaitCursor( true );
730
731 // Exceptions are cool...
732
734
735 // this is not a true while
736 while( true )
737 {
739 break;
740
742 break;
743
744 if( mbContentsPage &&
745 !CreateImagesForPresPages( true ) )
746 break;
747
749 break;
750
751 if( mbImpress )
753 break;
754
755 if( mbFrames )
756 {
757 if( !CreateFrames() )
758 break;
759
760 if( !CreateOutlinePages() )
761 break;
762
763 if( !CreateNavBarFrames() )
764 break;
765
766 if( mbNotes && mbImpress )
767 if( !CreateNotesPages() )
768 break;
769
770 }
771
772 if( mbContentsPage )
773 if( !CreateContentPage() )
774 break;
775
777
778 mpDocSh->SetWaitCursor( false );
780
781 if( mbDownload )
783
784 return;
785 }
786
787 // if we get to this point the export was
788 // canceled by the user after an error
789 mpDocSh->SetWaitCursor( false );
791}
792
794{
795 if( pPage == nullptr )
797
798 svtools::ColorConfig aConfig;
803
804 SfxStyleSheet* pSheet = nullptr;
805
807 {
808 // default text color from the outline template of the first page
810 if(pSheet == nullptr)
812 if(pSheet == nullptr)
814 }
815
816 if(pSheet == nullptr)
817 pSheet = mpDoc->GetDefaultStyleSheet();
818
819 if(pSheet)
820 {
821 SfxItemSet& rSet = pSheet->GetItemSet();
822 if(rSet.GetItemState(EE_CHAR_COLOR) == SfxItemState::SET)
824 }
825
826 // default background from the background of the master page of the first page
828
829 if( maTextColor == COL_AUTO )
830 {
831 if( !maBackColor.IsDark() )
833 }
834}
835
836void HtmlExport::InitProgress( sal_uInt16 nProgrCount )
837{
838 mpProgress.reset(new SfxProgress( mpDocSh, SdResId(STR_CREATE_PAGES), nProgrCount ));
839}
840
842{
843 mpProgress.reset();
844}
845
847{
848 mnPagesWritten = 0;
850
852 if( !checkForExistingFiles() )
853 {
856 }
857
859}
860
861// Export Document with WebCast (TM) Technology
863{
864 mnPagesWritten = 0;
866
867 mpDocSh->SetWaitCursor( true );
868
870
871 if (maCGIPath.isEmpty())
872 maCGIPath = ".";
873
874 if (!maCGIPath.endsWith("/"))
875 maCGIPath += "/";
876
877 if( meScript == SCRIPT_ASP )
878 {
879 maURLPath = "./";
880 }
881 else
882 {
883 if (maURLPath.isEmpty())
884 maURLPath = ".";
885
886 if (!maURLPath.endsWith("/"))
887 maURLPath += "/";
888 }
889
890 // this is not a true while
891 while(true)
892 {
894 break;
895
897 break;
898
899 if( meScript == SCRIPT_ASP )
900 {
901 if(!CreateASPScripts())
902 break;
903 }
904 else
905 {
906 if(!CreatePERLScripts())
907 break;
908 }
909
911 break;
912
914 break;
915
916 break;
917 }
918
919 mpDocSh->SetWaitCursor( false );
921}
922
923// Save the presentation as a downloadable file in the dest directory
925{
926 meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, maDocFileName );
927
928 OUString aURL(maExportPath + maDocFileName);
929
931
932 try
933 {
934 uno::Reference< frame::XStorable > xStorable( mpDoc->getUnoModel(), uno::UNO_QUERY );
935 if( xStorable.is() )
936 {
937 uno::Sequence< beans::PropertyValue > aProperties{
938 comphelper::makePropertyValue("Overwrite", true),
939 comphelper::makePropertyValue("FilterName", OUString("impress8"))
940 };
941 xStorable->storeToURL( aURL, aProperties );
942
943 mpDocSh->EnableSetModified( false );
944
945 return true;
946 }
947 }
948 catch( Exception& )
949 {
950 }
951
952 mpDocSh->EnableSetModified( false );
953
954 return false;
955}
956
957// create image files
959{
960 try
961 {
962 Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
963
964 Reference< drawing::XGraphicExportFilter > xGraphicExporter = drawing::GraphicExportFilter::create( xContext );
965
966 Sequence< PropertyValue > aFilterData(((meFormat==FORMAT_JPG)&&(mnCompression != -1))? 3 : 2);
967 auto pFilterData = aFilterData.getArray();
968 pFilterData[0].Name = "PixelWidth";
969 pFilterData[0].Value <<= static_cast<sal_Int32>(bThumbnail ? PUB_THUMBNAIL_WIDTH : mnWidthPixel );
970 pFilterData[1].Name = "PixelHeight";
971 pFilterData[1].Value <<= static_cast<sal_Int32>(bThumbnail ? PUB_THUMBNAIL_HEIGHT : mnHeightPixel);
972 if((meFormat==FORMAT_JPG)&&(mnCompression != -1))
973 {
974 pFilterData[2].Name = "Quality";
975 pFilterData[2].Value <<= static_cast<sal_Int32>(mnCompression);
976 }
977
978 OUString sFormat;
979 if( meFormat == FORMAT_PNG )
980 sFormat = "PNG";
981 else if( meFormat == FORMAT_GIF )
982 sFormat = "GIF";
983 else
984 sFormat = "JPG";
985
986 Sequence< PropertyValue > aDescriptor{
988 comphelper::makePropertyValue("FilterName", sFormat),
989 comphelper::makePropertyValue("FilterData", aFilterData)
990 };
991 auto pDescriptor = aDescriptor.getArray();
992
993 for (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
994 {
995 SdPage* pPage = maPages[ nSdPage ];
996
997 OUString aFull(maExportPath);
998 if (bThumbnail)
999 aFull += maThumbnailFiles[nSdPage];
1000 else
1001 aFull += maImageFiles[nSdPage];
1002
1003 pDescriptor[0].Value <<= aFull;
1004
1005 Reference< XComponent > xPage( pPage->getUnoPage(), UNO_QUERY );
1006 xGraphicExporter->setSourceDocument( xPage );
1007 xGraphicExporter->filter( aDescriptor );
1008
1009 if (mpProgress)
1010 mpProgress->SetState(++mnPagesWritten);
1011 }
1012 }
1013 catch( Exception& )
1014 {
1015 return false;
1016 }
1017
1018 return true;
1019}
1020
1021// get SdrTextObject with layout text of this page
1023{
1024 const size_t nObjectCount = pPage->GetObjCount();
1025 SdrTextObj* pResult = nullptr;
1026
1027 for (size_t nObject = 0; nObject < nObjectCount; ++nObject)
1028 {
1029 SdrObject* pObject = pPage->GetObj(nObject);
1030 if (pObject->GetObjInventor() == SdrInventor::Default &&
1031 pObject->GetObjIdentifier() == SdrObjKind::OutlineText)
1032 {
1033 pResult = static_cast<SdrTextObj*>(pObject);
1034 break;
1035 }
1036 }
1037 return pResult;
1038}
1039
1040// create HTML text version of impress pages
1042{
1043 OUString aStr;
1044 const char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
1045 if ( pCharSet )
1046 {
1047 aStr = " <meta HTTP-EQUIV=CONTENT-TYPE CONTENT=\"text/html; charset=" +
1048 OUString::createFromAscii(pCharSet) + "\">\r\n";
1049 }
1050 return aStr;
1051}
1052
1054{
1055 SvMemoryStream aStream;
1056
1057 uno::Reference<document::XDocumentProperties> xDocProps;
1058 if (mpDocSh)
1059 {
1060 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1061 mpDocSh->GetModel(), uno::UNO_QUERY_THROW);
1062 xDocProps.set(xDPS->getDocumentProperties());
1063 }
1064
1066 " ");
1067
1068 const sal_uInt64 nLen = aStream.GetSize();
1069 OSL_ENSURE(nLen < o3tl::make_unsigned(SAL_MAX_INT32), "Stream can't fit in OString");
1070 std::string_view aData(static_cast<const char*>(aStream.GetData()), static_cast<sal_Int32>(nLen));
1071
1072 return OStringToOUString(aData, RTL_TEXTENCODING_UTF8);
1073}
1074
1076{
1077 bool bOk = true;
1078
1079 SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
1080
1081 for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++)
1082 {
1083 SdPage* pPage = maPages[ nSdPage ];
1084
1085 if( mbDocColors )
1086 {
1087 SetDocColors( pPage );
1088 }
1089
1090 // HTML head
1091 OUStringBuffer aStr(gaHTMLHeader
1093 + " <title>"
1095 + "</title>\r\n"
1096 "</head>\r\n"
1097 + CreateBodyTag());
1098
1099 // navigation bar
1100 aStr.append(CreateNavBar(nSdPage, true));
1101
1102 // page title
1103 OUString sTitleText( CreateTextForTitle(pOutliner,pPage, pPage->GetPageBackgroundColor()) );
1104 lclAppendStyle(aStr, u"h1", getParagraphStyle(pOutliner, 0));
1105 aStr.append(sTitleText + "</h1>\r\n");
1106
1107 // write outline text
1108 aStr.append(CreateTextForPage( pOutliner, pPage, true, pPage->GetPageBackgroundColor() ));
1109
1110 // notes
1111 if(mbNotes)
1112 {
1113 SdPage* pNotesPage = maNotesPages[ nSdPage ];
1114 OUString aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, maBackColor) );
1115
1116 if (!aNotesStr.isEmpty())
1117 {
1118 aStr.append("<br>\r\n<h3>"
1119 + RESTOHTML(STR_HTMLEXP_NOTES)
1120 + ":</h3>\r\n"
1121 + aNotesStr);
1122 }
1123 }
1124
1125 // close page
1126 aStr.append("</body>\r\n</html>");
1127
1128 bOk = WriteHtml(maTextFiles[nSdPage], false, aStr);
1129
1130 if (mpProgress)
1131 mpProgress->SetState(++mnPagesWritten);
1132
1133 }
1134
1135 pOutliner->Clear();
1136
1137 return bOk;
1138}
1139
1142bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, std::u16string_view rHtmlData )
1143{
1144 ErrCode nErr = ERRCODE_NONE;
1145
1146 OUString aFileName( rFileName );
1147 if( bAddExtension )
1148 aFileName += gaHTMLExtension;
1149
1150 meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rFileName );
1151 EasyFile aFile;
1152 SvStream* pStr;
1153 OUString aFull(maExportPath + aFileName);
1154 nErr = aFile.createStream(aFull , pStr);
1155 if(nErr == ERRCODE_NONE)
1156 {
1157 OString aStr(OUStringToOString(rHtmlData, RTL_TEXTENCODING_UTF8));
1158 pStr->WriteOString( aStr );
1159 aFile.close();
1160 }
1161
1162 if( nErr != ERRCODE_NONE )
1164
1165 return nErr == ERRCODE_NONE;
1166}
1167
1170OUString HtmlExport::CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor )
1171{
1172 SdrTextObj* pTO = static_cast<SdrTextObj*>(pPage->GetPresObj(PresObjKind::Title));
1173 if(!pTO)
1174 pTO = GetLayoutTextObject(pPage);
1175
1176 if (pTO && !pTO->IsEmptyPresObj())
1177 {
1179 if(pOPO && pOutliner->GetParagraphCount() != 0)
1180 {
1181 pOutliner->Clear();
1182 pOutliner->SetText(*pOPO);
1183 return ParagraphToHTMLString(pOutliner,0, rBackgroundColor);
1184 }
1185 }
1186
1187 return OUString();
1188}
1189
1190// creates an outliner text for a page
1191OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage const * pPage,
1192 bool bHeadLine, const Color& rBackgroundColor)
1193{
1194 OUStringBuffer aStr;
1195
1196 for (size_t i = 0; i <pPage->GetObjCount(); ++i )
1197 {
1198 SdrObject* pObject = pPage->GetObj(i);
1199 PresObjKind eKind = pPage->GetPresObjKind(pObject);
1200
1201 switch (eKind)
1202 {
1203 case PresObjKind::NONE:
1204 {
1205 if (pObject->GetObjIdentifier() == SdrObjKind::Group)
1206 {
1207 SdrObjGroup* pObjectGroup = static_cast<SdrObjGroup*>(pObject);
1208 WriteObjectGroup(aStr, pObjectGroup, pOutliner, rBackgroundColor, false);
1209 }
1210 else if (pObject->GetObjIdentifier() == SdrObjKind::Table)
1211 {
1212 SdrTableObj* pTableObject = static_cast<SdrTableObj*>(pObject);
1213 WriteTable(aStr, pTableObject, pOutliner, rBackgroundColor);
1214 }
1215 else
1216 {
1217 if (pObject->GetOutlinerParaObject())
1218 {
1219 WriteOutlinerParagraph(aStr, pOutliner, pObject->GetOutlinerParaObject(), rBackgroundColor, false);
1220 }
1221 }
1222 }
1223 break;
1224
1225 case PresObjKind::Table:
1226 {
1227 SdrTableObj* pTableObject = static_cast<SdrTableObj*>(pObject);
1228 WriteTable(aStr, pTableObject, pOutliner, rBackgroundColor);
1229 }
1230 break;
1231
1232 case PresObjKind::Text:
1234 {
1235 SdrTextObj* pTextObject = static_cast<SdrTextObj*>(pObject);
1236 if (pTextObject->IsEmptyPresObj())
1237 continue;
1238 WriteOutlinerParagraph(aStr, pOutliner, pTextObject->GetOutlinerParaObject(), rBackgroundColor, bHeadLine);
1239 }
1240 break;
1241
1242 default:
1243 break;
1244 }
1245 }
1246 return aStr.makeStringAndClear();
1247}
1248
1249void HtmlExport::WriteTable(OUStringBuffer& aStr, SdrTableObj const * pTableObject, SdrOutliner* pOutliner, const Color& rBackgroundColor)
1250{
1251 CellPos aStart, aEnd;
1252
1253 aStart = SdrTableObj::getFirstCell();
1254 aEnd = pTableObject->getLastCell();
1255
1256 sal_Int32 nColCount = pTableObject->getColumnCount();
1257 aStr.append("<table>\r\n");
1258 for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++)
1259 {
1260 aStr.append(" <tr>\r\n");
1261 for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++)
1262 {
1263 aStr.append(" <td>\r\n");
1264 sal_Int32 nCellIndex = nRow * nColCount + nCol;
1265 SdrText* pText = pTableObject->getText(nCellIndex);
1266
1267 if (pText == nullptr)
1268 continue;
1269 WriteOutlinerParagraph(aStr, pOutliner, pText->GetOutlinerParaObject(), rBackgroundColor, false);
1270 aStr.append(" </td>\r\n");
1271 }
1272 aStr.append(" </tr>\r\n");
1273 }
1274 aStr.append("</table>\r\n");
1275}
1276
1277void HtmlExport::WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup const * pObjectGroup, SdrOutliner* pOutliner,
1278 const Color& rBackgroundColor, bool bHeadLine)
1279{
1280 SdrObjListIter aGroupIterator(pObjectGroup->GetSubList(), SdrIterMode::DeepNoGroups);
1281 while (aGroupIterator.IsMore())
1282 {
1283 SdrObject* pCurrentObject = aGroupIterator.Next();
1284 if (pCurrentObject->GetObjIdentifier() == SdrObjKind::Group)
1285 {
1286 SdrObjGroup* pCurrentGroupObject = static_cast<SdrObjGroup*>(pCurrentObject);
1287 WriteObjectGroup(aStr, pCurrentGroupObject, pOutliner, rBackgroundColor, bHeadLine);
1288 }
1289 else
1290 {
1291 OutlinerParaObject* pOutlinerParagraphObject = pCurrentObject->GetOutlinerParaObject();
1292 if (pOutlinerParagraphObject != nullptr)
1293 {
1294 WriteOutlinerParagraph(aStr, pOutliner, pOutlinerParagraphObject, rBackgroundColor, bHeadLine);
1295 }
1296 }
1297 }
1298}
1299
1300void HtmlExport::WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutliner,
1301 OutlinerParaObject const * pOutlinerParagraphObject,
1302 const Color& rBackgroundColor, bool bHeadLine)
1303{
1304 if (pOutlinerParagraphObject == nullptr)
1305 return;
1306
1307 pOutliner->SetText(*pOutlinerParagraphObject);
1308
1309 sal_Int32 nCount = pOutliner->GetParagraphCount();
1310
1311
1312 sal_Int16 nCurrentDepth = -1;
1313
1314 for (sal_Int32 nIndex = 0; nIndex < nCount; nIndex++)
1315 {
1316 Paragraph* pParagraph = pOutliner->GetParagraph(nIndex);
1317 if(pParagraph == nullptr)
1318 continue;
1319
1320 const sal_Int16 nDepth = static_cast<sal_uInt16>(pOutliner->GetDepth(nIndex));
1321 OUString aParaText = ParagraphToHTMLString(pOutliner, nIndex, rBackgroundColor);
1322
1323 if (aParaText.isEmpty())
1324 continue;
1325
1326 if (nDepth < 0)
1327 {
1328 OUString aTag = bHeadLine ? OUString("h2") : OUString("p");
1329 lclAppendStyle(aStr, aTag, getParagraphStyle(pOutliner, nIndex));
1330
1331 aStr.append(aParaText);
1332 aStr.append("</" + aTag + ">\r\n");
1333 }
1334 else
1335 {
1336 while(nCurrentDepth < nDepth)
1337 {
1338 aStr.append("<ul>\r\n");
1339 nCurrentDepth++;
1340 }
1341 while(nCurrentDepth > nDepth)
1342 {
1343 aStr.append("</ul>\r\n");
1344 nCurrentDepth--;
1345 }
1346 lclAppendStyle(aStr, u"li", getParagraphStyle(pOutliner, nIndex));
1347 aStr.append(aParaText);
1348 aStr.append("</li>\r\n");
1349 }
1350 }
1351 while(nCurrentDepth >= 0)
1352 {
1353 aStr.append("</ul>\r\n");
1354 nCurrentDepth--;
1355 }
1356 pOutliner->Clear();
1357}
1358
1359// creates an outliner text for a note page
1361 SdPage* pPage,
1362 const Color& rBackgroundColor )
1363{
1364 OUStringBuffer aStr;
1365
1366 SdrTextObj* pTO = static_cast<SdrTextObj*>(pPage->GetPresObj(PresObjKind::Notes));
1367
1368 if (pTO && !pTO->IsEmptyPresObj())
1369 {
1371 if (pOPO)
1372 {
1373 pOutliner->Clear();
1374 pOutliner->SetText( *pOPO );
1375
1376 sal_Int32 nCount = pOutliner->GetParagraphCount();
1377 for (sal_Int32 nPara = 0; nPara < nCount; nPara++)
1378 {
1379 lclAppendStyle(aStr, u"p", getParagraphStyle(pOutliner, nPara));
1380 aStr.append(ParagraphToHTMLString(pOutliner, nPara, rBackgroundColor)
1381 + "</p>\r\n");
1382 }
1383 }
1384 }
1385
1386 return aStr.makeStringAndClear();
1387}
1388
1389// converts a paragraph of the outliner to html
1390OUString HtmlExport::ParagraphToHTMLString( SdrOutliner const * pOutliner, sal_Int32 nPara, const Color& rBackgroundColor )
1391{
1392 OUStringBuffer aStr;
1393
1394 if(nullptr == pOutliner)
1395 return OUString();
1396
1397 // TODO: MALTE!!!
1398 EditEngine& rEditEngine = *const_cast<EditEngine*>(&pOutliner->GetEditEngine());
1399 bool bOldUpdateMode = rEditEngine.SetUpdateLayout(true);
1400
1401 Paragraph* pPara = pOutliner->GetParagraph(nPara);
1402 if(nullptr == pPara)
1403 return OUString();
1404
1406 std::vector<sal_Int32> aPortionList;
1407 rEditEngine.GetPortions( nPara, aPortionList );
1408
1409 sal_Int32 nPos1 = 0;
1410 for( sal_Int32 nPos2 : aPortionList )
1411 {
1412 ESelection aSelection( nPara, nPos1, nPara, nPos2);
1413
1414 SfxItemSet aSet( rEditEngine.GetAttribs( aSelection ) );
1415
1416 aStr.append(TextAttribToHTMLString( &aSet, &aState, rBackgroundColor ) +
1417 StringToHTMLString(rEditEngine.GetText( aSelection )));
1418
1419 nPos1 = nPos2;
1420 }
1421 aStr.append(aState.Flush());
1422 rEditEngine.SetUpdateLayout(bOldUpdateMode);
1423
1424 return aStr.makeStringAndClear();
1425}
1426
1427// Depending on the attributes of the specified set and the specified
1428// HtmlState, it creates the needed html tags in order to get the
1429// attributes
1430OUString HtmlExport::TextAttribToHTMLString( SfxItemSet const * pSet, HtmlState* pState, const Color& rBackgroundColor )
1431{
1432 OUStringBuffer aStr;
1433
1434 if(nullptr == pSet)
1435 return OUString();
1436
1437 OUString aLink, aTarget;
1438 if ( pSet->GetItemState( EE_FEATURE_FIELD ) == SfxItemState::SET )
1439 {
1440 const SvxFieldItem* pItem = pSet->GetItem<SvxFieldItem>( EE_FEATURE_FIELD );
1441 if(pItem)
1442 {
1443 const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pItem->GetField() );
1444 if(pURL)
1445 {
1446 aLink = pURL->GetURL();
1447 aTarget = pURL->GetTargetFrame();
1448 }
1449 }
1450 }
1451
1452 bool bTemp;
1453 OUString aTemp;
1454
1455 if ( pSet->GetItemState( EE_CHAR_WEIGHT ) == SfxItemState::SET )
1456 {
1457 bTemp = pSet->Get( EE_CHAR_WEIGHT ).GetWeight() == WEIGHT_BOLD;
1458 aTemp = pState->SetWeight( bTemp );
1459 if( bTemp )
1460 aStr.insert(0, aTemp);
1461 else
1462 aStr.append(aTemp);
1463 }
1464
1465 if ( pSet->GetItemState( EE_CHAR_UNDERLINE ) == SfxItemState::SET )
1466 {
1467 bTemp = pSet->Get( EE_CHAR_UNDERLINE ).GetLineStyle() != LINESTYLE_NONE;
1468 aTemp = pState->SetUnderline( bTemp );
1469 if( bTemp )
1470 aStr.insert(0, aTemp);
1471 else
1472 aStr.append(aTemp);
1473 }
1474
1475 if ( pSet->GetItemState( EE_CHAR_STRIKEOUT ) == SfxItemState::SET )
1476 {
1477 bTemp = pSet->Get( EE_CHAR_STRIKEOUT ).GetStrikeout() != STRIKEOUT_NONE;
1478 aTemp = pState->SetStrikeout( bTemp );
1479 if( bTemp )
1480 aStr.insert(0, aTemp);
1481 else
1482 aStr.append(aTemp);
1483 }
1484
1485 if ( pSet->GetItemState( EE_CHAR_ITALIC ) == SfxItemState::SET )
1486 {
1487 bTemp = pSet->Get( EE_CHAR_ITALIC ).GetPosture() != ITALIC_NONE;
1488 aTemp = pState->SetItalic( bTemp );
1489 if( bTemp )
1490 aStr.insert(0, aTemp);
1491 else
1492 aStr.append(aTemp);
1493 }
1494
1495 if(mbDocColors)
1496 {
1497 if ( pSet->GetItemState( EE_CHAR_COLOR ) == SfxItemState::SET )
1498 {
1499 Color aTextColor = pSet->Get( EE_CHAR_COLOR ).GetValue();
1500 if( aTextColor == COL_AUTO )
1501 {
1502 if( !rBackgroundColor.IsDark() )
1503 aTextColor = COL_BLACK;
1504 }
1505 aStr.append(pState->SetColor( aTextColor ));
1506 }
1507 }
1508
1509 if (!aLink.isEmpty())
1510 aStr.insert(0, pState->SetLink(aLink, aTarget));
1511 else
1512 aStr.append(pState->SetLink(aLink, aTarget));
1513
1514 return aStr.makeStringAndClear();
1515}
1516
1517// create HTML wrapper for picture files
1519{
1520 bool bOk = true;
1521
1522 std::vector<SdrObject*> aClickableObjects;
1523
1524 for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++)
1525 {
1526 // find clickable objects (also on the master page) and put it in the
1527 // list. This in reverse order character order since in html the first
1528 // area is taken in the case they overlap.
1529 SdPage* pPage = maPages[ nSdPage ];
1530
1531 if( mbDocColors )
1532 {
1533 SetDocColors( pPage );
1534 }
1535
1536 bool bMasterDone = false;
1537
1538 while (!bMasterDone)
1539 {
1540 // sal_True = backwards
1541 SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups, true);
1542
1543 SdrObject* pObject = aIter.Next();
1544 while (pObject)
1545 {
1548
1549 if ((pInfo &&
1550 (pInfo->meClickAction == presentation::ClickAction_BOOKMARK ||
1551 pInfo->meClickAction == presentation::ClickAction_DOCUMENT ||
1552 pInfo->meClickAction == presentation::ClickAction_PREVPAGE ||
1553 pInfo->meClickAction == presentation::ClickAction_NEXTPAGE ||
1554 pInfo->meClickAction == presentation::ClickAction_FIRSTPAGE ||
1555 pInfo->meClickAction == presentation::ClickAction_LASTPAGE)) ||
1556 pIMapInfo)
1557 {
1558 aClickableObjects.push_back(pObject);
1559 }
1560
1561 pObject = aIter.Next();
1562 }
1563 // now to the master page or finishing
1564 if (!pPage->IsMasterPage())
1565 pPage = static_cast<SdPage*>(&(pPage->TRG_GetMasterPage()));
1566 else
1567 bMasterDone = true;
1568 }
1569
1570 // HTML Head
1571 OUStringBuffer aStr(gaHTMLHeader +
1573 " <title>" + StringToHTMLString(maPageNames[nSdPage]) + "</title>\r\n");
1574
1575 // insert timing information
1576 pPage = maPages[ nSdPage ];
1577 if( meMode == PUBLISH_KIOSK )
1578 {
1579 double fSecs = 0;
1580 bool bEndless = false;
1581 if( !mbAutoSlide )
1582 {
1583 if( pPage->GetPresChange() != PresChange::Manual )
1584 {
1585 fSecs = pPage->GetTime();
1587 }
1588 }
1589 else
1590 {
1591 fSecs = mfSlideDuration;
1592 bEndless = mbEndless;
1593 }
1594
1595 if( fSecs != 0 )
1596 {
1597 if( nSdPage < (mnSdPageCount-1) || bEndless )
1598 {
1599 aStr.append("<meta http-equiv=\"refresh\" content=\""
1600 + OUString::number(fSecs)
1601 + "; URL=");
1602
1603 int nPage = nSdPage + 1;
1604 if( nPage == mnSdPageCount )
1605 nPage = 0;
1606
1607 aStr.append(maHTMLFiles[nPage]
1608 + "\">\r\n");
1609 }
1610 }
1611 }
1612
1613 aStr.append("</head>\r\n");
1614
1615 // HTML Body
1616 aStr.append(CreateBodyTag());
1617
1618 if( mbSlideSound && pPage->IsSoundOn() )
1619 aStr.append(InsertSound(pPage->GetSoundFile()));
1620
1621 // navigation bar
1622 if(!mbFrames )
1623 aStr.append(CreateNavBar(nSdPage, false));
1624 // Image
1625 aStr.append("<center>"
1626 "<img src=\""
1627 + maImageFiles[nSdPage]
1628 + "\" alt=\"\"");
1629
1630 if (!aClickableObjects.empty())
1631 aStr.append(" USEMAP=\"#map0\"");
1632
1633 aStr.append("></center>\r\n");
1634
1635 // notes
1636 if(mbNotes && !mbFrames)
1637 {
1638 SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
1639 SdPage* pNotesPage = maNotesPages[ nSdPage ];
1640 OUString aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, maBackColor) );
1641 pOutliner->Clear();
1642
1643 if (!aNotesStr.isEmpty())
1644 {
1645 aStr.append("<h3>"
1646 + RESTOHTML(STR_HTMLEXP_NOTES)
1647 + ":</h3><br>\r\n\r\n<p>"
1648 + aNotesStr
1649 + "\r\n</p>\r\n");
1650 }
1651 }
1652
1653 // create Imagemap if necessary
1654 if (!aClickableObjects.empty())
1655 {
1656 aStr.append("<map name=\"map0\">\r\n");
1657
1658 for (SdrObject* pObject : aClickableObjects)
1659 {
1662
1663 ::tools::Rectangle aRect(pObject->GetCurrentBoundRect());
1664 Point aLogPos(aRect.TopLeft());
1665 bool bIsSquare = aRect.GetWidth() == aRect.GetHeight();
1666
1667 sal_uLong nPageWidth = pPage->GetSize().Width() - pPage->GetLeftBorder() -
1668 pPage->GetRightBorder();
1669
1670 // BoundRect is relative to the physical page origin, not the
1671 // origin of ordinates
1672 aRect.Move(-pPage->GetLeftBorder(), -pPage->GetUpperBorder());
1673
1674 double fLogicToPixel = static_cast<double>(mnWidthPixel) / nPageWidth;
1675 aRect.SetLeft( static_cast<tools::Long>(aRect.Left() * fLogicToPixel) );
1676 aRect.SetTop( static_cast<tools::Long>(aRect.Top() * fLogicToPixel) );
1677 aRect.SetRight( static_cast<tools::Long>(aRect.Right() * fLogicToPixel) );
1678 aRect.SetBottom( static_cast<tools::Long>(aRect.Bottom() * fLogicToPixel) );
1679 tools::Long nRadius = aRect.GetWidth() / 2;
1680
1685 if (pIMapInfo)
1686 {
1687 const ImageMap& rIMap = pIMapInfo->GetImageMap();
1688 sal_uInt16 nAreaCount = rIMap.GetIMapObjectCount();
1689 for (sal_uInt16 nArea = 0; nArea < nAreaCount; nArea++)
1690 {
1691 IMapObject* pArea = rIMap.GetIMapObject(nArea);
1692 IMapObjectType nType = pArea->GetType();
1693 OUString aURL( pArea->GetURL() );
1694
1695 // if necessary, convert page and object names into the
1696 // corresponding names of the html file
1697 bool bIsMasterPage;
1698 sal_uInt16 nPgNum = mpDoc->GetPageByName( aURL, bIsMasterPage );
1699
1700 if (nPgNum == SDRPAGE_NOTFOUND)
1701 {
1702 // is the bookmark an object?
1703 SdrObject* pObj = mpDoc->GetObj( aURL );
1704 if (pObj)
1705 nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
1706 }
1707 if (nPgNum != SDRPAGE_NOTFOUND)
1708 {
1709 nPgNum = (nPgNum - 1) / 2; // SdrPageNum --> SdPageNum
1710 aURL = CreatePageURL(nPgNum);
1711 }
1712
1713 switch(nType)
1714 {
1715 case IMapObjectType::Rectangle:
1716 {
1717 ::tools::Rectangle aArea(static_cast<IMapRectangleObject*>(pArea)->
1718 GetRectangle(false));
1719
1720 // conversion into pixel coordinates
1721 aArea.Move(aLogPos.X() - pPage->GetLeftBorder(),
1722 aLogPos.Y() - pPage->GetUpperBorder());
1723 aArea.SetLeft( static_cast<tools::Long>(aArea.Left() * fLogicToPixel) );
1724 aArea.SetTop( static_cast<tools::Long>(aArea.Top() * fLogicToPixel) );
1725 aArea.SetRight( static_cast<tools::Long>(aArea.Right() * fLogicToPixel) );
1726 aArea.SetBottom( static_cast<tools::Long>(aArea.Bottom() * fLogicToPixel) );
1727
1728 aStr.append(CreateHTMLRectArea(aArea, aURL));
1729 }
1730 break;
1731
1732 case IMapObjectType::Circle:
1733 {
1734 Point aCenter(static_cast<IMapCircleObject*>(pArea)->
1735 GetCenter(false));
1736 aCenter += Point(aLogPos.X() - pPage->GetLeftBorder(),
1737 aLogPos.Y() - pPage->GetUpperBorder());
1738 aCenter.setX( static_cast<tools::Long>(aCenter.X() * fLogicToPixel) );
1739 aCenter.setY( static_cast<tools::Long>(aCenter.Y() * fLogicToPixel) );
1740
1741 sal_uLong nCircleRadius = static_cast<IMapCircleObject*>(pArea)->
1742 GetRadius(false);
1743 nCircleRadius = static_cast<sal_uLong>(nCircleRadius * fLogicToPixel);
1744 aStr.append(CreateHTMLCircleArea(nCircleRadius,
1745 aCenter.X(), aCenter.Y(),
1746 aURL));
1747 }
1748 break;
1749
1750 case IMapObjectType::Polygon:
1751 {
1752 tools::Polygon aArea(static_cast<IMapPolygonObject*>(pArea)->GetPolygon(false));
1754 Size(aLogPos.X() - pPage->GetLeftBorder(),
1755 aLogPos.Y() - pPage->GetUpperBorder()),
1756 fLogicToPixel, aURL));
1757 }
1758 break;
1759
1760 default:
1761 {
1762 SAL_INFO("sd", "unknown IMapObjectType");
1763 }
1764 break;
1765 }
1766 }
1767 }
1768
1773 if( pInfo )
1774 {
1775 OUString aHRef;
1776 presentation::ClickAction eClickAction = pInfo->meClickAction;
1777
1778 switch( eClickAction )
1779 {
1780 case presentation::ClickAction_BOOKMARK:
1781 {
1782 bool bIsMasterPage;
1783 sal_uInt16 nPgNum = mpDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage );
1784
1785 if( nPgNum == SDRPAGE_NOTFOUND )
1786 {
1787 // is the bookmark an object?
1788 SdrObject* pObj = mpDoc->GetObj(pInfo->GetBookmark());
1789 if (pObj)
1790 nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
1791 }
1792
1793 if( SDRPAGE_NOTFOUND != nPgNum )
1794 aHRef = CreatePageURL(( nPgNum - 1 ) / 2 );
1795 }
1796 break;
1797
1798 case presentation::ClickAction_DOCUMENT:
1799 aHRef = pInfo->GetBookmark();
1800 break;
1801
1802 case presentation::ClickAction_PREVPAGE:
1803 {
1804 sal_uLong nPage;
1805
1806 if (nSdPage == 0)
1807 nPage = 0;
1808 else
1809 nPage = nSdPage - 1;
1810
1811 aHRef = CreatePageURL( static_cast<sal_uInt16>(nPage));
1812 }
1813 break;
1814
1815 case presentation::ClickAction_NEXTPAGE:
1816 {
1817 sal_uLong nPage;
1818 if (nSdPage == mnSdPageCount - 1)
1819 nPage = mnSdPageCount - 1;
1820 else
1821 nPage = nSdPage + 1;
1822
1823 aHRef = CreatePageURL( static_cast<sal_uInt16>(nPage));
1824 }
1825 break;
1826
1827 case presentation::ClickAction_FIRSTPAGE:
1828 aHRef = CreatePageURL(0);
1829 break;
1830
1831 case presentation::ClickAction_LASTPAGE:
1832 aHRef = CreatePageURL(mnSdPageCount - 1);
1833 break;
1834
1835 default:
1836 break;
1837 }
1838
1839 // and now the areas
1840 if (!aHRef.isEmpty())
1841 {
1842 // a circle?
1843 if (pObject->GetObjInventor() == SdrInventor::Default &&
1844 pObject->GetObjIdentifier() == SdrObjKind::CircleOrEllipse &&
1845 bIsSquare )
1846 {
1847 aStr.append(CreateHTMLCircleArea(aRect.GetWidth() / 2,
1848 aRect.Left() + nRadius,
1849 aRect.Top() + nRadius,
1850 aHRef));
1851 }
1852 // a polygon?
1853 else if (pObject->GetObjInventor() == SdrInventor::Default &&
1854 (pObject->GetObjIdentifier() == SdrObjKind::PathLine ||
1855 pObject->GetObjIdentifier() == SdrObjKind::PolyLine ||
1856 pObject->GetObjIdentifier() == SdrObjKind::Polygon))
1857 {
1858 aStr.append(CreateHTMLPolygonArea(static_cast<SdrPathObj*>(pObject)->GetPathPoly(), Size(-pPage->GetLeftBorder(), -pPage->GetUpperBorder()), fLogicToPixel, aHRef));
1859 }
1860 // something completely different: use the BoundRect
1861 else
1862 {
1863 aStr.append(CreateHTMLRectArea(aRect, aHRef));
1864 }
1865
1866 }
1867 }
1868 }
1869
1870 aStr.append("</map>\r\n");
1871 }
1872 aClickableObjects.clear();
1873
1874 aStr.append("</body>\r\n</html>");
1875
1876 bOk = WriteHtml(maHTMLFiles[nSdPage], false, aStr);
1877 aStr.setLength(0);
1878
1879 if (mpProgress)
1880 mpProgress->SetState(++mnPagesWritten);
1881 }
1882
1883 return bOk;
1884}
1885
1886// create overview pages
1888{
1889 if( mbDocColors )
1890 SetDocColors();
1891
1892 // html head
1893 OUStringBuffer aStr(
1896 + " <title>"
1898 + "</title>\r\n</head>\r\n"
1899 + CreateBodyTag());
1900
1901 // page head
1902 aStr.append("<center>\r\n");
1903
1904 if(mbHeader)
1905 {
1906 aStr.append("<h1>" + getDocumentTitle() + "</h1><br>\r\n");
1907 }
1908
1909 aStr.append("<h2>");
1910
1911 // Solaris compiler bug workaround
1912 if( mbFrames )
1914 RESTOHTML(STR_HTMLEXP_CLICKSTART)));
1915 else
1917 RESTOHTML(STR_HTMLEXP_CLICKSTART)));
1918
1919 aStr.append("</h2>\r\n</center>\r\n"
1920 "<center><table width=\"90%\"><tr>\r\n");
1921
1922 // table of content
1923 aStr.append("<td valign=\"top\" align=\"left\" width=\"25%\">\r\n"
1924 "<h3>"
1925 + RESTOHTML(STR_HTMLEXP_CONTENTS)
1926 + "</h3>");
1927
1928 for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
1929 {
1930 OUString aPageName = maPageNames[nSdPage];
1931 aStr.append("<div align=\"left\">");
1932 if(mbFrames)
1933 aStr.append(StringToHTMLString(aPageName));
1934 else
1935 aStr.append(CreateLink(maHTMLFiles[nSdPage], aPageName));
1936 aStr.append("</div>\r\n");
1937 }
1938 aStr.append("</td>\r\n");
1939
1940 // document information
1941 aStr.append("<td valign=\"top\" align=\"left\" width=\"75%\">\r\n");
1942
1943 if (!maAuthor.isEmpty())
1944 {
1945 aStr.append("<p><strong>"
1946 + RESTOHTML(STR_HTMLEXP_AUTHOR)
1947 + ":</strong> "
1949 + "</p>\r\n");
1950 }
1951
1952 if (!maEMail.isEmpty())
1953 {
1954 aStr.append("<p><strong>"
1955 + RESTOHTML(STR_HTMLEXP_EMAIL)
1956 + ":</strong> <a href=\"mailto:"
1957 + maEMail
1958 + "\">"
1960 + "</a></p>\r\n");
1961 }
1962
1963 if (!maHomePage.isEmpty())
1964 {
1965 aStr.append("<p><strong>"
1966 + RESTOHTML(STR_HTMLEXP_HOMEPAGE)
1967 + ":</strong> <a href=\""
1968 + maHomePage
1969 + "\">"
1971 + "</a> </p>\r\n");
1972 }
1973
1974 if (!maInfo.isEmpty())
1975 {
1976 aStr.append("<p><strong>"
1977 + RESTOHTML(STR_HTMLEXP_INFO)
1978 + ":</strong><br>\r\n"
1980 + "</p>\r\n");
1981 }
1982
1983 if(mbDownload)
1984 {
1985 aStr.append("<p><a href=\""
1987 + "\">"
1988 + RESTOHTML(STR_HTMLEXP_DOWNLOAD)
1989 + "</a></p>\r\n");
1990 }
1991
1992 for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
1993 {
1994 OUString aText(
1995 "<img src=\"" +
1996 maThumbnailFiles[nSdPage] +
1997 "\" width=\"256\" height=\"192\" alt=\"" +
1999 "\">");
2000
2001 aStr.append(CreateLink(maHTMLFiles[nSdPage], aText)
2002 + "\r\n");
2003 }
2004
2005 aStr.append("</td></tr></table></center>\r\n"
2006 "</body>\r\n</html>");
2007
2008 bool bOk = WriteHtml(maIndex, false, aStr);
2009
2010 if (mpProgress)
2011 mpProgress->SetState(++mnPagesWritten);
2012
2013 return bOk;
2014}
2015
2016// create note pages (for frames)
2017
2019{
2020 bool bOk = true;
2021
2022 SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
2023 for( sal_uInt16 nSdPage = 0; bOk && nSdPage < mnSdPageCount; nSdPage++ )
2024 {
2025 SdPage* pPage = maNotesPages[nSdPage];
2026 if( mbDocColors )
2027 SetDocColors( pPage );
2028
2029 // Html head
2030 OUStringBuffer aStr(gaHTMLHeader
2032 + " <title>"
2034 + "</title>\r\n</head>\r\n"
2035 + CreateBodyTag());
2036
2037 if(pPage)
2038 aStr.append(CreateTextForNotesPage( pOutliner, pPage, maBackColor ));
2039
2040 aStr.append("</body>\r\n</html>");
2041
2042 OUString aFileName("note" + OUString::number(nSdPage));
2043 bOk = WriteHtml(aFileName, true, aStr);
2044
2045 if (mpProgress)
2046 mpProgress->SetState(++mnPagesWritten);
2047 }
2048
2049 pOutliner->Clear();
2050
2051 return bOk;
2052}
2053
2054// create outline pages (for frames)
2055
2057{
2058 bool bOk = true;
2059
2060 if( mbDocColors )
2061 {
2062 SetDocColors();
2063 }
2064
2065 // page 0 will be the closed outline, page 1 the opened
2066 for (sal_Int32 nPage = 0; nPage < (mbImpress?2:1) && bOk; ++nPage)
2067 {
2068 // Html head
2069 OUStringBuffer aStr(gaHTMLHeader
2071 + " <title>"
2073 + "</title>\r\n</head>\r\n"
2074 + CreateBodyTag());
2075
2076 SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
2077 for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
2078 {
2079 SdPage* pPage = maPages[ nSdPage ];
2080
2081 aStr.append("<div align=\"left\">");
2082 OUString aLink("JavaScript:parent.NavigateAbs(" +
2083 OUString::number(nSdPage) + ")");
2084
2085 OUString aTitle = CreateTextForTitle(pOutliner, pPage, maBackColor);
2086 if (aTitle.isEmpty())
2087 aTitle = maPageNames[nSdPage];
2088
2089 lclAppendStyle(aStr, u"p", getParagraphStyle(pOutliner, 0));
2090 aStr.append(CreateLink(aLink, aTitle)
2091 + "</p>");
2092
2093 if(nPage==1)
2094 {
2095 aStr.append(CreateTextForPage( pOutliner, pPage, false, maBackColor ));
2096 }
2097 aStr.append("</div>\r\n");
2098 }
2099 pOutliner->Clear();
2100
2101 aStr.append("</body>\r\n</html>");
2102
2103 OUString aFileName("outline" + OUString::number(nPage));
2104 bOk = WriteHtml(aFileName, true, aStr);
2105 aStr.setLength(0);
2106
2107 if (mpProgress)
2108 mpProgress->SetState(++mnPagesWritten);
2109 }
2110
2111 return bOk;
2112}
2113
2114// set file name
2116{
2117 // create lists with new file names
2118 maHTMLFiles.resize(mnSdPageCount);
2121 maPageNames.resize(mnSdPageCount);
2122 maTextFiles.resize(mnSdPageCount);
2123
2124 mbHeader = false; // headline on overview page?
2125
2126 for (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
2127 {
2128 OUString aHTMLFileName;
2129 if(nSdPage == 0 && !mbContentsPage && !mbFrames )
2130 aHTMLFileName = maIndex;
2131 else
2132 {
2133 aHTMLFileName = "img" + OUString::number(nSdPage) + gaHTMLExtension;
2134 }
2135
2136 maHTMLFiles[nSdPage] = aHTMLFileName;
2137
2138 OUString aImageFileName = "img" + OUString::number(nSdPage);
2139 if( meFormat==FORMAT_GIF )
2140 aImageFileName += ".gif";
2141 else if( meFormat==FORMAT_JPG )
2142 aImageFileName += ".jpg";
2143 else
2144 aImageFileName += ".png";
2145
2146 maImageFiles[nSdPage] = aImageFileName;
2147
2148 OUString aThumbnailFileName = "thumb" + OUString::number(nSdPage);
2149 if( meFormat!=FORMAT_JPG )
2150 aThumbnailFileName += ".png";
2151 else
2152 aThumbnailFileName += ".jpg";
2153
2154 maThumbnailFiles[nSdPage] = aThumbnailFileName;
2155
2156 maTextFiles[nSdPage] = "text" + OUString::number(nSdPage) + gaHTMLExtension;
2157
2158 SdPage* pSdPage = maPages[ nSdPage ];
2159
2160 // get slide title from page name
2161 maPageNames[nSdPage] = pSdPage->GetName();
2162 }
2163
2164 if(!mbContentsPage && mbFrames)
2166 else
2167 {
2168 maFramePage = "siframes" + gaHTMLExtension;
2169 }
2170}
2171
2173{
2174 // check for a title object in this page, if it's the first
2175 // title it becomes this documents title for the content
2176 // page
2177 if( !mbHeader )
2178 {
2179 if(mbImpress)
2180 {
2181 // if there is a non-empty title object, use their first passage
2182 // as page title
2183 SdPage* pSdPage = mpDoc->GetSdPage(0, PageKind::Standard);
2184 SdrObject* pTitleObj = pSdPage->GetPresObj(PresObjKind::Title);
2185 if (pTitleObj && !pTitleObj->IsEmptyPresObj())
2186 {
2187 OutlinerParaObject* pParaObject = pTitleObj->GetOutlinerParaObject();
2188 if (pParaObject)
2189 {
2190 const EditTextObject& rEditTextObject =
2191 pParaObject->GetTextObject();
2192 OUString aTest(rEditTextObject.GetText(0));
2193 if (!aTest.isEmpty())
2194 mDocTitle = aTest;
2195 }
2196 }
2197
2198 mDocTitle = mDocTitle.replace(0xff, ' ');
2199 }
2200
2201 if (mDocTitle.isEmpty())
2202 {
2204 sal_Int32 nDot = mDocTitle.indexOf('.');
2205 if (nDot > 0)
2206 mDocTitle = mDocTitle.copy(0, nDot);
2207 }
2208 mbHeader = true;
2209 }
2210
2211 return mDocTitle;
2212}
2213
2214constexpr OUStringLiteral JS_NavigateAbs =
2215 u"function NavigateAbs( nPage )\r\n"
2216 "{\r\n"
2217 " frames[\"show\"].location.href = \"img\" + nPage + \".$EXT\";\r\n"
2218 " //frames[\"notes\"].location.href = \"note\" + nPage + \".$EXT\";\r\n"
2219 " nCurrentPage = nPage;\r\n"
2220 " if(nCurrentPage==0)\r\n"
2221 " {\r\n"
2222 " frames[\"navbar1\"].location.href = \"navbar0.$EXT\";\r\n"
2223 " }\r\n"
2224 " else if(nCurrentPage==nPageCount-1)\r\n"
2225 " {\r\n"
2226 " frames[\"navbar1\"].location.href = \"navbar2.$EXT\";\r\n"
2227 " }\r\n"
2228 " else\r\n"
2229 " {\r\n"
2230 " frames[\"navbar1\"].location.href = \"navbar1.$EXT\";\r\n"
2231 " }\r\n"
2232 "}\r\n\r\n";
2233
2234constexpr OUStringLiteral JS_NavigateRel =
2235 u"function NavigateRel( nDelta )\r\n"
2236 "{\r\n"
2237 " var nPage = parseInt(nCurrentPage) + parseInt(nDelta);\r\n"
2238 " if( (nPage >= 0) && (nPage < nPageCount) )\r\n"
2239 " {\r\n"
2240 " NavigateAbs( nPage );\r\n"
2241 " }\r\n"
2242 "}\r\n\r\n";
2243
2244constexpr OUStringLiteral JS_ExpandOutline =
2245 u"function ExpandOutline()\r\n"
2246 "{\r\n"
2247 " frames[\"navbar2\"].location.href = \"navbar4.$EXT\";\r\n"
2248 " frames[\"outline\"].location.href = \"outline1.$EXT\";\r\n"
2249 "}\r\n\r\n";
2250
2251constexpr OUStringLiteral JS_CollapseOutline =
2252 u"function CollapseOutline()\r\n"
2253 "{\r\n"
2254 " frames[\"navbar2\"].location.href = \"navbar3.$EXT\";\r\n"
2255 " frames[\"outline\"].location.href = \"outline0.$EXT\";\r\n"
2256 "}\r\n\r\n";
2257
2258// create page with the frames
2259
2261{
2262 OUString aTmp;
2263 OUStringBuffer aStr(
2264 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\r\n"
2265 " \"http://www.w3.org/TR/html4/frameset.dtd\">\r\n"
2266 "<html>\r\n<head>\r\n"
2267
2269 + " <title>"
2271 + "</title>\r\n"
2272
2273 "<script type=\"text/javascript\">\r\n<!--\r\n"
2274
2275 "var nCurrentPage = 0;\r\nvar nPageCount = "
2276 + OUString::number(static_cast<sal_Int32>(mnSdPageCount))
2277 + ";\r\n\r\n");
2278
2279 OUString aFunction = JS_NavigateAbs;
2280
2281 if(mbNotes)
2282 {
2283 aFunction = aFunction.replaceAll("//", "");
2284 }
2285
2286 // substitute HTML file extension
2287 OUString aPlaceHolder(".$EXT");
2288 aFunction = aFunction.replaceAll(aPlaceHolder, gaHTMLExtension);
2289 aStr.append(aFunction);
2290
2291 aTmp = JS_NavigateRel;
2292 aTmp = aTmp.replaceAll(aPlaceHolder, gaHTMLExtension);
2293 aStr.append(aTmp);
2294
2295 if(mbImpress)
2296 {
2297 aTmp = JS_ExpandOutline;
2298 aTmp = aTmp.replaceAll(aPlaceHolder, gaHTMLExtension);
2299 aStr.append(aTmp);
2300
2301 aTmp = JS_CollapseOutline;
2302 aTmp = aTmp.replaceAll(aPlaceHolder, gaHTMLExtension);
2303 aStr.append(aTmp);
2304 }
2305 aStr.append("// -->\r\n</script>\r\n"
2306
2307 "</head>\r\n"
2308
2309 "<frameset cols=\"*,"
2310 + OUString::number(static_cast<sal_Int32>(mnWidthPixel + 16))
2311 + "\">\r\n");
2312 if(mbImpress)
2313 {
2314 aStr.append(
2315 " <frameset rows=\"42,*\">\r\n"
2316 " <frame src=\"navbar3"
2318 + "\" name=\"navbar2\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n");
2319 }
2320 aStr.append(" <frame src=\"outline0"
2322 + "\" name=\"outline\">\r\n");
2323 if(mbImpress)
2324 aStr.append(" </frameset>\r\n");
2325
2326 if(mbNotes)
2327 {
2328 aStr.append(" <frameset rows=\"42,"
2329 + OUString::number(static_cast<sal_Int32>(static_cast<double>(mnWidthPixel) * 0.75) + 16)
2330 + ",*\">\r\n");
2331 }
2332 else
2333 aStr.append(" <frameset rows=\"42,*\">\r\n");
2334
2335 aStr.append(
2336 " <frame src=\"navbar0"
2338 + "\" name=\"navbar1\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n"
2339
2340 " <frame src=\""
2341 + maHTMLFiles[0]
2342 + "\" name=\"show\" marginwidth=\"4\" marginheight=\"4\">\r\n");
2343
2344 if(mbNotes)
2345 {
2346 aStr.append(" <frame src=\"note0"
2348 + "\" name=\"notes\">\r\n");
2349 }
2350 aStr.append(" </frameset>\r\n"
2351
2352 "<noframes>\r\n"
2353 + CreateBodyTag()
2354 + RESTOHTML(STR_HTMLEXP_NOFRAMES)
2355 + "\r\n</noframes>\r\n</frameset>\r\n</html>");
2356
2357 bool bOk = WriteHtml(maFramePage, false, aStr);
2358
2359 if (mpProgress)
2360 mpProgress->SetState(++mnPagesWritten);
2361
2362 return bOk;
2363}
2364
2365// create button bar for standard
2366// we create the following html files
2367// navbar0.htm navigation bar graphic for the first page
2368// navbar1.htm navigation bar graphic for the second until second last page
2369// navbar2.htm navigation bar graphic for the last page
2370// navbar3.htm navigation outline closed
2371// navbar4.htm navigation outline open
2373{
2374 bool bOk = true;
2375 OUString aButton;
2376
2377 if( mbDocColors )
2378 {
2379 SetDocColors();
2381 }
2382
2383 for( int nFile = 0; nFile < 3 && bOk; nFile++ )
2384 {
2385 OUStringBuffer aStr(
2388 + " <title>"
2390 + "</title>\r\n</head>\r\n"
2391 + CreateBodyTag()
2392 + "<center>\r\n");
2393
2394 // first page
2395 aButton = SdResId(STR_HTMLEXP_FIRSTPAGE);
2396 if(mnButtonThema != -1)
2397 aButton = CreateImage(GetButtonName(nFile == 0 || mnSdPageCount == 1 ? BTN_FIRST_0 : BTN_FIRST_1),
2398 aButton);
2399
2400 if(nFile != 0 && mnSdPageCount > 1)
2401 aButton = CreateLink(u"JavaScript:parent.NavigateAbs(0)", aButton);
2402
2403 aStr.append(aButton
2404 + "\r\n");
2405
2406 // to the previous page
2407 aButton = SdResId(STR_PUBLISH_BACK);
2408 if(mnButtonThema != -1)
2409 aButton = CreateImage(GetButtonName(nFile == 0 || mnSdPageCount == 1?
2411 aButton);
2412
2413 if(nFile != 0 && mnSdPageCount > 1)
2414 aButton = CreateLink(u"JavaScript:parent.NavigateRel(-1)", aButton);
2415
2416 aStr.append(aButton
2417 + "\r\n");
2418
2419 // to the next page
2420 aButton = SdResId(STR_PUBLISH_NEXT);
2421 if(mnButtonThema != -1)
2422 aButton = CreateImage(GetButtonName(nFile ==2 || mnSdPageCount == 1?
2424 aButton);
2425
2426 if(nFile != 2 && mnSdPageCount > 1)
2427 aButton = CreateLink(u"JavaScript:parent.NavigateRel(1)", aButton);
2428
2429 aStr.append(aButton
2430 + "\r\n");
2431
2432 // to the last page
2433 aButton = SdResId(STR_HTMLEXP_LASTPAGE);
2434 if(mnButtonThema != -1)
2435 aButton = CreateImage(GetButtonName(nFile ==2 || mnSdPageCount == 1?
2437 aButton);
2438
2439 if(nFile != 2 && mnSdPageCount > 1)
2440 {
2441 OUString aLink("JavaScript:parent.NavigateAbs(" +
2442 OUString::number(mnSdPageCount-1) + ")");
2443
2444 aButton = CreateLink(aLink, aButton);
2445 }
2446
2447 aStr.append(aButton
2448 + "\r\n");
2449
2450 // content
2451 if (mbContentsPage)
2452 {
2453 aButton = SdResId(STR_PUBLISH_OUTLINE);
2454 if(mnButtonThema != -1)
2455 aButton = CreateImage(GetButtonName(BTN_INDEX), aButton);
2456
2457 // to the overview
2458 aStr.append(CreateLink(maIndex, aButton, u"_top")
2459 + "\r\n");
2460 }
2461
2462 // text mode
2463 if(mbImpress)
2464 {
2465 aButton = SdResId(STR_HTMLEXP_SETTEXT);
2466 if(mnButtonThema != -1)
2467 aButton = CreateImage(GetButtonName(BTN_TEXT), aButton);
2468
2469 OUString aText0("text0" + gaHTMLExtension);
2470 aStr.append(CreateLink(aText0, aButton, u"_top")
2471 + "\r\n");
2472 }
2473
2474 // and finished...
2475 aStr.append(
2476 "</center>\r\n"
2477 "</body>\r\n</html>");
2478
2479 OUString aFileName("navbar" + OUString::number(nFile));
2480
2481 bOk = WriteHtml(aFileName, true, aStr);
2482 aStr.setLength(0);
2483
2484 if (mpProgress)
2485 mpProgress->SetState(++mnPagesWritten);
2486 }
2487
2488 // the navigation bar outliner closed...
2489 if(bOk)
2490 {
2491 aButton = SdResId(STR_HTMLEXP_OUTLINE);
2492 if(mnButtonThema != -1)
2493 aButton = CreateImage(GetButtonName(BTN_MORE), aButton);
2494
2495 bOk = WriteHtml(
2496 "navbar3", true,
2497 Concat2View(
2498 gaHTMLHeader + CreateMetaCharset() + " <title>"
2499 + StringToHTMLString(maPageNames[0]) + "</title>\r\n</head>\r\n" + CreateBodyTag()
2500 + CreateLink(u"JavaScript:parent.ExpandOutline()", aButton)
2501 + "</body>\r\n</html>"));
2502
2503 if (mpProgress)
2504 mpProgress->SetState(++mnPagesWritten);
2505 }
2506
2507 // ... and the outliner open
2508 if( bOk )
2509 {
2510 aButton = SdResId(STR_HTMLEXP_NOOUTLINE);
2511 if(mnButtonThema != -1)
2512 aButton = CreateImage(GetButtonName(BTN_LESS), aButton);
2513
2514 bOk = WriteHtml(
2515 "navbar4", true,
2516 Concat2View(
2517 gaHTMLHeader + CreateMetaCharset() + " <title>"
2518 + StringToHTMLString(maPageNames[0]) + "</title>\r\n</head>\r\n" + CreateBodyTag()
2519 + CreateLink(u"JavaScript:parent.CollapseOutline()", aButton)
2520 + "</body>\r\n</html>"));
2521
2522 if (mpProgress)
2523 mpProgress->SetState(++mnPagesWritten);
2524
2525 }
2526
2527 return bOk;
2528}
2529
2530// create button bar for standard
2531OUString HtmlExport::CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const
2532{
2533 // prepare button bar
2534 OUString aStrNavFirst(SdResId(STR_HTMLEXP_FIRSTPAGE));
2535 OUString aStrNavPrev(SdResId(STR_PUBLISH_BACK));
2536 OUString aStrNavNext(SdResId(STR_PUBLISH_NEXT));
2537 OUString aStrNavLast(SdResId(STR_HTMLEXP_LASTPAGE));
2538 OUString aStrNavContent(SdResId(STR_PUBLISH_OUTLINE));
2539 OUString aStrNavText;
2540 if( bIsText )
2541 {
2542 aStrNavText = SdResId(STR_HTMLEXP_SETGRAPHIC);
2543 }
2544 else
2545 {
2546 aStrNavText = SdResId(STR_HTMLEXP_SETTEXT);
2547 }
2548
2549 if(!bIsText && mnButtonThema != -1)
2550 {
2551 if(nSdPage<1 || mnSdPageCount == 1)
2552 {
2553 aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_0), aStrNavFirst);
2554 aStrNavPrev = CreateImage(GetButtonName(BTN_PREV_0), aStrNavPrev);
2555 }
2556 else
2557 {
2558 aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_1), aStrNavFirst);
2559 aStrNavPrev = CreateImage(GetButtonName(BTN_PREV_1), aStrNavPrev);
2560 }
2561
2562 if(nSdPage == mnSdPageCount-1 || mnSdPageCount == 1)
2563 {
2564 aStrNavNext = CreateImage(GetButtonName(BTN_NEXT_0), aStrNavNext);
2565 aStrNavLast = CreateImage(GetButtonName(BTN_LAST_0), aStrNavLast);
2566 }
2567 else
2568 {
2569 aStrNavNext = CreateImage(GetButtonName(BTN_NEXT_1), aStrNavNext);
2570 aStrNavLast = CreateImage(GetButtonName(BTN_LAST_1), aStrNavLast);
2571 }
2572
2573 aStrNavContent = CreateImage(GetButtonName(BTN_INDEX), aStrNavContent);
2574 aStrNavText = CreateImage(GetButtonName(BTN_TEXT), aStrNavText);
2575 }
2576
2577 OUStringBuffer aStr("<center>\r\n"); //<table><tr>\r\n");
2578
2579 // first page
2580 if(nSdPage > 0)
2581 aStr.append(CreateLink( bIsText ? maTextFiles[0] : maHTMLFiles[0],aStrNavFirst));
2582 else
2583 aStr.append(aStrNavFirst);
2584 aStr.append(' ');
2585
2586 // to Previous page
2587 if(nSdPage > 0)
2588 aStr.append(CreateLink( bIsText ? maTextFiles[nSdPage-1]
2589 : maHTMLFiles[nSdPage-1], aStrNavPrev));
2590 else
2591 aStr.append(aStrNavPrev);
2592 aStr.append(' ');
2593
2594 // to Next page
2595 if(nSdPage < mnSdPageCount-1)
2596 aStr.append(CreateLink( bIsText ? maTextFiles[nSdPage+1]
2597 : maHTMLFiles[nSdPage+1], aStrNavNext));
2598 else
2599 aStr.append(aStrNavNext);
2600 aStr.append(' ');
2601
2602 // to Last page
2603 if(nSdPage < mnSdPageCount-1)
2604 aStr.append(CreateLink( bIsText ? maTextFiles[mnSdPageCount-1]
2606 aStrNavLast));
2607 else
2608 aStr.append(aStrNavLast);
2609 aStr.append(' ');
2610
2611 // to Index page
2612 if (mbContentsPage)
2613 {
2614 aStr.append(CreateLink(maIndex, aStrNavContent) + " ");
2615 }
2616
2617 // Text/Graphics
2618 if(mbImpress)
2619 {
2620 aStr.append(CreateLink( bIsText ? (mbFrames ? maFramePage : maHTMLFiles[nSdPage])
2621 : maTextFiles[nSdPage], aStrNavText));
2622
2623 }
2624
2625 aStr.append("</center><br>\r\n");
2626
2627 return aStr.makeStringAndClear();
2628}
2629
2630// export navigation graphics from button set
2632{
2633 if(mnButtonThema == -1 || !mpButtonSet)
2634 return;
2635
2636 for( int nButton = 0; nButton != SAL_N_ELEMENTS(pButtonNames); nButton++ )
2637 {
2638 if(!mbFrames && (nButton == BTN_MORE || nButton == BTN_LESS))
2639 continue;
2640
2641 if(!mbImpress && (nButton == BTN_TEXT || nButton == BTN_MORE || nButton == BTN_LESS ))
2642 continue;
2643
2644 OUString aFull = maExportPath + GetButtonName(nButton);
2645 mpButtonSet->exportButton( mnButtonThema, aFull, GetButtonName(nButton) );
2646 }
2647}
2648
2649// creates the <body> tag, including the specified color attributes
2651{
2652 OUStringBuffer aStr( "<body" );
2653
2654 if( mbUserAttr || mbDocColors )
2655 {
2656 Color aTextColor( maTextColor );
2657 if( (aTextColor == COL_AUTO) && (!maBackColor.IsDark()) )
2658 aTextColor = COL_BLACK;
2659
2660 aStr.append(" text=\""
2661 + ColorToHTMLString( aTextColor )
2662 + "\" bgcolor=\""
2664 + "\" link=\""
2666 + "\" vlink=\""
2668 + "\" alink=\""
2670 + "\"");
2671 }
2672
2673 aStr.append(">\r\n");
2674
2675 return aStr.makeStringAndClear();
2676}
2677
2678// creates a hyperlink
2679OUString HtmlExport::CreateLink( std::u16string_view aLink,
2680 std::u16string_view aText,
2681 std::u16string_view aTarget )
2682{
2683 OUStringBuffer aStr( OUString::Concat("<a href=\"") + aLink);
2684 if (!aTarget.empty())
2685 {
2686 aStr.append(OUString::Concat("\" target=\"") + aTarget);
2687 }
2688 aStr.append(OUString::Concat("\">") + aText + "</a>");
2689
2690 return aStr.makeStringAndClear();
2691}
2692
2693// creates an image tag
2694OUString HtmlExport::CreateImage( std::u16string_view aImage, std::u16string_view aAltText )
2695{
2696 OUStringBuffer aStr( OUString::Concat("<img src=\"") + aImage + "\" border=0");
2697
2698 if (!aAltText.empty())
2699 {
2700 aStr.append(OUString::Concat(" alt=\"") + aAltText + "\"");
2701 }
2702 else
2703 {
2704 // Agerskov: HTML 4.01 has to have an alt attribute even if it is an empty string
2705 aStr.append(" alt=\"\"");
2706 }
2707
2708 aStr.append('>');
2709
2710 return aStr.makeStringAndClear();
2711}
2712
2713// create area for a circle; we expect pixel coordinates
2715{
2716 static const char hex[] = "0123456789ABCDEF";
2717 OUStringBuffer aStr( "#xxxxxx" );
2718 aStr[1] = hex[(aColor.GetRed() >> 4) & 0xf];
2719 aStr[2] = hex[aColor.GetRed() & 0xf];
2720 aStr[3] = hex[(aColor.GetGreen() >> 4) & 0xf];
2721 aStr[4] = hex[aColor.GetGreen() & 0xf];
2722 aStr[5] = hex[(aColor.GetBlue() >> 4) & 0xf];
2723 aStr[6] = hex[aColor.GetBlue() & 0xf];
2724
2725 return aStr.makeStringAndClear();
2726}
2727
2728// create area for a circle; we expect pixel coordinates
2730 sal_uLong nCenterX,
2731 sal_uLong nCenterY,
2732 std::u16string_view rHRef )
2733{
2734 OUString aStr(
2735 "<area shape=\"circle\" alt=\"\" coords=\"" +
2736 OUString::number(nCenterX) + "," +
2737 OUString::number(nCenterY) + "," +
2738 OUString::number(nRadius) +
2739 "\" href=\"" + rHRef + "\">\n");
2740
2741 return aStr;
2742}
2743
2744// create area for a polygon; we expect pixel coordinates
2745OUString HtmlExport::CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPolygon,
2746 Size aShift, double fFactor, std::u16string_view rHRef )
2747{
2748 OUStringBuffer aStr;
2749 const sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
2750
2751 for ( sal_uInt32 nXPoly = 0; nXPoly < nNoOfPolygons; nXPoly++ )
2752 {
2753 const ::basegfx::B2DPolygon& aPolygon = rPolyPolygon.getB2DPolygon(nXPoly);
2754 const sal_uInt32 nNoOfPoints(aPolygon.count());
2755
2756 aStr.append("<area shape=\"polygon\" alt=\"\" coords=\"");
2757
2758 for ( sal_uInt32 nPoint = 0; nPoint < nNoOfPoints; nPoint++ )
2759 {
2760 const ::basegfx::B2DPoint aB2DPoint(aPolygon.getB2DPoint(nPoint));
2761 Point aPnt(FRound(aB2DPoint.getX()), FRound(aB2DPoint.getY()));
2762 // coordinates are relative to the physical page origin, not the
2763 // origin of ordinates
2764 aPnt.Move(aShift.Width(), aShift.Height());
2765
2766 aPnt.setX( static_cast<tools::Long>(aPnt.X() * fFactor) );
2767 aPnt.setY( static_cast<tools::Long>(aPnt.Y() * fFactor) );
2768 aStr.append( OUString::number(aPnt.X()) + "," + OUString::number(aPnt.Y()) );
2769
2770 if (nPoint < nNoOfPoints - 1)
2771 aStr.append(',');
2772 }
2773 aStr.append(OUString::Concat("\" href=\"") + rHRef + "\">\n");
2774 }
2775
2776 return aStr.makeStringAndClear();
2777}
2778
2779// create area for a rectangle; we expect pixel coordinates
2780OUString HtmlExport::CreateHTMLRectArea( const ::tools::Rectangle& rRect,
2781 std::u16string_view rHRef )
2782{
2783 OUString aStr(
2784 "<area shape=\"rect\" alt=\"\" coords=\"" +
2785 OUString::number(rRect.Left()) + "," +
2786 OUString::number(rRect.Top()) + "," +
2787 OUString::number(rRect.Right()) + "," +
2788 OUString::number(rRect.Bottom()) +
2789 "\" href=\"" + rHRef + "\">\n");
2790
2791 return aStr;
2792}
2793
2794// escapes a string for html
2795OUString HtmlExport::StringToHTMLString( const OUString& rString )
2796{
2797 SvMemoryStream aMemStm;
2798 HTMLOutFuncs::Out_String( aMemStm, rString );
2799 aMemStm.WriteChar( char(0) );
2800 sal_Int32 nLength = strlen(static_cast<char const *>(aMemStm.GetData()));
2801 return OUString( static_cast<char const *>(aMemStm.GetData()), nLength, RTL_TEXTENCODING_UTF8 );
2802}
2803
2804// creates a URL for a specific page
2805OUString HtmlExport::CreatePageURL( sal_uInt16 nPgNum )
2806{
2807 if(mbFrames)
2808 {
2809 return OUString("JavaScript:parent.NavigateAbs(" +
2810 OUString::number(nPgNum) + ")");
2811 }
2812 else
2813 return maHTMLFiles[nPgNum];
2814}
2815
2816bool HtmlExport::CopyScript( std::u16string_view rPath, const OUString& rSource, const OUString& rDest, bool bUnix /* = false */ )
2817{
2818 INetURLObject aURL( SvtPathOptions().GetConfigPath() );
2819 OUStringBuffer aScriptBuf;
2820
2821 aURL.Append( u"webcast" );
2822 aURL.Append( rSource );
2823
2824 meEC.SetContext( STR_HTMLEXP_ERROR_OPEN_FILE, rSource );
2825
2826 ErrCode nErr = ERRCODE_NONE;
2827 std::unique_ptr<SvStream> pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ );
2828
2829 if( pIStm )
2830 {
2831 OStringBuffer aLine;
2832
2833 while( pIStm->ReadLine( aLine ) )
2834 {
2835 aScriptBuf.appendAscii( aLine.getStr(), aLine.getLength() );
2836 if( bUnix )
2837 {
2838 aScriptBuf.append("\n");
2839 }
2840 else
2841 {
2842 aScriptBuf.append("\r\n");
2843 }
2844 }
2845
2846 nErr = pIStm->GetError();
2847 pIStm.reset();
2848 }
2849
2850 if( nErr != ERRCODE_NONE )
2851 {
2853 return static_cast<bool>(nErr);
2854 }
2855
2856 OUString aScript(aScriptBuf.makeStringAndClear());
2857 aScript = aScript.replaceAll("$$1", getDocumentTitle());
2858 aScript = aScript.replaceAll("$$2", RESTOHTML(STR_WEBVIEW_SAVE));
2859 aScript = aScript.replaceAll("$$3", maCGIPath);
2860 aScript = aScript.replaceAll("$$4", OUString::number(mnWidthPixel));
2861 aScript = aScript.replaceAll("$$5", OUString::number(mnHeightPixel));
2862
2863 OUString aDest(rPath + rDest);
2864
2865 meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rDest );
2866 // write script file
2867 {
2868 EasyFile aFile;
2869 SvStream* pStr;
2870 nErr = aFile.createStream(aDest, pStr);
2871 if(nErr == ERRCODE_NONE)
2872 {
2873 OString aStr(OUStringToOString(aScript, RTL_TEXTENCODING_UTF8));
2874 pStr->WriteOString( aStr );
2875 aFile.close();
2876 }
2877 }
2878
2879 if (mpProgress)
2880 mpProgress->SetState(++mnPagesWritten);
2881
2882 if( nErr != ERRCODE_NONE )
2884
2885 return nErr == ERRCODE_NONE;
2886}
2887
2888static const char * ASP_Scripts[] = { "common.inc", "webcast.asp", "show.asp", "savepic.asp", "poll.asp", "editpic.asp" };
2889
2892{
2893 for(const char * p : ASP_Scripts)
2894 {
2895 OUString aScript = OUString::createFromAscii(p);
2896
2897 if(!CopyScript(maExportPath, aScript, aScript))
2898 return false;
2899 }
2900
2901 return CopyScript(maExportPath, "edit.asp", maIndex);
2902}
2903
2904static const char *PERL_Scripts[] = { "webcast.pl", "common.pl", "editpic.pl", "poll.pl", "savepic.pl", "show.pl" };
2905
2906// creates and saves the PERL scripts for WebShow
2908{
2909 for(const char * p : PERL_Scripts)
2910 {
2911 OUString aScript = OUString::createFromAscii(p);
2912
2913 if(!CopyScript(maExportPath, aScript, aScript, true))
2914 return false;
2915 }
2916
2917 if (!CopyScript(maExportPath, "edit.pl", maIndex, true))
2918 return false;
2919
2920 if (!CopyScript(maExportPath, "index.pl", maIndexUrl, true))
2921 return false;
2922
2923 return true;
2924}
2925
2926// creates a list with names of the saved images
2928{
2929 OUStringBuffer aStr;
2930 for( sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
2931 {
2932 aStr.append(
2933 OUString::number(static_cast<sal_Int32>(nSdPage + 1))
2934 + ";"
2935 + maURLPath
2936 + maImageFiles[nSdPage]
2937 + "\r\n");
2938 }
2939
2940 bool bOk = WriteHtml("picture.txt", false, aStr);
2941
2942 if (mpProgress)
2943 mpProgress->SetState(++mnPagesWritten);
2944
2945 return bOk;
2946}
2947
2948// creates a file with the actual page number
2950{
2951 OUString aFileName("currpic.txt");
2952 OUString aFull(maExportPath + aFileName);
2953
2954 meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, aFileName );
2955 EasyFile aFile;
2956 SvStream* pStr;
2957 ErrCode nErr = aFile.createStream(aFull, pStr);
2958 if(nErr == ERRCODE_NONE)
2959 {
2960 pStr->WriteOString( "1" );
2961 aFile.close();
2962 }
2963
2964 if (mpProgress)
2965 mpProgress->SetState(++mnPagesWritten);
2966
2967 if( nErr != ERRCODE_NONE )
2969
2970 return nErr == ERRCODE_NONE;
2971}
2972
2973OUString HtmlExport::InsertSound( const OUString& rSoundFile )
2974{
2975 if (rSoundFile.isEmpty())
2976 return rSoundFile;
2977
2978 INetURLObject aURL( rSoundFile );
2979 OUString aSoundFileName = aURL.getName();
2980
2981 DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
2982
2983 OUString aStr("<embed src=\"" + aSoundFileName +
2984 "\" hidden=\"true\" autostart=\"true\">");
2985
2986 CopyFile(rSoundFile, maExportPath + aSoundFileName);
2987
2988 return aStr;
2989}
2990
2991bool HtmlExport::CopyFile( const OUString& rSourceFile, const OUString& rDestFile )
2992{
2993 meEC.SetContext( STR_HTMLEXP_ERROR_COPY_FILE, rSourceFile, rDestFile );
2994 osl::FileBase::RC Error = osl::File::copy( rSourceFile, rDestFile );
2995
2996 if( Error != osl::FileBase::E_None )
2997 {
2999 return false;
3000 }
3001 else
3002 {
3003 return true;
3004 }
3005}
3006
3007bool HtmlExport::checkFileExists( Reference< css::ucb::XSimpleFileAccess3 > const & xFileAccess, std::u16string_view aFileName )
3008{
3009 try
3010 {
3011 OUString url = maExportPath + aFileName;
3012 return xFileAccess->exists( url );
3013 }
3014 catch( css::uno::Exception& )
3015 {
3016 TOOLS_WARN_EXCEPTION( "sd", "sd::HtmlExport::checkFileExists()" );
3017 }
3018
3019 return false;
3020}
3021
3023{
3024 bool bFound = false;
3025
3026 try
3027 {
3028 Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
3029 uno::Reference<ucb::XSimpleFileAccess3> xFA(ucb::SimpleFileAccess::create(xContext));
3030
3031 sal_uInt16 nSdPage;
3032 for( nSdPage = 0; !bFound && (nSdPage < mnSdPageCount); nSdPage++)
3033 {
3034 if( checkFileExists( xFA, maImageFiles[nSdPage] ) ||
3035 checkFileExists( xFA, maHTMLFiles[nSdPage] ) ||
3036 checkFileExists( xFA, maThumbnailFiles[nSdPage] ) ||
3037 checkFileExists( xFA, maPageNames[nSdPage] ) ||
3038 checkFileExists( xFA, maTextFiles[nSdPage] ) )
3039 {
3040 bFound = true;
3041 }
3042 }
3043
3044 if( !bFound && mbDownload )
3045 bFound = checkFileExists( xFA, maDocFileName );
3046
3047 if( !bFound && mbFrames )
3048 bFound = checkFileExists( xFA, maFramePage );
3049
3050 if( bFound )
3051 {
3052 OUString aSystemPath;
3053 osl::FileBase::getSystemPathFromFileURL( maExportPath, aSystemPath );
3054 OUString aMsg(SdResId(STR_OVERWRITE_WARNING));
3055 aMsg = aMsg.replaceFirst( "%FILENAME", aSystemPath );
3056
3057 std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
3058 VclMessageType::Warning, VclButtonsType::YesNo,
3059 aMsg));
3060 xWarn->set_default_response(RET_YES);
3061 bFound = (RET_NO == xWarn->run());
3062 }
3063 }
3064 catch( Exception& )
3065 {
3066 TOOLS_WARN_EXCEPTION( "sd", "sd::HtmlExport::checkForExistingFiles()" );
3067 bFound = false;
3068 }
3069
3070 return bFound;
3071}
3072
3073OUString HtmlExport::GetButtonName( int nButton )
3074{
3075 return OUString::createFromAscii(pButtonNames[nButton]);
3076}
3077
3078EasyFile::EasyFile() : bOpen(false)
3079{
3080}
3081
3082EasyFile::~EasyFile()
3083{
3084 if( bOpen )
3085 close();
3086}
3087
3088ErrCode EasyFile::createStream( const OUString& rUrl, SvStream* &rpStr )
3089{
3090 if(bOpen)
3091 close();
3092
3093 OUString aFileName;
3094 createFileName( rUrl, aFileName );
3095
3096 ErrCode nErr = ERRCODE_NONE;
3097 pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, StreamMode::WRITE | StreamMode::TRUNC );
3098 if( pOStm )
3099 {
3100 bOpen = true;
3101 nErr = pOStm->GetError();
3102 }
3103 else
3104 {
3106 }
3107
3108 if( nErr != ERRCODE_NONE )
3109 {
3110 bOpen = false;
3111 pOStm.reset();
3112 }
3113
3114 rpStr = pOStm.get();
3115
3116 return nErr;
3117}
3118
3119void EasyFile::createFileName( const OUString& rURL, OUString& rFileName )
3120{
3121 if( bOpen )
3122 close();
3123
3124 INetURLObject aURL( rURL );
3125
3126 if( aURL.GetProtocol() == INetProtocol::NotValid )
3127 {
3128 OUString aURLStr;
3129 osl::FileBase::getFileURLFromSystemPath( rURL, aURLStr );
3130 aURL = INetURLObject( aURLStr );
3131 }
3132 DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
3133 rFileName = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
3134}
3135
3136void EasyFile::close()
3137{
3138 pOStm.reset();
3139 bOpen = false;
3140}
3141
3142// This class helps reporting errors during file i/o
3144 : ErrorContext(nullptr)
3145{
3146}
3147
3148bool HtmlErrorContext::GetString( ErrCode, OUString& rCtxStr )
3149{
3150 DBG_ASSERT(mpResId, "No error context set");
3151 if (!mpResId)
3152 return false;
3153
3154 rCtxStr = SdResId(mpResId);
3155
3156 rCtxStr = rCtxStr.replaceAll( "$(URL1)", maURL1 );
3157 rCtxStr = rCtxStr.replaceAll( "$(URL2)", maURL2 );
3158
3159 return true;
3160}
3161
3162void HtmlErrorContext::SetContext(TranslateId pResId, const OUString& rURL)
3163{
3164 mpResId = pResId;
3165 maURL1 = rURL;
3166 maURL2.clear();
3167}
3168
3169void HtmlErrorContext::SetContext(TranslateId pResId, const OUString& rURL1, const OUString& rURL2 )
3170{
3171 mpResId = pResId;
3172 maURL1 = rURL1;
3173 maURL2 = rURL2;
3174}
3175
3176/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
Any maPath
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt8 GetBlue() const
bool IsDark() const
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
OUString GetText(LineEnd eEnd=LINEEND_LF) const
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
SfxItemSet GetAttribs(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags=GetAttribsFlags::ALL) const
virtual OUString GetText(sal_Int32 nPara) const=0
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
virtual bool GetString(ErrCode nErrId, OUString &rCtxStr) override
Definition: htmlex.cxx:3148
void SetContext(TranslateId pResId, const OUString &rURL)
Definition: htmlex.cxx:3162
OUString maURL1
Definition: htmlex.hxx:68
OUString maURL2
Definition: htmlex.hxx:69
TranslateId mpResId
Definition: htmlex.hxx:67
bool mbImpress
Definition: htmlex.hxx:95
bool mbEndless
Definition: htmlex.hxx:121
OUString DocumentMetadata() const
Output document metadata.
Definition: htmlex.cxx:1053
std::vector< OUString > maThumbnailFiles
Definition: htmlex.hxx:134
static OUString CreateHTMLPolygonArea(const ::basegfx::B2DPolyPolygon &rPolyPoly, Size aShift, double fFactor, std::u16string_view rHRef)
Definition: htmlex.cxx:2745
bool mbHeader
Definition: htmlex.hxx:103
void WriteObjectGroup(OUStringBuffer &aStr, SdrObjGroup const *pObjectGroup, SdrOutliner *pOutliner, const Color &rBackgroundColor, bool bHeadLine)
Definition: htmlex.cxx:1277
bool mbUserAttr
Definition: htmlex.hxx:123
bool mbAutoSlide
Definition: htmlex.hxx:117
static OUString CreateImage(std::u16string_view aImage, std::u16string_view aAltText)
Definition: htmlex.cxx:2694
void ExportSingleDocument()
Definition: htmlex.cxx:624
void WriteTable(OUStringBuffer &aStr, sdr::table::SdrTableObj const *pTableObject, SdrOutliner *pOutliner, const Color &rBackgroundColor)
Definition: htmlex.cxx:1249
PublishingFormat meFormat
Definition: htmlex.hxx:102
PublishingScript meScript
Definition: htmlex.hxx:142
sal_uInt16 mnSdPageCount
Definition: htmlex.hxx:96
OUString TextAttribToHTMLString(SfxItemSet const *pSet, HtmlState *pState, const Color &rBackgroundColor)
Definition: htmlex.cxx:1430
void CreateBitmaps()
Definition: htmlex.cxx:2631
OUString const & getDocumentTitle()
Definition: htmlex.cxx:2172
static OUString GetButtonName(int nButton)
Definition: htmlex.cxx:3073
std::vector< OUString > maHTMLFiles
Definition: htmlex.hxx:132
bool CreateOutlinePages()
Definition: htmlex.cxx:2056
sal_Int16 mnButtonThema
Definition: htmlex.hxx:99
static OUString CreateHTMLCircleArea(sal_uLong nRadius, sal_uLong nCenterX, sal_uLong nCenterY, std::u16string_view rHRef)
Definition: htmlex.cxx:2729
std::vector< SdPage * > maPages
Definition: htmlex.hxx:83
OUString maInfo
Definition: htmlex.hxx:110
void ExportHtml()
Definition: htmlex.cxx:694
::sd::DrawDocShell * mpDocSh
Definition: htmlex.hxx:89
bool CreateASPScripts()
creates and saves the ASP scripts for WebShow
Definition: htmlex.cxx:2891
~HtmlExport()
Definition: htmlex.cxx:398
bool CreateHtmlForPresPages()
Definition: htmlex.cxx:1518
OUString CreateTextForTitle(SdrOutliner *pOutliner, SdPage *pPage, const Color &rBackgroundColor)
creates an outliner text for the title objects of a page
Definition: htmlex.cxx:1170
bool CreatePERLScripts()
Definition: htmlex.cxx:2907
void WriteOutlinerParagraph(OUStringBuffer &aStr, SdrOutliner *pOutliner, OutlinerParaObject const *pOutlinerParagraphObject, const Color &rBackgroundColor, bool bHeadLine)
Definition: htmlex.cxx:1300
bool SavePresentation()
Definition: htmlex.cxx:924
std::unique_ptr< SfxProgress > mpProgress
Definition: htmlex.hxx:94
sal_Int16 mnCompression
Definition: htmlex.hxx:111
OUString CreatePageURL(sal_uInt16 nPgNum)
Definition: htmlex.cxx:2805
OUString ParagraphToHTMLString(SdrOutliner const *pOutliner, sal_Int32 nPara, const Color &rBackgroundColor)
Definition: htmlex.cxx:1390
OUString mDocTitle
Definition: htmlex.hxx:114
std::vector< OUString > maPageNames
Definition: htmlex.hxx:135
Color maLinkColor
Definition: htmlex.hxx:126
bool mbContentsPage
Definition: htmlex.hxx:98
sal_uInt16 mnHeightPixel
Definition: htmlex.hxx:101
void InitProgress(sal_uInt16 nProgrCount)
Definition: htmlex.cxx:836
bool CreateImageNumberFile()
Definition: htmlex.cxx:2949
OUString maHomePage
Definition: htmlex.hxx:109
SdDrawDocument * mpDoc
Definition: htmlex.hxx:88
static OUString CreateLink(std::u16string_view aLink, std::u16string_view aText, std::u16string_view aTarget=std::u16string_view())
Definition: htmlex.cxx:2679
std::vector< SdPage * > maNotesPages
Definition: htmlex.hxx:84
std::vector< OUString > maImageFiles
Definition: htmlex.hxx:133
bool CreateContentPage()
Definition: htmlex.cxx:1887
OUString CreateTextForPage(SdrOutliner *pOutliner, SdPage const *pPage, bool bHeadLine, const Color &rBackgroundColor)
Definition: htmlex.cxx:1191
OUString maExportPath
output directory or URL.
Definition: htmlex.hxx:138
Color maTextColor
The following colors are used for the <body> tag if mbUserAttr is true.
Definition: htmlex.hxx:124
HtmlExport(OUString aPath, const css::uno::Sequence< css::beans::PropertyValue > &rParams, SdDrawDocument *pExpDoc, sd::DrawDocShell *pDocShell)
Definition: htmlex.cxx:346
bool mbHiddenSlides
Definition: htmlex.hxx:120
void SetDocColors(SdPage *pPage=nullptr)
Definition: htmlex.cxx:793
bool CreateNotesPages()
Definition: htmlex.cxx:2018
bool CreateHtmlTextForPresPages()
Definition: htmlex.cxx:1075
Color maBackColor
Definition: htmlex.hxx:125
static OUString CreateMetaCharset()
Output only the charset metadata, title etc. will be handled separately.
Definition: htmlex.cxx:1041
OUString CreateNavBar(sal_uInt16 nSdPage, bool bIsText) const
Definition: htmlex.cxx:2531
void CreateFileNames()
Definition: htmlex.cxx:2115
static OUString CreateHTMLRectArea(const ::tools::Rectangle &rRect, std::u16string_view rHRef)
Definition: htmlex.cxx:2780
bool CreateImagesForPresPages(bool bThumbnails=false)
Definition: htmlex.cxx:958
bool CreateFrames()
Definition: htmlex.cxx:2260
sal_uInt16 mnWidthPixel
Definition: htmlex.hxx:100
OUString CreateBodyTag() const
Definition: htmlex.cxx:2650
void ExportWebCast()
Definition: htmlex.cxx:862
sal_uInt16 mnPagesWritten
Definition: htmlex.hxx:97
bool CreateImageFileList()
Definition: htmlex.cxx:2927
static OUString StringToHTMLString(const OUString &rString)
Definition: htmlex.cxx:2795
HtmlErrorContext meEC
Definition: htmlex.hxx:91
static SdrTextObj * GetLayoutTextObject(SdrPage const *pPage)
Definition: htmlex.cxx:1022
bool CreateNavBarFrames()
Definition: htmlex.cxx:2372
OUString maDocFileName
Definition: htmlex.hxx:112
bool checkForExistingFiles()
Definition: htmlex.cxx:3022
OUString maAuthor
Definition: htmlex.hxx:108
bool mbNotes
Definition: htmlex.hxx:104
bool mbDownload
Definition: htmlex.hxx:115
Color maVLinkColor
Definition: htmlex.hxx:127
Color maALinkColor
Definition: htmlex.hxx:128
OUString maPath
Definition: htmlex.hxx:86
OUString maIndexUrl
Definition: htmlex.hxx:139
bool checkFileExists(css::uno::Reference< css::ucb::XSimpleFileAccess3 > const &xFileAccess, std::u16string_view aFileName)
Definition: htmlex.cxx:3007
OUString maFramePage
Definition: htmlex.hxx:113
bool CopyScript(std::u16string_view rPath, const OUString &rSource, const OUString &rDest, bool bUnix=false)
Definition: htmlex.cxx:2816
std::vector< OUString > maTextFiles
Definition: htmlex.hxx:136
OUString CreateTextForNotesPage(SdrOutliner *pOutliner, SdPage *pPage, const Color &rBackgroundColor)
Definition: htmlex.cxx:1360
void InitExportParameters(const css::uno::Sequence< css::beans::PropertyValue > &rParams)
Definition: htmlex.cxx:403
Color maFirstPageColor
Definition: htmlex.hxx:129
void ExportKiosk()
Definition: htmlex.cxx:846
OUString maURLPath
Definition: htmlex.hxx:140
bool mbDocColors
Definition: htmlex.hxx:130
double mfSlideDuration
Definition: htmlex.hxx:118
OUString maIndex
Definition: htmlex.hxx:106
bool CopyFile(const OUString &rSourceFile, const OUString &rDestFile)
Definition: htmlex.cxx:2991
bool WriteHtml(const OUString &rFileName, bool bAddExtension, std::u16string_view rHtmlData)
exports the given html data into a non unicode file in the current export path with the given filenam...
Definition: htmlex.cxx:1142
bool mbFrames
Definition: htmlex.hxx:105
bool mbSlideSound
Definition: htmlex.hxx:119
OUString maCGIPath
Definition: htmlex.hxx:141
OUString InsertSound(const OUString &rSoundFile)
Definition: htmlex.cxx:2973
std::unique_ptr< ButtonSet > mpButtonSet
Definition: htmlex.hxx:144
static OUString ColorToHTMLString(Color aColor)
Definition: htmlex.cxx:2714
void ResetProgress()
Definition: htmlex.cxx:841
HtmlPublishMode meMode
Definition: htmlex.hxx:93
OUString maEMail
Definition: htmlex.hxx:107
bool mbWeight
Definition: htmlex.cxx:148
OUString SetUnderline(bool bUnderline)
Definition: htmlex.cxx:226
Color maColor
Definition: htmlex.cxx:153
bool mbColor
Definition: htmlex.cxx:147
OUString Flush()
Definition: htmlex.cxx:171
OUString SetStrikeout(bool bStrike)
Definition: htmlex.cxx:240
bool mbLink
Definition: htmlex.cxx:152
bool mbStrike
Definition: htmlex.cxx:151
HtmlState(Color aDefColor)
Definition: htmlex.cxx:184
bool mbUnderline
Definition: htmlex.cxx:150
OUString SetWeight(bool bWeight)
Definition: htmlex.cxx:196
OUString SetLink(const OUString &aLink, const OUString &aTarget)
Definition: htmlex.cxx:278
bool mbItalic
Definition: htmlex.cxx:149
OUString maLink
Definition: htmlex.cxx:155
Color maDefColor
Definition: htmlex.cxx:154
OUString SetItalic(bool bItalic)
Definition: htmlex.cxx:211
OUString SetColor(Color aColor)
Definition: htmlex.cxx:254
OUString maTarget
Definition: htmlex.cxx:156
virtual IMapObjectType GetType() const=0
const OUString & GetURL() const
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetPartBeforeLastName() const
INetProtocol GetProtocol() const
IMapObject * GetIMapObject(size_t nPos) const
size_t GetIMapObjectCount() const
const EditTextObject & GetTextObject() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void setY(tools::Long nY)
constexpr tools::Long X() const
css::presentation::ClickAction meClickAction
Action at mouse click.
Definition: anminfo.hxx:48
OUString GetBookmark() const
Definition: anminfo.cxx:110
SAL_DLLPRIVATE const sd::PresentationSettings & getPresentationSettings() const
Definition: drawdoc.hxx:400
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
Definition: drawdoc2.cxx:207
SdOutliner * GetInternalOutliner(bool bCreateOutliner=true)
Definition: drawdoc.cxx:930
SAL_DLLPRIVATE sal_uInt16 GetPageByName(std::u16string_view rPgName, bool &rbIsMasterPage) const
Return the first page that has the given name.
Definition: drawdoc2.cxx:126
static SAL_DLLPRIVATE SdAnimationInfo * GetAnimationInfo(SdrObject *pObject)
deprecated
Definition: drawdoc2.cxx:950
SAL_DLLPRIVATE SdrObject * GetObj(std::u16string_view rObjName) const
Definition: drawdoc2.cxx:66
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
Definition: drawdoc.cxx:658
SAL_DLLPRIVATE DocumentType GetDocumentType() const
Definition: drawdoc.hxx:251
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
Definition: drawdoc2.cxx:212
SdrObject * GetPresObj(PresObjKind eObjKind, int nIndex=1, bool bFuzzySearch=false)
returns the nIndex'th object from the given PresObjKind, index starts with 1
Definition: sdpage.cxx:203
PresChange GetPresChange() const
Definition: sdpage.hxx:214
double GetTime() const
Definition: sdpage.hxx:217
SfxStyleSheet * GetStyleSheetForPresObj(PresObjKind eObjKind) const
Definition: sdpage.cxx:625
PresObjKind GetPresObjKind(SdrObject *pObj) const
Definition: sdpage.cxx:2309
bool IsSoundOn() const
Definition: sdpage.hxx:220
const OUString & GetSoundFile() const
Definition: sdpage.hxx:228
bool IsExcluded() const
Definition: sdpage.hxx:223
const OUString & GetName() const
Definition: sdpage.cxx:2505
SfxStyleSheet * GetDefaultStyleSheet() const
bool IsChanged() const
css::uno::Reference< css::uno::XInterface > const & getUnoModel()
virtual SdrObjList * GetSubList() const override
SdrObject * Next()
bool IsMore() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual OutlinerParaObject * GetOutlinerParaObject() const
bool IsEmptyPresObj() const
virtual SdrObjKind GetObjIdentifier() const
SdrPage * getSdrPageFromSdrObject() const
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
SdrPage & TRG_GetMasterPage() const
sal_uInt16 GetPageNum() const
bool IsMasterPage() const
Size GetSize() const
sal_Int32 GetUpperBorder() const
sal_Int32 GetRightBorder() const
sal_Int32 GetLeftBorder() const
Color GetPageBackgroundColor() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
OutlinerParaObject * GetOutlinerParaObject()
static void Out_DocInfo(SvStream &rStrm, const OUString &rBaseURL, const css::uno::Reference< css::document::XDocumentProperties > &, const char *pIndent, OUString *pNonConvertableChars=nullptr)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void SetWaitCursor(bool bSet) const
css::uno::Reference< css::frame::XModel3 > GetModel() const
void EnableSetModified(bool bEnable=true)
virtual SfxItemSet & GetItemSet()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const void * GetData()
sal_uInt64 GetSize()
SvStream & WriteOString(std::string_view rStr)
SvStream & WriteChar(char nChar)
const SvxFieldData * GetField() const
static SvxIMapInfo * GetIMapInfo(const SdrObject *pObject)
const ImageMap & GetImageMap() const
const OUString & GetTargetFrame() const
const OUString & GetURL() const
CellPos getLastCell() const
sal_Int32 getColumnCount() const
virtual SdrText * getText(sal_Int32 nIndex) const override
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
::basegfx::B2DPolygon getB2DPolygon() const
constexpr tools::Long GetWidth() const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
constexpr void SetBottom(tools::Long v)
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
ColorMode meMode
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
bool close
float u
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
EmbeddedObjectRef * pObject
#define ERRCODE_NONE
LINESTYLE_NONE
STRIKEOUT_NONE
ITALIC_NONE
WEIGHT_BOLD
tools::Long FRound(double fVal)
#define BTN_NEXT_1
Definition: htmlex.cxx:114
const char *const pButtonNames[]
Definition: htmlex.cxx:93
#define RESTOHTML(res)
Definition: htmlex.cxx:91
constexpr OUStringLiteral gaHTMLExtension
Definition: htmlex.cxx:343
constexpr OUStringLiteral JS_ExpandOutline
Definition: htmlex.cxx:2244
#define BTN_PREV_0
Definition: htmlex.cxx:111
#define BTN_NEXT_0
Definition: htmlex.cxx:113
constexpr OUStringLiteral JS_NavigateAbs
Definition: htmlex.cxx:2214
static const char * ASP_Scripts[]
Definition: htmlex.cxx:2888
constexpr OUStringLiteral JS_CollapseOutline
Definition: htmlex.cxx:2251
#define BTN_LESS
Definition: htmlex.cxx:120
#define BTN_LAST_0
Definition: htmlex.cxx:115
#define BTN_INDEX
Definition: htmlex.cxx:117
#define BTN_PREV_1
Definition: htmlex.cxx:112
constexpr OUStringLiteral JS_NavigateRel
Definition: htmlex.cxx:2234
constexpr OUStringLiteral gaHTMLHeader(u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n" " \"http://www.w3.org/TR/html4/transitional.dtd\">\r\n" "<html>\r\n<head>\r\n")
#define BTN_MORE
Definition: htmlex.cxx:119
#define BTN_LAST_1
Definition: htmlex.cxx:116
#define BTN_TEXT
Definition: htmlex.cxx:118
#define BTN_FIRST_0
Definition: htmlex.cxx:109
static const char * PERL_Scripts[]
Definition: htmlex.cxx:2904
#define BTN_FIRST_1
Definition: htmlex.cxx:110
#define PUB_THUMBNAIL_WIDTH
Definition: htmlex.hxx:46
#define PUB_THUMBNAIL_HEIGHT
Definition: htmlex.hxx:47
#define PUB_MEDRES_WIDTH
Definition: htmlex.hxx:42
HtmlPublishMode
@ PUBLISH_KIOSK
@ PUBLISH_FRAMES
@ PUBLISH_HTML
@ PUBLISH_WEBCAST
@ PUBLISH_SINGLE_DOCUMENT
IMapObjectType
sal_Int32 nIndex
void * p
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
aStr
constexpr OUStringLiteral aData
@ Exception
OUString encodeForXml(std::u16string_view rStr)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
Error
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
long Long
const char GetValue[]
PresObjKind
Definition: pres.hxx:22
QPRO_FUNC_TYPE nType
PublishingFormat
Definition: resltn.hxx:23
@ FORMAT_JPG
Definition: resltn.hxx:25
@ FORMAT_GIF
Definition: resltn.hxx:24
@ FORMAT_PNG
Definition: resltn.hxx:26
@ SCRIPT_ASP
Definition: resltn.hxx:31
@ SCRIPT_PERL
Definition: resltn.hxx:32
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
#define ERRCODE_SFX_CANTCREATECONTENT
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
#define STR_HTMLEXP_DEFAULT_EXTENSION
Definition: strings.hxx:21
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, OUString *pNonConvertableChars=nullptr)
#define SDRPAGE_NOTFOUND
#define SAL_MAX_INT32
RET_NO
RET_YES
std::unique_ptr< char[]> aBuffer
sal_Int32 nLength