20 #include <config_java.h>
23 #include <rtl/strbuf.hxx>
61 #include <com/sun/star/embed/XClassifiedObject.hpp>
62 #include <com/sun/star/embed/Aspects.hpp>
63 #include <com/sun/star/beans/XPropertySet.hpp>
64 #include <com/sun/star/frame/XStorable.hpp>
65 #include <com/sun/star/embed/ElementModes.hpp>
66 #include <com/sun/star/io/XActiveDataStreamer.hpp>
67 #include <com/sun/star/embed/XEmbedPersist2.hpp>
68 #include <com/sun/star/lang/XInitialization.hpp>
72 #include <rtl/uri.hxx>
80 #include <osl/file.hxx>
85 #define HTML_DFLT_EMBED_WIDTH ((MM50*5)/2)
86 #define HTML_DFLT_EMBED_HEIGHT ((MM50*5)/2)
88 #define HTML_DFLT_APPLET_WIDTH ((MM50*5)/2)
89 #define HTML_DFLT_APPLET_HEIGHT ((MM50*5)/2)
144 OUString lcl_CalculateFileName(
const OUString* pOrigFileName,
const Graphic& rGraphic,
145 const OUString& rExtension)
150 aFileName = *pOrigFileName;
164 const Size& rTwipDfltSize,
165 bool bPercentWidth,
bool bPercentHeight,
170 sal_uInt8 nPercentWidth = 0, nPercentHeight = 0;
184 aTwipSz.setWidth( rTwipDfltSize.
Width() );
188 aTwipSz.setWidth( rCSS1PropInfo.
m_nWidth );
190 else if( bPercentWidth && rPixSize.
Width() )
193 if( nPercentWidth > 100 )
196 aTwipSz.setWidth( rTwipDfltSize.
Width() );
200 aTwipSz.setWidth( rTwipDfltSize.
Width() );
202 if( aTwipSz.Width() <
MINFLY )
204 aTwipSz.setWidth(
MINFLY );
211 aTwipSz.setHeight( rTwipDfltSize.
Height() );
215 aTwipSz.setHeight( rCSS1PropInfo.
m_nHeight );
217 else if( bPercentHeight && rPixSize.
Height() )
220 if( nPercentHeight > 100 )
221 nPercentHeight = 100;
223 aTwipSz.setHeight( rTwipDfltSize.
Height() );
227 aTwipSz.setHeight( rTwipDfltSize.
Height() );
229 if( aTwipSz.Height() <
MINFLY )
231 aTwipSz.setHeight(
MINFLY );
237 aFrameSize.SetHeightPercent( nPercentHeight );
238 rFlyItemSet.
Put( aFrameSize );
246 sal_Int32 nLeftSpace = 0, nRightSpace = 0;
247 sal_uInt16 nUpperSpace = 0, nLowerSpace = 0;
254 nLeftSpace = nRightSpace = aTwipSpc.Width();
255 nUpperSpace = nLowerSpace =
static_cast<sal_uInt16
>(aTwipSpc.Height());
268 nLeftSpace = aLRItem.
GetLeft();
278 if( nLeftSpace > 0 || nRightSpace > 0 )
281 aLRItem.
SetLeft( std::max<sal_Int32>(nLeftSpace, 0) );
282 aLRItem.
SetRight( std::max<sal_Int32>(nRightSpace, 0) );
283 rFlyItemSet.
Put( aLRItem );
292 rFlyItemSet.
Put( aHoriOri );
314 if( !(nUpperSpace || nLowerSpace) )
320 rFlyItemSet.
Put( aULItem );
329 rFlyItemSet.
Put( aVertOri );
339 sal_Int32
nIndex = rPath.indexOf(
'?');
342 return rPath.copy(0, nIndex);
353 bool bPercentWidth =
false, bPercentHeight =
false, bHidden =
false;
361 for (
const auto & rOption : rHTMLOptions)
363 switch( rOption.GetToken() )
365 case HtmlOptionId::ID:
366 aId = rOption.GetString();
368 case HtmlOptionId::STYLE:
369 aStyle = rOption.GetString();
371 case HtmlOptionId::CLASS:
372 aClass = rOption.GetString();
374 case HtmlOptionId::NAME:
375 aName = rOption.GetString();
377 case HtmlOptionId::SRC:
379 aURL = rOption.GetString();
381 case HtmlOptionId::ALT:
382 aAlt = rOption.GetString();
384 case HtmlOptionId::TYPE:
385 if( aType.isEmpty() )
386 aType = rOption.GetString();
388 case HtmlOptionId::ALIGN:
395 case HtmlOptionId::WIDTH:
398 bPercentWidth = (rOption.GetString().indexOf(
'%') != -1);
399 aSize.
setWidth( static_cast<tools::Long>(rOption.GetNumber()) );
402 case HtmlOptionId::HEIGHT:
405 bPercentHeight = (rOption.GetString().indexOf(
'%') != -1);
406 aSize.
setHeight( static_cast<tools::Long>(rOption.GetNumber()) );
409 case HtmlOptionId::HSPACE:
411 aSpace.
setWidth( static_cast<tools::Long>(rOption.GetNumber()) );
413 case HtmlOptionId::VSPACE:
415 aSpace.
setHeight( static_cast<tools::Long>(rOption.GetNumber()) );
417 case HtmlOptionId::DATA:
418 if (m_bXHTML && aURL.isEmpty())
419 aData = rOption.GetString();
421 case HtmlOptionId::UNKNOWN:
422 if (rOption.GetTokenString().equalsIgnoreAsciiCase(
425 bHidden = !rOption.GetString().equalsIgnoreAsciiCase(
433 aCmdLst.
Append( rOption.GetTokenString(), rOption.GetString() );
436 if (aType ==
"image/png" && m_aEmbeds.empty())
440 SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
442 if( HasStyleOptions( aStyle, aId, aClass ) )
443 ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo );
447 eVertOri = text::VertOrientation::TOP;
457 bPercentWidth = bPercentHeight =
false;
462 bool bHasURL = !aURL.isEmpty() &&
467 bool bHasData = !aData.isEmpty();
473 aURLObj.
SetURL(rtl::Uri::convertRelToAbs(
476 catch (
const rtl::MalformedUriException& )
482 bool bHasType = !aType.isEmpty();
483 if( !bHasURL && !bHasType && !bHasData )
486 if (!m_aEmbeds.empty())
516 aAttrSet.Put(aFrameSize);
524 uno::Reference < embed::XEmbeddedObject > xObj;
530 uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
534 xSet->setPropertyValue(
"PluginURL",
uno::makeAny( aURL ) );
536 xSet->setPropertyValue(
"PluginMimeType",
uno::makeAny( aType ) );
538 uno::Sequence < beans::PropertyValue > aProps;
540 xSet->setPropertyValue(
"PluginCommands",
uno::makeAny( aProps ) );
545 else if (
SwDocShell* pDocSh = m_xDoc->GetDocShell())
548 uno::Reference<embed::XStorage> xStorage = pDocSh->GetStorage();
554 uno::Reference<io::XInputStream> xInStream;
559 auto it = m_aAllowedRTFOLEMimeTypes.find(aType);
560 if (m_aAllowedRTFOLEMimeTypes.empty() || it != m_aAllowedRTFOLEMimeTypes.end())
562 OString aMagic(
"{\\object");
565 if (aHeader == aMagic)
568 bool bOwnFormat =
false;
585 aType =
"application/vnd.sun.star.oleobject";
596 uno::Reference<io::XStream> xOutStream
597 = xStorage->openStreamElement(aObjName, embed::ElementModes::READWRITE);
598 if (aFileStream.IsOpen())
600 xOutStream->getOutputStream());
602 if (!aType.isEmpty())
605 uno::Reference<beans::XPropertySet> xOutStreamProps(xOutStream, uno::UNO_QUERY);
606 if (xOutStreamProps.is())
607 xOutStreamProps->setPropertyValue(
"MediaType",
uno::makeAny(aType));
622 SetAnchorAndAdjustment( eVertOri, eHoriOri, aPropInfo, aFrameSet );
628 aFrameSet.Put( aAnchor );
629 aFrameSet.Put(
SwFormatHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME) );
631 aFrameSet.Put(
SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::PRINT_AREA ) );
636 SetFixSize( aSize, aDfltSz, bPercentWidth, bPercentHeight, aPropInfo, aFrameSet );
637 SetSpace( aSpace, aItemSet, aPropInfo, aFrameSet );
640 uno::Reference<lang::XInitialization> xObjInitialization(xObj, uno::UNO_QUERY);
641 if (xObjInitialization.is())
651 m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam,
654 if (xObjInitialization.is())
663 if( !aName.isEmpty() )
678 RegisterFlyFrame( pFlyFormat );
688 m_aEmbeds.push(pOLENode);
693 #if HAVE_FEATURE_JAVA
694 void SwHTMLParser::NewObject()
697 OUString aStandBy,
aId, aStyle, aClass;
700 sal_Int16 eVertOri = text::VertOrientation::TOP;
703 bool bPercentWidth =
false, bPercentHeight =
false,
706 m_pAppletImpl.reset(
new SwApplet_Impl( m_xDoc->GetAttrPool() ));
709 for (
size_t i = rHTMLOptions.size();
i; )
714 case HtmlOptionId::ID:
717 case HtmlOptionId::STYLE:
720 case HtmlOptionId::CLASS:
723 case HtmlOptionId::DECLARE:
726 case HtmlOptionId::CLASSID:
729 case HtmlOptionId::CODEBASE:
731 case HtmlOptionId::DATA:
733 case HtmlOptionId::TYPE:
735 case HtmlOptionId::CODETYPE:
737 case HtmlOptionId::ARCHIVE:
738 case HtmlOptionId::UNKNOWN:
740 case HtmlOptionId::STANDBY:
743 case HtmlOptionId::WIDTH:
744 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
745 aSize.setWidth( static_cast<tools::Long>(rOption.
GetNumber()) );
747 case HtmlOptionId::HEIGHT:
748 bPercentHeight = (rOption.
GetString().indexOf(
'%') != -1);
749 aSize.setHeight( static_cast<tools::Long>(rOption.
GetNumber()) );
751 case HtmlOptionId::ALIGN:
755 case HtmlOptionId::USEMAP:
757 case HtmlOptionId::NAME:
759 case HtmlOptionId::HSPACE:
760 aSpace.setWidth( static_cast<tools::Long>(rOption.
GetNumber()) );
762 case HtmlOptionId::VSPACE:
763 aSpace.setHeight( static_cast<tools::Long>(rOption.
GetNumber()) );
765 case HtmlOptionId::BORDER:
768 case HtmlOptionId::SDONCLICK:
769 case HtmlOptionId::ONCLICK:
770 case HtmlOptionId::SDONMOUSEOVER:
771 case HtmlOptionId::ONMOUSEOVER:
772 case HtmlOptionId::SDONMOUSEOUT:
773 case HtmlOptionId::ONMOUSEOUT:
785 bool bIsApplet =
false;
787 if( !bDeclare && aClassID.getLength() == 42 &&
788 aClassID.startsWith(
"clsid:") )
790 aClassID = aClassID.copy(6);
792 if( aCID.
MakeId( aClassID ) )
794 SvGlobalName aJavaCID( 0x8AD9C840UL, 0x044EU, 0x11D1U, 0xB3U, 0xE9U,
795 0x00U, 0x80U, 0x5FU, 0x49U, 0x9DU, 0x93U );
797 bIsApplet = aJavaCID == aCID;
803 m_pAppletImpl.reset();
807 m_pAppletImpl->SetAltText( aStandBy );
809 SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
811 if( HasStyleOptions( aStyle, aId, aClass ) )
812 ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo );
814 SfxItemSet& rFrameSet = m_pAppletImpl->GetItemSet();
819 SetAnchorAndAdjustment( eVertOri, eHoriOri, aPropInfo, rFrameSet );
823 SetFixSize( aSize, aDfltSz, bPercentWidth, bPercentHeight, aPropInfo, rFrameSet );
824 SetSpace( aSpace, aItemSet, aPropInfo, rFrameSet );
830 #if HAVE_FEATURE_JAVA
833 if( !m_pAppletImpl->CreateApplet( m_sBaseURL ) )
836 m_pAppletImpl->FinishApplet();
840 m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam,
842 &m_pAppletImpl->GetItemSet() );
848 pNoTextNd->
SetTitle( m_pAppletImpl->GetAltText() );
851 RegisterFlyFrame( pFlyFormat );
853 m_pAppletImpl.reset();
859 #if HAVE_FEATURE_JAVA
860 void SwHTMLParser::InsertApplet()
862 OUString aCodeBase, aCode,
aName, aAlt, aId, aStyle, aClass;
865 bool bPercentWidth =
false, bPercentHeight =
false, bMayScript =
false;
866 sal_Int16 eVertOri = text::VertOrientation::TOP;
870 m_pAppletImpl.reset(
new SwApplet_Impl( m_xDoc->GetAttrPool() ));
873 for (
size_t i = rHTMLOptions.size();
i; )
878 case HtmlOptionId::ID:
881 case HtmlOptionId::STYLE:
884 case HtmlOptionId::CLASS:
887 case HtmlOptionId::CODEBASE:
890 case HtmlOptionId::CODE:
893 case HtmlOptionId::NAME:
896 case HtmlOptionId::ALT:
899 case HtmlOptionId::ALIGN:
903 case HtmlOptionId::WIDTH:
904 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
905 aSize.setWidth( static_cast<tools::Long>(rOption.
GetNumber()) );
907 case HtmlOptionId::HEIGHT:
908 bPercentHeight = (rOption.
GetString().indexOf(
'%') != -1);
909 aSize.setHeight( static_cast<tools::Long>(rOption.
GetNumber()) );
911 case HtmlOptionId::HSPACE:
912 aSpace.setWidth( static_cast<tools::Long>(rOption.
GetNumber()) );
914 case HtmlOptionId::VSPACE:
915 aSpace.setHeight( static_cast<tools::Long>(rOption.
GetNumber()) );
917 case HtmlOptionId::MAYSCRIPT:
928 if( aCode.isEmpty() )
930 m_pAppletImpl.reset();
934 if ( !aCodeBase.isEmpty() )
936 m_pAppletImpl->CreateApplet( aCode, aName, bMayScript, aCodeBase, m_sBaseURL );
937 m_pAppletImpl->SetAltText( aAlt );
939 SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
941 if( HasStyleOptions( aStyle, aId, aClass ) )
942 ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo );
944 SfxItemSet& rFrameSet = m_pAppletImpl->GetItemSet();
949 SetAnchorAndAdjustment( eVertOri, eHoriOri, aPropInfo, rFrameSet );
953 SetFixSize( aSize, aDfltSz, bPercentWidth, bPercentHeight, aPropInfo, rFrameSet );
954 SetSpace( aSpace, aItemSet, aPropInfo, rFrameSet );
960 #if HAVE_FEATURE_JAVA
964 m_pAppletImpl->FinishApplet();
968 m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam,
970 &m_pAppletImpl->GetItemSet());
976 pNoTextNd->
SetTitle( m_pAppletImpl->GetAltText() );
979 RegisterFlyFrame( pFlyFormat );
981 m_pAppletImpl.reset();
989 #if HAVE_FEATURE_JAVA
993 OUString aName, aValue;
996 for (
size_t i = rHTMLOptions.size();
i; )
1001 case HtmlOptionId::NAME:
1004 case HtmlOptionId::VALUE:
1011 if( aName.isEmpty() )
1014 m_pAppletImpl->AppendParam( aName, aValue );
1022 OUString aAlt, aId, aStyle, aClass;
1024 Size aSpace( 0, 0 );
1025 bool bPercentWidth =
false, bPercentHeight =
false;
1026 sal_Int16 eVertOri = text::VertOrientation::TOP;
1032 for (
const auto & rOption : rHTMLOptions)
1036 case HtmlOptionId::ID:
1039 case HtmlOptionId::STYLE:
1042 case HtmlOptionId::CLASS:
1045 case HtmlOptionId::ALT:
1048 case HtmlOptionId::ALIGN:
1052 case HtmlOptionId::WIDTH:
1053 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
1056 case HtmlOptionId::HEIGHT:
1057 bPercentHeight = (rOption.
GetString().indexOf(
'%') != -1);
1060 case HtmlOptionId::HSPACE:
1063 case HtmlOptionId::VSPACE:
1085 uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
1088 const OUString& aName = aFrameDesc.
GetName();
1094 xSet->setPropertyValue(
"FrameName",
uno::makeAny( aName ) );
1096 if ( eScroll == ScrollingMode::Auto )
1097 xSet->setPropertyValue(
"FrameIsAutoScroll",
1100 xSet->setPropertyValue(
"FrameIsScrollingMode",
1103 xSet->setPropertyValue(
"FrameIsBorder",
1106 xSet->setPropertyValue(
"FrameMarginWidth",
1109 xSet->setPropertyValue(
"FrameMarginHeight",
1114 catch ( uno::Exception& )
1118 SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
1120 if( HasStyleOptions( aStyle, aId, aClass ) )
1121 ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo );
1130 SetAnchorAndAdjustment( eVertOri, eHoriOri, aPropInfo, aFrameSet );
1134 SetFixSize( aSize, aDfltSz, bPercentWidth, bPercentHeight, aPropInfo, aFrameSet );
1135 SetSpace( aSpace, aItemSet, aPropInfo, aFrameSet );
1139 m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam,
1150 RegisterFlyFrame( pFlyFormat );
1152 m_bInFloatingFrame =
true;
1161 uno::Reference < embed::XClassifiedObject > xClass = rObj.
GetOleRef();
1171 #if HAVE_FEATURE_JAVA
1178 return static_cast< sal_uInt16
>(eType);
1190 OSL_ENSURE( pOLENd,
"OLE-Node expected" );
1196 uno::Reference < embed::XEmbeddedObject > xObj( rObj.
GetOleRef() );
1200 uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
1201 bool bHiddenEmbed =
false;
1205 OSL_FAIL(
"Unknown Object" );
1215 if( !rFrameFormat.
GetName().isEmpty() )
1229 aAny = xSet->getPropertyValue(
"PluginURL");
1230 if( (aAny >>= aStr) && !aStr.isEmpty() )
1236 if( !aURL.isEmpty() )
1246 aAny = xSet->getPropertyValue(
"PluginMimeType");
1247 if( (aAny >>= aType) && !aType.isEmpty() )
1262 bHiddenEmbed =
true;
1278 aAny = xSet->getPropertyValue(
"AppletCodeBase");
1279 if( (aAny >>= aCd) && !aCd.isEmpty() )
1282 if( !sCodeBase.isEmpty() )
1294 aAny = xSet->getPropertyValue(
"AppletCode");
1303 OUString aAppletName;
1304 aAny = xSet->getPropertyValue(
"AppletName");
1305 aAny >>= aAppletName;
1306 if( !aAppletName.isEmpty() )
1315 bool bScript =
false;
1316 aAny = xSet->getPropertyValue(
"AppletIsScript");
1354 uno::Sequence < beans::PropertyValue > aProps;
1355 aAny = xSet->getPropertyValue(
"AppletCommands");
1360 std::vector<sal_uLong> aParams;
1361 size_t i = aCommands.
size();
1364 const SvCommand& rCommand = aCommands[ --i ];
1365 const OUString& rName = rCommand.
GetCommand();
1377 aParams.push_back( i );
1385 size_t ii = aParams.size();
1388 const SvCommand& rCommand = aCommands[ aParams[--ii] ];
1389 const OUString& rName = rCommand.
GetCommand();
1405 if( aCommands.
size() )
1413 uno::Sequence < beans::PropertyValue > aProps;
1414 aAny = xSet->getPropertyValue(
"PluginCommands");
1419 for(
size_t i = 0;
i < aCommands.
size();
i++ )
1422 const OUString& rName = rCommand.
GetCommand();
1443 if( !aEndTags.isEmpty() )
1458 OSL_ENSURE( pOLENd,
"OLE-Node expected" );
1467 uno::Reference<document::XEmbeddedObjectSupplier2> xEmbeddedObjectSupplier(xTextContent, uno::UNO_QUERY);
1468 uno::Reference<frame::XStorable> xStorable(xEmbeddedObjectSupplier->getEmbeddedObject(), uno::UNO_QUERY);
1469 SAL_WARN_IF(!xStorable.is(),
"sw.html",
"OutHTML_FrameFormatOLENodeGrf: no embedded object");
1472 uno::Reference<lang::XServiceInfo> xServiceInfo(xStorable, uno::UNO_QUERY);
1474 if (xServiceInfo.is())
1476 if (xServiceInfo->supportsService(
"com.sun.star.sheet.SpreadsheetDocument"))
1477 aFilter =
"HTML (StarCalc)";
1478 else if (xServiceInfo->supportsService(
"com.sun.star.text.TextDocument"))
1479 aFilter =
"HTML (StarWriter)";
1482 if (xStorable.is() && !aFilter.isEmpty())
1490 aMediaDescriptor[
"FilterName"] <<= aFilter;
1491 aMediaDescriptor[
"FilterOptions"] <<= OUString(
"SkipHeaderFooter");
1492 aMediaDescriptor[
"OutputStream"] <<= xOutputStream;
1493 xStorable->storeToURL(
"private:stream", aMediaDescriptor.getAsConstPropertyValueList());
1495 OString
aData(static_cast<const char*>(aStream.
GetData()), static_cast<sal_Int32>(aStream.
GetSize()));
1501 catch ( uno::Exception& )
1511 SAL_WARN(
"sw.html",
"Unexpected missing OLE fallback graphic");
1518 bool bObjectOpened =
false;
1519 OUString aRTFType =
"text/rtf";
1525 if (rHTMLWrt.
mbXHTML && pDocSh)
1531 OUString aFileName = lcl_CalculateFileName(rHTMLWrt.
GetOrigFileName(), aGraphic,
"ole");
1535 uno::Reference<embed::XEmbeddedObject> xEmbeddedObject = rOLEObj.
GetOleRef();
1538 uno::Reference<io::XActiveDataStreamer> xStreamProvider;
1539 uno::Reference<embed::XEmbedPersist2> xOwnEmbedded;
1540 if (xEmbeddedObject.is())
1542 xStreamProvider.set(xEmbeddedObject, uno::UNO_QUERY);
1543 xOwnEmbedded.set(xEmbeddedObject, uno::UNO_QUERY);
1545 if (xStreamProvider.is())
1548 uno::Reference<io::XInputStream>
xStream(xStreamProvider->getStream(), uno::UNO_QUERY);
1555 aFileType = aRTFType;
1559 else if (xOwnEmbedded.is())
1574 aFileType = aRTFType;
1580 const OUString& aStreamName = rOLEObj.GetCurrentPersistName();
1581 uno::Reference<embed::XStorage> xStorage = pDocSh->GetStorage();
1582 uno::Reference<io::XStream> xInStream;
1586 xInStream = xStorage->openStreamElement(aStreamName, embed::ElementModes::READ);
1587 }
catch (
const uno::Exception&)
1589 TOOLS_WARN_EXCEPTION(
"sw.html",
"OutHTML_FrameFormatOLENodeGrf: failed to open stream element");
1595 xOutStream->getOutputStream());
1598 uno::Reference<beans::XPropertySet> xOutStreamProps(xInStream, uno::UNO_QUERY);
1599 if (xOutStreamProps.is())
1600 xOutStreamProps->getPropertyValue(
"MediaType") >>= aFileType;
1601 if (!aRTFType.isEmpty())
1603 aFileType = aRTFType;
1613 if (!aFileType.isEmpty())
1616 bObjectOpened =
true;
1620 OUString aGraphicURL;
1626 aGraphicURL = *pTempFileName;
1628 OUString aFilterName(
"JPG");
1629 XOutFlags nFlags = XOutFlags::UseGifIfPossible | XOutFlags::UseNativeIfPossible;
1633 aFilterName =
"PNG";
1634 nFlags = XOutFlags::NONE;
1635 aMimeType =
"image/png";
1637 if (aGraphic.GetType() == GraphicType::NONE)
1640 aGraphicURL = lcl_CalculateFileName(rHTMLWrt.
GetOrigFileName(), aGraphic,
"png");
1641 osl::File aFile(aGraphicURL);
1642 aFile.open(osl_File_OpenFlag_Create);
1666 nFlags,
"ole",
nullptr, aMimeType );
#define OOO_STRING_SVTOOLS_HTML_O_src
css::uno::Reference< css::embed::XEmbeddedObject > CreateEmbeddedObject(const css::uno::Sequence< sal_Int8 > &, OUString &, OUString const *pBaseURL=nullptr)
static SwHtmlOptType GetOptionType(const OUString &rName, bool bApplet)
static void SetSpace(const Size &rPixSpace, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFlyItemSet)
const char *const aClassID
const HtmlFrmOpts HTML_FRMOPTS_IFRAME
const OUString & GetBaseURL() const
EnumT GetEnum(const HTMLOptionEnum< EnumT > *pOptEnums, EnumT nDflt=static_cast< EnumT >(0)) const
#define OOO_STRING_SW_HTML_O_Hidden
const OUString & GetName() const
HtmlOptionId GetToken() const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
bool mbXHTML
If XHTML markup should be written instead of HTML.
sal_uInt16 GetLower() const
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars=nullptr)
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
void setWidth(tools::Long nWidth)
#define HTML_DFLT_APPLET_HEIGHT
const SwOLEObj & GetOLEObj() const
SwDocShell * GetDocShell()
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
BitmapChecksum GetChecksum() const
#define HTML_DFLT_EMBED_HEIGHT
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool WrapOleInRtf(SvStream &rOle2, SvStream &rRtf, SwOLENode &rOLENode)
Wraps an OLE2 container binary in an RTF fragment.
tools::Long getWidth() const
const HtmlFrmOpts HTML_FRMOPTS_EMBED
const HtmlFrmOpts HTML_FRMOPTS_HIDDEN_EMBED
#define SO3_IFRAME_CLASSID
Writer & OutHTML_FrameFormatOLENodeGrf(Writer &rWrt, const SwFrameFormat &rFrameFormat, bool bInCntnr)
tools::Long GetRight() const
void SetTitle(const OUString &rTitle)
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
const OUString & GetString() const
OUString m_aNonConvertableCharacters
#define OOO_STRING_SVTOOLS_HTML_iframe
sal_uInt64 Seek(sal_uInt64 nPos)
Content, content of frame (header, footer, fly).
SvStream & WriteOString(const OString &rStr)
SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative(OUString const &baseUriReference, OUString const &uriReference)
SvStream & WriteCharPtr(const char *pBuf)
static OutputDevice * GetDefaultDevice()
void OutNewLine(bool bCheck=false)
css::uno::Any const & rValue
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
SvxCSS1LengthType m_eHeightType
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, const OString &rStr, bool bOn=true)
Sequence< PropertyValue > aArguments
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
bool setExtension(OUString const &rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
#define HTML_DFLT_APPLET_WIDTH
void SwitchPersistence(const css::uno::Reference< css::embed::XStorage > &)
#define WARN_SWG_POOR_LOAD
svt::EmbeddedObjectRef & GetObject()
sal_uLong GetIndex() const
#define OOO_STRING_SVTOOLS_HTML_O_mayscript
static OUString GetAbsURL(OUString const &rTheBaseURIRef, OUString const &rTheRelURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static void Out_FrameDescriptor(SvStream &, const OUString &rBaseURL, const css::uno::Reference< css::beans::XPropertySet > &xSet, rtl_TextEncoding eDestEnc=RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars=nullptr)
void FillSequence(css::uno::Sequence< css::beans::PropertyValue > &) const
static ErrCode WriteGraphic(const Graphic &rGraphic, OUString &rFileName, const OUString &rFilterName, const XOutFlags nFlags, const Size *pMtfSize_100TH_MM=nullptr, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
OUString CreateUniqueObjectName()
#define OOO_STRING_SVTOOLS_HTML_O_code
static OUString StripQueryFromPath(const OUString &rBase, const OUString &rPath)
Strips query and fragment from a URL path if base URL is a file:// one.
bool IsHTMLMode(sal_uInt32 nMode) const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
constexpr OUStringLiteral aData
void OutImplicitMark(std::u16string_view rMark, const char *pMarkType)
tools::Long getHeight() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
#define TOOLS_WARN_EXCEPTION(area, stream)
The graphic frame is a replacement image of an OLE object.
rtl_TextEncoding m_eDestEnc
const OUString & GetArgument() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void FillFromSequence(const css::uno::Sequence< css::beans::PropertyValue > &)
void InsertFloatingFrame()
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
const HtmlFrmOpts HTML_FRMOPTS_OLE_CSS1
const INetURLObject & GetURL() const
const Graphic * GetGraphic()
tools::Long GetLeft() const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
tools::Long Width() const
const char *const aMimeType[]
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void Append(const OUString &rCommand, const OUString &rArg)
#define OOO_STRING_SVTOOLS_HTML_O_name
#define OOO_STRING_SVTOOLS_HTML_embed
SwNodes & GetNodes()
Node is in which nodes-array/doc?
const HtmlFrmOpts HTML_FRMOPTS_APPLET
#define SO3_APPLET_CLASSID
virtual Size GetTwipSize() const override
Writer & OutHTML_Image(Writer &rWrt, const SwFrameFormat &rFrameFormat, const OUString &rGraphicURL, Graphic const &rGraphic, const OUString &rAlternateText, const Size &rRealSize, HtmlFrmOpts nFrameOpts, const char *pMarkType, const ImageMap *pAltImgMap, const OUString &rMimeType)
bool SetFlyFrameAttr(SwFrameFormat &rFlyFormat, SfxItemSet &rSet)
Frame cannot be moved in Var-direction.
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
const HtmlFrmOpts HTML_FRMOPTS_APPLET_CNTNR
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
sal_uInt32 GetNumber() const
bool setBase(OUString const &rTheBase, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool HasFrameBorder() const
const SwNodeIndex * GetContentIdx() const
Point PixelToLogic(const Point &rDevicePt) const
OUString m_aRTFOLEMimeType
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
const OUString & GetCommand() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
#define OOO_STRING_SVTOOLS_HTML_O_codebase
const Size & GetMargin() const
constexpr sal_uInt16 RES_FRMATR_END(131)
const HtmlFrmOpts HTML_FRMOPTS_APPLET_ALL
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const HtmlFrmOpts HTML_FRMOPTS_IFRAME_ALL
#define OOO_STRING_SVTOOLS_HTML_applet
SvxCSS1LengthType m_eWidthType
ScrollingMode GetScrollingMode() const
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
void ParseFrameOptions(SfxFrameDescriptor *pFrame, const HTMLOptions &rOptions, const OUString &rBaseURL)
#define HTMLMODE_ABS_POS_FLY
Any makeAny(Color const &value)
#define HTML_DFLT_EMBED_WIDTH
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
OUString GetTitle() const
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
void ExportOLEObject(svt::EmbeddedObjectRef const &rObj, SotStorage &rDestStg)
::std::vector< HTMLOption > HTMLOptions
COMPHELPER_DLLPUBLIC bool isFileUrl(OUString const &url)
bool ExtractOleFromRtf(SvStream &rRtf, SvStream &rOle, bool &bOwnFormat)
Extracts an OLE2 container binary from an RTF fragment.
const OUString * GetOrigFileName() const
tools::Long Height() const
void SetGraphic(const Graphic &rGraphic, const OUString &rMediaType)
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
#define OOO_STRING_SVTOOLS_HTML_param
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
SvStream & WriteChar(char nChar)
const OUString & GetTokenString() const
bool InsertEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString &)
#define OOO_STRING_SVTOOLS_HTML_O_value
void setHeight(tools::Long nHeight)
#define OOO_STRING_SVTOOLS_HTML_O_type
static GraphicFilter & GetGraphicFilter()
#define SAL_WARN(area, stream)
bool SetURL(OUString const &rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
static css::uno::Reference< css::text::XTextContent > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
const HtmlFrmOpts HTML_FRMOPTS_EMBED_ALL
#define OOO_STRING_SVTOOLS_HTML_object
static sal_uInt16 GuessOLENodeFrameType(const SwNode &rNd)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
#define OOO_STRING_SVTOOLS_HTML_span
#define SO3_PLUGIN_CLASSID
OString read_uInt8s_ToOString(SvStream &rStrm, std::size_t nLen)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
bool MakeId(const OUString &rId)
const HtmlFrmOpts HTML_FRMOPTS_EMBED_CNTNR
const HtmlFrmOpts HTML_FRMOPTS_IFRAME_CNTNR
static void SetFixSize(const Size &rPixSize, const Size &rTwipDfltSize, bool bPercentWidth, bool bPercentHeight, SvxCSS1PropertyInfo const &rPropInfo, SfxItemSet &rFlyItemSet)
OString OutFrameFormatOptions(const SwFrameFormat &rFrameFormat, const OUString &rAltText, HtmlFrmOpts nFrameOpts)
OUString getExtension(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
Writer & OutHTML_FrameFormatOLENode(Writer &rWrt, const SwFrameFormat &rFrameFormat, bool bInCntnr)
sal_uInt16 GetUpper() const
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
void OutCSS1_FrameFormatOptions(const SwFrameFormat &rFrameFormat, HtmlFrmOpts nFrameOpts, const SdrObject *pSdrObj=nullptr, const SfxItemSet *pItemSet=nullptr)
Base class of the Writer document model elements.