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