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