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