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