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