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