LibreOffice Module sw (master)  1
svxcss1.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 <sal/config.h>
21 
22 #include <algorithm>
23 #include <cmath>
24 #include <limits>
25 #include <memory>
26 #include <stdlib.h>
27 
28 #include <svx/svxids.hrc>
30 #include <svtools/ctrltool.hxx>
31 #include <svl/urihelper.hxx>
32 #include <editeng/udlnitem.hxx>
33 #include <editeng/adjustitem.hxx>
34 #include <editeng/blinkitem.hxx>
36 #include <editeng/kernitem.hxx>
37 #include <editeng/lspcitem.hxx>
38 #include <editeng/fontitem.hxx>
39 #include <editeng/postitem.hxx>
40 #include <editeng/colritem.hxx>
41 #include <editeng/cmapitem.hxx>
42 #include <editeng/brushitem.hxx>
43 #include <editeng/wghtitem.hxx>
44 #include <editeng/fhgtitem.hxx>
45 #include <editeng/borderline.hxx>
46 #include <editeng/boxitem.hxx>
47 #include <editeng/ulspitem.hxx>
48 #include <editeng/lrspitem.hxx>
49 #include <editeng/langitem.hxx>
50 #include <svl/itempool.hxx>
51 #include <editeng/spltitem.hxx>
52 #include <editeng/widwitem.hxx>
53 #include <editeng/frmdiritem.hxx>
54 #include <editeng/orphitem.hxx>
55 #include <vcl/svapp.hxx>
56 #include <sal/log.hxx>
57 #include <osl/diagnose.h>
58 
59 #include "css1kywd.hxx"
60 #include "svxcss1.hxx"
61 #include "htmlnum.hxx"
62 
63 #include <utility>
64 
65 using namespace ::com::sun::star;
66 
68 typedef void (*FnParseCSS1Prop)( const CSS1Expression *pExpr,
69  SfxItemSet& rItemSet,
70  SvxCSS1PropertyInfo& rPropInfo,
71  const SvxCSS1Parser& rParser );
72 
74 {
75  { "xx-small", 0 },
76  { "x-small", 1 },
77  { "small", 2 },
78  { "medium", 3 },
79  { "large", 4 },
80  { "x-large", 5 },
81  { "xx-large", 6 },
82  { nullptr, 0 }
83 };
84 
86 {
87  { "extra-light", WEIGHT_NORMAL }, // WEIGHT_ULTRALIGHT (OBS)
88  { "light", WEIGHT_NORMAL }, // WEIGHT_LIGHT (OBSOLETE)
89  { "demi-light", WEIGHT_NORMAL }, // WEIGHT_SEMILIGHT (OBS)
90  { "medium", WEIGHT_NORMAL }, // WEIGHT_MEDIUM (OBS)
91  { "normal", WEIGHT_NORMAL }, // WEIGHT_MEDIUM
92  { "demi-bold", WEIGHT_NORMAL }, // WEIGHT_SEMIBOLD (OBS)
93  { "bold", WEIGHT_BOLD }, // WEIGHT_BOLD (OBSOLETE)
94  { "extra-bold", WEIGHT_BOLD }, // WEIGHT_ULTRABOLD (OBS)
95  { "bolder", WEIGHT_BOLD },
96  { "lighter", WEIGHT_NORMAL },
97  { nullptr, 0 }
98 };
99 
101 {
102  { "normal", ITALIC_NONE },
103  { "italic", ITALIC_NORMAL },
104  { "oblique", ITALIC_NORMAL },
105  { nullptr, 0 }
106 };
107 
109 {
110  { "normal", sal_uInt16(SvxCaseMap::NotMapped) },
111  { "small-caps", sal_uInt16(SvxCaseMap::SmallCaps) },
112  { nullptr, 0 }
113 };
114 
116 {
117  { "uppercase", sal_uInt16(SvxCaseMap::Uppercase) },
118  { "lowercase", sal_uInt16(SvxCaseMap::Lowercase) },
119  { "capitalize", sal_uInt16(SvxCaseMap::Capitalize) },
120  { nullptr, 0 }
121 };
122 
124 {
125  { "ltr", sal_uInt16(SvxFrameDirection::Horizontal_LR_TB) },
126  { "rtl", sal_uInt16(SvxFrameDirection::Horizontal_RL_TB) },
127  { "inherit", sal_uInt16(SvxFrameDirection::Environment) },
128  { nullptr, 0 }
129 };
130 
132 {
133  { "repeat", GPOS_TILED },
134  { "repeat-x", GPOS_TILED },
135  { "repeat-y", GPOS_TILED },
136  { "no-repeat", GPOS_NONE },
137  { nullptr, 0 }
138 };
139 
141 {
142  { "left", GPOS_LT },
143  { "center", GPOS_MT },
144  { "right", GPOS_RT },
145  { nullptr, 0 }
146 };
147 
149 {
150  { "top", GPOS_LT },
151  { "middle", GPOS_LM },
152  { "bottom", GPOS_LB },
153  { nullptr, 0 }
154 };
155 
157 {
158  { "left", sal_uInt16(SvxAdjust::Left) },
159  { "center", sal_uInt16(SvxAdjust::Center) },
160  { "right", sal_uInt16(SvxAdjust::Right) },
161  { "justify", sal_uInt16(SvxAdjust::Block) },
162  { nullptr, 0 }
163 };
164 
166 {
167  { "thin", 0 }, // DEF_LINE_WIDTH_0 / DEF_DOUBLE_LINE0
168  { "medium", 1 }, // DEF_LINE_WIDTH_1 / DEF_DOUBLE_LINE1
169  { "thick", 2 }, // DEF_LINE_WIDTH_2 / DEF_DOUBLE_LINE2
170  { nullptr, 0 }
171 };
172 
173 namespace {
174 
175 enum CSS1BorderStyle { CSS1_BS_NONE, CSS1_BS_SINGLE, CSS1_BS_DOUBLE, CSS1_BS_DOTTED, CSS1_BS_DASHED, CSS1_BS_GROOVE, CSS1_BS_RIDGE, CSS1_BS_INSET, CSS1_BS_OUTSET };
176 
177 }
178 
180 {
181  { "none", CSS1_BS_NONE },
182  { "dotted", CSS1_BS_DOTTED },
183  { "dashed", CSS1_BS_DASHED },
184  { "solid", CSS1_BS_SINGLE },
185  { "double", CSS1_BS_DOUBLE },
186  { "groove", CSS1_BS_GROOVE },
187  { "ridge", CSS1_BS_RIDGE },
188  { "inset", CSS1_BS_INSET },
189  { "outset", CSS1_BS_OUTSET },
190  { nullptr, 0 }
191 };
192 
194 {
195  { "left", sal_uInt16(SvxAdjust::Left) },
196  { "right", sal_uInt16(SvxAdjust::Right) },
197  { "none", sal_uInt16(SvxAdjust::End) },
198  { nullptr, 0 }
199 };
200 
202 {
203  { "absolute", SVX_CSS1_POS_ABSOLUTE },
204  { "relative", SVX_CSS1_POS_RELATIVE },
205  { "static", SVX_CSS1_POS_STATIC },
206  { nullptr, 0 }
207 };
208 
209 // Feature: PrintExt
211 {
212  { "auto", SVX_CSS1_STYPE_AUTO },
213  { "landscape", SVX_CSS1_STYPE_LANDSCAPE },
214  { "portrait", SVX_CSS1_STYPE_PORTRAIT },
215  { nullptr, 0 }
216 };
217 
219 {
220  { "auto", SVX_CSS1_PBREAK_AUTO },
221  { "always", SVX_CSS1_PBREAK_ALWAYS },
222  { "avoid", SVX_CSS1_PBREAK_AVOID },
223  { "left", SVX_CSS1_PBREAK_LEFT },
224  { "right", SVX_CSS1_PBREAK_RIGHT },
225  { nullptr, 0 }
226 };
227 
229 {
230  { "decimal", SVX_NUM_ARABIC },
231  { "lower-alpha", SVX_NUM_CHARS_LOWER_LETTER },
232  { "lower-latin", SVX_NUM_CHARS_LOWER_LETTER },
233  { "lower-roman", SVX_NUM_ROMAN_LOWER },
234  { "upper-alpha", SVX_NUM_CHARS_UPPER_LETTER },
235  { "upper-latin", SVX_NUM_CHARS_UPPER_LETTER },
236  { "upper-roman", SVX_NUM_ROMAN_UPPER },
237  { nullptr, 0 }
238 };
239 
241 {
242  { "circle", HTML_BULLETCHAR_CIRCLE },
243  { "disc", HTML_BULLETCHAR_DISC },
244  { "square", HTML_BULLETCHAR_SQUARE },
245  { nullptr, 0 }
246 };
247 
248 sal_uInt16 const aBorderWidths[] =
249 {
253 };
254 
255 #undef SBORDER_ENTRY
256 #undef DBORDER_ENTRY
257 
258 namespace {
259 
260 struct SvxCSS1ItemIds
261 {
262  sal_uInt16 nFont;
263  sal_uInt16 nFontCJK;
264  sal_uInt16 nFontCTL;
265  sal_uInt16 nPosture;
266  sal_uInt16 nPostureCJK;
267  sal_uInt16 nPostureCTL;
268  sal_uInt16 nWeight;
269  sal_uInt16 nWeightCJK;
270  sal_uInt16 nWeightCTL;
271  sal_uInt16 nFontHeight;
272  sal_uInt16 nFontHeightCJK;
273  sal_uInt16 nFontHeightCTL;
274  sal_uInt16 nUnderline;
275  sal_uInt16 nOverline;
276  sal_uInt16 nCrossedOut;
277  sal_uInt16 nColor;
278  sal_uInt16 nKerning;
279  sal_uInt16 nCaseMap;
280  sal_uInt16 nBlink;
281 
282  sal_uInt16 nLineSpacing;
283  sal_uInt16 nAdjust;
284  sal_uInt16 nWidows;
285  sal_uInt16 nOrphans;
286  sal_uInt16 nFormatSplit;
287 
288  TypedWhichId<SvxLRSpaceItem> nLRSpace{0};
289  TypedWhichId<SvxULSpaceItem> nULSpace{0};
290  sal_uInt16 nBox;
291  sal_uInt16 nBrush;
292 
293  sal_uInt16 nLanguage;
294  sal_uInt16 nLanguageCJK;
295  sal_uInt16 nLanguageCTL;
296  sal_uInt16 nDirection;
297 };
298 
299 }
300 
301 static SvxCSS1ItemIds aItemIds;
302 
304 {
306  sal_uInt16 nAbsWidth;
307  sal_uInt16 nNamedWidth;
309 
311  aColor( COL_BLACK ), nAbsWidth( USHRT_MAX ),
312  nNamedWidth( USHRT_MAX ), eStyle( CSS1_BS_NONE )
313  {}
314 
315  void SetBorderLine( SvxBoxItemLine nLine, SvxBoxItem &rBoxItem ) const;
316 };
317 
319 {
320  if( CSS1_BS_NONE==eStyle || nAbsWidth==0 ||
321  (nAbsWidth==USHRT_MAX && nNamedWidth==USHRT_MAX) )
322  {
323  rBoxItem.SetLine( nullptr, nLine );
324  return;
325  }
326 
327  ::editeng::SvxBorderLine aBorderLine( &aColor );
328 
329  // Line style double or single?
330  switch ( eStyle )
331  {
332  case CSS1_BS_SINGLE:
333  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
334  break;
335  case CSS1_BS_DOUBLE:
336  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
337  break;
338  case CSS1_BS_DOTTED:
339  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::DOTTED);
340  break;
341  case CSS1_BS_DASHED:
342  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::DASHED);
343  break;
344  case CSS1_BS_GROOVE:
345  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::ENGRAVED);
346  break;
347  case CSS1_BS_RIDGE:
348  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::EMBOSSED);
349  break;
350  case CSS1_BS_INSET:
351  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::INSET);
352  break;
353  case CSS1_BS_OUTSET:
354  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::OUTSET);
355  break;
356  default:
357  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::NONE);
358  break;
359  }
360 
361  // convert named width, if no absolute is given
362  if( nAbsWidth==USHRT_MAX )
363  aBorderLine.SetWidth( aBorderWidths[ nNamedWidth ] );
364  else
365  aBorderLine.SetWidth( nAbsWidth );
366 
367  rBoxItem.SetLine( &aBorderLine, nLine );
368 }
369 
371 {
372  Clear();
373 }
374 
376  m_aId( rProp.m_aId ),
377  m_bTopMargin( rProp.m_bTopMargin ),
378  m_bBottomMargin( rProp.m_bBottomMargin ),
379  m_bLeftMargin( rProp.m_bLeftMargin ),
380  m_bRightMargin( rProp.m_bRightMargin ),
381  m_bTextIndent( rProp.m_bTextIndent ),
382  m_bNumbering ( rProp.m_bNumbering ),
383  m_bBullet ( rProp.m_bBullet ),
384  m_eFloat( rProp.m_eFloat ),
385  m_ePosition( rProp.m_ePosition ),
386  m_nTopBorderDistance( rProp.m_nTopBorderDistance ),
387  m_nBottomBorderDistance( rProp.m_nBottomBorderDistance ),
388  m_nLeftBorderDistance( rProp.m_nLeftBorderDistance ),
389  m_nRightBorderDistance( rProp.m_nRightBorderDistance ),
390  m_nNumberingType ( rProp.m_nNumberingType ),
391  m_cBulletChar( rProp.m_cBulletChar ),
392  m_nColumnCount( rProp.m_nColumnCount ),
393  m_nLeft( rProp.m_nLeft ),
394  m_nTop( rProp.m_nTop ),
395  m_nWidth( rProp.m_nWidth ),
396  m_nHeight( rProp.m_nHeight ),
397  m_nLeftMargin( rProp.m_nLeftMargin ),
398  m_nRightMargin( rProp.m_nRightMargin ),
399  m_eLeftType( rProp.m_eLeftType ),
400  m_eTopType( rProp.m_eTopType ),
401  m_eWidthType( rProp.m_eWidthType ),
402  m_eHeightType( rProp.m_eHeightType ),
403  m_eSizeType( rProp.m_eSizeType ),
404  m_ePageBreakBefore( rProp.m_ePageBreakBefore ),
405  m_ePageBreakAfter( rProp.m_ePageBreakAfter )
406 {
407  for( size_t i=0; i<m_aBorderInfos.size(); ++i )
408  if (rProp.m_aBorderInfos[i])
409  m_aBorderInfos[i].reset( new SvxCSS1BorderInfo( *rProp.m_aBorderInfos[i] ) );
410 }
411 
413 {
414 }
415 
417 {
418  for(auto & rp : m_aBorderInfos)
419  rp.reset();
420 }
421 
423 {
424  m_aId.clear();
425  m_bTopMargin = m_bBottomMargin = false;
427  m_bNumbering = m_bBullet = false;
429  m_eFloat = SvxAdjust::End;
430 
434 
436  m_cBulletChar = ' ';
437 
438  m_nColumnCount = 0;
439 
440  m_nLeft = m_nTop = m_nWidth = m_nHeight = 0;
442 
443 // Feature: PrintExt
447 
449 }
450 
452 {
453  if( rProp.m_bTopMargin )
454  m_bTopMargin = true;
455  if( rProp.m_bBottomMargin )
456  m_bBottomMargin = true;
457 
458  if( rProp.m_bLeftMargin )
459  {
460  m_bLeftMargin = true;
462  }
463  if( rProp.m_bRightMargin )
464  {
465  m_bRightMargin = true;
467  }
468  if( rProp.m_bTextIndent )
469  m_bTextIndent = true;
470 
471  for( size_t i=0; i<m_aBorderInfos.size(); ++i )
472  {
473  if( rProp.m_aBorderInfos[i] )
474  m_aBorderInfos[i].reset( new SvxCSS1BorderInfo( *rProp.m_aBorderInfos[i] ) );
475  }
476 
485 
487 
488  if( rProp.m_eFloat != SvxAdjust::End )
489  m_eFloat = rProp.m_eFloat;
490 
491  if( rProp.m_ePosition != SVX_CSS1_POS_NONE )
492  m_ePosition = rProp.m_ePosition;
493 
494 // Feature: PrintExt
495  if( rProp.m_eSizeType != SVX_CSS1_STYPE_NONE )
496  {
497  m_eSizeType = rProp.m_eSizeType;
498  m_nWidth = rProp.m_nWidth;
499  m_nHeight = rProp.m_nHeight;
500  }
501 
504 
507 
508  if( rProp.m_eLeftType != SVX_CSS1_LTYPE_NONE )
509  {
510  m_eLeftType = rProp.m_eLeftType;
511  m_nLeft = rProp.m_nLeft;
512  }
513 
514  if( rProp.m_eTopType != SVX_CSS1_LTYPE_NONE )
515  {
516  m_eTopType = rProp.m_eTopType;
517  m_nTop = rProp.m_nTop;
518  }
519 
520  if( rProp.m_eWidthType != SVX_CSS1_LTYPE_NONE )
521  {
522  m_eWidthType = rProp.m_eWidthType;
523  m_nWidth = rProp.m_nWidth;
524  }
525 
526  if( rProp.m_eHeightType != SVX_CSS1_LTYPE_NONE )
527  {
529  m_nHeight = rProp.m_nHeight;
530  }
531 }
532 
534 {
535  sal_uInt16 nPos = 0;
536  switch( nLine )
537  {
538  case SvxBoxItemLine::TOP: nPos = 0; break;
539  case SvxBoxItemLine::BOTTOM: nPos = 1; break;
540  case SvxBoxItemLine::LEFT: nPos = 2; break;
541  case SvxBoxItemLine::RIGHT: nPos = 3; break;
542  }
543 
544  if( !m_aBorderInfos[nPos] && bCreate )
545  m_aBorderInfos[nPos].reset( new SvxCSS1BorderInfo );
546 
547  return m_aBorderInfos[nPos].get();
548 }
549 
551  sal_uInt16 nWhat )
552 {
553  SvxCSS1BorderInfo *pSrcInfo = GetBorderInfo( nSrcLine, false );
554  if( !pSrcInfo )
555  return;
556 
557  SvxCSS1BorderInfo *pDstInfo = GetBorderInfo( nDstLine );
558  if( (nWhat & SVX_CSS1_BORDERINFO_WIDTH) != 0 )
559  {
560  pDstInfo->nAbsWidth = pSrcInfo->nAbsWidth;
561  pDstInfo->nNamedWidth = pSrcInfo->nNamedWidth;
562  }
563 
564  if( (nWhat & SVX_CSS1_BORDERINFO_COLOR) != 0 )
565  pDstInfo->aColor = pSrcInfo->aColor;
566 
567  if( (nWhat & SVX_CSS1_BORDERINFO_STYLE) != 0 )
568  pDstInfo->eStyle = pSrcInfo->eStyle;
569 }
570 
571 void SvxCSS1PropertyInfo::CopyBorderInfo( sal_uInt16 nCount, sal_uInt16 nWhat )
572 {
573  if( nCount==0 )
574  {
575  CopyBorderInfo( SvxBoxItemLine::BOTTOM, SvxBoxItemLine::TOP, nWhat );
576  CopyBorderInfo( SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, nWhat );
577  }
578  if( nCount<=1 )
579  {
580  CopyBorderInfo( SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT, nWhat );
581  }
582 }
583 
585  sal_uInt16 nMinBorderDist,
586  const SvxBoxItem *pDfltItem )
587 {
592 
593  for( size_t i=0; !bChg && i<m_aBorderInfos.size(); ++i )
594  bChg = m_aBorderInfos[i]!=nullptr;
595 
596  if( !bChg )
597  return;
598 
599  std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(aItemIds.nBox));
600  if( pDfltItem )
601  aBoxItem.reset(pDfltItem->Clone());
602 
603  SvxCSS1BorderInfo *pInfo = GetBorderInfo( SvxBoxItemLine::TOP, false );
604  if( pInfo )
605  pInfo->SetBorderLine( SvxBoxItemLine::TOP, *aBoxItem );
606 
607  pInfo = GetBorderInfo( SvxBoxItemLine::BOTTOM, false );
608  if( pInfo )
609  pInfo->SetBorderLine( SvxBoxItemLine::BOTTOM, *aBoxItem );
610 
611  pInfo = GetBorderInfo( SvxBoxItemLine::LEFT, false );
612  if( pInfo )
613  pInfo->SetBorderLine( SvxBoxItemLine::LEFT, *aBoxItem );
614 
615  pInfo = GetBorderInfo( SvxBoxItemLine::RIGHT, false );
616  if( pInfo )
617  pInfo->SetBorderLine( SvxBoxItemLine::RIGHT, *aBoxItem );
618 
619  for( size_t i=0; i<m_aBorderInfos.size(); ++i )
620  {
621  SvxBoxItemLine nLine = SvxBoxItemLine::TOP;
622  sal_uInt16 nDist = 0;
623  switch( i )
624  {
625  case 0: nLine = SvxBoxItemLine::TOP;
626  nDist = m_nTopBorderDistance;
628  break;
629  case 1: nLine = SvxBoxItemLine::BOTTOM;
630  nDist = m_nBottomBorderDistance;
632  break;
633  case 2: nLine = SvxBoxItemLine::LEFT;
634  nDist = m_nLeftBorderDistance;
636  break;
637  case 3: nLine = SvxBoxItemLine::RIGHT;
638  nDist = m_nRightBorderDistance;
640  break;
641  }
642 
643  if( aBoxItem->GetLine( nLine ) )
644  {
645  if( UNSET_BORDER_DISTANCE == nDist )
646  nDist = aBoxItem->GetDistance( nLine );
647 
648  if( nDist < nMinBorderDist )
649  nDist = nMinBorderDist;
650  }
651  else
652  {
653  nDist = 0U;
654  }
655 
656  aBoxItem->SetDistance( nDist, nLine );
657  }
658 
659  rItemSet.Put( *aBoxItem );
660 
662 }
663 
665  const SvxCSS1PropertyInfo& rProp ) :
666  m_aItemSet( rItemSet ),
667  m_aPropInfo( rProp )
668 {}
669 
670 void SvxCSS1Parser::StyleParsed( const CSS1Selector * /*pSelector*/,
671  SfxItemSet& /*rItemSet*/,
672  SvxCSS1PropertyInfo& /*rPropInfo*/ )
673 {
674  // you see nothing is happening here
675 }
676 
677 void SvxCSS1Parser::SelectorParsed( std::unique_ptr<CSS1Selector> pSelector, bool bFirst )
678 {
679  if( bFirst )
680  {
681  OSL_ENSURE( m_pSheetItemSet, "Where is the Item-Set for Style-Sheets?" );
682 
683  for (const std::unique_ptr<CSS1Selector> & rpSelection : m_Selectors)
684  {
685  StyleParsed(rpSelection.get(), *m_pSheetItemSet, *m_pSheetPropInfo);
686  }
687  m_pSheetItemSet->ClearItem();
688  m_pSheetPropInfo->Clear();
689 
690  // prepare the next rule
691  m_Selectors.clear();
692  }
693 
694  m_Selectors.push_back(std::move(pSelector));
695 }
696 
697 SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, const OUString& rBaseURL,
698  sal_uInt16 const *pWhichIds, sal_uInt16 nWhichIds ) :
699  m_sBaseURL( rBaseURL ),
700  m_pItemSet(nullptr),
701  m_pPropInfo( nullptr ),
702  m_eDefaultEnc( RTL_TEXTENCODING_DONTKNOW ),
703  m_bIgnoreFontFamily( false )
704 {
705  // also initialize item IDs
706  auto initTrueWhich = [&rPool, this](sal_uInt16 rWid)
707  {
708  rWid = rPool.GetTrueWhich(rWid, false);
709  m_aWhichMap = m_aWhichMap.MergeRange(rWid, rWid);
710  return rWid;
711  };
712 
713  aItemIds.nFont = initTrueWhich( SID_ATTR_CHAR_FONT );
714  aItemIds.nFontCJK = initTrueWhich( SID_ATTR_CHAR_CJK_FONT );
715  aItemIds.nFontCTL = initTrueWhich( SID_ATTR_CHAR_CTL_FONT );
716  aItemIds.nPosture = initTrueWhich( SID_ATTR_CHAR_POSTURE );
717  aItemIds.nPostureCJK = initTrueWhich( SID_ATTR_CHAR_CJK_POSTURE );
718  aItemIds.nPostureCTL = initTrueWhich( SID_ATTR_CHAR_CTL_POSTURE );
719  aItemIds.nWeight = initTrueWhich( SID_ATTR_CHAR_WEIGHT );
720  aItemIds.nWeightCJK = initTrueWhich( SID_ATTR_CHAR_CJK_WEIGHT );
721  aItemIds.nWeightCTL = initTrueWhich( SID_ATTR_CHAR_CTL_WEIGHT );
722  aItemIds.nFontHeight = initTrueWhich( SID_ATTR_CHAR_FONTHEIGHT );
723  aItemIds.nFontHeightCJK = initTrueWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT );
724  aItemIds.nFontHeightCTL = initTrueWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT );
725  aItemIds.nUnderline = initTrueWhich( SID_ATTR_CHAR_UNDERLINE );
726  aItemIds.nOverline = initTrueWhich( SID_ATTR_CHAR_OVERLINE );
727  aItemIds.nCrossedOut = initTrueWhich( SID_ATTR_CHAR_STRIKEOUT );
728  aItemIds.nColor = initTrueWhich( SID_ATTR_CHAR_COLOR );
729  aItemIds.nKerning = initTrueWhich( SID_ATTR_CHAR_KERNING );
730  aItemIds.nCaseMap = initTrueWhich( SID_ATTR_CHAR_CASEMAP );
731  aItemIds.nBlink = initTrueWhich( SID_ATTR_FLASH );
732 
733  aItemIds.nLineSpacing = initTrueWhich( SID_ATTR_PARA_LINESPACE );
734  aItemIds.nAdjust = initTrueWhich( SID_ATTR_PARA_ADJUST );
735  aItemIds.nWidows = initTrueWhich( SID_ATTR_PARA_WIDOWS );
736  aItemIds.nOrphans = initTrueWhich( SID_ATTR_PARA_ORPHANS );
737  aItemIds.nFormatSplit = initTrueWhich( SID_ATTR_PARA_SPLIT );
738 
739  aItemIds.nLRSpace = TypedWhichId<SvxLRSpaceItem>(initTrueWhich( SID_ATTR_LRSPACE ));
740  aItemIds.nULSpace = TypedWhichId<SvxULSpaceItem>(initTrueWhich( SID_ATTR_ULSPACE ));
741  aItemIds.nBox = initTrueWhich( SID_ATTR_BORDER_OUTER );
742  aItemIds.nBrush = initTrueWhich( SID_ATTR_BRUSH );
743 
744  aItemIds.nLanguage = initTrueWhich( SID_ATTR_CHAR_LANGUAGE );
745  aItemIds.nLanguageCJK = initTrueWhich( SID_ATTR_CHAR_CJK_LANGUAGE );
746  aItemIds.nLanguageCTL = initTrueWhich( SID_ATTR_CHAR_CTL_LANGUAGE );
747  aItemIds.nDirection = initTrueWhich( SID_ATTR_FRAMEDIRECTION );
748 
749  if( pWhichIds && nWhichIds )
750  for (sal_uInt16 i = 0; i < nWhichIds; ++i)
751  m_aWhichMap = m_aWhichMap.MergeRange(pWhichIds[i], pWhichIds[i]);
752 
753  m_pSheetItemSet.reset( new SfxItemSet( rPool, m_aWhichMap ) );
755 }
756 
758 {
759  m_pSheetItemSet.reset();
760  m_pSheetPropInfo.reset();
761 }
762 
763 void SvxCSS1Parser::InsertId( const OUString& rId,
764  const SfxItemSet& rItemSet,
765  const SvxCSS1PropertyInfo& rProp )
766 {
767  InsertMapEntry( rId, rItemSet, rProp, m_Ids );
768 }
769 
770 const SvxCSS1MapEntry* SvxCSS1Parser::GetId( const OUString& rId ) const
771 {
772  CSS1Map::const_iterator itr = m_Ids.find(rId);
773  return itr == m_Ids.end() ? nullptr : itr->second.get();
774 }
775 
776 void SvxCSS1Parser::InsertClass( const OUString& rClass,
777  const SfxItemSet& rItemSet,
778  const SvxCSS1PropertyInfo& rProp )
779 {
780  InsertMapEntry( rClass, rItemSet, rProp, m_Classes );
781 }
782 
783 const SvxCSS1MapEntry* SvxCSS1Parser::GetClass( const OUString& rClass ) const
784 {
785  CSS1Map::const_iterator itr = m_Classes.find(rClass);
786  return itr == m_Classes.end() ? nullptr : itr->second.get();
787 }
788 
789 void SvxCSS1Parser::InsertPage( const OUString& rPage,
790  bool bPseudo,
791  const SfxItemSet& rItemSet,
792  const SvxCSS1PropertyInfo& rProp )
793 {
794  OUString aKey( rPage );
795  if( bPseudo )
796  aKey = ":" + aKey;
797  InsertMapEntry( aKey, rItemSet, rProp, m_Pages );
798 }
799 
800 SvxCSS1MapEntry* SvxCSS1Parser::GetPage( const OUString& rPage, bool bPseudo )
801 {
802  OUString aKey( rPage );
803  if( bPseudo )
804  aKey = ":" + aKey;
805 
806  CSS1Map::iterator itr = m_Pages.find(aKey);
807  return itr == m_Pages.end() ? nullptr : itr->second.get();
808 }
809 
810 void SvxCSS1Parser::InsertTag( const OUString& rTag,
811  const SfxItemSet& rItemSet,
812  const SvxCSS1PropertyInfo& rProp )
813 {
814  InsertMapEntry( rTag, rItemSet, rProp, m_Tags );
815 }
816 
817 SvxCSS1MapEntry* SvxCSS1Parser::GetTag( const OUString& rTag )
818 {
819  CSS1Map::iterator itr = m_Tags.find(rTag);
820  return itr == m_Tags.end() ? nullptr : itr->second.get();
821 }
822 
823 bool SvxCSS1Parser::ParseStyleSheet( const OUString& rIn )
824 {
825  m_pItemSet = m_pSheetItemSet.get();
827 
829 
830  for (const std::unique_ptr<CSS1Selector> & rpSelector : m_Selectors)
831  {
832  StyleParsed(rpSelector.get(), *m_pSheetItemSet, *m_pSheetPropInfo);
833  }
834 
835  // and clean up a little bit
836  m_Selectors.clear();
837  m_pSheetItemSet->ClearItem();
838  m_pSheetPropInfo->Clear();
839 
840  m_pItemSet = nullptr;
841  m_pPropInfo = nullptr;
842 
843  return true;
844 }
845 
846 void SvxCSS1Parser::ParseStyleOption( const OUString& rIn,
847  SfxItemSet& rItemSet,
848  SvxCSS1PropertyInfo& rPropInfo )
849 {
850  m_pItemSet = &rItemSet;
851  m_pPropInfo = &rPropInfo;
852 
854  rItemSet.ClearItem( aItemIds.nDirection );
855 
856  m_pItemSet = nullptr;
857  m_pPropInfo = nullptr;
858 }
859 
860 bool SvxCSS1Parser::GetEnum( const CSS1PropertyEnum *pPropTable,
861  const OUString &rValue, sal_uInt16& rEnum )
862 {
863  while( pPropTable->pName )
864  {
865  if( !rValue.equalsIgnoreAsciiCaseAscii( pPropTable->pName ) )
866  pPropTable++;
867  else
868  break;
869  }
870 
871  if( pPropTable->pName )
872  rEnum = pPropTable->nEnum;
873 
874  return (pPropTable->pName != nullptr);
875 }
876 
878 {
880  {
881  Size aTwipSz( rWidth, rHeight );
882  aTwipSz = Application::GetDefaultDevice()->PixelToLogic( aTwipSz,
883  MapMode(MapUnit::MapTwip) );
884 
885  rWidth = aTwipSz.Width();
886  rHeight = aTwipSz.Height();
887  }
888 }
889 
890 sal_uInt32 SvxCSS1Parser::GetFontHeight( sal_uInt16 nSize ) const
891 {
892  sal_uInt16 nHeight;
893 
894  switch( nSize )
895  {
896  case 0: nHeight = 8*20; break;
897  case 1: nHeight = 10*20; break;
898  case 2: nHeight = 11*20; break;
899  case 3: nHeight = 12*20; break;
900  case 4: nHeight = 17*20; break;
901  case 5: nHeight = 20*20; break;
902  case 6:
903  default: nHeight = 32*20; break;
904  }
905 
906  return nHeight;
907 }
908 
910 {
911  return nullptr;
912 }
913 
914 void SvxCSS1Parser::InsertMapEntry( const OUString& rKey,
915  const SfxItemSet& rItemSet,
916  const SvxCSS1PropertyInfo& rProp,
917  CSS1Map& rMap )
918 {
919  CSS1Map::iterator itr = rMap.find(rKey);
920  if (itr == rMap.end())
921  {
922  rMap.insert(std::make_pair(rKey, std::make_unique<SvxCSS1MapEntry>(rItemSet, rProp)));
923  }
924  else
925  {
926  SvxCSS1MapEntry *const p = itr->second.get();
927  MergeStyles( rItemSet, rProp,
928  p->GetItemSet(), p->GetPropertyInfo(), true );
929  }
930 }
931 
933  const SvxCSS1PropertyInfo& rSrcInfo,
934  SfxItemSet& rTargetSet,
935  SvxCSS1PropertyInfo& rTargetInfo,
936  bool bSmart )
937 {
938  if( !bSmart )
939  {
940  rTargetSet.Put( rSrcSet );
941  }
942  else
943  {
944  SvxLRSpaceItem aLRSpace( rTargetSet.Get(aItemIds.nLRSpace) );
945  SvxULSpaceItem aULSpace( rTargetSet.Get(aItemIds.nULSpace) );
946 
947  rTargetSet.Put( rSrcSet );
948 
949  if( rSrcInfo.m_bLeftMargin || rSrcInfo.m_bRightMargin ||
950  rSrcInfo.m_bTextIndent )
951  {
952  const SvxLRSpaceItem& rNewLRSpace = rSrcSet.Get( aItemIds.nLRSpace );
953 
954  if( rSrcInfo.m_bLeftMargin )
955  aLRSpace.SetLeft( rNewLRSpace.GetLeft() );
956  if( rSrcInfo.m_bRightMargin )
957  aLRSpace.SetRight( rNewLRSpace.GetRight() );
958  if( rSrcInfo.m_bTextIndent )
959  aLRSpace.SetTextFirstLineOffset( rNewLRSpace.GetTextFirstLineOffset() );
960 
961  rTargetSet.Put( aLRSpace );
962  }
963 
964  if( rSrcInfo.m_bTopMargin || rSrcInfo.m_bBottomMargin )
965  {
966  const SvxULSpaceItem& rNewULSpace = rSrcSet.Get( aItemIds.nULSpace );
967 
968  if( rSrcInfo.m_bTopMargin )
969  aULSpace.SetUpper( rNewULSpace.GetUpper() );
970  if( rSrcInfo.m_bBottomMargin )
971  aULSpace.SetLower( rNewULSpace.GetLower() );
972 
973  rTargetSet.Put( aULSpace );
974  }
975  }
976 
977  rTargetInfo.Merge( rSrcInfo );
978 }
979 
980 void SvxCSS1Parser::SetDfltEncoding( rtl_TextEncoding eEnc )
981 {
982  m_eDefaultEnc = eEnc;
983 }
984 
985 static void ParseCSS1_font_size( const CSS1Expression *pExpr,
986  SfxItemSet &rItemSet,
987  SvxCSS1PropertyInfo& /*rPropInfo*/,
988  const SvxCSS1Parser& rParser )
989 {
990  OSL_ENSURE( pExpr, "no expression" );
991 
992  sal_uLong nHeight = 0;
993  sal_uInt16 nPropHeight = 100;
994 
995  switch( pExpr->GetType() )
996  {
997  case CSS1_LENGTH:
998  nHeight = pExpr->GetULength();
999  break;
1000  case CSS1_PIXLENGTH:
1001  {
1002  double fHeight = pExpr->GetNumber();
1003  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
1004  {
1005  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
1006  tools::Long nPWidth = 0;
1007  SvxCSS1Parser::PixelToTwip(nPWidth, nPHeight);
1008  nHeight = static_cast<sal_uLong>(nPHeight);
1009  }
1010  else
1011  {
1012  SAL_WARN("sw.html", "out-of-size pxlength: " << fHeight);
1013  }
1014  }
1015  break;
1016  case CSS1_PERCENTAGE:
1017  // only for drop caps!
1018  nPropHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1019  break;
1020  case CSS1_IDENT:
1021  {
1022  sal_uInt16 nSize;
1023 
1024  if( SvxCSS1Parser::GetEnum( aFontSizeTable, pExpr->GetString(),
1025  nSize ) )
1026  {
1027  nHeight = rParser.GetFontHeight( nSize );
1028  }
1029  }
1030  break;
1031 
1032  default:
1033  ;
1034  }
1035 
1036  if( nHeight || nPropHeight!=100 )
1037  {
1038  SvxFontHeightItem aFontHeight( nHeight, nPropHeight,
1039  aItemIds.nFontHeight );
1040  rItemSet.Put( aFontHeight );
1041  aFontHeight.SetWhich( aItemIds.nFontHeightCJK );
1042  rItemSet.Put( aFontHeight );
1043  aFontHeight.SetWhich( aItemIds.nFontHeightCTL );
1044  rItemSet.Put( aFontHeight );
1045  }
1046 }
1047 
1048 static void ParseCSS1_font_family( const CSS1Expression *pExpr,
1049  SfxItemSet &rItemSet,
1050  SvxCSS1PropertyInfo& /*rPropInfo*/,
1051  const SvxCSS1Parser& rParser )
1052 {
1053  OSL_ENSURE( pExpr, "no expression" );
1054 
1055  OUStringBuffer aName;
1056  rtl_TextEncoding eEnc = rParser.GetDfltEncoding();
1057  const FontList *pFList = rParser.GetFontList();
1058  bool bFirst = true;
1059  bool bFound = false;
1060  while( pExpr && (bFirst || ','==pExpr->GetOp() || !pExpr->GetOp()) )
1061  {
1062  CSS1Token eType = pExpr->GetType();
1063  if( CSS1_IDENT==eType || CSS1_STRING==eType )
1064  {
1065  OUString aIdent( pExpr->GetString() );
1066 
1067  if( CSS1_IDENT==eType )
1068  {
1069  // Collect all following IDs and append them with a space
1070  const CSS1Expression *pNext = pExpr->GetNext();
1071  while( pNext && !pNext->GetOp() &&
1072  CSS1_IDENT==pNext->GetType() )
1073  {
1074  aIdent += " " + pNext->GetString();
1075  pExpr = pNext;
1076  pNext = pExpr->GetNext();
1077  }
1078  }
1079  if( !aIdent.isEmpty() )
1080  {
1081  if( !bFound && pFList )
1082  {
1083  sal_Handle hFont = pFList->GetFirstFontMetric( aIdent );
1084  if( nullptr != hFont )
1085  {
1086  const FontMetric& rFMetric = FontList::GetFontMetric( hFont );
1087  if( RTL_TEXTENCODING_DONTKNOW != rFMetric.GetCharSet() )
1088  {
1089  bFound = true;
1090  if( RTL_TEXTENCODING_SYMBOL == rFMetric.GetCharSet() )
1091  eEnc = RTL_TEXTENCODING_SYMBOL;
1092  }
1093  }
1094  }
1095  if( !bFirst )
1096  aName.append(";");
1097  aName.append(aIdent);
1098  }
1099  }
1100 
1101  pExpr = pExpr->GetNext();
1102  bFirst = false;
1103  }
1104 
1105  if( !aName.isEmpty() && !rParser.IsIgnoreFontFamily() )
1106  {
1107  SvxFontItem aFont( FAMILY_DONTKNOW, aName.makeStringAndClear(), OUString(), PITCH_DONTKNOW,
1108  eEnc, aItemIds.nFont );
1109  rItemSet.Put( aFont );
1110  aFont.SetWhich( aItemIds.nFontCJK );
1111  rItemSet.Put( aFont );
1112  aFont.SetWhich( aItemIds.nFontCTL );
1113  rItemSet.Put( aFont );
1114  }
1115 }
1116 
1117 static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
1118  SfxItemSet &rItemSet,
1119  SvxCSS1PropertyInfo& /*rPropInfo*/,
1120  const SvxCSS1Parser& /*rParser*/ )
1121 {
1122  OSL_ENSURE( pExpr, "no expression" );
1123 
1124  switch( pExpr->GetType() )
1125  {
1126  case CSS1_IDENT:
1127  case CSS1_STRING: // MS-IE, what else
1128  {
1129  sal_uInt16 nWeight;
1130  if( SvxCSS1Parser::GetEnum( aFontWeightTable, pExpr->GetString(),
1131  nWeight ) )
1132  {
1133  SvxWeightItem aWeight( static_cast<FontWeight>(nWeight), aItemIds.nWeight );
1134  rItemSet.Put( aWeight );
1135  aWeight.SetWhich( aItemIds.nWeightCJK );
1136  rItemSet.Put( aWeight );
1137  aWeight.SetWhich( aItemIds.nWeightCTL );
1138  rItemSet.Put( aWeight );
1139  }
1140  }
1141  break;
1142  case CSS1_NUMBER:
1143  {
1144  sal_uInt16 nWeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1145  SvxWeightItem aWeight( nWeight>400 ? WEIGHT_BOLD : WEIGHT_NORMAL,
1146  aItemIds.nWeight );
1147  rItemSet.Put( aWeight );
1148  aWeight.SetWhich( aItemIds.nWeightCJK );
1149  rItemSet.Put( aWeight );
1150  aWeight.SetWhich( aItemIds.nWeightCTL );
1151  rItemSet.Put( aWeight );
1152  }
1153  break;
1154 
1155  default:
1156  ;
1157  }
1158 }
1159 
1160 static void ParseCSS1_font_style( const CSS1Expression *pExpr,
1161  SfxItemSet &rItemSet,
1162  SvxCSS1PropertyInfo& /*rPropInfo*/,
1163  const SvxCSS1Parser& /*rParser*/ )
1164 {
1165  OSL_ENSURE( pExpr, "no expression" );
1166 
1167  bool bPosture = false;
1168  bool bCaseMap = false;
1169  FontItalic eItalic = ITALIC_NONE;
1170  SvxCaseMap eCaseMap = SvxCaseMap::NotMapped;
1171 
1172  // normal | italic || small-caps | oblique || small-caps | small-caps
1173  // (only normal, italic and oblique are valid)
1174 
1175  // the value can have two values!
1176  for( int i=0; pExpr && i<2; ++i )
1177  {
1178  // also here MS-IE parser leaves traces
1179  if( (CSS1_IDENT==pExpr->GetType() || CSS1_STRING==pExpr->GetType()) &&
1180  !pExpr->GetOp() )
1181  {
1182  const OUString& rValue = pExpr->GetString();
1183  // first check if the value is italic or 'normal'
1184  sal_uInt16 nItalic;
1185  if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nItalic ) )
1186  {
1187  eItalic = static_cast<FontItalic>(nItalic);
1188  if( !bCaseMap && ITALIC_NONE==eItalic )
1189  {
1190  // for 'normal' we must also exclude case-map
1191  eCaseMap = SvxCaseMap::NotMapped;
1192  bCaseMap = true;
1193  }
1194  bPosture = true;
1195  }
1196  else if( !bCaseMap &&
1197  rValue.equalsIgnoreAsciiCase( "small-caps" ) )
1198  {
1199  eCaseMap = SvxCaseMap::SmallCaps;
1200  bCaseMap = true;
1201  }
1202  }
1203 
1204  // fetch next expression
1205  pExpr = pExpr->GetNext();
1206  }
1207 
1208  if( bPosture )
1209  {
1210  SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
1211  rItemSet.Put( aPosture );
1212  aPosture.SetWhich( aItemIds.nPostureCJK );
1213  rItemSet.Put( aPosture );
1214  aPosture.SetWhich( aItemIds.nPostureCTL );
1215  rItemSet.Put( aPosture );
1216  }
1217 
1218  if( bCaseMap )
1219  rItemSet.Put( SvxCaseMapItem( eCaseMap, aItemIds.nCaseMap ) );
1220 }
1221 
1222 static void ParseCSS1_font_variant( const CSS1Expression *pExpr,
1223  SfxItemSet &rItemSet,
1224  SvxCSS1PropertyInfo& /*rPropInfo*/,
1225  const SvxCSS1Parser& /*rParser*/ )
1226 {
1227  assert(pExpr && "no expression");
1228 
1229  // normal | small-caps
1230  switch( pExpr->GetType() )
1231  {
1232  case CSS1_IDENT:
1233  {
1234  sal_uInt16 nCaseMap;
1235  if( SvxCSS1Parser::GetEnum( aFontVariantTable, pExpr->GetString(),
1236  nCaseMap ) )
1237  {
1238  rItemSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(nCaseMap),
1239  aItemIds.nCaseMap ) );
1240  }
1241  break;
1242  }
1243  default:
1244  break;
1245  }
1246 }
1247 
1248 static void ParseCSS1_text_transform( const CSS1Expression *pExpr,
1249  SfxItemSet &rItemSet,
1250  SvxCSS1PropertyInfo& /*rPropInfo*/,
1251  const SvxCSS1Parser& /*rParser*/ )
1252 {
1253  OSL_ENSURE( pExpr, "no expression" );
1254 
1255  // none | capitalize | uppercase | lowercase
1256 
1257  switch( pExpr->GetType() )
1258  {
1259  case CSS1_IDENT:
1260  {
1261  sal_uInt16 nCaseMap;
1262  if( SvxCSS1Parser::GetEnum( aTextTransformTable, pExpr->GetString(),
1263  nCaseMap ) )
1264  {
1265  rItemSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(nCaseMap),
1266  aItemIds.nCaseMap ) );
1267  }
1268  break;
1269  }
1270  default:
1271  break;
1272  }
1273 }
1274 
1275 static void ParseCSS1_color( const CSS1Expression *pExpr,
1276  SfxItemSet &rItemSet,
1277  SvxCSS1PropertyInfo& /*rPropInfo*/,
1278  const SvxCSS1Parser& /*rParser*/ )
1279 {
1280  OSL_ENSURE( pExpr, "no expression" );
1281 
1282  switch( pExpr->GetType() )
1283  {
1284  case CSS1_IDENT:
1285  case CSS1_RGB:
1286  case CSS1_HEXCOLOR:
1287  case CSS1_STRING: // because MS-IE
1288  {
1289  Color aColor;
1290  if( pExpr->GetColor( aColor ) )
1291  rItemSet.Put( SvxColorItem( aColor, aItemIds.nColor ) );
1292  }
1293  break;
1294  default:
1295  ;
1296  }
1297 }
1298 
1299 static void ParseCSS1_column_count( const CSS1Expression *pExpr,
1300  SfxItemSet& /*rItemSet*/,
1301  SvxCSS1PropertyInfo &rPropInfo,
1302  const SvxCSS1Parser& /*rParser*/ )
1303 {
1304  assert(pExpr && "no expression");
1305 
1306  if ( pExpr->GetType() == CSS1_NUMBER )
1307  {
1308  double columnCount = pExpr->GetNumber();
1309  if ( columnCount >= 2 )
1310  {
1311  rPropInfo.m_nColumnCount = columnCount;
1312  }
1313  }
1314 }
1315 
1316 static void ParseCSS1_direction( const CSS1Expression *pExpr,
1317  SfxItemSet &rItemSet,
1318  SvxCSS1PropertyInfo& /*rPropInfo*/,
1319  const SvxCSS1Parser& /*rParser*/ )
1320 {
1321  assert(pExpr && "no expression");
1322 
1323  sal_uInt16 nDir;
1324  switch( pExpr->GetType() )
1325  {
1326  case CSS1_IDENT:
1327  case CSS1_STRING:
1328  if( SvxCSS1Parser::GetEnum( aDirectionTable, pExpr->GetString(),
1329  nDir ) )
1330  {
1331  rItemSet.Put( SvxFrameDirectionItem(
1332  static_cast < SvxFrameDirection >( nDir ),
1333  aItemIds.nDirection ) );
1334  }
1335  break;
1336  default:
1337  ;
1338  }
1339 }
1340 
1342 {
1343  OSL_ENSURE( GPOS_LT==eHori || GPOS_MT==eHori || GPOS_RT==eHori,
1344  "vertical position not at the top" );
1345 
1346  switch( ePos )
1347  {
1348  case GPOS_LT:
1349  case GPOS_MT:
1350  case GPOS_RT:
1351  ePos = eHori;
1352  break;
1353 
1354  case GPOS_LM:
1355  case GPOS_MM:
1356  case GPOS_RM:
1357  ePos = GPOS_LT==eHori ? GPOS_LM : (GPOS_MT==eHori ? GPOS_MM : GPOS_RM);
1358  break;
1359 
1360  case GPOS_LB:
1361  case GPOS_MB:
1362  case GPOS_RB:
1363  ePos = GPOS_LT==eHori ? GPOS_LB : (GPOS_MT==eHori ? GPOS_MB : GPOS_RB);
1364  break;
1365 
1366  default:
1367  ;
1368  }
1369 }
1370 
1372 {
1373  OSL_ENSURE( GPOS_LT==eVert || GPOS_LM==eVert || GPOS_LB==eVert,
1374  "horizontal position not on the left side" );
1375 
1376  switch( ePos )
1377  {
1378  case GPOS_LT:
1379  case GPOS_LM:
1380  case GPOS_LB:
1381  ePos = eVert;
1382  break;
1383 
1384  case GPOS_MT:
1385  case GPOS_MM:
1386  case GPOS_MB:
1387  ePos = GPOS_LT==eVert ? GPOS_MT : (GPOS_LM==eVert ? GPOS_MM : GPOS_MB);
1388  break;
1389 
1390  case GPOS_RT:
1391  case GPOS_RM:
1392  case GPOS_RB:
1393  ePos = GPOS_LT==eVert ? GPOS_RT : (GPOS_LM==eVert ? GPOS_RM : GPOS_RB);
1394  break;
1395 
1396  default:
1397  ;
1398  }
1399 }
1400 
1401 static void ParseCSS1_background( const CSS1Expression *pExpr,
1402  SfxItemSet &rItemSet,
1403  SvxCSS1PropertyInfo& /*rPropInfo*/,
1404  const SvxCSS1Parser& rParser )
1405 {
1406  OSL_ENSURE( pExpr, "no expression" );
1407 
1408  Color aColor;
1409  OUString aURL;
1410 
1411  bool bColor = false, bTransparent = false;
1412  SvxGraphicPosition eRepeat = GPOS_TILED;
1414  bool bHori = false, bVert = false;
1415 
1416  while( pExpr && !pExpr->GetOp() )
1417  {
1418  switch( pExpr->GetType() )
1419  {
1420  case CSS1_URL:
1421  pExpr->GetURL( aURL );
1422  break;
1423 
1424  case CSS1_RGB:
1425  bColor = pExpr->GetColor( aColor );
1426  break;
1427 
1428  case CSS1_LENGTH:
1429  case CSS1_PIXLENGTH:
1430  {
1431  // since we don't know any absolute position, we
1432  // only distinguish between 0 and !0. Therefore pixel
1433  // can be handled like all other units.
1434 
1435  bool nonZero = std::trunc(pExpr->GetNumber()) != 0.0;
1436  if( !bHori )
1437  {
1438  ePos = nonZero ? GPOS_MM : GPOS_LT;
1439  bHori = true;
1440  }
1441  else if( !bVert )
1442  {
1443  MergeVert( ePos, (nonZero ? GPOS_LM : GPOS_LT) );
1444  bVert = true;
1445  }
1446  }
1447  break;
1448 
1449  case CSS1_PERCENTAGE:
1450  {
1451  // the percentage is converted to an enum
1452 
1453  sal_uInt16 nPerc = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1454  if( !bHori )
1455  {
1456  ePos = nPerc < 25 ? GPOS_LT
1457  : (nPerc < 75 ? GPOS_MM
1458  : GPOS_RB);
1459  }
1460  else if( !bVert )
1461  {
1462  SvxGraphicPosition eVert =
1463  nPerc < 25 ? GPOS_LT: (nPerc < 75 ? GPOS_LM
1464  : GPOS_LB);
1465  MergeVert( ePos, eVert );
1466  }
1467  }
1468  break;
1469 
1470  case CSS1_IDENT:
1471  case CSS1_HEXCOLOR:
1472  case CSS1_STRING: // because of MS-IE
1473  {
1474  sal_uInt16 nEnum;
1475  const OUString &rValue = pExpr->GetString();
1476  if( rValue.equalsIgnoreAsciiCase( "transparent" ) )
1477  {
1478  bTransparent = true;
1479  }
1480  if( SvxCSS1Parser::GetEnum( aBGRepeatTable, rValue, nEnum ) )
1481  {
1482  eRepeat = static_cast<SvxGraphicPosition>(nEnum);
1483  }
1484  else if( SvxCSS1Parser::GetEnum( aBGHoriPosTable, rValue, nEnum ) )
1485  {
1486  // <position>, horizontal
1487  MergeHori( ePos, static_cast<SvxGraphicPosition>(nEnum) );
1488  }
1489  else if( SvxCSS1Parser::GetEnum( aBGVertPosTable, rValue, nEnum ) )
1490  {
1491  // <position>, vertical
1492  MergeVert( ePos, static_cast<SvxGraphicPosition>(nEnum) );
1493  }
1494  else if( !bColor )
1495  {
1496  // <color>
1497  bColor = pExpr->GetColor( aColor );
1498  }
1499  // <scroll> we don't know
1500  }
1501  break;
1502 
1503  default:
1504  ;
1505  }
1506 
1507  pExpr = pExpr->GetNext();
1508  }
1509 
1510  // transparent beats everything
1511  if( bTransparent )
1512  {
1513  bColor = false;
1514  aURL.clear();
1515  }
1516 
1517  // repeat has priority over a position
1518  if( GPOS_NONE == eRepeat )
1519  eRepeat = ePos;
1520 
1521  if( !bTransparent && !bColor && aURL.isEmpty() )
1522  return;
1523 
1524  SvxBrushItem aBrushItem( aItemIds.nBrush );
1525 
1526  if( bTransparent )
1527  aBrushItem.SetColor( COL_TRANSPARENT);
1528  else if( bColor )
1529  aBrushItem.SetColor( aColor );
1530 
1531  if( !aURL.isEmpty() )
1532  {
1534  aBrushItem.SetGraphicPos( eRepeat );
1535  }
1536 
1537  rItemSet.Put( aBrushItem );
1538 }
1539 
1540 static void ParseCSS1_background_color( const CSS1Expression *pExpr,
1541  SfxItemSet &rItemSet,
1542  SvxCSS1PropertyInfo& /*rPropInfo*/,
1543  const SvxCSS1Parser& /*rParser*/ )
1544 {
1545  OSL_ENSURE( pExpr, "no expression" );
1546 
1547  Color aColor;
1548 
1549  bool bColor = false, bTransparent = false;
1550 
1551  switch( pExpr->GetType() )
1552  {
1553  case CSS1_RGB:
1554  bColor = pExpr->GetColor( aColor );
1555  break;
1556  case CSS1_IDENT:
1557  case CSS1_HEXCOLOR:
1558  case CSS1_STRING: // because of MS-IE
1559  if( pExpr->GetString().equalsIgnoreAsciiCase( "transparent" ) )
1560  {
1561  bTransparent = true;
1562  }
1563  else
1564  {
1565  // <color>
1566  bColor = pExpr->GetColor( aColor );
1567  }
1568  break;
1569  default:
1570  ;
1571  }
1572 
1573  if( bTransparent || bColor )
1574  {
1575  SvxBrushItem aBrushItem( aItemIds.nBrush );
1576 
1577  if( bTransparent )
1578  aBrushItem.SetColor( COL_TRANSPARENT );
1579  else if( bColor )
1580  aBrushItem.SetColor( aColor);
1581 
1582  rItemSet.Put( aBrushItem );
1583  }
1584 }
1585 
1586 static void ParseCSS1_line_height( const CSS1Expression *pExpr,
1587  SfxItemSet &rItemSet,
1588  SvxCSS1PropertyInfo& /*rPropInfo*/,
1589  const SvxCSS1Parser& )
1590 {
1591  OSL_ENSURE( pExpr, "no expression" );
1592 
1593  sal_uInt16 nHeight = 0;
1594  sal_uInt16 nPropHeight = 0;
1595 
1596  switch( pExpr->GetType() )
1597  {
1598  case CSS1_LENGTH:
1599  nHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetULength());
1600  break;
1601  case CSS1_PIXLENGTH:
1602  {
1603  double fHeight = pExpr->GetNumber();
1604  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
1605  {
1606  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
1607  tools::Long nPWidth = 0;
1608  SvxCSS1Parser::PixelToTwip(nPWidth, nPHeight);
1609  nHeight = o3tl::narrowing<sal_uInt16>(nPHeight);
1610  }
1611  }
1612  break;
1613  case CSS1_PERCENTAGE:
1614  {
1615  nPropHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1616  }
1617  break;
1618  case CSS1_NUMBER:
1619  {
1620  nPropHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber() * 100);
1621  }
1622  break;
1623  default:
1624  ;
1625  }
1626 
1627  if( nHeight )
1628  {
1629  if( nHeight < SvxCSS1Parser::GetMinFixLineSpace() )
1631  SvxLineSpacingItem aLSItem( nHeight, aItemIds.nLineSpacing );
1632  aLSItem.SetLineHeight( nHeight );
1633  // interpret <line-height> attribute as minimum line height
1634  aLSItem.SetLineSpaceRule( SvxLineSpaceRule::Min );
1635  aLSItem.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
1636  rItemSet.Put( aLSItem );
1637  }
1638  else if( nPropHeight )
1639  {
1640  SvxLineSpacingItem aLSItem( nPropHeight, aItemIds.nLineSpacing );
1641  aLSItem.SetLineSpaceRule( SvxLineSpaceRule::Auto );
1642  if( 100 == nPropHeight )
1643  aLSItem.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
1644  else
1645  aLSItem.SetPropLineSpace( nPropHeight );
1646  rItemSet.Put( aLSItem );
1647  }
1648 
1649 }
1650 
1651 static void ParseCSS1_list_style_type( const CSS1Expression *pExpr,
1652  SfxItemSet & /*rItemSet*/,
1653  SvxCSS1PropertyInfo& rPropInfo,
1654  const SvxCSS1Parser& /*rParser*/ )
1655 {
1656  OSL_ENSURE( pExpr, "no expression" );
1657 
1658  if( pExpr->GetType() != CSS1_IDENT )
1659  return;
1660 
1661  const OUString& rValue = pExpr->GetString();
1662 
1663  // values are context-dependent, so fill both
1664  sal_uInt16 nEnum;
1665  if( SvxCSS1Parser::GetEnum( aNumberStyleTable, rValue, nEnum ) )
1666  {
1667  rPropInfo.m_bNumbering = true;
1668  rPropInfo.m_nNumberingType = static_cast<SvxNumType>(nEnum);
1669  }
1670  if( SvxCSS1Parser::GetEnum( aBulletStyleTable, rValue, nEnum ) )
1671  {
1672  rPropInfo.m_bBullet = true;
1673  rPropInfo.m_cBulletChar = nEnum;
1674  }
1675 }
1676 
1677 static void ParseCSS1_font( const CSS1Expression *pExpr,
1678  SfxItemSet &rItemSet,
1679  SvxCSS1PropertyInfo& rPropInfo,
1680  const SvxCSS1Parser& rParser )
1681 {
1682  OSL_ENSURE( pExpr, "no expression" );
1683 
1684  FontItalic eItalic = ITALIC_NONE;
1685  SvxCaseMap eCaseMap = SvxCaseMap::NotMapped;
1686  FontWeight eWeight = WEIGHT_NORMAL;
1687 
1688  // [ <font-style> || <font-variant> || <font-weight> ] ?
1689  while( pExpr && !pExpr->GetOp() &&
1690  (CSS1_IDENT==pExpr->GetType() ||
1691  CSS1_STRING==pExpr->GetType() ||
1692  CSS1_NUMBER==pExpr->GetType()) )
1693  {
1694  if( CSS1_IDENT==pExpr->GetType() ||
1695  CSS1_STRING==pExpr->GetType() )
1696  {
1697  const OUString& rValue = pExpr->GetString();
1698 
1699  sal_uInt16 nEnum;
1700 
1701  if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nEnum ) )
1702  {
1703  eItalic = static_cast<FontItalic>(nEnum);
1704  }
1705  else if( SvxCSS1Parser::GetEnum( aFontVariantTable, rValue, nEnum ) )
1706  {
1707  eCaseMap = static_cast<SvxCaseMap>(nEnum);
1708  }
1709  else if( SvxCSS1Parser::GetEnum( aFontWeightTable, rValue, nEnum ) )
1710  {
1711  eWeight = static_cast<FontWeight>(nEnum);
1712  }
1713  }
1714  else
1715  {
1716  eWeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber()) > 400 ? WEIGHT_BOLD
1717  : WEIGHT_NORMAL;
1718  }
1719 
1720  pExpr = pExpr->GetNext();
1721  }
1722 
1723  if( !pExpr || pExpr->GetOp() )
1724  return;
1725 
1726  // Since "font" resets all values for which nothing is specified,
1727  // we do it here.
1728  SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
1729  rItemSet.Put( aPosture );
1730  aPosture.SetWhich( aItemIds.nPostureCJK );
1731  rItemSet.Put( aPosture );
1732  aPosture.SetWhich( aItemIds.nPostureCTL );
1733  rItemSet.Put( aPosture );
1734 
1735  rItemSet.Put( SvxCaseMapItem( eCaseMap, aItemIds.nCaseMap ) );
1736 
1737  SvxWeightItem aWeight( eWeight, aItemIds.nWeight );
1738  rItemSet.Put( aWeight );
1739  aWeight.SetWhich( aItemIds.nWeightCJK );
1740  rItemSet.Put( aWeight );
1741  aWeight.SetWhich( aItemIds.nWeightCTL );
1742  rItemSet.Put( aWeight );
1743 
1744  // font-size
1745  CSS1Expression aExpr( pExpr->GetType(), pExpr->GetString(),
1746  pExpr->GetNumber() );
1747  ParseCSS1_font_size( &aExpr, rItemSet, rPropInfo, rParser );
1748  pExpr = pExpr->GetNext();
1749 
1750  if( !pExpr )
1751  return;
1752 
1753  // [ '/' line-height ]?
1754  if( '/' == pExpr->GetOp() )
1755  {
1756  // '/' line-height
1757  aExpr.Set( pExpr->GetType(), pExpr->GetString(), pExpr->GetNumber() );
1758  ParseCSS1_line_height( &aExpr, rItemSet, rPropInfo, rParser );
1759 
1760  pExpr = pExpr->GetNext();
1761  }
1762 
1763  if( !pExpr || pExpr->GetOp() )
1764  return;
1765 
1766  // font-family
1767  ParseCSS1_font_family( pExpr, rItemSet, rPropInfo, rParser );
1768 }
1769 
1770 static void ParseCSS1_letter_spacing( const CSS1Expression *pExpr,
1771  SfxItemSet &rItemSet,
1772  SvxCSS1PropertyInfo& /*rPropInfo*/,
1773  const SvxCSS1Parser& /*rParser*/ )
1774 {
1775  OSL_ENSURE( pExpr, "no expression" );
1776 
1777  switch( pExpr->GetType() )
1778  {
1779  case CSS1_LENGTH:
1780  rItemSet.Put( SvxKerningItem( static_cast<short>(pExpr->GetSLength()),
1781  aItemIds.nKerning ) );
1782  break;
1783 
1784  case CSS1_PIXLENGTH:
1785  {
1786  double fHeight = pExpr->GetNumber();
1787  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
1788  {
1789  tools::Long nPWidth = static_cast<tools::Long>(fHeight);
1790  tools::Long nPHeight = 0;
1791  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
1792  rItemSet.Put( SvxKerningItem( static_cast<short>(nPWidth), aItemIds.nKerning ) );
1793  }
1794  }
1795  break;
1796 
1797  case CSS1_NUMBER:
1798  if( pExpr->GetNumber() == 0 )
1799  {
1800  // normally unnecessary, but we are tolerant
1801  rItemSet.Put( SvxKerningItem( short(0), aItemIds.nKerning ) );
1802  }
1803  break;
1804 
1805  case CSS1_IDENT:
1806  case CSS1_STRING: // As a precaution also MS-IE
1807  if( pExpr->GetString().equalsIgnoreAsciiCase( "normal" ) )
1808  {
1809  rItemSet.Put( SvxKerningItem( short(0), aItemIds.nKerning ) );
1810  }
1811  break;
1812  default:
1813  ;
1814  }
1815 }
1816 
1817 static void ParseCSS1_text_decoration( const CSS1Expression *pExpr,
1818  SfxItemSet &rItemSet,
1819  SvxCSS1PropertyInfo& /*rPropInfo*/,
1820  const SvxCSS1Parser& /*rParser*/ )
1821 {
1822  OSL_ENSURE( pExpr, "no expression" );
1823 
1824  bool bUnderline = false;
1825  bool bOverline = false;
1826  bool bCrossedOut = false;
1827  bool bBlink = false;
1828  bool bBlinkOn = false;
1829  FontLineStyle eUnderline = LINESTYLE_NONE;
1830  FontLineStyle eOverline = LINESTYLE_NONE;
1831  FontStrikeout eCrossedOut = STRIKEOUT_NONE;
1832 
1833  // the value can contain two values! And MS-IE also strings
1834  while( pExpr && (pExpr->GetType() == CSS1_IDENT ||
1835  pExpr->GetType() == CSS1_STRING) && !pExpr->GetOp() )
1836  {
1837  OUString aValue = pExpr->GetString().toAsciiLowerCase();
1838  bool bKnown = false;
1839 
1840  switch( aValue[0] )
1841  {
1842  case 'n':
1843  if( aValue == "none" )
1844  {
1845  bUnderline = true;
1846  eUnderline = LINESTYLE_NONE;
1847 
1848  bOverline = true;
1849  eOverline = LINESTYLE_NONE;
1850 
1851  bCrossedOut = true;
1852  eCrossedOut = STRIKEOUT_NONE;
1853 
1854  bBlink = true;
1855  bBlinkOn = false;
1856 
1857  bKnown = true;
1858  }
1859  break;
1860 
1861  case 'u':
1862  if( aValue == "underline" )
1863  {
1864  bUnderline = true;
1865  eUnderline = LINESTYLE_SINGLE;
1866 
1867  bKnown = true;
1868  }
1869  break;
1870 
1871  case 'o':
1872  if( aValue == "overline" )
1873  {
1874  bOverline = true;
1875  eOverline = LINESTYLE_SINGLE;
1876 
1877  bKnown = true;
1878  }
1879  break;
1880 
1881  case 'l':
1882  if( aValue == "line-through" )
1883  {
1884  bCrossedOut = true;
1885  eCrossedOut = STRIKEOUT_SINGLE;
1886 
1887  bKnown = true;
1888  }
1889  break;
1890 
1891  case 'b':
1892  if( aValue == "blink" )
1893  {
1894  bBlink = true;
1895  bBlinkOn = true;
1896 
1897  bKnown = true;
1898  }
1899  break;
1900  }
1901 
1902  if( !bKnown )
1903  {
1904  bUnderline = true;
1905  eUnderline = LINESTYLE_SINGLE;
1906  }
1907 
1908  pExpr = pExpr->GetNext();
1909  }
1910 
1911  if( bUnderline )
1912  rItemSet.Put( SvxUnderlineItem( eUnderline, aItemIds.nUnderline ) );
1913 
1914  if( bOverline )
1915  rItemSet.Put( SvxOverlineItem( eOverline, aItemIds.nOverline ) );
1916 
1917  if( bCrossedOut )
1918  rItemSet.Put( SvxCrossedOutItem( eCrossedOut, aItemIds.nCrossedOut ) );
1919 
1920  if( bBlink )
1921  rItemSet.Put( SvxBlinkItem( bBlinkOn, aItemIds.nBlink ) );
1922 }
1923 
1924 static void ParseCSS1_text_align( const CSS1Expression *pExpr,
1925  SfxItemSet &rItemSet,
1926  SvxCSS1PropertyInfo& /*rPropInfo*/,
1927  const SvxCSS1Parser& /*rParser*/ )
1928 {
1929  OSL_ENSURE( pExpr, "no expression" );
1930 
1931  if( CSS1_IDENT==pExpr->GetType() ||
1932  CSS1_STRING==pExpr->GetType() ) // MS-IE, again
1933  {
1934  sal_uInt16 nAdjust;
1935  if( SvxCSS1Parser::GetEnum( aTextAlignTable, pExpr->GetString(),
1936  nAdjust ) )
1937  {
1938  rItemSet.Put( SvxAdjustItem( static_cast<SvxAdjust>(nAdjust),
1939  aItemIds.nAdjust ) );
1940  }
1941  }
1942 }
1943 
1944 static void ParseCSS1_text_indent( const CSS1Expression *pExpr,
1945  SfxItemSet &rItemSet,
1946  SvxCSS1PropertyInfo& rPropInfo,
1947  const SvxCSS1Parser& /*rParser*/ )
1948 {
1949  OSL_ENSURE( pExpr, "no expression" );
1950 
1951  short nIndent = 0;
1952  bool bSet = false;
1953  switch( pExpr->GetType() )
1954  {
1955  case CSS1_LENGTH:
1956  {
1957  double n = std::round(pExpr->GetNumber());
1958  SAL_WARN_IF(
1959  n < std::numeric_limits<short>::min() || n > std::numeric_limits<short>::max(),
1960  "sw.html", "clamping length " << n << " to short range");
1961  nIndent = static_cast<short>(
1962  std::clamp(
1963  n, double(std::numeric_limits<short>::min()),
1964  double(std::numeric_limits<short>::max())));
1965  bSet = true;
1966  }
1967  break;
1968  case CSS1_PIXLENGTH:
1969  {
1970  double fWidth = pExpr->GetNumber();
1971  if (fWidth < SAL_MAX_INT32/2.0 && fWidth > SAL_MIN_INT32/2.0)
1972  {
1973  tools::Long nPWidth = static_cast<tools::Long>(fWidth);
1974  tools::Long nPHeight = 0;
1975  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
1976  nIndent = static_cast<short>(nPWidth);
1977  bSet = true;
1978  }
1979  }
1980  break;
1981  case CSS1_PERCENTAGE:
1982  // we aren't able
1983  break;
1984  default:
1985  ;
1986  }
1987 
1988  if( !bSet )
1989  return;
1990 
1991  if( const SvxLRSpaceItem* pItem = rItemSet.GetItemIfSet( aItemIds.nLRSpace, false ) )
1992  {
1993  SvxLRSpaceItem aLRItem( *pItem );
1994  aLRItem.SetTextFirstLineOffset( nIndent );
1995  rItemSet.Put( aLRItem );
1996  }
1997  else
1998  {
1999  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2000  aLRItem.SetTextFirstLineOffset( nIndent );
2001  rItemSet.Put( aLRItem );
2002  }
2003  rPropInfo.m_bTextIndent = true;
2004 }
2005 
2006 static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
2007  SfxItemSet &rItemSet,
2008  SvxCSS1PropertyInfo& rPropInfo,
2009  const SvxCSS1Parser& /*rParser*/ )
2010 {
2011  OSL_ENSURE( pExpr, "no expression" );
2012 
2013  tools::Long nLeft = 0;
2014  bool bSet = false;
2015  switch( pExpr->GetType() )
2016  {
2017  case CSS1_LENGTH:
2018  {
2019  nLeft = pExpr->GetSLength();
2020  bSet = true;
2021  }
2022  break;
2023  case CSS1_PIXLENGTH:
2024  {
2025  double fLeft = pExpr->GetNumber();
2026  if (fLeft < SAL_MAX_INT32/2.0 && fLeft > SAL_MIN_INT32/2.0)
2027  {
2028  nLeft = static_cast<tools::Long>(fLeft);
2029  tools::Long nPHeight = 0;
2030  SvxCSS1Parser::PixelToTwip( nLeft, nPHeight );
2031  bSet = true;
2032  }
2033  else
2034  {
2035  SAL_WARN("sw.html", "out-of-size pxlength: " << fLeft);
2036  }
2037  }
2038  break;
2039  case CSS1_PERCENTAGE:
2040  // we aren't able
2041  break;
2042  default:
2043  ;
2044  }
2045 
2046  if( !bSet )
2047  return;
2048 
2049  rPropInfo.m_nLeftMargin = nLeft;
2050  if( nLeft < 0 )
2051  nLeft = 0;
2052  if( const SvxLRSpaceItem* pItem = rItemSet.GetItemIfSet( aItemIds.nLRSpace, false ) )
2053  {
2054  SvxLRSpaceItem aLRItem( *pItem );
2055  aLRItem.SetTextLeft( o3tl::narrowing<sal_uInt16>(nLeft) );
2056  rItemSet.Put( aLRItem );
2057  }
2058  else
2059  {
2060  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2061  aLRItem.SetTextLeft( o3tl::narrowing<sal_uInt16>(nLeft) );
2062  rItemSet.Put( aLRItem );
2063  }
2064  rPropInfo.m_bLeftMargin = true;
2065 }
2066 
2067 static void ParseCSS1_margin_right( const CSS1Expression *pExpr,
2068  SfxItemSet &rItemSet,
2069  SvxCSS1PropertyInfo& rPropInfo,
2070  const SvxCSS1Parser& /*rParser*/ )
2071 {
2072  OSL_ENSURE( pExpr, "no expression" );
2073 
2074  tools::Long nRight = 0;
2075  bool bSet = false;
2076  switch( pExpr->GetType() )
2077  {
2078  case CSS1_LENGTH:
2079  {
2080  nRight = pExpr->GetSLength();
2081  bSet = true;
2082  }
2083  break;
2084  case CSS1_PIXLENGTH:
2085  {
2086  double fRight = pExpr->GetNumber();
2087  if (fRight < SAL_MAX_INT32/2.0 && fRight > SAL_MIN_INT32/2.0)
2088  {
2089  nRight = static_cast<tools::Long>(fRight);
2090  tools::Long nPHeight = 0;
2091  SvxCSS1Parser::PixelToTwip( nRight, nPHeight );
2092  bSet = true;
2093  }
2094  }
2095  break;
2096  case CSS1_PERCENTAGE:
2097  // we aren't able
2098  break;
2099  default:
2100  ;
2101  }
2102 
2103  if( !bSet )
2104  return;
2105 
2106  rPropInfo.m_nRightMargin = nRight;
2107  if( nRight < 0 )
2108  nRight = 0;
2109  if( const SvxLRSpaceItem* pItem = rItemSet.GetItemIfSet( aItemIds.nLRSpace, false ) )
2110  {
2111  SvxLRSpaceItem aLRItem( *pItem );
2112  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nRight) );
2113  rItemSet.Put( aLRItem );
2114  }
2115  else
2116  {
2117  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2118  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nRight) );
2119  rItemSet.Put( aLRItem );
2120  }
2121  rPropInfo.m_bRightMargin = true;
2122 }
2123 
2124 static void ParseCSS1_margin_top( const CSS1Expression *pExpr,
2125  SfxItemSet &rItemSet,
2126  SvxCSS1PropertyInfo& rPropInfo,
2127  const SvxCSS1Parser& /*rParser*/ )
2128 {
2129  assert(pExpr && "no expression");
2130 
2131  sal_uInt16 nUpper = 0;
2132  bool bSet = false;
2133  switch( pExpr->GetType() )
2134  {
2135  case CSS1_LENGTH:
2136  {
2137  tools::Long nTmp = pExpr->GetSLength();
2138  if( nTmp < 0 )
2139  nTmp = 0;
2140  nUpper = o3tl::narrowing<sal_uInt16>(nTmp);
2141  bSet = true;
2142  }
2143  break;
2144  case CSS1_PIXLENGTH:
2145  {
2146  double fHeight = pExpr->GetNumber();
2147  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
2148  {
2149  tools::Long nPWidth = 0;
2150  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
2151  if( nPHeight < 0 )
2152  nPHeight = 0;
2153  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2154  nUpper = o3tl::narrowing<sal_uInt16>(nPHeight);
2155  bSet = true;
2156  }
2157  }
2158  break;
2159  case CSS1_PERCENTAGE:
2160  // we aren't able
2161  break;
2162  default:
2163  ;
2164  }
2165 
2166  if( !bSet )
2167  return;
2168 
2169  if( const SvxULSpaceItem* pItem = rItemSet.GetItemIfSet( aItemIds.nULSpace, false ) )
2170  {
2171  SvxULSpaceItem aULItem( *pItem );
2172  aULItem.SetUpper( nUpper );
2173  rItemSet.Put( aULItem );
2174  }
2175  else
2176  {
2177  SvxULSpaceItem aULItem( aItemIds.nULSpace );
2178  aULItem.SetUpper( nUpper );
2179  rItemSet.Put( aULItem );
2180  }
2181  rPropInfo.m_bTopMargin = true;
2182 }
2183 
2184 static void ParseCSS1_margin_bottom( const CSS1Expression *pExpr,
2185  SfxItemSet &rItemSet,
2186  SvxCSS1PropertyInfo& rPropInfo,
2187  const SvxCSS1Parser& /*rParser*/ )
2188 {
2189  OSL_ENSURE( pExpr, "no expression" );
2190 
2191  sal_uInt16 nLower = 0;
2192  bool bSet = false;
2193  switch( pExpr->GetType() )
2194  {
2195  case CSS1_LENGTH:
2196  {
2197  tools::Long nTmp = pExpr->GetSLength();
2198  if( nTmp < 0 )
2199  nTmp = 0;
2200  nLower = o3tl::narrowing<sal_uInt16>(nTmp);
2201  bSet = true;
2202  }
2203  break;
2204  case CSS1_PIXLENGTH:
2205  {
2206  double fHeight = pExpr->GetNumber();
2207  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
2208  {
2209  tools::Long nPWidth = 0;
2210  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
2211  if( nPHeight < 0 )
2212  nPHeight = 0;
2213  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2214  nLower = o3tl::narrowing<sal_uInt16>(nPHeight);
2215  bSet = true;
2216  }
2217  }
2218  break;
2219  case CSS1_PERCENTAGE:
2220  // we aren't able
2221  break;
2222  default:
2223  ;
2224  }
2225 
2226  if( !bSet )
2227  return;
2228 
2229  if( const SvxULSpaceItem* pItem = rItemSet.GetItemIfSet( aItemIds.nULSpace, false ) )
2230  {
2231  SvxULSpaceItem aULItem( *pItem );
2232  aULItem.SetLower( nLower );
2233  rItemSet.Put( aULItem );
2234  }
2235  else
2236  {
2237  SvxULSpaceItem aULItem( aItemIds.nULSpace );
2238  aULItem.SetLower( nLower );
2239  rItemSet.Put( aULItem );
2240  }
2241  rPropInfo.m_bBottomMargin = true;
2242 }
2243 
2244 static void ParseCSS1_margin( const CSS1Expression *pExpr,
2245  SfxItemSet &rItemSet,
2246  SvxCSS1PropertyInfo& rPropInfo,
2247  const SvxCSS1Parser& /*rParser*/ )
2248 {
2249  OSL_ENSURE( pExpr, "no expression" );
2250 
2251  tools::Long nMargins[4] = { 0, 0, 0, 0 };
2252  bool bSetMargins[4] = { false, false, false, false };
2253 
2254  for( int i=0; pExpr && i<4 && !pExpr->GetOp(); ++i )
2255  {
2256  bool bSetThis = false;
2257  tools::Long nMargin = 0;
2258 
2259  switch( pExpr->GetType() )
2260  {
2261  case CSS1_LENGTH:
2262  {
2263  nMargin = pExpr->GetSLength();
2264  bSetThis = true;
2265  }
2266  break;
2267  case CSS1_PIXLENGTH:
2268  {
2269  double fMargin = pExpr->GetNumber();
2270  if (fMargin < SAL_MAX_INT32/2.0 && fMargin > SAL_MIN_INT32/2.0)
2271  {
2272  nMargin = static_cast<tools::Long>(fMargin);
2273  tools::Long nPWidth = 0;
2274  SvxCSS1Parser::PixelToTwip( nPWidth, nMargin );
2275  bSetThis = true;
2276  }
2277  else
2278  {
2279  SAL_WARN("sw.html", "out-of-size pxlength: " << fMargin);
2280  }
2281  }
2282  break;
2283  case CSS1_PERCENTAGE:
2284  // we aren't able
2285  break;
2286  default:
2287  ;
2288  }
2289 
2290  if( bSetThis )
2291  {
2292  // 0 = top
2293  // 1 = right
2294  // 2 = bottom
2295  // 3 = left
2296  switch( i )
2297  {
2298  case 0:
2299  nMargins[0] = nMargins[1] =nMargins[2] = nMargins[3] = nMargin;
2300  bSetMargins[0] = bSetMargins[1] =
2301  bSetMargins[2] = bSetMargins[3] = true;
2302  break;
2303  case 1:
2304  nMargins[1] = nMargins[3] = nMargin; // right + left
2305  bSetMargins[1] = bSetMargins[3] = true;
2306  break;
2307  case 2:
2308  nMargins[2] = nMargin; // bottom
2309  bSetMargins[2] = true;
2310  break;
2311  case 3:
2312  nMargins[3] = nMargin; // left
2313  bSetMargins[3] = true;
2314  break;
2315  }
2316  }
2317  pExpr = pExpr->GetNext();
2318  }
2319 
2320  if( bSetMargins[3] || bSetMargins[1] )
2321  {
2322  if( bSetMargins[3] )
2323  {
2324  rPropInfo.m_bLeftMargin = true;
2325  rPropInfo.m_nLeftMargin = nMargins[3];
2326  if( nMargins[3] < 0 )
2327  nMargins[3] = 0;
2328  }
2329  if( bSetMargins[1] )
2330  {
2331  rPropInfo.m_bRightMargin = true;
2332  rPropInfo.m_nRightMargin = nMargins[1];
2333  if( nMargins[1] < 0 )
2334  nMargins[1] = 0;
2335  }
2336 
2337  if( const SvxLRSpaceItem* pItem = rItemSet.GetItemIfSet( aItemIds.nLRSpace, false ) )
2338  {
2339  SvxLRSpaceItem aLRItem( *pItem );
2340  if( bSetMargins[3] )
2341  aLRItem.SetLeft( o3tl::narrowing<sal_uInt16>(nMargins[3]) );
2342  if( bSetMargins[1] )
2343  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nMargins[1]) );
2344  rItemSet.Put( aLRItem );
2345  }
2346  else
2347  {
2348  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2349  if( bSetMargins[3] )
2350  aLRItem.SetLeft( o3tl::narrowing<sal_uInt16>(nMargins[3]) );
2351  if( bSetMargins[1] )
2352  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nMargins[1]) );
2353  rItemSet.Put( aLRItem );
2354  }
2355  }
2356 
2357  if( !(bSetMargins[0] || bSetMargins[2]) )
2358  return;
2359 
2360  if( nMargins[0] < 0 )
2361  nMargins[0] = 0;
2362  if( nMargins[2] < 0 )
2363  nMargins[2] = 0;
2364 
2365  if( const SvxULSpaceItem* pItem = rItemSet.GetItemIfSet( aItemIds.nULSpace, false ) )
2366  {
2367  SvxULSpaceItem aULItem( *pItem );
2368  if( bSetMargins[0] )
2369  aULItem.SetUpper( o3tl::narrowing<sal_uInt16>(nMargins[0]) );
2370  if( bSetMargins[2] )
2371  aULItem.SetLower( o3tl::narrowing<sal_uInt16>(nMargins[2]) );
2372  rItemSet.Put( aULItem );
2373  }
2374  else
2375  {
2376  SvxULSpaceItem aULItem( aItemIds.nULSpace );
2377  if( bSetMargins[0] )
2378  aULItem.SetUpper( o3tl::narrowing<sal_uInt16>(nMargins[0]) );
2379  if( bSetMargins[2] )
2380  aULItem.SetLower( o3tl::narrowing<sal_uInt16>(nMargins[2]) );
2381  rItemSet.Put( aULItem );
2382  }
2383 
2384  rPropInfo.m_bTopMargin |= bSetMargins[0];
2385  rPropInfo.m_bBottomMargin |= bSetMargins[2];
2386 }
2387 
2388 static bool ParseCSS1_padding_xxx( const CSS1Expression *pExpr,
2389  SvxCSS1PropertyInfo& rPropInfo,
2390  SvxBoxItemLine nWhichLine )
2391 {
2392  OSL_ENSURE( pExpr, "no expression" );
2393 
2394  bool bSet = false;
2395  sal_uInt16 nDist = 0;
2396 
2397  switch( pExpr->GetType() )
2398  {
2399  case CSS1_LENGTH:
2400  {
2401  tools::Long nTmp = pExpr->GetSLength();
2402  if( nTmp < 0 )
2403  nTmp = 0;
2404  else if( nTmp > SvxCSS1PropertyInfo::UNSET_BORDER_DISTANCE-1 )
2406  nDist = o3tl::narrowing<sal_uInt16>(nTmp);
2407  bSet = true;
2408  }
2409  break;
2410  case CSS1_PIXLENGTH:
2411  {
2412  double fWidth = pExpr->GetNumber();
2413  if (fWidth < SAL_MAX_INT32/2.0 && fWidth > SAL_MIN_INT32/2.0)
2414  {
2415  tools::Long nPWidth = static_cast<tools::Long>(fWidth);
2416  tools::Long nPHeight = 0;
2417  if( nPWidth < 0 )
2418  nPWidth = 0;
2419  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2422  nDist = o3tl::narrowing<sal_uInt16>(nPWidth);
2423  bSet = true;
2424  }
2425  }
2426  break;
2427  case CSS1_PERCENTAGE:
2428  // we aren't able
2429  break;
2430  default:
2431  ;
2432  }
2433 
2434  if( bSet )
2435  {
2436  switch( nWhichLine )
2437  {
2438  case SvxBoxItemLine::TOP: rPropInfo.m_nTopBorderDistance = nDist; break;
2439  case SvxBoxItemLine::BOTTOM: rPropInfo.m_nBottomBorderDistance = nDist;break;
2440  case SvxBoxItemLine::LEFT: rPropInfo.m_nLeftBorderDistance = nDist; break;
2441  case SvxBoxItemLine::RIGHT: rPropInfo.m_nRightBorderDistance = nDist; break;
2442  }
2443  }
2444 
2445  return bSet;
2446 }
2447 
2448 static void ParseCSS1_padding_top( const CSS1Expression *pExpr,
2449  SfxItemSet & /*rItemSet*/,
2450  SvxCSS1PropertyInfo& rPropInfo,
2451  const SvxCSS1Parser& /*rParser*/ )
2452 {
2453  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::TOP );
2454 }
2455 
2456 static void ParseCSS1_padding_bottom( const CSS1Expression *pExpr,
2457  SfxItemSet & /*rItemSet*/,
2458  SvxCSS1PropertyInfo& rPropInfo,
2459  const SvxCSS1Parser& /*rParser*/ )
2460 {
2461  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::BOTTOM );
2462 }
2463 
2464 static void ParseCSS1_padding_left( const CSS1Expression *pExpr,
2465  SfxItemSet & /*rItemSet*/,
2466  SvxCSS1PropertyInfo& rPropInfo,
2467  const SvxCSS1Parser& /*rParser*/ )
2468 {
2469  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::LEFT );
2470 }
2471 
2472 static void ParseCSS1_padding_right( const CSS1Expression *pExpr,
2473  SfxItemSet & /*rItemSet*/,
2474  SvxCSS1PropertyInfo& rPropInfo,
2475  const SvxCSS1Parser& /*rParser*/ )
2476 {
2477  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::RIGHT );
2478 }
2479 
2480 static void ParseCSS1_padding( const CSS1Expression *pExpr,
2481  SfxItemSet & /*rItemSet*/,
2482  SvxCSS1PropertyInfo& rPropInfo,
2483  const SvxCSS1Parser& /*rParser*/ )
2484 {
2485  int n=0;
2486  while( n<4 && pExpr && !pExpr->GetOp() )
2487  {
2488  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2489  if( ParseCSS1_padding_xxx( pExpr, rPropInfo, nLine ) )
2490  {
2491  if( n==0 )
2492  {
2493  rPropInfo.m_nTopBorderDistance = rPropInfo.m_nBottomBorderDistance;
2494  rPropInfo.m_nLeftBorderDistance = rPropInfo.m_nTopBorderDistance;
2495  }
2496  if( n <= 1 )
2497  rPropInfo.m_nRightBorderDistance = rPropInfo.m_nLeftBorderDistance;
2498  }
2499 
2500  pExpr = pExpr->GetNext();
2501  n++;
2502  }
2503 }
2504 
2505 static void ParseCSS1_border_xxx( const CSS1Expression *pExpr,
2506  SfxItemSet & /*rItemSet*/,
2507  SvxCSS1PropertyInfo& rPropInfo,
2508  const SvxCSS1Parser& /*rParser*/,
2509  SvxBoxItemLine nWhichLine, bool bAll )
2510 {
2511  OSL_ENSURE( pExpr, "no expression" );
2512 
2513  sal_uInt16 nWidth = USHRT_MAX; // line thickness
2514  sal_uInt16 nNWidth = 1; // named line thickness (and default)
2515  CSS1BorderStyle eStyle = CSS1_BS_NONE; // line style
2516  Color aColor;
2517  bool bColor = false;
2518 
2519  while( pExpr && !pExpr->GetOp() )
2520  {
2521  switch( pExpr->GetType() )
2522  {
2523  case CSS1_RGB:
2524  case CSS1_HEXCOLOR:
2525  if( pExpr->GetColor( aColor ) )
2526  bColor = true;
2527  break;
2528 
2529  case CSS1_IDENT:
2530  {
2531  const OUString& rValue = pExpr->GetString();
2532  sal_uInt16 nValue;
2533  if( SvxCSS1Parser::GetEnum( aBorderWidthTable, rValue, nValue ) )
2534  {
2535  nNWidth = nValue;
2536  }
2537  else if( SvxCSS1Parser::GetEnum( aBorderStyleTable, rValue, nValue ) )
2538  {
2539  eStyle = static_cast<CSS1BorderStyle>(nValue);
2540  }
2541  else if( pExpr->GetColor( aColor ) )
2542  {
2543  bColor = true;
2544  }
2545  }
2546  break;
2547 
2548  case CSS1_LENGTH:
2549  nWidth = o3tl::narrowing<sal_uInt16>(pExpr->GetULength());
2550  break;
2551 
2552  case CSS1_PIXLENGTH:
2553  {
2554  // One Pixel becomes a hairline (is prettier)
2555  double fWidth = pExpr->GetNumber();
2556  if (fWidth > 1.0 && fWidth < SAL_MAX_INT32/2.0)
2557  {
2558  bool bHori = nWhichLine == SvxBoxItemLine::TOP ||
2559  nWhichLine == SvxBoxItemLine::BOTTOM;
2560 
2561  tools::Long nPWidth = bHori ? 0 : fWidth;
2562  tools::Long nPHeight = bHori ? fWidth : 0;
2563  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2564  nWidth = o3tl::narrowing<sal_uInt16>(bHori ? nPHeight : nPWidth);
2565  }
2566  else
2567  nWidth = 1;
2568  }
2569  break;
2570 
2571  default:
2572  ;
2573  }
2574 
2575  pExpr = pExpr->GetNext();
2576  }
2577 
2578  for( int i=0; i<4; ++i )
2579  {
2580  SvxBoxItemLine nLine = SvxBoxItemLine::TOP;
2581  switch( i )
2582  {
2583  case 0: nLine = SvxBoxItemLine::TOP; break;
2584  case 1: nLine = SvxBoxItemLine::BOTTOM; break;
2585  case 2: nLine = SvxBoxItemLine::LEFT; break;
2586  case 3: nLine = SvxBoxItemLine::RIGHT; break;
2587  }
2588 
2589  if( bAll || nLine == nWhichLine )
2590  {
2591  SvxCSS1BorderInfo *pInfo = rPropInfo.GetBorderInfo( nLine );
2592  pInfo->eStyle = eStyle;
2593  pInfo->nAbsWidth = nWidth;
2594  pInfo->nNamedWidth = nNWidth;
2595  if( bColor )
2596  pInfo->aColor = aColor;
2597  }
2598  }
2599 }
2600 
2601 static void ParseCSS1_border_xxx_width( const CSS1Expression *pExpr,
2602  SfxItemSet & /*rItemSet*/,
2603  SvxCSS1PropertyInfo& rPropInfo,
2604  const SvxCSS1Parser& /*rParser*/,
2605  SvxBoxItemLine nWhichLine )
2606 {
2607  OSL_ENSURE( pExpr, "no expression" );
2608 
2609  sal_uInt16 nWidth = USHRT_MAX; // line thickness
2610  sal_uInt16 nNWidth = 1; // named line thickness (and default)
2611 
2612  switch( pExpr->GetType() )
2613  {
2614  case CSS1_IDENT:
2615  {
2616  sal_uInt16 nValue;
2617  if( SvxCSS1Parser::GetEnum( aBorderWidthTable, pExpr->GetString(), nValue ) )
2618  {
2619  nNWidth = nValue;
2620  }
2621  }
2622  break;
2623 
2624  case CSS1_LENGTH:
2625  nWidth = o3tl::narrowing<sal_uInt16>(pExpr->GetULength());
2626  break;
2627 
2628  case CSS1_PIXLENGTH:
2629  {
2630  double fLength = pExpr->GetNumber();
2631  if (fLength < SAL_MAX_INT32/2.0 && fLength > SAL_MIN_INT32/2.0)
2632  {
2633  tools::Long nWidthL = static_cast<tools::Long>(fLength);
2634 
2635  bool bHori = nWhichLine == SvxBoxItemLine::TOP ||
2636  nWhichLine == SvxBoxItemLine::BOTTOM;
2637 
2638  tools::Long nPWidth = bHori ? 0 : nWidthL;
2639  tools::Long nPHeight = bHori ? nWidthL : 0;
2640  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2641  nWidth = o3tl::narrowing<sal_uInt16>(bHori ? nPHeight : nPWidth);
2642  }
2643  }
2644  break;
2645 
2646  default:
2647  ;
2648  }
2649 
2650  SvxCSS1BorderInfo *pInfo = rPropInfo.GetBorderInfo( nWhichLine );
2651  pInfo->nAbsWidth = nWidth;
2652  pInfo->nNamedWidth = nNWidth;
2653 }
2654 
2655 static void ParseCSS1_border_top_width( const CSS1Expression *pExpr,
2656  SfxItemSet &rItemSet,
2657  SvxCSS1PropertyInfo& rPropInfo,
2658  const SvxCSS1Parser& rParser )
2659 {
2660  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP );
2661 }
2662 
2664  SfxItemSet &rItemSet,
2665  SvxCSS1PropertyInfo& rPropInfo,
2666  const SvxCSS1Parser& rParser )
2667 {
2668  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::RIGHT );
2669 }
2670 
2672  SfxItemSet &rItemSet,
2673  SvxCSS1PropertyInfo& rPropInfo,
2674  const SvxCSS1Parser& rParser )
2675 {
2676  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::BOTTOM );
2677 }
2678 
2680  SfxItemSet &rItemSet,
2681  SvxCSS1PropertyInfo& rPropInfo,
2682  const SvxCSS1Parser& rParser )
2683 {
2684  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::LEFT );
2685 }
2686 
2687 static void ParseCSS1_border_width( const CSS1Expression *pExpr,
2688  SfxItemSet &rItemSet,
2689  SvxCSS1PropertyInfo& rPropInfo,
2690  const SvxCSS1Parser& rParser )
2691 {
2692  sal_uInt16 n=0;
2693  while( n<4 && pExpr && !pExpr->GetOp() )
2694  {
2695  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2696  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, nLine );
2697  rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_WIDTH );
2698 
2699  pExpr = pExpr->GetNext();
2700  n++;
2701  }
2702 }
2703 
2704 static void ParseCSS1_border_color( const CSS1Expression *pExpr,
2705  SfxItemSet & /*rItemSet*/,
2706  SvxCSS1PropertyInfo& rPropInfo,
2707  const SvxCSS1Parser& /*rParser*/ )
2708 {
2709  sal_uInt16 n=0;
2710  while( n<4 && pExpr && !pExpr->GetOp() )
2711  {
2712  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2713  Color aColor;
2714  switch( pExpr->GetType() )
2715  {
2716  case CSS1_RGB:
2717  case CSS1_HEXCOLOR:
2718  case CSS1_IDENT:
2719  if( pExpr->GetColor( aColor ) )
2720  rPropInfo.GetBorderInfo( nLine )->aColor = aColor;
2721  break;
2722  default:
2723  ;
2724  }
2725  rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_COLOR );
2726 
2727  pExpr = pExpr->GetNext();
2728  n++;
2729  }
2730 }
2731 
2732 static void ParseCSS1_border_style( const CSS1Expression *pExpr,
2733  SfxItemSet & /*rItemSet*/,
2734  SvxCSS1PropertyInfo& rPropInfo,
2735  const SvxCSS1Parser& /*rParser*/ )
2736 {
2737  sal_uInt16 n=0;
2738  while( n<4 && pExpr && !pExpr->GetOp() )
2739  {
2740  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2741  sal_uInt16 nValue = 0;
2742  if( CSS1_IDENT==pExpr->GetType() &&
2743  SvxCSS1Parser::GetEnum( aBorderStyleTable, pExpr->GetString(),
2744  nValue ) )
2745  {
2746  rPropInfo.GetBorderInfo( nLine )->eStyle = static_cast<CSS1BorderStyle>(nValue);
2747  }
2748  rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_STYLE );
2749 
2750  pExpr = pExpr->GetNext();
2751  n++;
2752  }
2753 }
2754 
2755 static void ParseCSS1_border_top( const CSS1Expression *pExpr,
2756  SfxItemSet &rItemSet,
2757  SvxCSS1PropertyInfo& rPropInfo,
2758  const SvxCSS1Parser& rParser )
2759 {
2760  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP, false );
2761 }
2762 
2763 static void ParseCSS1_border_right( const CSS1Expression *pExpr,
2764  SfxItemSet &rItemSet,
2765  SvxCSS1PropertyInfo& rPropInfo,
2766  const SvxCSS1Parser& rParser )
2767 {
2768  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::RIGHT, false );
2769 }
2770 
2771 static void ParseCSS1_border_bottom( const CSS1Expression *pExpr,
2772  SfxItemSet &rItemSet,
2773  SvxCSS1PropertyInfo& rPropInfo,
2774  const SvxCSS1Parser& rParser )
2775 {
2776  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::BOTTOM, false );
2777 }
2778 
2779 static void ParseCSS1_border_left( const CSS1Expression *pExpr,
2780  SfxItemSet &rItemSet,
2781  SvxCSS1PropertyInfo& rPropInfo,
2782  const SvxCSS1Parser& rParser )
2783 {
2784  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::LEFT, false );
2785 }
2786 
2787 static void ParseCSS1_border( const CSS1Expression *pExpr,
2788  SfxItemSet &rItemSet,
2789  SvxCSS1PropertyInfo& rPropInfo,
2790  const SvxCSS1Parser& rParser )
2791 {
2792  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP, true );
2793 }
2794 
2795 static void ParseCSS1_float( const CSS1Expression *pExpr,
2796  SfxItemSet & /*rItemSet*/,
2797  SvxCSS1PropertyInfo& rPropInfo,
2798  const SvxCSS1Parser& /*rParser*/ )
2799 {
2800  OSL_ENSURE( pExpr, "no expression" );
2801 
2802  if( CSS1_IDENT==pExpr->GetType() )
2803  {
2804  sal_uInt16 nFloat;
2805  if( SvxCSS1Parser::GetEnum( aFloatTable, pExpr->GetString(), nFloat ) )
2806  rPropInfo.m_eFloat = static_cast<SvxAdjust>(nFloat);
2807  }
2808 }
2809 
2810 static void ParseCSS1_position( const CSS1Expression *pExpr,
2811  SfxItemSet & /*rItemSet*/,
2812  SvxCSS1PropertyInfo& rPropInfo,
2813  const SvxCSS1Parser& /*rParser*/ )
2814 {
2815  OSL_ENSURE( pExpr, "no expression" );
2816 
2817  if( CSS1_IDENT==pExpr->GetType() )
2818  {
2819  sal_uInt16 nPos;
2820  if( SvxCSS1Parser::GetEnum( aPositionTable, pExpr->GetString(), nPos ) )
2821  rPropInfo.m_ePosition = static_cast<SvxCSS1Position>(nPos);
2822  }
2823 }
2824 
2825 static void ParseCSS1_length( const CSS1Expression *pExpr,
2826  tools::Long& rLength,
2827  SvxCSS1LengthType& rLengthType,
2828  bool bHori )
2829 {
2830  switch( pExpr->GetType() )
2831  {
2832  case CSS1_IDENT:
2833  if( pExpr->GetString().equalsIgnoreAsciiCase( "auto" ) )
2834  {
2835  rLength = 0;
2836  rLengthType = SVX_CSS1_LTYPE_AUTO;
2837  }
2838  break;
2839 
2840  case CSS1_LENGTH:
2841  rLength = pExpr->GetSLength();
2842  rLengthType = SVX_CSS1_LTYPE_TWIP;
2843  break;
2844 
2845  case CSS1_PIXLENGTH:
2846  case CSS1_NUMBER: // because of Netscape and IE
2847  {
2848  double fLength = pExpr->GetNumber();
2849  if (fLength < SAL_MAX_INT32/2.0 && fLength > SAL_MIN_INT32/2.0)
2850  {
2851  tools::Long nWidthL = static_cast<tools::Long>(fLength);
2852  tools::Long nPWidth = bHori ? 0 : nWidthL;
2853  tools::Long nPHeight = bHori ? nWidthL : 0;
2854  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2855  rLength = (bHori ? nPHeight : nPWidth);
2856  rLengthType = SVX_CSS1_LTYPE_TWIP;
2857  }
2858  }
2859  break;
2860 
2861  case CSS1_PERCENTAGE:
2862  rLength = static_cast<tools::Long>(std::min(pExpr->GetNumber(), 100.0));
2863  rLengthType = SVX_CSS1_LTYPE_PERCENTAGE;
2864  break;
2865 
2866  default:
2867  ;
2868  }
2869 }
2870 
2871 static void ParseCSS1_width( const CSS1Expression *pExpr,
2872  SfxItemSet & /*rItemSet*/,
2873  SvxCSS1PropertyInfo& rPropInfo,
2874  const SvxCSS1Parser& /*rParser*/ )
2875 {
2876  ParseCSS1_length( pExpr, rPropInfo.m_nWidth, rPropInfo.m_eWidthType, true );
2877 }
2878 
2879 static void ParseCSS1_height( const CSS1Expression *pExpr,
2880  SfxItemSet & /*rItemSet*/,
2881  SvxCSS1PropertyInfo& rPropInfo,
2882  const SvxCSS1Parser& /*rParser*/ )
2883 {
2884  ParseCSS1_length( pExpr, rPropInfo.m_nHeight, rPropInfo.m_eHeightType, false );
2885 }
2886 
2887 static void ParseCSS1_left( const CSS1Expression *pExpr,
2888  SfxItemSet & /*rItemSet*/,
2889  SvxCSS1PropertyInfo& rPropInfo,
2890  const SvxCSS1Parser& /*rParser*/ )
2891 {
2892  ParseCSS1_length( pExpr, rPropInfo.m_nLeft, rPropInfo.m_eLeftType, true );
2893 }
2894 
2895 static void ParseCSS1_top( const CSS1Expression *pExpr,
2896  SfxItemSet & /*rItemSet*/,
2897  SvxCSS1PropertyInfo& rPropInfo,
2898  const SvxCSS1Parser& /*rParser*/ )
2899 {
2900  ParseCSS1_length( pExpr, rPropInfo.m_nTop, rPropInfo.m_eTopType, false );
2901 }
2902 
2903 // Feature: PrintExt
2904 static void ParseCSS1_size( const CSS1Expression *pExpr,
2905  SfxItemSet & /*rItemSet*/,
2906  SvxCSS1PropertyInfo& rPropInfo,
2907  const SvxCSS1Parser& /*rParser*/ )
2908 {
2909  int n=0;
2910  while( n<2 && pExpr && !pExpr->GetOp() )
2911  {
2912  switch( pExpr->GetType() )
2913  {
2914  case CSS1_IDENT:
2915  {
2916  sal_uInt16 nValue;
2917  if( SvxCSS1Parser::GetEnum( aSizeTable, pExpr->GetString(),
2918  nValue ) )
2919  {
2920  rPropInfo.m_eSizeType = static_cast<SvxCSS1SizeType>(nValue);
2921  }
2922  }
2923  break;
2924 
2925  case CSS1_LENGTH:
2926  rPropInfo.m_nHeight = pExpr->GetSLength();
2927  if( n==0 )
2928  rPropInfo.m_nWidth = rPropInfo.m_nHeight;
2929  rPropInfo.m_eSizeType = SVX_CSS1_STYPE_TWIP;
2930  break;
2931 
2932  case CSS1_PIXLENGTH:
2933  {
2934  double fHeight = pExpr->GetNumber();
2935  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
2936  {
2937  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
2938  tools::Long nPWidth = n==0 ? nPHeight : 0;
2939  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2940  rPropInfo.m_nHeight = nPHeight;
2941  if( n==0 )
2942  rPropInfo.m_nWidth = nPWidth;
2943  rPropInfo.m_eSizeType = SVX_CSS1_STYPE_TWIP;
2944  }
2945  break;
2946  }
2947  default:
2948  ;
2949  }
2950 
2951  pExpr = pExpr->GetNext();
2952  n++;
2953  }
2954 }
2955 
2956 static void ParseCSS1_page_break_xxx( const CSS1Expression *pExpr,
2957  SvxCSS1PageBreak& rPBreak )
2958 {
2959  if( CSS1_IDENT == pExpr->GetType() )
2960  {
2961  sal_uInt16 nValue;
2962  if( SvxCSS1Parser::GetEnum( aPageBreakTable, pExpr->GetString(),
2963  nValue ) )
2964  {
2965  rPBreak = static_cast<SvxCSS1PageBreak>(nValue);
2966  }
2967  }
2968 }
2969 
2971  SfxItemSet & /*rItemSet*/,
2972  SvxCSS1PropertyInfo& rPropInfo,
2973  const SvxCSS1Parser& /*rParser*/ )
2974 {
2975  ParseCSS1_page_break_xxx( pExpr, rPropInfo.m_ePageBreakBefore );
2976 }
2977 
2978 static void ParseCSS1_page_break_after( const CSS1Expression *pExpr,
2979  SfxItemSet & /*rItemSet*/,
2980  SvxCSS1PropertyInfo& rPropInfo,
2981  const SvxCSS1Parser& /*rParser*/ )
2982 {
2983  ParseCSS1_page_break_xxx( pExpr, rPropInfo.m_ePageBreakAfter );
2984 }
2985 
2987  SfxItemSet &rItemSet,
2988  SvxCSS1PropertyInfo& /*rPropInfo*/,
2989  const SvxCSS1Parser& /*rParser*/ )
2990 {
2992  ParseCSS1_page_break_xxx( pExpr, eBreak );
2993 
2994  bool bSetSplit = false, bSplit = true;
2995  switch( eBreak )
2996  {
2997  case SVX_CSS1_PBREAK_AUTO:
2998  bSetSplit = true;
2999  break;
3000  case SVX_CSS1_PBREAK_AVOID:
3001  bSplit = false;
3002  bSetSplit = true;
3003  break;
3004  default:
3005  ;
3006  }
3007 
3008  if( bSetSplit )
3009  rItemSet.Put( SvxFormatSplitItem( bSplit, aItemIds.nFormatSplit ) );
3010 }
3011 
3012 static void ParseCSS1_widows( const CSS1Expression *pExpr,
3013  SfxItemSet &rItemSet,
3014  SvxCSS1PropertyInfo& /*rPropInfo*/,
3015  const SvxCSS1Parser& /*rParser*/ )
3016 {
3017  if( CSS1_NUMBER == pExpr->GetType() )
3018  {
3019  sal_uInt8 nVal = pExpr->GetNumber() <= 255
3020  ? static_cast<sal_uInt8>(pExpr->GetNumber())
3021  : 255;
3022  SvxWidowsItem aWidowsItem( nVal, aItemIds.nWidows );
3023  rItemSet.Put( aWidowsItem );
3024  }
3025 }
3026 
3027 static void ParseCSS1_orphans( const CSS1Expression *pExpr,
3028  SfxItemSet &rItemSet,
3029  SvxCSS1PropertyInfo& /*rPropInfo*/,
3030  const SvxCSS1Parser& /*rParser*/ )
3031 {
3032  if( CSS1_NUMBER == pExpr->GetType() )
3033  {
3034  sal_uInt8 nVal = pExpr->GetNumber() <= 255
3035  ? static_cast<sal_uInt8>(pExpr->GetNumber())
3036  : 255;
3037  SvxOrphansItem aOrphansItem( nVal, aItemIds.nOrphans );
3038  rItemSet.Put( aOrphansItem );
3039  }
3040 }
3041 
3042 static void ParseCSS1_so_language( const CSS1Expression *pExpr,
3043  SfxItemSet &rItemSet,
3044  SvxCSS1PropertyInfo& /*rPropInfo*/,
3045  const SvxCSS1Parser& /*rParser*/ )
3046 {
3047  if( CSS1_IDENT != pExpr->GetType() && CSS1_STRING != pExpr->GetType() )
3048  return;
3049 
3051  if( LANGUAGE_DONTKNOW != eLang )
3052  {
3053  SvxLanguageItem aLang( eLang, aItemIds.nLanguage );
3054  rItemSet.Put( aLang );
3055  aLang.SetWhich( aItemIds.nLanguageCJK );
3056  rItemSet.Put( aLang );
3057  aLang.SetWhich( aItemIds.nLanguageCTL );
3058  rItemSet.Put( aLang );
3059  }
3060 }
3061 
3062 static void ParseCSS1_visibility(const CSS1Expression* pExpr, SfxItemSet& /*rItemSet*/,
3063  SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& /*rParser*/)
3064 {
3065  if (pExpr->GetType() != CSS1_IDENT)
3066  return;
3067 
3068  rPropInfo.m_bVisible = pExpr->GetString() != "hidden";
3069 }
3070 
3071 namespace {
3072 
3073 // the assignment of property to parsing function
3074 struct CSS1PropEntry
3075 {
3076  const char * pName;
3077  FnParseCSS1Prop pFunc;
3078 };
3079 
3080 }
3081 
3082 #define CSS1_PROP_ENTRY(p) \
3083  { sCSS1_P_##p, ParseCSS1_##p }
3084 
3085 // the table with assignments
3086 CSS1PropEntry const aCSS1PropFnTab[] =
3087 {
3088  CSS1_PROP_ENTRY(background),
3089  CSS1_PROP_ENTRY(background_color),
3090  CSS1_PROP_ENTRY(border),
3091  CSS1_PROP_ENTRY(border_bottom),
3092  CSS1_PROP_ENTRY(border_bottom_width),
3093  CSS1_PROP_ENTRY(border_color),
3094  CSS1_PROP_ENTRY(border_left),
3095  CSS1_PROP_ENTRY(border_left_width),
3096  CSS1_PROP_ENTRY(border_right),
3097  CSS1_PROP_ENTRY(border_right_width),
3098  CSS1_PROP_ENTRY(border_style),
3099  CSS1_PROP_ENTRY(border_top),
3100  CSS1_PROP_ENTRY(border_top_width),
3101  CSS1_PROP_ENTRY(border_width),
3103  CSS1_PROP_ENTRY(column_count),
3104  CSS1_PROP_ENTRY(direction),
3105  CSS1_PROP_ENTRY(float),
3106  CSS1_PROP_ENTRY(font),
3107  CSS1_PROP_ENTRY(font_family),
3108  CSS1_PROP_ENTRY(font_size),
3109  CSS1_PROP_ENTRY(font_style),
3110  CSS1_PROP_ENTRY(font_variant),
3111  CSS1_PROP_ENTRY(font_weight),
3112  CSS1_PROP_ENTRY(height),
3114  CSS1_PROP_ENTRY(letter_spacing),
3115  CSS1_PROP_ENTRY(line_height),
3116  CSS1_PROP_ENTRY(list_style_type),
3117  CSS1_PROP_ENTRY(margin),
3118  CSS1_PROP_ENTRY(margin_bottom),
3119  CSS1_PROP_ENTRY(margin_left),
3120  CSS1_PROP_ENTRY(margin_right),
3121  CSS1_PROP_ENTRY(margin_top),
3122  CSS1_PROP_ENTRY(orphans),
3123  CSS1_PROP_ENTRY(padding),
3124  CSS1_PROP_ENTRY(padding_bottom),
3125  CSS1_PROP_ENTRY(padding_left),
3126  CSS1_PROP_ENTRY(padding_right),
3127  CSS1_PROP_ENTRY(padding_top),
3128  CSS1_PROP_ENTRY(page_break_after),
3129  CSS1_PROP_ENTRY(page_break_before),
3130  CSS1_PROP_ENTRY(page_break_inside),
3133  CSS1_PROP_ENTRY(so_language),
3134  CSS1_PROP_ENTRY(text_align),
3135  CSS1_PROP_ENTRY(text_decoration),
3136  CSS1_PROP_ENTRY(text_indent),
3137  CSS1_PROP_ENTRY(text_transform),
3139  CSS1_PROP_ENTRY(visibility),
3140  CSS1_PROP_ENTRY(widows),
3141  CSS1_PROP_ENTRY(width),
3142 };
3143 
3144 #if !defined NDEBUG
3145 static bool CSS1PropEntryCompare( const CSS1PropEntry &lhs, const CSS1PropEntry &rhs)
3146 {
3147  return strcmp(lhs.pName, rhs.pName) < 0;
3148 }
3149 #endif
3150 static bool CSS1PropEntryFindCompare(CSS1PropEntry const & lhs, OUString const & s)
3151 {
3152  return s.compareToIgnoreAsciiCaseAscii(lhs.pName) > 0;
3153 }
3154 
3155 void SvxCSS1Parser::DeclarationParsed( const OUString& rProperty,
3156  std::unique_ptr<CSS1Expression> pExpr )
3157 {
3158  OSL_ENSURE( m_pItemSet, "DeclarationParsed() without ItemSet" );
3159 
3160  static bool bSortedPropFns = false;
3161 
3162  if( !bSortedPropFns )
3163  {
3164  assert( std::is_sorted( std::begin(aCSS1PropFnTab), std::end(aCSS1PropFnTab),
3166  bSortedPropFns = true;
3167  }
3168 
3169  auto it = std::lower_bound( std::begin(aCSS1PropFnTab), std::end(aCSS1PropFnTab), rProperty,
3171  if( it != std::end(aCSS1PropFnTab) && !CSS1PropEntryFindCompare(*it,rProperty) )
3172  {
3173  it->pFunc( pExpr.get(), *m_pItemSet, *m_pPropInfo, *this );
3174  }
3175 }
3176 
3177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const char * pName
Definition: svxcss1.hxx:88
static void ParseCSS1_margin_bottom(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2184
RubyPosition m_ePosition
static void MergeStyles(const SfxItemSet &rSrcSet, const SvxCSS1PropertyInfo &rSrcInfo, SfxItemSet &rTargetSet, SvxCSS1PropertyInfo &rTargetInfo, bool bSmart)
Definition: svxcss1.cxx:932
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
static void ParseCSS1_width(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2871
virtual sal_uInt32 GetFontHeight(sal_uInt16 nSize) const
Definition: svxcss1.cxx:890
const OUString & GetBaseURL() const
Definition: svxcss1.hxx:305
#define SVX_CSS1_BORDERINFO_COLOR
Definition: svxcss1.hxx:95
void SetBorderLineStyle(SvxBorderLineStyle nNew)
SvxCSS1LengthType
Definition: svxcss1.hxx:47
URL aURL
SvxCSS1LengthType m_eLeftType
Definition: svxcss1.hxx:137
static const sal_Int16 VeryThin
void Merge(const SvxCSS1PropertyInfo &rProp)
Definition: svxcss1.cxx:451
SvxCSS1LengthType m_eTopType
Definition: svxcss1.hxx:137
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
static void ParseCSS1_margin(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2244
void SetWidth(tools::Long nWidth)
std::map< OUString, std::unique_ptr< SvxCSS1MapEntry > > CSS1Map
Definition: svxcss1.hxx:189
static void ParseCSS1_visibility(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:3062
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
static void ParseCSS1_text_transform(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1248
virtual void SelectorParsed(std::unique_ptr< CSS1Selector > pSelector, bool bFirst) override
Will be called when a Selector is parsed.
Definition: svxcss1.cxx:677
static void ParseCSS1_border_width(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2687
static void ParseCSS1_border_color(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2704
void ParseStyleOption(const OUString &rIn, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo)
Definition: svxcss1.cxx:846
static void ParseCSS1_font_variant(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1222
sal_uInt16 GetLower() const
GPOS_RM
virtual void SetDfltEncoding(rtl_TextEncoding eEnc)
Definition: svxcss1.cxx:980
sal_uInt64 left
#define SVX_CSS1_BORDERINFO_STYLE
Definition: svxcss1.hxx:96
static void ParseCSS1_border_right(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2763
CSS1Map m_Tags
Definition: svxcss1.hxx:195
CSS1PropertyEnum const aBGVertPosTable[]
Definition: svxcss1.cxx:148
#define CSS1_PROP_ENTRY(p)
Definition: svxcss1.cxx:3082
WhichRangesContainer m_aWhichMap
Definition: svxcss1.hxx:210
SvxCaseMap
virtual void StyleParsed(const CSS1Selector *pSelector, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo)
Definition: svxcss1.cxx:670
std::array< std::unique_ptr< SvxCSS1BorderInfo >, 4 > m_aBorderInfos
Definition: svxcss1.hxx:101
SvxCSS1BorderInfo * GetBorderInfo(SvxBoxItemLine nLine, bool bCreate=true)
Definition: svxcss1.cxx:533
GPOS_NONE
GPOS_LT
static void ParseCSS1_top(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2895
const SvxCSS1PropertyInfo & GetPropertyInfo() const
Definition: svxcss1.hxx:176
sal_uIntPtr sal_uLong
long Long
tools::Long GetRight() const
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
FAMILY_DONTKNOW
static void ParseCSS1_padding_left(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2464
static void ParseCSS1_direction(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1316
virtual const FontList * GetFontList() const
Definition: svxcss1.cxx:909
SVX_NUM_CHARS_UPPER_LETTER
tools::Long m_nHeight
Definition: svxcss1.hxx:134
CSS1PropertyEnum const aFontVariantTable[]
Definition: svxcss1.cxx:108
sal_Int64 n
static void InsertMapEntry(const OUString &rKey, const SfxItemSet &rItemSet, const SvxCSS1PropertyInfo &rProp, CSS1Map &rMap)
Definition: svxcss1.cxx:914
static void ParseCSS1_length(const CSS1Expression *pExpr, tools::Long &rLength, SvxCSS1LengthType &rLengthType, bool bHori)
Definition: svxcss1.cxx:2825
static void ParseCSS1_height(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2879
void Set(CSS1Token eTyp, const OUString &rVal, double nVal)
Definition: parcss1.hxx:150
CSS1PropertyEnum const aBorderStyleTable[]
Definition: svxcss1.cxx:179
SvxCSS1Parser(SfxItemPool &rPool, const OUString &rBaseURL, sal_uInt16 const *pWhichIds, sal_uInt16 nWhichIds)
Definition: svxcss1.cxx:697
CSS1Token
Definition: parcss1.hxx:29
tools::Long m_nWidth
Definition: svxcss1.hxx:134
static void ParseCSS1_page_break_before(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2970
void CopyBorderInfo(SvxBoxItemLine nSrcLine, SvxBoxItemLine nDstLine, sal_uInt16 nWhat)
Definition: svxcss1.cxx:550
static void ParseCSS1_text_align(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1924
static void ParseCSS1_letter_spacing(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1770
rtl_TextEncoding GetDfltEncoding() const
Definition: svxcss1.hxx:303
#define SVX_CSS1_BORDERINFO_WIDTH
Definition: svxcss1.hxx:94
static void ParseCSS1_border_xxx(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &, SvxBoxItemLine nWhichLine, bool bAll)
Definition: svxcss1.cxx:2505
void SetBoxItem(SfxItemSet &rItemSet, sal_uInt16 nMinBorderDist, const SvxBoxItem *pDflt=nullptr)
Definition: svxcss1.cxx:584
sal_Unicode GetOp() const
Definition: parcss1.hxx:141
CSS1PropertyEnum const aPositionTable[]
Definition: svxcss1.cxx:201
CSS1PropertyEnum const aTextAlignTable[]
Definition: svxcss1.cxx:156
static void PixelToTwip(tools::Long &nWidth, tools::Long &nHeight)
Definition: svxcss1.cxx:877
sal_uInt16 m_nTopBorderDistance
Definition: svxcss1.hxx:123
CSS1PropertyEnum const aNumberStyleTable[]
Definition: svxcss1.cxx:228
SvxCSS1PageBreak m_ePageBreakBefore
Definition: svxcss1.hxx:142
void SetLineSpaceRule(SvxLineSpaceRule e)
css::chart::ChartAxisLabelPosition ePos
static void ParseCSS1_widows(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:3012
std::unique_ptr< SfxItemSet > m_pSheetItemSet
Definition: svxcss1.hxx:199
sal_Unicode m_cBulletChar
Definition: svxcss1.hxx:129
static SvxCSS1ItemIds aItemIds
Definition: svxcss1.cxx:301
static void ParseCSS1_font_family(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:1048
static void ParseCSS1_line_height(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1586
CSS1PropertyEnum const aFontSizeTable[]
Definition: svxcss1.cxx:73
CSS1PropertyEnum const aBulletStyleTable[]
Definition: svxcss1.cxx:240
void(* FnParseCSS1Prop)(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
type of functions to parse CSS1 properties
Definition: svxcss1.cxx:68
static void ParseCSS1_font_weight(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1117
static void ParseCSS1_border_top(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2755
sal_uInt16 const aBorderWidths[]
Definition: svxcss1.cxx:248
void * sal_Handle
SvxNumType
sal_Handle GetFirstFontMetric(std::u16string_view rName) const
static OutputDevice * GetDefaultDevice()
WEIGHT_BOLD
a subexpression of a CSS1 declaration
Definition: parcss1.hxx:118
def position
constexpr tools::Long Width() const
CSS1PropertyEnum const aFontStyleTable[]
Definition: svxcss1.cxx:100
GPOS_TILED
static void ParseCSS1_border_left(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2779
SvxCSS1LengthType m_eHeightType
Definition: svxcss1.hxx:138
SvxCSS1SizeType m_eSizeType
Definition: svxcss1.hxx:140
static void ParseCSS1_font_style(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1160
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
void SetPropLineSpace(const sal_uInt16 nProp)
CSS1Map m_Pages
Definition: svxcss1.hxx:194
static void ParseCSS1_padding_right(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2472
rtl_TextEncoding m_eDefaultEnc
Definition: svxcss1.hxx:208
GPOS_LM
static void ParseCSS1_so_language(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:3042
LINESTYLE_NONE
bool IsIgnoreFontFamily() const
Definition: svxcss1.hxx:246
CSS1PropEntry const aCSS1PropFnTab[]
Definition: svxcss1.cxx:3086
static void ParseCSS1_color(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1275
static void ParseCSS1_background_color(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1540
SVX_NUM_ARABIC
virtual void DeclarationParsed(const OUString &rProperty, std::unique_ptr< CSS1Expression > pExpr) override
Will be called for every parsed Property.
Definition: svxcss1.cxx:3155
SVX_NUM_ROMAN_UPPER
SvxCSS1PageBreak m_ePageBreakAfter
Definition: svxcss1.hxx:143
SVX_NUM_ROMAN_LOWER
CSS1Map m_Ids
Definition: svxcss1.hxx:192
sal_uInt16 nEnum
Definition: svxcss1.hxx:89
CSS1PropertyEnum const aBGHoriPosTable[]
Definition: svxcss1.cxx:140
SvxCSS1MapEntry * GetTag(const OUString &rTag)
Definition: svxcss1.cxx:817
CSS1PropertyEnum const aTextTransformTable[]
Definition: svxcss1.cxx:115
static void ParseCSS1_padding_top(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2448
#define HTML_BULLETCHAR_DISC
Definition: htmlnum.hxx:32
static void ParseCSS1_border_right_width(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2663
SfxItemSet * m_pItemSet
Definition: svxcss1.hxx:200
sal_uInt16 GetTrueWhich(sal_uInt16 nSlot, bool bDeep=true) const
OString top
void ParseStyleSheet()
Definition: parcss1.cxx:670
STRIKEOUT_SINGLE
static void ParseCSS1_font_size(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:985
SvxCSS1Position
Definition: svxcss1.hxx:39
static void ParseCSS1_border_bottom_width(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2671
static void MergeHori(SvxGraphicPosition &ePos, SvxGraphicPosition eHori)
Definition: svxcss1.cxx:1341
static void ParseCSS1_border_bottom(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2771
void SetColor(const Color &rCol)
const CSS1Expression * GetNext() const
Definition: parcss1.hxx:147
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
static void ParseCSS1_border_style(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2732
SvxNumType m_nNumberingType
Definition: svxcss1.hxx:128
CSS1PropertyEnum const aDirectionTable[]
Definition: svxcss1.cxx:123
DocumentType eType
void InsertPage(const OUString &rPage, bool bPseudo, const SfxItemSet &rItemSet, const SvxCSS1PropertyInfo &rProp)
Definition: svxcss1.cxx:789
virtual ~SvxCSS1Parser() override
Definition: svxcss1.cxx:757
sal_uInt16 m_nLeftBorderDistance
Definition: svxcss1.hxx:125
static void ParseCSS1_size(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2904
SvxCSS1PropertyInfo * m_pPropInfo
Definition: svxcss1.hxx:203
static void ParseCSS1_position(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2810
sal_uInt16 char * pName
static bool CSS1PropEntryFindCompare(CSS1PropEntry const &lhs, OUString const &s)
Definition: svxcss1.cxx:3150
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SVX_NUM_CHARS_LOWER_LETTER
void DestroyBorderInfos()
Definition: svxcss1.cxx:416
#define SAL_MAX_INT32
CSS1PropertyEnum const aBGRepeatTable[]
Definition: svxcss1.cxx:131
CSS1BorderStyle eStyle
Definition: svxcss1.cxx:308
SvxCSS1SizeType
Definition: svxcss1.hxx:56
SvxAdjust
int i
sal_uInt16 m_nRightBorderDistance
Definition: svxcss1.hxx:126
CSS1PropertyEnum const aBorderWidthTable[]
Definition: svxcss1.cxx:165
tools::Long m_nTop
Definition: svxcss1.hxx:133
CSS1Map m_Classes
Definition: svxcss1.hxx:193
static void ParseCSS1_padding_bottom(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2456
static constexpr sal_uInt16 UNSET_BORDER_DISTANCE
Definition: svxcss1.hxx:106
static void ParseCSS1_column_count(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1299
static void ParseCSS1_margin_right(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2067
CSS1PropertyEnum const aFloatTable[]
Definition: svxcss1.cxx:193
static void ParseCSS1_page_break_inside(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2986
tools::Long GetLeft() const
static void ParseCSS1_background(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:1401
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
#define SAL_MIN_INT32
WEIGHT_NORMAL
GPOS_MT
SvxGraphicPosition
LINESTYLE_SINGLE
tools::Long m_nRightMargin
Definition: svxcss1.hxx:135
void InsertClass(const OUString &rClass, const SfxItemSet &rItemSet, const SvxCSS1PropertyInfo &rProp)
Definition: svxcss1.cxx:776
CSS1BorderStyle
Definition: svxcss1.cxx:175
#define LANGUAGE_DONTKNOW
GPOS_MM
static void ParseCSS1_left(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2887
PITCH_DONTKNOW
SvxCSS1Position m_ePosition
Definition: svxcss1.hxx:121
short GetTextFirstLineOffset() const
size
SvxCSS1MapEntry(const SfxItemSet &rItemSet, const SvxCSS1PropertyInfo &rProp)
Definition: svxcss1.cxx:664
virtual SvxBoxItem * Clone(SfxItemPool *pPool=nullptr) const override
#define HTML_BULLETCHAR_CIRCLE
Definition: htmlnum.hxx:33
static void MergeVert(SvxGraphicPosition &ePos, SvxGraphicPosition eVert)
Definition: svxcss1.cxx:1371
ITALIC_NONE
sal_uInt32 GetULength() const
Definition: parcss1.hxx:156
SvxAdjust m_eFloat
Definition: svxcss1.hxx:119
void ParseStyleOption(const OUString &rIn)
parse the content of a HTML style option
Definition: parcss1.cxx:1152
SAL_WARN_UNUSED_RESULT WhichRangesContainer MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo) const
GPOS_MB
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void SetGraphicPos(SvxGraphicPosition eNew)
SvxCSS1MapEntry * GetPage(const OUString &rPage, bool bPseudo)
Definition: svxcss1.cxx:800
CSS1PropertyEnum const aPageBreakTable[]
Definition: svxcss1.cxx:218
static void ParseCSS1_border(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2787
static bool ParseCSS1_padding_xxx(const CSS1Expression *pExpr, SvxCSS1PropertyInfo &rPropInfo, SvxBoxItemLine nWhichLine)
Definition: svxcss1.cxx:2388
static bool CSS1PropEntryCompare(const CSS1PropEntry &lhs, const CSS1PropEntry &rhs)
Definition: svxcss1.cxx:3145
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static void ParseCSS1_border_xxx_width(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &, SvxBoxItemLine nWhichLine)
Definition: svxcss1.cxx:2601
void SetInterLineSpaceRule(SvxInterLineSpaceRule e)
FontWeight
tools::Long m_nLeftMargin
Definition: svxcss1.hxx:135
SvxCSS1LengthType m_eWidthType
Definition: svxcss1.hxx:138
static const sal_Int16 Hairline
static void ParseCSS1_margin_top(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2124
const OUString & GetString() const
Definition: parcss1.hxx:137
sal_uInt16 nAbsWidth
Definition: svxcss1.cxx:306
sal_Int32 GetSLength() const
Definition: parcss1.hxx:161
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
static void ParseCSS1_padding(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2480
constexpr tools::Long Height() const
ITALIC_NORMAL
unsigned char sal_uInt8
static void ParseCSS1_border_top_width(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2655
static sal_uInt16 GetMinFixLineSpace()
Definition: svxcss1.hxx:300
static const sal_Int16 Thin
void SetLineHeight(const sal_uInt16 nHeight)
bool GetColor(Color &rRGB) const
Definition: parcss1.cxx:1238
OUString aName
void SetWhich(sal_uInt16 nId)
SvxBoxItemLine
tools::Long m_nLeft
Definition: svxcss1.hxx:133
const SvxCSS1MapEntry * GetId(const OUString &rId) const
Definition: svxcss1.cxx:770
void SetBorderLine(SvxBoxItemLine nLine, SvxBoxItem &rBoxItem) const
Definition: svxcss1.cxx:318
static void ParseCSS1_margin_left(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2006
void * p
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
static void ParseCSS1_text_decoration(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1817
CSS1Token GetType() const
Definition: parcss1.hxx:136
static void ParseCSS1_page_break_after(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2978
CSS1Selectors m_Selectors
Definition: svxcss1.hxx:190
sal_uInt16 nNamedWidth
Definition: svxcss1.cxx:307
static void ParseCSS1_border_left_width(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2679
static void ParseCSS1_page_break_xxx(const CSS1Expression *pExpr, SvxCSS1PageBreak &rPBreak)
Definition: svxcss1.cxx:2956
static void ParseCSS1_text_indent(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1944
CSS1PropertyEnum const aSizeTable[]
Definition: svxcss1.cxx:210
static void ParseCSS1_orphans(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:3027
CSS1PropertyEnum const aFontWeightTable[]
Definition: svxcss1.cxx:85
#define SAL_WARN(area, stream)
void GetURL(OUString &rURL) const
Definition: parcss1.cxx:1212
void InsertTag(const OUString &rTag, const SfxItemSet &rItemSet, const SvxCSS1PropertyInfo &rProp)
Definition: svxcss1.cxx:810
GPOS_RB
void SetGraphicLink(const OUString &rNew)
GPOS_LB
const SfxItemSet & GetItemSet() const
Definition: svxcss1.hxx:173
STRIKEOUT_NONE
static void ParseCSS1_font(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:1677
double GetNumber() const
Definition: parcss1.hxx:138
A simple selector.
Definition: parcss1.hxx:91
void InsertId(const OUString &rId, const SfxItemSet &rItemSet, const SvxCSS1PropertyInfo &rProp)
Definition: svxcss1.cxx:763
FontLineStyle
static void ParseCSS1_float(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2795
GPOS_RT
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
#define HTML_BULLETCHAR_SQUARE
Definition: htmlnum.hxx:34
const SvxCSS1MapEntry * GetClass(const OUString &rClass) const
Definition: svxcss1.cxx:783
static bool GetEnum(const CSS1PropertyEnum *pPropTable, const OUString &rValue, sal_uInt16 &rEnum)
Definition: svxcss1.cxx:860
std::unique_ptr< SvxCSS1PropertyInfo > m_pSheetPropInfo
Definition: svxcss1.hxx:202
sal_uInt16 m_nColumnCount
Definition: svxcss1.hxx:131
static void ParseCSS1_list_style_type(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1651
FontStrikeout
static const FontMetric & GetFontMetric(sal_Handle hFontMetric)
rtl_TextEncoding GetCharSet() const
sal_uInt16 nPos
sal_Int16 nValue
FontItalic
sal_uInt16 GetUpper() const
SvxCSS1PageBreak
Definition: svxcss1.hxx:65
bool m_bDetectedRangeSegmentation false
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)
sal_uInt16 m_nBottomBorderDistance
Definition: svxcss1.hxx:124
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo