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