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 <cmath>
23 #include <memory>
24 #include <stdlib.h>
25 
26 #include <svx/svxids.hrc>
28 #include <svtools/ctrltool.hxx>
29 #include <svl/urihelper.hxx>
30 #include <editeng/udlnitem.hxx>
31 #include <editeng/adjustitem.hxx>
32 #include <editeng/blinkitem.hxx>
34 #include <editeng/kernitem.hxx>
35 #include <editeng/lspcitem.hxx>
36 #include <editeng/fontitem.hxx>
37 #include <editeng/postitem.hxx>
38 #include <editeng/colritem.hxx>
39 #include <editeng/cmapitem.hxx>
40 #include <editeng/brushitem.hxx>
41 #include <editeng/wghtitem.hxx>
42 #include <editeng/fhgtitem.hxx>
43 #include <editeng/borderline.hxx>
44 #include <editeng/boxitem.hxx>
45 #include <editeng/ulspitem.hxx>
46 #include <editeng/lrspitem.hxx>
47 #include <editeng/langitem.hxx>
48 #include <svl/itempool.hxx>
49 #include <editeng/spltitem.hxx>
50 #include <editeng/widwitem.hxx>
51 #include <editeng/frmdiritem.hxx>
52 #include <editeng/orphitem.hxx>
53 #include <svtools/svparser.hxx>
54 #include <vcl/svapp.hxx>
55 #include <sal/log.hxx>
56 #include <osl/diagnose.h>
57 
58 #include "css1kywd.hxx"
59 #include "svxcss1.hxx"
60 #include "htmlnum.hxx"
61 
62 #include <utility>
63 
64 using namespace ::com::sun::star;
65 
67 typedef void (*FnParseCSS1Prop)( const CSS1Expression *pExpr,
68  SfxItemSet& rItemSet,
69  SvxCSS1PropertyInfo& rPropInfo,
70  const SvxCSS1Parser& rParser );
71 
73 {
74  { "xx-small", 0 },
75  { "x-small", 1 },
76  { "small", 2 },
77  { "medium", 3 },
78  { "large", 4 },
79  { "x-large", 5 },
80  { "xx-large", 6 },
81  { nullptr, 0 }
82 };
83 
85 {
86  { "extra-light", WEIGHT_NORMAL }, // WEIGHT_ULTRALIGHT (OBS)
87  { "light", WEIGHT_NORMAL }, // WEIGHT_LIGHT (OBSOLETE)
88  { "demi-light", WEIGHT_NORMAL }, // WEIGHT_SEMILIGHT (OBS)
89  { "medium", WEIGHT_NORMAL }, // WEIGHT_MEDIUM (OBS)
90  { "normal", WEIGHT_NORMAL }, // WEIGHT_MEDIUM
91  { "demi-bold", WEIGHT_NORMAL }, // WEIGHT_SEMIBOLD (OBS)
92  { "bold", WEIGHT_BOLD }, // WEIGHT_BOLD (OBSOLETE)
93  { "extra-bold", WEIGHT_BOLD }, // WEIGHT_ULTRABOLD (OBS)
94  { "bolder", WEIGHT_BOLD },
95  { "lighter", WEIGHT_NORMAL },
96  { nullptr, 0 }
97 };
98 
100 {
101  { "normal", ITALIC_NONE },
102  { "italic", ITALIC_NORMAL },
103  { "oblique", ITALIC_NORMAL },
104  { nullptr, 0 }
105 };
106 
108 {
109  { "normal", sal_uInt16(SvxCaseMap::NotMapped) },
110  { "small-caps", sal_uInt16(SvxCaseMap::SmallCaps) },
111  { nullptr, 0 }
112 };
113 
115 {
116  { "uppercase", sal_uInt16(SvxCaseMap::Uppercase) },
117  { "lowercase", sal_uInt16(SvxCaseMap::Lowercase) },
118  { "capitalize", sal_uInt16(SvxCaseMap::Capitalize) },
119  { nullptr, 0 }
120 };
121 
123 {
124  { "ltr", sal_uInt16(SvxFrameDirection::Horizontal_LR_TB) },
125  { "rtl", sal_uInt16(SvxFrameDirection::Horizontal_RL_TB) },
126  { "inherit", sal_uInt16(SvxFrameDirection::Environment) },
127  { nullptr, 0 }
128 };
129 
131 {
132  { "repeat", GPOS_TILED },
133  { "repeat-x", GPOS_TILED },
134  { "repeat-y", GPOS_TILED },
135  { "no-repeat", GPOS_NONE },
136  { nullptr, 0 }
137 };
138 
140 {
141  { "left", GPOS_LT },
142  { "center", GPOS_MT },
143  { "right", GPOS_RT },
144  { nullptr, 0 }
145 };
146 
148 {
149  { "top", GPOS_LT },
150  { "middle", GPOS_LM },
151  { "bottom", GPOS_LB },
152  { nullptr, 0 }
153 };
154 
156 {
157  { "left", sal_uInt16(SvxAdjust::Left) },
158  { "center", sal_uInt16(SvxAdjust::Center) },
159  { "right", sal_uInt16(SvxAdjust::Right) },
160  { "justify", sal_uInt16(SvxAdjust::Block) },
161  { nullptr, 0 }
162 };
163 
165 {
166  { "thin", 0 }, // DEF_LINE_WIDTH_0 / DEF_DOUBLE_LINE0
167  { "medium", 1 }, // DEF_LINE_WIDTH_1 / DEF_DOUBLE_LINE1
168  { "thick", 2 }, // DEF_LINE_WIDTH_2 / DEF_DOUBLE_LINE2
169  { nullptr, 0 }
170 };
171 
172 namespace {
173 
174 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 };
175 
176 }
177 
179 {
180  { "none", CSS1_BS_NONE },
181  { "dotted", CSS1_BS_DOTTED },
182  { "dashed", CSS1_BS_DASHED },
183  { "solid", CSS1_BS_SINGLE },
184  { "double", CSS1_BS_DOUBLE },
185  { "groove", CSS1_BS_GROOVE },
186  { "ridge", CSS1_BS_RIDGE },
187  { "inset", CSS1_BS_INSET },
188  { "outset", CSS1_BS_OUTSET },
189  { nullptr, 0 }
190 };
191 
193 {
194  { "left", sal_uInt16(SvxAdjust::Left) },
195  { "right", sal_uInt16(SvxAdjust::Right) },
196  { "none", sal_uInt16(SvxAdjust::End) },
197  { nullptr, 0 }
198 };
199 
201 {
202  { "absolute", SVX_CSS1_POS_ABSOLUTE },
203  { "relative", SVX_CSS1_POS_RELATIVE },
204  { "static", SVX_CSS1_POS_STATIC },
205  { nullptr, 0 }
206 };
207 
208 // Feature: PrintExt
210 {
211  { "auto", SVX_CSS1_STYPE_AUTO },
212  { "landscape", SVX_CSS1_STYPE_LANDSCAPE },
213  { "portrait", SVX_CSS1_STYPE_PORTRAIT },
214  { nullptr, 0 }
215 };
216 
218 {
219  { "auto", SVX_CSS1_PBREAK_AUTO },
220  { "always", SVX_CSS1_PBREAK_ALWAYS },
221  { "avoid", SVX_CSS1_PBREAK_AVOID },
222  { "left", SVX_CSS1_PBREAK_LEFT },
223  { "right", SVX_CSS1_PBREAK_RIGHT },
224  { nullptr, 0 }
225 };
226 
228 {
229  { "decimal", SVX_NUM_ARABIC },
230  { "lower-alpha", SVX_NUM_CHARS_LOWER_LETTER },
231  { "lower-latin", SVX_NUM_CHARS_LOWER_LETTER },
232  { "lower-roman", SVX_NUM_ROMAN_LOWER },
233  { "upper-alpha", SVX_NUM_CHARS_UPPER_LETTER },
234  { "upper-latin", SVX_NUM_CHARS_UPPER_LETTER },
235  { "upper-roman", SVX_NUM_ROMAN_UPPER },
236  { nullptr, 0 }
237 };
238 
240 {
241  { "circle", HTML_BULLETCHAR_CIRCLE },
242  { "disc", HTML_BULLETCHAR_DISC },
243  { "square", HTML_BULLETCHAR_SQUARE },
244  { nullptr, 0 }
245 };
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  sal_uInt16 nLRSpace;
289  sal_uInt16 nULSpace;
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 = initTrueWhich( SID_ATTR_LRSPACE );
740  aItemIds.nULSpace = 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( static_cast<const SvxLRSpaceItem&>(rTargetSet.Get(aItemIds.nLRSpace)) );
945  SvxULSpaceItem aULSpace( static_cast<const SvxULSpaceItem&>(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 =
953  static_cast<const SvxLRSpaceItem&>(rSrcSet.Get( aItemIds.nLRSpace ));
954 
955  if( rSrcInfo.m_bLeftMargin )
956  aLRSpace.SetLeft( rNewLRSpace.GetLeft() );
957  if( rSrcInfo.m_bRightMargin )
958  aLRSpace.SetRight( rNewLRSpace.GetRight() );
959  if( rSrcInfo.m_bTextIndent )
960  aLRSpace.SetTextFirstLineOffset( rNewLRSpace.GetTextFirstLineOffset() );
961 
962  rTargetSet.Put( aLRSpace );
963  }
964 
965  if( rSrcInfo.m_bTopMargin || rSrcInfo.m_bBottomMargin )
966  {
967  const SvxULSpaceItem& rNewULSpace =
968  static_cast<const SvxULSpaceItem&>(rSrcSet.Get( aItemIds.nULSpace ));
969 
970  if( rSrcInfo.m_bTopMargin )
971  aULSpace.SetUpper( rNewULSpace.GetUpper() );
972  if( rSrcInfo.m_bBottomMargin )
973  aULSpace.SetLower( rNewULSpace.GetLower() );
974 
975  rTargetSet.Put( aULSpace );
976  }
977  }
978 
979  rTargetInfo.Merge( rSrcInfo );
980 }
981 
982 void SvxCSS1Parser::SetDfltEncoding( rtl_TextEncoding eEnc )
983 {
984  m_eDefaultEnc = eEnc;
985 }
986 
987 static void ParseCSS1_font_size( const CSS1Expression *pExpr,
988  SfxItemSet &rItemSet,
989  SvxCSS1PropertyInfo& /*rPropInfo*/,
990  const SvxCSS1Parser& rParser )
991 {
992  OSL_ENSURE( pExpr, "no expression" );
993 
994  sal_uLong nHeight = 0;
995  sal_uInt16 nPropHeight = 100;
996 
997  switch( pExpr->GetType() )
998  {
999  case CSS1_LENGTH:
1000  nHeight = pExpr->GetULength();
1001  break;
1002  case CSS1_PIXLENGTH:
1003  {
1004  double fHeight = pExpr->GetNumber();
1005  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
1006  {
1007  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
1008  tools::Long nPWidth = 0;
1009  SvxCSS1Parser::PixelToTwip(nPWidth, nPHeight);
1010  nHeight = static_cast<sal_uLong>(nPHeight);
1011  }
1012  else
1013  {
1014  SAL_WARN("sw.html", "out-of-size pxlength: " << fHeight);
1015  }
1016  }
1017  break;
1018  case CSS1_PERCENTAGE:
1019  // only for drop caps!
1020  nPropHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1021  break;
1022  case CSS1_IDENT:
1023  {
1024  sal_uInt16 nSize;
1025 
1026  if( SvxCSS1Parser::GetEnum( aFontSizeTable, pExpr->GetString(),
1027  nSize ) )
1028  {
1029  nHeight = rParser.GetFontHeight( nSize );
1030  }
1031  }
1032  break;
1033 
1034  default:
1035  ;
1036  }
1037 
1038  if( nHeight || nPropHeight!=100 )
1039  {
1040  SvxFontHeightItem aFontHeight( nHeight, nPropHeight,
1041  aItemIds.nFontHeight );
1042  rItemSet.Put( aFontHeight );
1043  aFontHeight.SetWhich( aItemIds.nFontHeightCJK );
1044  rItemSet.Put( aFontHeight );
1045  aFontHeight.SetWhich( aItemIds.nFontHeightCTL );
1046  rItemSet.Put( aFontHeight );
1047  }
1048 }
1049 
1050 static void ParseCSS1_font_family( const CSS1Expression *pExpr,
1051  SfxItemSet &rItemSet,
1052  SvxCSS1PropertyInfo& /*rPropInfo*/,
1053  const SvxCSS1Parser& rParser )
1054 {
1055  OSL_ENSURE( pExpr, "no expression" );
1056 
1057  OUStringBuffer aName;
1058  rtl_TextEncoding eEnc = rParser.GetDfltEncoding();
1059  const FontList *pFList = rParser.GetFontList();
1060  bool bFirst = true;
1061  bool bFound = false;
1062  while( pExpr && (bFirst || ','==pExpr->GetOp() || !pExpr->GetOp()) )
1063  {
1064  CSS1Token eType = pExpr->GetType();
1065  if( CSS1_IDENT==eType || CSS1_STRING==eType )
1066  {
1067  OUString aIdent( pExpr->GetString() );
1068 
1069  if( CSS1_IDENT==eType )
1070  {
1071  // Collect all following IDs and append them with a space
1072  const CSS1Expression *pNext = pExpr->GetNext();
1073  while( pNext && !pNext->GetOp() &&
1074  CSS1_IDENT==pNext->GetType() )
1075  {
1076  aIdent += " " + pNext->GetString();
1077  pExpr = pNext;
1078  pNext = pExpr->GetNext();
1079  }
1080  }
1081  if( !aIdent.isEmpty() )
1082  {
1083  if( !bFound && pFList )
1084  {
1085  sal_Handle hFont = pFList->GetFirstFontMetric( aIdent );
1086  if( nullptr != hFont )
1087  {
1088  const FontMetric& rFMetric = FontList::GetFontMetric( hFont );
1089  if( RTL_TEXTENCODING_DONTKNOW != rFMetric.GetCharSet() )
1090  {
1091  bFound = true;
1092  if( RTL_TEXTENCODING_SYMBOL == rFMetric.GetCharSet() )
1093  eEnc = RTL_TEXTENCODING_SYMBOL;
1094  }
1095  }
1096  }
1097  if( !bFirst )
1098  aName.append(";");
1099  aName.append(aIdent);
1100  }
1101  }
1102 
1103  pExpr = pExpr->GetNext();
1104  bFirst = false;
1105  }
1106 
1107  if( !aName.isEmpty() && !rParser.IsIgnoreFontFamily() )
1108  {
1109  SvxFontItem aFont( FAMILY_DONTKNOW, aName.makeStringAndClear(), OUString(), PITCH_DONTKNOW,
1110  eEnc, aItemIds.nFont );
1111  rItemSet.Put( aFont );
1112  aFont.SetWhich( aItemIds.nFontCJK );
1113  rItemSet.Put( aFont );
1114  aFont.SetWhich( aItemIds.nFontCTL );
1115  rItemSet.Put( aFont );
1116  }
1117 }
1118 
1119 static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
1120  SfxItemSet &rItemSet,
1121  SvxCSS1PropertyInfo& /*rPropInfo*/,
1122  const SvxCSS1Parser& /*rParser*/ )
1123 {
1124  OSL_ENSURE( pExpr, "no expression" );
1125 
1126  switch( pExpr->GetType() )
1127  {
1128  case CSS1_IDENT:
1129  case CSS1_STRING: // MS-IE, what else
1130  {
1131  sal_uInt16 nWeight;
1132  if( SvxCSS1Parser::GetEnum( aFontWeightTable, pExpr->GetString(),
1133  nWeight ) )
1134  {
1135  SvxWeightItem aWeight( static_cast<FontWeight>(nWeight), aItemIds.nWeight );
1136  rItemSet.Put( aWeight );
1137  aWeight.SetWhich( aItemIds.nWeightCJK );
1138  rItemSet.Put( aWeight );
1139  aWeight.SetWhich( aItemIds.nWeightCTL );
1140  rItemSet.Put( aWeight );
1141  }
1142  }
1143  break;
1144  case CSS1_NUMBER:
1145  {
1146  sal_uInt16 nWeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1147  SvxWeightItem aWeight( nWeight>400 ? WEIGHT_BOLD : WEIGHT_NORMAL,
1148  aItemIds.nWeight );
1149  rItemSet.Put( aWeight );
1150  aWeight.SetWhich( aItemIds.nWeightCJK );
1151  rItemSet.Put( aWeight );
1152  aWeight.SetWhich( aItemIds.nWeightCTL );
1153  rItemSet.Put( aWeight );
1154  }
1155  break;
1156 
1157  default:
1158  ;
1159  }
1160 }
1161 
1162 static void ParseCSS1_font_style( const CSS1Expression *pExpr,
1163  SfxItemSet &rItemSet,
1164  SvxCSS1PropertyInfo& /*rPropInfo*/,
1165  const SvxCSS1Parser& /*rParser*/ )
1166 {
1167  OSL_ENSURE( pExpr, "no expression" );
1168 
1169  bool bPosture = false;
1170  bool bCaseMap = false;
1171  FontItalic eItalic = ITALIC_NONE;
1172  SvxCaseMap eCaseMap = SvxCaseMap::NotMapped;
1173 
1174  // normal | italic || small-caps | oblique || small-caps | small-caps
1175  // (only normal, italic and oblique are valid)
1176 
1177  // the value can have two values!
1178  for( int i=0; pExpr && i<2; ++i )
1179  {
1180  // also here MS-IE parser leaves traces
1181  if( (CSS1_IDENT==pExpr->GetType() || CSS1_STRING==pExpr->GetType()) &&
1182  !pExpr->GetOp() )
1183  {
1184  const OUString& rValue = pExpr->GetString();
1185  // first check if the value is italic or 'normal'
1186  sal_uInt16 nItalic;
1187  if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nItalic ) )
1188  {
1189  eItalic = static_cast<FontItalic>(nItalic);
1190  if( !bCaseMap && ITALIC_NONE==eItalic )
1191  {
1192  // for 'normal' we must also exclude case-map
1193  eCaseMap = SvxCaseMap::NotMapped;
1194  bCaseMap = true;
1195  }
1196  bPosture = true;
1197  }
1198  else if( !bCaseMap &&
1199  rValue.equalsIgnoreAsciiCase( "small-caps" ) )
1200  {
1201  eCaseMap = SvxCaseMap::SmallCaps;
1202  bCaseMap = true;
1203  }
1204  }
1205 
1206  // fetch next expression
1207  pExpr = pExpr->GetNext();
1208  }
1209 
1210  if( bPosture )
1211  {
1212  SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
1213  rItemSet.Put( aPosture );
1214  aPosture.SetWhich( aItemIds.nPostureCJK );
1215  rItemSet.Put( aPosture );
1216  aPosture.SetWhich( aItemIds.nPostureCTL );
1217  rItemSet.Put( aPosture );
1218  }
1219 
1220  if( bCaseMap )
1221  rItemSet.Put( SvxCaseMapItem( eCaseMap, aItemIds.nCaseMap ) );
1222 }
1223 
1224 static void ParseCSS1_font_variant( const CSS1Expression *pExpr,
1225  SfxItemSet &rItemSet,
1226  SvxCSS1PropertyInfo& /*rPropInfo*/,
1227  const SvxCSS1Parser& /*rParser*/ )
1228 {
1229  assert(pExpr && "no expression");
1230 
1231  // normal | small-caps
1232  switch( pExpr->GetType() )
1233  {
1234  case CSS1_IDENT:
1235  {
1236  sal_uInt16 nCaseMap;
1237  if( SvxCSS1Parser::GetEnum( aFontVariantTable, pExpr->GetString(),
1238  nCaseMap ) )
1239  {
1240  rItemSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(nCaseMap),
1241  aItemIds.nCaseMap ) );
1242  }
1243  break;
1244  }
1245  default:
1246  break;
1247  }
1248 }
1249 
1250 static void ParseCSS1_text_transform( const CSS1Expression *pExpr,
1251  SfxItemSet &rItemSet,
1252  SvxCSS1PropertyInfo& /*rPropInfo*/,
1253  const SvxCSS1Parser& /*rParser*/ )
1254 {
1255  OSL_ENSURE( pExpr, "no expression" );
1256 
1257  // none | capitalize | uppercase | lowercase
1258 
1259  switch( pExpr->GetType() )
1260  {
1261  case CSS1_IDENT:
1262  {
1263  sal_uInt16 nCaseMap;
1264  if( SvxCSS1Parser::GetEnum( aTextTransformTable, pExpr->GetString(),
1265  nCaseMap ) )
1266  {
1267  rItemSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(nCaseMap),
1268  aItemIds.nCaseMap ) );
1269  }
1270  break;
1271  }
1272  default:
1273  break;
1274  }
1275 }
1276 
1277 static void ParseCSS1_color( const CSS1Expression *pExpr,
1278  SfxItemSet &rItemSet,
1279  SvxCSS1PropertyInfo& /*rPropInfo*/,
1280  const SvxCSS1Parser& /*rParser*/ )
1281 {
1282  OSL_ENSURE( pExpr, "no expression" );
1283 
1284  switch( pExpr->GetType() )
1285  {
1286  case CSS1_IDENT:
1287  case CSS1_RGB:
1288  case CSS1_HEXCOLOR:
1289  case CSS1_STRING: // because MS-IE
1290  {
1291  Color aColor;
1292  if( pExpr->GetColor( aColor ) )
1293  rItemSet.Put( SvxColorItem( aColor, aItemIds.nColor ) );
1294  }
1295  break;
1296  default:
1297  ;
1298  }
1299 }
1300 
1301 static void ParseCSS1_column_count( const CSS1Expression *pExpr,
1302  SfxItemSet& /*rItemSet*/,
1303  SvxCSS1PropertyInfo &rPropInfo,
1304  const SvxCSS1Parser& /*rParser*/ )
1305 {
1306  assert(pExpr && "no expression");
1307 
1308  if ( pExpr->GetType() == CSS1_NUMBER )
1309  {
1310  double columnCount = pExpr->GetNumber();
1311  if ( columnCount >= 2 )
1312  {
1313  rPropInfo.m_nColumnCount = columnCount;
1314  }
1315  }
1316 }
1317 
1318 static void ParseCSS1_direction( const CSS1Expression *pExpr,
1319  SfxItemSet &rItemSet,
1320  SvxCSS1PropertyInfo& /*rPropInfo*/,
1321  const SvxCSS1Parser& /*rParser*/ )
1322 {
1323  assert(pExpr && "no expression");
1324 
1325  sal_uInt16 nDir;
1326  switch( pExpr->GetType() )
1327  {
1328  case CSS1_IDENT:
1329  case CSS1_STRING:
1330  if( SvxCSS1Parser::GetEnum( aDirectionTable, pExpr->GetString(),
1331  nDir ) )
1332  {
1333  rItemSet.Put( SvxFrameDirectionItem(
1334  static_cast < SvxFrameDirection >( nDir ),
1335  aItemIds.nDirection ) );
1336  }
1337  break;
1338  default:
1339  ;
1340  }
1341 }
1342 
1344 {
1345  OSL_ENSURE( GPOS_LT==eHori || GPOS_MT==eHori || GPOS_RT==eHori,
1346  "vertical position not at the top" );
1347 
1348  switch( ePos )
1349  {
1350  case GPOS_LT:
1351  case GPOS_MT:
1352  case GPOS_RT:
1353  ePos = eHori;
1354  break;
1355 
1356  case GPOS_LM:
1357  case GPOS_MM:
1358  case GPOS_RM:
1359  ePos = GPOS_LT==eHori ? GPOS_LM : (GPOS_MT==eHori ? GPOS_MM : GPOS_RM);
1360  break;
1361 
1362  case GPOS_LB:
1363  case GPOS_MB:
1364  case GPOS_RB:
1365  ePos = GPOS_LT==eHori ? GPOS_LB : (GPOS_MT==eHori ? GPOS_MB : GPOS_RB);
1366  break;
1367 
1368  default:
1369  ;
1370  }
1371 }
1372 
1374 {
1375  OSL_ENSURE( GPOS_LT==eVert || GPOS_LM==eVert || GPOS_LB==eVert,
1376  "horizontal position not on the left side" );
1377 
1378  switch( ePos )
1379  {
1380  case GPOS_LT:
1381  case GPOS_LM:
1382  case GPOS_LB:
1383  ePos = eVert;
1384  break;
1385 
1386  case GPOS_MT:
1387  case GPOS_MM:
1388  case GPOS_MB:
1389  ePos = GPOS_LT==eVert ? GPOS_MT : (GPOS_LM==eVert ? GPOS_MM : GPOS_MB);
1390  break;
1391 
1392  case GPOS_RT:
1393  case GPOS_RM:
1394  case GPOS_RB:
1395  ePos = GPOS_LT==eVert ? GPOS_RT : (GPOS_LM==eVert ? GPOS_RM : GPOS_RB);
1396  break;
1397 
1398  default:
1399  ;
1400  }
1401 }
1402 
1403 static void ParseCSS1_background( const CSS1Expression *pExpr,
1404  SfxItemSet &rItemSet,
1405  SvxCSS1PropertyInfo& /*rPropInfo*/,
1406  const SvxCSS1Parser& rParser )
1407 {
1408  OSL_ENSURE( pExpr, "no expression" );
1409 
1410  Color aColor;
1411  OUString aURL;
1412 
1413  bool bColor = false, bTransparent = false;
1414  SvxGraphicPosition eRepeat = GPOS_TILED;
1416  bool bHori = false, bVert = false;
1417 
1418  while( pExpr && !pExpr->GetOp() )
1419  {
1420  switch( pExpr->GetType() )
1421  {
1422  case CSS1_URL:
1423  pExpr->GetURL( aURL );
1424  break;
1425 
1426  case CSS1_RGB:
1427  bColor = pExpr->GetColor( aColor );
1428  break;
1429 
1430  case CSS1_LENGTH:
1431  case CSS1_PIXLENGTH:
1432  {
1433  // since we don't know any absolute position, we
1434  // only distinguish between 0 and !0. Therefore pixel
1435  // can be handled like all other units.
1436 
1437  bool nonZero = std::trunc(pExpr->GetNumber()) != 0.0;
1438  if( !bHori )
1439  {
1440  ePos = nonZero ? GPOS_MM : GPOS_LT;
1441  bHori = true;
1442  }
1443  else if( !bVert )
1444  {
1445  MergeVert( ePos, (nonZero ? GPOS_LM : GPOS_LT) );
1446  bVert = true;
1447  }
1448  }
1449  break;
1450 
1451  case CSS1_PERCENTAGE:
1452  {
1453  // the percentage is converted to an enum
1454 
1455  sal_uInt16 nPerc = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1456  if( !bHori )
1457  {
1458  ePos = nPerc < 25 ? GPOS_LT
1459  : (nPerc < 75 ? GPOS_MM
1460  : GPOS_RB);
1461  }
1462  else if( !bVert )
1463  {
1464  SvxGraphicPosition eVert =
1465  nPerc < 25 ? GPOS_LT: (nPerc < 75 ? GPOS_LM
1466  : GPOS_LB);
1467  MergeVert( ePos, eVert );
1468  }
1469  }
1470  break;
1471 
1472  case CSS1_IDENT:
1473  case CSS1_HEXCOLOR:
1474  case CSS1_STRING: // because of MS-IE
1475  {
1476  sal_uInt16 nEnum;
1477  const OUString &rValue = pExpr->GetString();
1478  if( rValue.equalsIgnoreAsciiCase( "transparent" ) )
1479  {
1480  bTransparent = true;
1481  }
1482  if( SvxCSS1Parser::GetEnum( aBGRepeatTable, rValue, nEnum ) )
1483  {
1484  eRepeat = static_cast<SvxGraphicPosition>(nEnum);
1485  }
1486  else if( SvxCSS1Parser::GetEnum( aBGHoriPosTable, rValue, nEnum ) )
1487  {
1488  // <position>, horizontal
1489  MergeHori( ePos, static_cast<SvxGraphicPosition>(nEnum) );
1490  }
1491  else if( SvxCSS1Parser::GetEnum( aBGVertPosTable, rValue, nEnum ) )
1492  {
1493  // <position>, vertical
1494  MergeVert( ePos, static_cast<SvxGraphicPosition>(nEnum) );
1495  }
1496  else if( !bColor )
1497  {
1498  // <color>
1499  bColor = pExpr->GetColor( aColor );
1500  }
1501  // <scroll> we don't know
1502  }
1503  break;
1504 
1505  default:
1506  ;
1507  }
1508 
1509  pExpr = pExpr->GetNext();
1510  }
1511 
1512  // transparent beats everything
1513  if( bTransparent )
1514  {
1515  bColor = false;
1516  aURL.clear();
1517  }
1518 
1519  // repeat has priority over a position
1520  if( GPOS_NONE == eRepeat )
1521  eRepeat = ePos;
1522 
1523  if( !bTransparent && !bColor && aURL.isEmpty() )
1524  return;
1525 
1526  SvxBrushItem aBrushItem( aItemIds.nBrush );
1527 
1528  if( bTransparent )
1529  aBrushItem.SetColor( COL_TRANSPARENT);
1530  else if( bColor )
1531  aBrushItem.SetColor( aColor );
1532 
1533  if( !aURL.isEmpty() )
1534  {
1535  aBrushItem.SetGraphicLink( URIHelper::SmartRel2Abs( INetURLObject( rParser.GetBaseURL()), aURL, Link<OUString *, bool>(), false ) );
1536  aBrushItem.SetGraphicPos( eRepeat );
1537  }
1538 
1539  rItemSet.Put( aBrushItem );
1540 }
1541 
1542 static void ParseCSS1_background_color( const CSS1Expression *pExpr,
1543  SfxItemSet &rItemSet,
1544  SvxCSS1PropertyInfo& /*rPropInfo*/,
1545  const SvxCSS1Parser& /*rParser*/ )
1546 {
1547  OSL_ENSURE( pExpr, "no expression" );
1548 
1549  Color aColor;
1550 
1551  bool bColor = false, bTransparent = false;
1552 
1553  switch( pExpr->GetType() )
1554  {
1555  case CSS1_RGB:
1556  bColor = pExpr->GetColor( aColor );
1557  break;
1558  case CSS1_IDENT:
1559  case CSS1_HEXCOLOR:
1560  case CSS1_STRING: // because of MS-IE
1561  if( pExpr->GetString().equalsIgnoreAsciiCase( "transparent" ) )
1562  {
1563  bTransparent = true;
1564  }
1565  else
1566  {
1567  // <color>
1568  bColor = pExpr->GetColor( aColor );
1569  }
1570  break;
1571  default:
1572  ;
1573  }
1574 
1575  if( bTransparent || bColor )
1576  {
1577  SvxBrushItem aBrushItem( aItemIds.nBrush );
1578 
1579  if( bTransparent )
1580  aBrushItem.SetColor( COL_TRANSPARENT );
1581  else if( bColor )
1582  aBrushItem.SetColor( aColor);
1583 
1584  rItemSet.Put( aBrushItem );
1585  }
1586 }
1587 
1588 static void ParseCSS1_line_height( const CSS1Expression *pExpr,
1589  SfxItemSet &rItemSet,
1590  SvxCSS1PropertyInfo& /*rPropInfo*/,
1591  const SvxCSS1Parser& )
1592 {
1593  OSL_ENSURE( pExpr, "no expression" );
1594 
1595  sal_uInt16 nHeight = 0;
1596  sal_uInt16 nPropHeight = 0;
1597 
1598  switch( pExpr->GetType() )
1599  {
1600  case CSS1_LENGTH:
1601  nHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetULength());
1602  break;
1603  case CSS1_PIXLENGTH:
1604  {
1605  double fHeight = pExpr->GetNumber();
1606  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
1607  {
1608  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
1609  tools::Long nPWidth = 0;
1610  SvxCSS1Parser::PixelToTwip(nPWidth, nPHeight);
1611  nHeight = o3tl::narrowing<sal_uInt16>(nPHeight);
1612  }
1613  }
1614  break;
1615  case CSS1_PERCENTAGE:
1616  {
1617  nPropHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber());
1618  }
1619  break;
1620  case CSS1_NUMBER:
1621  {
1622  nPropHeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber() * 100);
1623  }
1624  break;
1625  default:
1626  ;
1627  }
1628 
1629  if( nHeight )
1630  {
1631  if( nHeight < SvxCSS1Parser::GetMinFixLineSpace() )
1633  SvxLineSpacingItem aLSItem( nHeight, aItemIds.nLineSpacing );
1634  aLSItem.SetLineHeight( nHeight );
1635  // interpret <line-height> attribute as minimum line height
1636  aLSItem.SetLineSpaceRule( SvxLineSpaceRule::Min );
1637  aLSItem.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
1638  rItemSet.Put( aLSItem );
1639  }
1640  else if( nPropHeight )
1641  {
1642  SvxLineSpacingItem aLSItem( nPropHeight, aItemIds.nLineSpacing );
1643  aLSItem.SetLineSpaceRule( SvxLineSpaceRule::Auto );
1644  if( 100 == nPropHeight )
1645  aLSItem.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
1646  else
1647  aLSItem.SetPropLineSpace( nPropHeight );
1648  rItemSet.Put( aLSItem );
1649  }
1650 
1651 }
1652 
1653 static void ParseCSS1_list_style_type( const CSS1Expression *pExpr,
1654  SfxItemSet & /*rItemSet*/,
1655  SvxCSS1PropertyInfo& rPropInfo,
1656  const SvxCSS1Parser& /*rParser*/ )
1657 {
1658  OSL_ENSURE( pExpr, "no expression" );
1659 
1660  if( pExpr->GetType() != CSS1_IDENT )
1661  return;
1662 
1663  const OUString& rValue = pExpr->GetString();
1664 
1665  // values are context-dependent, so fill both
1666  sal_uInt16 nEnum;
1667  if( SvxCSS1Parser::GetEnum( aNumberStyleTable, rValue, nEnum ) )
1668  {
1669  rPropInfo.m_bNumbering = true;
1670  rPropInfo.m_nNumberingType = static_cast<SvxNumType>(nEnum);
1671  }
1672  if( SvxCSS1Parser::GetEnum( aBulletStyleTable, rValue, nEnum ) )
1673  {
1674  rPropInfo.m_bBullet = true;
1675  rPropInfo.m_cBulletChar = nEnum;
1676  }
1677 }
1678 
1679 static void ParseCSS1_font( const CSS1Expression *pExpr,
1680  SfxItemSet &rItemSet,
1681  SvxCSS1PropertyInfo& rPropInfo,
1682  const SvxCSS1Parser& rParser )
1683 {
1684  OSL_ENSURE( pExpr, "no expression" );
1685 
1686  FontItalic eItalic = ITALIC_NONE;
1687  SvxCaseMap eCaseMap = SvxCaseMap::NotMapped;
1688  FontWeight eWeight = WEIGHT_NORMAL;
1689 
1690  // [ <font-style> || <font-variant> || <font-weight> ] ?
1691  while( pExpr && !pExpr->GetOp() &&
1692  (CSS1_IDENT==pExpr->GetType() ||
1693  CSS1_STRING==pExpr->GetType() ||
1694  CSS1_NUMBER==pExpr->GetType()) )
1695  {
1696  if( CSS1_IDENT==pExpr->GetType() ||
1697  CSS1_STRING==pExpr->GetType() )
1698  {
1699  const OUString& rValue = pExpr->GetString();
1700 
1701  sal_uInt16 nEnum;
1702 
1703  if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nEnum ) )
1704  {
1705  eItalic = static_cast<FontItalic>(nEnum);
1706  }
1707  else if( SvxCSS1Parser::GetEnum( aFontVariantTable, rValue, nEnum ) )
1708  {
1709  eCaseMap = static_cast<SvxCaseMap>(nEnum);
1710  }
1711  else if( SvxCSS1Parser::GetEnum( aFontWeightTable, rValue, nEnum ) )
1712  {
1713  eWeight = static_cast<FontWeight>(nEnum);
1714  }
1715  }
1716  else
1717  {
1718  eWeight = o3tl::narrowing<sal_uInt16>(pExpr->GetNumber()) > 400 ? WEIGHT_BOLD
1719  : WEIGHT_NORMAL;
1720  }
1721 
1722  pExpr = pExpr->GetNext();
1723  }
1724 
1725  if( !pExpr || pExpr->GetOp() )
1726  return;
1727 
1728  // Since "font" resets all values for which nothing is specified,
1729  // we do it here.
1730  SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
1731  rItemSet.Put( aPosture );
1732  aPosture.SetWhich( aItemIds.nPostureCJK );
1733  rItemSet.Put( aPosture );
1734  aPosture.SetWhich( aItemIds.nPostureCTL );
1735  rItemSet.Put( aPosture );
1736 
1737  rItemSet.Put( SvxCaseMapItem( eCaseMap, aItemIds.nCaseMap ) );
1738 
1739  SvxWeightItem aWeight( eWeight, aItemIds.nWeight );
1740  rItemSet.Put( aWeight );
1741  aWeight.SetWhich( aItemIds.nWeightCJK );
1742  rItemSet.Put( aWeight );
1743  aWeight.SetWhich( aItemIds.nWeightCTL );
1744  rItemSet.Put( aWeight );
1745 
1746  // font-size
1747  CSS1Expression aExpr( pExpr->GetType(), pExpr->GetString(),
1748  pExpr->GetNumber() );
1749  ParseCSS1_font_size( &aExpr, rItemSet, rPropInfo, rParser );
1750  pExpr = pExpr->GetNext();
1751 
1752  if( !pExpr )
1753  return;
1754 
1755  // [ '/' line-height ]?
1756  if( '/' == pExpr->GetOp() )
1757  {
1758  // '/' line-height
1759  aExpr.Set( pExpr->GetType(), pExpr->GetString(), pExpr->GetNumber() );
1760  ParseCSS1_line_height( &aExpr, rItemSet, rPropInfo, rParser );
1761 
1762  pExpr = pExpr->GetNext();
1763  }
1764 
1765  if( !pExpr || pExpr->GetOp() )
1766  return;
1767 
1768  // font-family
1769  ParseCSS1_font_family( pExpr, rItemSet, rPropInfo, rParser );
1770 }
1771 
1772 static void ParseCSS1_letter_spacing( const CSS1Expression *pExpr,
1773  SfxItemSet &rItemSet,
1774  SvxCSS1PropertyInfo& /*rPropInfo*/,
1775  const SvxCSS1Parser& /*rParser*/ )
1776 {
1777  OSL_ENSURE( pExpr, "no expression" );
1778 
1779  switch( pExpr->GetType() )
1780  {
1781  case CSS1_LENGTH:
1782  rItemSet.Put( SvxKerningItem( static_cast<short>(pExpr->GetSLength()),
1783  aItemIds.nKerning ) );
1784  break;
1785 
1786  case CSS1_PIXLENGTH:
1787  {
1788  double fHeight = pExpr->GetNumber();
1789  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
1790  {
1791  tools::Long nPWidth = static_cast<tools::Long>(fHeight);
1792  tools::Long nPHeight = 0;
1793  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
1794  rItemSet.Put( SvxKerningItem( static_cast<short>(nPWidth), aItemIds.nKerning ) );
1795  }
1796  }
1797  break;
1798 
1799  case CSS1_NUMBER:
1800  if( pExpr->GetNumber() == 0 )
1801  {
1802  // normally unnecessary, but we are tolerant
1803  rItemSet.Put( SvxKerningItem( short(0), aItemIds.nKerning ) );
1804  }
1805  break;
1806 
1807  case CSS1_IDENT:
1808  case CSS1_STRING: // As a precaution also MS-IE
1809  if( pExpr->GetString().equalsIgnoreAsciiCase( "normal" ) )
1810  {
1811  rItemSet.Put( SvxKerningItem( short(0), aItemIds.nKerning ) );
1812  }
1813  break;
1814  default:
1815  ;
1816  }
1817 }
1818 
1819 static void ParseCSS1_text_decoration( const CSS1Expression *pExpr,
1820  SfxItemSet &rItemSet,
1821  SvxCSS1PropertyInfo& /*rPropInfo*/,
1822  const SvxCSS1Parser& /*rParser*/ )
1823 {
1824  OSL_ENSURE( pExpr, "no expression" );
1825 
1826  bool bUnderline = false;
1827  bool bOverline = false;
1828  bool bCrossedOut = false;
1829  bool bBlink = false;
1830  bool bBlinkOn = false;
1831  FontLineStyle eUnderline = LINESTYLE_NONE;
1832  FontLineStyle eOverline = LINESTYLE_NONE;
1833  FontStrikeout eCrossedOut = STRIKEOUT_NONE;
1834 
1835  // the value can contain two values! And MS-IE also strings
1836  while( pExpr && (pExpr->GetType() == CSS1_IDENT ||
1837  pExpr->GetType() == CSS1_STRING) && !pExpr->GetOp() )
1838  {
1839  OUString aValue = pExpr->GetString().toAsciiLowerCase();
1840  bool bKnown = false;
1841 
1842  switch( aValue[0] )
1843  {
1844  case 'n':
1845  if( aValue == "none" )
1846  {
1847  bUnderline = true;
1848  eUnderline = LINESTYLE_NONE;
1849 
1850  bOverline = true;
1851  eOverline = LINESTYLE_NONE;
1852 
1853  bCrossedOut = true;
1854  eCrossedOut = STRIKEOUT_NONE;
1855 
1856  bBlink = true;
1857  bBlinkOn = false;
1858 
1859  bKnown = true;
1860  }
1861  break;
1862 
1863  case 'u':
1864  if( aValue == "underline" )
1865  {
1866  bUnderline = true;
1867  eUnderline = LINESTYLE_SINGLE;
1868 
1869  bKnown = true;
1870  }
1871  break;
1872 
1873  case 'o':
1874  if( aValue == "overline" )
1875  {
1876  bOverline = true;
1877  eOverline = LINESTYLE_SINGLE;
1878 
1879  bKnown = true;
1880  }
1881  break;
1882 
1883  case 'l':
1884  if( aValue == "line-through" )
1885  {
1886  bCrossedOut = true;
1887  eCrossedOut = STRIKEOUT_SINGLE;
1888 
1889  bKnown = true;
1890  }
1891  break;
1892 
1893  case 'b':
1894  if( aValue == "blink" )
1895  {
1896  bBlink = true;
1897  bBlinkOn = true;
1898 
1899  bKnown = true;
1900  }
1901  break;
1902  }
1903 
1904  if( !bKnown )
1905  {
1906  bUnderline = true;
1907  eUnderline = LINESTYLE_SINGLE;
1908  }
1909 
1910  pExpr = pExpr->GetNext();
1911  }
1912 
1913  if( bUnderline )
1914  rItemSet.Put( SvxUnderlineItem( eUnderline, aItemIds.nUnderline ) );
1915 
1916  if( bOverline )
1917  rItemSet.Put( SvxOverlineItem( eOverline, aItemIds.nOverline ) );
1918 
1919  if( bCrossedOut )
1920  rItemSet.Put( SvxCrossedOutItem( eCrossedOut, aItemIds.nCrossedOut ) );
1921 
1922  if( bBlink )
1923  rItemSet.Put( SvxBlinkItem( bBlinkOn, aItemIds.nBlink ) );
1924 }
1925 
1926 static void ParseCSS1_text_align( const CSS1Expression *pExpr,
1927  SfxItemSet &rItemSet,
1928  SvxCSS1PropertyInfo& /*rPropInfo*/,
1929  const SvxCSS1Parser& /*rParser*/ )
1930 {
1931  OSL_ENSURE( pExpr, "no expression" );
1932 
1933  if( CSS1_IDENT==pExpr->GetType() ||
1934  CSS1_STRING==pExpr->GetType() ) // MS-IE, again
1935  {
1936  sal_uInt16 nAdjust;
1937  if( SvxCSS1Parser::GetEnum( aTextAlignTable, pExpr->GetString(),
1938  nAdjust ) )
1939  {
1940  rItemSet.Put( SvxAdjustItem( static_cast<SvxAdjust>(nAdjust),
1941  aItemIds.nAdjust ) );
1942  }
1943  }
1944 }
1945 
1946 static void ParseCSS1_text_indent( const CSS1Expression *pExpr,
1947  SfxItemSet &rItemSet,
1948  SvxCSS1PropertyInfo& rPropInfo,
1949  const SvxCSS1Parser& /*rParser*/ )
1950 {
1951  OSL_ENSURE( pExpr, "no expression" );
1952 
1953  short nIndent = 0;
1954  bool bSet = false;
1955  switch( pExpr->GetType() )
1956  {
1957  case CSS1_LENGTH:
1958  nIndent = static_cast<short>(pExpr->GetSLength());
1959  bSet = true;
1960  break;
1961  case CSS1_PIXLENGTH:
1962  {
1963  double fWidth = pExpr->GetNumber();
1964  if (fWidth < SAL_MAX_INT32/2.0 && fWidth > SAL_MIN_INT32/2.0)
1965  {
1966  tools::Long nPWidth = static_cast<tools::Long>(fWidth);
1967  tools::Long nPHeight = 0;
1968  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
1969  nIndent = static_cast<short>(nPWidth);
1970  bSet = true;
1971  }
1972  }
1973  break;
1974  case CSS1_PERCENTAGE:
1975  // we aren't able
1976  break;
1977  default:
1978  ;
1979  }
1980 
1981  if( !bSet )
1982  return;
1983 
1984  const SfxPoolItem* pItem;
1985  if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
1986  &pItem ) )
1987  {
1988  SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
1989  aLRItem.SetTextFirstLineOffset( nIndent );
1990  rItemSet.Put( aLRItem );
1991  }
1992  else
1993  {
1994  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
1995  aLRItem.SetTextFirstLineOffset( nIndent );
1996  rItemSet.Put( aLRItem );
1997  }
1998  rPropInfo.m_bTextIndent = true;
1999 }
2000 
2001 static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
2002  SfxItemSet &rItemSet,
2003  SvxCSS1PropertyInfo& rPropInfo,
2004  const SvxCSS1Parser& /*rParser*/ )
2005 {
2006  OSL_ENSURE( pExpr, "no expression" );
2007 
2008  tools::Long nLeft = 0;
2009  bool bSet = false;
2010  switch( pExpr->GetType() )
2011  {
2012  case CSS1_LENGTH:
2013  {
2014  nLeft = pExpr->GetSLength();
2015  bSet = true;
2016  }
2017  break;
2018  case CSS1_PIXLENGTH:
2019  {
2020  double fLeft = pExpr->GetNumber();
2021  if (fLeft < SAL_MAX_INT32/2.0 && fLeft > SAL_MIN_INT32/2.0)
2022  {
2023  nLeft = static_cast<tools::Long>(fLeft);
2024  tools::Long nPHeight = 0;
2025  SvxCSS1Parser::PixelToTwip( nLeft, nPHeight );
2026  bSet = true;
2027  }
2028  else
2029  {
2030  SAL_WARN("sw.html", "out-of-size pxlength: " << fLeft);
2031  }
2032  }
2033  break;
2034  case CSS1_PERCENTAGE:
2035  // we aren't able
2036  break;
2037  default:
2038  ;
2039  }
2040 
2041  if( !bSet )
2042  return;
2043 
2044  rPropInfo.m_nLeftMargin = nLeft;
2045  if( nLeft < 0 )
2046  nLeft = 0;
2047  const SfxPoolItem* pItem;
2048  if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
2049  &pItem ) )
2050  {
2051  SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
2052  aLRItem.SetTextLeft( o3tl::narrowing<sal_uInt16>(nLeft) );
2053  rItemSet.Put( aLRItem );
2054  }
2055  else
2056  {
2057  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2058  aLRItem.SetTextLeft( o3tl::narrowing<sal_uInt16>(nLeft) );
2059  rItemSet.Put( aLRItem );
2060  }
2061  rPropInfo.m_bLeftMargin = true;
2062 }
2063 
2064 static void ParseCSS1_margin_right( const CSS1Expression *pExpr,
2065  SfxItemSet &rItemSet,
2066  SvxCSS1PropertyInfo& rPropInfo,
2067  const SvxCSS1Parser& /*rParser*/ )
2068 {
2069  OSL_ENSURE( pExpr, "no expression" );
2070 
2071  tools::Long nRight = 0;
2072  bool bSet = false;
2073  switch( pExpr->GetType() )
2074  {
2075  case CSS1_LENGTH:
2076  {
2077  nRight = pExpr->GetSLength();
2078  bSet = true;
2079  }
2080  break;
2081  case CSS1_PIXLENGTH:
2082  {
2083  double fRight = pExpr->GetNumber();
2084  if (fRight < SAL_MAX_INT32/2.0 && fRight > SAL_MIN_INT32/2.0)
2085  {
2086  nRight = static_cast<tools::Long>(fRight);
2087  tools::Long nPHeight = 0;
2088  SvxCSS1Parser::PixelToTwip( nRight, nPHeight );
2089  bSet = true;
2090  }
2091  }
2092  break;
2093  case CSS1_PERCENTAGE:
2094  // we aren't able
2095  break;
2096  default:
2097  ;
2098  }
2099 
2100  if( !bSet )
2101  return;
2102 
2103  rPropInfo.m_nRightMargin = nRight;
2104  if( nRight < 0 )
2105  nRight = 0;
2106  const SfxPoolItem* pItem;
2107  if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
2108  &pItem ) )
2109  {
2110  SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
2111  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nRight) );
2112  rItemSet.Put( aLRItem );
2113  }
2114  else
2115  {
2116  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2117  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nRight) );
2118  rItemSet.Put( aLRItem );
2119  }
2120  rPropInfo.m_bRightMargin = true;
2121 }
2122 
2123 static void ParseCSS1_margin_top( const CSS1Expression *pExpr,
2124  SfxItemSet &rItemSet,
2125  SvxCSS1PropertyInfo& rPropInfo,
2126  const SvxCSS1Parser& /*rParser*/ )
2127 {
2128  assert(pExpr && "no expression");
2129 
2130  sal_uInt16 nUpper = 0;
2131  bool bSet = false;
2132  switch( pExpr->GetType() )
2133  {
2134  case CSS1_LENGTH:
2135  {
2136  tools::Long nTmp = pExpr->GetSLength();
2137  if( nTmp < 0 )
2138  nTmp = 0;
2139  nUpper = o3tl::narrowing<sal_uInt16>(nTmp);
2140  bSet = true;
2141  }
2142  break;
2143  case CSS1_PIXLENGTH:
2144  {
2145  double fHeight = pExpr->GetNumber();
2146  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
2147  {
2148  tools::Long nPWidth = 0;
2149  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
2150  if( nPHeight < 0 )
2151  nPHeight = 0;
2152  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2153  nUpper = o3tl::narrowing<sal_uInt16>(nPHeight);
2154  bSet = true;
2155  }
2156  }
2157  break;
2158  case CSS1_PERCENTAGE:
2159  // we aren't able
2160  break;
2161  default:
2162  ;
2163  }
2164 
2165  if( !bSet )
2166  return;
2167 
2168  const SfxPoolItem* pItem;
2169  if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
2170  &pItem ) )
2171  {
2172  SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
2173  aULItem.SetUpper( nUpper );
2174  rItemSet.Put( aULItem );
2175  }
2176  else
2177  {
2178  SvxULSpaceItem aULItem( aItemIds.nULSpace );
2179  aULItem.SetUpper( nUpper );
2180  rItemSet.Put( aULItem );
2181  }
2182  rPropInfo.m_bTopMargin = true;
2183 }
2184 
2185 static void ParseCSS1_margin_bottom( const CSS1Expression *pExpr,
2186  SfxItemSet &rItemSet,
2187  SvxCSS1PropertyInfo& rPropInfo,
2188  const SvxCSS1Parser& /*rParser*/ )
2189 {
2190  OSL_ENSURE( pExpr, "no expression" );
2191 
2192  sal_uInt16 nLower = 0;
2193  bool bSet = false;
2194  switch( pExpr->GetType() )
2195  {
2196  case CSS1_LENGTH:
2197  {
2198  tools::Long nTmp = pExpr->GetSLength();
2199  if( nTmp < 0 )
2200  nTmp = 0;
2201  nLower = o3tl::narrowing<sal_uInt16>(nTmp);
2202  bSet = true;
2203  }
2204  break;
2205  case CSS1_PIXLENGTH:
2206  {
2207  double fHeight = pExpr->GetNumber();
2208  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
2209  {
2210  tools::Long nPWidth = 0;
2211  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
2212  if( nPHeight < 0 )
2213  nPHeight = 0;
2214  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2215  nLower = o3tl::narrowing<sal_uInt16>(nPHeight);
2216  bSet = true;
2217  }
2218  }
2219  break;
2220  case CSS1_PERCENTAGE:
2221  // we aren't able
2222  break;
2223  default:
2224  ;
2225  }
2226 
2227  if( !bSet )
2228  return;
2229 
2230  const SfxPoolItem* pItem;
2231  if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
2232  &pItem ) )
2233  {
2234  SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
2235  aULItem.SetLower( nLower );
2236  rItemSet.Put( aULItem );
2237  }
2238  else
2239  {
2240  SvxULSpaceItem aULItem( aItemIds.nULSpace );
2241  aULItem.SetLower( nLower );
2242  rItemSet.Put( aULItem );
2243  }
2244  rPropInfo.m_bBottomMargin = true;
2245 }
2246 
2247 static void ParseCSS1_margin( const CSS1Expression *pExpr,
2248  SfxItemSet &rItemSet,
2249  SvxCSS1PropertyInfo& rPropInfo,
2250  const SvxCSS1Parser& /*rParser*/ )
2251 {
2252  OSL_ENSURE( pExpr, "no expression" );
2253 
2254  tools::Long nMargins[4] = { 0, 0, 0, 0 };
2255  bool bSetMargins[4] = { false, false, false, false };
2256 
2257  for( int i=0; pExpr && i<4 && !pExpr->GetOp(); ++i )
2258  {
2259  bool bSetThis = false;
2260  tools::Long nMargin = 0;
2261 
2262  switch( pExpr->GetType() )
2263  {
2264  case CSS1_LENGTH:
2265  {
2266  nMargin = pExpr->GetSLength();
2267  bSetThis = true;
2268  }
2269  break;
2270  case CSS1_PIXLENGTH:
2271  {
2272  double fMargin = pExpr->GetNumber();
2273  if (fMargin < SAL_MAX_INT32/2.0 && fMargin > SAL_MIN_INT32/2.0)
2274  {
2275  nMargin = static_cast<tools::Long>(fMargin);
2276  tools::Long nPWidth = 0;
2277  SvxCSS1Parser::PixelToTwip( nPWidth, nMargin );
2278  bSetThis = true;
2279  }
2280  else
2281  {
2282  SAL_WARN("sw.html", "out-of-size pxlength: " << fMargin);
2283  }
2284  }
2285  break;
2286  case CSS1_PERCENTAGE:
2287  // we aren't able
2288  break;
2289  default:
2290  ;
2291  }
2292 
2293  if( bSetThis )
2294  {
2295  // 0 = top
2296  // 1 = right
2297  // 2 = bottom
2298  // 3 = left
2299  switch( i )
2300  {
2301  case 0:
2302  nMargins[0] = nMargins[1] =nMargins[2] = nMargins[3] = nMargin;
2303  bSetMargins[0] = bSetMargins[1] =
2304  bSetMargins[2] = bSetMargins[3] = true;
2305  break;
2306  case 1:
2307  nMargins[1] = nMargins[3] = nMargin; // right + left
2308  bSetMargins[1] = bSetMargins[3] = true;
2309  break;
2310  case 2:
2311  nMargins[2] = nMargin; // bottom
2312  bSetMargins[2] = true;
2313  break;
2314  case 3:
2315  nMargins[3] = nMargin; // left
2316  bSetMargins[3] = true;
2317  break;
2318  }
2319  }
2320  pExpr = pExpr->GetNext();
2321  }
2322 
2323  if( bSetMargins[3] || bSetMargins[1] )
2324  {
2325  if( bSetMargins[3] )
2326  {
2327  rPropInfo.m_bLeftMargin = true;
2328  rPropInfo.m_nLeftMargin = nMargins[3];
2329  if( nMargins[3] < 0 )
2330  nMargins[3] = 0;
2331  }
2332  if( bSetMargins[1] )
2333  {
2334  rPropInfo.m_bRightMargin = true;
2335  rPropInfo.m_nRightMargin = nMargins[1];
2336  if( nMargins[1] < 0 )
2337  nMargins[1] = 0;
2338  }
2339 
2340  const SfxPoolItem* pItem;
2341  if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
2342  &pItem ) )
2343  {
2344  SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
2345  if( bSetMargins[3] )
2346  aLRItem.SetLeft( o3tl::narrowing<sal_uInt16>(nMargins[3]) );
2347  if( bSetMargins[1] )
2348  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nMargins[1]) );
2349  rItemSet.Put( aLRItem );
2350  }
2351  else
2352  {
2353  SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2354  if( bSetMargins[3] )
2355  aLRItem.SetLeft( o3tl::narrowing<sal_uInt16>(nMargins[3]) );
2356  if( bSetMargins[1] )
2357  aLRItem.SetRight( o3tl::narrowing<sal_uInt16>(nMargins[1]) );
2358  rItemSet.Put( aLRItem );
2359  }
2360  }
2361 
2362  if( !(bSetMargins[0] || bSetMargins[2]) )
2363  return;
2364 
2365  if( nMargins[0] < 0 )
2366  nMargins[0] = 0;
2367  if( nMargins[2] < 0 )
2368  nMargins[2] = 0;
2369 
2370  const SfxPoolItem* pItem;
2371  if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
2372  &pItem ) )
2373  {
2374  SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
2375  if( bSetMargins[0] )
2376  aULItem.SetUpper( o3tl::narrowing<sal_uInt16>(nMargins[0]) );
2377  if( bSetMargins[2] )
2378  aULItem.SetLower( o3tl::narrowing<sal_uInt16>(nMargins[2]) );
2379  rItemSet.Put( aULItem );
2380  }
2381  else
2382  {
2383  SvxULSpaceItem aULItem( aItemIds.nULSpace );
2384  if( bSetMargins[0] )
2385  aULItem.SetUpper( o3tl::narrowing<sal_uInt16>(nMargins[0]) );
2386  if( bSetMargins[2] )
2387  aULItem.SetLower( o3tl::narrowing<sal_uInt16>(nMargins[2]) );
2388  rItemSet.Put( aULItem );
2389  }
2390 
2391  rPropInfo.m_bTopMargin |= bSetMargins[0];
2392  rPropInfo.m_bBottomMargin |= bSetMargins[2];
2393 }
2394 
2395 static bool ParseCSS1_padding_xxx( const CSS1Expression *pExpr,
2396  SvxCSS1PropertyInfo& rPropInfo,
2397  SvxBoxItemLine nWhichLine )
2398 {
2399  OSL_ENSURE( pExpr, "no expression" );
2400 
2401  bool bSet = false;
2402  sal_uInt16 nDist = 0;
2403 
2404  switch( pExpr->GetType() )
2405  {
2406  case CSS1_LENGTH:
2407  {
2408  tools::Long nTmp = pExpr->GetSLength();
2409  if( nTmp < 0 )
2410  nTmp = 0;
2411  else if( nTmp > SvxCSS1PropertyInfo::UNSET_BORDER_DISTANCE-1 )
2413  nDist = o3tl::narrowing<sal_uInt16>(nTmp);
2414  bSet = true;
2415  }
2416  break;
2417  case CSS1_PIXLENGTH:
2418  {
2419  double fWidth = pExpr->GetNumber();
2420  if (fWidth < SAL_MAX_INT32/2.0 && fWidth > SAL_MIN_INT32/2.0)
2421  {
2422  tools::Long nPWidth = static_cast<tools::Long>(fWidth);
2423  tools::Long nPHeight = 0;
2424  if( nPWidth < 0 )
2425  nPWidth = 0;
2426  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2429  nDist = o3tl::narrowing<sal_uInt16>(nPWidth);
2430  bSet = true;
2431  }
2432  }
2433  break;
2434  case CSS1_PERCENTAGE:
2435  // we aren't able
2436  break;
2437  default:
2438  ;
2439  }
2440 
2441  if( bSet )
2442  {
2443  switch( nWhichLine )
2444  {
2445  case SvxBoxItemLine::TOP: rPropInfo.m_nTopBorderDistance = nDist; break;
2446  case SvxBoxItemLine::BOTTOM: rPropInfo.m_nBottomBorderDistance = nDist;break;
2447  case SvxBoxItemLine::LEFT: rPropInfo.m_nLeftBorderDistance = nDist; break;
2448  case SvxBoxItemLine::RIGHT: rPropInfo.m_nRightBorderDistance = nDist; break;
2449  }
2450  }
2451 
2452  return bSet;
2453 }
2454 
2455 static void ParseCSS1_padding_top( const CSS1Expression *pExpr,
2456  SfxItemSet & /*rItemSet*/,
2457  SvxCSS1PropertyInfo& rPropInfo,
2458  const SvxCSS1Parser& /*rParser*/ )
2459 {
2460  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::TOP );
2461 }
2462 
2463 static void ParseCSS1_padding_bottom( const CSS1Expression *pExpr,
2464  SfxItemSet & /*rItemSet*/,
2465  SvxCSS1PropertyInfo& rPropInfo,
2466  const SvxCSS1Parser& /*rParser*/ )
2467 {
2468  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::BOTTOM );
2469 }
2470 
2471 static void ParseCSS1_padding_left( const CSS1Expression *pExpr,
2472  SfxItemSet & /*rItemSet*/,
2473  SvxCSS1PropertyInfo& rPropInfo,
2474  const SvxCSS1Parser& /*rParser*/ )
2475 {
2476  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::LEFT );
2477 }
2478 
2479 static void ParseCSS1_padding_right( const CSS1Expression *pExpr,
2480  SfxItemSet & /*rItemSet*/,
2481  SvxCSS1PropertyInfo& rPropInfo,
2482  const SvxCSS1Parser& /*rParser*/ )
2483 {
2484  ParseCSS1_padding_xxx( pExpr, rPropInfo, SvxBoxItemLine::RIGHT );
2485 }
2486 
2487 static void ParseCSS1_padding( const CSS1Expression *pExpr,
2488  SfxItemSet & /*rItemSet*/,
2489  SvxCSS1PropertyInfo& rPropInfo,
2490  const SvxCSS1Parser& /*rParser*/ )
2491 {
2492  int n=0;
2493  while( n<4 && pExpr && !pExpr->GetOp() )
2494  {
2495  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2496  if( ParseCSS1_padding_xxx( pExpr, rPropInfo, nLine ) )
2497  {
2498  if( n==0 )
2499  {
2500  rPropInfo.m_nTopBorderDistance = rPropInfo.m_nBottomBorderDistance;
2501  rPropInfo.m_nLeftBorderDistance = rPropInfo.m_nTopBorderDistance;
2502  }
2503  if( n <= 1 )
2504  rPropInfo.m_nRightBorderDistance = rPropInfo.m_nLeftBorderDistance;
2505  }
2506 
2507  pExpr = pExpr->GetNext();
2508  n++;
2509  }
2510 }
2511 
2512 static void ParseCSS1_border_xxx( const CSS1Expression *pExpr,
2513  SfxItemSet & /*rItemSet*/,
2514  SvxCSS1PropertyInfo& rPropInfo,
2515  const SvxCSS1Parser& /*rParser*/,
2516  SvxBoxItemLine nWhichLine, bool bAll )
2517 {
2518  OSL_ENSURE( pExpr, "no expression" );
2519 
2520  sal_uInt16 nWidth = USHRT_MAX; // line thickness
2521  sal_uInt16 nNWidth = 1; // named line thickness (and default)
2522  CSS1BorderStyle eStyle = CSS1_BS_NONE; // line style
2523  Color aColor;
2524  bool bColor = false;
2525 
2526  while( pExpr && !pExpr->GetOp() )
2527  {
2528  switch( pExpr->GetType() )
2529  {
2530  case CSS1_RGB:
2531  case CSS1_HEXCOLOR:
2532  if( pExpr->GetColor( aColor ) )
2533  bColor = true;
2534  break;
2535 
2536  case CSS1_IDENT:
2537  {
2538  const OUString& rValue = pExpr->GetString();
2539  sal_uInt16 nValue;
2540  if( SvxCSS1Parser::GetEnum( aBorderWidthTable, rValue, nValue ) )
2541  {
2542  nNWidth = nValue;
2543  }
2544  else if( SvxCSS1Parser::GetEnum( aBorderStyleTable, rValue, nValue ) )
2545  {
2546  eStyle = static_cast<CSS1BorderStyle>(nValue);
2547  }
2548  else if( pExpr->GetColor( aColor ) )
2549  {
2550  bColor = true;
2551  }
2552  }
2553  break;
2554 
2555  case CSS1_LENGTH:
2556  nWidth = o3tl::narrowing<sal_uInt16>(pExpr->GetULength());
2557  break;
2558 
2559  case CSS1_PIXLENGTH:
2560  {
2561  // One Pixel becomes a hairline (is prettier)
2562  double fWidth = pExpr->GetNumber();
2563  if (fWidth > 1.0 && fWidth < SAL_MAX_INT32/2.0)
2564  {
2565  bool bHori = nWhichLine == SvxBoxItemLine::TOP ||
2566  nWhichLine == SvxBoxItemLine::BOTTOM;
2567 
2568  tools::Long nPWidth = bHori ? 0 : fWidth;
2569  tools::Long nPHeight = bHori ? fWidth : 0;
2570  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2571  nWidth = o3tl::narrowing<sal_uInt16>(bHori ? nPHeight : nPWidth);
2572  }
2573  else
2574  nWidth = 1;
2575  }
2576  break;
2577 
2578  default:
2579  ;
2580  }
2581 
2582  pExpr = pExpr->GetNext();
2583  }
2584 
2585  for( int i=0; i<4; ++i )
2586  {
2587  SvxBoxItemLine nLine = SvxBoxItemLine::TOP;
2588  switch( i )
2589  {
2590  case 0: nLine = SvxBoxItemLine::TOP; break;
2591  case 1: nLine = SvxBoxItemLine::BOTTOM; break;
2592  case 2: nLine = SvxBoxItemLine::LEFT; break;
2593  case 3: nLine = SvxBoxItemLine::RIGHT; break;
2594  }
2595 
2596  if( bAll || nLine == nWhichLine )
2597  {
2598  SvxCSS1BorderInfo *pInfo = rPropInfo.GetBorderInfo( nLine );
2599  pInfo->eStyle = eStyle;
2600  pInfo->nAbsWidth = nWidth;
2601  pInfo->nNamedWidth = nNWidth;
2602  if( bColor )
2603  pInfo->aColor = aColor;
2604  }
2605  }
2606 }
2607 
2608 static void ParseCSS1_border_xxx_width( const CSS1Expression *pExpr,
2609  SfxItemSet & /*rItemSet*/,
2610  SvxCSS1PropertyInfo& rPropInfo,
2611  const SvxCSS1Parser& /*rParser*/,
2612  SvxBoxItemLine nWhichLine )
2613 {
2614  OSL_ENSURE( pExpr, "no expression" );
2615 
2616  sal_uInt16 nWidth = USHRT_MAX; // line thickness
2617  sal_uInt16 nNWidth = 1; // named line thickness (and default)
2618 
2619  switch( pExpr->GetType() )
2620  {
2621  case CSS1_IDENT:
2622  {
2623  sal_uInt16 nValue;
2624  if( SvxCSS1Parser::GetEnum( aBorderWidthTable, pExpr->GetString(), nValue ) )
2625  {
2626  nNWidth = nValue;
2627  }
2628  }
2629  break;
2630 
2631  case CSS1_LENGTH:
2632  nWidth = o3tl::narrowing<sal_uInt16>(pExpr->GetULength());
2633  break;
2634 
2635  case CSS1_PIXLENGTH:
2636  {
2637  double fLength = pExpr->GetNumber();
2638  if (fLength < SAL_MAX_INT32/2.0 && fLength > SAL_MIN_INT32/2.0)
2639  {
2640  tools::Long nWidthL = static_cast<tools::Long>(fLength);
2641 
2642  bool bHori = nWhichLine == SvxBoxItemLine::TOP ||
2643  nWhichLine == SvxBoxItemLine::BOTTOM;
2644 
2645  tools::Long nPWidth = bHori ? 0 : nWidthL;
2646  tools::Long nPHeight = bHori ? nWidthL : 0;
2647  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2648  nWidth = o3tl::narrowing<sal_uInt16>(bHori ? nPHeight : nPWidth);
2649  }
2650  }
2651  break;
2652 
2653  default:
2654  ;
2655  }
2656 
2657  SvxCSS1BorderInfo *pInfo = rPropInfo.GetBorderInfo( nWhichLine );
2658  pInfo->nAbsWidth = nWidth;
2659  pInfo->nNamedWidth = nNWidth;
2660 }
2661 
2662 static void ParseCSS1_border_top_width( const CSS1Expression *pExpr,
2663  SfxItemSet &rItemSet,
2664  SvxCSS1PropertyInfo& rPropInfo,
2665  const SvxCSS1Parser& rParser )
2666 {
2667  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP );
2668 }
2669 
2671  SfxItemSet &rItemSet,
2672  SvxCSS1PropertyInfo& rPropInfo,
2673  const SvxCSS1Parser& rParser )
2674 {
2675  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::RIGHT );
2676 }
2677 
2679  SfxItemSet &rItemSet,
2680  SvxCSS1PropertyInfo& rPropInfo,
2681  const SvxCSS1Parser& rParser )
2682 {
2683  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::BOTTOM );
2684 }
2685 
2687  SfxItemSet &rItemSet,
2688  SvxCSS1PropertyInfo& rPropInfo,
2689  const SvxCSS1Parser& rParser )
2690 {
2691  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::LEFT );
2692 }
2693 
2694 static void ParseCSS1_border_width( const CSS1Expression *pExpr,
2695  SfxItemSet &rItemSet,
2696  SvxCSS1PropertyInfo& rPropInfo,
2697  const SvxCSS1Parser& rParser )
2698 {
2699  sal_uInt16 n=0;
2700  while( n<4 && pExpr && !pExpr->GetOp() )
2701  {
2702  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2703  ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, nLine );
2704  rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_WIDTH );
2705 
2706  pExpr = pExpr->GetNext();
2707  n++;
2708  }
2709 }
2710 
2711 static void ParseCSS1_border_color( const CSS1Expression *pExpr,
2712  SfxItemSet & /*rItemSet*/,
2713  SvxCSS1PropertyInfo& rPropInfo,
2714  const SvxCSS1Parser& /*rParser*/ )
2715 {
2716  sal_uInt16 n=0;
2717  while( n<4 && pExpr && !pExpr->GetOp() )
2718  {
2719  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2720  Color aColor;
2721  switch( pExpr->GetType() )
2722  {
2723  case CSS1_RGB:
2724  case CSS1_HEXCOLOR:
2725  case CSS1_IDENT:
2726  if( pExpr->GetColor( aColor ) )
2727  rPropInfo.GetBorderInfo( nLine )->aColor = aColor;
2728  break;
2729  default:
2730  ;
2731  }
2732  rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_COLOR );
2733 
2734  pExpr = pExpr->GetNext();
2735  n++;
2736  }
2737 }
2738 
2739 static void ParseCSS1_border_style( const CSS1Expression *pExpr,
2740  SfxItemSet & /*rItemSet*/,
2741  SvxCSS1PropertyInfo& rPropInfo,
2742  const SvxCSS1Parser& /*rParser*/ )
2743 {
2744  sal_uInt16 n=0;
2745  while( n<4 && pExpr && !pExpr->GetOp() )
2746  {
2747  SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT;
2748  sal_uInt16 nValue = 0;
2749  if( CSS1_IDENT==pExpr->GetType() &&
2750  SvxCSS1Parser::GetEnum( aBorderStyleTable, pExpr->GetString(),
2751  nValue ) )
2752  {
2753  rPropInfo.GetBorderInfo( nLine )->eStyle = static_cast<CSS1BorderStyle>(nValue);
2754  }
2755  rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_STYLE );
2756 
2757  pExpr = pExpr->GetNext();
2758  n++;
2759  }
2760 }
2761 
2762 static void ParseCSS1_border_top( const CSS1Expression *pExpr,
2763  SfxItemSet &rItemSet,
2764  SvxCSS1PropertyInfo& rPropInfo,
2765  const SvxCSS1Parser& rParser )
2766 {
2767  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP, false );
2768 }
2769 
2770 static void ParseCSS1_border_right( const CSS1Expression *pExpr,
2771  SfxItemSet &rItemSet,
2772  SvxCSS1PropertyInfo& rPropInfo,
2773  const SvxCSS1Parser& rParser )
2774 {
2775  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::RIGHT, false );
2776 }
2777 
2778 static void ParseCSS1_border_bottom( const CSS1Expression *pExpr,
2779  SfxItemSet &rItemSet,
2780  SvxCSS1PropertyInfo& rPropInfo,
2781  const SvxCSS1Parser& rParser )
2782 {
2783  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::BOTTOM, false );
2784 }
2785 
2786 static void ParseCSS1_border_left( const CSS1Expression *pExpr,
2787  SfxItemSet &rItemSet,
2788  SvxCSS1PropertyInfo& rPropInfo,
2789  const SvxCSS1Parser& rParser )
2790 {
2791  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::LEFT, false );
2792 }
2793 
2794 static void ParseCSS1_border( const CSS1Expression *pExpr,
2795  SfxItemSet &rItemSet,
2796  SvxCSS1PropertyInfo& rPropInfo,
2797  const SvxCSS1Parser& rParser )
2798 {
2799  ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP, true );
2800 }
2801 
2802 static void ParseCSS1_float( const CSS1Expression *pExpr,
2803  SfxItemSet & /*rItemSet*/,
2804  SvxCSS1PropertyInfo& rPropInfo,
2805  const SvxCSS1Parser& /*rParser*/ )
2806 {
2807  OSL_ENSURE( pExpr, "no expression" );
2808 
2809  if( CSS1_IDENT==pExpr->GetType() )
2810  {
2811  sal_uInt16 nFloat;
2812  if( SvxCSS1Parser::GetEnum( aFloatTable, pExpr->GetString(), nFloat ) )
2813  rPropInfo.m_eFloat = static_cast<SvxAdjust>(nFloat);
2814  }
2815 }
2816 
2817 static void ParseCSS1_position( const CSS1Expression *pExpr,
2818  SfxItemSet & /*rItemSet*/,
2819  SvxCSS1PropertyInfo& rPropInfo,
2820  const SvxCSS1Parser& /*rParser*/ )
2821 {
2822  OSL_ENSURE( pExpr, "no expression" );
2823 
2824  if( CSS1_IDENT==pExpr->GetType() )
2825  {
2826  sal_uInt16 nPos;
2827  if( SvxCSS1Parser::GetEnum( aPositionTable, pExpr->GetString(), nPos ) )
2828  rPropInfo.m_ePosition = static_cast<SvxCSS1Position>(nPos);
2829  }
2830 }
2831 
2832 static void ParseCSS1_length( const CSS1Expression *pExpr,
2833  tools::Long& rLength,
2834  SvxCSS1LengthType& rLengthType,
2835  bool bHori )
2836 {
2837  switch( pExpr->GetType() )
2838  {
2839  case CSS1_IDENT:
2840  if( pExpr->GetString().equalsIgnoreAsciiCase( "auto" ) )
2841  {
2842  rLength = 0;
2843  rLengthType = SVX_CSS1_LTYPE_AUTO;
2844  }
2845  break;
2846 
2847  case CSS1_LENGTH:
2848  rLength = pExpr->GetSLength();
2849  rLengthType = SVX_CSS1_LTYPE_TWIP;
2850  break;
2851 
2852  case CSS1_PIXLENGTH:
2853  case CSS1_NUMBER: // because of Netscape and IE
2854  {
2855  double fLength = pExpr->GetNumber();
2856  if (fLength < SAL_MAX_INT32/2.0 && fLength > SAL_MIN_INT32/2.0)
2857  {
2858  tools::Long nWidthL = static_cast<tools::Long>(fLength);
2859  tools::Long nPWidth = bHori ? 0 : nWidthL;
2860  tools::Long nPHeight = bHori ? nWidthL : 0;
2861  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2862  rLength = (bHori ? nPHeight : nPWidth);
2863  rLengthType = SVX_CSS1_LTYPE_TWIP;
2864  }
2865  }
2866  break;
2867 
2868  case CSS1_PERCENTAGE:
2869  rLength = static_cast<tools::Long>(pExpr->GetNumber());
2870  if( rLength > 100 )
2871  rLength = 100;
2872  rLengthType = SVX_CSS1_LTYPE_PERCENTAGE;
2873  break;
2874 
2875  default:
2876  ;
2877  }
2878 }
2879 
2880 static void ParseCSS1_width( const CSS1Expression *pExpr,
2881  SfxItemSet & /*rItemSet*/,
2882  SvxCSS1PropertyInfo& rPropInfo,
2883  const SvxCSS1Parser& /*rParser*/ )
2884 {
2885  ParseCSS1_length( pExpr, rPropInfo.m_nWidth, rPropInfo.m_eWidthType, true );
2886 }
2887 
2888 static void ParseCSS1_height( const CSS1Expression *pExpr,
2889  SfxItemSet & /*rItemSet*/,
2890  SvxCSS1PropertyInfo& rPropInfo,
2891  const SvxCSS1Parser& /*rParser*/ )
2892 {
2893  ParseCSS1_length( pExpr, rPropInfo.m_nHeight, rPropInfo.m_eHeightType, false );
2894 }
2895 
2896 static void ParseCSS1_left( const CSS1Expression *pExpr,
2897  SfxItemSet & /*rItemSet*/,
2898  SvxCSS1PropertyInfo& rPropInfo,
2899  const SvxCSS1Parser& /*rParser*/ )
2900 {
2901  ParseCSS1_length( pExpr, rPropInfo.m_nLeft, rPropInfo.m_eLeftType, true );
2902 }
2903 
2904 static void ParseCSS1_top( const CSS1Expression *pExpr,
2905  SfxItemSet & /*rItemSet*/,
2906  SvxCSS1PropertyInfo& rPropInfo,
2907  const SvxCSS1Parser& /*rParser*/ )
2908 {
2909  ParseCSS1_length( pExpr, rPropInfo.m_nTop, rPropInfo.m_eTopType, false );
2910 }
2911 
2912 // Feature: PrintExt
2913 static void ParseCSS1_size( const CSS1Expression *pExpr,
2914  SfxItemSet & /*rItemSet*/,
2915  SvxCSS1PropertyInfo& rPropInfo,
2916  const SvxCSS1Parser& /*rParser*/ )
2917 {
2918  int n=0;
2919  while( n<2 && pExpr && !pExpr->GetOp() )
2920  {
2921  switch( pExpr->GetType() )
2922  {
2923  case CSS1_IDENT:
2924  {
2925  sal_uInt16 nValue;
2926  if( SvxCSS1Parser::GetEnum( aSizeTable, pExpr->GetString(),
2927  nValue ) )
2928  {
2929  rPropInfo.m_eSizeType = static_cast<SvxCSS1SizeType>(nValue);
2930  }
2931  }
2932  break;
2933 
2934  case CSS1_LENGTH:
2935  rPropInfo.m_nHeight = pExpr->GetSLength();
2936  if( n==0 )
2937  rPropInfo.m_nWidth = rPropInfo.m_nHeight;
2938  rPropInfo.m_eSizeType = SVX_CSS1_STYPE_TWIP;
2939  break;
2940 
2941  case CSS1_PIXLENGTH:
2942  {
2943  double fHeight = pExpr->GetNumber();
2944  if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
2945  {
2946  tools::Long nPHeight = static_cast<tools::Long>(fHeight);
2947  tools::Long nPWidth = n==0 ? nPHeight : 0;
2948  SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2949  rPropInfo.m_nHeight = nPHeight;
2950  if( n==0 )
2951  rPropInfo.m_nWidth = nPWidth;
2952  rPropInfo.m_eSizeType = SVX_CSS1_STYPE_TWIP;
2953  }
2954  break;
2955  }
2956  default:
2957  ;
2958  }
2959 
2960  pExpr = pExpr->GetNext();
2961  n++;
2962  }
2963 }
2964 
2965 static void ParseCSS1_page_break_xxx( const CSS1Expression *pExpr,
2966  SvxCSS1PageBreak& rPBreak )
2967 {
2968  if( CSS1_IDENT == pExpr->GetType() )
2969  {
2970  sal_uInt16 nValue;
2971  if( SvxCSS1Parser::GetEnum( aPageBreakTable, pExpr->GetString(),
2972  nValue ) )
2973  {
2974  rPBreak = static_cast<SvxCSS1PageBreak>(nValue);
2975  }
2976  }
2977 }
2978 
2980  SfxItemSet & /*rItemSet*/,
2981  SvxCSS1PropertyInfo& rPropInfo,
2982  const SvxCSS1Parser& /*rParser*/ )
2983 {
2984  ParseCSS1_page_break_xxx( pExpr, rPropInfo.m_ePageBreakBefore );
2985 }
2986 
2987 static void ParseCSS1_page_break_after( const CSS1Expression *pExpr,
2988  SfxItemSet & /*rItemSet*/,
2989  SvxCSS1PropertyInfo& rPropInfo,
2990  const SvxCSS1Parser& /*rParser*/ )
2991 {
2992  ParseCSS1_page_break_xxx( pExpr, rPropInfo.m_ePageBreakAfter );
2993 }
2994 
2996  SfxItemSet &rItemSet,
2997  SvxCSS1PropertyInfo& /*rPropInfo*/,
2998  const SvxCSS1Parser& /*rParser*/ )
2999 {
3001  ParseCSS1_page_break_xxx( pExpr, eBreak );
3002 
3003  bool bSetSplit = false, bSplit = true;
3004  switch( eBreak )
3005  {
3006  case SVX_CSS1_PBREAK_AUTO:
3007  bSetSplit = true;
3008  break;
3009  case SVX_CSS1_PBREAK_AVOID:
3010  bSplit = false;
3011  bSetSplit = true;
3012  break;
3013  default:
3014  ;
3015  }
3016 
3017  if( bSetSplit )
3018  rItemSet.Put( SvxFormatSplitItem( bSplit, aItemIds.nFormatSplit ) );
3019 }
3020 
3021 static void ParseCSS1_widows( const CSS1Expression *pExpr,
3022  SfxItemSet &rItemSet,
3023  SvxCSS1PropertyInfo& /*rPropInfo*/,
3024  const SvxCSS1Parser& /*rParser*/ )
3025 {
3026  if( CSS1_NUMBER == pExpr->GetType() )
3027  {
3028  sal_uInt8 nVal = pExpr->GetNumber() <= 255
3029  ? static_cast<sal_uInt8>(pExpr->GetNumber())
3030  : 255;
3031  SvxWidowsItem aWidowsItem( nVal, aItemIds.nWidows );
3032  rItemSet.Put( aWidowsItem );
3033  }
3034 }
3035 
3036 static void ParseCSS1_orphans( const CSS1Expression *pExpr,
3037  SfxItemSet &rItemSet,
3038  SvxCSS1PropertyInfo& /*rPropInfo*/,
3039  const SvxCSS1Parser& /*rParser*/ )
3040 {
3041  if( CSS1_NUMBER == pExpr->GetType() )
3042  {
3043  sal_uInt8 nVal = pExpr->GetNumber() <= 255
3044  ? static_cast<sal_uInt8>(pExpr->GetNumber())
3045  : 255;
3046  SvxOrphansItem aOrphansItem( nVal, aItemIds.nOrphans );
3047  rItemSet.Put( aOrphansItem );
3048  }
3049 }
3050 
3051 static void ParseCSS1_so_language( const CSS1Expression *pExpr,
3052  SfxItemSet &rItemSet,
3053  SvxCSS1PropertyInfo& /*rPropInfo*/,
3054  const SvxCSS1Parser& /*rParser*/ )
3055 {
3056  if( CSS1_IDENT != pExpr->GetType() && CSS1_STRING != pExpr->GetType() )
3057  return;
3058 
3060  if( LANGUAGE_DONTKNOW != eLang )
3061  {
3062  SvxLanguageItem aLang( eLang, aItemIds.nLanguage );
3063  rItemSet.Put( aLang );
3064  aLang.SetWhich( aItemIds.nLanguageCJK );
3065  rItemSet.Put( aLang );
3066  aLang.SetWhich( aItemIds.nLanguageCTL );
3067  rItemSet.Put( aLang );
3068  }
3069 }
3070 
3071 static void ParseCSS1_visibility(const CSS1Expression* pExpr, SfxItemSet& /*rItemSet*/,
3072  SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& /*rParser*/)
3073 {
3074  if (pExpr->GetType() != CSS1_IDENT)
3075  return;
3076 
3077  rPropInfo.m_bVisible = pExpr->GetString() != "hidden";
3078 }
3079 
3080 namespace {
3081 
3082 // the assignment of property to parsing function
3083 struct CSS1PropEntry
3084 {
3085  const char * pName;
3086  FnParseCSS1Prop pFunc;
3087 };
3088 
3089 }
3090 
3091 #define CSS1_PROP_ENTRY(p) \
3092  { sCSS1_P_##p, ParseCSS1_##p }
3093 
3094 // the table with assignments
3095 CSS1PropEntry const aCSS1PropFnTab[] =
3096 {
3097  CSS1_PROP_ENTRY(background),
3098  CSS1_PROP_ENTRY(background_color),
3099  CSS1_PROP_ENTRY(border),
3100  CSS1_PROP_ENTRY(border_bottom),
3101  CSS1_PROP_ENTRY(border_bottom_width),
3102  CSS1_PROP_ENTRY(border_color),
3103  CSS1_PROP_ENTRY(border_left),
3104  CSS1_PROP_ENTRY(border_left_width),
3105  CSS1_PROP_ENTRY(border_right),
3106  CSS1_PROP_ENTRY(border_right_width),
3107  CSS1_PROP_ENTRY(border_style),
3108  CSS1_PROP_ENTRY(border_top),
3109  CSS1_PROP_ENTRY(border_top_width),
3110  CSS1_PROP_ENTRY(border_width),
3112  CSS1_PROP_ENTRY(column_count),
3113  CSS1_PROP_ENTRY(direction),
3114  CSS1_PROP_ENTRY(float),
3115  CSS1_PROP_ENTRY(font),
3116  CSS1_PROP_ENTRY(font_family),
3117  CSS1_PROP_ENTRY(font_size),
3118  CSS1_PROP_ENTRY(font_style),
3119  CSS1_PROP_ENTRY(font_variant),
3120  CSS1_PROP_ENTRY(font_weight),
3121  CSS1_PROP_ENTRY(height),
3123  CSS1_PROP_ENTRY(letter_spacing),
3124  CSS1_PROP_ENTRY(line_height),
3125  CSS1_PROP_ENTRY(list_style_type),
3126  CSS1_PROP_ENTRY(margin),
3127  CSS1_PROP_ENTRY(margin_bottom),
3128  CSS1_PROP_ENTRY(margin_left),
3129  CSS1_PROP_ENTRY(margin_right),
3130  CSS1_PROP_ENTRY(margin_top),
3131  CSS1_PROP_ENTRY(orphans),
3132  CSS1_PROP_ENTRY(padding),
3133  CSS1_PROP_ENTRY(padding_bottom),
3134  CSS1_PROP_ENTRY(padding_left),
3135  CSS1_PROP_ENTRY(padding_right),
3136  CSS1_PROP_ENTRY(padding_top),
3137  CSS1_PROP_ENTRY(page_break_after),
3138  CSS1_PROP_ENTRY(page_break_before),
3139  CSS1_PROP_ENTRY(page_break_inside),
3142  CSS1_PROP_ENTRY(so_language),
3143  CSS1_PROP_ENTRY(text_align),
3144  CSS1_PROP_ENTRY(text_decoration),
3145  CSS1_PROP_ENTRY(text_indent),
3146  CSS1_PROP_ENTRY(text_transform),
3147  CSS1_PROP_ENTRY(top),
3148  CSS1_PROP_ENTRY(visibility),
3149  CSS1_PROP_ENTRY(widows),
3150  CSS1_PROP_ENTRY(width),
3151 };
3152 
3153 #if !defined NDEBUG
3154 static bool CSS1PropEntryCompare( const CSS1PropEntry &lhs, const CSS1PropEntry &rhs)
3155 {
3156  return strcmp(lhs.pName, rhs.pName) < 0;
3157 }
3158 #endif
3159 static bool CSS1PropEntryFindCompare(CSS1PropEntry const & lhs, OUString const & s)
3160 {
3161  return s.compareToIgnoreAsciiCaseAscii(lhs.pName) > 0;
3162 }
3163 
3164 void SvxCSS1Parser::DeclarationParsed( const OUString& rProperty,
3165  std::unique_ptr<CSS1Expression> pExpr )
3166 {
3167  OSL_ENSURE( m_pItemSet, "DeclarationParsed() without ItemSet" );
3168 
3169  static bool bSortedPropFns = false;
3170 
3171  if( !bSortedPropFns )
3172  {
3173  assert( std::is_sorted( std::begin(aCSS1PropFnTab), std::end(aCSS1PropFnTab),
3175  bSortedPropFns = true;
3176  }
3177 
3178  auto it = std::lower_bound( std::begin(aCSS1PropFnTab), std::end(aCSS1PropFnTab), rProperty,
3180  if( it != std::end(aCSS1PropFnTab) && !CSS1PropEntryFindCompare(*it,rProperty) )
3181  {
3182  it->pFunc( pExpr.get(), *m_pItemSet, *m_pPropInfo, *this );
3183  }
3184 }
3185 
3186 /* 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:2185
RubyPosition m_ePosition
static void MergeStyles(const SfxItemSet &rSrcSet, const SvxCSS1PropertyInfo &rSrcInfo, SfxItemSet &rTargetSet, SvxCSS1PropertyInfo &rTargetInfo, bool bSmart)
Definition: svxcss1.cxx:932
static void ParseCSS1_width(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2880
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
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:2247
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:3071
static void ParseCSS1_text_transform(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1250
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:2694
static void ParseCSS1_border_color(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2711
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:1224
sal_uInt16 GetLower() const
GPOS_RM
virtual void SetDfltEncoding(rtl_TextEncoding eEnc)
Definition: svxcss1.cxx:982
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:2770
CSS1Map m_Tags
Definition: svxcss1.hxx:195
CSS1PropertyEnum const aBGVertPosTable[]
Definition: svxcss1.cxx:147
#define CSS1_PROP_ENTRY(p)
Definition: svxcss1.cxx:3091
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:2904
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:2471
static void ParseCSS1_direction(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1318
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:107
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:2832
static void ParseCSS1_height(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2888
void Set(CSS1Token eTyp, const OUString &rVal, double nVal)
Definition: parcss1.hxx:150
CSS1PropertyEnum const aBorderStyleTable[]
Definition: svxcss1.cxx:178
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:2979
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:1926
static void ParseCSS1_letter_spacing(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1772
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:2512
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:200
CSS1PropertyEnum const aTextAlignTable[]
Definition: svxcss1.cxx:155
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:227
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:3021
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:1050
#define DEF_LINE_WIDTH_1
static void ParseCSS1_line_height(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1588
CSS1PropertyEnum const aFontSizeTable[]
Definition: svxcss1.cxx:72
CSS1PropertyEnum const aBulletStyleTable[]
Definition: svxcss1.cxx:239
void(* FnParseCSS1Prop)(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
type of functions to parse CSS1 properties
Definition: svxcss1.cxx:67
static void ParseCSS1_font_weight(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1119
static void ParseCSS1_border_top(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2762
sal_uInt16 const aBorderWidths[]
Definition: svxcss1.cxx:248
void * sal_Handle
SvxNumType
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:99
GPOS_TILED
static void ParseCSS1_border_left(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2786
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:1162
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:2479
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:3051
LINESTYLE_NONE
bool IsIgnoreFontFamily() const
Definition: svxcss1.hxx:246
CSS1PropEntry const aCSS1PropFnTab[]
Definition: svxcss1.cxx:3095
static void ParseCSS1_color(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1277
static void ParseCSS1_background_color(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1542
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:3164
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:139
SvxCSS1MapEntry * GetTag(const OUString &rTag)
Definition: svxcss1.cxx:817
CSS1PropertyEnum const aTextTransformTable[]
Definition: svxcss1.cxx:114
static void ParseCSS1_padding_top(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2455
#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:2670
SfxItemSet * m_pItemSet
Definition: svxcss1.hxx:200
sal_uInt16 GetTrueWhich(sal_uInt16 nSlot, bool bDeep=true) const
void ParseStyleSheet()
Definition: parcss1.cxx:669
STRIKEOUT_SINGLE
static void ParseCSS1_font_size(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:987
SvxCSS1Position
Definition: svxcss1.hxx:39
static void ParseCSS1_border_bottom_width(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2678
static void MergeHori(SvxGraphicPosition &ePos, SvxGraphicPosition eHori)
Definition: svxcss1.cxx:1343
static void ParseCSS1_border_bottom(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2778
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:2739
SvxNumType m_nNumberingType
Definition: svxcss1.hxx:128
CSS1PropertyEnum const aDirectionTable[]
Definition: svxcss1.cxx:122
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:2913
SvxCSS1PropertyInfo * m_pPropInfo
Definition: svxcss1.hxx:203
static void ParseCSS1_position(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2817
sal_uInt16 char * pName
static bool CSS1PropEntryFindCompare(CSS1PropEntry const &lhs, OUString const &s)
Definition: svxcss1.cxx:3159
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:130
CSS1BorderStyle eStyle
Definition: svxcss1.cxx:308
SvxCSS1SizeType
Definition: svxcss1.hxx:56
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SvxAdjust
int i
sal_uInt16 m_nRightBorderDistance
Definition: svxcss1.hxx:126
CSS1PropertyEnum const aBorderWidthTable[]
Definition: svxcss1.cxx:164
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:2463
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:1301
static void ParseCSS1_margin_right(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2064
CSS1PropertyEnum const aFloatTable[]
Definition: svxcss1.cxx:192
static void ParseCSS1_page_break_inside(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2995
tools::Long GetLeft() const
static void ParseCSS1_background(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:1403
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:174
#define LANGUAGE_DONTKNOW
GPOS_MM
static void ParseCSS1_left(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2896
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:1373
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:1151
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:217
static void ParseCSS1_border(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &rParser)
Definition: svxcss1.cxx:2794
static bool ParseCSS1_padding_xxx(const CSS1Expression *pExpr, SvxCSS1PropertyInfo &rPropInfo, SvxBoxItemLine nWhichLine)
Definition: svxcss1.cxx:2395
static bool CSS1PropEntryCompare(const CSS1PropEntry &lhs, const CSS1PropEntry &rhs)
Definition: svxcss1.cxx:3154
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:2608
void SetInterLineSpaceRule(SvxInterLineSpaceRule e)
FontWeight
tools::Long m_nLeftMargin
Definition: svxcss1.hxx:135
SvxCSS1LengthType m_eWidthType
Definition: svxcss1.hxx:138
static void ParseCSS1_margin_top(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2123
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
static void ParseCSS1_padding(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2487
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:2662
static sal_uInt16 GetMinFixLineSpace()
Definition: svxcss1.hxx:300
void SetLineHeight(const sal_uInt16 nHeight)
bool GetColor(Color &rRGB) const
Definition: parcss1.cxx:1237
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:2001
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:1819
CSS1Token GetType() const
Definition: parcss1.hxx:136
#define DEF_LINE_WIDTH_5
static void ParseCSS1_page_break_after(const CSS1Expression *pExpr, SfxItemSet &, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:2987
sal_Handle GetFirstFontMetric(const OUString &rName) const
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:2686
static void ParseCSS1_page_break_xxx(const CSS1Expression *pExpr, SvxCSS1PageBreak &rPBreak)
Definition: svxcss1.cxx:2965
static void ParseCSS1_text_indent(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const SvxCSS1Parser &)
Definition: svxcss1.cxx:1946
CSS1PropertyEnum const aSizeTable[]
Definition: svxcss1.cxx:209
static void ParseCSS1_orphans(const CSS1Expression *pExpr, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &, const SvxCSS1Parser &)
Definition: svxcss1.cxx:3036
CSS1PropertyEnum const aFontWeightTable[]
Definition: svxcss1.cxx:84
#define SAL_WARN(area, stream)
void GetURL(OUString &rURL) const
Definition: parcss1.cxx:1211
void InsertTag(const OUString &rTag, const SfxItemSet &rItemSet, const SvxCSS1PropertyInfo &rProp)
Definition: svxcss1.cxx:810
GPOS_RB
#define DEF_LINE_WIDTH_0
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:1679
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:2802
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:1653
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
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