LibreOffice Module sw (master)  1
htmlflywriter.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 <com/sun/star/text/HoriOrientation.hpp>
21 #include <com/sun/star/text/VertOrientation.hpp>
22 #include <com/sun/star/text/RelOrientation.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <hintids.hxx>
25 #include <tools/fract.hxx>
26 #include <svl/urihelper.hxx>
27 #include <vcl/svapp.hxx>
28 #include <sfx2/event.hxx>
29 #include <svtools/htmlkywd.hxx>
30 #include <svtools/htmlout.hxx>
31 #include <svtools/htmltokn.h>
32 #include <vcl/imap.hxx>
33 #include <vcl/imapobj.hxx>
34 #include <svtools/htmlcfg.hxx>
35 #include <svtools/HtmlWriter.hxx>
36 #include <svx/svdouno.hxx>
37 #include <svx/xoutbmp.hxx>
38 #include <editeng/boxitem.hxx>
39 #include <editeng/lrspitem.hxx>
40 #include <editeng/ulspitem.hxx>
41 #include <editeng/brushitem.hxx>
42 #include <sal/log.hxx>
43 #include <osl/diagnose.h>
44 #include <svx/svdograf.hxx>
45 
46 #include <fmtanchr.hxx>
47 #include <fmtornt.hxx>
48 #include <fmturl.hxx>
49 #include <fmtfsize.hxx>
50 #include <fmtclds.hxx>
51 #include <fmtcntnt.hxx>
52 #include <fmtsrnd.hxx>
53 #include <fmtinfmt.hxx>
54 #include <txtinet.hxx>
55 #include <frmatr.hxx>
56 #include <grfatr.hxx>
57 #include <flypos.hxx>
58 #include <ndgrf.hxx>
59 
60 #include <doc.hxx>
61 #include <ndtxt.hxx>
62 #include <pam.hxx>
63 #include <swerror.h>
64 #include <frmfmt.hxx>
65 #include "wrthtml.hxx"
66 #include "htmlatr.hxx"
67 #include "htmlfly.hxx"
68 #include "htmlreqifreader.hxx"
69 
70 using namespace css;
71 
89 
101 
108 
115 
123 
131 
132 static Writer& OutHTML_FrameFormatTableNode( Writer& rWrt, const SwFrameFormat& rFrameFormat );
133 static Writer& OutHTML_FrameFormatAsMulticol( Writer& rWrt, const SwFrameFormat& rFormat,
134  bool bInCntnr );
135 static Writer& OutHTML_FrameFormatAsSpacer( Writer& rWrt, const SwFrameFormat& rFormat );
137  const SwFrameFormat& rFrameFormat, bool bSpan );
138 static Writer& OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& rFormat, bool bPNGFallback );
139 
140 static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rFormat,
141  bool bInCntnr, bool bPNGFallback );
142 
143 static Writer& OutHTML_FrameFormatAsMarquee( Writer& rWrt, const SwFrameFormat& rFrameFormat,
144  const SdrObject& rSdrObj );
145 
147 {
148  { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SvMacroItemId::OnImageLoadDone },
149  { OOO_STRING_SVTOOLS_HTML_O_SDonabort, OOO_STRING_SVTOOLS_HTML_O_onabort, SvMacroItemId::OnImageLoadCancel },
150  { OOO_STRING_SVTOOLS_HTML_O_SDonerror, OOO_STRING_SVTOOLS_HTML_O_onerror, SvMacroItemId::OnImageLoadError },
151  { nullptr, nullptr, SvMacroItemId::NONE }
152 };
153 
155 {
158  { nullptr, nullptr, SvMacroItemId::NONE }
159 };
160 
161 sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat,
162  const SdrObject*& rpSdrObj )
163 {
165 
166  if( RES_DRAWFRMFMT == rFrameFormat.Which() )
167  {
168  // use an arbitrary draw object as the default value
169  eType = HTML_FRMTYPE_DRAW;
170 
171  const SdrObject *pObj =
172  SwHTMLWriter::GetMarqueeTextObj( static_cast<const SwDrawFrameFormat &>(rFrameFormat) );
173  if( pObj )
174  {
175  // scrolling text
176  rpSdrObj = pObj;
177  eType = HTML_FRMTYPE_MARQUEE;
178  }
179  else
180  {
181  pObj = GetHTMLControl( static_cast<const SwDrawFrameFormat &>(rFrameFormat) );
182 
183  if( pObj )
184  {
185  // Form control
186  rpSdrObj = pObj;
187  eType = HTML_FRMTYPE_CONTROL;
188  }
189  }
190  }
191  else
192  {
193  // use a text frame as the default value
194  eType = HTML_FRMTYPE_TEXT;
195 
196  const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
197  SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1;
198  const SwNode* pNd = m_pDoc->GetNodes()[ nStt ];
199 
200  if( pNd->IsGrfNode() )
201  {
202  // graphic node
203  eType = HTML_FRMTYPE_GRF;
204  }
205  else if( pNd->IsOLENode() )
206  {
207  // applet, plugin, floating frame
208  eType = static_cast<SwHTMLFrameType>(GuessOLENodeFrameType( *pNd ));
209  }
210  else
211  {
212  SwNodeOffset nEnd = m_pDoc->GetNodes()[nStt-1]->EndOfSectionIndex();
213 
214  const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
215  const SwFormatCol* pFormatCol = rItemSet.GetItemIfSet( RES_COL );
216  if( pFormatCol && pFormatCol->GetNumCols() > 1 )
217  {
218  // frame with columns
219  eType = HTML_FRMTYPE_MULTICOL;
220  }
221  else if( pNd->IsTableNode() )
222  {
223  const SwTableNode *pTableNd = pNd->GetTableNode();
224  SwNodeOffset nTableEnd = pTableNd->EndOfSectionIndex();
225 
226  if( nTableEnd+1 == nEnd )
227  {
228  // table
229  eType = HTML_FRMTYPE_TABLE;
230  }
231  else if( nTableEnd+2 == nEnd )
232  {
233  // table with caption
234  eType = HTML_FRMTYPE_TABLE_CAP;
235  }
236  }
237  else if( pNd->IsTextNode() )
238  {
239  const SwTextNode *pTextNd = pNd->GetTextNode();
240 
241  bool bEmpty = false;
242  if( nStt==nEnd-1 && !pTextNd->Len() )
243  {
244  // empty frame? Only if no frame is
245  // anchored to the text or start node.
246  bEmpty = true;
247  if( m_pHTMLPosFlyFrames )
248  {
249  for( auto & pHTMLPosFlyFrame : *m_pHTMLPosFlyFrames )
250  {
251  SwNodeOffset nIdx = pHTMLPosFlyFrame->GetNdIndex().GetIndex();
252  bEmpty = (nIdx != nStt) && (nIdx != nStt-1);
253  if( !bEmpty || nIdx > nStt )
254  break;
255  }
256  }
257  }
258  if( bEmpty )
259  {
260  std::unique_ptr<SvxBrushItem> aBrush = rFrameFormat.makeBackgroundBrushItem();
263  if( aBrush &&
264  (GPOS_NONE != aBrush->GetGraphicPos() ||
265  aBrush->GetColor() != COL_TRANSPARENT ))
266  {
267  bEmpty = false;
268  }
269  }
270  if( bEmpty )
271  {
272  // empty frame
273  eType = HTML_FRMTYPE_EMPTY;
274  }
275  else if( m_pDoc->GetNodes()[nStt+1]->IsTableNode() )
276  {
277  const SwTableNode *pTableNd =
278  m_pDoc->GetNodes()[nStt+1]->GetTableNode();
279  if( pTableNd->EndOfSectionIndex()+1 == nEnd )
280  {
281  // table with heading
282  eType = HTML_FRMTYPE_TABLE_CAP;
283  }
284  }
285  }
286  }
287  }
288 
289  return static_cast< sal_uInt16 >(eType);
290 }
291 
293 {
294  OSL_ENSURE( HTML_CFG_MAX+1 == MAX_BROWSERS,
295  "number of browser configurations has changed" );
296 
297  SwPosFlyFrames aFlyPos(
298  m_pDoc->GetAllFlyFormats(m_bWriteAll ? nullptr : m_pCurrentPam.get(), true));
299 
300  for(const auto& rpItem : aFlyPos)
301  {
302  const SwFrameFormat& rFrameFormat = rpItem->GetFormat();
303  const SdrObject *pSdrObj = nullptr;
304  const SwPosition *pAPos;
305  const SwContentNode *pACNd;
306  SwHTMLFrameType eType = static_cast<SwHTMLFrameType>(GuessFrameType( rFrameFormat, pSdrObj ));
307 
308  AllHtmlFlags nMode;
309  const SwFormatAnchor& rAnchor = rFrameFormat.GetAnchor();
310  sal_Int16 eHoriRel = rFrameFormat.GetHoriOrient().GetRelationOrient();
311  switch( rAnchor.GetAnchorId() )
312  {
313  case RndStdIds::FLY_AT_PAGE:
314  case RndStdIds::FLY_AT_FLY:
315  nMode = aHTMLOutFramePageFlyTable[eType][m_nExportMode];
316  break;
317 
318  case RndStdIds::FLY_AT_PARA:
319  // frames that are anchored to a paragraph are only placed
320  // before the paragraph, if the paragraph has a
321  // spacing.
322  if( text::RelOrientation::FRAME == eHoriRel &&
323  (pAPos = rAnchor.GetContentAnchor()) != nullptr &&
324  (pACNd = pAPos->nNode.GetNode().GetContentNode()) != nullptr )
325  {
326  const SvxLRSpaceItem& rLRItem =
327  pACNd->GetAttr(RES_LR_SPACE);
328  if( rLRItem.GetTextLeft() || rLRItem.GetRight() )
329  {
330  nMode = aHTMLOutFrameParaFrameTable[eType][m_nExportMode];
331  break;
332  }
333  }
334  nMode = aHTMLOutFrameParaPrtAreaTable[eType][m_nExportMode];
335  break;
336 
337  case RndStdIds::FLY_AT_CHAR:
338  if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
339  nMode = aHTMLOutFrameParaPrtAreaTable[eType][m_nExportMode];
340  else
341  nMode = aHTMLOutFrameParaOtherTable[eType][m_nExportMode];
342  break;
343 
344  default:
345  nMode = aHTMLOutFrameParaPrtAreaTable[eType][m_nExportMode];
346  break;
347  }
348 
349  if( !m_pHTMLPosFlyFrames )
350  m_pHTMLPosFlyFrames.reset(new SwHTMLPosFlyFrames);
351 
352  m_pHTMLPosFlyFrames->insert( std::make_unique<SwHTMLPosFlyFrame>(*rpItem, pSdrObj, nMode) );
353  }
354 }
355 
356 bool SwHTMLWriter::OutFlyFrame( SwNodeOffset nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos )
357 {
358  bool bFlysLeft = false; // Are there still Flys left at the current node position?
359 
360  // OutFlyFrame can be called recursively. Thus, sometimes it is
361  // necessary to start over after a Fly was returned.
362  bool bRestart = true;
363  while( m_pHTMLPosFlyFrames && bRestart )
364  {
365  bFlysLeft = bRestart = false;
366 
367  // search for the beginning of the FlyFrames
368  size_t i {0};
369 
370  for( ; i < m_pHTMLPosFlyFrames->size() &&
371  (*m_pHTMLPosFlyFrames)[i]->GetNdIndex().GetIndex() < nNdIdx; i++ )
372  ;
373  for( ; !bRestart && i < m_pHTMLPosFlyFrames->size() &&
374  (*m_pHTMLPosFlyFrames)[i]->GetNdIndex().GetIndex() == nNdIdx; i++ )
375  {
376  SwHTMLPosFlyFrame *pPosFly = (*m_pHTMLPosFlyFrames)[i].get();
377  if( ( HtmlPosition::Any == nPos ||
378  pPosFly->GetOutPos() == nPos ) &&
379  pPosFly->GetContentIndex() == nContentIdx )
380  {
381  // It is important to remove it first, because additional
382  // elements or the whole array could be deleted on
383  // deeper recursion levels.
384  std::unique_ptr<SwHTMLPosFlyFrame> flyHolder = m_pHTMLPosFlyFrames->erase_extract(i);
385  i--;
386  if( m_pHTMLPosFlyFrames->empty() )
387  {
388  m_pHTMLPosFlyFrames.reset();
389  bRestart = true; // not really, only exit the loop
390  }
391 
392  HTMLOutFuncs::FlushToAscii(Strm()); // it was one time only; do we still need it?
393 
394  OutFrameFormat( pPosFly->GetOutMode(), pPosFly->GetFormat(),
395  pPosFly->GetSdrObject() );
396  switch( pPosFly->GetOutFn() )
397  {
398  case HtmlOut::Div:
399  case HtmlOut::Span:
400  case HtmlOut::MultiCol:
401  case HtmlOut::TableNode:
402  bRestart = true; // It could become recursive here
403  break;
404  default: break;
405  }
406  }
407  else
408  {
409  bFlysLeft = true;
410  }
411  }
412  }
413 
414  return bFlysLeft;
415 }
416 
417 void SwHTMLWriter::OutFrameFormat( AllHtmlFlags nMode, const SwFrameFormat& rFrameFormat,
418  const SdrObject *pSdrObject )
419 {
420  HtmlContainerFlags nCntnrMode = nMode.nContainer;
421  HtmlOut nOutMode = nMode.nOut;
422  OString aContainerStr;
423  if( HtmlContainerFlags::NONE != nCntnrMode )
424  {
425 
426  if( m_bLFPossible && HtmlContainerFlags::Div == nCntnrMode )
427  OutNewLine();
428 
429  OStringBuffer sOut;
430  aContainerStr = (HtmlContainerFlags::Div == nCntnrMode)
433  sOut.append("<" + GetNamespace() + aContainerStr + " "
435  "sd-abs-pos\"");
436  Strm().WriteOString( sOut.makeStringAndClear() );
437 
438  // Output a width for non-draw objects
439  HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_CNTNR;
440 
441  // For frames with columns we can also output the background
442  if( HtmlOut::MultiCol == nOutMode )
444 
445  if( IsHTMLMode( HTMLMODE_BORDER_NONE ) )
446  nFrameFlags |= HtmlFrmOpts::SNoBorder;
447  OutCSS1_FrameFormatOptions( rFrameFormat, nFrameFlags, pSdrObject );
448  Strm().WriteChar( '>' );
449 
450  if( HtmlContainerFlags::Div == nCntnrMode )
451  {
452  IncIndentLevel();
453  m_bLFPossible = true;
454  }
455  }
456 
457  switch( nOutMode )
458  {
459  case HtmlOut::TableNode: // OK
460  OSL_ENSURE( aContainerStr.isEmpty(), "Table: Container is not supposed to be here" );
461  OutHTML_FrameFormatTableNode( *this, rFrameFormat );
462  break;
463  case HtmlOut::GraphicNode: // OK
464  OutHTML_FrameFormatGrfNode( *this, rFrameFormat, !aContainerStr.isEmpty(), /*bPNGFallback=*/true );
465  break;
466  case HtmlOut::OleNode: // OK
467  OutHTML_FrameFormatOLENode( *this, rFrameFormat, !aContainerStr.isEmpty() );
468  break;
469  case HtmlOut::OleGraphic: // OK
470  OutHTML_FrameFormatOLENodeGrf( *this, rFrameFormat, !aContainerStr.isEmpty() );
471  break;
472  case HtmlOut::Div:
473  case HtmlOut::Span:
474  OSL_ENSURE( aContainerStr.isEmpty(), "Div: Container is not supposed to be here" );
475  OutHTML_FrameFormatAsDivOrSpan( *this, rFrameFormat, HtmlOut::Span==nOutMode );
476  break;
477  case HtmlOut::MultiCol: // OK
478  OutHTML_FrameFormatAsMulticol( *this, rFrameFormat, !aContainerStr.isEmpty() );
479  break;
480  case HtmlOut::Spacer: // OK
481  OSL_ENSURE( aContainerStr.isEmpty(), "Spacer: Container is not supposed to be here" );
482  OutHTML_FrameFormatAsSpacer( *this, rFrameFormat );
483  break;
484  case HtmlOut::Control: // OK
486  static_cast<const SwDrawFrameFormat &>(rFrameFormat), dynamic_cast<const SdrUnoObj&>(*pSdrObject),
487  !aContainerStr.isEmpty() );
488  break;
489  case HtmlOut::AMarquee:
490  OutHTML_FrameFormatAsMarquee( *this, rFrameFormat, *pSdrObject );
491  break;
492  case HtmlOut::Marquee:
493  OSL_ENSURE( aContainerStr.isEmpty(), "Marquee: Container is not supposed to be here" );
495  static_cast<const SwDrawFrameFormat &>(rFrameFormat), *pSdrObject );
496  break;
498  OutHTML_FrameFormatAsImage( *this, rFrameFormat, /*bPNGFallback=*/true );
499  break;
500  }
501 
502  if( HtmlContainerFlags::Div == nCntnrMode )
503  {
504  DecIndentLevel();
505  if( m_bLFPossible )
506  OutNewLine();
507  HTMLOutFuncs::Out_AsciiTag( Strm(), OStringConcatenation(GetNamespace() + OOO_STRING_SVTOOLS_HTML_division), false );
508  m_bLFPossible = true;
509  }
510  else if( HtmlContainerFlags::Span == nCntnrMode )
511  HTMLOutFuncs::Out_AsciiTag( Strm(), OStringConcatenation(GetNamespace() + OOO_STRING_SVTOOLS_HTML_span), false );
512 }
513 
515  const OUString& rAlternateText,
516  HtmlFrmOpts nFrameOpts )
517 {
518  OString sRetEndTags;
519  OStringBuffer sOut;
520  const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
521 
522  // Name
523  if( (nFrameOpts & (HtmlFrmOpts::Id|HtmlFrmOpts::Name)) &&
524  !rFrameFormat.GetName().isEmpty() )
525  {
526  const char *pStr =
528  sOut.append(OString::Concat(" ") + pStr + "=\"");
529  Strm().WriteOString( sOut.makeStringAndClear() );
530  HTMLOutFuncs::Out_String( Strm(), rFrameFormat.GetName() );
531  sOut.append('\"');
532  }
533 
534  // Name
535  if( nFrameOpts & HtmlFrmOpts::Dir )
536  {
537  SvxFrameDirection nDir = GetHTMLDirection( rItemSet );
538  Strm().WriteOString( sOut.makeStringAndClear() );
539  OutDirection( nDir );
540  }
541 
542  // ALT
543  if( (nFrameOpts & HtmlFrmOpts::Alt) && !rAlternateText.isEmpty() )
544  {
545  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_alt "=\"");
546  Strm().WriteOString( sOut.makeStringAndClear() );
547  HTMLOutFuncs::Out_String( Strm(), rAlternateText );
548  sOut.append('\"');
549  }
550 
551  // ALIGN
552  const char *pStr = nullptr;
553  RndStdIds eAnchorId = rFrameFormat.GetAnchor().GetAnchorId();
554  if( (nFrameOpts & HtmlFrmOpts::Align) &&
555  ((RndStdIds::FLY_AT_PARA == eAnchorId) || (RndStdIds::FLY_AT_CHAR == eAnchorId)) )
556  {
557  // MIB 12.3.98: Wouldn't it be more clever to left-align frames that
558  // are anchored to a paragraph if necessary, instead of inserting them
559  // as being anchored to characters?
560  const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient();
561  if( !(nFrameOpts & HtmlFrmOpts::SAlign) ||
562  text::RelOrientation::FRAME == rHoriOri.GetRelationOrient() ||
563  text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() )
564  {
565  pStr = text::HoriOrientation::RIGHT == rHoriOri.GetHoriOrient()
568  }
569  }
570  const SwFormatVertOrient* pVertOrient;
571  if( (nFrameOpts & HtmlFrmOpts::Align) && !pStr &&
572  ( !(nFrameOpts & HtmlFrmOpts::SAlign) ||
573  (RndStdIds::FLY_AS_CHAR == eAnchorId) ) &&
574  (pVertOrient = rItemSet.GetItemIfSet( RES_VERT_ORIENT )) )
575  {
576  switch( pVertOrient->GetVertOrient() )
577  {
578  case text::VertOrientation::LINE_TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_top; break;
579  case text::VertOrientation::CHAR_TOP:
580  case text::VertOrientation::BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_texttop; break; // not possible
581  case text::VertOrientation::LINE_CENTER:
582  case text::VertOrientation::CHAR_CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_absmiddle; break; // not possible
583  case text::VertOrientation::CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_middle; break;
584  case text::VertOrientation::LINE_BOTTOM:
585  case text::VertOrientation::CHAR_BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_absbottom; break; // not possible
586  case text::VertOrientation::TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_bottom; break;
587  case text::VertOrientation::NONE: break;
588  }
589  }
590  if( pStr )
591  {
592  sOut.append(OString::Concat(" " OOO_STRING_SVTOOLS_HTML_O_align "=\"") +
593  pStr + "\"");
594  }
595 
596  // HSPACE and VSPACE
597  Size aTwipSpc( 0, 0 );
598  const SvxLRSpaceItem* pLRSpaceItem;
599  if( (nFrameOpts & (HtmlFrmOpts::Space|HtmlFrmOpts::MarginSize)) &&
600  (pLRSpaceItem = rItemSet.GetItemIfSet( RES_LR_SPACE )) )
601  {
602  aTwipSpc.setWidth(
603  ( pLRSpaceItem->GetLeft() + pLRSpaceItem->GetRight() ) / 2 );
604  m_nDfltLeftMargin = m_nDfltRightMargin = aTwipSpc.Width();
605  }
606  const SvxULSpaceItem* pULSpaceItem;
607  if( (nFrameOpts & (HtmlFrmOpts::Space|HtmlFrmOpts::MarginSize)) &&
608  (pULSpaceItem = rItemSet.GetItemIfSet( RES_UL_SPACE )) )
609  {
610  aTwipSpc.setHeight(
611  ( pULSpaceItem->GetUpper() + pULSpaceItem->GetLower() ) / 2 );
612  m_nDfltTopMargin = m_nDfltBottomMargin = o3tl::narrowing<sal_uInt16>(aTwipSpc.Height());
613  }
614 
615  if( (nFrameOpts & HtmlFrmOpts::Space) &&
616  (aTwipSpc.Width() || aTwipSpc.Height()) &&
618  {
619  Size aPixelSpc =
621  MapMode(MapUnit::MapTwip) );
622  if( !aPixelSpc.Width() && aTwipSpc.Width() )
623  aPixelSpc.setWidth( 1 );
624  if( !aPixelSpc.Height() && aTwipSpc.Height() )
625  aPixelSpc.setHeight( 1 );
626 
627  if( aPixelSpc.Width() )
628  {
629  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_hspace
630  "=\"" + OString::number(aPixelSpc.Width()) + "\"");
631  }
632 
633  if( aPixelSpc.Height() )
634  {
635  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_vspace
636  "=\"" + OString::number(aPixelSpc.Height()) + "\"");
637  }
638  }
639 
640  // The spacing must be considered for the size, if the corresponding flag
641  // is set.
642  if( nFrameOpts & HtmlFrmOpts::MarginSize )
643  {
644  aTwipSpc.setWidth( aTwipSpc.Width() * -2 );
645  aTwipSpc.setHeight( aTwipSpc.Height() * -2 );
646  }
647  else
648  {
649  aTwipSpc.setWidth( 0 );
650  aTwipSpc.setHeight( 0 );
651  }
652 
653  const SvxBoxItem* pBoxItem;
654  if( !(nFrameOpts & HtmlFrmOpts::AbsSize) &&
655  (pBoxItem = rItemSet.GetItemIfSet( RES_BOX )) )
656  {
657  aTwipSpc.AdjustWidth(pBoxItem->CalcLineSpace( SvxBoxItemLine::LEFT ) );
658  aTwipSpc.AdjustWidth(pBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT ) );
659  aTwipSpc.AdjustHeight(pBoxItem->CalcLineSpace( SvxBoxItemLine::TOP ) );
660  aTwipSpc.AdjustHeight(pBoxItem->CalcLineSpace( SvxBoxItemLine::BOTTOM ) );
661  }
662 
663  // WIDTH and/or HEIGHT
664  // Output SwFrameSize::Variable/SwFrameSize::Minimum only, if ANYSIZE is set
665  const SwFormatFrameSize *pFSItem;
666  if( (nFrameOpts & HtmlFrmOpts::Size) &&
667  (pFSItem = rItemSet.GetItemIfSet( RES_FRM_SIZE )) &&
668  ( (nFrameOpts & HtmlFrmOpts::AnySize) ||
669  SwFrameSize::Fixed == pFSItem->GetHeightSizeType()) )
670  {
671  sal_uInt8 nPercentWidth = pFSItem->GetWidthPercent();
672  sal_uInt8 nPercentHeight = pFSItem->GetHeightPercent();
673 
674  // Size of the object in Twips without margins
675  Size aTwipSz( (nPercentWidth ? 0
676  : pFSItem->GetWidth()-aTwipSpc.Width()),
677  (nPercentHeight ? 0
678  : pFSItem->GetHeight()-aTwipSpc.Height()) );
679 
680  OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, "Frame size minus spacing < 0!!!???" );
681  if( aTwipSz.Width() < 0 )
682  aTwipSz.setWidth( 0 );
683  if( aTwipSz.Height() < 0 )
684  aTwipSz.setHeight( 0 );
685 
686  Size aPixelSz( 0, 0 );
687  if( (aTwipSz.Width() || aTwipSz.Height()) &&
689  {
690  aPixelSz =
692  MapMode(MapUnit::MapTwip) );
693  if( !aPixelSz.Width() && aTwipSz.Width() )
694  aPixelSz.setWidth( 1 );
695  if( !aPixelSz.Height() && aTwipSz.Height() )
696  aPixelSz.setHeight( 1 );
697  }
698 
699  if( (nFrameOpts & HtmlFrmOpts::Width) &&
700  ((nPercentWidth && nPercentWidth!=255) || aPixelSz.Width()) )
701  {
702  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_width "=\"");
703  if( nPercentWidth )
704  sOut.append(static_cast<sal_Int32>(nPercentWidth)).append('%');
705  else
706  sOut.append(static_cast<sal_Int32>(aPixelSz.Width()));
707  sOut.append("\"");
708  }
709 
710  if( (nFrameOpts & HtmlFrmOpts::Height) &&
711  ((nPercentHeight && nPercentHeight!=255) || aPixelSz.Height()) )
712  {
713  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_height "=\"");
714  if( nPercentHeight )
715  sOut.append(static_cast<sal_Int32>(nPercentHeight)).append('%');
716  else
717  sOut.append(static_cast<sal_Int32>(aPixelSz.Height()));
718  sOut.append("\"");
719  }
720  }
721 
722  if (!sOut.isEmpty())
723  Strm().WriteOString( sOut.makeStringAndClear() );
724 
725  // Insert wrap for graphics that are anchored to a paragraph as
726  // <BR CLEAR=...> in the string
727  const SwFormatSurround* pSurround;
728  if( (nFrameOpts & HtmlFrmOpts::BrClear) &&
729  ((RndStdIds::FLY_AT_PARA == rFrameFormat.GetAnchor().GetAnchorId()) ||
730  (RndStdIds::FLY_AT_CHAR == rFrameFormat.GetAnchor().GetAnchorId())) &&
731  (pSurround = rItemSet.GetItemIfSet( RES_SURROUND )) )
732  {
733  sal_Int16 eHoriOri = rFrameFormat.GetHoriOrient().GetHoriOrient();
734  pStr = nullptr;
735  css::text::WrapTextMode eSurround = pSurround->GetSurround();
736  bool bAnchorOnly = pSurround->IsAnchorOnly();
737  switch( eHoriOri )
738  {
739  case text::HoriOrientation::RIGHT:
740  {
741  switch( eSurround )
742  {
743  case css::text::WrapTextMode_NONE:
744  case css::text::WrapTextMode_RIGHT:
746  break;
747  case css::text::WrapTextMode_LEFT:
748  case css::text::WrapTextMode_PARALLEL:
749  if( bAnchorOnly )
750  m_bClearRight = true;
751  break;
752  default:
753  ;
754  }
755  }
756  break;
757 
758  default:
759  // If a frame is centered, it gets left aligned. This
760  // should be taken into account here, too.
761  {
762  switch( eSurround )
763  {
764  case css::text::WrapTextMode_NONE:
765  case css::text::WrapTextMode_LEFT:
767  break;
768  case css::text::WrapTextMode_RIGHT:
769  case css::text::WrapTextMode_PARALLEL:
770  if( bAnchorOnly )
771  m_bClearLeft = true;
772  break;
773  default:
774  ;
775  }
776  }
777  break;
778 
779  }
780 
781  if( pStr )
782  {
783  sOut.append("<" OOO_STRING_SVTOOLS_HTML_linebreak
785  "=\"" + OString::Concat(pStr) + "\">");
786  sRetEndTags = sOut.makeStringAndClear();
787  }
788  }
789  return sRetEndTags;
790 }
791 
792 void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, std::u16string_view rAlternateText, HtmlFrmOpts nFrameOptions)
793 {
794  bool bReplacement = (nFrameOptions & HtmlFrmOpts::Replacement) || mbReqIF;
795  const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
796 
797  // Name
798  if( (nFrameOptions & (HtmlFrmOpts::Id|HtmlFrmOpts::Name)) &&
799  !rFrameFormat.GetName().isEmpty() && !bReplacement)
800  {
801  const char* pAttributeName = (nFrameOptions & HtmlFrmOpts::Id) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name;
802  aHtml.attribute(pAttributeName, rFrameFormat.GetName());
803  }
804 
805  // Name
806  if (nFrameOptions & HtmlFrmOpts::Dir)
807  {
808  SvxFrameDirection nCurrentDirection = GetHTMLDirection(rItemSet);
809  OString sDirection = convertDirection(nCurrentDirection);
810  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_dir, sDirection);
811  }
812 
813  // alt
814  if( (nFrameOptions & HtmlFrmOpts::Alt) && !rAlternateText.empty() && !bReplacement )
815  {
816  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_alt, rAlternateText);
817  }
818 
819  // align
820  const char* pAlignString = nullptr;
821  RndStdIds eAnchorId = rFrameFormat.GetAnchor().GetAnchorId();
822  if( (nFrameOptions & HtmlFrmOpts::Align) &&
823  ((RndStdIds::FLY_AT_PARA == eAnchorId) || (RndStdIds::FLY_AT_CHAR == eAnchorId)) && !bReplacement)
824  {
825  const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient();
826  if( !(nFrameOptions & HtmlFrmOpts::SAlign) ||
827  text::RelOrientation::FRAME == rHoriOri.GetRelationOrient() ||
828  text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() )
829  {
830  pAlignString = text::HoriOrientation::RIGHT == rHoriOri.GetHoriOrient()
833  }
834  }
835  const SwFormatVertOrient* pVertOrient;
836  if( (nFrameOptions & HtmlFrmOpts::Align) && !pAlignString &&
837  ( !(nFrameOptions & HtmlFrmOpts::SAlign) ||
838  (RndStdIds::FLY_AS_CHAR == eAnchorId) ) &&
839  (pVertOrient = rItemSet.GetItemIfSet( RES_VERT_ORIENT )) )
840  {
841  switch( pVertOrient->GetVertOrient() )
842  {
843  case text::VertOrientation::LINE_TOP: pAlignString = OOO_STRING_SVTOOLS_HTML_VA_top; break;
844  case text::VertOrientation::CHAR_TOP:
845  case text::VertOrientation::BOTTOM: pAlignString = OOO_STRING_SVTOOLS_HTML_VA_texttop; break;
846  case text::VertOrientation::LINE_CENTER:
847  case text::VertOrientation::CHAR_CENTER: pAlignString = OOO_STRING_SVTOOLS_HTML_VA_absmiddle; break;
848  case text::VertOrientation::CENTER: pAlignString = OOO_STRING_SVTOOLS_HTML_VA_middle; break;
849  case text::VertOrientation::LINE_BOTTOM:
850  case text::VertOrientation::CHAR_BOTTOM: pAlignString = OOO_STRING_SVTOOLS_HTML_VA_absbottom; break;
851  case text::VertOrientation::TOP: pAlignString = OOO_STRING_SVTOOLS_HTML_VA_bottom; break;
852  case text::VertOrientation::NONE: break;
853  }
854  }
855  if (pAlignString && !bReplacement)
856  {
857  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_align, pAlignString);
858  }
859 
860  // hspace and vspace
861  Size aTwipSpc( 0, 0 );
862  const SvxLRSpaceItem* pLRSpaceItem;
863  if( (nFrameOptions & (HtmlFrmOpts::Space | HtmlFrmOpts::MarginSize)) &&
864  (pLRSpaceItem = rItemSet.GetItemIfSet( RES_LR_SPACE )) )
865  {
866  aTwipSpc.setWidth(
867  ( pLRSpaceItem->GetLeft() + pLRSpaceItem->GetRight() ) / 2 );
868  m_nDfltLeftMargin = m_nDfltRightMargin = aTwipSpc.Width();
869  }
870  const SvxULSpaceItem* pULSpaceItem;
871  if( (nFrameOptions & (HtmlFrmOpts::Space|HtmlFrmOpts::MarginSize)) &&
872  (pULSpaceItem = rItemSet.GetItemIfSet( RES_UL_SPACE )) )
873  {
874  aTwipSpc.setHeight(
875  ( pULSpaceItem->GetUpper() + pULSpaceItem->GetLower() ) / 2 );
876  m_nDfltTopMargin = m_nDfltBottomMargin = o3tl::narrowing<sal_uInt16>(aTwipSpc.Height());
877  }
878 
879  if( (nFrameOptions & HtmlFrmOpts::Space) &&
880  (aTwipSpc.Width() || aTwipSpc.Height()) &&
882  {
883  Size aPixelSpc =
885  MapMode(MapUnit::MapTwip) );
886  if( !aPixelSpc.Width() && aTwipSpc.Width() )
887  aPixelSpc.setWidth( 1 );
888  if( !aPixelSpc.Height() && aTwipSpc.Height() )
889  aPixelSpc.setHeight( 1 );
890 
891  if (aPixelSpc.Width())
892  {
893  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_hspace, static_cast<sal_Int32>(aPixelSpc.Width()));
894  }
895 
896  if (aPixelSpc.Height())
897  {
898  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_vspace, static_cast<sal_Int32>(aPixelSpc.Height()));
899  }
900  }
901 
902  // The spacing must be considered for the size, if the corresponding flag
903  // is set.
904  if( nFrameOptions & HtmlFrmOpts::MarginSize )
905  {
906  aTwipSpc.setWidth( aTwipSpc.Width() * -2 );
907  aTwipSpc.setHeight( aTwipSpc.Height() * -2 );
908  }
909  else
910  {
911  aTwipSpc.setWidth( 0 );
912  aTwipSpc.setHeight( 0 );
913  }
914 
915  const SvxBoxItem* pBoxItem;
916  if( !(nFrameOptions & HtmlFrmOpts::AbsSize) &&
917  (pBoxItem = rItemSet.GetItemIfSet( RES_BOX )) )
918  {
919  aTwipSpc.AdjustWidth(pBoxItem->CalcLineSpace( SvxBoxItemLine::LEFT ) );
920  aTwipSpc.AdjustWidth(pBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT ) );
921  aTwipSpc.AdjustHeight(pBoxItem->CalcLineSpace( SvxBoxItemLine::TOP ) );
922  aTwipSpc.AdjustHeight(pBoxItem->CalcLineSpace( SvxBoxItemLine::BOTTOM ) );
923  }
924 
925  // "width" and/or "height"
926  // Only output SwFrameSize::Variable/SwFrameSize::Minimum if ANYSIZE is set
927  std::optional<SwFormatFrameSize> aFrameSize;
928  const SwFormatFrameSize* pFSItem = rItemSet.GetItemIfSet( RES_FRM_SIZE );
929  const SdrObject* pObject;
930  if (!pFSItem && (pObject = rFrameFormat.FindSdrObject()))
931  {
932  // Write size for Draw shapes as well.
933  const tools::Rectangle& rSnapRect = pObject->GetSnapRect();
934  aFrameSize.emplace();
935  aFrameSize->SetWidthSizeType(SwFrameSize::Fixed);
936  aFrameSize->SetWidth(rSnapRect.getWidth());
937  aFrameSize->SetHeightSizeType(SwFrameSize::Fixed);
938  aFrameSize->SetHeight(rSnapRect.getHeight());
939  pFSItem = &*aFrameSize;
940  }
941  if( (nFrameOptions & HtmlFrmOpts::Size) &&
942  pFSItem &&
943  ( (nFrameOptions & HtmlFrmOpts::AnySize) ||
944  SwFrameSize::Fixed == pFSItem->GetHeightSizeType()) )
945  {
946  sal_uInt8 nPercentWidth = pFSItem->GetWidthPercent();
947  sal_uInt8 nPercentHeight = pFSItem->GetHeightPercent();
948 
949  // Size of the object in Twips without margins
950  Size aTwipSz( (nPercentWidth && nPercentWidth != 255 ? 0
951  : pFSItem->GetWidth()-aTwipSpc.Width()),
952  (nPercentHeight && nPercentHeight != 255 ? 0
953  : pFSItem->GetHeight()-aTwipSpc.Height()) );
954 
955  OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, "Frame size minus spacing < 0!!!???" );
956  if( aTwipSz.Width() < 0 )
957  aTwipSz.setWidth( 0 );
958  if( aTwipSz.Height() < 0 )
959  aTwipSz.setHeight( 0 );
960 
961  Size aPixelSz( 0, 0 );
962  if( (aTwipSz.Width() || aTwipSz.Height()) &&
964  {
965  aPixelSz =
967  MapMode(MapUnit::MapTwip) );
968  if( !aPixelSz.Width() && aTwipSz.Width() )
969  aPixelSz.setWidth( 1 );
970  if( !aPixelSz.Height() && aTwipSz.Height() )
971  aPixelSz.setHeight( 1 );
972  }
973 
974  if( (nFrameOptions & HtmlFrmOpts::Width) &&
975  ((nPercentWidth && nPercentWidth!=255) || aPixelSz.Width()) )
976  {
977  OString sWidth;
978  if (nPercentWidth && nPercentWidth != 255)
979  sWidth = OString::number(static_cast<sal_Int32>(nPercentWidth)) + "%";
980  else
981  sWidth = OString::number(static_cast<sal_Int32>(aPixelSz.Width()));
983  }
984 
985  if( (nFrameOptions & HtmlFrmOpts::Height) &&
986  ((nPercentHeight && nPercentHeight!=255) || aPixelSz.Height()) )
987  {
988  OString sHeight;
989  if (nPercentHeight && nPercentHeight != 255)
990  sHeight = OString::number(static_cast<sal_Int32>(nPercentHeight)) + "%";
991  else
992  sHeight = OString::number(static_cast<sal_Int32>(aPixelSz.Height()));
994  }
995  }
996 
997  // Insert wrap for graphics that are anchored to a paragraph as
998  // <BR CLEAR=...> in the string
999 
1000  if( !(nFrameOptions & HtmlFrmOpts::BrClear) )
1001  return;
1002  RndStdIds nAnchorId = rFrameFormat.GetAnchor().GetAnchorId();
1003  if (RndStdIds::FLY_AT_PARA != nAnchorId && RndStdIds::FLY_AT_CHAR != nAnchorId)
1004  return;
1005  const SwFormatSurround* pSurround = rItemSet.GetItemIfSet( RES_SURROUND );
1006  if (!pSurround)
1007  return;
1008 
1009  const char* pSurroundString = nullptr;
1010 
1011  sal_Int16 eHoriOri = rFrameFormat.GetHoriOrient().GetHoriOrient();
1012  css::text::WrapTextMode eSurround = pSurround->GetSurround();
1013  bool bAnchorOnly = pSurround->IsAnchorOnly();
1014  switch( eHoriOri )
1015  {
1016  case text::HoriOrientation::RIGHT:
1017  {
1018  switch( eSurround )
1019  {
1020  case css::text::WrapTextMode_NONE:
1021  case css::text::WrapTextMode_RIGHT:
1022  pSurroundString = OOO_STRING_SVTOOLS_HTML_AL_right;
1023  break;
1024  case css::text::WrapTextMode_LEFT:
1025  case css::text::WrapTextMode_PARALLEL:
1026  if( bAnchorOnly )
1027  m_bClearRight = true;
1028  break;
1029  default:
1030  ;
1031  }
1032  }
1033  break;
1034 
1035  default:
1036  // If a frame is centered, it gets left aligned. This
1037  // should be taken into account here, too.
1038  {
1039  switch( eSurround )
1040  {
1041  case css::text::WrapTextMode_NONE:
1042  case css::text::WrapTextMode_LEFT:
1043  pSurroundString = OOO_STRING_SVTOOLS_HTML_AL_left;
1044  break;
1045  case css::text::WrapTextMode_RIGHT:
1046  case css::text::WrapTextMode_PARALLEL:
1047  if( bAnchorOnly )
1048  m_bClearLeft = true;
1049  break;
1050  default:
1051  break;
1052  }
1053  }
1054  break;
1055  }
1056 
1057  if (pSurroundString)
1058  {
1060  aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_clear, pSurroundString);
1061  aHtml.end();
1062  }
1063 }
1064 
1065 namespace
1066 {
1067 
1068 OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, const SwFrameFormat& rFrameFormat,
1069  const Size& rRealSize, const ImageMap* pAltImgMap, const SwFormatURL*& pURLItem)
1070 {
1071  OUString aIMapName;
1072 
1073  // Only consider the URL attribute if no ImageMap was supplied
1074  if (!pAltImgMap)
1075  pURLItem = rItemSet.GetItemIfSet( RES_URL );
1076 
1077  // write ImageMap
1078  const ImageMap* pIMap = pAltImgMap;
1079  if( !pIMap && pURLItem )
1080  {
1081  pIMap = pURLItem->GetMap();
1082  }
1083 
1084  if (pIMap)
1085  {
1086  // make the name unique
1087  aIMapName = pIMap->GetName();
1088  OUString aNameBase;
1089  if (!aIMapName.isEmpty())
1090  aNameBase = aIMapName;
1091  else
1092  aNameBase = OOO_STRING_SVTOOLS_HTML_map;
1093 
1094  if (aIMapName.isEmpty())
1095  aIMapName = aNameBase + OUString::number(rHTMLWrt.m_nImgMapCnt);
1096 
1097  bool bFound;
1098  do
1099  {
1100  bFound = false;
1101  for (const OUString & rImgMapName : rHTMLWrt.m_aImgMapNames)
1102  {
1103  // TODO: Unicode: Comparison is case insensitive for ASCII
1104  // characters only now!
1105  if (aIMapName.equalsIgnoreAsciiCase(rImgMapName))
1106  {
1107  bFound = true;
1108  break;
1109  }
1110  }
1111  if (bFound)
1112  {
1113  rHTMLWrt.m_nImgMapCnt++;
1114  aIMapName = aNameBase + OUString::number( rHTMLWrt.m_nImgMapCnt );
1115  }
1116  } while (bFound);
1117 
1118  bool bScale = false;
1119  Fraction aScaleX(1, 1);
1120  Fraction aScaleY(1, 1);
1121 
1122  const SwFormatFrameSize& rFrameSize = rFrameFormat.GetFrameSize();
1123  const SvxBoxItem& rBox = rFrameFormat.GetBox();
1124 
1125  if (!rFrameSize.GetWidthPercent() && rRealSize.Width())
1126  {
1127  SwTwips nWidth = rFrameSize.GetWidth();
1128  nWidth -= rBox.CalcLineSpace(SvxBoxItemLine::LEFT) + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT);
1129 
1130  OSL_ENSURE( nWidth > 0, "Are there any graphics that are 0 twip wide!?" );
1131  if (nWidth <= 0) // should not happen
1132  nWidth = 1;
1133 
1134  if (rRealSize.Width() != nWidth)
1135  {
1136  aScaleX = Fraction(nWidth, rRealSize.Width());
1137  bScale = true;
1138  }
1139  }
1140 
1141  if (!rFrameSize.GetHeightPercent() && rRealSize.Height())
1142  {
1143  SwTwips nHeight = rFrameSize.GetHeight();
1144 
1145  nHeight -= rBox.CalcLineSpace(SvxBoxItemLine::TOP) + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM);
1146 
1147  OSL_ENSURE( nHeight > 0, "Are there any graphics that are 0 twip high!?" );
1148  if (nHeight <= 0)
1149  nHeight = 1;
1150 
1151  if (rRealSize.Height() != nHeight)
1152  {
1153  aScaleY = Fraction(nHeight, rRealSize.Height());
1154  bScale = true;
1155  }
1156  }
1157 
1158  rHTMLWrt.m_aImgMapNames.push_back(aIMapName);
1159 
1160  OString aIndMap, aIndArea;
1161  const char *pIndArea = nullptr, *pIndMap = nullptr;
1162 
1163  if (rHTMLWrt.m_bLFPossible)
1164  {
1165  rHTMLWrt.OutNewLine( true );
1166  aIndMap = rHTMLWrt.GetIndentString();
1167  aIndArea = rHTMLWrt.GetIndentString(1);
1168  pIndArea = aIndArea.getStr();
1169  pIndMap = aIndMap.getStr();
1170  }
1171 
1172  if (bScale)
1173  {
1174  ImageMap aScaledIMap(*pIMap);
1175  aScaledIMap.Scale(aScaleX, aScaleY);
1176  HTMLOutFuncs::Out_ImageMap( rHTMLWrt.Strm(), rHTMLWrt.GetBaseURL(), aScaledIMap, aIMapName,
1178  rHTMLWrt.m_bCfgStarBasic,
1179  SAL_NEWLINE_STRING, pIndArea, pIndMap );
1180  }
1181  else
1182  {
1183  HTMLOutFuncs::Out_ImageMap( rHTMLWrt.Strm(), rHTMLWrt.GetBaseURL(), *pIMap, aIMapName,
1185  rHTMLWrt.m_bCfgStarBasic,
1186  SAL_NEWLINE_STRING, pIndArea, pIndMap );
1187  }
1188  }
1189  return aIMapName;
1190 }
1191 
1192 }
1193 
1194 Writer& OutHTML_ImageStart( HtmlWriter& rHtml, Writer& rWrt, const SwFrameFormat &rFrameFormat,
1195  const OUString& rGraphicURL,
1196  Graphic const & rGraphic, const OUString& rAlternateText,
1197  const Size &rRealSize, HtmlFrmOpts nFrameOpts,
1198  const char *pMarkType,
1199  const ImageMap *pAltImgMap,
1200  const OUString& rMimeType )
1201 {
1202  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1203  // <object data="..."> instead of <img src="...">
1204  bool bReplacement = (nFrameOpts & HtmlFrmOpts::Replacement) || rHTMLWrt.mbReqIF;
1205 
1206  if (rHTMLWrt.mbSkipImages)
1207  return rHTMLWrt;
1208 
1209  // if necessary, temporarily close an open attribute
1210  if( !rHTMLWrt.m_aINetFormats.empty() )
1211  {
1212  SwFormatINetFormat* pINetFormat = rHTMLWrt.m_aINetFormats.back();
1213  OutHTML_INetFormat( rWrt, *pINetFormat, false );
1214  }
1215 
1216  OUString aGraphicURL( rGraphicURL );
1217  if( !rHTMLWrt.mbEmbedImages && !HTMLOutFuncs::PrivateURLToInternalImg(aGraphicURL) && !rHTMLWrt.mpTempBaseURL )
1218  aGraphicURL = URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), aGraphicURL);
1219 
1220  const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
1221 
1222  const SwFormatURL* pURLItem = nullptr;
1223  OUString aIMapName = lclWriteOutImap(rHTMLWrt, rItemSet, rFrameFormat, rRealSize, pAltImgMap, pURLItem);
1224 
1225  // put img into new line
1226  if( rHTMLWrt.m_bLFPossible )
1227  rHTMLWrt.OutNewLine( true );
1228 
1229  // <a name=...></a>...<img ...>
1230  if( pMarkType && !rFrameFormat.GetName().isEmpty() )
1231  {
1232  rHTMLWrt.OutImplicitMark( rFrameFormat.GetName(), pMarkType );
1233  }
1234 
1235  // URL -> <a>...<img ... >...</a>
1236  const SvxMacroItem *pMacItem = rItemSet.GetItemIfSet(RES_FRMMACRO);
1237 
1238  if (pURLItem || pMacItem)
1239  {
1240  OUString aMapURL;
1241  OUString aName;
1242  OUString aTarget;
1243 
1244  if(pURLItem)
1245  {
1246  aMapURL = pURLItem->GetURL();
1247  aName = pURLItem->GetName();
1248  aTarget = pURLItem->GetTargetFrameName();
1249  }
1250 
1251  bool bEvents = pMacItem && !pMacItem->GetMacroTable().empty();
1252 
1253  if( !aMapURL.isEmpty() || !aName.isEmpty() || !aTarget.isEmpty() || bEvents )
1254  {
1256 
1257  // Output "href" element if a link or macro exists
1258  if( !aMapURL.isEmpty() || bEvents )
1259  {
1260  rHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_href, OUStringToOString(rHTMLWrt.convertHyperlinkHRefValue(aMapURL), RTL_TEXTENCODING_UTF8));
1261  }
1262 
1263  if( !aName.isEmpty() )
1264  {
1265  rHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_name, OUStringToOString(aName, RTL_TEXTENCODING_UTF8));
1266  }
1267 
1268  if( !aTarget.isEmpty() )
1269  {
1270  rHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_target, OUStringToOString(aTarget, RTL_TEXTENCODING_UTF8));
1271  }
1272 
1273  if( pMacItem )
1274  {
1275  const SvxMacroTableDtor& rMacTable = pMacItem->GetMacroTable();
1276  if (!rMacTable.empty())
1277  {
1279  }
1280  }
1281  }
1282  }
1283 
1284  // <font color = ...>...<img ... >...</font>
1285  sal_uInt16 nBorderWidth = 0;
1286  const SvxBoxItem* pBoxItem;
1287  if( (nFrameOpts & HtmlFrmOpts::Border) &&
1288  (pBoxItem = rItemSet.GetItemIfSet( RES_BOX )) )
1289  {
1290  Size aTwipBorder( 0, 0 );
1291  const ::editeng::SvxBorderLine *pColBorderLine = nullptr;
1292  const ::editeng::SvxBorderLine *pBorderLine = pBoxItem->GetLeft();
1293  if( pBorderLine )
1294  {
1295  pColBorderLine = pBorderLine;
1296  aTwipBorder.AdjustWidth(pBorderLine->GetOutWidth() );
1297  }
1298 
1299  pBorderLine = pBoxItem->GetRight();
1300  if( pBorderLine )
1301  {
1302  pColBorderLine = pBorderLine;
1303  aTwipBorder.AdjustWidth(pBorderLine->GetOutWidth() );
1304  }
1305 
1306  pBorderLine = pBoxItem->GetTop();
1307  if( pBorderLine )
1308  {
1309  pColBorderLine = pBorderLine;
1310  aTwipBorder.AdjustHeight(pBorderLine->GetOutWidth() );
1311  }
1312 
1313  pBorderLine = pBoxItem->GetBottom();
1314  if( pBorderLine )
1315  {
1316  pColBorderLine = pBorderLine;
1317  aTwipBorder.AdjustHeight(pBorderLine->GetOutWidth() );
1318  }
1319 
1320  aTwipBorder.setWidth( aTwipBorder.Width() / 2 );
1321  aTwipBorder.setHeight( aTwipBorder.Height() / 2 );
1322 
1323  if( (aTwipBorder.Width() || aTwipBorder.Height()) &&
1325  {
1326  Size aPixelBorder =
1328  MapMode(MapUnit::MapTwip) );
1329  if( !aPixelBorder.Width() && aTwipBorder.Width() )
1330  aPixelBorder.setWidth( 1 );
1331  if( !aPixelBorder.Height() && aTwipBorder.Height() )
1332  aPixelBorder.setHeight( 1 );
1333 
1334  if( aPixelBorder.Width() )
1335  aPixelBorder.setHeight( 0 );
1336 
1337  nBorderWidth =
1338  o3tl::narrowing<sal_uInt16>(aPixelBorder.Width() + aPixelBorder.Height());
1339  }
1340 
1341  if( pColBorderLine )
1342  {
1344  HtmlWriterHelper::applyColor(rHtml, OOO_STRING_SVTOOLS_HTML_O_color, pColBorderLine->GetColor());
1345  }
1346  }
1347 
1348  OString aTag(OOO_STRING_SVTOOLS_HTML_image);
1349  if (bReplacement)
1350  // Write replacement graphic of OLE object as <object>.
1352  rHtml.start(aTag);
1353 
1354  OStringBuffer sBuffer;
1355  if(rHTMLWrt.mbEmbedImages)
1356  {
1357  OUString aGraphicInBase64;
1358  if (XOutBitmap::GraphicToBase64(rGraphic, aGraphicInBase64))
1359  {
1360  sBuffer.append(OOO_STRING_SVTOOLS_HTML_O_data);
1361  sBuffer.append(":");
1362  sBuffer.append(OUStringToOString(aGraphicInBase64, RTL_TEXTENCODING_UTF8));
1363  rHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_src, sBuffer.makeStringAndClear().getStr());
1364  }
1365  else
1366  rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD;
1367  }
1368  else
1369  {
1370  sBuffer.append(OUStringToOString(aGraphicURL, RTL_TEXTENCODING_UTF8));
1371  OString aAttribute(OOO_STRING_SVTOOLS_HTML_O_src);
1372  if (bReplacement)
1373  aAttribute = OOO_STRING_SVTOOLS_HTML_O_data;
1374  rHtml.attribute(aAttribute, sBuffer.makeStringAndClear().getStr());
1375  }
1376 
1377  if (bReplacement)
1378  {
1379  // Handle XHTML type attribute for OLE replacement images.
1380  if (!rMimeType.isEmpty())
1381  rHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_type, rMimeType.toUtf8());
1382  }
1383 
1384  // Events
1385  if (const SvxMacroItem* pMacroItem = rItemSet.GetItemIfSet(RES_FRMMACRO))
1386  {
1387  const SvxMacroTableDtor& rMacTable = pMacroItem->GetMacroTable();
1388  if (!rMacTable.empty())
1389  {
1390  HtmlWriterHelper::applyEvents(rHtml, rMacTable, aImageEventTable, rHTMLWrt.m_bCfgStarBasic);
1391  }
1392  }
1393 
1394  // alt, align, width, height, hspace, vspace
1395  rHTMLWrt.writeFrameFormatOptions(rHtml, rFrameFormat, rAlternateText, nFrameOpts);
1396  if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) )
1397  rHTMLWrt.OutCSS1_FrameFormatOptions( rFrameFormat, nFrameOpts );
1398 
1399  if ((nFrameOpts & HtmlFrmOpts::Border) && !bReplacement)
1400  {
1401  rHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_border, nBorderWidth);
1402  }
1403 
1404  if( pURLItem && pURLItem->IsServerMap() )
1405  {
1407  }
1408 
1409  if( !aIMapName.isEmpty() )
1410  {
1411  rHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_usemap, OUStringConcatenation("#" + aIMapName));
1412  }
1413 
1414  if (bReplacement)
1415  {
1416  // XHTML object replacement image's alternate text doesn't use the
1417  // "alt" attribute.
1418  if (rAlternateText.isEmpty())
1419  // Empty alternate text is not valid.
1420  rHtml.characters(" ");
1421  else
1422  rHtml.characters(rAlternateText.toUtf8());
1423  }
1424 
1425  return rHTMLWrt;
1426 }
1427 
1429 {
1430  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1431  rHtml.flushStack();
1432 
1433  if( !rHTMLWrt.m_aINetFormats.empty() )
1434  {
1435  // There is still an attribute on the stack that has to be reopened
1436  SwFormatINetFormat *pINetFormat = rHTMLWrt.m_aINetFormats.back();
1437  OutHTML_INetFormat( rWrt, *pINetFormat, true );
1438  }
1439 
1440  return rHTMLWrt;
1441 }
1442 
1444  const char *pTag,
1445  const SvxBrushItem* pBrush,
1446  const OUString &rGraphicURL)
1447 {
1448  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1449 
1450  OUString aGraphicInBase64;
1451  OUString aLink;
1452  if( pBrush )
1453  {
1454  aLink = pBrush->GetGraphicLink();
1455  if(rHTMLWrt.mbEmbedImages || aLink.isEmpty())
1456  {
1457  const Graphic* pGrf = pBrush->GetGraphic();
1458  if( pGrf )
1459  {
1460  if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) )
1461  {
1462  rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD;
1463  }
1464  }
1465  }
1466  else if(!aLink.isEmpty())
1467  {
1468  if( rHTMLWrt.m_bCfgCpyLinkedGrfs )
1469  {
1470  rHTMLWrt.CopyLocalFileToINet( aLink );
1471  }
1472 
1473  }
1474  }
1475  else if(!rHTMLWrt.mbEmbedImages)
1476  {
1477  aLink = rGraphicURL;
1478  }
1479  if(!aLink.isEmpty())
1480  {
1482  aLink = URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), aLink);
1483  }
1484 
1485  OStringBuffer sOut;
1486  if( pTag )
1487  sOut.append('<').append(pTag);
1488 
1489  sOut.append(' ');
1490  sOut.append(OOO_STRING_SVTOOLS_HTML_O_style "=\"");
1491  if(!aLink.isEmpty())
1492  {
1493  sOut.append(OOO_STRING_SVTOOLS_HTML_O_src "=\"");
1494  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
1495  HTMLOutFuncs::Out_String( rWrt.Strm(), aLink );
1496  }
1497  else
1498  {
1499  sOut.append("list-style-image: url("
1501  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
1502  HTMLOutFuncs::Out_String( rWrt.Strm(), aGraphicInBase64 );
1503  sOut.append(");");
1504  }
1505  sOut.append('\"');
1506 
1507  if (pTag)
1508  sOut.append('>');
1509  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
1510 
1511  return rWrt;
1512 }
1513 
1514 static Writer& OutHTML_FrameFormatTableNode( Writer& rWrt, const SwFrameFormat& rFrameFormat )
1515 {
1516  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1517 
1518  const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
1519  SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1;
1520  SwNodeOffset nEnd = rHTMLWrt.m_pDoc->GetNodes()[nStt-1]->EndOfSectionIndex();
1521 
1522  OUString aCaption;
1523  bool bTopCaption = false;
1524 
1525  // Not const, because GetTable won't be const sometime later
1526  SwNode *pNd = rHTMLWrt.m_pDoc->GetNodes()[ nStt ];
1527  SwTableNode *pTableNd = pNd->GetTableNode();
1528  const SwTextNode *pTextNd = pNd->GetTextNode();
1529  if( !pTableNd && pTextNd )
1530  {
1531  // Table with heading
1532  bTopCaption = true;
1533  pTableNd = rHTMLWrt.m_pDoc->GetNodes()[nStt+1]->GetTableNode();
1534  }
1535  OSL_ENSURE( pTableNd, "Frame does not contain a table" );
1536  if( pTableNd )
1537  {
1538  SwNodeOffset nTableEnd = pTableNd->EndOfSectionIndex();
1539  OSL_ENSURE( nTableEnd == nEnd - 1 ||
1540  (nTableEnd == nEnd - 2 && !bTopCaption),
1541  "Invalid frame content for a table" );
1542 
1543  if( nTableEnd == nEnd - 2 )
1544  pTextNd = rHTMLWrt.m_pDoc->GetNodes()[nTableEnd+1]->GetTextNode();
1545  }
1546  if( pTextNd )
1547  aCaption = pTextNd->GetText();
1548 
1549  if( pTableNd )
1550  {
1551  HTMLSaveData aSaveData( rHTMLWrt, pTableNd->GetIndex()+1,
1552  pTableNd->EndOfSectionIndex(),
1553  true, &rFrameFormat );
1554  rHTMLWrt.m_bOutFlyFrame = true;
1555  OutHTML_SwTableNode( rHTMLWrt, *pTableNd, &rFrameFormat, &aCaption,
1556  bTopCaption );
1557  }
1558 
1559  return rWrt;
1560 }
1561 
1563  const SwFrameFormat& rFrameFormat,
1564  bool bInCntnr )
1565 {
1566  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1567 
1568  rHTMLWrt.ChangeParaToken( HtmlTokenId::NONE );
1569 
1570  // Close the current <DL>!
1571  rHTMLWrt.OutAndSetDefList( 0 );
1572 
1573  // output as Multicol
1574  if( rHTMLWrt.m_bLFPossible )
1575  rHTMLWrt.OutNewLine();
1576 
1577  OStringBuffer sOut;
1578  sOut.append('<').append(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_multicol);
1579 
1580  const SwFormatCol& rFormatCol = rFrameFormat.GetCol();
1581 
1582  // output the number of columns as COLS
1583  sal_uInt16 nCols = rFormatCol.GetNumCols();
1584  if( nCols )
1585  {
1586  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_cols
1587  "=\"" + OString::number(nCols) + "\"");
1588  }
1589 
1590  // the Gutter width (minimum value) as GUTTER
1591  sal_uInt16 nGutter = rFormatCol.GetGutterWidth( true );
1592  if( nGutter!=USHRT_MAX )
1593  {
1594  if( nGutter && Application::GetDefaultDevice() )
1595  {
1596  nGutter = o3tl::narrowing<sal_uInt16>(Application::GetDefaultDevice()
1597  ->LogicToPixel( Size(nGutter,0),
1598  MapMode(MapUnit::MapTwip) ).Width());
1599  }
1600  sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_gutter
1601  "=\"" + OString::number(nGutter) + "\"");
1602  }
1603 
1604  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
1605 
1606  // WIDTH
1607  HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_MULTICOL;
1608  if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr )
1609  nFrameFlags |= HTML_FRMOPTS_MULTICOL_CSS1;
1610  rHTMLWrt.OutFrameFormatOptions(rFrameFormat, OUString(), nFrameFlags);
1611  if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr )
1612  rHTMLWrt.OutCSS1_FrameFormatOptions( rFrameFormat, nFrameFlags );
1613 
1614  rWrt.Strm().WriteChar( '>' );
1615 
1616  rHTMLWrt.m_bLFPossible = true;
1617  rHTMLWrt.IncIndentLevel(); // indent the content of Multicol
1618 
1619  const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
1620  SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex();
1621  const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode();
1622  OSL_ENSURE( pSttNd, "Where is the start node" );
1623 
1624  {
1625  // in a block, so that the old state can be restored in time
1626  // before the end
1627  HTMLSaveData aSaveData( rHTMLWrt, nStt+1,
1628  pSttNd->EndOfSectionIndex(),
1629  true, &rFrameFormat );
1630  rHTMLWrt.m_bOutFlyFrame = true;
1631  rHTMLWrt.Out_SwDoc( rWrt.m_pCurrentPam.get() );
1632  }
1633 
1634  rHTMLWrt.DecIndentLevel(); // indent the content of Multicol;
1635  if( rHTMLWrt.m_bLFPossible )
1636  rHTMLWrt.OutNewLine();
1637  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_multicol), false );
1638  rHTMLWrt.m_bLFPossible = true;
1639 
1640  return rWrt;
1641 }
1642 
1643 static Writer& OutHTML_FrameFormatAsSpacer( Writer& rWrt, const SwFrameFormat& rFrameFormat )
1644 {
1645  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1646 
1647  // if possible, output a line break before the graphic
1648  if( rHTMLWrt.m_bLFPossible )
1649  rHTMLWrt.OutNewLine( true );
1650 
1651  OString sOut =
1652  "<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_spacer " "
1655  rWrt.Strm().WriteOString( sOut );
1656 
1657  // ALIGN, WIDTH, HEIGHT
1658  OString aEndTags = rHTMLWrt.OutFrameFormatOptions(rFrameFormat, OUString(), HTML_FRMOPTS_SPACER);
1659 
1660  rWrt.Strm().WriteChar( '>' );
1661  if( !aEndTags.isEmpty() )
1662  rWrt.Strm().WriteOString( aEndTags );
1663 
1664  return rWrt;
1665 }
1666 
1668  const SwFrameFormat& rFrameFormat, bool bSpan)
1669 {
1670  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1671 
1672  OString aTag;
1673  if( !bSpan )
1674  {
1675  rHTMLWrt.ChangeParaToken( HtmlTokenId::NONE );
1676 
1677  // Close the current <DL>!
1678  rHTMLWrt.OutAndSetDefList( 0 );
1680  }
1681  else
1683 
1684  // output as DIV
1685  if( rHTMLWrt.m_bLFPossible )
1686  rHTMLWrt.OutNewLine();
1687 
1688  OStringBuffer sOut;
1689  sOut.append('<').append(rHTMLWrt.GetNamespace() + aTag);
1690 
1691  rWrt.Strm().WriteOString( sOut.makeStringAndClear() );
1692  HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_DIV;
1693  if( rHTMLWrt.IsHTMLMode( HTMLMODE_BORDER_NONE ) )
1694  nFrameFlags |= HtmlFrmOpts::SNoBorder;
1695  OString aEndTags = rHTMLWrt.OutFrameFormatOptions(rFrameFormat, OUString(), nFrameFlags);
1696  rHTMLWrt.OutCSS1_FrameFormatOptions( rFrameFormat, nFrameFlags );
1697  rWrt.Strm().WriteChar( '>' );
1698 
1699  rHTMLWrt.IncIndentLevel(); // indent the content
1700  rHTMLWrt.m_bLFPossible = true;
1701 
1702  const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
1703  SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex();
1704 
1705  // Output frame-anchored frames that are anchored to the start node
1706  rHTMLWrt.OutFlyFrame( nStt, 0, HtmlPosition::Any );
1707 
1708  const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode();
1709  OSL_ENSURE( pSttNd, "Where is the start node" );
1710 
1711  {
1712  // in a block, so that the old state can be restored in time
1713  // before the end
1714  HTMLSaveData aSaveData( rHTMLWrt, nStt+1,
1715  pSttNd->EndOfSectionIndex(),
1716  true, &rFrameFormat );
1717  rHTMLWrt.m_bOutFlyFrame = true;
1718  rHTMLWrt.Out_SwDoc( rWrt.m_pCurrentPam.get() );
1719  }
1720 
1721  rHTMLWrt.DecIndentLevel(); // indent the content of Multicol;
1722  if( rHTMLWrt.m_bLFPossible )
1723  rHTMLWrt.OutNewLine();
1724  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + aTag), false );
1725 
1726  if( !aEndTags.isEmpty() )
1727  rWrt.Strm().WriteOString( aEndTags );
1728 
1729  return rWrt;
1730 }
1731 
1733 static void OutHTML_ImageOLEStart(SwHTMLWriter& rHTMLWrt, const Graphic& rGraphic,
1734  const SwFrameFormat& rFrameFormat)
1735 {
1736  if (!rHTMLWrt.mbReqIF || !rHTMLWrt.m_bExportImagesAsOLE)
1737  return;
1738 
1739  // Write the original image as an RTF fragment.
1740  OUString aFileName;
1741  if (rHTMLWrt.GetOrigFileName())
1742  aFileName = *rHTMLWrt.GetOrigFileName();
1743  INetURLObject aURL(aFileName);
1744  OUString aName = aURL.getBase() + "_" + aURL.getExtension() + "_"
1745  + OUString::number(rGraphic.GetChecksum(), 16);
1746  aURL.setBase(aName);
1747  aURL.setExtension(u"ole");
1749 
1750  SvFileStream aOutStream(aFileName, StreamMode::WRITE);
1751  if (!SwReqIfReader::WrapGraphicInRtf(rGraphic, rFrameFormat, aOutStream))
1752  SAL_WARN("sw.html", "SwReqIfReader::WrapGraphicInRtf() failed");
1753 
1754  // Refer to this data.
1755  aFileName = URIHelper::simpleNormalizedMakeRelative(rHTMLWrt.GetBaseURL(), aFileName);
1756  rHTMLWrt.Strm().WriteOString(
1757  OStringConcatenation("<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_object));
1758  rHTMLWrt.Strm().WriteOString(OStringConcatenation(" data=\"" + aFileName.toUtf8() + "\""));
1759  rHTMLWrt.Strm().WriteOString(" type=\"text/rtf\"");
1760  rHTMLWrt.Strm().WriteOString(">");
1761  rHTMLWrt.OutNewLine();
1762 }
1763 
1765 static void OutHTML_ImageOLEEnd(SwHTMLWriter& rHTMLWrt)
1766 {
1767  if (rHTMLWrt.mbReqIF && rHTMLWrt.m_bExportImagesAsOLE)
1768  {
1769  rHTMLWrt.Strm().WriteOString(
1770  OStringConcatenation("</" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_object ">"));
1771  }
1772 }
1773 
1774 static Writer & OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& rFrameFormat, bool bPNGFallback)
1775 {
1776  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1777  bool bWritePNGFallback = rHTMLWrt.mbReqIF && !rHTMLWrt.m_bExportImagesAsOLE && bPNGFallback;
1778 
1779  if (rHTMLWrt.mbSkipImages)
1780  return rWrt;
1781 
1782  ImageMap aIMap;
1783  std::optional<Size> aDPI;
1784  if (rHTMLWrt.m_nShapeDPI.has_value())
1785  {
1786  aDPI.emplace(*rHTMLWrt.m_nShapeDPI, *rHTMLWrt.m_nShapeDPI);
1787  }
1788  Graphic aGraphic( const_cast<SwFrameFormat &>(rFrameFormat).MakeGraphic( &aIMap, /*nMaximumQuadraticPixels=*/2100000, aDPI ) );
1789 
1790  if (rHTMLWrt.mbReqIF)
1791  {
1792  // ImageMap doesn't seem to be allowed in reqif.
1793  if (auto pGrafObj = dynamic_cast<const SdrGrafObj*>(rFrameFormat.FindSdrObject()))
1794  {
1795  aGraphic = pGrafObj->GetGraphic();
1796  }
1797  else
1798  {
1799  // We only have a bitmap, write that as PNG without any fallback.
1800  bWritePNGFallback = false;
1801  }
1802  }
1803 
1804  Size aSz( 0, 0 );
1805  OUString GraphicURL;
1806  OUString aMimeType("image/jpeg");
1807  if(!rHTMLWrt.mbEmbedImages)
1808  {
1809  if( rHTMLWrt.GetOrigFileName() )
1810  GraphicURL = *rHTMLWrt.GetOrigFileName();
1811 
1812  OUString aFilterName("JPG");
1813  XOutFlags nFlags = XOutFlags::UseGifIfPossible | XOutFlags::UseNativeIfPossible;
1814 
1815  if (rHTMLWrt.mbReqIF && !bWritePNGFallback)
1816  {
1817  // Writing image without fallback PNG in ReqIF mode: force PNG output.
1818  aFilterName = "PNG";
1819  nFlags = XOutFlags::NONE;
1820  aMimeType = "image/png";
1821  }
1822  else if (rHTMLWrt.mbReqIF)
1823  {
1824  // Original format is wanted, don't force JPG.
1825  aFilterName.clear();
1826  aMimeType.clear();
1827  }
1828 
1829  if( aGraphic.GetType() == GraphicType::NONE ||
1830  XOutBitmap::WriteGraphic( aGraphic, GraphicURL,
1831  aFilterName,
1832  nFlags ) != ERRCODE_NONE )
1833  {
1834  // empty or incorrect, because there is nothing to output
1835  rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD;
1836  return rWrt;
1837  }
1838 
1839  GraphicURL = URIHelper::SmartRel2Abs(
1840  INetURLObject(rWrt.GetBaseURL()), GraphicURL,
1842 
1843  }
1844  uno::Reference<beans::XPropertySet> xGraphic(aGraphic.GetXGraphic(), uno::UNO_QUERY);
1845  if (xGraphic.is() && aMimeType.isEmpty())
1846  xGraphic->getPropertyValue("MimeType") >>= aMimeType;
1847 
1848  OutHTML_ImageOLEStart(rHTMLWrt, aGraphic, rFrameFormat);
1849 
1850  HtmlWriter aHtml(rWrt.Strm(), rHTMLWrt.maNamespace);
1851  OutHTML_ImageStart( aHtml, rWrt, rFrameFormat, GraphicURL, aGraphic, rFrameFormat.GetName(), aSz,
1852  HtmlFrmOpts::GenImgMask, "frame",
1853  aIMap.GetIMapObjectCount() ? &aIMap : nullptr, aMimeType );
1854 
1855  GfxLink aLink = aGraphic.GetGfxLink();
1856  if (bWritePNGFallback && aLink.GetType() != GfxLinkType::NativePng)
1857  {
1858  OutHTML_FrameFormatAsImage( rWrt, rFrameFormat, /*bPNGFallback=*/false);
1859  }
1860 
1861  OutHTML_ImageEnd(aHtml, rWrt);
1862 
1863  OutHTML_ImageOLEEnd(rHTMLWrt);
1864 
1865  return rWrt;
1866 }
1867 
1868 static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rFrameFormat,
1869  bool bInCntnr, bool bPNGFallback )
1870 {
1871  SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
1872  bool bWritePNGFallback = rHTMLWrt.mbReqIF && !rHTMLWrt.m_bExportImagesAsOLE && bPNGFallback;
1873 
1874  if (rHTMLWrt.mbSkipImages)
1875  return rWrt;
1876 
1877  const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
1878  SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1;
1879  SwGrfNode *pGrfNd = rHTMLWrt.m_pDoc->GetNodes()[ nStt ]->GetGrfNode();
1880  OSL_ENSURE( pGrfNd, "Grf node expected" );
1881  if( !pGrfNd )
1882  return rWrt;
1883 
1884  HtmlFrmOpts nFrameFlags = bInCntnr ? HTML_FRMOPTS_IMG_CNTNR : HTML_FRMOPTS_IMG;
1885  if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr )
1886  nFrameFlags |= HTML_FRMOPTS_IMG_CSS1;
1887 
1888  Graphic aGraphic = pGrfNd->GetGraphic();
1889  OUString aGraphicURL;
1890  OUString aMimeType;
1891  if(!rHTMLWrt.mbEmbedImages)
1892  {
1893  const SwMirrorGrf& rMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
1894 
1895  if( !pGrfNd->IsLinkedFile() || MirrorGraph::Dont != rMirror.GetValue() )
1896  {
1897  // create a (mirrored) jpeg file
1898  if( rHTMLWrt.GetOrigFileName() )
1899  aGraphicURL = *rHTMLWrt.GetOrigFileName();
1900  else
1901  aGraphicURL = rHTMLWrt.GetBaseURL();
1902  pGrfNd->GetGrf( true );
1903 
1904  XOutFlags nFlags = XOutFlags::UseGifIfSensible |
1905  XOutFlags::UseNativeIfPossible;
1906  switch( rMirror.GetValue() )
1907  {
1908  case MirrorGraph::Vertical: nFlags = XOutFlags::MirrorHorz; break;
1909  case MirrorGraph::Horizontal: nFlags = XOutFlags::MirrorVert; break;
1910  case MirrorGraph::Both:
1911  nFlags = XOutFlags::MirrorVert | XOutFlags::MirrorHorz;
1912  break;
1913  default: break;
1914  }
1915 
1916  const SwFormatFrameSize& rSize = rFrameFormat.GetFrameSize();
1917  Size aMM100Size = o3tl::convert( rSize.GetSize(),
1919 
1920  OUString aFilterName("");
1921 
1922  if (rHTMLWrt.mbReqIF && !bWritePNGFallback)
1923  {
1924  // Writing image without fallback PNG in ReqIF mode: force PNG
1925  // output.
1926  // But don't force it when writing the original format and we'll write PNG inside
1927  // that.
1928  aFilterName = "PNG";
1929  nFlags &= ~XOutFlags::UseNativeIfPossible;
1930  nFlags &= ~XOutFlags::UseGifIfSensible;
1931  aMimeType = "image/png";
1932  }
1933 
1934  const Graphic& rGraphic = pGrfNd->GetGrf();
1935 
1936  // So that Graphic::IsTransparent() can report true.
1937  if (!rGraphic.isAvailable())
1938  const_cast<Graphic&>(rGraphic).makeAvailable();
1939 
1940  if (rHTMLWrt.mbReqIF && bWritePNGFallback)
1941  {
1942  // ReqIF: force native data if possible.
1943  const std::shared_ptr<VectorGraphicData>& pVectorGraphicData = rGraphic.getVectorGraphicData();
1944  if (pVectorGraphicData && pVectorGraphicData->getType() == VectorGraphicDataType::Svg)
1945  {
1946  aFilterName = "svg";
1947  }
1948  else if (rGraphic.GetGfxLink().IsEMF())
1949  {
1950  aFilterName = "emf";
1951  aMimeType = "image/x-emf"; // avoid image/x-wmf
1952  }
1953  else if (pVectorGraphicData && pVectorGraphicData->getType() == VectorGraphicDataType::Wmf)
1954  {
1955  aFilterName = "wmf";
1956  }
1957  else if (rGraphic.GetGfxLink().GetType() == GfxLinkType::NativeTif)
1958  {
1959  aFilterName = "tif";
1960  aMimeType = "image/tiff"; // avoid image/x-vclgraphic
1961  }
1962  }
1963 
1964  ErrCode nErr = XOutBitmap::WriteGraphic( rGraphic, aGraphicURL,
1965  aFilterName, nFlags, &aMM100Size );
1966  if( nErr )
1967  {
1968  rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD;
1969  return rWrt;
1970  }
1971  aGraphicURL = URIHelper::SmartRel2Abs(
1972  INetURLObject(rWrt.GetBaseURL()), aGraphicURL,
1974  }
1975  else
1976  {
1977  pGrfNd->GetFileFilterNms( &aGraphicURL, nullptr );
1978  if( rHTMLWrt.m_bCfgCpyLinkedGrfs )
1979  rWrt.CopyLocalFileToINet( aGraphicURL );
1980  }
1981 
1982  }
1983  uno::Reference<beans::XPropertySet> xGraphic(aGraphic.GetXGraphic(), uno::UNO_QUERY);
1984  if (xGraphic.is() && aMimeType.isEmpty())
1985  xGraphic->getPropertyValue("MimeType") >>= aMimeType;
1986 
1987  OutHTML_ImageOLEStart(rHTMLWrt, aGraphic, rFrameFormat);
1988 
1989  HtmlWriter aHtml(rWrt.Strm(), rHTMLWrt.maNamespace);
1990  OutHTML_ImageStart( aHtml, rWrt, rFrameFormat, aGraphicURL, aGraphic, pGrfNd->GetTitle(),
1991  pGrfNd->GetTwipSize(), nFrameFlags, "graphic", nullptr, aMimeType );
1992 
1993  GfxLink aLink = aGraphic.GetGfxLink();
1994  if (bWritePNGFallback && aLink.GetType() != GfxLinkType::NativePng)
1995  {
1996  // Not OLE mode, outer format is not PNG: write inner PNG.
1997  OutHTML_FrameFormatGrfNode( rWrt, rFrameFormat,
1998  bInCntnr, /*bPNGFallback=*/false );
1999  }
2000 
2001  OutHTML_ImageEnd(aHtml, rWrt);
2002 
2003  OutHTML_ImageOLEEnd(rHTMLWrt);
2004 
2005  return rWrt;
2006 }
2007 
2008 static Writer& OutHTML_FrameFormatAsMarquee( Writer& rWrt, const SwFrameFormat& rFrameFormat,
2009  const SdrObject& rSdrObj )
2010 {
2011  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2012 
2013  // get the edit engine attributes of the object as SW attributes and
2014  // sort them as Hints
2015  const SfxItemSet& rFormatItemSet = rFrameFormat.GetAttrSet();
2016  SfxItemSetFixed<RES_CHRATR_BEGIN, RES_CHRATR_END> aItemSet( *rFormatItemSet.GetPool() );
2017  SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, &rSdrObj );
2018  bool bCfgOutStylesOld = rHTMLWrt.m_bCfgOutStyles;
2019  rHTMLWrt.m_bCfgOutStyles = false;
2020  rHTMLWrt.m_bTextAttr = true;
2021  rHTMLWrt.m_bTagOn = true;
2022  Out_SfxItemSet( aHTMLAttrFnTab, rWrt, aItemSet, false );
2023  rHTMLWrt.m_bTextAttr = false;
2024 
2026  static_cast<const SwDrawFrameFormat &>(rFrameFormat),
2027  rSdrObj );
2028  rHTMLWrt.m_bTextAttr = true;
2029  rHTMLWrt.m_bTagOn = false;
2030  Out_SfxItemSet( aHTMLAttrFnTab, rWrt, aItemSet, false );
2031  rHTMLWrt.m_bTextAttr = false;
2032  rHTMLWrt.m_bCfgOutStyles = bCfgOutStylesOld;
2033 
2034  return rWrt;
2035 }
2036 
2037 Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrameFormat& rFrameFormat,
2038  bool bHeader )
2039 {
2040  SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
2041 
2042  // output as Multicol
2043  rHTMLWrt.OutNewLine();
2044  OStringBuffer sOut;
2045  sOut.append(OOO_STRING_SVTOOLS_HTML_division " "
2047  .append( bHeader ? "header" : "footer" ).append("\"");
2048  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + sOut) );
2049 
2050  rHTMLWrt.IncIndentLevel(); // indent the content of Multicol;
2051 
2052  // Piece a spacer for the spacing together. Because the
2053  // <DL> or </DL> always produces a space between paragraphs, it is
2054  // subtracted if necessary.
2055  const SvxULSpaceItem& rULSpace = rFrameFormat.GetULSpace();
2056  sal_uInt16 nSize = bHeader ? rULSpace.GetLower() : rULSpace.GetUpper();
2057  rHTMLWrt.m_nHeaderFooterSpace = nSize;
2058 
2059  OString aSpacer;
2060  if( rHTMLWrt.IsHTMLMode(HTMLMODE_VERT_SPACER) &&
2062  {
2063  nSize -= HTML_PARSPACE;
2064  nSize = static_cast<sal_Int16>(Application::GetDefaultDevice()
2065  ->LogicToPixel( Size(nSize,0), MapMode(MapUnit::MapTwip) ).Width());
2066 
2071  "=\"" + OString::number(nSize) + "\"";
2072  }
2073 
2074  const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
2075  SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex();
2076  const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode();
2077  OSL_ENSURE( pSttNd, "Where is the start node" );
2078 
2079  if( !bHeader && !aSpacer.isEmpty() )
2080  {
2081  rHTMLWrt.OutNewLine();
2082  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + aSpacer) );
2083  }
2084 
2085  {
2086  // in a block, so that the old state can be restored in time
2087  // before the end. pFlyFormat doesn't need to be set here, because
2088  // PageDesc attributes cannot occur here
2089  HTMLSaveData aSaveData( rHTMLWrt, nStt+1,
2090  pSttNd->EndOfSectionIndex() );
2091 
2092  if( bHeader )
2093  rHTMLWrt.m_bOutHeader = true;
2094  else
2095  rHTMLWrt.m_bOutFooter = true;
2096 
2097  rHTMLWrt.Out_SwDoc( rWrt.m_pCurrentPam.get() );
2098  }
2099 
2100  if( bHeader && !aSpacer.isEmpty() )
2101  {
2102  rHTMLWrt.OutNewLine();
2103  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + aSpacer) );
2104  }
2105 
2106  rHTMLWrt.DecIndentLevel(); // indent the content of Multicol;
2107  rHTMLWrt.OutNewLine();
2108  HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_division), false );
2109 
2110  rHTMLWrt.m_nHeaderFooterSpace = 0;
2111 
2112  return rWrt;
2113 }
2114 
2115 void SwHTMLWriter::AddLinkTarget( const OUString& rURL )
2116 {
2117  if( rURL.isEmpty() || rURL[0] != '#' )
2118  return;
2119 
2120  // There might be a '|' as delimiter (if the link has been inserted
2121  // freshly) or a '%7c' or a '%7C' if the document has been saved and
2122  // loaded already.
2123  sal_Int32 nPos = rURL.getLength();
2124  bool bFound = false, bEncoded = false;
2125  while( !bFound && nPos > 0 )
2126  {
2127  sal_Unicode c = rURL[ --nPos ];
2128  switch( c )
2129  {
2130  case cMarkSeparator:
2131  bFound = true;
2132  break;
2133  case '%':
2134  bFound = (rURL.getLength() - nPos) >=3 && rURL[ nPos+1 ] == '7';
2135  if(bFound)
2136  {
2137  c = rURL[ nPos+2 ];
2138  bFound = (c == 'C' || c == 'c');
2139  }
2140  if( bFound )
2141  bEncoded = true;
2142  }
2143  }
2144  if( !bFound || nPos < 2 ) // at least "#a|..."
2145  return;
2146 
2147  OUString aURL( rURL.copy( 1 ) );
2148 
2149  // nPos-1+1/3 (-1 because of Erase)
2150  OUString sCmp = aURL.copy(bEncoded ? nPos+2 : nPos).replaceAll(" ","");
2151  if( sCmp.isEmpty() )
2152  return;
2153 
2154  sCmp = sCmp.toAsciiLowerCase();
2155 
2156  if( sCmp == "region" ||
2157  sCmp == "frame" ||
2158  sCmp == "graphic" ||
2159  sCmp == "ole" ||
2160  sCmp == "table" )
2161  {
2162  // Just remember it in a sorted array
2163  if( bEncoded )
2164  {
2165  aURL = aURL.replaceAt( nPos - 1, 3, rtl::OUStringChar(cMarkSeparator) );
2166  }
2167  m_aImplicitMarks.insert( aURL );
2168  }
2169  else if( sCmp == "outline" )
2170  {
2171  // Here, we need position and name. That's why we sort a
2172  // sal_uInt16 and a string array ourselves.
2173  OUString aOutline( aURL.copy( 0, nPos-1 ) );
2174  SwPosition aPos( *m_pCurrentPam->GetPoint() );
2175  if( m_pDoc->GotoOutline( aPos, aOutline ) )
2176  {
2177  SwNodeOffset nIdx = aPos.nNode.GetIndex();
2178 
2179  decltype(m_aOutlineMarkPoss)::size_type nIns=0;
2180  while( nIns < m_aOutlineMarkPoss.size() &&
2181  m_aOutlineMarkPoss[nIns] < nIdx )
2182  nIns++;
2183 
2184  m_aOutlineMarkPoss.insert( m_aOutlineMarkPoss.begin()+nIns, nIdx );
2185  if( bEncoded )
2186  {
2187  aURL = aURL.replaceAt( nPos - 1, 3, rtl::OUStringChar(cMarkSeparator) );
2188  }
2189  m_aOutlineMarks.insert( m_aOutlineMarks.begin()+nIns, aURL );
2190  }
2191  }
2192 }
2193 
2195 {
2196  const SwTextINetFormat* pTextAttr;
2197 
2198  for (const SfxPoolItem* pItem : m_pDoc->GetAttrPool().GetItemSurrogates(RES_TXTATR_INETFMT))
2199  {
2200  auto pINetFormat = dynamic_cast<const SwFormatINetFormat*>(pItem);
2201  const SwTextNode* pTextNd;
2202 
2203  if( pINetFormat &&
2204  nullptr != ( pTextAttr = pINetFormat->GetTextINetFormat()) &&
2205  nullptr != ( pTextNd = pTextAttr->GetpTextNode() ) &&
2206  pTextNd->GetNodes().IsDocNodes() )
2207  {
2208  AddLinkTarget( pINetFormat->GetValue() );
2209  }
2210  }
2211 
2212  for (const SfxPoolItem* pItem : m_pDoc->GetAttrPool().GetItemSurrogates(RES_URL))
2213  {
2214  auto pURL = dynamic_cast<const SwFormatURL*>(pItem);
2215  if( pURL )
2216  {
2217  AddLinkTarget( pURL->GetURL() );
2218  const ImageMap *pIMap = pURL->GetMap();
2219  if( pIMap )
2220  {
2221  for( size_t i=0; i<pIMap->GetIMapObjectCount(); ++i )
2222  {
2223  const IMapObject* pObj = pIMap->GetIMapObject( i );
2224  if( pObj )
2225  {
2226  AddLinkTarget( pObj->GetURL() );
2227  }
2228  }
2229  }
2230  }
2231  }
2232 }
2233 
2234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const HtmlFrmOpts HTML_FRMOPTS_SPACER
#define OOO_STRING_SVTOOLS_HTML_O_src
Graphic GetGraphic() const
Definition: ndnotxt.cxx:229
Starts a section of nodes in the document model.
Definition: node.hxx:313
static SVT_DLLPUBLIC void applyEvents(HtmlWriter &rHtmlWriter, const SvxMacroTableDtor &rMacroTable, const HTMLOutEvent *pEventTable, bool bOutStarBasic)
#define OOO_STRING_SVTOOLS_HTML_O_vspace
#define OOO_STRING_SVTOOLS_HTML_O_onload
std::set< SwPosFlyFramePtr, SwPosFlyFrameCmp > SwPosFlyFrames
Definition: flypos.hxx:51
bool m_bCfgCpyLinkedGrfs
Definition: wrthtml.hxx:345
tools::Long GetWidth() const
static const SdrObject * GetMarqueeTextObj(const SwDrawFrameFormat &rFormat)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
URL aURL
sal_uInt16 GuessFrameType(const SwFrameFormat &rFrameFormat, const SdrObject *&rpStrObj)
const OUString & GetBaseURL() const
Definition: shellio.hxx:444
#define OOO_STRING_SVTOOLS_HTML_VA_texttop
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:687
static SVT_DLLPUBLIC SvStream & FlushToAscii(SvStream &)
static Writer & OutHTML_FrameFormatAsSpacer(Writer &rWrt, const SwFrameFormat &rFormat)
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
#define OOO_STRING_SVTOOLS_HTML_O_clear
#define OOO_STRING_SVTOOLS_HTML_VA_bottom
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Marks a position in the document model.
Definition: pam.hxx:36
std::vector< OUString > m_aImgMapNames
Definition: wrthtml.hxx:283
bool IsGrfNode() const
Definition: node.hxx:666
#define OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical
HtmlContainerFlags nContainer
Definition: htmlfly.hxx:91
HtmlOut nOut
Definition: htmlfly.hxx:89
sal_uInt16 GetLower() const
void setWidth(tools::Long nWidth)
const OUString & GetText() const
Definition: ndtxt.hxx:218
static bool GraphicToBase64(const Graphic &rGraphic, OUString &rOUString, bool bAddPrefix=true, ConvertDataFormat aTargetFormat=ConvertDataFormat::Unknown)
#define OOO_STRING_SVTOOLS_HTML_O_title
static Writer & OutHTML_FrameFormatAsMulticol(Writer &rWrt, const SwFrameFormat &rFormat, bool bInCntnr)
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
#define OOO_STRING_SVTOOLS_HTML_O_ismap
#define OOO_STRING_SVTOOLS_HTML_VA_absmiddle
tools::Long getWidth() const
SwNodeIndex nNode
Definition: pam.hxx:38
GPOS_NONE
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
BitmapChecksum GetChecksum() const
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
sal_Int32 GetContentIndex() const
Definition: htmlfly.hxx:121
#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseover
const OUString & GetName() const
#define HTMLMODE_BORDER_NONE
Definition: wrthtml.hxx:126
Writer & OutHTML_FrameFormatOLENodeGrf(Writer &rWrt, const SwFrameFormat &rFrameFormat, bool bInCntnr)
Definition: htmlplug.cxx:1449
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:277
tools::Long GetRight() const
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
HtmlContainerFlags
Definition: htmlfly.hxx:76
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
AllHtmlFlags const aHTMLOutFrameParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS]
Definition: htmlflyt.cxx:120
#define OOO_STRING_SVTOOLS_HTML_O_dir
void DecIndentLevel()
Definition: wrthtml.hxx:511
bool IsLinkedFile() const
Definition: ndgrf.hxx:164
Writer & OutHTML_ImageEnd(HtmlWriter &rHtml, Writer &rWrt)
#define OOO_STRING_SVTOOLS_HTML_map
void OutFrameFormat(AllHtmlFlags nType, const SwFrameFormat &rFormat, const SdrObject *pSdrObj)
SwNode & GetNode() const
Definition: ndindex.hxx:119
#define OOO_STRING_SVTOOLS_HTML_O_gutter
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SvxFrameDirection
#define OOO_STRING_SVTOOLS_HTML_O_id
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, std::string_view rStr, bool bOn=true)
bool setExtension(std::u16string_view rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
size_t GetIMapObjectCount() const
const editeng::SvxBorderLine * GetRight() const
HTMLOutEvent const aImageEventTable[]
AllHtmlFlags const aHTMLOutFrameParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS]
Definition: htmlflyt.cxx:217
EmbeddedObjectRef * pObject
constexpr int nBorderWidth
SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative(OUString const &baseUriReference, OUString const &uriReference)
OString maNamespace
XML namespace, in case of XHTML.
Definition: wrthtml.hxx:398
const HtmlFrmOpts HTML_FRMOPTS_IMG_CSS1
HtmlPosition GetOutPos() const
Definition: htmlfly.hxx:124
ErrCode m_nWarn
Definition: wrthtml.hxx:309
#define OOO_STRING_SVTOOLS_HTML_O_alt
const SvxBoxItem & GetBox(bool=true) const
Definition: frmatr.hxx:84
#define OOO_STRING_SVTOOLS_HTML_O_usemap
virtual const tools::Rectangle & GetSnapRect() const
Writer & Out_SfxItemSet(const SwAttrFnTab, Writer &, const SfxItemSet &, bool bDeep)
Definition: wrt_fn.cxx:42
static OutputDevice * GetDefaultDevice()
tools::Long getHeight() const
#define OOO_STRING_SVTOOLS_HTML_O_onmouseout
constexpr tools::Long Width() const
void OutNewLine(bool bCheck=false)
Definition: wrthtml.cxx:1503
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
sal_uInt16 sal_Unicode
const sal_uInt16 MAX_BROWSERS
Definition: htmlfly.hxx:86
bool m_bLFPossible
Definition: wrthtml.hxx:381
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:737
#define OOO_STRING_SVTOOLS_HTML_O_size
SwTableNode * GetTableNode()
Definition: node.hxx:609
bool mbReqIF
If the ReqIF subset of XHTML should be written.
Definition: wrthtml.hxx:400
#define OOO_STRING_SVTOOLS_HTML_O_height
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
SwAttrFnTab aHTMLAttrFnTab
Definition: htmlatr.cxx:3206
#define OOO_STRING_SVTOOLS_HTML_O_href
bool WrapGraphicInRtf(const Graphic &rGraphic, const SwFrameFormat &rFormat, SvStream &rRtf)
Wraps an image in an RTF fragment.
#define WARN_SWG_POOR_LOAD
Definition: swerror.h:40
#define OOO_STRING_SVTOOLS_HTML_O_SDonabort
const OUString & GetName() const
Definition: format.hxx:131
bool IsAnchorOnly() const
Definition: fmtsrnd.hxx:52
OString GetIndentString(sal_uInt16 nIncLvl=0)
Definition: wrthtml.cxx:1486
#define OOO_STRING_SVTOOLS_HTML_O_onabort
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)
#define OOO_STRING_SVTOOLS_HTML_VA_top
std::unique_ptr< utl::TempFile > mpTempBaseURL
Temporary base URL for paste of images.
Definition: wrthtml.hxx:394
bool isAvailable() const
const Graphic * GetGraphic(OUString const &referer=OUString()) const
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:152
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
Definition: ndgrf.cxx:494
static Writer & OutHTML_FrameFormatAsImage(Writer &rWrt, const SwFrameFormat &rFormat, bool bPNGFallback)
bool IsHTMLMode(sal_uInt32 nMode) const
Definition: wrthtml.hxx:580
#define OOO_STRING_SVTOOLS_HTML_O_hspace
const OUString & GetName() const
Definition: fmturl.hxx:71
std::vector< SwFormatINetFormat * > m_aINetFormats
Definition: wrthtml.hxx:293
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
void ChangeParaToken(HtmlTokenId nNew)
Definition: htmlatr.cxx:158
bool IsOLENode() const
Definition: node.hxx:662
#define OOO_STRING_SVTOOLS_HTML_O_data
bool OutFlyFrame(SwNodeOffset nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos)
DocumentType eType
#define OOO_STRING_SVTOOLS_HTML_O_class
#define OOO_STRING_SVTOOLS_HTML_font
void OutImplicitMark(std::u16string_view rMark, const char *pMarkType)
Definition: wrthtml.cxx:1298
#define HTML_PARSPACE
Definition: wrthtml.hxx:70
const SwFrameFormat & GetFormat() const
Definition: htmlfly.hxx:118
const editeng::SvxBorderLine * GetTop() const
bool empty() const
tools::Long GetTextLeft() const
#define OOO_STRING_SVTOOLS_HTML_O_SDonerror
Style of a layout element.
Definition: frmfmt.hxx:59
The graphic frame is a replacement image of an OLE object.
bool m_bCfgStarBasic
Definition: wrthtml.hxx:344
#define HTML_CFG_MAX
#define OOO_STRING_SVTOOLS_HTML_O_onerror
const editeng::SvxBorderLine * GetLeft() const
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
static void OutHTML_ImageOLEEnd(SwHTMLWriter &rHTMLWrt)
Ends the OLE version of an image in the ReqIF + OLE case.
const HtmlFrmOpts HTML_FRMOPTS_IMG
#define OOO_STRING_SVTOOLS_HTML_O_border
GraphicType GetType() const
sal_uInt16 m_nHeaderFooterSpace
Definition: wrthtml.hxx:329
Writer & OutHTML_SwTableNode(Writer &rWrt, SwTableNode &rNode, const SwFrameFormat *pFlyFrameFormat, const OUString *pCaption, bool bTopCaption)
Definition: htmltabw.cxx:873
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
static Writer & OutHTML_FrameFormatAsMarquee(Writer &rWrt, const SwFrameFormat &rFrameFormat, const SdrObject &rSdrObj)
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
constexpr TypedWhichId< SvxMacroItem > RES_FRMMACRO(108)
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:919
SwContentNode * GetContentNode()
Definition: node.hxx:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
FlyAnchors.
Definition: fmtanchr.hxx:34
HtmlOut GetOutFn() const
Definition: htmlfly.hxx:123
tools::Long GetLeft() const
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
static SVT_DLLPUBLIC bool PrivateURLToInternalImg(OUString &rURL)
#define OOO_STRING_SVTOOLS_HTML_AL_left
float u
#define OOO_STRING_SVTOOLS_HTML_O_onmouseover
#define OOO_STRING_SVTOOLS_HTML_O_name
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
AllHtmlFlags const aHTMLOutFramePageFlyTable[MAX_FRMTYPES][MAX_BROWSERS]
Definition: htmlflyt.cxx:24
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:703
bool mbEmbedImages
Definition: wrthtml.hxx:392
#define OOO_STRING_SVTOOLS_HTML_VA_middle
AllHtmlFlags const & GetOutMode() const
Definition: htmlfly.hxx:122
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
const SwTextNode * GetpTextNode() const
Definition: txtinet.hxx:45
bool m_bOutFooter
Definition: wrthtml.hxx:365
GfxLink GetGfxLink() const
tools::Long GetHeight() const
#define OOO_STRING_SVTOOLS_HTML_multicol
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:124
Writer & OutHTML_DrawFrameFormatAsMarquee(Writer &rWrt, const SwDrawFrameFormat &rFormat, const SdrObject &rSdrObject)
SfxItemPool * GetPool() const
SwHTMLFrameType
Definition: htmlfly.hxx:36
void Out_SwDoc(SwPaM *)
Definition: wrthtml.cxx:885
Frame cannot be moved in Var-direction.
tools::Long SwTwips
Definition: swtypes.hxx:51
static Writer & OutHTML_FrameFormatAsDivOrSpan(Writer &rWrt, const SwFrameFormat &rFrameFormat, bool bSpan)
virtual Size GetTwipSize() const override
Definition: ndgrf.cxx:432
const HtmlFrmOpts HTML_FRMOPTS_MULTICOL
bool setBase(std::u16string_view rTheBase, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool m_bExportImagesAsOLE
ReqIF mode: export images as OLE objects.
Definition: wrthtml.hxx:413
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
bool m_bTagOn
Definition: wrthtml.hxx:350
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
bool end(const OString &aElement)
const OUString & GetGraphicLink() const
#define OOO_STRING_SVTOOLS_HTML_SPTYPE_block
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
HtmlFrmOpts
Definition: wrthtml.hxx:76
const SwMirrorGrf & GetMirrorGrf(bool=true) const
Definition: grfatr.hxx:282
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
#define OOO_STRING_SVTOOLS_HTML_O_align
#define OOO_STRING_SVTOOLS_HTML_division
AllHtmlFlags const aHTMLOutFrameParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS]
Definition: htmlflyt.cxx:313
const HtmlFrmOpts HTML_FRMOPTS_CNTNR
#define OOO_STRING_SVTOOLS_HTML_linebreak
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
const SvxMacroTableDtor & GetMacroTable() const
XOutFlags
std::optional< sal_Int32 > m_nShapeDPI
DPI used when exporting a vector shape as a bitmap.
Definition: wrthtml.hxx:416
Writer & OutHTML_DrawFrameFormatAsControl(Writer &rWrt, const SwDrawFrameFormat &rFormat, const SdrUnoObj &rFormObj, bool bInCntnr)
Definition: htmlforw.cxx:672
#define HTMLMODE_ABS_POS_FLY
Definition: wrthtml.hxx:123
#define OOO_STRING_SVTOOLS_HTML_AL_right
static void OutHTML_ImageOLEStart(SwHTMLWriter &rHTMLWrt, const Graphic &rGraphic, const SwFrameFormat &rFrameFormat)
Starts the OLE version of an image in the ReqIF + OLE case.
void characters(std::string_view rChars)
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, OUString *pNonConvertableChars=nullptr)
bool m_bOutHeader
Definition: wrthtml.hxx:364
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
static Writer & OutHTML_FrameFormatTableNode(Writer &rWrt, const SwFrameFormat &rFrameFormat)
void start(const OString &aElement)
Writer & OutHTML_ImageStart(HtmlWriter &rHtml, 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)
SvStream & WriteOString(std::string_view rStr)
#define OOO_STRING_SVTOOLS_HTML_O_style
#define ERRCODE_NONE
constexpr tools::Long Height() const
unsigned char sal_uInt8
const HtmlFrmOpts HTML_FRMOPTS_IMG_CNTNR
OUString GetTitle() const
Definition: ndnotxt.cxx:258
const SdrObject * GetSdrObject() const
Definition: htmlfly.hxx:119
#define OOO_STRING_SVTOOLS_HTML_O_cols
#define OOO_STRING_SVTOOLS_HTML_O_target
const OUString & GetTargetFrameName() const
Definition: fmturl.hxx:65
void IncIndentLevel()
Definition: wrthtml.hxx:507
void CollectFlyFrames()
static SVT_DLLPUBLIC void applyColor(HtmlWriter &rHtmlWriter, std::string_view aAttributeName, const Color &rColor)
void writeFrameFormatOptions(HtmlWriter &aHtml, const SwFrameFormat &rFrameFormat, std::u16string_view rAltText, HtmlFrmOpts nFrameOpts)
OUString aName
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
const OUString * GetOrigFileName() const
Definition: shellio.hxx:439
SwNodes & GetNodes()
Definition: doc.hxx:408
const HtmlFrmOpts HTML_FRMOPTS_DIV
tools::Long AdjustWidth(tools::Long n)
#define HTMLMODE_VERT_SPACER
Definition: wrthtml.hxx:118
HTMLOutEvent const aIMapEventTable[]
static SVT_DLLPUBLIC SvStream & Out_ImageMap(SvStream &, const OUString &, const ImageMap &, const OUString &, const HTMLOutEvent *pEventTable, bool bOutStarBasic, const char *pDelim, const char *pIndentArea, const char *pIndentMap, OUString *pNonConvertableChars=nullptr)
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
Definition: wrthtml.cxx:1552
#define OOO_STRING_SVTOOLS_HTML_spacer
const HtmlFrmOpts HTML_FRMOPTS_IMG_ALL
bool makeAvailable()
Writer & OutHTML_HeaderFooter(Writer &rWrt, const SwFrameFormat &rFrameFormat, bool bHeader)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
#define OOO_STRING_SVTOOLS_HTML_image
SvStream & WriteChar(char nChar)
tools::Long AdjustHeight(tools::Long n)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
HtmlOut
Definition: htmlfly.hxx:54
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:724
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseout
sal_uInt16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false) const
std::shared_ptr< SwUnoCursor > m_pCurrentPam
Definition: shellio.hxx:410
const HtmlFrmOpts HTML_FRMOPTS_MULTICOL_CSS1
void attribute(std::string_view aAttribute, const char *aValue)
sal_uInt16 m_nImgMapCnt
Definition: wrthtml.hxx:314
void setHeight(tools::Long nHeight)
void flushStack()
void AddLinkTarget(const OUString &rURL)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
SvStream & Strm()
Definition: writer.cxx:215
#define OOO_STRING_SVTOOLS_HTML_O_type
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
#define OOO_STRING_SVTOOLS_HTML_O_SDonload
#define OOO_STRING_SVTOOLS_HTML_O_color
const sal_Unicode *const aMimeType[]
void CollectLinkTargets()
#define SAL_WARN(area, stream)
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2380
static Writer & OutHTML_FrameFormatGrfNode(Writer &rWrt, const SwFrameFormat &rFormat, bool bInCntnr, bool bPNGFallback)
RndStdIds
static void GetEEAttrsFromDrwObj(SfxItemSet &rItemSet, const SdrObject *pObj)
bool IsTableNode() const
Definition: node.hxx:650
bool m_bTextAttr
Definition: wrthtml.hxx:359
#define OOO_STRING_SVTOOLS_HTML_VA_absbottom
HtmlPosition
Definition: htmlfly.hxx:69
HTMLOutEvent const aAnchorEventTable[]
Definition: htmlatr.cxx:86
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
bool m_bCfgOutStyles
Definition: wrthtml.hxx:341
const std::shared_ptr< VectorGraphicData > & getVectorGraphicData() const
#define OOO_STRING_SVTOOLS_HTML_object
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:731
void OutAndSetDefList(sal_uInt16 nNewLvl)
Definition: htmlatr.cxx:120
OUString convertHyperlinkHRefValue(const OUString &rURL)
Definition: wrthtml.cxx:1311
Writer & OutHTML_INetFormat(Writer &rWrt, const SwFormatINetFormat &rINetFormat, bool bOn)
Definition: htmlatr.cxx:2939
bool IsServerMap() const
Definition: fmturl.hxx:67
#define OOO_STRING_SVTOOLS_HTML_span
bool IsTextNode() const
Definition: node.hxx:646
bool mbSkipImages
Definition: wrthtml.hxx:389
const editeng::SvxBorderLine * GetBottom() const
const OUString & GetURL() const
#define OOO_STRING_SVTOOLS_HTML_anchor
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:140
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
#define OOO_STRING_SVTOOLS_HTML_O_width
const Graphic & GetGrf(bool bWait=false) const
Definition: ndgrf.cxx:373
#define SAL_NEWLINE_STRING
SwDoc * m_pDoc
Definition: shellio.hxx:408
const Size & GetSize() const
sal_uInt16 nPos
OString OutFrameFormatOptions(const SwFrameFormat &rFrameFormat, const OUString &rAltText, HtmlFrmOpts nFrameOpts)
bool m_bOutFlyFrame
Definition: wrthtml.hxx:366
bool CopyLocalFileToINet(OUString &rFileNm)
Definition: writer.cxx:300
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
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)
Definition: htmlplug.cxx:1189
sal_uInt16 GetUpper() const
Writer & OutHTML_BulletImage(Writer &rWrt, const char *pTag, const SvxBrushItem *pBrush, const OUString &rGraphicURL)
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
const OUString & GetURL() const
Definition: fmturl.hxx:66
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)
Definition: css1atr.cxx:1843
EnumT GetValue() const
Base class of the Writer document model elements.
Definition: node.hxx:81