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>
27#include <rtl/tencinfo.h>
32#include <osl/file.hxx>
35#include <com/sun/star/frame/XStorable.hpp>
52#include <editeng/editeng.hxx>
91#define RESTOHTML( res ) StringToHTMLString(SdResId(res))
128 std::unique_ptr<SvStream> pOStm;
137 void createFileName(
const OUString& rUrl, OUString& rFileName );
166 OUString
SetLink(
const OUString& aLink,
const OUString& aTarget );
191 maDefColor(aDefColor)
291 if (!aLink.isEmpty())
294 if (!aTarget.isEmpty())
309OUString getParagraphStyle(
const SdrOutliner* pOutliner, sal_Int32 nPara )
311 SfxItemSet aParaSet( pOutliner->GetParaAttribs( nPara ) );
315 if( aParaSet.GetItem<
SvxFrameDirectionItem>( EE_PARA_WRITINGDIR )->GetValue() == SvxFrameDirection::Horizontal_RL_TB )
318 sStyle =
"direction: rtl;";
328void lclAppendStyle(OUStringBuffer& aBuffer, std::u16string_view aTag, std::u16string_view aStyle)
331 aBuffer.append(OUString::Concat(
"<") + aTag +
">");
333 aBuffer.append(OUString::Concat(
"<") + aTag +
" style=\"" + aStyle +
"\">");
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" );
348 const Sequence< PropertyValue >& rParams,
353 mpDocSh( pDocShell ),
355 mbContentsPage(false),
363 mbHiddenSlides(true),
408 for(
const PropertyValue& rParam : rParams )
410 if ( rParam.Name ==
"PublishMode" )
413 rParam.Value >>= temp;
416 else if ( rParam.Name ==
"IndexURL" )
418 rParam.Value >>=
aStr;
421 else if ( rParam.Name ==
"Format" )
424 rParam.Value >>= temp;
427 else if ( rParam.Name ==
"Compression" )
429 rParam.Value >>=
aStr;
430 OUString aTmp(
aStr );
433 aTmp = aTmp.replaceFirst(
"%",
"");
437 else if ( rParam.Name ==
"Width" )
440 rParam.Value >>= temp;
443 else if ( rParam.Name ==
"UseButtonSet" )
446 rParam.Value >>= temp;
449 else if ( rParam.Name ==
"IsExportNotes" )
454 rParam.Value >>= temp;
458 else if ( rParam.Name ==
"IsExportContentsPage" )
461 rParam.Value >>= temp;
464 else if ( rParam.Name ==
"Author" )
466 rParam.Value >>=
aStr;
469 else if ( rParam.Name ==
"EMail" )
471 rParam.Value >>=
aStr;
474 else if ( rParam.Name ==
"HomepageURL" )
476 rParam.Value >>=
aStr;
479 else if ( rParam.Name ==
"UserText" )
481 rParam.Value >>=
aStr;
484 else if ( rParam.Name ==
"EnableDownload" )
487 rParam.Value >>= temp;
490 else if ( rParam.Name ==
"SlideSound" )
493 rParam.Value >>= temp;
496 else if ( rParam.Name ==
"HiddenSlides" )
499 rParam.Value >>= temp;
502 else if ( rParam.Name ==
"BackColor" )
505 rParam.Value >>= temp;
509 else if ( rParam.Name ==
"TextColor" )
512 rParam.Value >>= temp;
516 else if ( rParam.Name ==
"LinkColor" )
519 rParam.Value >>= temp;
523 else if ( rParam.Name ==
"VLinkColor" )
526 rParam.Value >>= temp;
530 else if ( rParam.Name ==
"ALinkColor" )
533 rParam.Value >>= temp;
537 else if ( rParam.Name ==
"IsUseDocumentColors" )
540 rParam.Value >>= temp;
543 else if ( rParam.Name ==
"KioskSlideDuration" )
546 rParam.Value >>= temp;
550 else if ( rParam.Name ==
"KioskEndless" )
553 rParam.Value >>= temp;
556 else if ( rParam.Name ==
"WebCastCGIURL" )
558 rParam.Value >>=
aStr;
561 else if ( rParam.Name ==
"WebCastTargetURL" )
563 rParam.Value >>=
aStr;
566 else if ( rParam.Name ==
"WebCastScriptLanguage" )
568 rParam.Value >>=
aStr;
580 OSL_FAIL(
"Unknown property for html export detected!");
594 double dRatio=
static_cast<double>(aTmpSize.
Width())/aTmpSize.
Height();
639 for(sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount; ++nSdPage)
654 sStyle +=
"page-break-before:always; ";
655 sStyle += getParagraphStyle(pOutliner, 0);
657 lclAppendStyle(
aStr,
u"h1", sStyle);
659 aStr.append(sTitleText +
"</h1>\r\n");
670 if (!aNotesStr.isEmpty())
672 aStr.append(
"<br>\r\n<h3>"
685 aStr.append(
"</body>\r\n</html>");
795 if( pPage ==
nullptr )
810 if(pSheet ==
nullptr)
812 if(pSheet ==
nullptr)
816 if(pSheet ==
nullptr)
934 uno::Reference< frame::XStorable > xStorable(
mpDoc->
getUnoModel(), uno::UNO_QUERY );
962 Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
964 Reference< drawing::XGraphicExportFilter > xGraphicExporter = drawing::GraphicExportFilter::create( xContext );
967 auto pFilterData = aFilterData.getArray();
968 pFilterData[0].Name =
"PixelWidth";
970 pFilterData[1].Name =
"PixelHeight";
974 pFilterData[2].Name =
"Quality";
975 pFilterData[2].Value <<=
static_cast<sal_Int32
>(
mnCompression);
986 Sequence< PropertyValue > aDescriptor{
991 auto pDescriptor = aDescriptor.getArray();
993 for (sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount; nSdPage++)
1003 pDescriptor[0].Value <<= aFull;
1005 Reference< XComponent > xPage( pPage->
getUnoPage(), UNO_QUERY );
1006 xGraphicExporter->setSourceDocument( xPage );
1007 xGraphicExporter->filter( aDescriptor );
1027 for (
size_t nObject = 0; nObject < nObjectCount; ++nObject)
1030 if (
pObject->GetObjInventor() == SdrInventor::Default &&
1031 pObject->GetObjIdentifier() == SdrObjKind::OutlineText)
1044 const char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
1047 aStr =
" <meta HTTP-EQUIV=CONTENT-TYPE CONTENT=\"text/html; charset=" +
1048 OUString::createFromAscii(pCharSet) +
"\">\r\n";
1057 uno::Reference<document::XDocumentProperties> xDocProps;
1060 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1062 xDocProps.set(xDPS->getDocumentProperties());
1068 const sal_uInt64 nLen = aStream.
GetSize();
1070 std::string_view
aData(
static_cast<const char*
>(aStream.
GetData()),
static_cast<sal_Int32
>(nLen));
1072 return OStringToOUString(
aData, RTL_TEXTENCODING_UTF8);
1081 for(sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount && bOk; nSdPage++)
1104 lclAppendStyle(
aStr,
u"h1", getParagraphStyle(pOutliner, 0));
1105 aStr.append(sTitleText +
"</h1>\r\n");
1116 if (!aNotesStr.isEmpty())
1118 aStr.append(
"<br>\r\n<h3>"
1126 aStr.append(
"</body>\r\n</html>");
1146 OUString aFileName( rFileName );
1154 nErr = aFile.createStream(aFull , pStr);
1179 if(pOPO && pOutliner->GetParagraphCount() != 0)
1182 pOutliner->SetText(*pOPO);
1192 bool bHeadLine,
const Color& rBackgroundColor)
1194 OUStringBuffer
aStr;
1205 if (
pObject->GetObjIdentifier() == SdrObjKind::Group)
1210 else if (
pObject->GetObjIdentifier() == SdrObjKind::Table)
1217 if (
pObject->GetOutlinerParaObject())
1246 return aStr.makeStringAndClear();
1253 aStart = SdrTableObj::getFirstCell();
1257 aStr.append(
"<table>\r\n");
1258 for (sal_Int32 nRow = aStart.
mnRow; nRow <= aEnd.
mnRow; nRow++)
1260 aStr.append(
" <tr>\r\n");
1261 for (sal_Int32 nCol = aStart.
mnCol; nCol <= aEnd.
mnCol; nCol++)
1263 aStr.append(
" <td>\r\n");
1264 sal_Int32 nCellIndex = nRow * nColCount + nCol;
1267 if (pText ==
nullptr)
1270 aStr.append(
" </td>\r\n");
1272 aStr.append(
" </tr>\r\n");
1274 aStr.append(
"</table>\r\n");
1278 const Color& rBackgroundColor,
bool bHeadLine)
1281 while (aGroupIterator.
IsMore())
1292 if (pOutlinerParagraphObject !=
nullptr)
1302 const Color& rBackgroundColor,
bool bHeadLine)
1304 if (pOutlinerParagraphObject ==
nullptr)
1307 pOutliner->SetText(*pOutlinerParagraphObject);
1309 sal_Int32
nCount = pOutliner->GetParagraphCount();
1312 sal_Int16 nCurrentDepth = -1;
1317 if(pParagraph ==
nullptr)
1320 const sal_Int16 nDepth =
static_cast<sal_uInt16
>(pOutliner->GetDepth(
nIndex));
1323 if (aParaText.isEmpty())
1328 OUString aTag = bHeadLine ? OUString(
"h2") : OUString(
"p");
1329 lclAppendStyle(
aStr, aTag, getParagraphStyle(pOutliner,
nIndex));
1331 aStr.append(aParaText);
1332 aStr.append(
"</" + aTag +
">\r\n");
1336 while(nCurrentDepth < nDepth)
1338 aStr.append(
"<ul>\r\n");
1341 while(nCurrentDepth > nDepth)
1343 aStr.append(
"</ul>\r\n");
1346 lclAppendStyle(
aStr,
u"li", getParagraphStyle(pOutliner,
nIndex));
1347 aStr.append(aParaText);
1348 aStr.append(
"</li>\r\n");
1351 while(nCurrentDepth >= 0)
1353 aStr.append(
"</ul>\r\n");
1362 const Color& rBackgroundColor )
1364 OUStringBuffer
aStr;
1374 pOutliner->SetText( *pOPO );
1376 sal_Int32
nCount = pOutliner->GetParagraphCount();
1377 for (sal_Int32 nPara = 0; nPara <
nCount; nPara++)
1379 lclAppendStyle(
aStr,
u"p", getParagraphStyle(pOutliner, nPara));
1386 return aStr.makeStringAndClear();
1392 OUStringBuffer
aStr;
1394 if(
nullptr == pOutliner)
1401 Paragraph* pPara = pOutliner->GetParagraph(nPara);
1402 if(
nullptr == pPara)
1406 std::vector<sal_Int32> aPortionList;
1409 sal_Int32 nPos1 = 0;
1410 for( sal_Int32 nPos2 : aPortionList )
1412 ESelection aSelection( nPara, nPos1, nPara, nPos2);
1424 return aStr.makeStringAndClear();
1432 OUStringBuffer
aStr;
1437 OUString aLink, aTarget;
1460 aStr.insert(0, aTemp);
1470 aStr.insert(0, aTemp);
1480 aStr.insert(0, aTemp);
1490 aStr.insert(0, aTemp);
1502 if( !rBackgroundColor.
IsDark() )
1509 if (!aLink.isEmpty())
1514 return aStr.makeStringAndClear();
1522 std::vector<SdrObject*> aClickableObjects;
1524 for(sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount && bOk; nSdPage++)
1536 bool bMasterDone =
false;
1538 while (!bMasterDone)
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)) ||
1558 aClickableObjects.push_back(
pObject);
1580 bool bEndless =
false;
1599 aStr.append(
"<meta http-equiv=\"refresh\" content=\""
1600 + OUString::number(fSecs)
1603 int nPage = nSdPage + 1;
1613 aStr.append(
"</head>\r\n");
1625 aStr.append(
"<center>"
1630 if (!aClickableObjects.empty())
1631 aStr.append(
" USEMAP=\"#map0\"");
1633 aStr.append(
"></center>\r\n");
1643 if (!aNotesStr.isEmpty())
1647 +
":</h3><br>\r\n\r\n<p>"
1654 if (!aClickableObjects.empty())
1656 aStr.append(
"<map name=\"map0\">\r\n");
1674 double fLogicToPixel =
static_cast<double>(
mnWidthPixel) / nPageWidth;
1689 for (sal_uInt16 nArea = 0; nArea < nAreaCount; nArea++)
1709 nPgNum = (nPgNum - 1) / 2;
1715 case IMapObjectType::Rectangle:
1718 GetRectangle(
false));
1732 case IMapObjectType::Circle:
1743 nCircleRadius =
static_cast<sal_uLong>(nCircleRadius * fLogicToPixel);
1745 aCenter.
X(), aCenter.
Y(),
1750 case IMapObjectType::Polygon:
1756 fLogicToPixel,
aURL));
1762 SAL_INFO(
"sd",
"unknown IMapObjectType");
1776 presentation::ClickAction eClickAction = pInfo->
meClickAction;
1778 switch( eClickAction )
1780 case presentation::ClickAction_BOOKMARK:
1798 case presentation::ClickAction_DOCUMENT:
1802 case presentation::ClickAction_PREVPAGE:
1809 nPage = nSdPage - 1;
1815 case presentation::ClickAction_NEXTPAGE:
1821 nPage = nSdPage + 1;
1827 case presentation::ClickAction_FIRSTPAGE:
1831 case presentation::ClickAction_LASTPAGE:
1840 if (!aHRef.isEmpty())
1843 if (
pObject->GetObjInventor() == SdrInventor::Default &&
1844 pObject->GetObjIdentifier() == SdrObjKind::CircleOrEllipse &&
1848 aRect.
Left() + nRadius,
1849 aRect.
Top() + nRadius,
1853 else if (
pObject->GetObjInventor() == SdrInventor::Default &&
1854 (
pObject->GetObjIdentifier() == SdrObjKind::PathLine ||
1855 pObject->GetObjIdentifier() == SdrObjKind::PolyLine ||
1856 pObject->GetObjIdentifier() == SdrObjKind::Polygon))
1870 aStr.append(
"</map>\r\n");
1872 aClickableObjects.clear();
1874 aStr.append(
"</body>\r\n</html>");
1893 OUStringBuffer
aStr(
1898 +
"</title>\r\n</head>\r\n"
1902 aStr.append(
"<center>\r\n");
1909 aStr.append(
"<h2>");
1919 aStr.append(
"</h2>\r\n</center>\r\n"
1920 "<center><table width=\"90%\"><tr>\r\n");
1923 aStr.append(
"<td valign=\"top\" align=\"left\" width=\"25%\">\r\n"
1928 for(sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount; nSdPage++)
1931 aStr.append(
"<div align=\"left\">");
1936 aStr.append(
"</div>\r\n");
1938 aStr.append(
"</td>\r\n");
1941 aStr.append(
"<td valign=\"top\" align=\"left\" width=\"75%\">\r\n");
1945 aStr.append(
"<p><strong>"
1954 aStr.append(
"<p><strong>"
1956 +
":</strong> <a href=\"mailto:"
1965 aStr.append(
"<p><strong>"
1967 +
":</strong> <a href=\""
1976 aStr.append(
"<p><strong>"
1978 +
":</strong><br>\r\n"
1985 aStr.append(
"<p><a href=\""
1992 for(sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount; nSdPage++)
1997 "\" width=\"256\" height=\"192\" alt=\"" +
2005 aStr.append(
"</td></tr></table></center>\r\n"
2006 "</body>\r\n</html>");
2023 for( sal_uInt16 nSdPage = 0; bOk && nSdPage <
mnSdPageCount; nSdPage++ )
2034 +
"</title>\r\n</head>\r\n"
2040 aStr.append(
"</body>\r\n</html>");
2042 OUString aFileName(
"note" + OUString::number(nSdPage));
2066 for (sal_Int32 nPage = 0; nPage < (
mbImpress?2:1) && bOk; ++nPage)
2073 +
"</title>\r\n</head>\r\n"
2077 for(sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount; nSdPage++)
2081 aStr.append(
"<div align=\"left\">");
2082 OUString aLink(
"JavaScript:parent.NavigateAbs(" +
2083 OUString::number(nSdPage) +
")");
2086 if (aTitle.isEmpty())
2089 lclAppendStyle(
aStr,
u"p", getParagraphStyle(pOutliner, 0));
2097 aStr.append(
"</div>\r\n");
2101 aStr.append(
"</body>\r\n</html>");
2103 OUString aFileName(
"outline" + OUString::number(nPage));
2126 for (sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount; nSdPage++)
2128 OUString aHTMLFileName;
2138 OUString aImageFileName =
"img" + OUString::number(nSdPage);
2140 aImageFileName +=
".gif";
2142 aImageFileName +=
".jpg";
2144 aImageFileName +=
".png";
2148 OUString aThumbnailFileName =
"thumb" + OUString::number(nSdPage);
2150 aThumbnailFileName +=
".png";
2152 aThumbnailFileName +=
".jpg";
2192 OUString aTest(rEditTextObject.
GetText(0));
2193 if (!aTest.isEmpty())
2204 sal_Int32 nDot =
mDocTitle.indexOf(
'.');
2215 u"function NavigateAbs( nPage )\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"
2222 " frames[\"navbar1\"].location.href = \"navbar0.$EXT\";\r\n"
2224 " else if(nCurrentPage==nPageCount-1)\r\n"
2226 " frames[\"navbar1\"].location.href = \"navbar2.$EXT\";\r\n"
2230 " frames[\"navbar1\"].location.href = \"navbar1.$EXT\";\r\n"
2235 u"function NavigateRel( nDelta )\r\n"
2237 " var nPage = parseInt(nCurrentPage) + parseInt(nDelta);\r\n"
2238 " if( (nPage >= 0) && (nPage < nPageCount) )\r\n"
2240 " NavigateAbs( nPage );\r\n"
2245 u"function ExpandOutline()\r\n"
2247 " frames[\"navbar2\"].location.href = \"navbar4.$EXT\";\r\n"
2248 " frames[\"outline\"].location.href = \"outline1.$EXT\";\r\n"
2252 u"function CollapseOutline()\r\n"
2254 " frames[\"navbar2\"].location.href = \"navbar3.$EXT\";\r\n"
2255 " frames[\"outline\"].location.href = \"outline0.$EXT\";\r\n"
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"
2273 "<script type=\"text/javascript\">\r\n<!--\r\n"
2275 "var nCurrentPage = 0;\r\nvar nPageCount = "
2283 aFunction = aFunction.replaceAll(
"//",
"");
2287 OUString aPlaceHolder(
".$EXT");
2289 aStr.append(aFunction);
2305 aStr.append(
"// -->\r\n</script>\r\n"
2309 "<frameset cols=\"*,"
2310 + OUString::number(
static_cast<sal_Int32
>(
mnWidthPixel + 16))
2315 " <frameset rows=\"42,*\">\r\n"
2316 " <frame src=\"navbar3"
2318 +
"\" name=\"navbar2\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n");
2320 aStr.append(
" <frame src=\"outline0"
2322 +
"\" name=\"outline\">\r\n");
2324 aStr.append(
" </frameset>\r\n");
2328 aStr.append(
" <frameset rows=\"42,"
2329 + OUString::number(
static_cast<sal_Int32
>(
static_cast<double>(
mnWidthPixel) * 0.75) + 16)
2333 aStr.append(
" <frameset rows=\"42,*\">\r\n");
2336 " <frame src=\"navbar0"
2338 +
"\" name=\"navbar1\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n"
2342 +
"\" name=\"show\" marginwidth=\"4\" marginheight=\"4\">\r\n");
2346 aStr.append(
" <frame src=\"note0"
2348 +
"\" name=\"notes\">\r\n");
2350 aStr.append(
" </frameset>\r\n"
2355 +
"\r\n</noframes>\r\n</frameset>\r\n</html>");
2383 for(
int nFile = 0; nFile < 3 && bOk; nFile++ )
2385 OUStringBuffer
aStr(
2390 +
"</title>\r\n</head>\r\n"
2395 aButton =
SdResId(STR_HTMLEXP_FIRSTPAGE);
2401 aButton =
CreateLink(
u"JavaScript:parent.NavigateAbs(0)", aButton);
2407 aButton =
SdResId(STR_PUBLISH_BACK);
2414 aButton =
CreateLink(
u"JavaScript:parent.NavigateRel(-1)", aButton);
2420 aButton =
SdResId(STR_PUBLISH_NEXT);
2427 aButton =
CreateLink(
u"JavaScript:parent.NavigateRel(1)", aButton);
2433 aButton =
SdResId(STR_HTMLEXP_LASTPAGE);
2441 OUString aLink(
"JavaScript:parent.NavigateAbs(" +
2453 aButton =
SdResId(STR_PUBLISH_OUTLINE);
2465 aButton =
SdResId(STR_HTMLEXP_SETTEXT);
2477 "</body>\r\n</html>");
2479 OUString aFileName(
"navbar" + OUString::number(nFile));
2491 aButton =
SdResId(STR_HTMLEXP_OUTLINE);
2500 +
CreateLink(
u"JavaScript:parent.ExpandOutline()", aButton)
2501 +
"</body>\r\n</html>"));
2510 aButton =
SdResId(STR_HTMLEXP_NOOUTLINE);
2519 +
CreateLink(
u"JavaScript:parent.CollapseOutline()", aButton)
2520 +
"</body>\r\n</html>"));
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;
2542 aStrNavText =
SdResId(STR_HTMLEXP_SETGRAPHIC);
2546 aStrNavText =
SdResId(STR_HTMLEXP_SETTEXT);
2577 OUStringBuffer
aStr(
"<center>\r\n");
2583 aStr.append(aStrNavFirst);
2591 aStr.append(aStrNavPrev);
2599 aStr.append(aStrNavNext);
2608 aStr.append(aStrNavLast);
2625 aStr.append(
"</center><br>\r\n");
2627 return aStr.makeStringAndClear();
2652 OUStringBuffer
aStr(
"<body" );
2660 aStr.append(
" text=\""
2673 aStr.append(
">\r\n");
2675 return aStr.makeStringAndClear();
2680 std::u16string_view aText,
2681 std::u16string_view aTarget )
2683 OUStringBuffer
aStr( OUString::Concat(
"<a href=\"") + aLink);
2684 if (!aTarget.empty())
2686 aStr.append(OUString::Concat(
"\" target=\"") + aTarget);
2688 aStr.append(OUString::Concat(
"\">") + aText +
"</a>");
2690 return aStr.makeStringAndClear();
2696 OUStringBuffer
aStr( OUString::Concat(
"<img src=\"") + aImage +
"\" border=0");
2698 if (!aAltText.empty())
2700 aStr.append(OUString::Concat(
" alt=\"") + aAltText +
"\"");
2705 aStr.append(
" alt=\"\"");
2710 return aStr.makeStringAndClear();
2716 static const char hex[] =
"0123456789ABCDEF";
2717 OUStringBuffer
aStr(
"#xxxxxx" );
2725 return aStr.makeStringAndClear();
2732 std::u16string_view rHRef )
2735 "<area shape=\"circle\" alt=\"\" coords=\"" +
2736 OUString::number(nCenterX) +
"," +
2737 OUString::number(nCenterY) +
"," +
2738 OUString::number(nRadius) +
2739 "\" href=\"" + rHRef +
"\">\n");
2746 Size aShift,
double fFactor, std::u16string_view rHRef )
2748 OUStringBuffer
aStr;
2749 const sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
2751 for ( sal_uInt32 nXPoly = 0; nXPoly < nNoOfPolygons; nXPoly++ )
2753 const ::basegfx::B2DPolygon& aPolygon = rPolyPolygon.getB2DPolygon(nXPoly);
2754 const sal_uInt32 nNoOfPoints(aPolygon.count());
2756 aStr.append(
"<area shape=\"polygon\" alt=\"\" coords=\"");
2758 for ( sal_uInt32 nPoint = 0; nPoint < nNoOfPoints; nPoint++ )
2760 const ::basegfx::B2DPoint aB2DPoint(aPolygon.getB2DPoint(nPoint));
2768 aStr.append( OUString::number(aPnt.
X()) +
"," + OUString::number(aPnt.
Y()) );
2770 if (nPoint < nNoOfPoints - 1)
2773 aStr.append(OUString::Concat(
"\" href=\"") + rHRef +
"\">\n");
2776 return aStr.makeStringAndClear();
2781 std::u16string_view rHRef )
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");
2800 sal_Int32
nLength = strlen(
static_cast<char const *
>(aMemStm.
GetData()));
2801 return OUString(
static_cast<char const *
>(aMemStm.
GetData()),
nLength, RTL_TEXTENCODING_UTF8 );
2809 return OUString(
"JavaScript:parent.NavigateAbs(" +
2810 OUString::number(nPgNum) +
")");
2819 OUStringBuffer aScriptBuf;
2821 aURL.Append(
u"webcast" );
2822 aURL.Append( rSource );
2831 OStringBuffer aLine;
2833 while( pIStm->ReadLine( aLine ) )
2835 aScriptBuf.appendAscii( aLine.getStr(), aLine.getLength() );
2838 aScriptBuf.append(
"\n");
2842 aScriptBuf.append(
"\r\n");
2846 nErr = pIStm->GetError();
2853 return static_cast<bool>(nErr);
2856 OUString aScript(aScriptBuf.makeStringAndClear());
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));
2863 OUString aDest(rPath + rDest);
2870 nErr = aFile.createStream(aDest, pStr);
2888static const char *
ASP_Scripts[] = {
"common.inc",
"webcast.asp",
"show.asp",
"savepic.asp",
"poll.asp",
"editpic.asp" };
2895 OUString aScript = OUString::createFromAscii(
p);
2904static const char *
PERL_Scripts[] = {
"webcast.pl",
"common.pl",
"editpic.pl",
"poll.pl",
"savepic.pl",
"show.pl" };
2911 OUString aScript = OUString::createFromAscii(
p);
2929 OUStringBuffer
aStr;
2930 for( sal_uInt16 nSdPage = 0; nSdPage <
mnSdPageCount; nSdPage++)
2933 OUString::number(
static_cast<sal_Int32
>(nSdPage + 1))
2951 OUString aFileName(
"currpic.txt");
2957 ErrCode nErr = aFile.createStream(aFull, pStr);
2975 if (rSoundFile.isEmpty())
2979 OUString aSoundFileName =
aURL.getName();
2981 DBG_ASSERT(
aURL.GetProtocol() != INetProtocol::NotValid,
"invalid URL" );
2983 OUString
aStr(
"<embed src=\"" + aSoundFileName +
2984 "\" hidden=\"true\" autostart=\"true\">");
2993 meEC.
SetContext( STR_HTMLEXP_ERROR_COPY_FILE, rSourceFile, rDestFile );
2994 osl::FileBase::RC
Error = osl::File::copy( rSourceFile, rDestFile );
2996 if(
Error != osl::FileBase::E_None )
3012 return xFileAccess->exists( url );
3014 catch( css::uno::Exception& )
3024 bool bFound =
false;
3028 Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
3029 uno::Reference<ucb::XSimpleFileAccess3> xFA(ucb::SimpleFileAccess::create(xContext));
3032 for( nSdPage = 0; !bFound && (nSdPage <
mnSdPageCount); nSdPage++)
3052 OUString aSystemPath;
3053 osl::FileBase::getSystemPathFromFileURL(
maExportPath, aSystemPath );
3054 OUString aMsg(
SdResId(STR_OVERWRITE_WARNING));
3055 aMsg = aMsg.replaceFirst(
"%FILENAME", aSystemPath );
3058 VclMessageType::Warning, VclButtonsType::YesNo,
3060 xWarn->set_default_response(
RET_YES);
3061 bFound = (
RET_NO == xWarn->run());
3075 return OUString::createFromAscii(
pButtonNames[nButton]);
3078EasyFile::EasyFile() : bOpen(false)
3082EasyFile::~EasyFile()
3088ErrCode EasyFile::createStream(
const OUString& rUrl,
SvStream* &rpStr )
3094 createFileName( rUrl, aFileName );
3101 nErr = pOStm->GetError();
3108 if( nErr != ERRCODE_NONE )
3114 rpStr = pOStm.get();
3119void EasyFile::createFileName(
const OUString& rURL, OUString& rFileName )
3126 if(
aURL.GetProtocol() == INetProtocol::NotValid )
3129 osl::FileBase::getFileURLFromSystemPath( rURL, aURLStr );
3132 DBG_ASSERT(
aURL.GetProtocol() != INetProtocol::NotValid,
"invalid URL" );
3136void EasyFile::close()
3156 rCtxStr = rCtxStr.replaceAll(
"$(URL1)",
maURL1 );
3157 rCtxStr = rCtxStr.replaceAll(
"$(URL2)",
maURL2 );
PropertiesInfo aProperties
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt8 GetBlue() 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
void SetContext(TranslateId pResId, const OUString &rURL)
OUString DocumentMetadata() const
Output document metadata.
std::vector< OUString > maThumbnailFiles
static OUString CreateHTMLPolygonArea(const ::basegfx::B2DPolyPolygon &rPolyPoly, Size aShift, double fFactor, std::u16string_view rHRef)
void WriteObjectGroup(OUStringBuffer &aStr, SdrObjGroup const *pObjectGroup, SdrOutliner *pOutliner, const Color &rBackgroundColor, bool bHeadLine)
static OUString CreateImage(std::u16string_view aImage, std::u16string_view aAltText)
void ExportSingleDocument()
void WriteTable(OUStringBuffer &aStr, sdr::table::SdrTableObj const *pTableObject, SdrOutliner *pOutliner, const Color &rBackgroundColor)
PublishingFormat meFormat
PublishingScript meScript
OUString TextAttribToHTMLString(SfxItemSet const *pSet, HtmlState *pState, const Color &rBackgroundColor)
OUString const & getDocumentTitle()
static OUString GetButtonName(int nButton)
std::vector< OUString > maHTMLFiles
bool CreateOutlinePages()
static OUString CreateHTMLCircleArea(sal_uLong nRadius, sal_uLong nCenterX, sal_uLong nCenterY, std::u16string_view rHRef)
std::vector< SdPage * > maPages
::sd::DrawDocShell * mpDocSh
bool CreateASPScripts()
creates and saves the ASP scripts for WebShow
bool CreateHtmlForPresPages()
OUString CreateTextForTitle(SdrOutliner *pOutliner, SdPage *pPage, const Color &rBackgroundColor)
creates an outliner text for the title objects of a page
void WriteOutlinerParagraph(OUStringBuffer &aStr, SdrOutliner *pOutliner, OutlinerParaObject const *pOutlinerParagraphObject, const Color &rBackgroundColor, bool bHeadLine)
std::unique_ptr< SfxProgress > mpProgress
OUString CreatePageURL(sal_uInt16 nPgNum)
OUString ParagraphToHTMLString(SdrOutliner const *pOutliner, sal_Int32 nPara, const Color &rBackgroundColor)
std::vector< OUString > maPageNames
void InitProgress(sal_uInt16 nProgrCount)
bool CreateImageNumberFile()
static OUString CreateLink(std::u16string_view aLink, std::u16string_view aText, std::u16string_view aTarget=std::u16string_view())
std::vector< SdPage * > maNotesPages
std::vector< OUString > maImageFiles
OUString CreateTextForPage(SdrOutliner *pOutliner, SdPage const *pPage, bool bHeadLine, const Color &rBackgroundColor)
OUString maExportPath
output directory or URL.
Color maTextColor
The following colors are used for the <body> tag if mbUserAttr is true.
HtmlExport(OUString aPath, const css::uno::Sequence< css::beans::PropertyValue > &rParams, SdDrawDocument *pExpDoc, sd::DrawDocShell *pDocShell)
void SetDocColors(SdPage *pPage=nullptr)
bool CreateHtmlTextForPresPages()
static OUString CreateMetaCharset()
Output only the charset metadata, title etc. will be handled separately.
OUString CreateNavBar(sal_uInt16 nSdPage, bool bIsText) const
static OUString CreateHTMLRectArea(const ::tools::Rectangle &rRect, std::u16string_view rHRef)
bool CreateImagesForPresPages(bool bThumbnails=false)
OUString CreateBodyTag() const
sal_uInt16 mnPagesWritten
bool CreateImageFileList()
static OUString StringToHTMLString(const OUString &rString)
static SdrTextObj * GetLayoutTextObject(SdrPage const *pPage)
bool CreateNavBarFrames()
bool checkForExistingFiles()
bool checkFileExists(css::uno::Reference< css::ucb::XSimpleFileAccess3 > const &xFileAccess, std::u16string_view aFileName)
bool CopyScript(std::u16string_view rPath, const OUString &rSource, const OUString &rDest, bool bUnix=false)
std::vector< OUString > maTextFiles
OUString CreateTextForNotesPage(SdrOutliner *pOutliner, SdPage *pPage, const Color &rBackgroundColor)
void InitExportParameters(const css::uno::Sequence< css::beans::PropertyValue > &rParams)
bool CopyFile(const OUString &rSourceFile, const OUString &rDestFile)
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...
OUString InsertSound(const OUString &rSoundFile)
std::unique_ptr< ButtonSet > mpButtonSet
static OUString ColorToHTMLString(Color aColor)
OUString SetUnderline(bool bUnderline)
OUString SetStrikeout(bool bStrike)
HtmlState(Color aDefColor)
OUString SetWeight(bool bWeight)
OUString SetLink(const OUString &aLink, const OUString &aTarget)
OUString SetItalic(bool bItalic)
OUString SetColor(Color aColor)
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.
OUString GetBookmark() const
SAL_DLLPRIVATE const sd::PresentationSettings & getPresentationSettings() const
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SdOutliner * GetInternalOutliner(bool bCreateOutliner=true)
SAL_DLLPRIVATE sal_uInt16 GetPageByName(std::u16string_view rPgName, bool &rbIsMasterPage) const
Return the first page that has the given name.
static SAL_DLLPRIVATE SdAnimationInfo * GetAnimationInfo(SdrObject *pObject)
deprecated
SAL_DLLPRIVATE SdrObject * GetObj(std::u16string_view rObjName) const
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
SAL_DLLPRIVATE DocumentType GetDocumentType() const
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
SdrObject * GetPresObj(PresObjKind eObjKind, int nIndex=1, bool bFuzzySearch=false)
returns the nIndex'th object from the given PresObjKind, index starts with 1
PresChange GetPresChange() const
SfxStyleSheet * GetStyleSheetForPresObj(PresObjKind eObjKind) const
PresObjKind GetPresObjKind(SdrObject *pObj) const
const OUString & GetSoundFile() const
const OUString & GetName() const
SfxStyleSheet * GetDefaultStyleSheet() const
css::uno::Reference< css::uno::XInterface > const & getUnoModel()
virtual SdrObjList * GetSubList() const override
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
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
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
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)
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
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
tools::Long FRound(double fVal)
const char *const pButtonNames[]
constexpr OUStringLiteral gaHTMLExtension
constexpr OUStringLiteral JS_ExpandOutline
constexpr OUStringLiteral JS_NavigateAbs
static const char * ASP_Scripts[]
constexpr OUStringLiteral JS_CollapseOutline
constexpr OUStringLiteral JS_NavigateRel
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")
static const char * PERL_Scripts[]
#define PUB_THUMBNAIL_WIDTH
#define PUB_THUMBNAIL_HEIGHT
@ PUBLISH_SINGLE_DOCUMENT
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
constexpr OUStringLiteral aData
OUString encodeForXml(std::u16string_view rStr)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
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)
OUString SdResId(TranslateId aId)
#define ERRCODE_SFX_CANTCREATECONTENT
#define STR_HTMLEXP_DEFAULT_EXTENSION
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, OUString *pNonConvertableChars=nullptr)
std::unique_ptr< char[]> aBuffer