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