LibreOffice Module sw (master)  1
htmlgrin.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 <memory>
21 #include <hintids.hxx>
22 #include <comphelper/string.hxx>
24 #include <vcl/svapp.hxx>
26 #include <svl/stritem.hxx>
27 #include <svl/urihelper.hxx>
28 #include <svl/languageoptions.hxx>
29 #include <editeng/fhgtitem.hxx>
30 #include <editeng/brushitem.hxx>
31 #include <editeng/colritem.hxx>
32 #include <editeng/boxitem.hxx>
33 #include <editeng/ulspitem.hxx>
34 #include <editeng/langitem.hxx>
35 #include <sfx2/docfile.hxx>
36 #include <sfx2/event.hxx>
37 #include <vcl/imap.hxx>
38 #include <svtools/htmltokn.h>
39 #include <svtools/htmlkywd.hxx>
40 #include <unotools/eventcfg.hxx>
41 #include <sal/log.hxx>
42 #include <osl/diagnose.h>
43 #include <o3tl/string_view.hxx>
44 
45 #include <fmtornt.hxx>
46 #include <fmturl.hxx>
47 #include <fmtsrnd.hxx>
48 #include <fmtinfmt.hxx>
49 #include <fmtcntnt.hxx>
50 #include <fmtanchr.hxx>
51 #include <fmtfsize.hxx>
52 #include <charatr.hxx>
53 #include <frmfmt.hxx>
54 #include <charfmt.hxx>
55 #include <docsh.hxx>
56 #include <pam.hxx>
57 #include <doc.hxx>
58 #include <ndtxt.hxx>
59 #include <shellio.hxx>
60 #include <poolfmt.hxx>
61 #include <IMark.hxx>
62 #include <ndgrf.hxx>
63 #include "htmlnum.hxx"
64 #include "swcss1.hxx"
65 #include "swhtml.hxx"
66 #include <numrule.hxx>
67 #include <IDocumentMarkAccess.hxx>
68 #include <frameformats.hxx>
69 
70 #include <vcl/graphicfilter.hxx>
71 #include <tools/urlobj.hxx>
73 
74 using namespace ::com::sun::star;
75 
77 {
78  { OOO_STRING_SVTOOLS_HTML_AL_left, text::HoriOrientation::LEFT },
79  { OOO_STRING_SVTOOLS_HTML_AL_right, text::HoriOrientation::RIGHT },
80  { nullptr, 0 }
81 };
82 
84 {
85  { OOO_STRING_SVTOOLS_HTML_VA_top, text::VertOrientation::LINE_TOP },
86  { OOO_STRING_SVTOOLS_HTML_VA_texttop, text::VertOrientation::CHAR_TOP },
87  { OOO_STRING_SVTOOLS_HTML_VA_middle, text::VertOrientation::CENTER },
88  { OOO_STRING_SVTOOLS_HTML_AL_center, text::VertOrientation::CENTER },
89  { OOO_STRING_SVTOOLS_HTML_VA_absmiddle, text::VertOrientation::LINE_CENTER },
90  { OOO_STRING_SVTOOLS_HTML_VA_bottom, text::VertOrientation::TOP },
91  { OOO_STRING_SVTOOLS_HTML_VA_baseline, text::VertOrientation::TOP },
92  { OOO_STRING_SVTOOLS_HTML_VA_absbottom, text::VertOrientation::LINE_BOTTOM },
93  { nullptr, 0 }
94 };
95 
96 ImageMap *SwHTMLParser::FindImageMap( std::u16string_view rName ) const
97 {
98  OSL_ENSURE( rName[0] != '#', "FindImageMap: name begins with '#'!" );
99 
100  if (m_pImageMaps)
101  {
102  for (const auto &rpIMap : *m_pImageMaps)
103  {
104  if (o3tl::equalsIgnoreAsciiCase(rName, rpIMap->GetName()))
105  {
106  return rpIMap.get();
107  }
108  }
109  }
110  return nullptr;
111 }
112 
114 {
115  SwNodes& rNds = m_xDoc->GetNodes();
116  // on the first node of section #1
118  SwNodeOffset nEndIdx = rNds.GetEndOfAutotext().GetIndex();
119 
120  SwGrfNode* pGrfNd;
121  while( m_nMissingImgMaps > 0 && nIdx < nEndIdx )
122  {
123  SwNode *pNd = rNds[nIdx + 1];
124  pGrfNd = pNd->GetGrfNode();
125  if( nullptr != pGrfNd )
126  {
127  SwFrameFormat *pFormat = pGrfNd->GetFlyFormat();
128  SwFormatURL aURL( pFormat->GetURL() );
129  const ImageMap *pIMap = aURL.GetMap();
130  if( pIMap && pIMap->GetIMapObjectCount()==0 )
131  {
132  // The (empty) image map of the node will be either
133  // replaced with found image map or deleted.
134  ImageMap *pNewIMap =
135  FindImageMap( pIMap->GetName() );
136  aURL.SetMap( pNewIMap );
137  pFormat->SetFormatAttr( aURL );
138  if( !pGrfNd->IsScaleImageMap() )
139  {
140  // meanwhile the graphic size is known or the
141  // graphic don't need scaling
142  pGrfNd->ScaleImageMap();
143  }
144  m_nMissingImgMaps--; // search a map less
145  }
146  }
147  nIdx = rNds[nIdx]->EndOfSectionIndex() + 1;
148  }
149 }
150 
151 void SwHTMLParser::SetAnchorAndAdjustment( sal_Int16 eVertOri,
152  sal_Int16 eHoriOri,
153  const SvxCSS1PropertyInfo &rCSS1PropInfo,
154  SfxItemSet& rFrameItemSet )
155 {
156  const SfxItemSet *pCntnrItemSet = nullptr;
157  auto i = m_aContexts.size();
158  while( !pCntnrItemSet && i > m_nContextStMin )
159  pCntnrItemSet = m_aContexts[--i]->GetFrameItemSet();
160 
161  if( pCntnrItemSet )
162  {
163  // If we are in a container then the anchoring of the container is used.
164  rFrameItemSet.Put( *pCntnrItemSet );
165  }
166  else if( SwCSS1Parser::MayBePositioned( rCSS1PropInfo, true ) )
167  {
168  // If the alignment can be set via CSS1 options we use them.
169  SetAnchorAndAdjustment( rCSS1PropInfo, rFrameItemSet );
170  }
171  else
172  {
173  // Otherwise the alignment is set correspondingly the normal HTML options.
174  SetAnchorAndAdjustment( eVertOri, eHoriOri, rFrameItemSet );
175  }
176 }
177 
178 void SwHTMLParser::SetAnchorAndAdjustment( sal_Int16 eVertOri,
179  sal_Int16 eHoriOri,
180  SfxItemSet& rFrameSet,
181  bool bDontAppend )
182 {
183  bool bMoveBackward = false;
184  SwFormatAnchor aAnchor( RndStdIds::FLY_AS_CHAR );
185  sal_Int16 eVertRel = text::RelOrientation::FRAME;
186 
187  if( text::HoriOrientation::NONE != eHoriOri )
188  {
189  // determine paragraph indent
190  sal_uInt16 nLeftSpace = 0, nRightSpace = 0;
191  short nIndent = 0;
192  GetMarginsFromContextWithNumberBullet( nLeftSpace, nRightSpace, nIndent );
193 
194  // determine horizontal alignment and wrapping
195  sal_Int16 eHoriRel;
196  css::text::WrapTextMode eSurround;
197  switch( eHoriOri )
198  {
199  case text::HoriOrientation::LEFT:
200  eHoriRel = nLeftSpace ? text::RelOrientation::PRINT_AREA : text::RelOrientation::FRAME;
201  eSurround = css::text::WrapTextMode_RIGHT;
202  break;
203  case text::HoriOrientation::RIGHT:
204  eHoriRel = nRightSpace ? text::RelOrientation::PRINT_AREA : text::RelOrientation::FRAME;
205  eSurround = css::text::WrapTextMode_LEFT;
206  break;
207  case text::HoriOrientation::CENTER: // for tables
208  eHoriRel = text::RelOrientation::FRAME;
209  eSurround = css::text::WrapTextMode_NONE;
210  break;
211  default:
212  eHoriRel = text::RelOrientation::FRAME;
213  eSurround = css::text::WrapTextMode_PARALLEL;
214  break;
215  }
216 
217  // Create a new paragraph, if the current one has frames
218  // anchored at paragraph/at char without wrapping.
219  if( !bDontAppend && HasCurrentParaFlys( true ) )
220  {
221  // When the paragraph only contains graphics then there
222  // is no need for bottom margin. Since here also with use of
223  // styles no margin should be created, set attributes to
224  // override!
225  sal_uInt16 nUpper=0, nLower=0;
226  GetULSpaceFromContext( nUpper, nLower );
227  InsertAttr( SvxULSpaceItem( nUpper, 0, RES_UL_SPACE ), true );
228 
230 
231  if( nUpper )
232  {
233  NewAttr(m_xAttrTab, &m_xAttrTab->pULSpace, SvxULSpaceItem(0, nLower, RES_UL_SPACE));
234  m_aParaAttrs.push_back( m_xAttrTab->pULSpace );
235  EndAttr( m_xAttrTab->pULSpace, false );
236  }
237  }
238 
239  // determine vertical alignment and anchoring
240  const sal_Int32 nContent = m_pPam->GetPoint()->nContent.GetIndex();
241  if( nContent )
242  {
243  aAnchor.SetType( RndStdIds::FLY_AT_CHAR );
244  bMoveBackward = true;
245  eVertOri = text::VertOrientation::CHAR_BOTTOM;
246  eVertRel = text::RelOrientation::CHAR;
247  }
248  else
249  {
250  aAnchor.SetType( RndStdIds::FLY_AT_PARA );
251  eVertOri = text::VertOrientation::TOP;
252  eVertRel = text::RelOrientation::PRINT_AREA;
253  }
254 
255  rFrameSet.Put( SwFormatHoriOrient( 0, eHoriOri, eHoriRel) );
256 
257  rFrameSet.Put( SwFormatSurround( eSurround ) );
258  }
259  rFrameSet.Put( SwFormatVertOrient( 0, eVertOri, eVertRel) );
260 
261  if( bMoveBackward )
263 
264  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR && !m_pPam->GetNode().GetTextNode())
265  {
266  eState = SvParserState::Error;
267  return;
268  }
269 
270  aAnchor.SetAnchor( m_pPam->GetPoint() );
271 
272  if( bMoveBackward )
274 
275  rFrameSet.Put( aAnchor );
276 }
277 
279 {
280  // automatically anchored frames must be moved forward by one position
281  if( RES_DRAWFRMFMT != pFlyFormat->Which() &&
282  (RndStdIds::FLY_AT_PARA == pFlyFormat->GetAnchor().GetAnchorId()) &&
283  css::text::WrapTextMode_THROUGH == pFlyFormat->GetSurround().GetSurround() )
284  {
285  m_aMoveFlyFrames.emplace_back(std::make_unique<SwHTMLFrameFormatListener>(pFlyFormat));
286  m_aMoveFlyCnts.push_back( m_pPam->GetPoint()->nContent.GetIndex() );
287  }
288 }
289 
290 /* */
291 
293  OUString& rTypeStr ) const
294 {
295  SwDocShell *pDocSh = m_xDoc->GetDocShell();
296  SvKeyValueIterator* pHeaderAttrs = pDocSh ? pDocSh->GetHeaderAttributes()
297  : nullptr;
298  rType = GetScriptType( pHeaderAttrs );
299  rTypeStr = GetScriptTypeString( pHeaderAttrs );
300 }
301 
302 namespace
303 {
304  bool allowAccessLink(const SwDoc& rDoc)
305  {
306  OUString sReferer;
307  SfxObjectShell * sh = rDoc.GetPersist();
308  if (sh != nullptr && sh->HasName())
309  {
310  sReferer = sh->GetMedium()->GetName();
311  }
312  return !SvtSecurityOptions::isUntrustedReferer(sReferer);
313  }
314 }
315 
316 /* */
317 
319 {
320  // and now analyze
321  OUString sAltNm, aId, aClass, aStyle, aMap, sHTMLGrfName;
322  OUString sGrfNm;
323  OUString aGraphicData;
324  sal_Int16 eVertOri = text::VertOrientation::TOP;
325  sal_Int16 eHoriOri = text::HoriOrientation::NONE;
326  bool bWidthProvided=false, bHeightProvided=false;
327  tools::Long nWidth=0, nHeight=0;
328  tools::Long nVSpace=0, nHSpace=0;
329 
330  sal_uInt16 nBorder = (m_xAttrTab->pINetFormat ? 1 : 0);
331  bool bIsMap = false;
332  bool bPercentWidth = false;
333  bool bPercentHeight = false;
334  OUString sWidthAsString, sHeightAsString;
335  SvxMacroItem aMacroItem(RES_FRMMACRO);
336 
337  ScriptType eDfltScriptType;
338  OUString sDfltScriptType;
339  GetDefaultScriptType( eDfltScriptType, sDfltScriptType );
340 
341  const HTMLOptions& rHTMLOptions = GetOptions();
342  for (size_t i = rHTMLOptions.size(); i; )
343  {
344  SvMacroItemId nEvent = SvMacroItemId::NONE;
345  ScriptType eScriptType2 = eDfltScriptType;
346  const HTMLOption& rOption = rHTMLOptions[--i];
347  switch( rOption.GetToken() )
348  {
349  case HtmlOptionId::ID:
350  aId = rOption.GetString();
351  break;
352  case HtmlOptionId::STYLE:
353  aStyle = rOption.GetString();
354  break;
355  case HtmlOptionId::CLASS:
356  aClass = rOption.GetString();
357  break;
358  case HtmlOptionId::SRC:
359  sGrfNm = rOption.GetString();
360  if( !InternalImgToPrivateURL(sGrfNm) )
361  sGrfNm = INetURLObject::GetAbsURL( m_sBaseURL, sGrfNm );
362  break;
363  case HtmlOptionId::DATA:
364  aGraphicData = rOption.GetString();
365  if (!InternalImgToPrivateURL(aGraphicData))
366  aGraphicData = INetURLObject::GetAbsURL(
368  break;
369  case HtmlOptionId::ALIGN:
370  eVertOri =
371  rOption.GetEnum( aHTMLImgVAlignTable,
372  text::VertOrientation::TOP );
373  eHoriOri =
374  rOption.GetEnum( aHTMLImgHAlignTable );
375  break;
376  case HtmlOptionId::WIDTH:
377  // for now only store as pixel value!
378  nWidth = rOption.GetNumber();
379  sWidthAsString = rOption.GetString();
380  bPercentWidth = (sWidthAsString.indexOf('%') != -1);
381  if( bPercentWidth && nWidth>100 )
382  nWidth = 100;
383  // width|height = "auto" means viewing app decides the size
384  // i.e. proceed as if no particular size was provided
385  bWidthProvided = (sWidthAsString != "auto");
386  break;
387  case HtmlOptionId::HEIGHT:
388  // for now only store as pixel value!
389  nHeight = rOption.GetNumber();
390  sHeightAsString = rOption.GetString();
391  bPercentHeight = (sHeightAsString.indexOf('%') != -1);
392  if( bPercentHeight && nHeight>100 )
393  nHeight = 100;
394  // the same as above w/ HtmlOptionId::WIDTH
395  bHeightProvided = (sHeightAsString != "auto");
396  break;
397  case HtmlOptionId::VSPACE:
398  nVSpace = rOption.GetNumber();
399  break;
400  case HtmlOptionId::HSPACE:
401  nHSpace = rOption.GetNumber();
402  break;
403  case HtmlOptionId::ALT:
404  sAltNm = rOption.GetString();
405  break;
406  case HtmlOptionId::BORDER:
407  nBorder = o3tl::narrowing<sal_uInt16>(rOption.GetNumber());
408  break;
409  case HtmlOptionId::ISMAP:
410  bIsMap = true;
411  break;
412  case HtmlOptionId::USEMAP:
413  aMap = rOption.GetString();
414  break;
415  case HtmlOptionId::NAME:
416  sHTMLGrfName = rOption.GetString();
417  break;
418 
419  case HtmlOptionId::SDONLOAD:
420  eScriptType2 = STARBASIC;
421  [[fallthrough]];
422  case HtmlOptionId::ONLOAD:
423  nEvent = SvMacroItemId::OnImageLoadDone;
424  goto IMAGE_SETEVENT;
425 
426  case HtmlOptionId::SDONABORT:
427  eScriptType2 = STARBASIC;
428  [[fallthrough]];
429  case HtmlOptionId::ONABORT:
430  nEvent = SvMacroItemId::OnImageLoadCancel;
431  goto IMAGE_SETEVENT;
432 
433  case HtmlOptionId::SDONERROR:
434  eScriptType2 = STARBASIC;
435  [[fallthrough]];
436  case HtmlOptionId::ONERROR:
437  nEvent = SvMacroItemId::OnImageLoadError;
438  goto IMAGE_SETEVENT;
439 IMAGE_SETEVENT:
440  {
441  OUString sTmp( rOption.GetString() );
442  if( !sTmp.isEmpty() )
443  {
444  sTmp = convertLineEnd(sTmp, GetSystemLineEnd());
445  OUString sScriptType;
446  if( EXTENDED_STYPE == eScriptType2 )
447  sScriptType = sDfltScriptType;
448  aMacroItem.SetMacro( nEvent,
449  SvxMacro( sTmp, sScriptType, eScriptType2 ));
450  }
451  }
452  break;
453  default: break;
454  }
455  }
456 
457  if (sGrfNm.isEmpty() && !aGraphicData.isEmpty())
458  sGrfNm = aGraphicData;
459 
460  if( sGrfNm.isEmpty() )
461  return;
462 
463  // When we are in an ordered list and the paragraph is still empty and not
464  // numbered, it may be a graphic for a bullet list.
465  if( !m_pPam->GetPoint()->nContent.GetIndex() &&
466  GetNumInfo().GetDepth() > 0 && GetNumInfo().GetDepth() <= MAXLEVEL &&
467  !m_aBulletGrfs[GetNumInfo().GetDepth()-1].isEmpty() &&
468  m_aBulletGrfs[GetNumInfo().GetDepth()-1]==sGrfNm )
469  {
470  SwTextNode* pTextNode = m_pPam->GetNode().GetTextNode();
471 
472  if( pTextNode && ! pTextNode->IsCountedInList())
473  {
474  OSL_ENSURE( pTextNode->GetActualListLevel() == GetNumInfo().GetLevel(),
475  "Numbering level is wrong" );
476 
477  pTextNode->SetCountedInList( true );
478 
479  // It's necessary to invalidate the rule, because between the reading
480  // of LI and the graphic an EndAction could be called.
481  if( GetNumInfo().GetNumRule() )
482  GetNumInfo().GetNumRule()->SetInvalidRule( true );
483 
484  // Set the style again, so that indent of the first line is correct.
486 
487  return;
488  }
489  }
490 
491  Graphic aGraphic;
492  INetURLObject aGraphicURL( sGrfNm );
493  if( aGraphicURL.GetProtocol() == INetProtocol::Data )
494  {
495  std::unique_ptr<SvMemoryStream> const pStream(aGraphicURL.getData());
496  if (pStream)
497  {
499  aGraphic = rFilter.ImportUnloadedGraphic(*pStream);
500  sGrfNm.clear();
501 
502  if (!sGrfNm.isEmpty())
503  {
504  if (ERRCODE_NONE == rFilter.ImportGraphic(aGraphic, u"", *pStream))
505  sGrfNm.clear();
506  }
507  }
508  }
509  else if (m_sBaseURL.isEmpty() || !aGraphicData.isEmpty())
510  {
511  // sBaseURL is empty if the source is clipboard
512  // aGraphicData is non-empty for <object data="..."> -> not a linked graphic.
513  if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL))
514  sGrfNm.clear();
515  }
516 
517  if (!sGrfNm.isEmpty())
518  {
519  aGraphic.SetDefaultType();
520  }
521 
522  if (!nHeight || !nWidth)
523  {
524  Size aPixelSize = aGraphic.GetSizePixel(Application::GetDefaultDevice());
525  if (!bWidthProvided)
526  nWidth = aPixelSize.Width();
527  if (!bHeightProvided)
528  nHeight = aPixelSize.Height();
529  // tdf#142781 - calculate the width/height keeping the aspect ratio
530  if (!bPercentWidth && bWidthProvided && !bHeightProvided && aPixelSize.Width())
531  nHeight = nWidth * aPixelSize.Height() / aPixelSize.Width();
532  else if (!bPercentHeight && !bWidthProvided && bHeightProvided && aPixelSize.Height())
533  nWidth = nHeight * aPixelSize.Width() / aPixelSize.Height();
534  }
535 
536  SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
537  SvxCSS1PropertyInfo aPropInfo;
538  if( HasStyleOptions( aStyle, aId, aClass ) )
539  ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo );
540 
541  SfxItemSetFixed<RES_FRMATR_BEGIN, RES_FRMATR_END-1> aFrameSet( m_xDoc->GetAttrPool() );
542  if( !IsNewDoc() )
543  Reader::ResetFrameFormatAttrs( aFrameSet );
544 
545  // set the border
546  tools::Long nHBorderWidth = 0, nVBorderWidth = 0;
547  if( nBorder )
548  {
549  nHBorderWidth = static_cast<tools::Long>(nBorder);
550  nVBorderWidth = static_cast<tools::Long>(nBorder);
551  SvxCSS1Parser::PixelToTwip( nVBorderWidth, nHBorderWidth );
552 
553  ::editeng::SvxBorderLine aHBorderLine( nullptr, nHBorderWidth );
554  ::editeng::SvxBorderLine aVBorderLine( nullptr, nVBorderWidth );
555 
556  if( m_xAttrTab->pINetFormat )
557  {
558  const OUString& rURL =
559  static_cast<const SwFormatINetFormat&>(m_xAttrTab->pINetFormat->GetItem()).GetValue();
560 
561  m_pCSS1Parser->SetATagStyles();
562  sal_uInt16 nPoolId = static_cast< sal_uInt16 >(m_xDoc->IsVisitedURL( rURL )
565  const SwCharFormat *pCharFormat = m_pCSS1Parser->GetCharFormatFromPool( nPoolId );
566  aHBorderLine.SetColor( pCharFormat->GetColor().GetValue() );
567  aVBorderLine.SetColor( aHBorderLine.GetColor() );
568  }
569  else
570  {
571  const SvxColorItem& rColorItem = m_xAttrTab->pFontColor ?
572  static_cast<const SvxColorItem &>(m_xAttrTab->pFontColor->GetItem()) :
573  m_xDoc->GetDefault(RES_CHRATR_COLOR);
574  aHBorderLine.SetColor( rColorItem.GetValue() );
575  aVBorderLine.SetColor( aHBorderLine.GetColor() );
576  }
577 
578  SvxBoxItem aBoxItem( RES_BOX );
579  aBoxItem.SetLine( &aHBorderLine, SvxBoxItemLine::TOP );
580  aBoxItem.SetLine( &aHBorderLine, SvxBoxItemLine::BOTTOM );
581  aBoxItem.SetLine( &aVBorderLine, SvxBoxItemLine::LEFT );
582  aBoxItem.SetLine( &aVBorderLine, SvxBoxItemLine::RIGHT );
583  aFrameSet.Put( aBoxItem );
584  }
585 
586  SetAnchorAndAdjustment( eVertOri, eHoriOri, aPropInfo, aFrameSet );
587 
588  SetSpace( Size( nHSpace, nVSpace), aItemSet, aPropInfo, aFrameSet );
589 
590  // set other CSS1 attributes
591  SetFrameFormatAttrs( aItemSet, HtmlFrameFormatFlags::Box, aFrameSet );
592 
593  Size aTwipSz( bPercentWidth ? 0 : nWidth, bPercentHeight ? 0 : nHeight );
594  if( (aTwipSz.Width() || aTwipSz.Height()) && Application::GetDefaultDevice() )
595  {
596  if (bWidthProvided || bHeightProvided || // attributes imply pixel!
597  aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
598  {
600  ->PixelToLogic( aTwipSz, MapMode( MapUnit::MapTwip ) );
601  }
602  else
603  { // some bitmaps may have a size in metric units (e.g. PNG); use that
604  assert(aGraphic.GetPrefMapMode().GetMapUnit() < MapUnit::MapPixel);
605  aTwipSz = OutputDevice::LogicToLogic(aGraphic.GetPrefSize(),
606  aGraphic.GetPrefMapMode(), MapMode(MapUnit::MapTwip));
607  }
608  }
609 
610  // convert CSS1 size to "normal" size
611  switch( aPropInfo.m_eWidthType )
612  {
613  case SVX_CSS1_LTYPE_TWIP:
614  aTwipSz.setWidth( aPropInfo.m_nWidth );
615  nWidth = 1; // != 0
616  bPercentWidth = false;
617  break;
619  aTwipSz.setWidth( 0 );
620  nWidth = aPropInfo.m_nWidth;
621  bPercentWidth = true;
622  break;
623  default:
624  ;
625  }
626  switch( aPropInfo.m_eHeightType )
627  {
628  case SVX_CSS1_LTYPE_TWIP:
629  aTwipSz.setHeight( aPropInfo.m_nHeight );
630  nHeight = 1; // != 0
631  bPercentHeight = false;
632  break;
634  aTwipSz.setHeight( 0 );
635  nHeight = aPropInfo.m_nHeight;
636  bPercentHeight = true;
637  break;
638  default:
639  ;
640  }
641 
642  Size aGrfSz( 0, 0 );
643  bool bSetTwipSize = true; // Set Twip-Size on Node?
644  bool bChangeFrameSize = false; // Change frame format later?
645  bool bRequestGrfNow = false;
646  bool bSetScaleImageMap = false;
647  sal_uInt8 nPercentWidth = 0, nPercentHeight = 0;
648 
649  // bPercentWidth / bPercentHeight means we have a percent size. If that's not the case and we have no
650  // size from nWidth / nHeight either, then inspect the image header.
651  if ((!bPercentWidth && !nWidth) && (!bPercentHeight && !nHeight) && !m_bFuzzing && allowAccessLink(*m_xDoc))
652  {
653  GraphicDescriptor aDescriptor(aGraphicURL);
654  if (aDescriptor.Detect(/*bExtendedInfo=*/true))
655  {
656  // Try to use size info from the image header before defaulting to
657  // HTML_DFLT_IMG_WIDTH/HEIGHT.
658  aTwipSz = Application::GetDefaultDevice()->PixelToLogic(aDescriptor.GetSizePixel(),
659  MapMode(MapUnit::MapTwip));
660  nWidth = aTwipSz.getWidth();
661  nHeight = aTwipSz.getHeight();
662  }
663  }
664 
665  if( !nWidth || !nHeight )
666  {
667  // When the graphic is in a table, it will be requested immediately,
668  // so that it is available before the table is layouted.
669  if (m_xTable && !nWidth)
670  {
671  bRequestGrfNow = true;
673  }
674 
675  // The frame size is set later
676  bChangeFrameSize = true;
677  aGrfSz = aTwipSz;
678  if( !nWidth && !nHeight )
679  {
680  aTwipSz.setWidth( HTML_DFLT_IMG_WIDTH );
681  aTwipSz.setHeight( HTML_DFLT_IMG_HEIGHT );
682  }
683  else if( nWidth )
684  {
685  // a percentage value
686  if( bPercentWidth )
687  {
688  nPercentWidth = static_cast<sal_uInt8>(nWidth);
689  nPercentHeight = 255;
690  }
691  else
692  {
693  aTwipSz.setHeight( HTML_DFLT_IMG_HEIGHT );
694  }
695  }
696  else if( nHeight )
697  {
698  if( bPercentHeight )
699  {
700  nPercentHeight = static_cast<sal_uInt8>(nHeight);
701  nPercentWidth = 255;
702  }
703  else
704  {
705  aTwipSz.setWidth( HTML_DFLT_IMG_WIDTH );
706  }
707  }
708  }
709  else
710  {
711  // Width and height were given and don't need to be set
712  bSetTwipSize = false;
713 
714  if( bPercentWidth )
715  nPercentWidth = static_cast<sal_uInt8>(nWidth);
716 
717  if( bPercentHeight )
718  nPercentHeight = static_cast<sal_uInt8>(nHeight);
719  }
720 
721  // set image map
722  aMap = comphelper::string::stripEnd(aMap, ' ');
723  if( !aMap.isEmpty() )
724  {
725  // Since we only know local image maps we just use everything
726  // after # as name
727  sal_Int32 nPos = aMap.indexOf( '#' );
728  OUString aName;
729  if ( -1 == nPos )
730  aName = aMap ;
731  else
732  aName = aMap.copy(nPos+1);
733 
734  ImageMap *pImgMap = FindImageMap( aName );
735  if( pImgMap )
736  {
737  SwFormatURL aURL; aURL.SetMap( pImgMap );// is copied
738 
739  bSetScaleImageMap = !nPercentWidth || !nPercentHeight;
740  aFrameSet.Put( aURL );
741  }
742  else
743  {
744  ImageMap aEmptyImgMap( aName );
745  SwFormatURL aURL; aURL.SetMap( &aEmptyImgMap );// is copied
746  aFrameSet.Put( aURL );
747  m_nMissingImgMaps++; // image maps are missing
748 
749  // the graphic has to scaled during SetTwipSize, if we didn't
750  // set a size on the node or the size doesn't match the graphic size.
751  bSetScaleImageMap = true;
752  }
753  }
754 
755  // observe minimum values !!
756  if( nPercentWidth )
757  {
758  OSL_ENSURE( !aTwipSz.Width(),
759  "Why is a width set if we already have percentage value?" );
760  aTwipSz.setWidth( aGrfSz.Width() ? aGrfSz.Width()
762  }
763  else
764  {
765  aTwipSz.AdjustWidth(2*nVBorderWidth );
766  if( aTwipSz.Width() < MINFLY )
767  aTwipSz.setWidth( MINFLY );
768  }
769  if( nPercentHeight )
770  {
771  OSL_ENSURE( !aTwipSz.Height(),
772  "Why is a height set if we already have percentage value?" );
773  aTwipSz.setHeight( aGrfSz.Height() ? aGrfSz.Height()
775  }
776  else
777  {
778  aTwipSz.AdjustHeight(2*nHBorderWidth );
779  if( aTwipSz.Height() < MINFLY )
780  aTwipSz.setHeight( MINFLY );
781  }
782 
783  SwFormatFrameSize aFrameSize( SwFrameSize::Fixed, aTwipSz.Width(), aTwipSz.Height() );
784  aFrameSize.SetWidthPercent( nPercentWidth );
785  aFrameSize.SetHeightPercent( nPercentHeight );
786  aFrameSet.Put( aFrameSize );
787 
788  const SwNodeType eNodeType = m_pPam->GetNode().GetNodeType();
789  if (eNodeType != SwNodeType::Text && eNodeType != SwNodeType::Table)
790  return;
791 
792  // passing empty sGrfNm here, means we don't want the graphic to be linked
793  SwFrameFormat *const pFlyFormat =
794  m_xDoc->getIDocumentContentOperations().InsertGraphic(
795  *m_pPam, sGrfNm, OUString(), &aGraphic,
796  &aFrameSet, nullptr, nullptr);
797  SwGrfNode *pGrfNd = m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx()
798  ->GetIndex()+1 ]->GetGrfNode();
799 
800  if( !sHTMLGrfName.isEmpty() )
801  {
802  pFlyFormat->SetName( sHTMLGrfName );
803 
804  // maybe jump to graphic
805  if( JumpToMarks::Graphic == m_eJumpTo && sHTMLGrfName == m_sJmpMark )
806  {
807  m_bChkJumpMark = true;
809  }
810  }
811 
812  if (pGrfNd)
813  {
814  if( !sAltNm.isEmpty() )
815  pGrfNd->SetTitle( sAltNm );
816 
817  if( bSetTwipSize )
818  pGrfNd->SetTwipSize( aGrfSz );
819 
820  pGrfNd->SetChgTwipSize( bChangeFrameSize );
821 
822  if( bSetScaleImageMap )
823  pGrfNd->SetScaleImageMap( true );
824  }
825 
826  if( m_xAttrTab->pINetFormat )
827  {
828  const SwFormatINetFormat &rINetFormat =
829  static_cast<const SwFormatINetFormat&>(m_xAttrTab->pINetFormat->GetItem());
830 
831  SwFormatURL aURL( pFlyFormat->GetURL() );
832 
833  aURL.SetURL( rINetFormat.GetValue(), bIsMap );
834  aURL.SetTargetFrameName( rINetFormat.GetTargetFrame() );
835  aURL.SetName( rINetFormat.GetName() );
836  pFlyFormat->SetFormatAttr( aURL );
837 
838  {
839  static const SvMacroItemId aEvents[] = {
840  SvMacroItemId::OnMouseOver,
841  SvMacroItemId::OnClick,
842  SvMacroItemId::OnMouseOut };
843 
844  for( SvMacroItemId id : aEvents )
845  {
846  const SvxMacro *pMacro = rINetFormat.GetMacro( id );
847  if( nullptr != pMacro )
848  aMacroItem.SetMacro( id, *pMacro );
849  }
850  }
851 
852  if ((RndStdIds::FLY_AS_CHAR == pFlyFormat->GetAnchor().GetAnchorId()) &&
853  m_xAttrTab->pINetFormat->GetStartParagraph() ==
854  m_pPam->GetPoint()->nNode &&
855  m_xAttrTab->pINetFormat->GetStartContent() ==
856  m_pPam->GetPoint()->nContent.GetIndex() - 1 )
857  {
858  // the attribute was insert right before as-character anchored
859  // graphic, therefore we move it
860  m_xAttrTab->pINetFormat->SetStart( *m_pPam->GetPoint() );
861 
862  // When the attribute is also an anchor, we'll insert
863  // a bookmark before the graphic, because SwFormatURL
864  // isn't an anchor.
865  if( !rINetFormat.GetName().isEmpty() )
866  {
868  InsertBookmark( rINetFormat.GetName() );
870  }
871  }
872 
873  }
874 
875  if( !aMacroItem.GetMacroTable().empty() )
876  {
878  pFlyFormat->SetFormatAttr( aMacroItem );
879  }
880 
881  // tdf#87083 If the graphic has not been loaded yet, then load it now.
882  // Otherwise it may be loaded during the first paint of the object and it
883  // will be too late to adapt the size of the graphic at that point.
884  if (bRequestGrfNow && pGrfNd)
885  {
886  Size aUpdatedSize = pGrfNd->GetTwipSize(); //trigger a swap-in
887  SAL_WARN_IF(!aUpdatedSize.Width() || !aUpdatedSize.Height(), "sw.html", "html image with no width or height");
888  }
889 
890  // maybe create frames and register auto bound frames
891  RegisterFlyFrame( pFlyFormat );
892 
893  if( !aId.isEmpty() )
894  InsertBookmark( aId );
895 }
896 
897 /* */
898 
900 {
901  m_xDoc->SetTextFormatColl( *m_pPam,
902  m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_TEXT ) );
903 
904  OUString aBackGround, aId, aStyle, aLang, aDir;
905  Color aBGColor, aTextColor, aLinkColor, aVLinkColor;
906  bool bBGColor=false, bTextColor=false;
907  bool bLinkColor=false, bVLinkColor=false;
908 
909  ScriptType eDfltScriptType;
910  OUString sDfltScriptType;
911  GetDefaultScriptType( eDfltScriptType, sDfltScriptType );
912 
913  const HTMLOptions& rHTMLOptions = GetOptions();
914  for (size_t i = rHTMLOptions.size(); i; )
915  {
916  const HTMLOption& rOption = rHTMLOptions[--i];
917  ScriptType eScriptType2 = eDfltScriptType;
918  OUString aEvent;
919  bool bSetEvent = false;
920 
921  switch( rOption.GetToken() )
922  {
923  case HtmlOptionId::ID:
924  aId = rOption.GetString();
925  break;
926  case HtmlOptionId::BACKGROUND:
927  aBackGround = rOption.GetString();
928  break;
929  case HtmlOptionId::BGCOLOR:
930  rOption.GetColor( aBGColor );
931  bBGColor = true;
932  break;
933  case HtmlOptionId::TEXT:
934  rOption.GetColor( aTextColor );
935  bTextColor = true;
936  break;
937  case HtmlOptionId::LINK:
938  rOption.GetColor( aLinkColor );
939  bLinkColor = true;
940  break;
941  case HtmlOptionId::VLINK:
942  rOption.GetColor( aVLinkColor );
943  bVLinkColor = true;
944  break;
945 
946  case HtmlOptionId::SDONLOAD:
947  eScriptType2 = STARBASIC;
948  [[fallthrough]];
949  case HtmlOptionId::ONLOAD:
950  aEvent = GlobalEventConfig::GetEventName( GlobalEventId::OPENDOC );
951  bSetEvent = true;
952  break;
953 
954  case HtmlOptionId::SDONUNLOAD:
955  eScriptType2 = STARBASIC;
956  [[fallthrough]];
957  case HtmlOptionId::ONUNLOAD:
958  aEvent = GlobalEventConfig::GetEventName( GlobalEventId::PREPARECLOSEDOC );
959  bSetEvent = true;
960  break;
961 
962  case HtmlOptionId::SDONFOCUS:
963  eScriptType2 = STARBASIC;
964  [[fallthrough]];
965  case HtmlOptionId::ONFOCUS:
966  aEvent = GlobalEventConfig::GetEventName( GlobalEventId::ACTIVATEDOC );
967  bSetEvent = true;
968  break;
969 
970  case HtmlOptionId::SDONBLUR:
971  eScriptType2 = STARBASIC;
972  [[fallthrough]];
973  case HtmlOptionId::ONBLUR:
974  aEvent = GlobalEventConfig::GetEventName( GlobalEventId::DEACTIVATEDOC );
975  bSetEvent = true;
976  break;
977 
978  case HtmlOptionId::ONERROR:
979  break;
980 
981  case HtmlOptionId::STYLE:
982  aStyle = rOption.GetString();
983  bTextColor = true;
984  break;
985  case HtmlOptionId::LANG:
986  aLang = rOption.GetString();
987  break;
988  case HtmlOptionId::DIR:
989  aDir = rOption.GetString();
990  break;
991  default: break;
992  }
993 
994  if( bSetEvent )
995  {
996  const OUString& rEvent = rOption.GetString();
997  if( !rEvent.isEmpty() )
998  InsertBasicDocEvent( aEvent, rEvent, eScriptType2,
999  sDfltScriptType );
1000  }
1001  }
1002 
1003  if( bTextColor && !m_pCSS1Parser->IsBodyTextSet() )
1004  {
1005  // The font colour is set in the default style
1006  m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_STANDARD )
1007  ->SetFormatAttr( SvxColorItem(aTextColor, RES_CHRATR_COLOR) );
1008  m_pCSS1Parser->SetBodyTextSet();
1009  }
1010 
1011  // Prepare the items for the page style (background, frame)
1012  // If BrushItem already set values must remain!
1013  std::unique_ptr<SvxBrushItem> aBrushItem( m_pCSS1Parser->makePageDescBackground() );
1014  bool bSetBrush = false;
1015 
1016  if( bBGColor && !m_pCSS1Parser->IsBodyBGColorSet() )
1017  {
1018  // background colour from "BGCOLOR"
1019  OUString aLink;
1020  if( !aBrushItem->GetGraphicLink().isEmpty() )
1021  aLink = aBrushItem->GetGraphicLink();
1022  SvxGraphicPosition ePos = aBrushItem->GetGraphicPos();
1023 
1024  aBrushItem->SetColor( aBGColor );
1025 
1026  if( !aLink.isEmpty() )
1027  {
1028  aBrushItem->SetGraphicLink( aLink );
1029  aBrushItem->SetGraphicPos( ePos );
1030  }
1031  bSetBrush = true;
1032  m_pCSS1Parser->SetBodyBGColorSet();
1033  }
1034 
1035  if( !aBackGround.isEmpty() && !m_pCSS1Parser->IsBodyBackgroundSet() )
1036  {
1037  // background graphic from "BACKGROUND"
1038  aBrushItem->SetGraphicLink( INetURLObject::GetAbsURL( m_sBaseURL, aBackGround ) );
1039  aBrushItem->SetGraphicPos( GPOS_TILED );
1040  bSetBrush = true;
1041  m_pCSS1Parser->SetBodyBackgroundSet();
1042  }
1043 
1044  if( !aStyle.isEmpty() || !aDir.isEmpty() )
1045  {
1046  SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
1047  SvxCSS1PropertyInfo aPropInfo;
1048  OUString aDummy;
1049  ParseStyleOptions( aStyle, aDummy, aDummy, aItemSet, aPropInfo, nullptr, &aDir );
1050 
1051  // Some attributes have to set on the page style, in fact the ones
1052  // which aren't inherited
1053  m_pCSS1Parser->SetPageDescAttrs( bSetBrush ? aBrushItem.get() : nullptr,
1054  &aItemSet );
1055 
1056  static const TypedWhichId<SvxFontHeightItem> aWhichIds[3] = { RES_CHRATR_FONTSIZE,
1059  for(auto const & i : aWhichIds)
1060  {
1061  const SvxFontHeightItem *pItem = aItemSet.GetItemIfSet( i, false );
1062  if( pItem && pItem->GetProp() != 100)
1063  {
1064  sal_uInt32 nHeight =
1065  ( m_aFontHeights[2] * pItem->GetProp() ) / 100;
1066  SvxFontHeightItem aNewItem( nHeight, 100, i );
1067  aItemSet.Put( aNewItem );
1068  }
1069  }
1070 
1071  // all remaining options can be set on the default style
1072  m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_STANDARD )
1073  ->SetFormatAttr( aItemSet );
1074  }
1075  else if( bSetBrush )
1076  {
1077  m_pCSS1Parser->SetPageDescAttrs( aBrushItem.get() );
1078  }
1079 
1080  if( bLinkColor && !m_pCSS1Parser->IsBodyLinkSet() )
1081  {
1082  SwCharFormat *pCharFormat =
1083  m_pCSS1Parser->GetCharFormatFromPool(RES_POOLCHR_INET_NORMAL);
1084  pCharFormat->SetFormatAttr( SvxColorItem(aLinkColor, RES_CHRATR_COLOR) );
1085  m_pCSS1Parser->SetBodyLinkSet();
1086  }
1087  if( bVLinkColor && !m_pCSS1Parser->IsBodyVLinkSet() )
1088  {
1089  SwCharFormat *pCharFormat =
1090  m_pCSS1Parser->GetCharFormatFromPool(RES_POOLCHR_INET_VISIT);
1091  pCharFormat->SetFormatAttr( SvxColorItem(aVLinkColor, RES_CHRATR_COLOR) );
1092  m_pCSS1Parser->SetBodyVLinkSet();
1093  }
1094  if( !aLang.isEmpty() )
1095  {
1097  if( LANGUAGE_DONTKNOW != eLang )
1098  {
1099  sal_uInt16 nWhich = 0;
1101  {
1102  case SvtScriptType::LATIN:
1103  nWhich = RES_CHRATR_LANGUAGE;
1104  break;
1105  case SvtScriptType::ASIAN:
1106  nWhich = RES_CHRATR_CJK_LANGUAGE;
1107  break;
1108  case SvtScriptType::COMPLEX:
1109  nWhich = RES_CHRATR_CTL_LANGUAGE;
1110  break;
1111  default: break;
1112  }
1113  if( nWhich )
1114  {
1115  SvxLanguageItem aLanguage( eLang, nWhich );
1116  aLanguage.SetWhich( nWhich );
1117  m_xDoc->SetDefault( aLanguage );
1118  }
1119  }
1120  }
1121 
1122  if( !aId.isEmpty() )
1123  InsertBookmark( aId );
1124 }
1125 
1126 /* */
1127 
1129 {
1130  // end previous link if there was one
1131  std::unique_ptr<HTMLAttrContext> xOldCntxt(PopContext(HtmlTokenId::ANCHOR_ON));
1132  if (xOldCntxt)
1133  {
1134  // and maybe end attributes
1135  EndContext(xOldCntxt.get());
1136  }
1137 
1138  SvxMacroTableDtor aMacroTable;
1139  OUString sHRef, aName, sTarget;
1140  OUString aId, aStyle, aClass, aLang, aDir;
1141  bool bHasHRef = false, bFixed = false;
1142 
1143  ScriptType eDfltScriptType;
1144  OUString sDfltScriptType;
1145  GetDefaultScriptType( eDfltScriptType, sDfltScriptType );
1146 
1147  const HTMLOptions& rHTMLOptions = GetOptions();
1148  for (size_t i = rHTMLOptions.size(); i; )
1149  {
1150  SvMacroItemId nEvent = SvMacroItemId::NONE;
1151  ScriptType eScriptType2 = eDfltScriptType;
1152  const HTMLOption& rOption = rHTMLOptions[--i];
1153  switch( rOption.GetToken() )
1154  {
1155  case HtmlOptionId::NAME:
1156  aName = rOption.GetString();
1157  break;
1158 
1159  case HtmlOptionId::HREF:
1160  sHRef = rOption.GetString();
1161  bHasHRef = true;
1162  break;
1163  case HtmlOptionId::TARGET:
1164  sTarget = rOption.GetString();
1165  break;
1166 
1167  case HtmlOptionId::STYLE:
1168  aStyle = rOption.GetString();
1169  break;
1170  case HtmlOptionId::ID:
1171  aId = rOption.GetString();
1172  break;
1173  case HtmlOptionId::CLASS:
1174  aClass = rOption.GetString();
1175  break;
1176  case HtmlOptionId::SDFIXED:
1177  bFixed = true;
1178  break;
1179  case HtmlOptionId::LANG:
1180  aLang = rOption.GetString();
1181  break;
1182  case HtmlOptionId::DIR:
1183  aDir = rOption.GetString();
1184  break;
1185 
1186  case HtmlOptionId::SDONCLICK:
1187  eScriptType2 = STARBASIC;
1188  [[fallthrough]];
1189  case HtmlOptionId::ONCLICK:
1190  nEvent = SvMacroItemId::OnClick;
1191  goto ANCHOR_SETEVENT;
1192 
1193  case HtmlOptionId::SDONMOUSEOVER:
1194  eScriptType2 = STARBASIC;
1195  [[fallthrough]];
1196  case HtmlOptionId::ONMOUSEOVER:
1197  nEvent = SvMacroItemId::OnMouseOver;
1198  goto ANCHOR_SETEVENT;
1199 
1200  case HtmlOptionId::SDONMOUSEOUT:
1201  eScriptType2 = STARBASIC;
1202  [[fallthrough]];
1203  case HtmlOptionId::ONMOUSEOUT:
1204  nEvent = SvMacroItemId::OnMouseOut;
1205  goto ANCHOR_SETEVENT;
1206 ANCHOR_SETEVENT:
1207  {
1208  OUString sTmp( rOption.GetString() );
1209  if( !sTmp.isEmpty() )
1210  {
1211  sTmp = convertLineEnd(sTmp, GetSystemLineEnd());
1212  OUString sScriptType;
1213  if( EXTENDED_STYPE == eScriptType2 )
1214  sScriptType = sDfltScriptType;
1215  aMacroTable.Insert( nEvent, SvxMacro( sTmp, sScriptType, eScriptType2 ));
1216  }
1217  }
1218  break;
1219  default: break;
1220  }
1221  }
1222 
1223  // Jump targets, which match our implicit targets,
1224  // here we throw out rigorously.
1225  if( !aName.isEmpty() )
1226  {
1227  OUString sDecoded( INetURLObject::decode( aName,
1229  sal_Int32 nPos = sDecoded.lastIndexOf( cMarkSeparator );
1230  if( nPos != -1 )
1231  {
1232  OUString sCmp= sDecoded.copy(nPos+1).replaceAll(" ","");
1233  if( !sCmp.isEmpty() )
1234  {
1235  sCmp = sCmp.toAsciiLowerCase();
1236  if( sCmp == "region" ||
1237  sCmp == "frame" ||
1238  sCmp == "graphic" ||
1239  sCmp == "ole" ||
1240  sCmp == "table" ||
1241  sCmp == "outline" ||
1242  sCmp == "text" )
1243  {
1244  aName.clear();
1245  }
1246  }
1247  }
1248  }
1249 
1250  // create a new context
1251  std::unique_ptr<HTMLAttrContext> xCntxt(new HTMLAttrContext(HtmlTokenId::ANCHOR_ON));
1252 
1253  bool bEnAnchor = false, bFootnoteAnchor = false, bFootnoteEnSymbol = false;
1254  OUString aFootnoteName;
1255  OUString aStrippedClass( aClass );
1256  SwCSS1Parser::GetScriptFromClass( aStrippedClass, false );
1257  if( aStrippedClass.getLength() >=9 && bHasHRef && sHRef.getLength() > 1 &&
1258  ('s' == aStrippedClass[0] || 'S' == aStrippedClass[0]) &&
1259  ('d' == aStrippedClass[1] || 'D' == aStrippedClass[1]) )
1260  {
1261  if( aStrippedClass.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_sdendnote_anc ) )
1262  bEnAnchor = true;
1263  else if( aStrippedClass.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_sdfootnote_anc ) )
1264  bFootnoteAnchor = true;
1265  else if( aStrippedClass.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_sdendnote_sym ) ||
1266  aStrippedClass.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_sdfootnote_sym ) )
1267  bFootnoteEnSymbol = true;
1268  if( bEnAnchor || bFootnoteAnchor || bFootnoteEnSymbol )
1269  {
1270  aFootnoteName = sHRef.copy( 1 );
1271  aClass.clear();
1272  aStrippedClass.clear();
1273  aName.clear();
1274  bHasHRef = false;
1275  }
1276  }
1277 
1278  // Styles parsen
1279  if( HasStyleOptions( aStyle, aId, aStrippedClass, &aLang, &aDir ) )
1280  {
1281  SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
1282  SvxCSS1PropertyInfo aPropInfo;
1283 
1284  if( ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) )
1285  {
1286  DoPositioning(aItemSet, aPropInfo, xCntxt.get());
1287  InsertAttrs(aItemSet, aPropInfo, xCntxt.get(), true);
1288  }
1289  }
1290 
1291  if( bHasHRef )
1292  {
1293  if( !sHRef.isEmpty() )
1294  {
1296  }
1297  else
1298  {
1299  // use directory if empty URL
1300  INetURLObject aURLObj( m_aPathToFile );
1301  sHRef = aURLObj.GetPartBeforeLastName();
1302  }
1303 
1304  m_pCSS1Parser->SetATagStyles();
1305  SwFormatINetFormat aINetFormat( sHRef, sTarget );
1306  aINetFormat.SetName( aName );
1307 
1308  if( !aMacroTable.empty() )
1309  {
1311  aINetFormat.SetMacroTable( &aMacroTable );
1312  }
1313 
1314  // set the default attribute
1315  InsertAttr(&m_xAttrTab->pINetFormat, aINetFormat, xCntxt.get());
1316  }
1317  else if( !aName.isEmpty() )
1318  {
1319  InsertBookmark( aName );
1320  }
1321 
1322  if( bEnAnchor || bFootnoteAnchor )
1323  {
1324  InsertFootEndNote( aFootnoteName, bEnAnchor, bFixed );
1326  }
1327  else if( bFootnoteEnSymbol )
1328  {
1330  }
1331 
1332  // save context
1333  PushContext(xCntxt);
1334 }
1335 
1337 {
1339  {
1341  m_bInFootEndNoteAnchor = false;
1342  }
1343  else if( m_bInFootEndNoteSymbol )
1344  {
1345  m_bInFootEndNoteSymbol = false;
1346  }
1347 
1348  EndTag( HtmlTokenId::ANCHOR_OFF );
1349 }
1350 
1351 /* */
1352 
1353 void SwHTMLParser::InsertBookmark( const OUString& rName )
1354 {
1355  HTMLAttr* pTmp = new HTMLAttr( *m_pPam->GetPoint(),
1356  SfxStringItem(RES_FLTR_BOOKMARK, rName), nullptr, std::shared_ptr<HTMLAttrTable>());
1357  m_aSetAttrTab.push_back( pTmp );
1358 }
1359 
1360 bool SwHTMLParser::HasCurrentParaBookmarks( bool bIgnoreStack ) const
1361 {
1362  bool bHasMarks = false;
1363  SwNodeOffset nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex();
1364 
1365  // first step: are there still bookmark in the attribute-stack?
1366  // bookmarks are added to the end of the stack - thus we only have
1367  // to check the last bookmark
1368  if( !bIgnoreStack )
1369  {
1370  for( auto i = m_aSetAttrTab.size(); i; )
1371  {
1372  HTMLAttr* pAttr = m_aSetAttrTab[ --i ];
1373  if( RES_FLTR_BOOKMARK == pAttr->m_pItem->Which() )
1374  {
1375  if( pAttr->GetStartParagraphIdx() == nNodeIdx )
1376  bHasMarks = true;
1377  break;
1378  }
1379  }
1380  }
1381 
1382  if( !bHasMarks )
1383  {
1384  // second step: when we didn't find a bookmark, check if there is one set already
1385  IDocumentMarkAccess* const pMarkAccess = m_xDoc->getIDocumentMarkAccess();
1386  for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
1387  ppMark != pMarkAccess->getAllMarksEnd();
1388  ++ppMark)
1389  {
1390  const ::sw::mark::IMark* pBookmark = *ppMark;
1391 
1392  const SwNodeOffset nBookNdIdx = pBookmark->GetMarkPos().nNode.GetIndex();
1393  if( nBookNdIdx==nNodeIdx )
1394  {
1395  bHasMarks = true;
1396  break;
1397  }
1398  else if( nBookNdIdx > nNodeIdx )
1399  break;
1400  }
1401  }
1402 
1403  return bHasMarks;
1404 }
1405 
1406 /* */
1407 
1409 {
1410  bool bSetSmallFont = false;
1411 
1412  SwContentNode* pCNd = m_pPam->GetContentNode();
1413  SwNodeOffset nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex();
1414  if( !m_pPam->GetPoint()->nContent.GetIndex() )
1415  {
1416  if( pCNd && pCNd->StartOfSectionIndex() + 2 <
1417  pCNd->EndOfSectionIndex() && CanRemoveNode(nNodeIdx))
1418  {
1419  const SwFrameFormats& rFrameFormatTable = *m_xDoc->GetSpzFrameFormats();
1420 
1421  for( auto pFormat : rFrameFormatTable )
1422  {
1423  SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
1424  SwPosition const*const pAPos = pAnchor->GetContentAnchor();
1425  if (pAPos &&
1426  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
1427  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
1428  pAPos->nNode == nNodeIdx )
1429 
1430  return; // we can't delete the node
1431  }
1432 
1433  SetAttr( false ); // the still open attributes must be
1434  // closed before the node is deleted,
1435  // otherwise the last index is dangling
1436 
1437  if( pCNd->Len() && pCNd->IsTextNode() )
1438  {
1439  // fields were inserted into the node, now they have
1440  // to be moved
1441  SwTextNode *pPrvNd = m_xDoc->GetNodes()[nNodeIdx-1]->GetTextNode();
1442  if( pPrvNd )
1443  {
1444  SwIndex aSrc( pCNd, 0 );
1445  pCNd->GetTextNode()->CutText( pPrvNd, aSrc, pCNd->Len() );
1446  }
1447  }
1448 
1449  // now we have to move maybe existing bookmarks
1450  IDocumentMarkAccess* const pMarkAccess = m_xDoc->getIDocumentMarkAccess();
1451  for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
1452  ppMark != pMarkAccess->getAllMarksEnd();
1453  ++ppMark)
1454  {
1455  ::sw::mark::IMark* pMark = *ppMark;
1456 
1457  SwNodeOffset nBookNdIdx = pMark->GetMarkPos().nNode.GetIndex();
1458  if(nBookNdIdx==nNodeIdx)
1459  {
1460  SwNodeIndex nNewNdIdx(m_pPam->GetPoint()->nNode);
1461  SwContentNode* pNd = SwNodes::GoPrevious(&nNewNdIdx);
1462  if(!pNd)
1463  {
1464  OSL_ENSURE(false, "Oops, where is my predecessor node?");
1465  return;
1466  }
1467  // #i81002# - refactoring
1468  // Do not directly manipulate member of <SwBookmark>
1469  {
1470  SwPosition aNewPos(*pNd);
1471  aNewPos.nContent.Assign(pNd, pNd->Len());
1472  const SwPaM aPaM(aNewPos);
1473  pMarkAccess->repositionMark(*ppMark, aPaM);
1474  }
1475  }
1476  else if( nBookNdIdx > nNodeIdx )
1477  break;
1478  }
1479 
1480  m_pPam->GetPoint()->nContent.Assign( nullptr, 0 );
1481  m_pPam->SetMark();
1482  m_pPam->DeleteMark();
1483  m_xDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode );
1485  }
1486  else if (pCNd && pCNd->IsTextNode() && m_xTable)
1487  {
1488  // In empty cells we set a small font, so that the cell doesn't
1489  // get higher than the graphic resp. as low as possible.
1490  bSetSmallFont = true;
1491  }
1492  }
1493  else if( pCNd && pCNd->IsTextNode() && m_xTable &&
1494  pCNd->StartOfSectionIndex()+2 ==
1495  pCNd->EndOfSectionIndex() )
1496  {
1497  // When the cell contains only as-character anchored graphics/frames,
1498  // then we also set a small font.
1499  bSetSmallFont = true;
1500  SwTextNode* pTextNd = pCNd->GetTextNode();
1501 
1502  sal_Int32 nPos = m_pPam->GetPoint()->nContent.GetIndex();
1503  while( bSetSmallFont && nPos>0 )
1504  {
1505  --nPos;
1506  bSetSmallFont =
1507  (CH_TXTATR_BREAKWORD == pTextNd->GetText()[nPos]) &&
1508  (nullptr != pTextNd->GetTextAttrForCharAt( nPos, RES_TXTATR_FLYCNT ));
1509  }
1510  }
1511 
1512  if( bSetSmallFont )
1513  {
1514  // Added default to CJK and CTL
1515  SvxFontHeightItem aFontHeight( 40, 100, RES_CHRATR_FONTSIZE );
1516  pCNd->SetAttr( aFontHeight );
1517  SvxFontHeightItem aFontHeightCJK( 40, 100, RES_CHRATR_CJK_FONTSIZE );
1518  pCNd->SetAttr( aFontHeightCJK );
1519  SvxFontHeightItem aFontHeightCTL( 40, 100, RES_CHRATR_CTL_FONTSIZE );
1520  pCNd->SetAttr( aFontHeightCTL );
1521  }
1522 }
1523 
1525 {
1527  return;
1528  SwDocShell *pDocSh = m_xDoc->GetDocShell();
1529  if (!pDocSh)
1530  return;
1531  uno::Reference<frame::XModel> const xModel(pDocSh->GetBaseModel());
1533  m_bNotifyMacroEventRead = true;
1534 }
1535 
1536 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 IncGrfsThatResizeTable()
Definition: htmltab.cxx:3186
OString stripEnd(const OString &rIn, char c)
sal_uInt8 GetLevel() const
Definition: htmlnum.hxx:110
virtual sal_Int32 Len() const
Definition: node.cxx:1243
static void SetSpace(const Size &rPixSpace, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFlyItemSet)
Definition: htmlplug.cxx:243
void DeleteMark()
Definition: pam.hxx:178
SvxMacro & Insert(SvMacroItemId nEvent, const SvxMacro &rMacro)
URL aURL
void SetAnchorAndAdjustment(sal_Int16 eVertOri, sal_Int16 eHoriOri, const SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFrameSet)
Definition: htmlgrin.cxx:151
const SvxColorItem & GetColor(bool=true) const
Definition: charatr.hxx:128
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
EnumT GetEnum(const HTMLOptionEnum< EnumT > *pOptEnums, EnumT nDflt=static_cast< EnumT >(0)) const
SvKeyValueIterator * GetHeaderAttributes()
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
Definition: ndarr.hxx:155
#define OOO_STRING_SVTOOLS_HTML_VA_texttop
HtmlOptionId GetToken() const
sal_uInt16 m_nMissingImgMaps
Definition: swhtml.hxx:416
static Css1ScriptFlags GetScriptFromClass(OUString &rClass, bool bSubClassOnly=true)
Definition: htmlcss1.cxx:545
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:687
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
void FinishFootEndNote()
Definition: htmlftn.cxx:193
#define OOO_STRING_SVTOOLS_HTML_VA_bottom
Marks a position in the document model.
Definition: pam.hxx:36
void InsertImage()
Definition: htmlgrin.cxx:318
void SetAttr(bool bChkEnd=true, bool bBeforeTable=false, std::deque< std::unique_ptr< HTMLAttr >> *pPostIts=nullptr)
Definition: swhtml.hxx:508
ErrCode ImportGraphic(Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat=GRFILTER_FORMAT_DONTKNOW, sal_uInt16 *pDeterminedFormat=nullptr, GraphicFilterImportFlags nImportFlags=GraphicFilterImportFlags::NONE)
#define OOO_STRING_SVTOOLS_HTML_sdendnote_anc
bool m_bFuzzing
Definition: swhtml.hxx:472
HTMLAttrs m_aSetAttrTab
Definition: swhtml.hxx:376
void setWidth(tools::Long nWidth)
const OUString & GetText() const
Definition: ndtxt.hxx:218
std::string GetValue
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
OUString m_aPathToFile
Definition: swhtml.hxx:356
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
#define OOO_STRING_SVTOOLS_HTML_VA_absmiddle
#define OOO_STRING_SVTOOLS_HTML_AL_center
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:683
void ScaleImageMap()
Scale an image-map: the image-map becomes zoomed in / out by factor between graphic-size and border-s...
Definition: ndgrf.cxx:645
SwNodeIndex nNode
Definition: pam.hxx:38
void InsertBookmark(const OUString &rName)
Definition: htmlgrin.cxx:1353
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
const OUString & GetName() const
#define MINFLY
Definition: swtypes.hxx:61
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
long Long
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
void SetTitle(const OUString &rTitle)
Definition: ndnotxt.cxx:245
#define OOO_STRING_SVTOOLS_HTML_sdfootnote_anc
void NewAttr(const std::shared_ptr< HTMLAttrTable > &rAttrTab, HTMLAttr **ppAttr, const SfxPoolItem &rItem)
Definition: swhtml.cxx:3085
Provides access to the marks of a document.
const OUString & GetString() const
Definition: doc.hxx:187
constexpr sal_uInt16 RES_FRMATR_END(133)
JumpToMarks m_eJumpTo
Definition: swhtml.hxx:424
void CutText(SwTextNode *const pDest, const SwIndex &rStart, const sal_Int32 nLen)
Definition: ndtxt.cxx:2417
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
HTMLAttrContexts m_aContexts
Definition: swhtml.hxx:379
virtual const SwPosition & GetMarkPos() const =0
sal_uInt32 m_aFontHeights[7]
Definition: swhtml.hxx:408
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1317
SvMacroItemId
#define OOO_STRING_SVTOOLS_HTML_sdfootnote_sym
const SvxMacro * GetMacro(SvMacroItemId nEvent) const
Definition: fmtatr2.cxx:257
OUString m_sBaseURL
Definition: swhtml.hxx:357
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static void PixelToTwip(tools::Long &nWidth, tools::Long &nHeight)
Definition: svxcss1.cxx:877
std::unique_ptr< ImageMaps > m_pImageMaps
all Image-Maps that have been read
Definition: swhtml.hxx:403
css::chart::ChartAxisLabelPosition ePos
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4139
void SetMacroTable(const SvxMacroTableDtor *pTable)
Set a new MacroTable or clear the current one.
Definition: fmtatr2.cxx:234
void InsertBasicDocEvent(const OUString &aEventName, const OUString &rName, ScriptType eScrType, const OUString &rScrType)
Definition: htmlbas.cxx:226
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:230
static OutputDevice * GetDefaultDevice()
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
Definition: ndtxt.cxx:3068
Graphic ImportUnloadedGraphic(SvStream &rIStream, sal_uInt64 sizeLimit=0, const Size *pSizeHint=nullptr)
constexpr tools::Long Width() const
HashMap_OWString_Interface aMap
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:173
GPOS_TILED
void SetChgTwipSize(bool b)
Definition: ndgrf.hxx:98
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
Definition: shellio.cxx:613
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
SwNodeType GetNodeType() const
Definition: node.hxx:146
bool m_bNotifyMacroEventRead
Definition: swhtml.hxx:471
SwIndex nContent
Definition: pam.hxx:39
ScriptType GetScriptType(SvKeyValueIterator *) const
void GetDefaultScriptType(ScriptType &rType, OUString &rTypeStr) const
Definition: htmlgrin.cxx:292
void SetColor(const Color &rColor)
void InsertAttrs(std::deque< std::unique_ptr< HTMLAttr >> rAttrs)
Definition: swhtml.cxx:3486
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
bool ParseStyleOptions(const OUString &rStyle, const OUString &rId, const OUString &rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
Definition: htmlcss1.cxx:1838
LineEnd GetSystemLineEnd()
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2560
void NewAnchor()
Definition: htmlgrin.cxx:1128
#define OOO_STRING_SVTOOLS_HTML_VA_top
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:152
void SetCountedInList(bool bCounted)
Definition: ndtxt.cxx:4261
constexpr tools::Long getHeight() const
constexpr TypedWhichId< SfxStringItem > RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN)
void SetMap(const ImageMap *pM)
Pointer will be copied.
Definition: atrfrm.cxx:1841
SwPaM * m_pPam
Definition: swhtml.hxx:393
static OUString StripQueryFromPath(const OUString &rBase, const OUString &rPath)
Strips query and fragment from a URL path if base URL is a file:// one.
Definition: htmlplug.cxx:333
std::vector< std::unique_ptr< SwHTMLFrameFormatListener > > m_aMoveFlyFrames
Definition: swhtml.hxx:380
void InsertBodyOptions()
Definition: htmlgrin.cxx:899
sal_uInt16 GetProp() const
Specific frame formats (frames, DrawObjects).
void InsertAttr(const SfxPoolItem &rItem, bool bInsAtStart)
Definition: swhtml.cxx:3477
const OUString & GetName() const
Definition: fmtinfmt.hxx:80
virtual void repositionMark(::sw::mark::IMark *io_pMark, const SwPaM &rPaM)=0
Moves an existing mark to a new selection and performs needed updates.
OUString m_sJmpMark
Definition: swhtml.hxx:368
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
static void SetFrameFormatAttrs(SfxItemSet &rItemSet, HtmlFrameFormatFlags nFlags, SfxItemSet &rFrameItemSet)
Definition: htmlcss1.cxx:2061
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:502
void InsertFootEndNote(const OUString &rName, bool bEndNote, bool bFixed)
Definition: htmlftn.cxx:178
bool empty() const
Style of a layout element.
Definition: frmfmt.hxx:59
void EndTag(HtmlTokenId nToken)
Definition: swhtml.cxx:3619
SwNodeType
Definition: ndtyp.hxx:28
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
sal_uInt16 GetDepth() const
Definition: htmlnum.hxx:73
const Size & GetSizePixel() const
std::deque< sal_Int32 > m_aMoveFlyCnts
Definition: swhtml.hxx:381
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
Internet visited.
Definition: poolfmt.hxx:121
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:959
const SwPosition * GetPoint() const
Definition: pam.hxx:208
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
void NotifyMacroEventRead()
Definition: htmlgrin.cxx:1524
static OUString GetEventName(GlobalEventId nID)
#define OOO_STRING_SVTOOLS_HTML_VA_baseline
constexpr TypedWhichId< SvxMacroItem > RES_FRMMACRO(108)
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
bool HasCurrentParaBookmarks(bool bIgnoreStack=false) const
Definition: htmlgrin.cxx:1360
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
const Color & GetColor() const
Text body.
Definition: poolfmt.hxx:251
std::unique_ptr< SwCSS1Parser > m_pCSS1Parser
Definition: swhtml.hxx:388
SwNodeOffset GetIndex() const
Definition: node.hxx:292
SwNodeOffset GetStartParagraphIdx() const
Definition: swhtml.hxx:160
FlyAnchors.
Definition: fmtanchr.hxx:34
const SwFormatURL & GetURL(bool=true) const
Definition: fmturl.hxx:78
void EndContext(HTMLAttrContext *pContext)
Definition: htmlctxt.cxx:371
#define OOO_STRING_SVTOOLS_HTML_AL_left
SvxGraphicPosition
Internet normal.
Definition: poolfmt.hxx:120
Marks a character position inside a document model node.
Definition: index.hxx:33
float u
std::unique_ptr< HTMLAttrContext > PopContext(HtmlTokenId nToken=HtmlTokenId::NONE)
Definition: htmlcss1.cxx:2100
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
void StripTrailingPara()
Definition: htmlgrin.cxx:1408
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
#define LANGUAGE_DONTKNOW
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
bool DoPositioning(SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext)
Definition: htmlctxt.cxx:467
void EndAnchor()
Definition: htmlgrin.cxx:1336
static OUString GetAbsURL(std::u16string_view rTheBaseURIRef, OUString const &rTheRelURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Marks a node in the document model.
Definition: ndindex.hxx:30
bool m_bInFootEndNoteSymbol
Definition: swhtml.hxx:465
bool HasName() const
MapUnit GetMapUnit() const
void RegisterFlyFrame(SwFrameFormat *pFlyFrame)
Definition: htmlgrin.cxx:278
#define OOO_STRING_SVTOOLS_HTML_VA_middle
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:124
Represents the style of a text portion.
Definition: charfmt.hxx:26
void SetTwipSize(const Size &rSz)
Definition: ndgrf.cxx:632
bool IsScaleImageMap() const
Definition: ndgrf.hxx:106
Frame cannot be moved in Var-direction.
virtual Size GetTwipSize() const override
Definition: ndgrf.cxx:432
void SetMacro(SvMacroItemId nEvent, const SvxMacro &)
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
Definition: htmlgrin.cxx:83
bool HasCurrentParaFlys(bool bNoSurroundOnly=false, bool bSurroundOnly=false) const
Definition: swhtml.cxx:4548
sal_uInt32 GetNumber() const
size_t m_nContextStMin
Definition: swhtml.hxx:418
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Size GetPrefSize() const
tools::Long const nBorder
bool isUntrustedReferer(OUString const &referer)
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
const SvxMacroTableDtor & GetMacroTable() const
void ConnectImageMaps()
Definition: htmlgrin.cxx:113
void SetInvalidRule(bool bFlag)
Definition: number.cxx:957
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1566
HTMLAttrs m_aParaAttrs
Definition: swhtml.hxx:377
#define OOO_STRING_SVTOOLS_HTML_AL_right
constexpr tools::Long HTML_DFLT_IMG_HEIGHT
Definition: swhtml.hxx:65
void SetScaleImageMap(bool b)
Definition: ndgrf.hxx:107
bool CanRemoveNode(SwNodeOffset nNodeIdx) const
Definition: swhtml.cxx:612
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
#define SAL_WARN_IF(condition, area, stream)
#define OOO_STRING_SVTOOLS_HTML_sdendnote_sym
#define ERRCODE_NONE
MapMode GetPrefMapMode() const
constexpr tools::Long Height() const
unsigned char sal_uInt8
OUString GetPartBeforeLastName() const
const OUString & GetTargetFrame() const
Definition: fmtinfmt.hxx:89
void SetWidthPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:95
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
::std::vector< HTMLOption > HTMLOptions
void GetULSpaceFromContext(sal_uInt16 &rUpper, sal_uInt16 &rLower) const
Definition: htmlcss1.cxx:2181
OUString aName
void SetTextCollAttrs(HTMLAttrContext *pContext=nullptr)
Definition: swhtml.cxx:4620
sal_Int32 GetIndex() const
Definition: index.hxx:91
SwHTMLNumRuleInfo & GetNumInfo()
Definition: swhtml.hxx:558
bool IsCountedInList() const
Definition: ndtxt.cxx:4276
INetProtocol GetProtocol() const
tools::Long AdjustWidth(tools::Long n)
bool EndAttr(HTMLAttr *pAttr, bool bChkEmpty=true)
Definition: swhtml.cxx:3101
constexpr tools::Long HTML_DFLT_IMG_WIDTH
Definition: swhtml.hxx:64
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:639
SwTableNode is derived from SwStartNode.
tools::Long AdjustHeight(tools::Long n)
ImageMap * FindImageMap(std::u16string_view rURL) const
Definition: htmlgrin.cxx:96
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
std::shared_ptr< HTMLTable > m_xTable
Definition: swhtml.hxx:398
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
void GetColor(Color &) const
void setHeight(tools::Long nHeight)
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
static GraphicFilter & GetGraphicFilter()
Reference< XModel > xModel
void GetMarginsFromContextWithNumberBullet(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
Definition: htmlcss1.cxx:2165
constexpr tools::Long getWidth() const
#define OOO_STRING_SVTOOLS_HTML_VA_absbottom
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
Definition: htmlgrin.cxx:76
void SetDefaultType()
ScriptType
std::shared_ptr< HTMLAttrTable > m_xAttrTab
Definition: swhtml.hxx:378
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:476
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:154
const OUString & GetScriptTypeString(SvKeyValueIterator *) const
bool m_bInFootEndNoteAnchor
Definition: swhtml.hxx:464
bool AppendTextNode(SwHTMLAppendMode eMode=AM_NORMAL, bool bUpdateNum=true)
Definition: swhtml.cxx:2188
bool m_bCallNextToken
Definition: swhtml.hxx:444
bool Detect(bool bExtendedInfo=false)
COMPHELPER_DLLPUBLIC void notifyMacroEventRead(const css::uno::Reference< css::frame::XModel > &_rxDocument)
void PushContext(std::unique_ptr< HTMLAttrContext > &rCntxt)
Definition: swhtml.hxx:572
bool m_bChkJumpMark
Definition: swhtml.hxx:458
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
rtl::Reference< SwDoc > m_xDoc
Definition: swhtml.hxx:392
bool IsTextNode() const
Definition: node.hxx:646
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:76
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
SwNumRule * GetNumRule()
Definition: htmlnum.hxx:69
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:719
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
std::unique_ptr< SfxPoolItem > m_pItem
Definition: swhtml.hxx:139
std::unique_ptr< SvMemoryStream > getData() const
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
AnyEventRef aEvent
void SetName(const OUString &rNm)
Definition: fmtinfmt.hxx:84
const Color & GetValue() const
sal_uInt16 nPos
static bool MayBePositioned(const SvxCSS1PropertyInfo &rPropInfo, bool bAutoWidth=false)
Definition: htmlcss1.cxx:1409
static bool HasStyleOptions(std::u16string_view rStyle, std::u16string_view rId, std::u16string_view rClass, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
Definition: swhtml.hxx:1014
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
OUString m_aBulletGrfs[MAXLEVEL]
Definition: swhtml.hxx:367
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1585
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
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)
Base class of the Writer document model elements.
Definition: node.hxx:81
OUString aId
SfxMedium * GetMedium() const