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