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