LibreOffice Module sw (master)  1
htmldrawreader.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 <hintids.hxx>
21 #include <vcl/svapp.hxx>
22 #include <svx/svdmodel.hxx>
23 #include <svx/svdpage.hxx>
24 #include <svx/svdobj.hxx>
25 #include <svx/svdotext.hxx>
26 #include <svx/sdtagitm.hxx>
27 #include <svx/sdtacitm.hxx>
28 #include <svx/sdtayitm.hxx>
29 #include <svx/sdtaaitm.hxx>
30 #include <svx/sdtaiitm.hxx>
31 #include <svx/sdtmfitm.hxx>
32 #include <editeng/eeitem.hxx>
33 #include <editeng/outliner.hxx>
34 #include <svx/xfillit0.hxx>
35 #include <svx/xflclit.hxx>
36 #include <editeng/colritem.hxx>
37 #include <editeng/brushitem.hxx>
38 #include <editeng/lrspitem.hxx>
39 #include <editeng/ulspitem.hxx>
40 #include <svl/itemiter.hxx>
41 #include <svl/whiter.hxx>
42 #include <svtools/htmlout.hxx>
43 #include <svtools/htmltokn.h>
44 #include <svtools/htmlkywd.hxx>
45 #include <svx/svdpool.hxx>
46 
47 #include <charatr.hxx>
48 #include <drawdoc.hxx>
49 #include <frmfmt.hxx>
50 #include <fmtanchr.hxx>
51 #include <fmtornt.hxx>
52 #include <fmtsrnd.hxx>
53 #include <ndtxt.hxx>
54 #include <doc.hxx>
56 #include <dcontact.hxx>
57 #include <poolfmt.hxx>
58 #include "swcss1.hxx"
59 #include "swhtml.hxx"
60 #include <shellio.hxx>
61 #include <rtl/strbuf.hxx>
62 
63 using namespace css;
64 
66 {
67  { OOO_STRING_SVTOOLS_HTML_BEHAV_scroll, SdrTextAniKind::Scroll },
68  { OOO_STRING_SVTOOLS_HTML_BEHAV_alternate, SdrTextAniKind::Alternate },
69  { OOO_STRING_SVTOOLS_HTML_BEHAV_slide, SdrTextAniKind::Slide },
70  { nullptr, SdrTextAniKind(0) }
71 };
72 
74 {
75  { OOO_STRING_SVTOOLS_HTML_AL_left, SdrTextAniDirection::Left },
76  { OOO_STRING_SVTOOLS_HTML_AL_right, SdrTextAniDirection::Right },
77  { nullptr, SdrTextAniDirection(0) }
78 };
79 
81  const Size& rPixSpace,
82  sal_Int16 eVertOri,
83  sal_Int16 eHoriOri,
84  SfxItemSet& rCSS1ItemSet,
85  SvxCSS1PropertyInfo& rCSS1PropInfo )
86 {
87  // always on top of text.
88  // but in invisible layer. <ConnectToLayout> will move the object
89  // to the visible layer.
90  pNewDrawObj->SetLayer( m_xDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() );
91 
92  SfxItemSet aFrameSet( m_xDoc->GetAttrPool(),
94  if( !IsNewDoc() )
95  Reader::ResetFrameFormatAttrs( aFrameSet );
96 
97  sal_uInt16 nLeftSpace = 0, nRightSpace = 0, nUpperSpace = 0, nLowerSpace = 0;
98  if( (rPixSpace.Width() || rPixSpace.Height()) && Application::GetDefaultDevice() )
99  {
100  Size aTwipSpc( rPixSpace.Width(), rPixSpace.Height() );
101  aTwipSpc =
103  MapMode(MapUnit::MapTwip) );
104  nLeftSpace = nRightSpace = static_cast<sal_uInt16>(aTwipSpc.Width());
105  nUpperSpace = nLowerSpace = static_cast<sal_uInt16>(aTwipSpc.Height());
106  }
107 
108  // set left/right border
109  const SfxPoolItem *pItem;
110  if( SfxItemState::SET==rCSS1ItemSet.GetItemState( RES_LR_SPACE, true, &pItem ) )
111  {
112  // maybe flatten the first line indentation
113  const SvxLRSpaceItem *pLRItem = static_cast<const SvxLRSpaceItem *>(pItem);
114  SvxLRSpaceItem aLRItem( *pLRItem );
115  aLRItem.SetTextFirstLineOfst( 0 );
116  if( rCSS1PropInfo.m_bLeftMargin )
117  {
118  nLeftSpace = static_cast< sal_uInt16 >(aLRItem.GetLeft());
119  rCSS1PropInfo.m_bLeftMargin = false;
120  }
121  if( rCSS1PropInfo.m_bRightMargin )
122  {
123  nRightSpace = static_cast< sal_uInt16 >(aLRItem.GetRight());
124  rCSS1PropInfo.m_bRightMargin = false;
125  }
126  rCSS1ItemSet.ClearItem( RES_LR_SPACE );
127  }
128  if( nLeftSpace || nRightSpace )
129  {
130  SvxLRSpaceItem aLRItem( RES_LR_SPACE );
131  aLRItem.SetLeft( nLeftSpace );
132  aLRItem.SetRight( nRightSpace );
133  aFrameSet.Put( aLRItem );
134  }
135 
136  // set top/bottom border
137  if( SfxItemState::SET==rCSS1ItemSet.GetItemState( RES_UL_SPACE, true, &pItem ) )
138  {
139  // maybe flatten the first line indentation
140  const SvxULSpaceItem *pULItem = static_cast<const SvxULSpaceItem *>(pItem);
141  if( rCSS1PropInfo.m_bTopMargin )
142  {
143  nUpperSpace = pULItem->GetUpper();
144  rCSS1PropInfo.m_bTopMargin = false;
145  }
146  if( rCSS1PropInfo.m_bBottomMargin )
147  {
148  nLowerSpace = pULItem->GetLower();
149  rCSS1PropInfo.m_bBottomMargin = false;
150  }
151 
152  rCSS1ItemSet.ClearItem( RES_UL_SPACE );
153  }
154  if( nUpperSpace || nLowerSpace )
155  {
156  SvxULSpaceItem aULItem( RES_UL_SPACE );
157  aULItem.SetUpper( nUpperSpace );
158  aULItem.SetLower( nLowerSpace );
159  aFrameSet.Put( aULItem );
160  }
161 
162  SwFormatAnchor aAnchor( RndStdIds::FLY_AS_CHAR );
163  if( SVX_CSS1_POS_ABSOLUTE == rCSS1PropInfo.m_ePosition &&
164  SVX_CSS1_LTYPE_TWIP == rCSS1PropInfo.m_eLeftType &&
165  SVX_CSS1_LTYPE_TWIP == rCSS1PropInfo.m_eTopType )
166  {
167  const SwStartNode *pFlySttNd =
168  m_pPam->GetPoint()->nNode.GetNode().FindFlyStartNode();
169 
170  if( pFlySttNd )
171  {
172  aAnchor.SetType( RndStdIds::FLY_AT_FLY );
173  SwPosition aPos( *pFlySttNd );
174  aAnchor.SetAnchor( &aPos );
175  }
176  else
177  {
178  aAnchor.SetType( RndStdIds::FLY_AT_PAGE );
179  }
180  // #i26791# - direct positioning for <SwDoc::Insert(..)>
181  pNewDrawObj->SetRelativePos( Point(rCSS1PropInfo.m_nLeft + nLeftSpace,
182  rCSS1PropInfo.m_nTop + nUpperSpace) );
183  aFrameSet.Put( SwFormatSurround(css::text::WrapTextMode_THROUGH) );
184  }
185  else if( SvxAdjust::Left == rCSS1PropInfo.m_eFloat ||
186  text::HoriOrientation::LEFT == eHoriOri )
187  {
188  aAnchor.SetType( RndStdIds::FLY_AT_PARA );
189  aFrameSet.Put( SwFormatSurround(css::text::WrapTextMode_RIGHT) );
190  // #i26791# - direct positioning for <SwDoc::Insert(..)>
191  pNewDrawObj->SetRelativePos( Point(nLeftSpace, nUpperSpace) );
192  }
193  else if( text::VertOrientation::NONE != eVertOri )
194  {
195  aFrameSet.Put( SwFormatVertOrient( 0, eVertOri ) );
196  }
197 
198  if (RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId())
199  {
200  aAnchor.SetPageNum( 1 );
201  }
202  else if( RndStdIds::FLY_AT_FLY != aAnchor.GetAnchorId() )
203  {
204  aAnchor.SetAnchor( m_pPam->GetPoint() );
205  }
206  aFrameSet.Put( aAnchor );
207 
208  m_xDoc->getIDocumentContentOperations().InsertDrawObj( *m_pPam, *pNewDrawObj, aFrameSet );
209 }
210 
211 static void PutEEPoolItem( SfxItemSet &rEEItemSet,
212  const SfxPoolItem& rSwItem )
213 {
214 
215  sal_uInt16 nEEWhich = 0;
216 
217  switch( rSwItem.Which() )
218  {
219  case RES_CHRATR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
220  case RES_CHRATR_CROSSEDOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
221  case RES_CHRATR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
222  case RES_CHRATR_FONT: nEEWhich = EE_CHAR_FONTINFO; break;
223  case RES_CHRATR_CJK_FONT: nEEWhich = EE_CHAR_FONTINFO_CJK; break;
224  case RES_CHRATR_CTL_FONT: nEEWhich = EE_CHAR_FONTINFO_CTL; break;
225  case RES_CHRATR_FONTSIZE: nEEWhich = EE_CHAR_FONTHEIGHT; break;
226  case RES_CHRATR_CJK_FONTSIZE: nEEWhich = EE_CHAR_FONTHEIGHT_CJK; break;
227  case RES_CHRATR_CTL_FONTSIZE: nEEWhich = EE_CHAR_FONTHEIGHT_CTL; break;
228  case RES_CHRATR_KERNING: nEEWhich = EE_CHAR_KERNING; break;
229  case RES_CHRATR_POSTURE: nEEWhich = EE_CHAR_ITALIC; break;
230  case RES_CHRATR_CJK_POSTURE: nEEWhich = EE_CHAR_ITALIC_CJK; break;
231  case RES_CHRATR_CTL_POSTURE: nEEWhich = EE_CHAR_ITALIC_CTL; break;
232  case RES_CHRATR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE; break;
233  case RES_CHRATR_WEIGHT: nEEWhich = EE_CHAR_WEIGHT; break;
234  case RES_CHRATR_CJK_WEIGHT: nEEWhich = EE_CHAR_WEIGHT_CJK; break;
235  case RES_CHRATR_CTL_WEIGHT: nEEWhich = EE_CHAR_WEIGHT_CTL; break;
236  case RES_BACKGROUND:
238  {
239  const SvxBrushItem& rBrushItem = static_cast<const SvxBrushItem&>(rSwItem);
240  rEEItemSet.Put( XFillStyleItem(drawing::FillStyle_SOLID) );
241  rEEItemSet.Put(XFillColorItem(OUString(),
242  rBrushItem.GetColor()) );
243  }
244  break;
245  }
246 
247  if( nEEWhich )
248  rEEItemSet.Put( rSwItem.CloneSetWhich(nEEWhich) );
249 }
250 
252 {
253 
254  OSL_ENSURE( !m_pMarquee, "Marquee in Marquee???" );
255  m_aContents.clear();
256 
257  OUString aId, aStyle, aClass;
258 
259  long nWidth=0, nHeight=0;
260  bool bPrcWidth = false, bDirection = false, bBGColor = false;
261  Size aSpace( 0, 0 );
262  sal_Int16 eVertOri = text::VertOrientation::TOP;
263  sal_Int16 eHoriOri = text::HoriOrientation::NONE;
264  SdrTextAniKind eAniKind = SdrTextAniKind::Scroll;
265  SdrTextAniDirection eAniDir = SdrTextAniDirection::Left;
266  sal_uInt16 nCount = 0, nDelay = 60;
267  sal_Int16 nAmount = -6;
268  Color aBGColor;
269 
270  const HTMLOptions& rHTMLOptions = GetOptions();
271  for (const auto & rOption : rHTMLOptions)
272  {
273  switch( rOption.GetToken() )
274  {
275  case HtmlOptionId::ID:
276  aId = rOption.GetString();
277  break;
278  case HtmlOptionId::STYLE:
279  aStyle = rOption.GetString();
280  break;
281  case HtmlOptionId::CLASS:
282  aClass = rOption.GetString();
283  break;
284 
285  case HtmlOptionId::BEHAVIOR:
286  eAniKind = rOption.GetEnum( aHTMLMarqBehaviorTable, eAniKind );
287  break;
288 
289  case HtmlOptionId::BGCOLOR:
290  rOption.GetColor( aBGColor );
291  bBGColor = true;
292  break;
293 
294  case HtmlOptionId::DIRECTION:
295  eAniDir = rOption.GetEnum( aHTMLMarqDirectionTable, eAniDir );
296  bDirection = true;
297  break;
298 
299  case HtmlOptionId::LOOP:
300  if (rOption.GetString().
301  equalsIgnoreAsciiCase(OOO_STRING_SVTOOLS_HTML_LOOP_infinite))
302  {
303  nCount = 0;
304  }
305  else
306  {
307  const sal_Int32 nLoop = rOption.GetSNumber();
308  nCount = std::max<sal_Int32>(nLoop, 0);
309  }
310  break;
311 
312  case HtmlOptionId::SCROLLAMOUNT:
313  nAmount = - static_cast<sal_Int16>(rOption.GetNumber());
314  break;
315 
316  case HtmlOptionId::SCROLLDELAY:
317  nDelay = static_cast<sal_uInt16>(rOption.GetNumber());
318  break;
319 
320  case HtmlOptionId::WIDTH:
321  // first only save as pixel value!
322  nWidth = rOption.GetNumber();
323  bPrcWidth = rOption.GetString().indexOf('%') != -1;
324  if( bPrcWidth && nWidth>100 )
325  nWidth = 100;
326  break;
327 
328  case HtmlOptionId::HEIGHT:
329  // first only save as pixel value!
330  nHeight = rOption.GetNumber();
331  if( rOption.GetString().indexOf('%') != -1 )
332  nHeight = 0;
333  break;
334 
335  case HtmlOptionId::HSPACE:
336  // first only save as pixel value!
337  aSpace.setHeight( rOption.GetNumber() );
338  break;
339 
340  case HtmlOptionId::VSPACE:
341  // first only save as pixel value!
342  aSpace.setWidth( rOption.GetNumber() );
343  break;
344 
345  case HtmlOptionId::ALIGN:
346  eVertOri =
347  rOption.GetEnum( aHTMLImgVAlignTable,
349  eHoriOri =
350  rOption.GetEnum( aHTMLImgHAlignTable );
351  break;
352  default: break;
353  }
354  }
355 
356  // create a DrawTextobj
357  // #i52858# - method name changed
358  SwDrawModel* pModel = m_xDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
359  SdrPage* pPg = pModel->GetPage( 0 );
360  m_pMarquee = SdrObjFactory::MakeNewObject(
361  *pModel,
362  SdrInventor::Default,
363  OBJ_TEXT);
364 
365  if( !m_pMarquee )
366  return;
367 
368  pPg->InsertObject( m_pMarquee );
369 
370  if( !aId.isEmpty() )
371  InsertBookmark( aId );
372 
373  // (only) Alternate runs from left to right as default
374  if( SdrTextAniKind::Alternate==eAniKind && !bDirection )
375  eAniDir = SdrTextAniDirection::Right;
376 
377  // re set the attributes needed for scrolling
378  sal_uInt16 const aWhichMap[] { XATTR_FILL_FIRST, XATTR_FILL_LAST,
381  0 };
382  SfxItemSet aItemSet( pModel->GetItemPool(), aWhichMap );
383  aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
384  aItemSet.Put( makeSdrTextAutoGrowHeightItem( true ) );
385  aItemSet.Put( SdrTextAniKindItem( eAniKind ) );
386  aItemSet.Put( SdrTextAniDirectionItem( eAniDir ) );
387  aItemSet.Put( SdrTextAniCountItem( nCount ) );
388  aItemSet.Put( SdrTextAniDelayItem( nDelay ) );
389  aItemSet.Put( SdrTextAniAmountItem( nAmount ) );
390  if( SdrTextAniKind::Alternate==eAniKind )
391  {
392  // (only) Alternate starts and ends Inside as default
393  aItemSet.Put( SdrTextAniStartInsideItem(true) );
394  aItemSet.Put( SdrTextAniStopInsideItem(true) );
395  if( SdrTextAniDirection::Left==eAniDir )
397  }
398 
399  // set the default colour (from the default template), so that a meaningful
400  // colour is set at all
401  const Color& rDfltColor =
402  m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_STANDARD )
403  ->GetColor().GetValue();
404  aItemSet.Put( SvxColorItem( rDfltColor, EE_CHAR_COLOR ) );
405 
406  // set the attributes of the current paragraph style
407  sal_uInt16 nWhichIds[] =
408  {
417  0
418  };
419  SwTextNode const*const pTextNd =
420  m_pPam->GetPoint()->nNode.GetNode().GetTextNode();
421  if( pTextNd )
422  {
423  const SfxItemSet& rItemSet = pTextNd->GetAnyFormatColl().GetAttrSet();
424  const SfxPoolItem *pItem;
425  for( int i=0; nWhichIds[i]; ++i )
426  {
427  if( SfxItemState::SET == rItemSet.GetItemState( nWhichIds[i], true, &pItem ) )
428  PutEEPoolItem( aItemSet, *pItem );
429  }
430  }
431 
432  // set attribute of environment at the Draw object
433  HTMLAttr** pHTMLAttributes = reinterpret_cast<HTMLAttr**>(m_xAttrTab.get());
434  for (auto nCnt = sizeof(HTMLAttrTable) / sizeof(HTMLAttr*); nCnt--; ++pHTMLAttributes)
435  {
436  HTMLAttr *pAttr = *pHTMLAttributes;
437  if( pAttr )
438  PutEEPoolItem( aItemSet, pAttr->GetItem() );
439  }
440 
441  if( bBGColor )
442  {
443  aItemSet.Put( XFillStyleItem(drawing::FillStyle_SOLID) );
444  aItemSet.Put(XFillColorItem(OUString(), aBGColor));
445  }
446 
447  // parse styles (is here only possible for attributes, which also
448  // can be set at character object)
449  SfxItemSet aStyleItemSet( m_xDoc->GetAttrPool(),
450  m_pCSS1Parser->GetWhichMap() );
451  SvxCSS1PropertyInfo aPropInfo;
452  if( HasStyleOptions( aStyle, aId, aClass ) &&
453  ParseStyleOptions( aStyle, aId, aClass, aStyleItemSet, aPropInfo ) )
454  {
455  SfxItemIter aIter( aStyleItemSet );
456 
457  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
458  {
459  PutEEPoolItem( aItemSet, *pItem );
460  }
461  }
462 
463  // now set the size
464  Size aTwipSz( bPrcWidth ? 0 : nWidth, nHeight );
465  if( (aTwipSz.Width() || aTwipSz.Height()) && Application::GetDefaultDevice() )
466  {
468  ->PixelToLogic( aTwipSz, MapMode( MapUnit::MapTwip ) );
469  }
470 
471  if( SVX_CSS1_LTYPE_TWIP== aPropInfo.m_eWidthType )
472  {
473  aTwipSz.setWidth( aPropInfo.m_nWidth );
474  nWidth = 1; // != 0;
475  bPrcWidth = false;
476  }
477  if( SVX_CSS1_LTYPE_TWIP== aPropInfo.m_eHeightType )
478  aTwipSz.setHeight( aPropInfo.m_nHeight );
479 
480  m_bFixMarqueeWidth = false;
481  if( !nWidth || bPrcWidth )
482  {
483  if( m_xTable )
484  {
485  if( !pCurTable )
486  {
487  // The marquee is in a table, but not in a cell. Since now no
488  // reasonable mapping to a cell is possible, we adjust here the
489  // width to the content of the marquee.
490  m_bFixMarqueeWidth = true;
491  }
492  else if( !nWidth )
493  {
494  // Because we know in which cell the marquee is, we also can
495  // adjust the width. No width specification is treated as
496  // 100 percent.
497  nWidth = 100;
498  bPrcWidth = true;
499  }
500  aTwipSz.setWidth( MINLAY );
501  }
502  else
503  {
504  long nBrowseWidth = GetCurrentBrowseWidth();
505  aTwipSz.setWidth( !nWidth ? nBrowseWidth
506  : (nWidth*nBrowseWidth) / 100 );
507  }
508  }
509 
510  // The height is only minimum height
511  if( aTwipSz.Height() < MINFLY )
512  aTwipSz.setHeight( MINFLY );
513  aItemSet.Put( makeSdrTextMinFrameHeightItem( aTwipSz.Height() ) );
514 
515  m_pMarquee->SetMergedItemSetAndBroadcast(aItemSet);
516 
517  if( aTwipSz.Width() < MINFLY )
518  aTwipSz.setWidth( MINFLY );
519  m_pMarquee->SetLogicRect( tools::Rectangle( 0, 0, aTwipSz.Width(), aTwipSz.Height() ) );
520 
521  // and insert the object into the document
522  InsertDrawObject( m_pMarquee, aSpace, eVertOri, eHoriOri, aStyleItemSet,
523  aPropInfo );
524 
525  // Register the drawing object at the table. Is a little bit complicated,
526  // because it is done via the parser, although the table is known, but
527  // otherwise the table would have to be public and that also isn't pretty.
528  // The global pTable also can't be used, because the marquee can also be
529  // in a sub-table.
530  if( pCurTable && bPrcWidth)
531  RegisterDrawObjectToTable( pCurTable, m_pMarquee, static_cast<sal_uInt8>(nWidth) );
532 }
533 
535 {
536  OSL_ENSURE( m_pMarquee && OBJ_TEXT==m_pMarquee->GetObjIdentifier(),
537  "no marquee or wrong type" );
538 
539  if( m_bFixMarqueeWidth )
540  {
541  // Because there is no fixed height make the text object wider then
542  // the text, so that there is no line break.
543  const tools::Rectangle& rOldRect = m_pMarquee->GetLogicRect();
544  m_pMarquee->SetLogicRect( tools::Rectangle( rOldRect.TopLeft(),
545  Size( USHRT_MAX, 240 ) ) );
546  }
547 
548  // insert the collected text
549  static_cast<SdrTextObj*>(m_pMarquee)->SetText( m_aContents );
550  m_pMarquee->SetMergedItemSetAndBroadcast( m_pMarquee->GetMergedItemSet() );
551 
552  if( m_bFixMarqueeWidth )
553  {
554  // adjust the size to the text
555  static_cast<SdrTextObj*>(m_pMarquee)->FitFrameToTextSize();
556  }
557 
558  m_aContents.clear();
559  m_pMarquee = nullptr;
560 }
561 
563 {
564  OSL_ENSURE( m_pMarquee && OBJ_TEXT==m_pMarquee->GetObjIdentifier(),
565  "no marquee or wrong type" );
566 
567  // append the current text part to the text
568  m_aContents += aToken;
569 }
570 
572 {
573  OSL_ENSURE( OBJ_TEXT==pObj->GetObjIdentifier(),
574  "no marquee or wrong type" );
575 
576  if( OBJ_TEXT!=pObj->GetObjIdentifier() )
577  return;
578 
579  // the old size
580  const tools::Rectangle& rOldRect = pObj->GetLogicRect();
581  Size aNewSz( nWidth, rOldRect.GetSize().Height() );
582  pObj->SetLogicRect( tools::Rectangle( rOldRect.TopLeft(), aNewSz ) );
583 }
584 
585 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define OOO_STRING_SVTOOLS_HTML_LOOP_infinite
long GetLeft() const
Point TopLeft() const
long Width() const
Starts a section of nodes in the document model.
Definition: node.hxx:303
#define EE_CHAR_ESCAPEMENT
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:84
#define EE_CHAR_FONTINFO
SvxCSS1LengthType m_eLeftType
Definition: svxcss1.hxx:137
SvxCSS1LengthType m_eTopType
Definition: svxcss1.hxx:137
#define OOO_STRING_SVTOOLS_HTML_BEHAV_alternate
Marks a position in the document model.
Definition: pam.hxx:35
sal_uInt16 GetLower() const
#define EE_CHAR_ITALIC_CTL
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:77
#define EE_CHAR_ITALIC_CJK
long Height() const
#define RES_CHRATR_CJK_POSTURE
Definition: hintids.hxx:94
OBJ_TEXT
#define EE_CHAR_KERNING
#define MINFLY
Definition: swtypes.hxx:65
#define MINLAY
Definition: swtypes.hxx:66
#define RES_FRMATR_END
Definition: hintids.hxx:238
#define EE_CHAR_WEIGHT_CTL
#define RES_CHRATR_CJK_WEIGHT
Definition: hintids.hxx:95
#define RES_CHRATR_FONT
Definition: hintids.hxx:76
long SwTwips
Definition: swtypes.hxx:49
#define EE_CHAR_FONTHEIGHT_CJK
#define SDRATTR_MISC_LAST
#define RES_CHRATR_CJK_FONT
Definition: hintids.hxx:91
#define RES_CHRATR_CJK_FONTSIZE
Definition: hintids.hxx:92
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
static HTMLOptionEnum< SdrTextAniDirection > const aHTMLMarqDirectionTable[]
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
SdrTextAniKind
static OutputDevice * GetDefaultDevice()
const SfxPoolItem * NextItem()
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
Definition: shellio.cxx:608
void SetLeft(const long nL, const sal_uInt16 nProp=100)
#define XATTR_FILL_LAST
#define EE_CHAR_WEIGHT_CJK
#define RES_CHRATR_CTL_FONTSIZE
Definition: hintids.hxx:97
static void ResizeDrawObject(SdrObject *pObj, SwTwips nWidth)
#define XATTR_FILL_FIRST
#define RES_UL_SPACE
Definition: hintids.hxx:199
SfxPoolItem & GetItem()
Definition: swhtml.hxx:169
#define EE_CHAR_ITALIC
static SdrObject * MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, sal_uInt16 nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
void InsertDrawObject(SdrObject *pNewDrawObj, const Size &rSpace, sal_Int16 eVertOri, sal_Int16 eHoriOri, SfxItemSet &rCSS1ItemSet, SvxCSS1PropertyInfo &rCSS1PropInfo)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:716
#define RES_BACKGROUND
Definition: hintids.hxx:212
const Color & GetColor() const
#define RES_CHRATR_COLOR
Definition: hintids.hxx:72
virtual void SetLayer(SdrLayerID nLayer)
void SetRight(const long nR, const sal_uInt16 nProp=100)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:90
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define RES_CHRATR_CTL_FONT
Definition: hintids.hxx:96
void NewMarquee(HTMLTable *pCurTable=nullptr)
virtual sal_uInt16 GetObjIdentifier() const
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
SdrMetricItem makeSdrTextMinFrameHeightItem(long mnHeight)
#define EE_CHAR_UNDERLINE
int i
static void PutEEPoolItem(SfxItemSet &rEEItemSet, const SfxPoolItem &rSwItem)
FlyAnchors.
Definition: fmtanchr.hxx:34
#define SDRATTR_MISC_FIRST
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
#define OOO_STRING_SVTOOLS_HTML_AL_left
#define EE_CHAR_COLOR
#define RES_CHRATR_UNDERLINE
Definition: hintids.hxx:83
SvxCSS1Position m_ePosition
Definition: svxcss1.hxx:121
#define EE_CHAR_FONTHEIGHT
#define RES_CHRATR_ESCAPEMENT
Definition: hintids.hxx:75
virtual void SetLogicRect(const tools::Rectangle &rRect)
virtual void SetRelativePos(const Point &rPnt)
SvxAdjust m_eFloat
Definition: svxcss1.hxx:119
void InsertMarqueeText()
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
Size GetSize() const
HTMLOptionEnum< sal_Int16 > const aHTMLImgVAlignTable[]
Definition: htmlgrin.cxx:86
#define RES_CHRATR_KERNING
Definition: hintids.hxx:78
#define RES_LR_SPACE
Definition: hintids.hxx:198
Point PixelToLogic(const Point &rDevicePt) const
SDRTEXTHORZADJUST_RIGHT
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
#define EE_CHAR_START
#define EE_CHAR_FONTINFO_CJK
void SetTextFirstLineOfst(const short nF, const sal_uInt16 nProp=100)
#define OOO_STRING_SVTOOLS_HTML_AL_right
#define OOO_STRING_SVTOOLS_HTML_BEHAV_slide
#define RES_CHRATR_POSTURE
Definition: hintids.hxx:80
#define EE_CHAR_WEIGHT
#define RES_CHRATR_CTL_WEIGHT
Definition: hintids.hxx:100
#define RES_CHRATR_CTL_POSTURE
Definition: hintids.hxx:99
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
::std::vector< HTMLOption > HTMLOptions
#define EE_CHAR_FONTHEIGHT_CTL
#define OOO_STRING_SVTOOLS_HTML_BEHAV_scroll
SdrTextAniDirection
long GetRight() const
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:198
#define RES_CHRATR_CROSSEDOUT
Definition: hintids.hxx:74
const SfxItemPool & GetItemPool() const
HTMLOptionEnum< sal_Int16 > const aHTMLImgHAlignTable[]
Definition: htmlgrin.cxx:79
virtual const tools::Rectangle & GetLogicRect() const
#define EE_CHAR_FONTINFO_CTL
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
#define EE_CHAR_STRIKEOUT
void setWidth(long nWidth)
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:194
sal_uInt16 Which() const
static HTMLOptionEnum< SdrTextAniKind > const aHTMLMarqBehaviorTable[]
#define EE_CHAR_END
const SfxPoolItem * GetCurItem() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
sal_uInt16 GetUpper() const
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1479
void setHeight(long nHeight)