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>
23 #include <vcl/svapp.hxx>
24 #include <vcl/wrkwin.hxx>
25 #include <svx/svxids.hrc>
27 #include <svl/stritem.hxx>
28 #include <svl/urihelper.hxx>
29 #include <editeng/fhgtitem.hxx>
30 #include <editeng/lrspitem.hxx>
31 #include <editeng/adjustitem.hxx>
32 #include <editeng/brushitem.hxx>
33 #include <editeng/colritem.hxx>
34 #include <editeng/boxitem.hxx>
35 #include <editeng/ulspitem.hxx>
36 #include <editeng/langitem.hxx>
38 #include <sfx2/docfile.hxx>
39 #include <sfx2/event.hxx>
40 #include <vcl/imap.hxx>
41 #include <svtools/htmltokn.h>
42 #include <svtools/htmlkywd.hxx>
43 #include <unotools/eventcfg.hxx>
44 #include <sal/log.hxx>
45 #include <osl/diagnose.h>
46 
47 #include <fmtornt.hxx>
48 #include <fmturl.hxx>
49 #include <fmtsrnd.hxx>
50 #include <fmtinfmt.hxx>
51 #include <fmtcntnt.hxx>
52 #include <fmtanchr.hxx>
53 #include <fmtfsize.hxx>
54 #include <frmatr.hxx>
55 #include <charatr.hxx>
56 #include <frmfmt.hxx>
57 #include <charfmt.hxx>
58 #include <docary.hxx>
59 #include <docsh.hxx>
60 #include <pam.hxx>
61 #include <doc.hxx>
62 #include <ndtxt.hxx>
63 #include <shellio.hxx>
64 #include <poolfmt.hxx>
65 #include <IMark.hxx>
66 #include <ndgrf.hxx>
67 #include "htmlnum.hxx"
68 #include "swcss1.hxx"
69 #include "swhtml.hxx"
70 #include <numrule.hxx>
71 #include <fmtflcnt.hxx>
72 #include <IDocumentMarkAccess.hxx>
73 
74 #include <vcl/graphicfilter.hxx>
75 #include <tools/urlobj.hxx>
76 
77 using namespace ::com::sun::star;
78 
80 {
83  { nullptr, 0 }
84 };
85 
87 {
88  { OOO_STRING_SVTOOLS_HTML_VA_top, text::VertOrientation::LINE_TOP },
89  { OOO_STRING_SVTOOLS_HTML_VA_texttop, text::VertOrientation::CHAR_TOP },
90  { OOO_STRING_SVTOOLS_HTML_VA_middle, text::VertOrientation::CENTER },
91  { OOO_STRING_SVTOOLS_HTML_AL_center, text::VertOrientation::CENTER },
92  { OOO_STRING_SVTOOLS_HTML_VA_absmiddle, text::VertOrientation::LINE_CENTER },
95  { OOO_STRING_SVTOOLS_HTML_VA_absbottom, text::VertOrientation::LINE_BOTTOM },
96  { nullptr, 0 }
97 };
98 
99 ImageMap *SwHTMLParser::FindImageMap( const OUString& rName ) const
100 {
101  OSL_ENSURE( rName[0] != '#', "FindImageMap: name begins with '#'!" );
102 
103  if (m_pImageMaps)
104  {
105  for (auto &rpIMap : *m_pImageMaps)
106  {
107  if (rName.equalsIgnoreAsciiCase(rpIMap->GetName()))
108  {
109  return rpIMap.get();
110  }
111  }
112  }
113  return nullptr;
114 }
115 
117 {
118  SwNodes& rNds = m_xDoc->GetNodes();
119  // on the first node of section #1
120  sal_uLong nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 1;
121  sal_uLong nEndIdx = rNds.GetEndOfAutotext().GetIndex();
122 
123  SwGrfNode* pGrfNd;
124  while( m_nMissingImgMaps > 0 && nIdx < nEndIdx )
125  {
126  SwNode *pNd = rNds[nIdx + 1];
127  if( nullptr != (pGrfNd = pNd->GetGrfNode()) )
128  {
129  SwFrameFormat *pFormat = pGrfNd->GetFlyFormat();
130  SwFormatURL aURL( pFormat->GetURL() );
131  const ImageMap *pIMap = aURL.GetMap();
132  if( pIMap && pIMap->GetIMapObjectCount()==0 )
133  {
134  // The (empty) image map of the node will be either
135  // replaced with found image map or deleted.
136  ImageMap *pNewIMap =
137  FindImageMap( pIMap->GetName() );
138  aURL.SetMap( pNewIMap );
139  pFormat->SetFormatAttr( aURL );
140  if( !pGrfNd->IsScaleImageMap() )
141  {
142  // meanwhile the graphic size is known or the
143  // graphic don't need scaling
144  pGrfNd->ScaleImageMap();
145  }
146  m_nMissingImgMaps--; // search a map less
147  }
148  }
149  nIdx = rNds[nIdx]->EndOfSectionIndex() + 1;
150  }
151 }
152 
153 void SwHTMLParser::SetAnchorAndAdjustment( sal_Int16 eVertOri,
154  sal_Int16 eHoriOri,
155  const SvxCSS1PropertyInfo &rCSS1PropInfo,
156  SfxItemSet& rFrameItemSet )
157 {
158  const SfxItemSet *pCntnrItemSet = nullptr;
159  auto i = m_aContexts.size();
160  while( !pCntnrItemSet && i > m_nContextStMin )
161  pCntnrItemSet = m_aContexts[--i]->GetFrameItemSet();
162 
163  if( pCntnrItemSet )
164  {
165  // If we are in a container then the anchoring of the container is used.
166  rFrameItemSet.Put( *pCntnrItemSet );
167  }
168  else if( SwCSS1Parser::MayBePositioned( rCSS1PropInfo, true ) )
169  {
170  // If the alignment can be set via CSS1 options we use them.
171  SetAnchorAndAdjustment( rCSS1PropInfo, rFrameItemSet );
172  }
173  else
174  {
175  // Otherwise the alignment is set correspondingly the normal HTML options.
176  SetAnchorAndAdjustment( eVertOri, eHoriOri, rFrameItemSet );
177  }
178 }
179 
180 void SwHTMLParser::SetAnchorAndAdjustment( sal_Int16 eVertOri,
181  sal_Int16 eHoriOri,
182  SfxItemSet& rFrameSet,
183  bool bDontAppend )
184 {
185  bool bMoveBackward = false;
186  SwFormatAnchor aAnchor( RndStdIds::FLY_AS_CHAR );
187  sal_Int16 eVertRel = text::RelOrientation::FRAME;
188 
189  if( text::HoriOrientation::NONE != eHoriOri )
190  {
191  // determine paragraph indent
192  sal_uInt16 nLeftSpace = 0, nRightSpace = 0;
193  short nIndent = 0;
194  GetMarginsFromContextWithNumBul( nLeftSpace, nRightSpace, nIndent );
195 
196  // determine horizontal alignment and wrapping
197  sal_Int16 eHoriRel;
198  css::text::WrapTextMode eSurround;
199  switch( eHoriOri )
200  {
202  eHoriRel = nLeftSpace ? text::RelOrientation::PRINT_AREA : text::RelOrientation::FRAME;
203  eSurround = css::text::WrapTextMode_RIGHT;
204  break;
206  eHoriRel = nRightSpace ? text::RelOrientation::PRINT_AREA : text::RelOrientation::FRAME;
207  eSurround = css::text::WrapTextMode_LEFT;
208  break;
209  case text::HoriOrientation::CENTER: // for tables
210  eHoriRel = text::RelOrientation::FRAME;
211  eSurround = css::text::WrapTextMode_NONE;
212  break;
213  default:
214  eHoriRel = text::RelOrientation::FRAME;
215  eSurround = css::text::WrapTextMode_PARALLEL;
216  break;
217  }
218 
219  // Create a new paragraph, if the current one has frames
220  // anchored at paragraph/at char without wrapping.
221  if( !bDontAppend && HasCurrentParaFlys( true ) )
222  {
223  // When the paragraph only contains graphics then there
224  // is no need for bottom margin. Since here also with use of
225  // styles no margin should be created, set attributes to
226  // override!
227  sal_uInt16 nUpper=0, nLower=0;
228  GetULSpaceFromContext( nUpper, nLower );
229  InsertAttr( SvxULSpaceItem( nUpper, 0, RES_UL_SPACE ), true );
230 
232 
233  if( nUpper )
234  {
235  NewAttr(m_xAttrTab, &m_xAttrTab->pULSpace, SvxULSpaceItem(0, nLower, RES_UL_SPACE));
236  m_aParaAttrs.push_back( m_xAttrTab->pULSpace );
237  EndAttr( m_xAttrTab->pULSpace, false );
238  }
239  }
240 
241  // determine vertical alignment and anchoring
242  const sal_Int32 nContent = m_pPam->GetPoint()->nContent.GetIndex();
243  if( nContent )
244  {
245  aAnchor.SetType( RndStdIds::FLY_AT_CHAR );
246  bMoveBackward = true;
247  eVertOri = text::VertOrientation::CHAR_BOTTOM;
248  eVertRel = text::RelOrientation::CHAR;
249  }
250  else
251  {
252  aAnchor.SetType( RndStdIds::FLY_AT_PARA );
253  eVertOri = text::VertOrientation::TOP;
254  eVertRel = text::RelOrientation::PRINT_AREA;
255  }
256 
257  rFrameSet.Put( SwFormatHoriOrient( 0, eHoriOri, eHoriRel) );
258 
259  rFrameSet.Put( SwFormatSurround( eSurround ) );
260  }
261  rFrameSet.Put( SwFormatVertOrient( 0, eVertOri, eVertRel) );
262 
263  if( bMoveBackward )
265 
266  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR && !m_pPam->GetNode().GetTextNode())
267  {
268  eState = SvParserState::Error;
269  return;
270  }
271 
272  aAnchor.SetAnchor( m_pPam->GetPoint() );
273 
274  if( bMoveBackward )
276 
277  rFrameSet.Put( aAnchor );
278 }
279 
281 {
282  // automatically anchored frames must be moved forward by one position
283  if( RES_DRAWFRMFMT != pFlyFormat->Which() &&
284  (RndStdIds::FLY_AT_PARA == pFlyFormat->GetAnchor().GetAnchorId()) &&
285  css::text::WrapTextMode_THROUGH == pFlyFormat->GetSurround().GetSurround() )
286  {
287  m_aMoveFlyFrames.push_back( pFlyFormat );
288  m_aMoveFlyCnts.push_back( m_pPam->GetPoint()->nContent.GetIndex() );
289  }
290 }
291 
292 /* */
293 
295  OUString& rTypeStr ) const
296 {
297  SwDocShell *pDocSh = m_xDoc->GetDocShell();
298  SvKeyValueIterator* pHeaderAttrs = pDocSh ? pDocSh->GetHeaderAttributes()
299  : nullptr;
300  rType = GetScriptType( pHeaderAttrs );
301  rTypeStr = GetScriptTypeString( pHeaderAttrs );
302 }
303 
304 namespace
305 {
306  bool allowAccessLink(const SwDoc& rDoc)
307  {
308  OUString sReferer;
309  SfxObjectShell * sh = rDoc.GetPersist();
310  if (sh != nullptr && sh->HasName())
311  {
312  sReferer = sh->GetMedium()->GetName();
313  }
314  return !SvtSecurityOptions().isUntrustedReferer(sReferer);
315  }
316 }
317 
318 /* */
319 
321 {
322  // and now analyze
323  OUString sAltNm, aId, aClass, aStyle, aMap, sHTMLGrfName;
324  OUString sGrfNm;
325  OUString aGraphicData;
326  sal_Int16 eVertOri = text::VertOrientation::TOP;
327  sal_Int16 eHoriOri = text::HoriOrientation::NONE;
328  bool bWidthProvided=false, bHeightProvided=false;
329  long nWidth=0, nHeight=0;
330  long nVSpace=0, nHSpace=0;
331 
332  sal_uInt16 nBorder = (m_xAttrTab->pINetFormat ? 1 : 0);
333  bool bIsMap = false;
334  bool bPrcWidth = false;
335  bool bPrcHeight = false;
336  OUString sWidthAsString, sHeightAsString;
337  SvxMacroItem aMacroItem(RES_FRMMACRO);
338 
339  ScriptType eDfltScriptType;
340  OUString sDfltScriptType;
341  GetDefaultScriptType( eDfltScriptType, sDfltScriptType );
342 
343  const HTMLOptions& rHTMLOptions = GetOptions();
344  for (size_t i = rHTMLOptions.size(); i; )
345  {
346  SvMacroItemId nEvent = SvMacroItemId::NONE;
347  ScriptType eScriptType2 = eDfltScriptType;
348  const HTMLOption& rOption = rHTMLOptions[--i];
349  switch( rOption.GetToken() )
350  {
351  case HtmlOptionId::ID:
352  aId = rOption.GetString();
353  break;
354  case HtmlOptionId::STYLE:
355  aStyle = rOption.GetString();
356  break;
357  case HtmlOptionId::CLASS:
358  aClass = rOption.GetString();
359  break;
360  case HtmlOptionId::SRC:
361  sGrfNm = rOption.GetString();
362  if( !InternalImgToPrivateURL(sGrfNm) )
363  sGrfNm = INetURLObject::GetAbsURL( m_sBaseURL, sGrfNm );
364  break;
365  case HtmlOptionId::DATA:
366  aGraphicData = rOption.GetString();
367  if (!InternalImgToPrivateURL(aGraphicData))
368  aGraphicData = INetURLObject::GetAbsURL(
370  break;
371  case HtmlOptionId::ALIGN:
372  eVertOri =
373  rOption.GetEnum( aHTMLImgVAlignTable,
375  eHoriOri =
376  rOption.GetEnum( aHTMLImgHAlignTable );
377  break;
378  case HtmlOptionId::WIDTH:
379  // for now only store as pixel value!
380  nWidth = rOption.GetNumber();
381  sWidthAsString = rOption.GetString();
382  bPrcWidth = (sWidthAsString.indexOf('%') != -1);
383  if( bPrcWidth && nWidth>100 )
384  nWidth = 100;
385  // width|height = "auto" means viewing app decides the size
386  // i.e. proceed as if no particular size was provided
387  bWidthProvided = (sWidthAsString != "auto");
388  break;
389  case HtmlOptionId::HEIGHT:
390  // for now only store as pixel value!
391  nHeight = rOption.GetNumber();
392  sHeightAsString = rOption.GetString();
393  bPrcHeight = (sHeightAsString.indexOf('%') != -1);
394  if( bPrcHeight && nHeight>100 )
395  nHeight = 100;
396  // the same as above w/ HtmlOptionId::WIDTH
397  bHeightProvided = (sHeightAsString != "auto");
398  break;
399  case HtmlOptionId::VSPACE:
400  nVSpace = rOption.GetNumber();
401  break;
402  case HtmlOptionId::HSPACE:
403  nHSpace = rOption.GetNumber();
404  break;
405  case HtmlOptionId::ALT:
406  sAltNm = rOption.GetString();
407  break;
408  case HtmlOptionId::BORDER:
409  nBorder = static_cast<sal_uInt16>(rOption.GetNumber());
410  break;
411  case HtmlOptionId::ISMAP:
412  bIsMap = true;
413  break;
414  case HtmlOptionId::USEMAP:
415  aMap = rOption.GetString();
416  break;
417  case HtmlOptionId::NAME:
418  sHTMLGrfName = rOption.GetString();
419  break;
420 
421  case HtmlOptionId::SDONLOAD:
422  eScriptType2 = STARBASIC;
423  [[fallthrough]];
424  case HtmlOptionId::ONLOAD:
425  nEvent = SvMacroItemId::OnImageLoadDone;
426  goto IMAGE_SETEVENT;
427 
428  case HtmlOptionId::SDONABORT:
429  eScriptType2 = STARBASIC;
430  [[fallthrough]];
431  case HtmlOptionId::ONABORT:
432  nEvent = SvMacroItemId::OnImageLoadCancel;
433  goto IMAGE_SETEVENT;
434 
435  case HtmlOptionId::SDONERROR:
436  eScriptType2 = STARBASIC;
437  [[fallthrough]];
438  case HtmlOptionId::ONERROR:
439  nEvent = SvMacroItemId::OnImageLoadError;
440  goto IMAGE_SETEVENT;
441 IMAGE_SETEVENT:
442  {
443  OUString sTmp( rOption.GetString() );
444  if( !sTmp.isEmpty() )
445  {
446  sTmp = convertLineEnd(sTmp, GetSystemLineEnd());
447  OUString sScriptType;
448  if( EXTENDED_STYPE == eScriptType2 )
449  sScriptType = sDfltScriptType;
450  aMacroItem.SetMacro( nEvent,
451  SvxMacro( sTmp, sScriptType, eScriptType2 ));
452  }
453  }
454  break;
455  default: break;
456  }
457  }
458 
459  if (sGrfNm.isEmpty() && !aGraphicData.isEmpty())
460  sGrfNm = aGraphicData;
461 
462  if( sGrfNm.isEmpty() )
463  return;
464 
465  // When we are in a ordered list and the paragraph is still empty and not
466  // numbered, it may be a graphic for a bullet list.
467  if( !m_pPam->GetPoint()->nContent.GetIndex() &&
468  GetNumInfo().GetDepth() > 0 && GetNumInfo().GetDepth() <= MAXLEVEL &&
469  !m_aBulletGrfs[GetNumInfo().GetDepth()-1].isEmpty() &&
470  m_aBulletGrfs[GetNumInfo().GetDepth()-1]==sGrfNm )
471  {
472  SwTextNode* pTextNode = m_pPam->GetNode().GetTextNode();
473 
474  if( pTextNode && ! pTextNode->IsCountedInList())
475  {
476  OSL_ENSURE( pTextNode->GetActualListLevel() == GetNumInfo().GetLevel(),
477  "Numbering level is wrong" );
478 
479  pTextNode->SetCountedInList( true );
480 
481  // It's necessary to invalidate the rule, because between the reading
482  // of LI and the graphic an EndAction could be called.
483  if( GetNumInfo().GetNumRule() )
484  GetNumInfo().GetNumRule()->SetInvalidRule( true );
485 
486  // Set the style again, so that indent of the first line is correct.
488 
489  return;
490  }
491  }
492 
493  Graphic aGraphic;
494  INetURLObject aGraphicURL( sGrfNm );
495  if( aGraphicURL.GetProtocol() == INetProtocol::Data )
496  {
497  std::unique_ptr<SvMemoryStream> const pStream(aGraphicURL.getData());
498  if (pStream)
499  {
501  aGraphic = rFilter.ImportUnloadedGraphic(*pStream);
502  sGrfNm.clear();
503 
504  if (!sGrfNm.isEmpty())
505  {
506  if (ERRCODE_NONE == rFilter.ImportGraphic(aGraphic, "", *pStream))
507  sGrfNm.clear();
508  }
509  }
510  }
511  else if (m_sBaseURL.isEmpty() || !aGraphicData.isEmpty())
512  {
513  // sBaseURL is empty if the source is clipboard
514  // aGraphicData is non-empty for <object data="..."> -> not a linked graphic.
515  if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL))
516  sGrfNm.clear();
517  }
518 
519  if (!sGrfNm.isEmpty())
520  {
521  aGraphic.SetDefaultType();
522  }
523 
524  if (!nHeight || !nWidth)
525  {
526  Size aPixelSize = aGraphic.GetSizePixel(Application::GetDefaultDevice());
527  if (!bWidthProvided)
528  nWidth = aPixelSize.Width();
529  if (!bHeightProvided)
530  nHeight = aPixelSize.Height();
531  }
532 
533  SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() );
534  SvxCSS1PropertyInfo aPropInfo;
535  if( HasStyleOptions( aStyle, aId, aClass ) )
536  ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo );
537 
538  SfxItemSet aFrameSet( m_xDoc->GetAttrPool(),
540  if( !IsNewDoc() )
541  Reader::ResetFrameFormatAttrs( aFrameSet );
542 
543  // set the border
544  long nHBorderWidth = 0, nVBorderWidth = 0;
545  if( nBorder )
546  {
547  nHBorderWidth = static_cast<long>(nBorder);
548  nVBorderWidth = static_cast<long>(nBorder);
549  SvxCSS1Parser::PixelToTwip( nVBorderWidth, nHBorderWidth );
550 
551  ::editeng::SvxBorderLine aHBorderLine( nullptr, nHBorderWidth );
552  ::editeng::SvxBorderLine aVBorderLine( nullptr, nVBorderWidth );
553 
554  if( m_xAttrTab->pINetFormat )
555  {
556  const OUString& rURL =
557  static_cast<const SwFormatINetFormat&>(m_xAttrTab->pINetFormat->GetItem()).GetValue();
558 
559  m_pCSS1Parser->SetATagStyles();
560  sal_uInt16 nPoolId = static_cast< sal_uInt16 >(m_xDoc->IsVisitedURL( rURL )
563  const SwCharFormat *pCharFormat = m_pCSS1Parser->GetCharFormatFromPool( nPoolId );
564  aHBorderLine.SetColor( pCharFormat->GetColor().GetValue() );
565  aVBorderLine.SetColor( aHBorderLine.GetColor() );
566  }
567  else
568  {
569  const SvxColorItem& rColorItem = m_xAttrTab->pFontColor ?
570  static_cast<const SvxColorItem &>(m_xAttrTab->pFontColor->GetItem()) :
571  m_xDoc->GetDefault(RES_CHRATR_COLOR);
572  aHBorderLine.SetColor( rColorItem.GetValue() );
573  aVBorderLine.SetColor( aHBorderLine.GetColor() );
574  }
575 
576  SvxBoxItem aBoxItem( RES_BOX );
577  aBoxItem.SetLine( &aHBorderLine, SvxBoxItemLine::TOP );
578  aBoxItem.SetLine( &aHBorderLine, SvxBoxItemLine::BOTTOM );
579  aBoxItem.SetLine( &aVBorderLine, SvxBoxItemLine::LEFT );
580  aBoxItem.SetLine( &aVBorderLine, SvxBoxItemLine::RIGHT );
581  aFrameSet.Put( aBoxItem );
582  }
583 
584  SetAnchorAndAdjustment( eVertOri, eHoriOri, aPropInfo, aFrameSet );
585 
586  SetSpace( Size( nHSpace, nVSpace), aItemSet, aPropInfo, aFrameSet );
587 
588  // set other CSS1 attributes
589  SetFrameFormatAttrs( aItemSet, HtmlFrameFormatFlags::Box, aFrameSet );
590 
591  Size aTwipSz( bPrcWidth ? 0 : nWidth, bPrcHeight ? 0 : nHeight );
592  if( (aTwipSz.Width() || aTwipSz.Height()) && Application::GetDefaultDevice() )
593  {
594  if (bWidthProvided || bHeightProvided || // attributes imply pixel!
595  aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
596  {
598  ->PixelToLogic( aTwipSz, MapMode( MapUnit::MapTwip ) );
599  }
600  else
601  { // some bitmaps may have a size in metric units (e.g. PNG); use that
602  assert(aGraphic.GetPrefMapMode().GetMapUnit() < MapUnit::MapPixel);
603  aTwipSz = OutputDevice::LogicToLogic(aGraphic.GetPrefSize(),
604  aGraphic.GetPrefMapMode(), MapMode(MapUnit::MapTwip));
605  }
606  }
607 
608  // convert CSS1 size to "normal" size
609  switch( aPropInfo.m_eWidthType )
610  {
611  case SVX_CSS1_LTYPE_TWIP:
612  aTwipSz.setWidth( aPropInfo.m_nWidth );
613  nWidth = 1; // != 0
614  bPrcWidth = false;
615  break;
617  aTwipSz.setWidth( 0 );
618  nWidth = aPropInfo.m_nWidth;
619  bPrcWidth = true;
620  break;
621  default:
622  ;
623  }
624  switch( aPropInfo.m_eHeightType )
625  {
626  case SVX_CSS1_LTYPE_TWIP:
627  aTwipSz.setHeight( aPropInfo.m_nHeight );
628  nHeight = 1; // != 0
629  bPrcHeight = false;
630  break;
632  aTwipSz.setHeight( 0 );
633  nHeight = aPropInfo.m_nHeight;
634  bPrcHeight = true;
635  break;
636  default:
637  ;
638  }
639 
640  Size aGrfSz( 0, 0 );
641  bool bSetTwipSize = true; // Set Twip-Size on Node?
642  bool bChangeFrameSize = false; // Change frame format later?
643  bool bRequestGrfNow = false;
644  bool bSetScaleImageMap = false;
645  sal_uInt8 nPrcWidth = 0, nPrcHeight = 0;
646 
647  // bPrcWidth / bPrcHeight means we have a percent size. If that's not the case and we have no
648  // size from nWidth / nHeight either, then inspect the image header.
649  if ((!bPrcWidth && !nWidth) && (!bPrcHeight && !nHeight) && allowAccessLink(*m_xDoc))
650  {
651  GraphicDescriptor aDescriptor(aGraphicURL);
652  if (aDescriptor.Detect(/*bExtendedInfo=*/true))
653  {
654  // Try to use size info from the image header before defaulting to
655  // HTML_DFLT_IMG_WIDTH/HEIGHT.
656  aTwipSz = Application::GetDefaultDevice()->PixelToLogic(aDescriptor.GetSizePixel(),
657  MapMode(MapUnit::MapTwip));
658  nWidth = aTwipSz.getWidth();
659  nHeight = aTwipSz.getHeight();
660  }
661  }
662 
663  if( !nWidth || !nHeight )
664  {
665  // When the graphic is in a table, it will be requested immediately,
666  // so that it is available before the table is layouted.
667  if (m_xTable && !nWidth)
668  {
669  bRequestGrfNow = true;
671  }
672 
673  // The frame size is set later
674  bChangeFrameSize = true;
675  aGrfSz = aTwipSz;
676  if( !nWidth && !nHeight )
677  {
678  aTwipSz.setWidth( HTML_DFLT_IMG_WIDTH );
679  aTwipSz.setHeight( HTML_DFLT_IMG_HEIGHT );
680  }
681  else if( nWidth )
682  {
683  // a percentage value
684  if( bPrcWidth )
685  {
686  nPrcWidth = static_cast<sal_uInt8>(nWidth);
687  nPrcHeight = 255;
688  }
689  else
690  {
691  aTwipSz.setHeight( HTML_DFLT_IMG_HEIGHT );
692  }
693  }
694  else if( nHeight )
695  {
696  if( bPrcHeight )
697  {
698  nPrcHeight = static_cast<sal_uInt8>(nHeight);
699  nPrcWidth = 255;
700  }
701  else
702  {
703  aTwipSz.setWidth( HTML_DFLT_IMG_WIDTH );
704  }
705  }
706  }
707  else
708  {
709  // Width and height were given and don't need to be set
710  bSetTwipSize = false;
711 
712  if( bPrcWidth )
713  nPrcWidth = static_cast<sal_uInt8>(nWidth);
714 
715  if( bPrcHeight )
716  nPrcHeight = static_cast<sal_uInt8>(nHeight);
717  }
718 
719  // set image map
720  aMap = comphelper::string::stripEnd(aMap, ' ');
721  if( !aMap.isEmpty() )
722  {
723  // Since we only know local image maps we just use everything
724  // after # as name
725  sal_Int32 nPos = aMap.indexOf( '#' );
726  OUString aName;
727  if ( -1 == nPos )
728  aName = aMap ;
729  else
730  aName = aMap.copy(nPos+1);
731 
732  ImageMap *pImgMap = FindImageMap( aName );
733  if( pImgMap )
734  {
735  SwFormatURL aURL; aURL.SetMap( pImgMap );// is copied
736 
737  bSetScaleImageMap = !nPrcWidth || !nPrcHeight;
738  aFrameSet.Put( aURL );
739  }
740  else
741  {
742  ImageMap aEmptyImgMap( aName );
743  SwFormatURL aURL; aURL.SetMap( &aEmptyImgMap );// is copied
744  aFrameSet.Put( aURL );
745  m_nMissingImgMaps++; // image maps are missing
746 
747  // the graphic has to scaled during SetTwipSize, if we didn't
748  // set a size on the node or the size doesn't match the graphic size.
749  bSetScaleImageMap = true;
750  }
751  }
752 
753  // observe minimum values !!
754  if( nPrcWidth )
755  {
756  OSL_ENSURE( !aTwipSz.Width(),
757  "Why is a width set if we already have percentage value?" );
758  aTwipSz.setWidth( aGrfSz.Width() ? aGrfSz.Width()
760  }
761  else
762  {
763  aTwipSz.AdjustWidth(2*nVBorderWidth );
764  if( aTwipSz.Width() < MINFLY )
765  aTwipSz.setWidth( MINFLY );
766  }
767  if( nPrcHeight )
768  {
769  OSL_ENSURE( !aTwipSz.Height(),
770  "Why is a height set if we already have percentage value?" );
771  aTwipSz.setHeight( aGrfSz.Height() ? aGrfSz.Height()
773  }
774  else
775  {
776  aTwipSz.AdjustHeight(2*nHBorderWidth );
777  if( aTwipSz.Height() < MINFLY )
778  aTwipSz.setHeight( MINFLY );
779  }
780 
781  SwFormatFrameSize aFrameSize( ATT_FIX_SIZE, aTwipSz.Width(), aTwipSz.Height() );
782  aFrameSize.SetWidthPercent( nPrcWidth );
783  aFrameSize.SetHeightPercent( nPrcHeight );
784  aFrameSet.Put( aFrameSize );
785 
786  const SwNodeType eNodeType = m_pPam->GetNode().GetNodeType();
787  if (eNodeType != SwNodeType::Text && eNodeType != SwNodeType::Table)
788  return;
789 
790  // passing empty sGrfNm here, means we don't want the graphic to be linked
791  SwFrameFormat *const pFlyFormat =
792  m_xDoc->getIDocumentContentOperations().InsertGraphic(
793  *m_pPam, sGrfNm, OUString(), &aGraphic,
794  &aFrameSet, nullptr, nullptr);
795  SwGrfNode *pGrfNd = m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx()
796  ->GetIndex()+1 ]->GetGrfNode();
797 
798  if( !sHTMLGrfName.isEmpty() )
799  {
800  pFlyFormat->SetName( sHTMLGrfName );
801 
802  // maybe jump to graphic
803  if( JumpToMarks::Graphic == m_eJumpTo && sHTMLGrfName == m_sJmpMark )
804  {
805  m_bChkJumpMark = true;
807  }
808  }
809 
810  if (pGrfNd)
811  {
812  if( !sAltNm.isEmpty() )
813  pGrfNd->SetTitle( sAltNm );
814 
815  if( bSetTwipSize )
816  pGrfNd->SetTwipSize( aGrfSz );
817 
818  pGrfNd->SetChgTwipSize( bChangeFrameSize );
819 
820  if( bSetScaleImageMap )
821  pGrfNd->SetScaleImageMap( true );
822  }
823 
824  if( m_xAttrTab->pINetFormat )
825  {
826  const SwFormatINetFormat &rINetFormat =
827  static_cast<const SwFormatINetFormat&>(m_xAttrTab->pINetFormat->GetItem());
828 
829  SwFormatURL aURL( pFlyFormat->GetURL() );
830 
831  aURL.SetURL( rINetFormat.GetValue(), bIsMap );
832  aURL.SetTargetFrameName( rINetFormat.GetTargetFrame() );
833  aURL.SetName( rINetFormat.GetName() );
834  pFlyFormat->SetFormatAttr( aURL );
835 
836  {
837  static const SvMacroItemId aEvents[] = {
838  SvMacroItemId::OnMouseOver,
839  SvMacroItemId::OnClick,
840  SvMacroItemId::OnMouseOut };
841 
842  for( SvMacroItemId id : aEvents )
843  {
844  const SvxMacro *pMacro = rINetFormat.GetMacro( id );
845  if( nullptr != pMacro )
846  aMacroItem.SetMacro( id, *pMacro );
847  }
848  }
849 
850  if ((RndStdIds::FLY_AS_CHAR == pFlyFormat->GetAnchor().GetAnchorId()) &&
851  m_xAttrTab->pINetFormat->GetSttPara() ==
852  m_pPam->GetPoint()->nNode &&
853  m_xAttrTab->pINetFormat->GetSttCnt() ==
854  m_pPam->GetPoint()->nContent.GetIndex() - 1 )
855  {
856  // the attribute was insert right before as-character anchored
857  // graphic, therefore we move it
858  m_xAttrTab->pINetFormat->SetStart( *m_pPam->GetPoint() );
859 
860  // When the attribute is also an anchor, we'll insert
861  // a bookmark before the graphic, because SwFormatURL
862  // isn't an anchor.
863  if( !rINetFormat.GetName().isEmpty() )
864  {
866  InsertBookmark( rINetFormat.GetName() );
868  }
869  }
870 
871  }
872 
873  if( !aMacroItem.GetMacroTable().empty() )
874  pFlyFormat->SetFormatAttr( aMacroItem );
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::shared_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  aINetFormat.SetMacroTable( &aMacroTable );
1308 
1309  // set the default attribute
1310  InsertAttr(&m_xAttrTab->pINetFormat, aINetFormat, xCntxt.get());
1311  }
1312  else if( !aName.isEmpty() )
1313  {
1314  InsertBookmark( aName );
1315  }
1316 
1317  if( bEnAnchor || bFootnoteAnchor )
1318  {
1319  InsertFootEndNote( aFootnoteName, bEnAnchor, bFixed );
1321  }
1322  else if( bFootnoteEnSymbol )
1323  {
1325  }
1326 
1327  // save context
1328  PushContext(xCntxt);
1329 }
1330 
1332 {
1334  {
1336  m_bInFootEndNoteAnchor = false;
1337  }
1338  else if( m_bInFootEndNoteSymbol )
1339  {
1340  m_bInFootEndNoteSymbol = false;
1341  }
1342 
1343  EndTag( HtmlTokenId::ANCHOR_OFF );
1344 }
1345 
1346 /* */
1347 
1348 void SwHTMLParser::InsertBookmark( const OUString& rName )
1349 {
1350  HTMLAttr* pTmp = new HTMLAttr( *m_pPam->GetPoint(),
1351  SfxStringItem(RES_FLTR_BOOKMARK, rName), nullptr, std::shared_ptr<HTMLAttrTable>());
1352  m_aSetAttrTab.push_back( pTmp );
1353 }
1354 
1355 bool SwHTMLParser::HasCurrentParaBookmarks( bool bIgnoreStack ) const
1356 {
1357  bool bHasMarks = false;
1358  sal_uLong nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex();
1359 
1360  // first step: are there still bookmark in the attribute-stack?
1361  // bookmarks are added to the end of the stack - thus we only have
1362  // to check the last bookmark
1363  if( !bIgnoreStack )
1364  {
1365  for( auto i = m_aSetAttrTab.size(); i; )
1366  {
1367  HTMLAttr* pAttr = m_aSetAttrTab[ --i ];
1368  if( RES_FLTR_BOOKMARK == pAttr->m_pItem->Which() )
1369  {
1370  if( pAttr->GetSttParaIdx() == nNodeIdx )
1371  bHasMarks = true;
1372  break;
1373  }
1374  }
1375  }
1376 
1377  if( !bHasMarks )
1378  {
1379  // second step: when we didn't find a bookmark, check if there is one set already
1380  IDocumentMarkAccess* const pMarkAccess = m_xDoc->getIDocumentMarkAccess();
1381  for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
1382  ppMark != pMarkAccess->getAllMarksEnd();
1383  ++ppMark)
1384  {
1385  const ::sw::mark::IMark* pBookmark = *ppMark;
1386 
1387  const sal_uLong nBookNdIdx = pBookmark->GetMarkPos().nNode.GetIndex();
1388  if( nBookNdIdx==nNodeIdx )
1389  {
1390  bHasMarks = true;
1391  break;
1392  }
1393  else if( nBookNdIdx > nNodeIdx )
1394  break;
1395  }
1396  }
1397 
1398  return bHasMarks;
1399 }
1400 
1401 /* */
1402 
1404 {
1405  bool bSetSmallFont = false;
1406 
1407  SwContentNode* pCNd = m_pPam->GetContentNode();
1408  sal_uLong nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex();
1409  if( !m_pPam->GetPoint()->nContent.GetIndex() )
1410  {
1411  if( pCNd && pCNd->StartOfSectionIndex() + 2 <
1412  pCNd->EndOfSectionIndex() && CanRemoveNode(nNodeIdx))
1413  {
1414  const SwFrameFormats& rFrameFormatTable = *m_xDoc->GetSpzFrameFormats();
1415 
1416  for( auto pFormat : rFrameFormatTable )
1417  {
1418  SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
1419  SwPosition const*const pAPos = pAnchor->GetContentAnchor();
1420  if (pAPos &&
1421  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
1422  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
1423  pAPos->nNode == nNodeIdx )
1424 
1425  return; // we can't delete the node
1426  }
1427 
1428  SetAttr( false ); // the still open attributes must be
1429  // closed before the node is deleted,
1430  // otherwise the last index is dangling
1431 
1432  if( pCNd->Len() && pCNd->IsTextNode() )
1433  {
1434  // fields were inserted into the node, now they have
1435  // to be moved
1436  SwTextNode *pPrvNd = m_xDoc->GetNodes()[nNodeIdx-1]->GetTextNode();
1437  if( pPrvNd )
1438  {
1439  SwIndex aSrc( pCNd, 0 );
1440  pCNd->GetTextNode()->CutText( pPrvNd, aSrc, pCNd->Len() );
1441  }
1442  }
1443 
1444  // now we have to move maybe existing bookmarks
1445  IDocumentMarkAccess* const pMarkAccess = m_xDoc->getIDocumentMarkAccess();
1446  for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
1447  ppMark != pMarkAccess->getAllMarksEnd();
1448  ++ppMark)
1449  {
1450  ::sw::mark::IMark* pMark = *ppMark;
1451 
1452  sal_uLong nBookNdIdx = pMark->GetMarkPos().nNode.GetIndex();
1453  if(nBookNdIdx==nNodeIdx)
1454  {
1455  SwNodeIndex nNewNdIdx(m_pPam->GetPoint()->nNode);
1456  SwContentNode* pNd = SwNodes::GoPrevious(&nNewNdIdx);
1457  if(!pNd)
1458  {
1459  OSL_ENSURE(false, "Oops, where is my predecessor node?");
1460  return;
1461  }
1462  // #i81002# - refactoring
1463  // Do not directly manipulate member of <SwBookmark>
1464  {
1465  SwPosition aNewPos(*pNd);
1466  aNewPos.nContent.Assign(pNd, pNd->Len());
1467  const SwPaM aPaM(aNewPos);
1468  pMarkAccess->repositionMark(*ppMark, aPaM);
1469  }
1470  }
1471  else if( nBookNdIdx > nNodeIdx )
1472  break;
1473  }
1474 
1475  m_pPam->GetPoint()->nContent.Assign( nullptr, 0 );
1476  m_pPam->SetMark();
1477  m_pPam->DeleteMark();
1478  m_xDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode );
1480  }
1481  else if (pCNd && pCNd->IsTextNode() && m_xTable)
1482  {
1483  // In empty cells we set a small font, so that the cell doesn't
1484  // get higher than the graphic resp. as low as possible.
1485  bSetSmallFont = true;
1486  }
1487  }
1488  else if( pCNd && pCNd->IsTextNode() && m_xTable &&
1489  pCNd->StartOfSectionIndex()+2 ==
1490  pCNd->EndOfSectionIndex() )
1491  {
1492  // When the cell contains only as-character anchored graphics/frames,
1493  // then we also set a small font.
1494  bSetSmallFont = true;
1495  SwTextNode* pTextNd = pCNd->GetTextNode();
1496 
1497  sal_Int32 nPos = m_pPam->GetPoint()->nContent.GetIndex();
1498  while( bSetSmallFont && nPos>0 )
1499  {
1500  --nPos;
1501  bSetSmallFont =
1502  (CH_TXTATR_BREAKWORD == pTextNd->GetText()[nPos]) &&
1503  (nullptr != pTextNd->GetTextAttrForCharAt( nPos, RES_TXTATR_FLYCNT ));
1504  }
1505  }
1506 
1507  if( bSetSmallFont )
1508  {
1509  // Added default to CJK and CTL
1510  SvxFontHeightItem aFontHeight( 40, 100, RES_CHRATR_FONTSIZE );
1511  pCNd->SetAttr( aFontHeight );
1512  SvxFontHeightItem aFontHeightCJK( 40, 100, RES_CHRATR_CJK_FONTSIZE );
1513  pCNd->SetAttr( aFontHeightCJK );
1514  SvxFontHeightItem aFontHeightCTL( 40, 100, RES_CHRATR_CTL_FONTSIZE );
1515  pCNd->SetAttr( aFontHeightCTL );
1516  }
1517 }
1518 
1519 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 IncGrfsThatResizeTable()
Definition: htmltab.cxx:3175
long Width() const
sal_uInt8 GetLevel() const
Definition: htmlnum.hxx:110
EXTENDED_STYPE
virtual sal_Int32 Len() const
Definition: node.cxx:1183
static void SetSpace(const Size &rPixSpace, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFlyItemSet)
Definition: htmlplug.cxx:245
void DeleteMark()
Definition: pam.hxx:177
SvxMacro & Insert(SvMacroItemId nEvent, const SvxMacro &rMacro)
void SetAnchorAndAdjustment(sal_Int16 eVertOri, sal_Int16 eHoriOri, const SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFrameSet)
Definition: htmlgrin.cxx:153
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:157
OString stripEnd(const OString &rIn, sal_Char c)
#define OOO_STRING_SVTOOLS_HTML_VA_texttop
HtmlOptionId GetToken() const
sal_uInt16 m_nMissingImgMaps
Definition: swhtml.hxx:400
static Css1ScriptFlags GetScriptFromClass(OUString &rClass, bool bSubClassOnly=true)
Definition: htmlcss1.cxx:555
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:320
void SetAttr(bool bChkEnd=true, bool bBeforeTable=false, std::deque< std::unique_ptr< HTMLAttr >> *pPostIts=nullptr)
Definition: swhtml.hxx:486
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:92
#define OOO_STRING_SVTOOLS_HTML_sdendnote_anc
HTMLAttrs m_aSetAttrTab
Definition: swhtml.hxx:360
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:76
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:673
long AdjustWidth(long n)
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:78
const OUString & GetText() const
Definition: ndtxt.hxx:211
ImageMap * FindImageMap(const OUString &rURL) const
Definition: htmlgrin.cxx:99
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:639
SwNodeIndex nNode
Definition: pam.hxx:37
void InsertBookmark(const OUString &rName)
Definition: htmlgrin.cxx:1348
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:247
#define OOO_STRING_SVTOOLS_HTML_sdfootnote_anc
void NewAttr(const std::shared_ptr< HTMLAttrTable > &rAttrTab, HTMLAttr **ppAttr, const SfxPoolItem &rItem)
Definition: swhtml.cxx:3024
#define RES_FRMATR_END
Definition: hintids.hxx:236
#define RES_FLTR_BOOKMARK
Definition: hintids.hxx:321
Provides access to the marks of a document.
const OUString & GetString() const
Definition: doc.hxx:185
JumpToMarks m_eJumpTo
Definition: swhtml.hxx:408
void CutText(SwTextNode *const pDest, const SwIndex &rStart, const sal_Int32 nLen)
Definition: ndtxt.cxx:2402
HTMLAttrContexts m_aContexts
Definition: swhtml.hxx:363
virtual const SwPosition & GetMarkPos() const =0
sal_uInt32 m_aFontHeights[7]
Definition: swhtml.hxx:392
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1290
SvMacroItemId
#define OOO_STRING_SVTOOLS_HTML_sdfootnote_sym
const SvxMacro * GetMacro(SvMacroItemId nEvent) const
Definition: fmtatr2.cxx:256
OUString m_sBaseURL
Definition: swhtml.hxx:341
#define RES_CHRATR_CJK_FONTSIZE
Definition: hintids.hxx:91
Frame cannot be moved in Var-direction.
Definition: fmtfsize.hxx:38
std::unique_ptr< ImageMaps > m_pImageMaps
all Image-Maps that have been read
Definition: swhtml.hxx:387
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:4095
void SetMacroTable(const SvxMacroTableDtor *pTable)
Set a new MacroTable or clear the current one.
Definition: fmtatr2.cxx:233
void InsertBasicDocEvent(const OUString &aEventName, const OUString &rName, ScriptType eScrType, const OUString &rScrType)
Definition: htmlbas.cxx:231
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:3058
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:43
GPOS_TILED
void SetChgTwipSize(bool b)
Definition: ndgrf.hxx:99
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
Definition: shellio.cxx:625
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
SwNodeType GetNodeType() const
Definition: node.hxx:144
#define RES_CHRATR_CTL_FONTSIZE
Definition: hintids.hxx:96
SwIndex nContent
Definition: pam.hxx:38
ScriptType GetScriptType(SvKeyValueIterator *) const
void GetDefaultScriptType(ScriptType &rType, OUString &rTypeStr) const
Definition: htmlgrin.cxx:294
void SetColor(const Color &rColor)
void InsertAttrs(std::deque< std::unique_ptr< HTMLAttr >> rAttrs)
Definition: swhtml.cxx:3425
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:1845
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
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:2464
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
void NewAnchor()
Definition: htmlgrin.cxx:1126
#define RES_UL_SPACE
Definition: hintids.hxx:197
#define OOO_STRING_SVTOOLS_HTML_VA_top
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
void SetCountedInList(bool bCounted)
Definition: ndtxt.cxx:4223
static SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
void SetMap(const ImageMap *pM)
Pointer will be copied.
Definition: atrfrm.cxx:1742
SwPaM * m_pPam
Definition: swhtml.hxx:377
bool isUntrustedReferer(OUString const &referer) 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:338
void InsertBodyOptions()
Definition: htmlgrin.cxx:894
Specific frame formats (frames, DrawObjects).
Definition: docary.hxx:201
void InsertAttr(const SfxPoolItem &rItem, bool bInsAtStart)
Definition: swhtml.cxx:3416
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:352
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:71
static bool HasStyleOptions(const OUString &rStyle, const OUString &rId, const OUString &rClass, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
Definition: swhtml.hxx:991
static void SetFrameFormatAttrs(SfxItemSet &rItemSet, HtmlFrameFormatFlags nFlags, SfxItemSet &rFrameItemSet)
Definition: htmlcss1.cxx:2068
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
std::vector< SwFrameFormat * > m_aMoveFlyFrames
Definition: swhtml.hxx:364
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:483
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:3558
SwNodeType
Definition: ndtyp.hxx:28
void GetMarginsFromContextWithNumBul(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
Definition: htmlcss1.cxx:2170
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:340
sal_uInt16 GetDepth() const
Definition: htmlnum.hxx:73
const Size & GetSizePixel() const
std::deque< sal_Int32 > m_aMoveFlyCnts
Definition: swhtml.hxx:365
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:894
const SwPosition * GetPoint() const
Definition: pam.hxx:207
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
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:1355
const Color & GetColor() const
Text body.
Definition: poolfmt.hxx:251
int i
std::unique_ptr< SwCSS1Parser > m_pCSS1Parser
Definition: swhtml.hxx:372
FlyAnchors.
Definition: fmtanchr.hxx:34
const SwFormatURL & GetURL(bool=true) const
Definition: fmturl.hxx:78
void EndContext(HTMLAttrContext *pContext)
Definition: htmlctxt.cxx:372
#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:2105
void StripTrailingPara()
Definition: htmlgrin.cxx:1403
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:468
void EndAnchor()
Definition: htmlgrin.cxx:1331
Marks a node in the document model.
Definition: ndindex.hxx:31
bool m_bInFootEndNoteSymbol
Definition: swhtml.hxx:449
bool HasName() const
MapUnit GetMapUnit() const
void RegisterFlyFrame(SwFrameFormat *pFlyFrame)
Definition: htmlgrin.cxx:280
void SetURL(const OUString &rURL, bool bServerMap)
Definition: atrfrm.cxx:1736
#define OOO_STRING_SVTOOLS_HTML_VA_middle
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:137
void SetTwipSize(const Size &rSz)
Definition: ndgrf.cxx:626
bool IsScaleImageMap() const
Definition: ndgrf.hxx:107
virtual Size GetTwipSize() const override
Definition: ndgrf.cxx:428
void SetMacro(SvMacroItemId nEvent, const SvxMacro &)
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
Definition: htmlgrin.cxx:86
bool HasCurrentParaFlys(bool bNoSurroundOnly=false, bool bSurroundOnly=false) const
Definition: swhtml.cxx:4486
sal_uInt32 GetNumber() const
size_t m_nContextStMin
Definition: swhtml.hxx:402
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:460
#define HTML_DFLT_IMG_WIDTH
Definition: swhtml.hxx:62
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:116
void SetInvalidRule(bool bFlag)
Definition: number.cxx:862
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1471
HTMLAttrs m_aParaAttrs
Definition: swhtml.hxx:361
#define OOO_STRING_SVTOOLS_HTML_AL_right
void SetScaleImageMap(bool b)
Definition: ndgrf.hxx:108
#define SAL_WARN_IF(condition, area, stream)
#define OOO_STRING_SVTOOLS_HTML_sdendnote_sym
#define RES_DRAWFRMFMT
Definition: hintids.hxx:277
#define ERRCODE_NONE
MapMode GetPrefMapMode() const
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:97
unsigned char sal_uInt8
OUString GetPartBeforeLastName() const
const OUString & GetTargetFrame() const
Definition: fmtinfmt.hxx:89
Graphic ImportUnloadedGraphic(SvStream &rIStream, sal_uInt64 sizeLimit=0, Size *pSizeHint=nullptr)
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:2186
bool CanRemoveNode(sal_uLong nNodeIdx) const
Definition: swhtml.cxx:583
void SetTextCollAttrs(HTMLAttrContext *pContext=nullptr)
Definition: swhtml.cxx:4558
sal_Int32 GetIndex() const
Definition: index.hxx:95
SwHTMLNumRuleInfo & GetNumInfo()
Definition: swhtml.hxx:536
bool IsCountedInList() const
Definition: ndtxt.cxx:4238
INetProtocol GetProtocol() const
bool EndAttr(HTMLAttr *pAttr, bool bChkEmpty=true)
Definition: swhtml.cxx:3040
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:634
SwTableNode is derived from SwStartNode.
#define RES_TXTATR_FLYCNT
Definition: hintids.hxx:151
std::shared_ptr< HTMLTable > m_xTable
Definition: swhtml.hxx:382
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
OString const aName
#define RES_BOX
Definition: hintids.hxx:211
#define HTML_DFLT_IMG_HEIGHT
Definition: swhtml.hxx:63
static GraphicFilter & GetGraphicFilter()
#define OOO_STRING_SVTOOLS_HTML_VA_absbottom
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
Definition: htmlgrin.cxx:79
void SetDefaultType()
ScriptType
std::shared_ptr< HTMLAttrTable > m_xAttrTab
Definition: swhtml.hxx:362
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:457
long getHeight() const
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:155
const OUString & GetScriptTypeString(SvKeyValueIterator *) const
bool m_bInFootEndNoteAnchor
Definition: swhtml.hxx:448
bool AppendTextNode(SwHTMLAppendMode eMode=AM_NORMAL, bool bUpdateNum=true)
Definition: swhtml.cxx:2146
bool m_bCallNextToken
Definition: swhtml.hxx:428
#define RES_FRMMACRO
Definition: hintids.hxx:213
bool Detect(bool bExtendedInfo=false)
void PushContext(std::unique_ptr< HTMLAttrContext > &rCntxt)
Definition: swhtml.hxx:550
bool m_bChkJumpMark
Definition: swhtml.hxx:442
long getWidth() const
sal_Int32 nPos
rtl::Reference< SwDoc > m_xDoc
Definition: swhtml.hxx:376
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:75
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:192
SwNumRule * GetNumRule()
Definition: htmlnum.hxx:69
STARBASIC
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:710
std::unique_ptr< SfxPoolItem > m_pItem
Definition: swhtml.hxx:137
sal_uInt32 GetSttParaIdx() const
Definition: swhtml.hxx:158
std::unique_ptr< SvMemoryStream > getData() const
void SetName(const OUString &rNm)
Definition: fmtinfmt.hxx:84
const Color & GetValue() const
static bool MayBePositioned(const SvxCSS1PropertyInfo &rPropInfo, bool bAutoWidth=false)
Definition: htmlcss1.cxx:1420
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843
static void PixelToTwip(long &nWidth, long &nHeight)
Definition: svxcss1.cxx:867
OUString m_aBulletGrfs[MAXLEVEL]
Definition: swhtml.hxx:351
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1486
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)