LibreOffice Module sc (master)  1
stylesbuffer.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 <stylesbuffer.hxx>
21 
22 #include <com/sun/star/awt/FontDescriptor.hpp>
23 #include <com/sun/star/awt/FontFamily.hpp>
24 #include <com/sun/star/awt/FontPitch.hpp>
25 #include <com/sun/star/awt/FontSlant.hpp>
26 #include <com/sun/star/awt/FontStrikeout.hpp>
27 #include <com/sun/star/awt/FontType.hpp>
28 #include <com/sun/star/awt/FontWeight.hpp>
29 #include <com/sun/star/awt/FontUnderline.hpp>
30 #include <com/sun/star/awt/XDevice.hpp>
31 #include <com/sun/star/awt/XFont2.hpp>
32 #include <com/sun/star/container/XIndexAccess.hpp>
33 #include <com/sun/star/container/XNameContainer.hpp>
34 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
35 #include <com/sun/star/style/XStyle.hpp>
36 #include <com/sun/star/text/WritingMode2.hpp>
37 #include <com/sun/star/table/BorderLineStyle.hpp>
38 #include <com/sun/star/table/CellVertJustify2.hpp>
39 #include <com/sun/star/table/CellJustifyMethod.hpp>
40 #include <editeng/justifyitem.hxx>
41 #include <editeng/frmdiritem.hxx>
42 #include <editeng/fontitem.hxx>
43 #include <editeng/postitem.hxx>
44 #include <editeng/fhgtitem.hxx>
45 #include <editeng/wghtitem.hxx>
46 #include <editeng/udlnitem.hxx>
47 #include <editeng/colritem.hxx>
49 #include <editeng/contouritem.hxx>
51 #include <editeng/shdditem.hxx>
52 #include <editeng/eeitem.hxx>
53 #include <editeng/borderline.hxx>
54 #include <editeng/boxitem.hxx>
55 #include <editeng/lineitem.hxx>
56 #include <editeng/brushitem.hxx>
57 #include <svx/rotmodit.hxx>
58 #include <tools/fontenum.hxx>
59 #include <vcl/unohelp.hxx>
60 #include <rtl/tencinfo.h>
61 #include <rtl/ustrbuf.hxx>
62 #include <sal/log.hxx>
63 #include <osl/diagnose.h>
64 #include <oox/core/filterbase.hxx>
70 #include <oox/token/namespaces.hxx>
71 #include <oox/token/properties.hxx>
72 #include <oox/token/tokens.hxx>
73 #include <themebuffer.hxx>
74 #include <unitconverter.hxx>
75 #include <document.hxx>
76 #include <stlpool.hxx>
77 #include <docpool.hxx>
78 #include <ftools.hxx>
79 #include <scitems.hxx>
80 #include <attrib.hxx>
81 #include <globstr.hrc>
82 #include <scresid.hxx>
83 #include <xlconst.hxx>
84 #include <documentimport.hxx>
85 #include <numformat.hxx>
86 #include <patattr.hxx>
87 #include <stlsheet.hxx>
88 #include <biffhelper.hxx>
89 
90 namespace oox::xls {
91 
92 using namespace ::com::sun::star::awt;
93 using namespace ::com::sun::star::container;
94 using namespace ::com::sun::star::style;
95 using namespace ::com::sun::star::table;
96 using namespace ::com::sun::star::text;
97 using namespace ::com::sun::star::uno;
98 
99 
100 namespace {
101 
102 // OOXML constants ------------------------------------------------------------
103 
104 // OOXML predefined color indexes (also used in BIFF3-BIFF8)
105 const sal_Int32 OOX_COLOR_USEROFFSET = 0;
106 
107 // OOXML font family (also used in BIFF)
108 const sal_Int32 OOX_FONTFAMILY_NONE = 0;
109 const sal_Int32 OOX_FONTFAMILY_ROMAN = 1;
110 const sal_Int32 OOX_FONTFAMILY_SWISS = 2;
111 const sal_Int32 OOX_FONTFAMILY_MODERN = 3;
112 const sal_Int32 OOX_FONTFAMILY_SCRIPT = 4;
113 const sal_Int32 OOX_FONTFAMILY_DECORATIVE = 5;
114 
115 // OOXML cell text direction (also used in BIFF)
116 const sal_Int32 OOX_XF_TEXTDIR_CONTEXT = 0;
117 const sal_Int32 OOX_XF_TEXTDIR_LTR = 1;
118 const sal_Int32 OOX_XF_TEXTDIR_RTL = 2;
119 
120 // OOXML cell rotation (also used in BIFF)
121 const sal_Int32 OOX_XF_ROTATION_NONE = 0;
122 const sal_Int32 OOX_XF_ROTATION_STACKED = 255;
123 
124 // OOXML cell indentation
125 const sal_Int32 OOX_XF_INDENT_NONE = 0;
126 
127 // OOXML built-in cell styles (also used in BIFF)
128 const sal_Int32 OOX_STYLE_NORMAL = 0;
129 const sal_Int32 OOX_STYLE_ROWLEVEL = 1;
130 const sal_Int32 OOX_STYLE_COLLEVEL = 2;
131 
132 // BIFF12 constants -----------------------------------------------------------
133 
134 // BIFF12 color types
135 const sal_uInt8 BIFF12_COLOR_AUTO = 0;
136 const sal_uInt8 BIFF12_COLOR_INDEXED = 1;
137 const sal_uInt8 BIFF12_COLOR_RGB = 2;
138 const sal_uInt8 BIFF12_COLOR_THEME = 3;
139 
140 // BIFF12 diagonal borders
141 const sal_uInt8 BIFF12_BORDER_DIAG_TLBR = 0x01;
142 const sal_uInt8 BIFF12_BORDER_DIAG_BLTR = 0x02;
143 
144 // BIFF12 gradient fill
145 const sal_Int32 BIFF12_FILL_GRADIENT = 40;
146 
147 // BIFF12 XF flags
148 const sal_uInt32 BIFF12_XF_WRAPTEXT = 0x00400000;
149 const sal_uInt32 BIFF12_XF_JUSTLASTLINE = 0x00800000;
150 const sal_uInt32 BIFF12_XF_SHRINK = 0x01000000;
151 const sal_uInt32 BIFF12_XF_LOCKED = 0x10000000;
152 const sal_uInt32 BIFF12_XF_HIDDEN = 0x20000000;
153 
154 // BIFF12 XF attribute used flags
155 const sal_uInt16 BIFF12_XF_NUMFMT_USED = 0x0001;
156 const sal_uInt16 BIFF12_XF_FONT_USED = 0x0002;
157 const sal_uInt16 BIFF12_XF_ALIGN_USED = 0x0004;
158 const sal_uInt16 BIFF12_XF_BORDER_USED = 0x0008;
159 const sal_uInt16 BIFF12_XF_AREA_USED = 0x0010;
160 const sal_uInt16 BIFF12_XF_PROT_USED = 0x0020;
161 
162 // BIFF12 DXF constants
163 const sal_uInt16 BIFF12_DXF_FILL_PATTERN = 0;
164 const sal_uInt16 BIFF12_DXF_FILL_FGCOLOR = 1;
165 const sal_uInt16 BIFF12_DXF_FILL_BGCOLOR = 2;
166 const sal_uInt16 BIFF12_DXF_FILL_GRADIENT = 3;
167 const sal_uInt16 BIFF12_DXF_FILL_STOP = 4;
168 const sal_uInt16 BIFF12_DXF_FONT_COLOR = 5;
169 const sal_uInt16 BIFF12_DXF_BORDER_TOP = 6;
170 const sal_uInt16 BIFF12_DXF_BORDER_BOTTOM = 7;
171 const sal_uInt16 BIFF12_DXF_BORDER_LEFT = 8;
172 const sal_uInt16 BIFF12_DXF_BORDER_RIGHT = 9;
173 const sal_uInt16 BIFF12_DXF_FONT_NAME = 24;
174 const sal_uInt16 BIFF12_DXF_FONT_WEIGHT = 25;
175 const sal_uInt16 BIFF12_DXF_FONT_UNDERLINE = 26;
176 const sal_uInt16 BIFF12_DXF_FONT_ESCAPEMENT = 27;
177 const sal_uInt16 BIFF12_DXF_FONT_ITALIC = 28;
178 const sal_uInt16 BIFF12_DXF_FONT_STRIKE = 29;
179 const sal_uInt16 BIFF12_DXF_FONT_OUTLINE = 30;
180 const sal_uInt16 BIFF12_DXF_FONT_SHADOW = 31;
181 const sal_uInt16 BIFF12_DXF_FONT_HEIGHT = 36;
182 const sal_uInt16 BIFF12_DXF_FONT_SCHEME = 37;
183 const sal_uInt16 BIFF12_DXF_NUMFMT_CODE = 38;
184 const sal_uInt16 BIFF12_DXF_NUMFMT_ID = 41;
185 
186 // BIFF12 CELLSTYLE flags
187 const sal_uInt16 BIFF12_CELLSTYLE_BUILTIN = 0x0001;
188 const sal_uInt16 BIFF12_CELLSTYLE_HIDDEN = 0x0002;
189 const sal_uInt16 BIFF12_CELLSTYLE_CUSTOM = 0x0004;
190 
191 // BIFF constants -------------------------------------------------------------
192 
193 // BIFF font flags, also used in BIFF12
194 const sal_uInt16 BIFF_FONTFLAG_ITALIC = 0x0002;
195 const sal_uInt16 BIFF_FONTFLAG_STRIKEOUT = 0x0008;
196 const sal_uInt16 BIFF_FONTFLAG_OUTLINE = 0x0010;
197 const sal_uInt16 BIFF_FONTFLAG_SHADOW = 0x0020;
198 
199 // BIFF font weight
200 const sal_uInt16 BIFF_FONTWEIGHT_BOLD = 450;
201 
202 // BIFF font underline, also used in BIFF12
203 const sal_uInt8 BIFF_FONTUNDERL_NONE = 0;
204 const sal_uInt8 BIFF_FONTUNDERL_SINGLE = 1;
205 const sal_uInt8 BIFF_FONTUNDERL_DOUBLE = 2;
206 const sal_uInt8 BIFF_FONTUNDERL_SINGLE_ACC = 33;
207 const sal_uInt8 BIFF_FONTUNDERL_DOUBLE_ACC = 34;
208 
209 ::Color lclReadRgbColor( BinaryInputStream& rStrm )
210 {
211  sal_uInt8 nR, nG, nB, nA;
212  nR = rStrm.readuChar();
213  nG = rStrm.readuChar();
214  nB = rStrm.readuChar();
215  nA = rStrm.readuChar();
216  sal_Int32 nValue = nA;
217  nValue <<= 8;
218  nValue |= nR;
219  nValue <<= 8;
220  nValue |= nG;
221  nValue <<= 8;
222  nValue |= nB;
223  return ::Color(nValue);
224 }
225 
226 } // namespace
227 
229  GraphicHelper( rHelper.getBaseFilter().getComponentContext(), rHelper.getBaseFilter().getTargetFrame(), rHelper.getBaseFilter().getStorage() ),
230  WorkbookHelper( rHelper )
231 {
232 }
233 
235 {
236  return getTheme().getColorByToken( nToken );
237 }
238 
239 ::Color ExcelGraphicHelper::getPaletteColor( sal_Int32 nPaletteIdx ) const
240 {
241  return getStyles().getPaletteColor( nPaletteIdx );
242 }
243 
245 {
247  setSchemeClr( XML_phClr );
248 }
249 
250 void Color::setRgb( ::Color nRgbValue, double fTint )
251 {
253  setSrgbClr( sal_uInt32(nRgbValue) & 0xFFFFFF );
254  if( fTint != 0.0 ) addExcelTintTransformation( fTint );
255 }
256 
257 void Color::setTheme( sal_Int32 nThemeIdx, double fTint )
258 {
260  static const sal_Int32 spnColorTokens[] = {
261  XML_lt1, XML_dk1, XML_lt2, XML_dk2, XML_accent1, XML_accent2,
262  XML_accent3, XML_accent4, XML_accent5, XML_accent6, XML_hlink, XML_folHlink };
263  setSchemeClr( STATIC_ARRAY_SELECT( spnColorTokens, nThemeIdx, XML_TOKEN_INVALID ) );
264  if( fTint != 0.0 ) addExcelTintTransformation( fTint );
265 }
266 
267 void Color::setIndexed( sal_Int32 nPaletteIdx, double fTint )
268 {
270  setPaletteClr( nPaletteIdx );
271  if( fTint != 0.0 ) addExcelTintTransformation( fTint );
272 }
273 
274 void Color::importColor( const AttributeList& rAttribs )
275 {
276  // tdf#113271 The order of import color is very important in case of more than one color attributes was provided.
277  // This order (theme -> rgb -> indexed -> auto) is not documented and was gathered experimentally based on MS Excel 2013.
278  if( rAttribs.hasAttribute( XML_theme ) )
279  setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( XML_tint, 0.0 ) );
280  else if( rAttribs.hasAttribute( XML_rgb ) )
281  setRgb( rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_TRANSPARENT) ), rAttribs.getDouble( XML_tint, 0.0 ) );
282  else if( rAttribs.hasAttribute( XML_indexed ) )
283  setIndexed( rAttribs.getInteger( XML_indexed, -1 ), rAttribs.getDouble( XML_tint, 0.0 ) );
284  else if( rAttribs.getBool( XML_auto, false ) )
285  setAuto();
286  else
287  {
288  OSL_FAIL( "Color::importColor - unknown color type" );
289  setAuto();
290  }
291 }
292 
294 {
295  sal_uInt8 nFlags, nIndex;
296  sal_Int16 nTint;
297  nFlags = rStrm.readuChar();
298  nIndex = rStrm.readuChar();
299  nTint = rStrm.readInt16();
300 
301  // scale tint from signed 16-bit to double range -1.0 ... 1.0
302  double fTint = nTint;
303  if( nTint < 0 )
304  fTint /= -SAL_MIN_INT16;
305  else if( nTint > 0 )
306  fTint /= SAL_MAX_INT16;
307 
308  switch( extractValue< sal_uInt8 >( nFlags, 1, 7 ) )
309  {
310  case BIFF12_COLOR_AUTO:
311  setAuto();
312  rStrm.skip( 4 );
313  break;
314  case BIFF12_COLOR_INDEXED:
315  setIndexed( nIndex, fTint );
316  rStrm.skip( 4 );
317  break;
318  case BIFF12_COLOR_RGB:
319  setRgb( lclReadRgbColor( rStrm ), fTint );
320  break;
321  case BIFF12_COLOR_THEME:
322  setTheme( nIndex, fTint );
323  rStrm.skip( 4 );
324  break;
325  default:
326  OSL_FAIL( "Color::importColor - unknown color type" );
327  setAuto();
328  rStrm.skip( 4 );
329  }
330 }
331 
333 {
334  setIndexed( rStrm.readInt32() );
335 }
336 
338 {
339  orColor.importColor( rStrm );
340  return rStrm;
341 }
342 
343 namespace {
344 
346 #define PALETTE_EGA_COLORS_LIGHT \
347  ::Color(0x000000), ::Color(0xFFFFFF), ::Color(0xFF0000), ::Color(0x00FF00), ::Color(0x0000FF), ::Color(0xFFFF00), ::Color(0xFF00FF), ::Color(0x00FFFF)
348 
349 #define PALETTE_EGA_COLORS_DARK \
350  ::Color(0x800000), ::Color(0x008000), ::Color(0x000080), ::Color(0x808000), ::Color(0x800080), ::Color(0x008080), ::Color(0xC0C0C0), ::Color(0x808080)
351 
353 const ::Color spnDefColors8[] =
354 {
357 /* 16 */ PALETTE_EGA_COLORS_DARK,
358 /* 24 */ ::Color(0x9999FF), ::Color(0x993366), ::Color(0xFFFFCC), ::Color(0xCCFFFF), ::Color(0x660066), ::Color(0xFF8080), ::Color(0x0066CC), ::Color(0xCCCCFF),
359 /* 32 */ ::Color(0x000080), ::Color(0xFF00FF), ::Color(0xFFFF00), ::Color(0x00FFFF), ::Color(0x800080), ::Color(0x800000), ::Color(0x008080), ::Color(0x0000FF),
360 /* 40 */ ::Color(0x00CCFF), ::Color(0xCCFFFF), ::Color(0xCCFFCC), ::Color(0xFFFF99), ::Color(0x99CCFF), ::Color(0xFF99CC), ::Color(0xCC99FF), ::Color(0xFFCC99),
361 /* 48 */ ::Color(0x3366FF), ::Color(0x33CCCC), ::Color(0x99CC00), ::Color(0xFFCC00), ::Color(0xFF9900), ::Color(0xFF6600), ::Color(0x666699), ::Color(0x969696),
362 /* 56 */ ::Color(0x003366), ::Color(0x339966), ::Color(0x003300), ::Color(0x333300), ::Color(0x993300), ::Color(0x993366), ::Color(0x333399), ::Color(0x333333)
363 };
364 
365 #undef PALETTE_EGA_COLORS_LIGHT
366 #undef PALETTE_EGA_COLORS_DARK
367 
368 } // namespace
369 
371  : WorkbookHelper(rHelper)
372  , mnAppendIndex(0)
373 {
374  // default colors
375  maColors.insert( maColors.begin(), spnDefColors8, spnDefColors8 + SAL_N_ELEMENTS(spnDefColors8) );
376  mnAppendIndex = OOX_COLOR_USEROFFSET;
377 }
378 
380 {
381  appendColor( rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_WHITE) ) );
382 }
383 
385 {
386  ::Color nRgb = lclReadRgbColor( rStrm );
387  appendColor( nRgb );
388 }
389 
390 ::Color ColorPalette::getColor( sal_Int32 nPaletteIdx ) const
391 {
392  ::Color nColor = API_RGB_TRANSPARENT;
393  if( const ::Color* pnPaletteColor = ContainerHelper::getVectorElement( maColors, nPaletteIdx ) )
394  {
395  nColor = *pnPaletteColor;
396  }
397  else switch( nPaletteIdx )
398  {
401  case OOX_COLOR_CHWINDOWTEXT: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_windowText ); break;
404  case OOX_COLOR_CHWINDOWBACK: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_window ); break;
405  case OOX_COLOR_BUTTONBACK: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_btnFace ); break;
406  case OOX_COLOR_CHBORDERAUTO: nColor = API_RGB_BLACK; /* really always black? */ break;
407  case OOX_COLOR_NOTEBACK: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_infoBk ); break;
408  case OOX_COLOR_NOTETEXT: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_infoText ); break;
409  case OOX_COLOR_FONTAUTO: nColor = API_RGB_TRANSPARENT; break;
410  default: OSL_FAIL( "ColorPalette::getColor - unknown color index" );
411  }
412  return nColor;
413 }
414 
415 void ColorPalette::appendColor( ::Color nRGBValue )
416 {
417  if( mnAppendIndex < maColors.size() )
418  maColors[ mnAppendIndex ] = nRGBValue;
419  else
420  maColors.push_back( nRGBValue );
421  ++mnAppendIndex;
422 }
423 
424 namespace {
425 
426 void lclSetFontName( ApiScriptFontName& rFontName, const FontDescriptor& rFontDesc, bool bHasGlyphs )
427 {
428  if( bHasGlyphs )
429  {
430  rFontName.maName = rFontDesc.Name;
431  rFontName.mnFamily = rFontDesc.Family;
432  // API font descriptor contains rtl_TextEncoding constants
433  rFontName.mnTextEnc = rFontDesc.CharSet;
434  }
435  else
436  {
437  rFontName = ApiScriptFontName();
438  }
439 }
440 
441 } // namespace
442 
444  mnScheme( XML_none ),
445  mnFamily( OOX_FONTFAMILY_NONE ),
446  mnCharSet( WINDOWS_CHARSET_DEFAULT ),
447  mfHeight( 0.0 ),
448  mnUnderline( XML_none ),
449  mnEscapement( XML_baseline ),
450  mbBold( false ),
451  mbItalic( false ),
452  mbStrikeout( false ),
453  mbOutline( false ),
454  mbShadow( false )
455 {
456 }
457 
459 {
460  static const sal_Int32 spnSchemes[] = { XML_none, XML_major, XML_minor };
461  mnScheme = STATIC_ARRAY_SELECT( spnSchemes, nScheme, XML_none );
462 }
463 
464 void FontModel::setBiffHeight( sal_uInt16 nHeight )
465 {
466  mfHeight = nHeight / 20.0; // convert twips to points
467 }
468 
469 void FontModel::setBiffWeight( sal_uInt16 nWeight )
470 {
471  mbBold = nWeight >= BIFF_FONTWEIGHT_BOLD;
472 }
473 
474 void FontModel::setBiffUnderline( sal_uInt16 nUnderline )
475 {
476  switch( nUnderline )
477  {
478  case BIFF_FONTUNDERL_NONE: mnUnderline = XML_none; break;
479  case BIFF_FONTUNDERL_SINGLE: mnUnderline = XML_single; break;
480  case BIFF_FONTUNDERL_DOUBLE: mnUnderline = XML_double; break;
481  case BIFF_FONTUNDERL_SINGLE_ACC: mnUnderline = XML_singleAccounting; break;
482  case BIFF_FONTUNDERL_DOUBLE_ACC: mnUnderline = XML_doubleAccounting; break;
483  default: mnUnderline = XML_none;
484  }
485 }
486 
487 void FontModel::setBiffEscapement( sal_uInt16 nEscapement )
488 {
489  static const sal_Int32 spnEscapes[] = { XML_baseline, XML_superscript, XML_subscript };
490  mnEscapement = STATIC_ARRAY_SELECT( spnEscapes, nEscapement, XML_baseline );
491 }
492 
494  mbNameUsed( bAllUsed ),
495  mbColorUsed( bAllUsed ),
496  mbSchemeUsed( bAllUsed ),
497  mbHeightUsed( bAllUsed ),
498  mbUnderlineUsed( bAllUsed ),
499  mbEscapementUsed( bAllUsed ),
500  mbWeightUsed( bAllUsed ),
501  mbPostureUsed( bAllUsed ),
502  mbStrikeoutUsed( bAllUsed ),
503  mbOutlineUsed( bAllUsed ),
504  mbShadowUsed( bAllUsed )
505 {
506 }
507 
509  mnFamily( css::awt::FontFamily::DONTKNOW ),
510  mnTextEnc( RTL_TEXTENCODING_DONTKNOW )
511 {
512 }
513 
515  maDesc(
516  "Calibri",
517  220, // height 11 points
518  0,
519  OUString(),
521  RTL_TEXTENCODING_DONTKNOW,
523  100.0,
525  css::awt::FontSlant_NONE,
526  css::awt::FontUnderline::NONE,
528  0.0,
529  false,
530  false,
531  css::awt::FontType::DONTKNOW ),
533  mnEscapement( API_ESCAPE_NONE ),
534  mnEscapeHeight( API_ESCAPEHEIGHT_NONE ),
535  mbOutline( false ),
536  mbShadow( false )
537 {
538  maLatinFont.maName = maDesc.Name;
539 }
540 
541 Font::Font( const WorkbookHelper& rHelper, bool bDxf ) :
542  WorkbookHelper( rHelper ),
543  maModel( rHelper.getTheme().getDefaultFontModel() ),
544  maUsedFlags( !bDxf ),
545  mbDxf( bDxf )
546 {
547 }
548 
549 Font::Font( const WorkbookHelper& rHelper, const FontModel& rModel ) :
550  WorkbookHelper( rHelper ),
551  maModel( rModel ),
552  maUsedFlags( true ),
553  mbDxf( false )
554 {
555 }
556 
557 void Font::importAttribs( sal_Int32 nElement, const AttributeList& rAttribs )
558 {
559  const FontModel& rDefModel = getTheme().getDefaultFontModel();
560  switch( nElement )
561  {
562  case XLS_TOKEN( name ): // when in <font> element
563  case XLS_TOKEN( rFont ): // when in <rPr> element
564  if( rAttribs.hasAttribute( XML_val ) )
565  {
566  maModel.maName = rAttribs.getXString( XML_val, OUString() );
567  maUsedFlags.mbNameUsed = true;
568  }
569  break;
570  case XLS_TOKEN( scheme ):
571  maModel.mnScheme = rAttribs.getToken( XML_val, rDefModel.mnScheme );
572  break;
573  case XLS_TOKEN( family ):
574  maModel.mnFamily = rAttribs.getInteger( XML_val, rDefModel.mnFamily );
575  break;
576  case XLS_TOKEN( charset ):
577  maModel.mnCharSet = rAttribs.getInteger( XML_val, rDefModel.mnCharSet );
578  break;
579  case XLS_TOKEN( sz ):
580  maModel.mfHeight = rAttribs.getDouble( XML_val, rDefModel.mfHeight );
581  maUsedFlags.mbHeightUsed = true;
582  break;
583  case XLS_TOKEN( color ):
584  maModel.maColor.importColor( rAttribs );
585  maUsedFlags.mbColorUsed = true;
586  break;
587  case XLS_TOKEN( u ):
588  maModel.mnUnderline = rAttribs.getToken( XML_val, XML_single );
590  break;
591  case XLS_TOKEN( vertAlign ):
592  maModel.mnEscapement = rAttribs.getToken( XML_val, XML_baseline );
594  break;
595  case XLS_TOKEN( b ):
596  maModel.mbBold = rAttribs.getBool( XML_val, true );
597  maUsedFlags.mbWeightUsed = true;
598  break;
599  case XLS_TOKEN( i ):
600  maModel.mbItalic = rAttribs.getBool( XML_val, true );
601  maUsedFlags.mbPostureUsed = true;
602  break;
603  case XLS_TOKEN( strike ):
604  maModel.mbStrikeout = rAttribs.getBool( XML_val, true );
606  break;
607  case XLS_TOKEN( outline ):
608  maModel.mbOutline = rAttribs.getBool( XML_val, true );
609  maUsedFlags.mbOutlineUsed = true;
610  break;
611  case XLS_TOKEN( shadow ):
612  maModel.mbShadow = rAttribs.getBool( XML_val, true );
613  maUsedFlags.mbShadowUsed = true;
614  break;
615  }
616 }
617 
619 {
620  SAL_WARN_IF( mbDxf, "sc", "Font::importFont - unexpected conditional formatting flag" );
621 
622  sal_uInt16 nHeight, nFlags, nWeight, nEscapement;
623  sal_uInt8 nUnderline, nFamily, nCharSet, nScheme;
624  nHeight = rStrm.readuInt16();
625  nFlags = rStrm.readuInt16();
626  nWeight = rStrm.readuInt16();
627  nEscapement = rStrm.readuInt16();
628  nUnderline = rStrm.readuChar();
629  nFamily = rStrm.readuChar();
630  nCharSet = rStrm.readuChar();
631  rStrm.skip( 1 );
632  rStrm >> maModel.maColor;
633  nScheme = rStrm.readuChar();
634  rStrm >> maModel.maName;
635 
636  // equal constants in all BIFFs for weight, underline, and escapement
637  maModel.setBiff12Scheme( nScheme );
638  maModel.setBiffHeight( nHeight );
639  maModel.setBiffWeight( nWeight );
640  maModel.setBiffUnderline( nUnderline );
641  maModel.setBiffEscapement( nEscapement );
642  maModel.mnFamily = nFamily;
643  maModel.mnCharSet = nCharSet;
644  // equal flags in all BIFFs
645  maModel.mbItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
646  maModel.mbStrikeout = getFlag( nFlags, BIFF_FONTFLAG_STRIKEOUT );
647  maModel.mbOutline = getFlag( nFlags, BIFF_FONTFLAG_OUTLINE );
648  maModel.mbShadow = getFlag( nFlags, BIFF_FONTFLAG_SHADOW );
649 }
650 
652 {
653  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfName - missing conditional formatting flag" );
654  maModel.maName = BiffHelper::readString( rStrm, false );
655  maUsedFlags.mbColorUsed = true;
656 }
657 
659 {
660  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfColor - missing conditional formatting flag" );
661  rStrm >> maModel.maColor;
662  maUsedFlags.mbColorUsed = true;
663 }
664 
666 {
667  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfScheme - missing conditional formatting flag" );
668  maModel.setBiff12Scheme( rStrm.readuInt8() );
669  maUsedFlags.mbSchemeUsed = true;
670 }
671 
673 {
674  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfHeight - missing conditional formatting flag" );
675  maModel.setBiffHeight( rStrm.readuInt16() );
676  maUsedFlags.mbHeightUsed = true;
677 }
678 
680 {
681  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfWeight - missing conditional formatting flag" );
682  maModel.setBiffWeight( rStrm.readuInt16() );
683  maUsedFlags.mbWeightUsed = true;
684 }
685 
687 {
688  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfUnderline - missing conditional formatting flag" );
691 }
692 
694 {
695  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfEscapement - missing conditional formatting flag" );
698 }
699 
700 void Font::importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm )
701 {
702  SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfFlag - missing conditional formatting flag" );
703  bool bFlag = rStrm.readuInt8() != 0;
704  switch( nElement )
705  {
706  case XML_i:
707  maModel.mbItalic = bFlag;
708  maUsedFlags.mbPostureUsed = true;
709  break;
710  case XML_strike:
711  maModel.mbStrikeout = bFlag;
713  break;
714  case XML_outline:
715  maModel.mbOutline = bFlag;
716  maUsedFlags.mbOutlineUsed = true;
717  break;
718  case XML_shadow:
719  maModel.mbShadow = bFlag;
720  maUsedFlags.mbShadowUsed = true;
721  break;
722  default:
723  OSL_FAIL( "Font::importDxfFlag - unexpected element identifier" );
724  }
725 }
726 
728 {
729  // font name
731 
732  // font family
733  switch( maModel.mnFamily )
734  {
735  case OOX_FONTFAMILY_NONE: maApiData.maDesc.Family = css::awt::FontFamily::DONTKNOW; break;
736  case OOX_FONTFAMILY_ROMAN: maApiData.maDesc.Family = css::awt::FontFamily::ROMAN; break;
737  case OOX_FONTFAMILY_SWISS: maApiData.maDesc.Family = css::awt::FontFamily::SWISS; break;
738  case OOX_FONTFAMILY_MODERN: maApiData.maDesc.Family = css::awt::FontFamily::MODERN; break;
739  case OOX_FONTFAMILY_SCRIPT: maApiData.maDesc.Family = css::awt::FontFamily::SCRIPT; break;
740  case OOX_FONTFAMILY_DECORATIVE: maApiData.maDesc.Family = css::awt::FontFamily::DECORATIVE; break;
741  }
742 
743  // character set (API font descriptor uses rtl_TextEncoding in member CharSet!)
744  if( (0 <= maModel.mnCharSet) && (maModel.mnCharSet <= SAL_MAX_UINT8) )
745  maApiData.maDesc.CharSet = static_cast< sal_Int16 >(
746  rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maModel.mnCharSet ) ) );
747 
748  // color, height, weight, slant, strikeout, outline, shadow
749  maApiData.mnColor = maModel.maColor.getColor( getBaseFilter().getGraphicHelper() );
750  maApiData.maDesc.Height = static_cast< sal_Int16 >( maModel.mfHeight * 20.0 );
751  maApiData.maDesc.Weight = maModel.mbBold ? css::awt::FontWeight::BOLD : css::awt::FontWeight::NORMAL;
752  maApiData.maDesc.Slant = maModel.mbItalic ? css::awt::FontSlant_ITALIC : css::awt::FontSlant_NONE;
753  maApiData.maDesc.Strikeout = maModel.mbStrikeout ? css::awt::FontStrikeout::SINGLE : css::awt::FontStrikeout::NONE;
756 
757  // underline
758  switch( maModel.mnUnderline )
759  {
760  case XML_double: maApiData.maDesc.Underline = css::awt::FontUnderline::DOUBLE; break;
761  case XML_doubleAccounting: maApiData.maDesc.Underline = css::awt::FontUnderline::DOUBLE; break;
762  case XML_none: maApiData.maDesc.Underline = css::awt::FontUnderline::NONE; break;
763  case XML_single: maApiData.maDesc.Underline = css::awt::FontUnderline::SINGLE; break;
764  case XML_singleAccounting: maApiData.maDesc.Underline = css::awt::FontUnderline::SINGLE; break;
765  }
766 
767  // escapement
768  switch( maModel.mnEscapement )
769  {
770  case XML_baseline:
773  break;
774  case XML_superscript:
777  break;
778  case XML_subscript:
781  break;
782  }
783 
784  // supported script types
785  if( maUsedFlags.mbNameUsed )
786  {
787  PropertySet aDocProps( getDocument() );
788  Reference< XDevice > xDevice( aDocProps.getAnyProperty( PROP_ReferenceDevice ), UNO_QUERY );
789  if( xDevice.is() )
790  {
791  Reference< XFont2 > xFont( xDevice->getFont( maApiData.maDesc ), UNO_QUERY );
792  if( xFont.is() )
793  {
794  // #91658# CJK fonts
795  bool bHasAsian =
796  xFont->hasGlyphs( OUString( u'\x3041' ) ) || // 3040-309F: Hiragana
797  xFont->hasGlyphs( OUString( u'\x30A1' ) ) || // 30A0-30FF: Katakana
798  xFont->hasGlyphs( OUString( u'\x3111' ) ) || // 3100-312F: Bopomofo
799  xFont->hasGlyphs( OUString( u'\x3131' ) ) || // 3130-318F: Hangul Compatibility Jamo
800  xFont->hasGlyphs( OUString( u'\x3301' ) ) || // 3300-33FF: CJK Compatibility
801  xFont->hasGlyphs( OUString( u'\x3401' ) ) || // 3400-4DBF: CJK Unified Ideographs Extension A
802  xFont->hasGlyphs( OUString( u'\x4E01' ) ) || // 4E00-9FFF: CJK Unified Ideographs
803  xFont->hasGlyphs( OUString( u'\x7E01' ) ) || // 4E00-9FFF: CJK Unified Ideographs
804  xFont->hasGlyphs( OUString( u'\xA001' ) ) || // A001-A48F: Yi Syllables
805  xFont->hasGlyphs( OUString( u'\xAC01' ) ) || // AC00-D7AF: Hangul Syllables
806  xFont->hasGlyphs( OUString( u'\xCC01' ) ) || // AC00-D7AF: Hangul Syllables
807  xFont->hasGlyphs( OUString( u'\xF901' ) ) || // F900-FAFF: CJK Compatibility Ideographs
808  xFont->hasGlyphs( OUString( u'\xFF71' ) ); // FF00-FFEF: Halfwidth/Fullwidth Forms
809  // #113783# CTL fonts
810  bool bHasCmplx =
811  xFont->hasGlyphs( OUString( u'\x05D1' ) ) || // 0590-05FF: Hebrew
812  xFont->hasGlyphs( OUString( u'\x0631' ) ) || // 0600-06FF: Arabic
813  xFont->hasGlyphs( OUString( u'\x0721' ) ) || // 0700-074F: Syriac
814  xFont->hasGlyphs( OUString( u'\x0911' ) ) || // 0900-0DFF: Indic scripts
815  xFont->hasGlyphs( OUString( u'\x0E01' ) ) || // 0E00-0E7F: Thai
816  xFont->hasGlyphs( OUString( u'\xFB21' ) ) || // FB1D-FB4F: Hebrew Presentation Forms
817  xFont->hasGlyphs( OUString( u'\xFB51' ) ) || // FB50-FDFF: Arabic Presentation Forms-A
818  xFont->hasGlyphs( OUString( u'\xFE71' ) ); // FE70-FEFF: Arabic Presentation Forms-B
819  // Western fonts
820  bool bHasLatin =
821  (!bHasAsian && !bHasCmplx) ||
822  xFont->hasGlyphs( OUString( 'A' ) );
823 
824  lclSetFontName( maApiData.maLatinFont, maApiData.maDesc, bHasLatin );
825  lclSetFontName( maApiData.maAsianFont, maApiData.maDesc, bHasAsian );
826  lclSetFontName( maApiData.maCmplxFont, maApiData.maDesc, bHasCmplx );
827  }
828  }
829  }
830 }
831 
833 {
835 }
836 
837 static ::FontFamily lcl_getFontFamily( sal_Int32 nFamily )
838 {
839  ::FontFamily eScFamily = FAMILY_DONTKNOW;
840  switch( nFamily )
841  {
842  case css::awt::FontFamily::DONTKNOW:
843  eScFamily = FAMILY_DONTKNOW;
844  break;
845  case css::awt::FontFamily::ROMAN:
846  eScFamily = FAMILY_ROMAN;
847  break;
848  case css::awt::FontFamily::SWISS:
849  eScFamily = FAMILY_SWISS;
850  break;
851  case css::awt::FontFamily::MODERN:
852  eScFamily = FAMILY_MODERN;
853  break;
854  case css::awt::FontFamily::SCRIPT:
855  eScFamily = FAMILY_SCRIPT;
856  break;
857  case css::awt::FontFamily::DECORATIVE:
858  eScFamily = FAMILY_DECORATIVE;
859  break;
860  }
861  return eScFamily;
862 }
863 
864 void Font::fillToItemSet( SfxItemSet& rItemSet, bool bEditEngineText, bool bSkipPoolDefs ) const
865 {
866  if ( maUsedFlags.mbNameUsed )
867  {
868  if( !maApiData.maLatinFont.maName.isEmpty() )
869  {
870  rtl_TextEncoding eFontEnc = maApiData.maLatinFont.mnTextEnc;
871  // taken from binary importer
872  rtl_TextEncoding eTempTextEnc = (bEditEngineText && (eFontEnc == getTextEncoding())) ?
873  ScfTools::GetSystemTextEncoding() : eFontEnc;
874 
876  PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT );
877  ScfTools::PutItem( rItemSet, aFontItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_FONTINFO) : ATTR_FONT, bSkipPoolDefs );
878  }
879  if( !maApiData.maAsianFont.maName.isEmpty() )
880  {
881  rtl_TextEncoding eFontEnc = maApiData.maAsianFont.mnTextEnc;
882  // taken from binary importer
883  rtl_TextEncoding eTempTextEnc = (bEditEngineText && (eFontEnc == getTextEncoding())) ?
884  ScfTools::GetSystemTextEncoding() : eFontEnc;
886  PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT );
887  ScfTools::PutItem( rItemSet, aFontItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_FONTINFO_CJK) : ATTR_CJK_FONT, bSkipPoolDefs );
888  }
889  if( !maApiData.maCmplxFont.maName.isEmpty() )
890  {
891  rtl_TextEncoding eFontEnc = maApiData.maCmplxFont.mnTextEnc;
892  // taken from binary importer
893  rtl_TextEncoding eTempTextEnc = (bEditEngineText && (eFontEnc == getTextEncoding())) ?
894  ScfTools::GetSystemTextEncoding() : eFontEnc;
896  PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT );
897  ScfTools::PutItem( rItemSet, aFontItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_FONTINFO_CTL) : ATTR_CTL_FONT, bSkipPoolDefs );
898  }
899  }
900  // font height
902  {
903  sal_Int32 nHeight = maApiData.maDesc.Height;
904  // do we use XclFontItemType::HeaderFooter ( or is it just relevant for the binary filter )
905  if( bEditEngineText/* && (eType != XclFontItemType::HeaderFooter) */) // do not convert header/footer height
906  nHeight = (nHeight * 127 + 36) / EXC_POINTS_PER_INCH; // 1 in == 72 pt
907  SvxFontHeightItem aHeightItem( nHeight, 100, ATTR_FONT_HEIGHT );
908  ScfTools::PutItem( rItemSet, aHeightItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_FONTHEIGHT) : ATTR_FONT_HEIGHT, bSkipPoolDefs );
909  ScfTools::PutItem( rItemSet, aHeightItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_FONTHEIGHT_CJK) : ATTR_CJK_FONT_HEIGHT, bSkipPoolDefs );
910  ScfTools::PutItem( rItemSet, aHeightItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_FONTHEIGHT_CTL) : ATTR_CTL_FONT_HEIGHT, bSkipPoolDefs );
911  }
912  // font weight
914  {
916  SvxWeightItem aWeightItem( fWeight, ATTR_FONT_WEIGHT );
917  ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_WEIGHT) : ATTR_FONT_WEIGHT, bSkipPoolDefs );
918  ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_WEIGHT_CTL) : ATTR_CTL_FONT_WEIGHT, bSkipPoolDefs );
919  ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_WEIGHT_CJK) : ATTR_CJK_FONT_WEIGHT, bSkipPoolDefs );
920  }
921  // font posture
923  {
924  SvxPostureItem aPostItem( ( maApiData.maDesc.Slant == css::awt::FontSlant_ITALIC ) ? ITALIC_NORMAL : ITALIC_NONE, ATTR_FONT_POSTURE);
925  ScfTools::PutItem( rItemSet, aPostItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_ITALIC) : ATTR_FONT_POSTURE, bSkipPoolDefs );
926  ScfTools::PutItem( rItemSet, aPostItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_ITALIC_CJK) : ATTR_CJK_FONT_POSTURE, bSkipPoolDefs );
927  ScfTools::PutItem( rItemSet, aPostItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_ITALIC_CTL) : ATTR_CTL_FONT_POSTURE, bSkipPoolDefs );
928  }
929  // character color
931  {
932  ScfTools::PutItem( rItemSet,SvxColorItem( maApiData.mnColor, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_COLOR) : ATTR_FONT_COLOR), bSkipPoolDefs );
933  }
934  // underline style
936  {
937  FontLineStyle eScUnderl;
938  if ( maApiData.maDesc.Underline == css::awt::FontUnderline::DOUBLE )
939  eScUnderl = LINESTYLE_DOUBLE;
940  else if ( maApiData.maDesc.Underline == css::awt::FontUnderline::SINGLE )
941  eScUnderl = LINESTYLE_SINGLE;
942  else
943  eScUnderl = LINESTYLE_NONE;
944  SvxUnderlineItem aUnderlItem( eScUnderl, ATTR_FONT_UNDERLINE );
945  ScfTools::PutItem( rItemSet, aUnderlItem, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_UNDERLINE) : ATTR_FONT_UNDERLINE, bSkipPoolDefs );
946  }
947  // strike out style
949  {
950  ScfTools::PutItem( rItemSet, SvxCrossedOutItem( maModel.mbStrikeout ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_STRIKEOUT) : ATTR_FONT_CROSSEDOUT ), bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_STRIKEOUT) : ATTR_FONT_CROSSEDOUT, bSkipPoolDefs );
951  }
952 
953  // outline style
955  {
956  ScfTools::PutItem( rItemSet, SvxContourItem( maApiData.mbOutline, ATTR_FONT_CONTOUR ), bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_OUTLINE) : ATTR_FONT_CONTOUR, bSkipPoolDefs );
957  }
958 
959  // shadow style
961  {
962  ScfTools::PutItem( rItemSet, SvxShadowedItem( maApiData.mbShadow, ATTR_FONT_SHADOWED ), bEditEngineText ? static_cast<sal_uInt16>(EE_CHAR_SHADOW) : ATTR_FONT_SHADOWED, bSkipPoolDefs );
963  }
965  {
966  SvxEscapement eScEscapem = SvxEscapement::Off;
968  eScEscapem = SvxEscapement::Superscript;
970  eScEscapem = SvxEscapement::Subscript;
971  if( bEditEngineText )
972  {
973  // #TODO handle EscapementHeight
974  rItemSet.Put( SvxEscapementItem( eScEscapem, EE_CHAR_ESCAPEMENT ) );
975  }
976  }
977 }
978 
979 void Font::writeToPropertyMap( PropertyMap& rPropMap ) const
980 {
981  // font name properties
982  if( maUsedFlags.mbNameUsed )
983  {
984  if( !maApiData.maLatinFont.maName.isEmpty() )
985  {
986  rPropMap.setProperty( PROP_CharFontName, maApiData.maLatinFont.maName);
987  rPropMap.setProperty( PROP_CharFontFamily, maApiData.maLatinFont.mnFamily);
988  rPropMap.setProperty( PROP_CharFontCharSet, maApiData.maLatinFont.mnTextEnc);
989  }
990  if( !maApiData.maAsianFont.maName.isEmpty() )
991  {
992  rPropMap.setProperty( PROP_CharFontNameAsian, maApiData.maAsianFont.maName);
993  rPropMap.setProperty( PROP_CharFontFamilyAsian, maApiData.maAsianFont.mnFamily);
994  rPropMap.setProperty( PROP_CharFontCharSetAsian, maApiData.maAsianFont.mnTextEnc);
995  }
996  if( !maApiData.maCmplxFont.maName.isEmpty() )
997  {
998  rPropMap.setProperty( PROP_CharFontNameComplex, maApiData.maCmplxFont.maName);
999  rPropMap.setProperty( PROP_CharFontFamilyComplex, maApiData.maCmplxFont.mnFamily);
1000  rPropMap.setProperty( PROP_CharFontCharSetComplex, maApiData.maCmplxFont.mnTextEnc);
1001  }
1002  }
1003  // font height
1005  {
1006  float fHeight = static_cast< float >( maApiData.maDesc.Height / 20.0 ); // twips to points
1007  rPropMap.setProperty( PROP_CharHeight, fHeight);
1008  rPropMap.setProperty( PROP_CharHeightAsian, fHeight);
1009  rPropMap.setProperty( PROP_CharHeightComplex, fHeight);
1010  }
1011  // font weight
1013  {
1014  float fWeight = maApiData.maDesc.Weight;
1015  rPropMap.setProperty( PROP_CharWeight, fWeight);
1016  rPropMap.setProperty( PROP_CharWeightAsian, fWeight);
1017  rPropMap.setProperty( PROP_CharWeightComplex, fWeight);
1018  }
1019  // font posture
1021  {
1022  rPropMap.setProperty( PROP_CharPosture, maApiData.maDesc.Slant);
1023  rPropMap.setProperty( PROP_CharPostureAsian, maApiData.maDesc.Slant);
1024  rPropMap.setProperty( PROP_CharPostureComplex, maApiData.maDesc.Slant);
1025  }
1026  // character color
1027  if( maUsedFlags.mbColorUsed )
1028  rPropMap.setProperty( PROP_CharColor, maApiData.mnColor);
1029  // underline style
1031  rPropMap.setProperty( PROP_CharUnderline, maApiData.maDesc.Underline);
1032  // strike out style
1034  rPropMap.setProperty( PROP_CharStrikeout, maApiData.maDesc.Strikeout);
1035  // outline style
1037  rPropMap.setProperty( PROP_CharContoured, maApiData.mbOutline);
1038  // shadow style
1040  rPropMap.setProperty( PROP_CharShadowed, maApiData.mbShadow);
1041  // escapement
1043  {
1044  rPropMap.setProperty( PROP_CharEscapement, maApiData.mnEscapement);
1045  rPropMap.setProperty( PROP_CharEscapementHeight, maApiData.mnEscapeHeight);
1046  }
1047 }
1048 
1049 void Font::writeToPropertySet( PropertySet& rPropSet ) const
1050 {
1051  PropertyMap aPropMap;
1052  writeToPropertyMap( aPropMap );
1053  rPropSet.setProperties( aPropMap );
1054 }
1055 
1057  mnHorAlign( XML_general ),
1058  mnVerAlign( XML_bottom ),
1059  mnTextDir( OOX_XF_TEXTDIR_CONTEXT ),
1060  mnRotation( OOX_XF_ROTATION_NONE ),
1061  mnIndent( OOX_XF_INDENT_NONE ),
1062  mbWrapText( false ),
1063  mbShrink( false ),
1064  mbJustLastLine( false )
1065 {
1066 }
1067 
1069 {
1070  static const sal_Int32 spnHorAligns[] = {
1071  XML_general, XML_left, XML_center, XML_right,
1072  XML_fill, XML_justify, XML_centerContinuous, XML_distributed };
1073  mnHorAlign = STATIC_ARRAY_SELECT( spnHorAligns, nHorAlign, XML_general );
1074 }
1075 
1077 {
1078  static const sal_Int32 spnVerAligns[] = {
1079  XML_top, XML_center, XML_bottom, XML_justify, XML_distributed };
1080  mnVerAlign = STATIC_ARRAY_SELECT( spnVerAligns, nVerAlign, XML_bottom );
1081 }
1082 
1084  meHorJustify( css::table::CellHoriJustify_STANDARD ),
1085  mnHorJustifyMethod( css::table::CellJustifyMethod::AUTO ),
1086  mnVerJustify( css::table::CellVertJustify2::STANDARD ),
1087  mnVerJustifyMethod( css::table::CellJustifyMethod::AUTO ),
1088  meOrientation( css::table::CellOrientation_STANDARD ),
1089  mnRotation( 0 ),
1090  mnWritingMode( css::text::WritingMode2::PAGE ),
1091  mnIndent( 0 ),
1092  mbWrapText( false ),
1093  mbShrink( false )
1094 {
1095 }
1096 
1097 bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight )
1098 {
1099  return
1100  (rLeft.meHorJustify == rRight.meHorJustify) &&
1101  (rLeft.mnHorJustifyMethod == rRight.mnHorJustifyMethod) &&
1102  (rLeft.mnVerJustify == rRight.mnVerJustify) &&
1103  (rLeft.mnVerJustifyMethod == rRight.mnVerJustifyMethod) &&
1104  (rLeft.meOrientation == rRight.meOrientation) &&
1105  (rLeft.mnRotation == rRight.mnRotation) &&
1106  (rLeft.mnWritingMode == rRight.mnWritingMode) &&
1107  (rLeft.mnIndent == rRight.mnIndent) &&
1108  (rLeft.mbWrapText == rRight.mbWrapText) &&
1109  (rLeft.mbShrink == rRight.mbShrink);
1110 }
1111 
1113  WorkbookHelper( rHelper )
1114 {
1115 }
1116 
1118 {
1119  maModel.mnVerAlign = rAttribs.getToken( XML_vertical, XML_bottom );
1120  maModel.mnTextDir = rAttribs.getInteger( XML_readingOrder, OOX_XF_TEXTDIR_CONTEXT );
1121  maModel.mnRotation = rAttribs.getInteger( XML_textRotation, OOX_XF_ROTATION_NONE );
1122  sal_Int32 nDefaultHorAlign = XML_general;
1123  if (maModel.mnRotation != OOX_XF_ROTATION_NONE)
1124  {
1125  if (maModel.mnRotation < 90 || maModel.mnRotation == 180)
1126  {
1127  nDefaultHorAlign = XML_left;
1128  }
1129  else
1130  {
1131  nDefaultHorAlign = XML_right;
1132  }
1133  }
1134  maModel.mnHorAlign = rAttribs.getToken( XML_horizontal, nDefaultHorAlign );
1135  maModel.mnIndent = rAttribs.getInteger( XML_indent, OOX_XF_INDENT_NONE );
1136  maModel.mbWrapText = rAttribs.getBool( XML_wrapText, false );
1137  maModel.mbShrink = rAttribs.getBool( XML_shrinkToFit, false );
1138  maModel.mbJustLastLine = rAttribs.getBool( XML_justifyLastLine, false );
1139 }
1140 
1141 void Alignment::setBiff12Data( sal_uInt32 nFlags )
1142 {
1143  maModel.setBiffHorAlign( extractValue< sal_uInt8 >( nFlags, 16, 3 ) );
1144  maModel.setBiffVerAlign( extractValue< sal_uInt8 >( nFlags, 19, 3 ) );
1145  maModel.mnTextDir = extractValue< sal_Int32 >( nFlags, 26, 2 );
1146  maModel.mnRotation = extractValue< sal_Int32 >( nFlags, 0, 8 );
1147  maModel.mnIndent = extractValue< sal_uInt8 >( nFlags, 8, 8 );
1148  maModel.mbWrapText = getFlag( nFlags, BIFF12_XF_WRAPTEXT );
1149  maModel.mbShrink = getFlag( nFlags, BIFF12_XF_SHRINK );
1150  maModel.mbJustLastLine = getFlag( nFlags, BIFF12_XF_JUSTLASTLINE );
1151 }
1152 
1154 {
1155  // horizontal alignment
1156  switch( maModel.mnHorAlign )
1157  {
1158  case XML_center: maApiData.meHorJustify = css::table::CellHoriJustify_CENTER; break;
1159  case XML_centerContinuous: maApiData.meHorJustify = css::table::CellHoriJustify_CENTER; break;
1160  case XML_distributed: maApiData.meHorJustify = css::table::CellHoriJustify_BLOCK; break;
1161  case XML_fill: maApiData.meHorJustify = css::table::CellHoriJustify_REPEAT; break;
1162  case XML_general: maApiData.meHorJustify = css::table::CellHoriJustify_STANDARD; break;
1163  case XML_justify: maApiData.meHorJustify = css::table::CellHoriJustify_BLOCK; break;
1164  case XML_left: maApiData.meHorJustify = css::table::CellHoriJustify_LEFT; break;
1165  case XML_right: maApiData.meHorJustify = css::table::CellHoriJustify_RIGHT; break;
1166  }
1167 
1168  if (maModel.mnHorAlign == XML_distributed)
1169  maApiData.mnHorJustifyMethod = css::table::CellJustifyMethod::DISTRIBUTE;
1170 
1171  // vertical alignment
1172  switch( maModel.mnVerAlign )
1173  {
1174  case XML_bottom: maApiData.mnVerJustify = css::table::CellVertJustify2::BOTTOM; break;
1175  case XML_center: maApiData.mnVerJustify = css::table::CellVertJustify2::CENTER; break;
1176  case XML_distributed: maApiData.mnVerJustify = css::table::CellVertJustify2::BLOCK; break;
1177  case XML_justify: maApiData.mnVerJustify = css::table::CellVertJustify2::BLOCK; break;
1178  case XML_top: maApiData.mnVerJustify = css::table::CellVertJustify2::TOP; break;
1179  }
1180 
1181  if (maModel.mnVerAlign == XML_distributed)
1182  maApiData.mnVerJustifyMethod = css::table::CellJustifyMethod::DISTRIBUTE;
1183 
1184  /* indentation: expressed as number of blocks of 3 space characters in
1185  OOXML. */
1186  sal_Int32 nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, Unit::Space );
1187  if( (0 <= nIndent) && (nIndent <= SAL_MAX_INT16) )
1188  maApiData.mnIndent = static_cast< sal_Int16 >( nIndent );
1189 
1190  // complex text direction
1191  switch( maModel.mnTextDir )
1192  {
1193  case OOX_XF_TEXTDIR_CONTEXT: maApiData.mnWritingMode = css::text::WritingMode2::PAGE; break;
1194  case OOX_XF_TEXTDIR_LTR: maApiData.mnWritingMode = css::text::WritingMode2::LR_TB; break;
1195  case OOX_XF_TEXTDIR_RTL: maApiData.mnWritingMode = css::text::WritingMode2::RL_TB; break;
1196  }
1197 
1198  // rotation: 0-90 means 0 to 90 degrees ccw, 91-180 means 1 to 90 degrees cw, 255 means stacked
1199  sal_Int32 nOoxRot = maModel.mnRotation;
1200  maApiData.mnRotation = ((0 <= nOoxRot) && (nOoxRot <= 90)) ?
1201  (100 * nOoxRot) :
1202  (((91 <= nOoxRot) && (nOoxRot <= 180)) ? (100 * (450 - nOoxRot)) : 0);
1203 
1204  // "Orientation" property used for character stacking
1205  maApiData.meOrientation = (nOoxRot == OOX_XF_ROTATION_STACKED) ?
1206  css::table::CellOrientation_STACKED : css::table::CellOrientation_STANDARD;
1207 
1208  // alignment flags (#i84960 automatic line break, if vertically justified/distributed)
1209  maApiData.mbWrapText = maModel.mbWrapText || (maModel.mnVerAlign == XML_distributed) || (maModel.mnVerAlign == XML_justify);
1211 
1212 }
1213 
1215 {
1216  ::SvxCellVerJustify nVert = ::SvxCellVerJustify::Standard;
1217  switch ( maApiData.mnVerJustify )
1218  {
1219  case css::table::CellVertJustify2::BOTTOM:
1220  nVert = ::SvxCellVerJustify::Bottom;
1221  break;
1222  case css::table::CellVertJustify2::CENTER:
1223  nVert = ::SvxCellVerJustify::Center;
1224  break;
1225  case css::table::CellVertJustify2::TOP:
1226  nVert = ::SvxCellVerJustify::Top;
1227  break;
1228  case css::table::CellVertJustify2::BLOCK:
1229  nVert = ::SvxCellVerJustify::Block;
1230  break;
1231  case css::table::CellVertJustify2::STANDARD:
1232  default:
1233  nVert = ::SvxCellVerJustify::Standard;
1234  break;
1235  }
1236  return nVert;
1237 }
1238 
1240 {
1241  ::SvxCellHorJustify nHori = ::SvxCellHorJustify::Standard;
1242  switch( maApiData.meHorJustify )
1243  {
1244  case css::table::CellHoriJustify_LEFT:
1245  nHori = ::SvxCellHorJustify::Left;
1246  break;
1247  case css::table::CellHoriJustify_CENTER:
1248  nHori = ::SvxCellHorJustify::Center;
1249  break;
1250  case css::table::CellHoriJustify_RIGHT:
1251  nHori = ::SvxCellHorJustify::Right;
1252  break;
1253  case css::table::CellHoriJustify_BLOCK:
1254  nHori = ::SvxCellHorJustify::Block;
1255  break;
1256  case css::table::CellHoriJustify_REPEAT:
1257  nHori = ::SvxCellHorJustify::Repeat;
1258  break;
1259  case css::table::CellHoriJustify_STANDARD:
1260  default:
1261  nHori = ::SvxCellHorJustify::Standard;
1262  break;
1263  }
1264  return nHori;
1265 }
1266 
1268 {
1269  SvxFrameDirection eFrameDir = SvxFrameDirection::Environment;
1270  switch( maApiData.mnWritingMode )
1271  {
1272  case css::text::WritingMode2::PAGE:
1273  eFrameDir = SvxFrameDirection::Environment;
1274  break;
1275  case css::text::WritingMode2::LR_TB:
1276  eFrameDir = SvxFrameDirection::Horizontal_LR_TB;
1277  break;
1278  case css::text::WritingMode2::RL_TB:
1279  eFrameDir = SvxFrameDirection::Horizontal_RL_TB;
1280  break;
1281  default:
1282  OSL_FAIL( "GetScFrameDir - unknown CTL text direction" );
1283  }
1284  return eFrameDir;
1285 }
1286 
1287 void Alignment::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
1288 {
1289  // horizontal alignment
1290  ScfTools::PutItem( rItemSet, SvxHorJustifyItem( GetScHorAlign(), ATTR_HOR_JUSTIFY ), bSkipPoolDefs );
1291  ScfTools::PutItem( rItemSet, SvxJustifyMethodItem( ( maApiData.mnHorJustifyMethod == css::table::CellJustifyMethod::DISTRIBUTE ) ? ::SvxCellJustifyMethod::Distribute : ::SvxCellJustifyMethod::Auto, ATTR_HOR_JUSTIFY_METHOD ), bSkipPoolDefs );
1292  ScfTools::PutItem( rItemSet, SvxVerJustifyItem( GetScVerAlign(), ATTR_VER_JUSTIFY ), bSkipPoolDefs );
1293  // vertical alignment
1294  ScfTools::PutItem( rItemSet, SvxJustifyMethodItem( ( maApiData.mnVerJustifyMethod == css::table::CellJustifyMethod::DISTRIBUTE ) ? ::SvxCellJustifyMethod::Distribute : ::SvxCellJustifyMethod::Auto, ATTR_VER_JUSTIFY_METHOD ), bSkipPoolDefs );
1295 
1296  // CTL text direction
1297  ScfTools::PutItem( rItemSet, SvxFrameDirectionItem( GetScFrameDir(), ATTR_WRITINGDIR ), bSkipPoolDefs );
1298  // set an angle in the range from -90 to 90 degrees
1299  ScfTools::PutItem( rItemSet, ScRotateValueItem( maApiData.mnRotation ), bSkipPoolDefs );
1300  // Orientation
1301  ScfTools::PutItem( rItemSet, ScVerticalStackCell( maApiData.meOrientation == css::table::CellOrientation_STACKED ), bSkipPoolDefs );
1302  // indent
1303  ScfTools::PutItem( rItemSet, ScIndentItem( maApiData.mnIndent ), bSkipPoolDefs );
1304  // line wrap
1305  ScfTools::PutItem( rItemSet, ScLineBreakCell( maApiData.mbWrapText ), bSkipPoolDefs );
1306  ScfTools::PutItem( rItemSet, ScShrinkToFitCell( maApiData.mbShrink ), bSkipPoolDefs );
1307 }
1308 
1310  mbLocked( true ), // default in Excel and Calc
1311  mbHidden( false )
1312 {
1313 }
1314 
1316  maCellProt( true, false, false, false )
1317 {
1318 }
1319 
1320 bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight )
1321 {
1322  return
1323  (rLeft.maCellProt.IsLocked == rRight.maCellProt.IsLocked) &&
1324  (rLeft.maCellProt.IsFormulaHidden == rRight.maCellProt.IsFormulaHidden) &&
1325  (rLeft.maCellProt.IsHidden == rRight.maCellProt.IsHidden) &&
1326  (rLeft.maCellProt.IsPrintHidden == rRight.maCellProt.IsPrintHidden);
1327 }
1328 
1330  WorkbookHelper( rHelper )
1331 {
1332 }
1333 
1335 {
1336  maModel.mbLocked = rAttribs.getBool( XML_locked, true );
1337  maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
1338 }
1339 
1340 void Protection::setBiff12Data( sal_uInt32 nFlags )
1341 {
1342  maModel.mbLocked = getFlag( nFlags, BIFF12_XF_LOCKED );
1343  maModel.mbHidden = getFlag( nFlags, BIFF12_XF_HIDDEN );
1344 }
1345 
1347 {
1348  maApiData.maCellProt.IsLocked = maModel.mbLocked;
1349  maApiData.maCellProt.IsFormulaHidden = maModel.mbHidden;
1350 }
1351 
1352 void Protection::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
1353 {
1354  ScfTools::PutItem( rItemSet, ScProtectionAttr( maApiData.maCellProt.IsLocked, maApiData.maCellProt.IsFormulaHidden ), bSkipPoolDefs );
1355 }
1356 
1357 namespace {
1358 
1359 bool lcl_isBorder(const css::table::BorderLine& rBorder)
1360 {
1361  return (rBorder.InnerLineWidth > 0) || (rBorder.OuterLineWidth > 0);
1362 }
1363 
1364 }
1365 
1367  mnStyle( XML_none ),
1368  mbUsed( !bDxf )
1369 {
1371 }
1372 
1373 void BorderLineModel::setBiffStyle( sal_Int32 nLineStyle )
1374 {
1375  static const sal_Int32 spnStyleIds[] = {
1376  XML_none, XML_thin, XML_medium, XML_dashed,
1377  XML_dotted, XML_thick, XML_double, XML_hair,
1378  XML_mediumDashed, XML_dashDot, XML_mediumDashDot, XML_dashDotDot,
1379  XML_mediumDashDotDot, XML_slantDashDot };
1380  mnStyle = STATIC_ARRAY_SELECT( spnStyleIds, nLineStyle, XML_none );
1381 }
1382 
1384  maLeft( bDxf ),
1385  maRight( bDxf ),
1386  maTop( bDxf ),
1387  maBottom( bDxf ),
1388  maDiagonal( bDxf ),
1389  mbDiagTLtoBR( false ),
1390  mbDiagBLtoTR( false )
1391 {
1392 }
1393 
1395  mbBorderUsed( false ),
1396  mbDiagUsed( false )
1397 {
1398 }
1399 
1401 {
1402  return
1403  ( lcl_isBorder( maTop ) && maTop.OuterLineWidth > 0 ) ||
1404  ( lcl_isBorder( maBottom ) && maBottom.OuterLineWidth > 0 ) ||
1405  ( lcl_isBorder( maLeft ) && maLeft.OuterLineWidth > 0 ) ||
1406  ( lcl_isBorder( maRight ) && maRight.OuterLineWidth > 0 );
1407 }
1408 
1409 namespace {
1410 
1411 void lclSetBorderLineWidth( BorderLine& rBorderLine,
1412  sal_Int16 nOuter, sal_Int16 nDist = API_LINE_NONE, sal_Int16 nInner = API_LINE_NONE )
1413 {
1414  rBorderLine.OuterLineWidth = nOuter;
1415  rBorderLine.LineDistance = nDist;
1416  rBorderLine.InnerLineWidth = nInner;
1417 }
1418 
1419 } // namespace
1420 
1421 Border::Border( const WorkbookHelper& rHelper, bool bDxf ) :
1422  WorkbookHelper( rHelper ),
1423  maModel( bDxf ),
1424  mbDxf( bDxf )
1425 {
1426 }
1427 
1428 void Border::importBorder( const AttributeList& rAttribs )
1429 {
1430  maModel.mbDiagTLtoBR = rAttribs.getBool( XML_diagonalDown, false );
1431  maModel.mbDiagBLtoTR = rAttribs.getBool( XML_diagonalUp, false );
1432 }
1433 
1434 void Border::importStyle( sal_Int32 nElement, const AttributeList& rAttribs )
1435 {
1436  if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
1437  {
1438  pBorderLine->mnStyle = rAttribs.getToken( XML_style, XML_none );
1439  pBorderLine->mbUsed = true;
1440  }
1441 }
1442 
1443 void Border::importColor( sal_Int32 nElement, const AttributeList& rAttribs )
1444 {
1445  if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
1446  pBorderLine->maColor.importColor( rAttribs );
1447 }
1448 
1450 {
1451  sal_uInt8 nFlags = rStrm.readuInt8();
1452  maModel.mbDiagTLtoBR = getFlag( nFlags, BIFF12_BORDER_DIAG_TLBR );
1453  maModel.mbDiagBLtoTR = getFlag( nFlags, BIFF12_BORDER_DIAG_BLTR );
1454  maModel.maTop.setBiffStyle( rStrm.readuInt16() );
1455  rStrm >> maModel.maTop.maColor;
1457  rStrm >> maModel.maBottom.maColor;
1459  rStrm >> maModel.maLeft.maColor;
1461  rStrm >> maModel.maRight.maColor;
1463  rStrm >> maModel.maDiagonal.maColor;
1464 }
1465 
1466 void Border::importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm )
1467 {
1468  SAL_WARN_IF( !mbDxf, "sc", "Border::importDxfBorder - missing conditional formatting flag" );
1469  if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
1470  {
1471  sal_uInt16 nStyle;
1472  rStrm >> pBorderLine->maColor;
1473  nStyle = rStrm.readuInt16();
1474  pBorderLine->setBiffStyle( nStyle );
1475  pBorderLine->mbUsed = true;
1476  }
1477 }
1478 
1479 void Border::finalizeImport( bool bRTL )
1480 {
1481  if ( bRTL )
1482  {
1485  maModel.maRight = aTmp;
1486  }
1489 
1494 
1495  if( maModel.mbDiagTLtoBR )
1497  if( maModel.mbDiagBLtoTR )
1499 }
1500 
1501 void Border::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
1502 {
1503  if( maApiData.mbBorderUsed )
1504  {
1505  SvxBoxItem aBoxItem( ATTR_BORDER );
1507 
1508  if (SvxBoxItem::LineToSvxLine(maApiData.maLeft, aLine, false))
1509  {
1510  aBoxItem.SetLine( &aLine, SvxBoxItemLine::LEFT );
1511  }
1512  if (SvxBoxItem::LineToSvxLine(maApiData.maRight, aLine, false))
1513  {
1514  aBoxItem.SetLine( &aLine, SvxBoxItemLine::RIGHT );
1515  }
1516  if (SvxBoxItem::LineToSvxLine(maApiData.maTop, aLine, false))
1517  {
1518  aBoxItem.SetLine( &aLine, SvxBoxItemLine::TOP );
1519  }
1520  if (SvxBoxItem::LineToSvxLine(maApiData.maBottom, aLine, false))
1521  {
1522  aBoxItem.SetLine( &aLine, SvxBoxItemLine::BOTTOM );
1523  }
1524  ScfTools::PutItem( rItemSet, aBoxItem, bSkipPoolDefs );
1525  }
1526  if ( maApiData.mbDiagUsed )
1527  {
1528  SvxLineItem aTLBRItem( ATTR_BORDER_TLBR );
1529  SvxLineItem aBLTRItem( ATTR_BORDER_BLTR );
1531  if (SvxBoxItem::LineToSvxLine(maApiData.maTLtoBR, aLine, false))
1532  {
1533  aTLBRItem.SetLine( &aLine );
1534  }
1535  if (SvxBoxItem::LineToSvxLine(maApiData.maBLtoTR, aLine, false))
1536  {
1537  aBLTRItem.SetLine( &aLine );
1538  }
1539  ScfTools::PutItem( rItemSet, aTLBRItem, bSkipPoolDefs );
1540  ScfTools::PutItem( rItemSet, aBLTRItem, bSkipPoolDefs );
1541  }
1542 }
1543 
1545 {
1546  switch( nElement )
1547  {
1548  case XLS_TOKEN( left ): return &maModel.maLeft;
1549  case XLS_TOKEN( start ): return &maModel.maLeft;
1550  case XLS_TOKEN( right ): return &maModel.maRight;
1551  case XLS_TOKEN( end ): return &maModel.maRight;
1552  case XLS_TOKEN( top ): return &maModel.maTop;
1553  case XLS_TOKEN( bottom ): return &maModel.maBottom;
1554  case XLS_TOKEN( diagonal ): return &maModel.maDiagonal;
1555  }
1556  return nullptr;
1557 }
1558 
1559 bool Border::convertBorderLine( BorderLine2& rBorderLine, const BorderLineModel& rModel )
1560 {
1561  // Document: sc/qa/unit/data/README.cellborders
1562 
1563  rBorderLine.Color = sal_Int32(rModel.maColor.getColor( getBaseFilter().getGraphicHelper(), API_RGB_BLACK ));
1564  switch( rModel.mnStyle )
1565  {
1566  case XML_dashDot:
1567  lclSetBorderLineWidth( rBorderLine, API_LINE_THIN );
1568  rBorderLine.LineStyle = BorderLineStyle::DASH_DOT;
1569  break;
1570  case XML_dashDotDot:
1571  lclSetBorderLineWidth( rBorderLine, API_LINE_THIN );
1572  rBorderLine.LineStyle = BorderLineStyle::DASH_DOT_DOT;
1573  break;
1574  case XML_dashed:
1575  lclSetBorderLineWidth( rBorderLine, API_LINE_THIN );
1576  rBorderLine.LineStyle = BorderLineStyle::FINE_DASHED;
1577  break;
1578  case XML_dotted:
1579  lclSetBorderLineWidth( rBorderLine, API_LINE_THIN );
1580  rBorderLine.LineStyle = BorderLineStyle::DOTTED;
1581  break;
1582  case XML_double:
1583  lclSetBorderLineWidth( rBorderLine, 10, 15, 10 );
1584  rBorderLine.LineStyle = BorderLineStyle::DOUBLE_THIN;
1585  break;
1586  case XML_hair: lclSetBorderLineWidth( rBorderLine, API_LINE_HAIR ); break;
1587  case XML_medium: lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); break;
1588  case XML_mediumDashDot:
1589  lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM );
1590  rBorderLine.LineStyle = BorderLineStyle::DASH_DOT;
1591  break;
1592  case XML_mediumDashDotDot:
1593  lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM );
1594  rBorderLine.LineStyle = BorderLineStyle::DASH_DOT_DOT;
1595  break;
1596  case XML_mediumDashed:
1597  lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM );
1598  rBorderLine.LineStyle = BorderLineStyle::DASHED;
1599  break;
1600  case XML_none: lclSetBorderLineWidth( rBorderLine, API_LINE_NONE ); break;
1601  case XML_slantDashDot:
1602  lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM );
1603  rBorderLine.LineStyle = BorderLineStyle::FINE_DASHED;
1604  break;
1605  case XML_thick: lclSetBorderLineWidth( rBorderLine, API_LINE_THICK ); break;
1606  case XML_thin: lclSetBorderLineWidth( rBorderLine, API_LINE_THIN ); break;
1607  default: lclSetBorderLineWidth( rBorderLine, API_LINE_NONE ); break;
1608  }
1609  return rModel.mbUsed;
1610 }
1611 
1613  mnPattern( XML_none ),
1614  mbPattColorUsed( !bDxf ),
1615  mbFillColorUsed( !bDxf ),
1616  mbPatternUsed( !bDxf )
1617 {
1620 }
1621 
1622 void PatternFillModel::setBiffPattern( sal_Int32 nPattern )
1623 {
1624  static const sal_Int32 spnPatternIds[] = {
1625  XML_none, XML_solid, XML_mediumGray, XML_darkGray,
1626  XML_lightGray, XML_darkHorizontal, XML_darkVertical, XML_darkDown,
1627  XML_darkUp, XML_darkGrid, XML_darkTrellis, XML_lightHorizontal,
1628  XML_lightVertical, XML_lightDown, XML_lightUp, XML_lightGrid,
1629  XML_lightTrellis, XML_gray125, XML_gray0625 };
1630  mnPattern = STATIC_ARRAY_SELECT( spnPatternIds, nPattern, XML_none );
1631 }
1632 
1634  mnType( XML_linear ),
1635  mfAngle( 0.0 ),
1636  mfLeft( 0.0 ),
1637  mfRight( 0.0 ),
1638  mfTop( 0.0 ),
1639  mfBottom( 0.0 )
1640 {
1641 }
1642 
1644 {
1645  sal_Int32 nType;
1646  nType = rStrm.readInt32();
1647  mfAngle = rStrm.readDouble();
1648  mfLeft = rStrm.readDouble();
1649  mfRight = rStrm.readDouble();
1650  mfTop = rStrm.readDouble();
1651  mfBottom = rStrm.readDouble();
1652  static const sal_Int32 spnTypes[] = { XML_linear, XML_path };
1653  mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
1654 }
1655 
1657 {
1658  Color aColor;
1659  double fPosition;
1660  if( bDxf )
1661  {
1662  rStrm.skip( 2 );
1663  fPosition = rStrm.readDouble();
1664  rStrm >> aColor;
1665  }
1666  else
1667  {
1668  rStrm >> aColor;
1669  fPosition = rStrm.readDouble();
1670  }
1671  if( !rStrm.isEof() && (fPosition >= 0.0) )
1672  maColors[ fPosition ] = aColor;
1673 }
1674 
1677  mbTransparent( true ),
1678  mbUsed( false )
1679 {
1680 }
1681 
1682 namespace {
1683 
1684 sal_Int32 lclGetMixedColorComp( sal_Int32 nPatt, sal_Int32 nFill, sal_Int32 nAlpha )
1685 {
1686  return ((nPatt - nFill) * nAlpha) / 0x80 + nFill;
1687 }
1688 
1689 ::Color lclGetMixedColor( ::Color nPattColor, ::Color nFillColor, sal_Int32 nAlpha )
1690 {
1691  return ::Color(
1692  lclGetMixedColorComp( nPattColor.GetRed(), nFillColor.GetRed(), nAlpha ),
1693  lclGetMixedColorComp( nPattColor.GetGreen(), nFillColor.GetGreen(), nAlpha ),
1694  lclGetMixedColorComp( nPattColor.GetBlue(), nFillColor.GetBlue(), nAlpha ) );
1695 }
1696 
1697 } // namespace
1698 
1699 Fill::Fill( const WorkbookHelper& rHelper, bool bDxf ) :
1700  WorkbookHelper( rHelper ),
1701  mbDxf( bDxf )
1702 {
1703 }
1704 
1706 {
1707  mxPatternModel = std::make_shared<PatternFillModel>( mbDxf );
1708  mxPatternModel->mnPattern = rAttribs.getToken( XML_patternType, XML_none );
1709  if( mbDxf )
1710  mxPatternModel->mbPatternUsed = rAttribs.hasAttribute( XML_patternType );
1711 }
1712 
1713 void Fill::importFgColor( const AttributeList& rAttribs )
1714 {
1715  OSL_ENSURE( mxPatternModel, "Fill::importFgColor - missing pattern data" );
1716  if( mxPatternModel )
1717  {
1718  mxPatternModel->maPatternColor.importColor( rAttribs );
1719  mxPatternModel->mbPattColorUsed = true;
1720  }
1721 }
1722 
1723 void Fill::importBgColor( const AttributeList& rAttribs )
1724 {
1725  OSL_ENSURE( mxPatternModel, "Fill::importBgColor - missing pattern data" );
1726  if( mxPatternModel )
1727  {
1728  mxPatternModel->maFillColor.importColor( rAttribs );
1729  mxPatternModel->mbFillColorUsed = true;
1730  }
1731 }
1732 
1734 {
1735  mxGradientModel = std::make_shared<GradientFillModel>();
1736  mxGradientModel->mnType = rAttribs.getToken( XML_type, XML_linear );
1737  mxGradientModel->mfAngle = rAttribs.getDouble( XML_degree, 0.0 );
1738  mxGradientModel->mfLeft = rAttribs.getDouble( XML_left, 0.0 );
1739  mxGradientModel->mfRight = rAttribs.getDouble( XML_right, 0.0 );
1740  mxGradientModel->mfTop = rAttribs.getDouble( XML_top, 0.0 );
1741  mxGradientModel->mfBottom = rAttribs.getDouble( XML_bottom, 0.0 );
1742 }
1743 
1744 void Fill::importColor( const AttributeList& rAttribs, double fPosition )
1745 {
1746  OSL_ENSURE( mxGradientModel, "Fill::importColor - missing gradient data" );
1747  if( mxGradientModel && (fPosition >= 0.0) )
1748  mxGradientModel->maColors[ fPosition ].importColor( rAttribs );
1749 }
1750 
1752 {
1753  SAL_WARN_IF( mbDxf, "sc", "Fill::importFill - unexpected conditional formatting flag" );
1754  sal_Int32 nPattern = rStrm.readInt32();
1755  if( nPattern == BIFF12_FILL_GRADIENT )
1756  {
1757  mxGradientModel = std::make_shared<GradientFillModel>();
1758  sal_Int32 nStopCount;
1759  rStrm.skip( 16 );
1760  mxGradientModel->readGradient( rStrm );
1761  nStopCount = rStrm.readInt32();
1762  for( sal_Int32 nStop = 0; (nStop < nStopCount) && !rStrm.isEof(); ++nStop )
1763  mxGradientModel->readGradientStop( rStrm, false );
1764  }
1765  else
1766  {
1767  mxPatternModel = std::make_shared<PatternFillModel>( mbDxf );
1768  mxPatternModel->setBiffPattern( nPattern );
1769  rStrm >> mxPatternModel->maPatternColor >> mxPatternModel->maFillColor;
1770  }
1771 }
1772 
1774 {
1775  SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfPattern - missing conditional formatting flag" );
1776  if( !mxPatternModel )
1777  mxPatternModel = std::make_shared<PatternFillModel>( mbDxf );
1778  mxPatternModel->setBiffPattern( rStrm.readuInt8() );
1779  mxPatternModel->mbPatternUsed = true;
1780 }
1781 
1783 {
1784  SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfFgColor - missing conditional formatting flag" );
1785  if( !mxPatternModel )
1786  mxPatternModel = std::make_shared<PatternFillModel>( mbDxf );
1787  mxPatternModel->maPatternColor.importColor( rStrm );
1788  mxPatternModel->mbPattColorUsed = true;
1789 }
1790 
1792 {
1793  SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfBgColor - missing conditional formatting flag" );
1794  if( !mxPatternModel )
1795  mxPatternModel = std::make_shared<PatternFillModel>( mbDxf );
1796  mxPatternModel->maFillColor.importColor( rStrm );
1797  mxPatternModel->mbFillColorUsed = true;
1798 }
1799 
1801 {
1802  SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfGradient - missing conditional formatting flag" );
1803  if( !mxGradientModel )
1804  mxGradientModel = std::make_shared<GradientFillModel>();
1805  mxGradientModel->readGradient( rStrm );
1806 }
1807 
1809 {
1810  SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfStop - missing conditional formatting flag" );
1811  if( !mxGradientModel )
1812  mxGradientModel = std::make_shared<GradientFillModel>();
1813  mxGradientModel->readGradientStop( rStrm, true );
1814 }
1815 
1817 {
1818  const GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper();
1819 
1820  if( mxPatternModel )
1821  {
1822  // finalize the OOXML data struct
1823  PatternFillModel& rModel = *mxPatternModel;
1824  if( mbDxf )
1825  {
1826  if( rModel.mbFillColorUsed && (!rModel.mbPatternUsed || (rModel.mnPattern == XML_solid)) )
1827  {
1828  rModel.maPatternColor = rModel.maFillColor;
1829  rModel.mnPattern = XML_solid;
1830  rModel.mbPattColorUsed = rModel.mbPatternUsed = true;
1831  }
1832  else if( !rModel.mbFillColorUsed && rModel.mbPatternUsed && (rModel.mnPattern == XML_solid) )
1833  {
1834  rModel.mbPatternUsed = false;
1835  }
1836  }
1837 
1838  // convert to API fill settings
1839  maApiData.mbUsed = rModel.mbPatternUsed;
1840  if( rModel.mnPattern == XML_none )
1841  {
1843  maApiData.mbTransparent = true;
1844  }
1845  else
1846  {
1847  sal_Int32 nAlpha = 0x80;
1848  switch( rModel.mnPattern )
1849  {
1850  case XML_darkDown: nAlpha = 0x40; break;
1851  case XML_darkGray: nAlpha = 0x60; break;
1852  case XML_darkGrid: nAlpha = 0x40; break;
1853  case XML_darkHorizontal: nAlpha = 0x40; break;
1854  case XML_darkTrellis: nAlpha = 0x60; break;
1855  case XML_darkUp: nAlpha = 0x40; break;
1856  case XML_darkVertical: nAlpha = 0x40; break;
1857  case XML_gray0625: nAlpha = 0x08; break;
1858  case XML_gray125: nAlpha = 0x10; break;
1859  case XML_lightDown: nAlpha = 0x20; break;
1860  case XML_lightGray: nAlpha = 0x20; break;
1861  case XML_lightGrid: nAlpha = 0x38; break;
1862  case XML_lightHorizontal: nAlpha = 0x20; break;
1863  case XML_lightTrellis: nAlpha = 0x30; break;
1864  case XML_lightUp: nAlpha = 0x20; break;
1865  case XML_lightVertical: nAlpha = 0x20; break;
1866  case XML_mediumGray: nAlpha = 0x40; break;
1867  case XML_solid: nAlpha = 0x80; break;
1868  }
1869 
1870  ::Color nWinTextColor = rGraphicHelper.getSystemColor( XML_windowText );
1871  ::Color nWinColor = rGraphicHelper.getSystemColor( XML_window );
1872 
1873  if( !rModel.mbPattColorUsed )
1874  rModel.maPatternColor.setAuto();
1875  ::Color nPattColor = rModel.maPatternColor.getColor( rGraphicHelper, nWinTextColor );
1876 
1877  if( !rModel.mbFillColorUsed )
1878  rModel.maFillColor.setAuto();
1879  ::Color nFillColor = rModel.maFillColor.getColor( rGraphicHelper, nWinColor );
1880 
1881  maApiData.mnColor = lclGetMixedColor( nPattColor, nFillColor, nAlpha );
1882  maApiData.mbTransparent = false;
1883  }
1884  }
1885  else if( mxGradientModel && !mxGradientModel->maColors.empty() )
1886  {
1888  maApiData.mbUsed = true; // no support for differential attributes
1889  GradientFillModel::ColorMap::const_iterator aIt = rModel.maColors.begin();
1890  OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
1891  maApiData.mnColor = aIt->second.getColor( rGraphicHelper, API_RGB_WHITE );
1892  if( ++aIt != rModel.maColors.end() )
1893  {
1894  OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
1895  ::Color nEndColor = aIt->second.getColor( rGraphicHelper, API_RGB_WHITE );
1896  maApiData.mnColor = lclGetMixedColor( maApiData.mnColor, nEndColor, 0x40 );
1897  maApiData.mbTransparent = false;
1898  }
1899  }
1900 }
1901 
1902 void Fill::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
1903 {
1904  if( maApiData.mbUsed )
1905  {
1906  SvxBrushItem aBrushItem( ATTR_BACKGROUND );
1907  if ( maApiData.mbTransparent )
1908  {
1909  aBrushItem.SetColor( COL_TRANSPARENT );
1910  }
1911  else
1912  {
1913  aBrushItem.SetColor( maApiData.mnColor );
1914  }
1915  ScfTools::PutItem( rItemSet, aBrushItem, bSkipPoolDefs );
1916  }
1917 }
1918 
1920  mnStyleXfId( -1 ),
1921  mnFontId( -1 ),
1922  mnNumFmtId( -1 ),
1923  mnBorderId( -1 ),
1924  mnFillId( -1 ),
1925  mbCellXf( true ),
1926  mbFontUsed( false ),
1927  mbNumFmtUsed( false ),
1928  mbAlignUsed( false ),
1929  mbProtUsed( false ),
1930  mbBorderUsed( false ),
1931  mbAreaUsed( false )
1932 {
1933 }
1934 
1936  mbLatinNumFmtOnly(true),
1937  mpDefPattern(pDefPattern)
1938 {}
1939 
1940 Xf::Xf( const WorkbookHelper& rHelper ) :
1941  WorkbookHelper( rHelper ),
1942  mnScNumFmt(0),
1943  maAlignment( rHelper ),
1944  maProtection( rHelper ),
1945  meRotationRef( css::table::CellVertJustify2::STANDARD ),
1946  mpStyleSheet( nullptr )
1947 {
1948 }
1949 
1950 void Xf::importXf( const AttributeList& rAttribs, bool bCellXf )
1951 {
1952  maModel.mbCellXf = bCellXf;
1953  // tdf#70565 Set proper default value to "0" of xfId attribute
1954  // When xfId is not exist during .xlsx import
1955  // it must have values set to "0".
1956  // This doesn't impact spreadsheets created with MS Excel,
1957  // as xfId attribute is always created during export to .xlsx
1958  // Not setting "0" value is causing wrong .xlsx import by LibreOffice,
1959  // for spreadsheets created by external applications (ex. SAP BI).
1960  if ( maModel.mbCellXf )
1961  {
1962  maModel.mnStyleXfId = rAttribs.getInteger( XML_xfId, 0 );
1963  }
1964  else
1965  {
1966  maModel.mnStyleXfId = rAttribs.getInteger( XML_xfId, -1 );
1967  }
1968  maModel.mnFontId = rAttribs.getInteger( XML_fontId, -1 );
1969  maModel.mnNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
1970  maModel.mnBorderId = rAttribs.getInteger( XML_borderId, -1 );
1971  maModel.mnFillId = rAttribs.getInteger( XML_fillId, -1 );
1972 
1973 
1974  /* Default value of the apply*** attributes is dependent on context:
1975  true in cellStyleXfs element, false in cellXfs element... */
1976  maModel.mbAlignUsed = rAttribs.getBool( XML_applyAlignment, !maModel.mbCellXf );
1977  maModel.mbProtUsed = rAttribs.getBool( XML_applyProtection, !maModel.mbCellXf );
1978  maModel.mbFontUsed = rAttribs.getBool( XML_applyFont, !maModel.mbCellXf );
1979  maModel.mbNumFmtUsed = rAttribs.getBool( XML_applyNumberFormat, !maModel.mbCellXf );
1980  maModel.mbBorderUsed = rAttribs.getBool( XML_applyBorder, !maModel.mbCellXf );
1981  maModel.mbAreaUsed = rAttribs.getBool( XML_applyFill, !maModel.mbCellXf );
1982 }
1983 
1984 void Xf::importAlignment( const AttributeList& rAttribs )
1985 {
1986  maAlignment.importAlignment( rAttribs );
1987 }
1988 
1989 void Xf::importProtection( const AttributeList& rAttribs )
1990 {
1991  maProtection.importProtection( rAttribs );
1992 }
1993 
1994 void Xf::importXf( SequenceInputStream& rStrm, bool bCellXf )
1995 {
1996  maModel.mbCellXf = bCellXf;
1997  maModel.mnStyleXfId = rStrm.readuInt16();
1998  maModel.mnNumFmtId = rStrm.readuInt16();
1999  maModel.mnFontId = rStrm.readuInt16();
2000  maModel.mnFillId = rStrm.readuInt16();
2001  maModel.mnBorderId = rStrm.readuInt16();
2002  sal_uInt32 nFlags = rStrm.readuInt32();
2003  maAlignment.setBiff12Data( nFlags );
2004  maProtection.setBiff12Data( nFlags );
2005  // used flags, see comments in Xf::setBiffUsedFlags()
2006  sal_uInt16 nUsedFlags = rStrm.readuInt16();
2007  maModel.mbFontUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_FONT_USED );
2008  maModel.mbNumFmtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_NUMFMT_USED );
2009  maModel.mbAlignUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_ALIGN_USED );
2010  maModel.mbProtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_PROT_USED );
2011  maModel.mbBorderUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_BORDER_USED );
2012  maModel.mbAreaUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_AREA_USED );
2013 }
2014 
2016 {
2017  // alignment and protection
2020 }
2021 
2023 {
2024  return getStyles().getFont( maModel.mnFontId );
2025 }
2026 
2027 void Xf::applyPatternToAttrList( AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal_Int32 nNumFmtId )
2028 {
2029  createPattern();
2030  ScPatternAttr& rPat = *mpPattern;
2031  ScDocument& rDoc = getScDocument();
2032  if ( isCellXf() )
2033  {
2034  StylesBuffer& rStyles = getStyles();
2035  rStyles.createCellStyle( maModel.mnStyleXfId );
2036 
2038  if ( mpStyleSheet )
2039  {
2040  //rDoc.ApplySelectionStyle( static_cast<ScStyleSheet&>(*mpStyleSheet), rMarkData );
2041  rPat.SetStyleSheet(mpStyleSheet, false);
2042  }
2043  else
2044  {
2045  ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
2046  if (pStylePool)
2047  {
2048  ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>(
2049  pStylePool->Find(
2050  ScResId(STR_STYLENAME_STANDARD_CELL), SfxStyleFamily::Para));
2051 
2052  if (pStyleSheet)
2053  rPat.SetStyleSheet( pStyleSheet, false );
2054  }
2055  }
2056  }
2057  if ( nNumFmtId >= 0 )
2058  {
2059  ScPatternAttr aNumPat(rDoc.GetPool());
2060  mnScNumFmt = getStyles().writeNumFmtToItemSet( aNumPat.GetItemSet(), nNumFmtId, false );
2061  rPat.GetItemSet().Put(aNumPat.GetItemSet());
2062  }
2063 
2065  rAttrs.mbLatinNumFmtOnly = false;
2066 
2067  if (rPat.GetStyleName())
2068  {
2069  // Check for a gap between the last entry and this one.
2070  bool bHasGap = false;
2071  if (rAttrs.maAttrs.empty() && nRow1 > 0)
2072  // First attribute range doesn't start at row 0.
2073  bHasGap = true;
2074 
2075  if (!rAttrs.maAttrs.empty() && rAttrs.maAttrs.back().nEndRow + 1 < nRow1)
2076  bHasGap = true;
2077 
2078  if (bHasGap)
2079  {
2080  // Fill this gap with the default pattern.
2081  ScAttrEntry aEntry;
2082  aEntry.nEndRow = nRow1 - 1;
2083  aEntry.pPattern = &rDoc.GetPool()->Put(*rAttrs.mpDefPattern);
2084  rAttrs.maAttrs.push_back(aEntry);
2085 
2086  // Check if the default pattern is 'General'.
2087  if (!sc::NumFmtUtil::isLatinScript(*aEntry.pPattern, rDoc))
2088  rAttrs.mbLatinNumFmtOnly = false;
2089  }
2090 
2091  ScAttrEntry aEntry;
2092  aEntry.nEndRow = nRow2;
2093  aEntry.pPattern = &rDoc.GetPool()->Put(rPat);
2094  rAttrs.maAttrs.push_back(aEntry);
2095 
2096  if (!sc::NumFmtUtil::isLatinScript(*aEntry.pPattern, rDoc))
2097  rAttrs.mbLatinNumFmtOnly = false;
2098  }
2099 }
2100 
2101 void Xf::writeToDoc( ScDocumentImport& rDoc, const ScRange& rRange )
2102 {
2103  const StylesBuffer& rStyles = getStyles();
2104 
2105  if (isCellXf())
2106  {
2107  // Cell style name.
2108  OUString aStyleName = rStyles.createCellStyle(maModel.mnStyleXfId);
2109 
2110  ScStyleSheet* pStyleSheet =
2111  static_cast<ScStyleSheet*>(
2112  rDoc.getDoc().GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para));
2113 
2114  if (pStyleSheet)
2115  {
2116  rDoc.getDoc().ApplyStyleAreaTab(
2117  rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aStart.Tab(),
2118  *pStyleSheet);
2119  }
2120  }
2121 
2122  const ScPatternAttr& rAttr = createPattern();
2123  rDoc.getDoc().ApplyPatternAreaTab(
2124  rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aStart.Tab(), rAttr);
2125 }
2126 
2127 const ::ScPatternAttr&
2128 Xf::createPattern( bool bSkipPoolDefs )
2129 {
2130  if( mpPattern )
2131  return *mpPattern;
2132  mpPattern.reset( new ::ScPatternAttr( getScDocument().GetPool() ) );
2133  SfxItemSet& rItemSet = mpPattern->GetItemSet();
2134  /* Enables the used flags, if the formatting attributes differ from the
2135  style XF. In cell XFs Excel uses the cell attributes, if they differ
2136  from the parent style XF (even if the used flag is switched off).
2137  #109899# ...or if the respective flag is not set in parent style XF.
2138  */
2139  StylesBuffer& rStyles = getStyles();
2140 
2141  const Xf* pStyleXf = isCellXf() ? rStyles.getStyleXf( maModel.mnStyleXfId ).get() : nullptr;
2142  if( pStyleXf && !mpStyleSheet )
2143  {
2144  rStyles.createCellStyle( maModel.mnStyleXfId );
2146  OSL_ENSURE( mpStyleSheet, "Xf::createPattern - no parentStyle created" );
2147 
2148  const XfModel& rStyleData = pStyleXf->maModel;
2149  if( !maModel.mbFontUsed )
2150  maModel.mbFontUsed = !rStyleData.mbFontUsed || (maModel.mnFontId != rStyleData.mnFontId);
2151  if( !maModel.mbNumFmtUsed )
2152  maModel.mbNumFmtUsed = !rStyleData.mbNumFmtUsed || (maModel.mnNumFmtId != rStyleData.mnNumFmtId);
2153  if( !maModel.mbAlignUsed )
2154  maModel.mbAlignUsed = !rStyleData.mbAlignUsed || !(maAlignment.getApiData() == pStyleXf->maAlignment.getApiData());
2155  if( !maModel.mbProtUsed )
2156  maModel.mbProtUsed = !rStyleData.mbProtUsed || !(maProtection.getApiData() == pStyleXf->maProtection.getApiData());
2157  if( !maModel.mbBorderUsed )
2159  if( !maModel.mbAreaUsed )
2161  }
2162  // cell protection
2163  if( maModel.mbProtUsed )
2164  {
2165  maProtection.fillToItemSet( rItemSet, bSkipPoolDefs );
2166  }
2167 
2168  // font
2169  if( maModel.mbFontUsed )
2170  {
2171  rStyles.writeFontToItemSet( rItemSet, maModel.mnFontId, bSkipPoolDefs );
2172  }
2173 
2174  // value format
2175  if( maModel.mbNumFmtUsed )
2176  {
2177  mnScNumFmt = rStyles.writeNumFmtToItemSet( rItemSet, maModel.mnNumFmtId, bSkipPoolDefs );
2178  }
2179  // alignment
2180  if( maModel.mbAlignUsed )
2181  {
2182  maAlignment.fillToItemSet( rItemSet, bSkipPoolDefs );
2183  }
2184 
2185  // border
2186  if( maModel.mbBorderUsed )
2187  {
2188  rStyles.writeBorderToItemSet( rItemSet, maModel.mnBorderId, bSkipPoolDefs );
2189  }
2190 
2191  // area
2192  if( maModel.mbAreaUsed )
2193  {
2194  rStyles.writeFillToItemSet( rItemSet, maModel.mnFillId, bSkipPoolDefs );
2195  }
2196 
2197  /* #i38709# Decide which rotation reference mode to use. If any outer
2198  border line of the cell is set (either explicitly or via cell style),
2199  and the cell contents are rotated, set rotation reference to bottom of
2200  cell. This causes the borders to be painted rotated with the text. */
2201  if( const Alignment* pAlignment = maModel.mbAlignUsed ? &maAlignment : (pStyleXf ? &pStyleXf->maAlignment : nullptr) )
2202  {
2204  sal_Int32 nBorderId = maModel.mbBorderUsed ? maModel.mnBorderId : (pStyleXf ? pStyleXf->maModel.mnBorderId : -1);
2205  if( const Border* pBorder = rStyles.getBorder( nBorderId ).get() )
2206  {
2207  if( (pAlignment->getApiData().mnRotation != 0) && pBorder->getApiData().hasAnyOuterBorder() )
2208  {
2209  meRotationRef = css::table::CellVertJustify2::BOTTOM;
2210  eRotateMode = SVX_ROTATE_MODE_BOTTOM;
2211  }
2212  }
2213  ScfTools::PutItem( rItemSet, SvxRotateModeItem( eRotateMode, ATTR_ROTATE_MODE ), bSkipPoolDefs );
2214  }
2215 
2216  return *mpPattern;
2217 }
2218 
2219 Dxf::Dxf( const WorkbookHelper& rHelper ) :
2220  WorkbookHelper( rHelper )
2221 {
2222 }
2223 
2224 FontRef const & Dxf::createFont( bool bAlwaysNew )
2225 {
2226  if( bAlwaysNew || !mxFont )
2227  mxFont = std::make_shared<Font>( *this, true );
2228  return mxFont;
2229 }
2230 
2231 BorderRef const & Dxf::createBorder( bool bAlwaysNew )
2232 {
2233  if( bAlwaysNew || !mxBorder )
2234  mxBorder = std::make_shared<Border>( *this, true );
2235  return mxBorder;
2236 }
2237 
2238 FillRef const & Dxf::createFill( bool bAlwaysNew )
2239 {
2240  if( bAlwaysNew || !mxFill )
2241  mxFill = std::make_shared<Fill>( *this, true );
2242  return mxFill;
2243 }
2244 
2245 void Dxf::importNumFmt( const AttributeList& rAttribs )
2246 {
2247  // don't propagate number formats defined in Dxf entries
2248  // they can have the same id ( but different format codes ) as those
2249  // defined globally earlier. We discard the id defined in XML_numFmtId
2250  // and generate one ourselves ( this assumes that the normal numberformat
2251  // import has already taken place )
2252  sal_Int32 nNumFmtId = getStyles().nextFreeNumFmtId();
2253  OUString aFmtCode = rAttribs.getXString( XML_formatCode, OUString() );
2254  mxNumFmt = getStyles().createNumFmt( nNumFmtId, aFmtCode );
2255 }
2256 
2258 {
2259  sal_Int32 nNumFmtId = -1;
2260  OUString aFmtCode;
2261  sal_uInt16 nRecCount;
2262  rStrm.skip( 4 ); // flags
2263  nRecCount = rStrm.readuInt16();
2264  for( sal_uInt16 nRec = 0; !rStrm.isEof() && (nRec < nRecCount); ++nRec )
2265  {
2266  sal_uInt16 nSubRecId, nSubRecSize;
2267  sal_Int64 nRecEnd = rStrm.tell();
2268  nSubRecId = rStrm.readuInt16();
2269  nSubRecSize = rStrm.readuInt16();
2270  nRecEnd += nSubRecSize;
2271  switch( nSubRecId )
2272  {
2273  case BIFF12_DXF_FILL_PATTERN: createFill( false )->importDxfPattern( rStrm ); break;
2274  case BIFF12_DXF_FILL_FGCOLOR: createFill( false )->importDxfFgColor( rStrm ); break;
2275  case BIFF12_DXF_FILL_BGCOLOR: createFill( false )->importDxfBgColor( rStrm ); break;
2276  case BIFF12_DXF_FILL_GRADIENT: createFill( false )->importDxfGradient( rStrm ); break;
2277  case BIFF12_DXF_FILL_STOP: createFill( false )->importDxfStop( rStrm ); break;
2278  case BIFF12_DXF_FONT_COLOR: createFont( false )->importDxfColor( rStrm ); break;
2279  case BIFF12_DXF_BORDER_TOP: createBorder( false )->importDxfBorder( XLS_TOKEN( top ), rStrm ); break;
2280  case BIFF12_DXF_BORDER_BOTTOM: createBorder( false )->importDxfBorder( XLS_TOKEN( bottom ), rStrm ); break;
2281  case BIFF12_DXF_BORDER_LEFT: createBorder( false )->importDxfBorder( XLS_TOKEN( left ), rStrm ); break;
2282  case BIFF12_DXF_BORDER_RIGHT: createBorder( false )->importDxfBorder( XLS_TOKEN( right ), rStrm ); break;
2283  case BIFF12_DXF_FONT_NAME: createFont( false )->importDxfName( rStrm ); break;
2284  case BIFF12_DXF_FONT_WEIGHT: createFont( false )->importDxfWeight( rStrm ); break;
2285  case BIFF12_DXF_FONT_UNDERLINE: createFont( false )->importDxfUnderline( rStrm ); break;
2286  case BIFF12_DXF_FONT_ESCAPEMENT: createFont( false )->importDxfEscapement( rStrm ); break;
2287  case BIFF12_DXF_FONT_ITALIC: createFont( false )->importDxfFlag( XML_i, rStrm ); break;
2288  case BIFF12_DXF_FONT_STRIKE: createFont( false )->importDxfFlag( XML_strike, rStrm ); break;
2289  case BIFF12_DXF_FONT_OUTLINE: createFont( false )->importDxfFlag( XML_outline, rStrm ); break;
2290  case BIFF12_DXF_FONT_SHADOW: createFont( false )->importDxfFlag( XML_shadow, rStrm ); break;
2291  case BIFF12_DXF_FONT_HEIGHT: createFont( false )->importDxfHeight( rStrm ); break;
2292  case BIFF12_DXF_FONT_SCHEME: createFont( false )->importDxfScheme( rStrm ); break;
2293  case BIFF12_DXF_NUMFMT_CODE: aFmtCode = BiffHelper::readString( rStrm, false ); break;
2294  case BIFF12_DXF_NUMFMT_ID: nNumFmtId = rStrm.readuInt16(); break;
2295  }
2296  rStrm.seek( nRecEnd );
2297  }
2298  OSL_ENSURE( !rStrm.isEof() && (rStrm.getRemaining() == 0), "Dxf::importDxf - unexpected remaining data" );
2299  mxNumFmt = getStyles().createNumFmt( nNumFmtId, aFmtCode );
2300 }
2301 
2303 {
2304  if( mxFont )
2305  mxFont->finalizeImport();
2306  bool bRTL = false;
2307  // number format already finalized by the number formats buffer
2308  if( mxAlignment )
2309  {
2310  mxAlignment->finalizeImport();
2311  // how do we detect RTL when text dir is OOX_XF_CONTEXT? ( seems you
2312  // would need access to the cell content, which we don't here )
2313  if ( mxAlignment->getModel().mnTextDir == OOX_XF_TEXTDIR_RTL )
2314  bRTL = true;
2315  }
2316  if( mxProtection )
2317  mxProtection->finalizeImport();
2318  if( mxBorder )
2319  {
2320  mxBorder->finalizeImport( bRTL );
2321  }
2322  if( mxFill )
2323  mxFill->finalizeImport();
2324 }
2325 
2326 void Dxf::fillToItemSet( SfxItemSet& rSet ) const
2327 {
2328  if (mxFont)
2329  mxFont->fillToItemSet(rSet, false);
2330  if (mxNumFmt)
2331  mxNumFmt->fillToItemSet(rSet);
2332  if (mxAlignment)
2333  mxAlignment->fillToItemSet(rSet);
2334  if (mxProtection)
2335  mxProtection->fillToItemSet(rSet);
2336  if (mxBorder)
2337  mxBorder->fillToItemSet(rSet);
2338  if (mxFill)
2339  mxFill->fillToItemSet(rSet);
2340 }
2341 
2342 namespace {
2343 
2344 const char* const sppcStyleNames[] =
2345 {
2346  "Normal",
2347  "RowLevel_", // outline level will be appended
2348  "ColLevel_", // outline level will be appended
2349  "Comma",
2350  "Currency",
2351  "Percent",
2352  "Comma [0]", // new in BIFF4
2353  "Currency [0]",
2354  "Hyperlink", // new in BIFF8
2355  "Followed Hyperlink",
2356  "Note", // new in OOX
2357  "Warning Text",
2358  nullptr,
2359  nullptr,
2360  nullptr,
2361  "Title",
2362  "Heading 1",
2363  "Heading 2",
2364  "Heading 3",
2365  "Heading 4",
2366  "Input",
2367  "Output",
2368  "Calculation",
2369  "Check Cell",
2370  "Linked Cell",
2371  "Total",
2372  "Good",
2373  "Bad",
2374  "Neutral",
2375  "Accent1",
2376  "20% - Accent1",
2377  "40% - Accent1",
2378  "60% - Accent1",
2379  "Accent2",
2380  "20% - Accent2",
2381  "40% - Accent2",
2382  "60% - Accent2",
2383  "Accent3",
2384  "20% - Accent3",
2385  "40% - Accent3",
2386  "60% - Accent3",
2387  "Accent4",
2388  "20% - Accent4",
2389  "40% - Accent4",
2390  "60% - Accent4",
2391  "Accent5",
2392  "20% - Accent5",
2393  "40% - Accent5",
2394  "60% - Accent5",
2395  "Accent6",
2396  "20% - Accent6",
2397  "40% - Accent6",
2398  "60% - Accent6",
2399  "Explanatory Text"
2400 };
2401 const sal_Int32 snStyleNamesCount = static_cast< sal_Int32 >( SAL_N_ELEMENTS( sppcStyleNames ) );
2402 
2403 OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sal_Int32 nLevel = 0 )
2404 {
2405  OSL_ENSURE( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount), "lclGetBuiltinStyleName - unknown built-in style" );
2406  OUStringBuffer aStyleName("Excel Built-in ");
2407  if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ] != nullptr) )
2408  aStyleName.appendAscii( sppcStyleNames[ nBuiltinId ] );
2409  else if( !rName.isEmpty() )
2410  aStyleName.append( rName );
2411  else
2412  aStyleName.append( nBuiltinId );
2413  if( (nBuiltinId == OOX_STYLE_ROWLEVEL) || (nBuiltinId == OOX_STYLE_COLLEVEL) )
2414  aStyleName.append( nLevel );
2415  return aStyleName.makeStringAndClear();
2416 }
2417 
2418 OUString lclCreateStyleName( const CellStyleModel& rModel )
2419 {
2420  return rModel.mbBuiltin ? lclGetBuiltinStyleName( rModel.mnBuiltinId, rModel.maName, rModel.mnLevel ) : rModel.maName;
2421 }
2422 
2423 } // namespace
2424 
2426  mnXfId( -1 ),
2427  mnBuiltinId( -1 ),
2428  mnLevel( 0 ),
2429  mbBuiltin( false ),
2430  mbCustom( false ),
2431  mbHidden( false )
2432 {
2433 }
2434 
2436 {
2437  return mbBuiltin && (mnBuiltinId >= 0);
2438 }
2439 
2441 {
2442  return mbBuiltin && (mnBuiltinId == OOX_STYLE_NORMAL);
2443 }
2444 
2446  WorkbookHelper( rHelper ),
2447  mbCreated( false ),
2448  mpStyleSheet( nullptr )
2449 {
2450 }
2451 
2453 {
2454  maModel.maName = rAttribs.getXString( XML_name, OUString() );
2455  maModel.mnXfId = rAttribs.getInteger( XML_xfId, -1 );
2456  maModel.mnBuiltinId = rAttribs.getInteger( XML_builtinId, -1 );
2457  maModel.mnLevel = rAttribs.getInteger( XML_iLevel, 0 );
2458  maModel.mbBuiltin = rAttribs.hasAttribute( XML_builtinId );
2459  maModel.mbCustom = rAttribs.getBool( XML_customBuiltin, false );
2460  maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
2461 }
2462 
2464 {
2465  sal_uInt16 nFlags;
2466  maModel.mnXfId = rStrm.readInt32();
2467  nFlags = rStrm.readuInt16();
2468  maModel.mnBuiltinId = rStrm.readInt8();
2469  maModel.mnLevel = rStrm.readInt8();
2470  rStrm >> maModel.maName;
2471  maModel.mbBuiltin = getFlag( nFlags, BIFF12_CELLSTYLE_BUILTIN );
2472  maModel.mbCustom = getFlag( nFlags, BIFF12_CELLSTYLE_CUSTOM );
2473  maModel.mbHidden = getFlag( nFlags, BIFF12_CELLSTYLE_HIDDEN );
2474 }
2475 
2477 {
2478 
2479  // #i1624# #i1768# ignore unnamed user styles
2480  bool bDefStyle = maModel.isDefaultStyle();
2481  if( !mbCreated )
2482  {
2483  if ( bDefStyle && maFinalName.isEmpty() )
2484  maFinalName = ScResId( STR_STYLENAME_STANDARD_CELL );
2485  mbCreated = maFinalName.isEmpty();
2486  }
2487 
2488  if( !mbCreated && !mpStyleSheet )
2489  {
2490  bool bCreatePattern = false;
2491  Xf* pXF = getStyles().getStyleXf( maModel.mnXfId ).get();
2492  ::ScDocument& rDoc = getScDocument();
2493 
2494  if( bDefStyle )
2495  {
2496  // use existing "Default" style sheet
2497  mpStyleSheet = static_cast< ScStyleSheet* >( rDoc.GetStyleSheetPool()->Find(
2498  ScResId( STR_STYLENAME_STANDARD_CELL ), SfxStyleFamily::Para ) );
2499  OSL_ENSURE( mpStyleSheet, "CellStyle::createStyle - Default style not found" );
2500  bCreatePattern = true;
2501  }
2502  else
2503  {
2504  mpStyleSheet = static_cast< ScStyleSheet* >( rDoc.GetStyleSheetPool()->Find( maFinalName, SfxStyleFamily::Para ) );
2505  if( !mpStyleSheet )
2506  {
2507  mpStyleSheet = &static_cast< ScStyleSheet& >( rDoc.GetStyleSheetPool()->Make( maFinalName, SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined ) );
2508  bCreatePattern = true;
2509  }
2510  }
2511 
2512  // bDefStyle==true omits default pool items in CreatePattern()
2513  if( bCreatePattern && mpStyleSheet && pXF )
2514  mpStyleSheet->GetItemSet().Put( pXF->createPattern( bDefStyle ).GetItemSet() );
2515  }
2516 }
2517 
2518 void CellStyle::finalizeImport( const OUString& rFinalName )
2519 {
2520  maFinalName = rFinalName;
2521  if( !maModel.isBuiltin() || maModel.mbCustom )
2522  createCellStyle();
2523 }
2524 
2526  WorkbookHelper( rHelper )
2527 {
2528 }
2529 
2531 {
2532  CellStyleRef xCellStyle = std::make_shared<CellStyle>( *this );
2533  xCellStyle->importCellStyle( rAttribs );
2534  insertCellStyle( xCellStyle );
2535  return xCellStyle;
2536 }
2537 
2539 {
2540  CellStyleRef xCellStyle = std::make_shared<CellStyle>( *this );
2541  xCellStyle->importCellStyle( rStrm );
2542  insertCellStyle( xCellStyle );
2543  return xCellStyle;
2544 }
2545 
2547 {
2548  // calculate final names of all styles
2550  CellStyleNameMap aCellStyles;
2551  CellStyleVector aConflictNameStyles;
2552 
2553  /* First, reserve style names that are built-in in Calc. This causes that
2554  imported cell styles get different unused names and thus do not try to
2555  overwrite these built-in styles. */
2556  try
2557  {
2558  // unfortunately, com.sun.star.style.StyleFamily does not implement XEnumerationAccess...
2559  Reference< XIndexAccess > xStyleFamilyIA( getCellStyleFamily(), UNO_QUERY_THROW );
2560  for( sal_Int32 nIndex = 0, nCount = xStyleFamilyIA->getCount(); nIndex < nCount; ++nIndex )
2561  {
2562  Reference< XStyle > xStyle( xStyleFamilyIA->getByIndex( nIndex ), UNO_QUERY_THROW );
2563  if( !xStyle->isUserDefined() )
2564  {
2565  // create an empty entry by using ::std::map<>::operator[]
2566  aCellStyles[ xStyle->getName() ];
2567  }
2568  }
2569  }
2570  catch( Exception& )
2571  {
2572  }
2573 
2574  /* Calculate names of built-in styles. Store styles with reserved names
2575  in the aConflictNameStyles list. */
2576  for( const auto& rxStyle : maBuiltinStyles )
2577  {
2578  const CellStyleModel& rModel = rxStyle->getModel();
2579  if (rModel.isDefaultStyle())
2580  continue;
2581 
2582  OUString aStyleName = lclCreateStyleName( rModel );
2583  /* If a builtin style entry already exists,
2584  we just stick with the last definition and ignore
2585  the preceding ones. */
2586  aCellStyles[ aStyleName ] = rxStyle;
2587  }
2588 
2589  /* Calculate names of user defined styles. Store styles with reserved
2590  names in the aConflictNameStyles list. */
2591  for( const auto& rxStyle : maUserStyles )
2592  {
2593  const CellStyleModel& rModel = rxStyle->getModel();
2594  OUString aStyleName = lclCreateStyleName( rModel );
2595  // #i1624# #i1768# ignore unnamed user styles
2596  if( aStyleName.getLength() > 0 )
2597  {
2598  if( aCellStyles.find( aStyleName ) != aCellStyles.end() )
2599  aConflictNameStyles.push_back( rxStyle );
2600  else
2601  aCellStyles[ aStyleName ] = rxStyle;
2602  }
2603  }
2604 
2605  // find unused names for all styles with conflicting names
2606  // having the index counter outside the loop prevents performance problems with opening some pathological documents (tdf#62095)
2607  sal_Int32 nIndex = 0;
2608  for( const auto& rxStyle : aConflictNameStyles )
2609  {
2610  const CellStyleModel& rModel = rxStyle->getModel();
2611  OUString aStyleName = lclCreateStyleName( rModel );
2612  OUString aUnusedName;
2613  do
2614  {
2615  aUnusedName = aStyleName + OUStringChar(' ') + OUString::number( ++nIndex );
2616  }
2617  while( !aCellStyles.try_emplace( aUnusedName, rxStyle ).second );
2618  }
2619 
2620  // set final names and create user-defined and modified built-in cell styles
2621  aCellStyles.forEachMemWithKey( &CellStyle::finalizeImport );
2622 }
2623 
2625 {
2626  return mxDefStyle ? mxDefStyle->getModel().mnXfId : -1;
2627 }
2628 
2630 {
2631  return createCellStyle( mxDefStyle );
2632 }
2633 
2634 OUString CellStyleBuffer::createCellStyle( sal_Int32 nXfId ) const
2635 {
2636  return createCellStyle( maStylesByXf.get( nXfId ) );
2637 }
2638 
2640 {
2641  return getCellStyleSheet( maStylesByXf.get( nXfId ) );
2642 }
2643 
2644 // private --------------------------------------------------------------------
2645 
2647 {
2648  const CellStyleModel& rModel = xCellStyle->getModel();
2649  if( rModel.mnXfId >= 0 )
2650  {
2651  // insert into the built-in map or user defined map
2652  (rModel.isBuiltin() ? maBuiltinStyles : maUserStyles).push_back( xCellStyle );
2653 
2654  // insert into the XF identifier map
2655  OSL_ENSURE( maStylesByXf.count( rModel.mnXfId ) == 0, "CellStyleBuffer::insertCellStyle - multiple styles with equal XF identifier" );
2656  maStylesByXf[ rModel.mnXfId ] = xCellStyle;
2657 
2658  // remember default cell style
2659  if( rModel.isDefaultStyle() )
2660  mxDefStyle = xCellStyle;
2661  }
2662 }
2663 
2665 {
2666  ::ScStyleSheet* pStyleSheet = nullptr;
2667  if ( rxCellStyle )
2668  pStyleSheet = rxCellStyle->getStyleSheet();
2669  return pStyleSheet;
2670 }
2671 
2672 OUString CellStyleBuffer::createCellStyle( const CellStyleRef& rxCellStyle )
2673 {
2674  if( rxCellStyle )
2675  {
2676  rxCellStyle->createCellStyle();
2677  const OUString& rStyleName = rxCellStyle->getFinalStyleName();
2678  if( !rStyleName.isEmpty() )
2679  return rStyleName;
2680  }
2681  // on error: fallback to default style
2682  return lclGetBuiltinStyleName( OOX_STYLE_NORMAL, OUString() );
2683 }
2684 
2686  mnAutoFormatId( 0 ),
2687  mbApplyNumFmt( false ),
2688  mbApplyFont( false ),
2689  mbApplyAlignment( false ),
2690  mbApplyBorder( false ),
2691  mbApplyFill( false ),
2692  mbApplyProtection( false )
2693 {
2694 }
2695 
2697  WorkbookHelper( rHelper ),
2698  maPalette( rHelper ),
2699  maNumFmts( rHelper ),
2700  maCellStyles( rHelper )
2701 {
2702 }
2703 
2705 {
2706  FontRef xFont = std::make_shared<Font>( *this, false );
2707  maFonts.push_back( xFont );
2708  return xFont;
2709 }
2710 
2711 NumberFormatRef StylesBuffer::createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode )
2712 {
2713  return maNumFmts.createNumFmt( nNumFmtId, rFmtCode );
2714 }
2715 
2717 {
2718  return maNumFmts.nextFreeId();
2719 }
2720 
2722 {
2723  BorderRef xBorder = std::make_shared<Border>( *this, false );
2724  maBorders.push_back( xBorder );
2725  return xBorder;
2726 }
2727 
2729 {
2730  FillRef xFill = std::make_shared<Fill>( *this, false );
2731  maFills.push_back( xFill );
2732  return xFill;
2733 }
2734 
2736 {
2737  XfRef xXf = std::make_shared<Xf>( *this );
2738  maCellXfs.push_back( xXf );
2739  return xXf;
2740 }
2741 
2743 {
2744  XfRef xXf = std::make_shared<Xf>( *this );
2745  maStyleXfs.push_back( xXf );
2746  return xXf;
2747 }
2748 
2750 {
2751  DxfRef xDxf = std::make_shared<Dxf>( *this );
2752  maDxfs.push_back( xDxf );
2753  return xDxf;
2754 }
2755 
2757 {
2758  DxfRef xDxf = std::make_shared<Dxf>( *this );
2759  maExtDxfs.push_back( xDxf );
2760  return xDxf;
2761 }
2762 
2764 {
2765  maPalette.importPaletteColor( rAttribs );
2766 }
2767 
2769 {
2770  return maNumFmts.importNumFmt( rAttribs );
2771 }
2772 
2774 {
2775  return maCellStyles.importCellStyle( rAttribs );
2776 }
2777 
2779 {
2780  maPalette.importPaletteColor( rStrm );
2781 }
2782 
2784 {
2785  maNumFmts.importNumFmt( rStrm );
2786 }
2787 
2789 {
2790  maCellStyles.importCellStyle( rStrm );
2791 }
2792 
2794 {
2795  // fonts first, are needed to finalize unit converter and XFs below
2797  // finalize unit coefficients after default font is known
2799  // number formats
2801  // borders and fills
2802  // is there a document wide RTL setting that we
2803  // would/could need to pass to finalizeImport here ?
2806  // style XFs and cell XFs
2809  // built-in and user defined cell styles
2811  // differential formatting (for conditional formatting)
2813 }
2814 
2815 ::Color StylesBuffer::getPaletteColor( sal_Int32 nPaletteIdx ) const
2816 {
2817  return maPalette.getColor( nPaletteIdx );
2818 }
2819 
2820 FontRef StylesBuffer::getFont( sal_Int32 nFontId ) const
2821 {
2822  return maFonts.get( nFontId );
2823 }
2824 
2825 BorderRef StylesBuffer::getBorder( sal_Int32 nBorderId ) const
2826 {
2827  return maBorders.get( nBorderId );
2828 }
2829 
2830 XfRef StylesBuffer::getCellXf( sal_Int32 nXfId ) const
2831 {
2832  return maCellXfs.get( nXfId );
2833 }
2834 
2835 XfRef StylesBuffer::getStyleXf( sal_Int32 nXfId ) const
2836 {
2837  return maStyleXfs.get( nXfId );
2838 }
2839 
2841 {
2842  FontRef xFont;
2843  if( const Xf* pXf = getCellXf( nXfId ).get() )
2844  xFont = pXf->getFont();
2845  return xFont;
2846 }
2847 
2849 {
2850  FontRef xDefFont;
2851  if( const Xf* pXf = getStyleXf( maCellStyles.getDefaultXfId() ).get() )
2852  xDefFont = pXf->getFont();
2853  // no font from styles - try first loaded font (e.g. BIFF2)
2854  if( !xDefFont )
2855  xDefFont = maFonts.get( 0 );
2856  OSL_ENSURE( xDefFont, "StylesBuffer::getDefaultFont - no default font found" );
2857  return xDefFont;
2858 }
2859 
2861 {
2862  FontRef xDefFont = getDefaultFont();
2863  return xDefFont ? xDefFont->getModel() : getTheme().getDefaultFontModel();
2864 }
2865 
2866 bool StylesBuffer::equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 )
2867 {
2868  // in OOXML, borders are assumed to be unique
2869  return nBorderId1 == nBorderId2;
2870 }
2871 
2872 bool StylesBuffer::equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 )
2873 {
2874  // in OOXML, fills are assumed to be unique
2875  return nFillId1 == nFillId2;
2876 }
2877 
2879 {
2881 }
2882 
2883 OUString StylesBuffer::createCellStyle( sal_Int32 nXfId ) const
2884 {
2885  return maCellStyles.createCellStyle( nXfId );
2886 }
2887 
2889 {
2890  return maCellStyles.getCellStyleSheet( nXfId );
2891 }
2892 
2893 OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const
2894 {
2895  OUString& rStyleName = maDxfStyles[ nDxfId ];
2896  if (!rStyleName.isEmpty())
2897  return rStyleName;
2898 
2899  if (Dxf* pDxf = maDxfs.get(nDxfId).get())
2900  {
2901  rStyleName = "ConditionalStyle_" + OUString::number(nDxfId + 1);
2902 
2903  // Create a cell style. This may overwrite an existing style if
2904  // one with the same name exists.
2906  *getScDocument().GetStyleSheetPool(), rStyleName, true);
2907 
2908  rStyleSheet.ResetParent();
2909  SfxItemSet& rStyleItemSet =
2910  rStyleSheet.GetItemSet();
2911 
2912  pDxf->fillToItemSet(rStyleItemSet);
2913 
2914  }
2915 
2916  // on error: fallback to default style
2917  if (rStyleName.isEmpty())
2918  rStyleName = maCellStyles.getDefaultStyleName();
2919 
2920  return rStyleName;
2921 }
2922 
2923 OUString StylesBuffer::createExtDxfStyle( sal_Int32 nDxfId ) const
2924 {
2925  OUString rStyleName;
2926 
2927  if (Dxf* pDxf = maExtDxfs.get(nDxfId).get())
2928  {
2929  rStyleName = "ExtConditionalStyle_" + OUString::number(nDxfId + 1);
2930 
2931  // Create a cell style. This may overwrite an existing style if
2932  // one with the same name exists.
2934  *getScDocument().GetStyleSheetPool(), rStyleName, true);
2935 
2936  rStyleSheet.ResetParent();
2937  SfxItemSet& rStyleItemSet =
2938  rStyleSheet.GetItemSet();
2939 
2940  pDxf->fillToItemSet(rStyleItemSet);
2941  }
2942 
2943  // on error: fallback to default style
2944  if (rStyleName.isEmpty())
2945  rStyleName = maCellStyles.getDefaultStyleName();
2946 
2947  return rStyleName;
2948 }
2949 
2950 void StylesBuffer::writeFontToItemSet( SfxItemSet& rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs ) const
2951 {
2952  if( Font* pFont = maFonts.get( nFontId ).get() )
2953  pFont->fillToItemSet( rItemSet, false, bSkipPoolDefs );
2954 }
2955 
2956 sal_uInt32 StylesBuffer::writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const
2957 {
2958  return maNumFmts.fillToItemSet( rItemSet, nNumFmtId, bSkipPoolDefs );
2959 }
2960 
2961 void StylesBuffer::writeBorderToItemSet( SfxItemSet& rItemSet, sal_Int32 nBorderId, bool bSkipPoolDefs ) const
2962 {
2963  if( Border* pBorder = maBorders.get( nBorderId ).get() )
2964  pBorder->fillToItemSet( rItemSet, bSkipPoolDefs );
2965 }
2966 
2967 void StylesBuffer::writeFillToItemSet( SfxItemSet& rItemSet, sal_Int32 nFillId, bool bSkipPoolDefs ) const
2968 {
2969  if( Fill* pFill = maFills.get( nFillId ).get() )
2970  pFill->fillToItemSet( rItemSet, bSkipPoolDefs );
2971 }
2972 
2973 bool operator==( const XfModel& rXfModel1, const XfModel& rXfModel2 )
2974 {
2975  return ( rXfModel1.mbCellXf == rXfModel2.mbCellXf &&
2976  rXfModel1.mnStyleXfId == rXfModel2.mnStyleXfId &&
2977  rXfModel1.mbFontUsed == rXfModel2.mbFontUsed &&
2978  rXfModel1.mnFontId == rXfModel2.mnFontId &&
2979  rXfModel1.mbNumFmtUsed == rXfModel2.mbNumFmtUsed &&
2980  rXfModel1.mnNumFmtId == rXfModel2.mnNumFmtId &&
2981  rXfModel1.mbAlignUsed == rXfModel2.mbAlignUsed &&
2982  rXfModel1.mbBorderUsed == rXfModel2.mbBorderUsed &&
2983  rXfModel1.mnBorderId == rXfModel2.mnBorderId &&
2984  rXfModel1.mbAreaUsed == rXfModel2.mbAreaUsed &&
2985  rXfModel1.mnFillId == rXfModel2.mnFillId &&
2986  rXfModel1.mbProtUsed == rXfModel2.mbProtUsed );
2987 }
2988 
2989 bool operator==( const Xf& rXf1, const Xf& rXf2 )
2990 {
2991  if ( rXf1.maModel == rXf2.maModel )
2992  {
2993  if ( rXf1.maModel.mbAlignUsed )
2994  {
2995  if ( !( rXf1.maAlignment.getApiData() == rXf2.maAlignment.getApiData() ) )
2996  return false;
2997  }
2998  if ( rXf1.maModel.mbProtUsed )
2999  {
3000  if ( !( rXf1.maProtection.getApiData() == rXf2.maProtection.getApiData() ) )
3001  return false;
3002  }
3003  return true;
3004  }
3005  return false;
3006 }
3007 
3009  ScDocumentImport& rDoc, const ScRange& rRange, sal_Int32 nXfId ) const
3010 {
3011  Xf* pXf = maCellXfs.get(nXfId).get();
3012  if (!pXf)
3013  return;
3014 
3015  pXf->writeToDoc(rDoc, rRange);
3016 }
3017 
3018 } // namespace oox
3019 
3020 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
::SvxFrameDirection GetScFrameDir() const
bool mbProtUsed
True = alignment used.
BorderRef const & createBorder(bool bAlwaysNew=true)
Creates a new empty border object.
void setAuto()
Sets the color to automatic.
double mfHeight
Windows font character set.
Contains all API cell alignment attributes.
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
sal_uInt32 mnScNumFmt
Calc item set.
Color maColor
Font name.
PatternModelRef mxPatternModel
bool mbShrink
True = multi-line text.
bool mbAreaUsed
True = border data used.
::Color getPaletteColor(sal_Int32 nIndex) const
Returns the palette color with the specified index.
SvxCellHorJustify
void importColor(sal_Int32 nElement, const AttributeList &rAttribs)
Sets color attributes for the border line with the passed element identifier.
bool mbColorUsed
True = font name/family/char set are used.
CellStyleRef importCellStyle(const AttributeList &rAttribs)
Appends and returns a new named cell style object.
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
const ::Color API_RGB_BLACK(0x000000)
const sal_Int32 OOX_COLOR_NOTETEXT
Note background color.
CellStyleModel maModel
SC_DLLPUBLIC void ApplyStyleAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScStyleSheet &rStyle)
Definition: document.cxx:4853
sal_Int32 mnRotation
Normal or stacked text.
Contains all XML font attributes, e.g.
const sal_Int16 API_LINE_THIN
sal_Int32 nIndex
bool mbHeightUsed
True = font scheme is used.
const sal_Int32 OOX_COLOR_WINDOWBACK
System window text color (BIFF5+).
ApiBorderLine maTLtoBR
Bottom line format.
ScAddress aStart
Definition: address.hxx:500
FillRef createFill()
Creates a new empty fill object.
::Color getColor(sal_Int32 nPaletteIdx) const
Returns the RGB value of the color with the passed index.
void setBiffEscapement(sal_uInt16 nEscapement)
const sal_Int32 OOX_COLOR_WINDOWBACK3
System window text color (BIFF3-BIFF4).
virtual void skip(sal_Int32 nBytes, size_t nAtomSize=1) override
sal_Int32 getDefaultXfId() const
Returns the XF identifier associated to the default cell style.
sal_uInt8 GetRed() const
GradientFillModel()
Gradient colors.
Protection(const WorkbookHelper &rHelper)
FAMILY_SCRIPT
std::shared_ptr< Fill > FillRef
::Color mnColor
Font descriptor (height in twips, weight in %).
void finalizeImport()
Final processing after import of all style settings.
OptValue< bool > getBool(sal_Int32 nAttrToken) const
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
Font(const WorkbookHelper &rHelper, bool bDxf)
ApiBorderLine maTop
Right line format.
SCROW Row() const
Definition: address.hxx:262
static const VectorType::value_type * getVectorElement(const VectorType &rVector, sal_Int32 nIndex)
sal_uInt64 left
bool mbHidden
True = locked against editing.
void writeFontToItemSet(SfxItemSet &rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs) const
double mfLeft
Rotation angle for type linear.
SvxRotateMode
CellStyle(const WorkbookHelper &rHelper)
FAMILY_MODERN
double mfTop
Right convergence for type path.
DxfVector maExtDxfs
List of differential cell styles.
CellStyleXfIdMap maStylesByXf
All user defined cell styles.
void importDxfHeight(SequenceInputStream &rStrm)
Imports the font height from a DXF record.
void importDxfEscapement(SequenceInputStream &rStrm)
Imports the font escapement style from a DXF record.
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
void writeToDoc(ScDocumentImport &rDoc, const ScRange &rRange)
OptValue< OUString > getXString(sal_Int32 nAttrToken) const
sal_Int16 mnLevel
NumberFormatRef createNumFmt(sal_Int32 nNumFmtId, const OUString &rFmtCode)
Creates a number format.
sal_Int32 mnNumFmtId
void writeToPropertyMap(PropertyMap &rPropMap) const
Writes all font attributes to the passed property map.
void setBiffUnderline(sal_uInt16 nUnderline)
sal_Int32 mnStyle
Borderline color.
sal_Int32 mnFamily
Major/minor scheme font.
sal_Int16 mnIndent
CTL text direction.
::std::vector< ::Color > maColors
void setBiffHorAlign(sal_uInt8 nHorAlign)
Sets horizontal alignment from the passed BIFF data.
const FontModel & getDefaultFontModel() const
Returns the default font data for the current file type.
Definition: themebuffer.hxx:42
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
bool mbOutline
Escapement font height.
void importProtection(const AttributeList &rAttribs)
Sets all attributes from the protection element.
void importFont(SequenceInputStream &rStrm)
Imports the FONT record from the passed stream.
const sal_Int32 OOX_COLOR_WINDOWTEXT
System window background color (BIFF3-BIFF4).
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
Dxf(const WorkbookHelper &rHelper)
FAMILY_DONTKNOW
const sal_Int32 OOX_COLOR_CHBORDERAUTO
System window background color (BIFF8 charts).
void importDxfBorder(sal_Int32 nElement, SequenceInputStream &rStrm)
Imports a border from a DXF record from the passed stream.
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
sal_Int32 mnNumFmtId
Index to font data list.
bool mbPattColorUsed
Pattern identifier (e.g. solid).
XfRef getCellXf(sal_Int32 nXfId) const
Returns the specified cell format object.
void importDxfColor(SequenceInputStream &rStrm)
Imports the font color from a DXF record.
css::uno::Any getAnyProperty(sal_Int32 nPropId) const
bool mbUsed
Border line style.
sal_Int32 mnVerAlign
Horizontal alignment.
exports com.sun.star. awt
void setBiff12Data(sal_uInt32 nFlags)
Sets the protection attributes from the passed BIFF12 XF record data.
const sal_Int8 API_ESCAPEHEIGHT_NONE
Subscript: lower characters automatically (magic value -101).
bool setProperty(sal_Int32 nPropId, Type &&rValue)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
SVX_ROTATE_MODE_STANDARD
void importBgColor(const AttributeList &rAttribs)
Sets the background color from the bgColor element.
const SfxItemSet & GetItemSet() const
exports com.sun.star. table
Fill(const WorkbookHelper &rHelper, bool bDxf)
XfRef getStyleXf(sal_Int32 nXfId) const
Returns the specified style format object.
const sal_Int16 API_LINE_HAIR
sal_Int32 mnUnderline
Font height in points.
bool mbWeightUsed
True = escapement style is used.
value_type get(sal_Int32 nIndex) const
Reference< XStyle > maCellStyles[style_count]
const ApiProtectionData & getApiData() const
Returns the converted API protection data struct.
XfRef createCellXf()
Creates a new empty cell formatting object.
ApiBorderLine maBottom
Top line format.
const sal_Int32 EXC_POINTS_PER_INCH
Definition: xlconst.hxx:134
const sal_Int16 API_ESCAPE_SUBSCRIPT
Superscript: raise characters automatically (magic value 101).
ScAddress aEnd
Definition: address.hxx:501
BorderLineModel maLeft
virtual ::Color getSchemeColor(sal_Int32 nToken) const override
Derived classes may implement to resolve a scheme color from the passed XML token identifier...
SvxFrameDirection
OptValue< double > getDouble(sal_Int32 nAttrToken) const
void setBiffVerAlign(sal_uInt8 nVerAlign)
Sets vertical alignment from the passed BIFF data.
CellStyleRef mxDefStyle
All cell styles, mapped by XF identifier.
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
sal_uInt32 readuInt32()
FAMILY_ROMAN
#define STATIC_ARRAY_SELECT(array, index, def)
void SetLine(const editeng::SvxBorderLine *pNew)
void importDxfScheme(SequenceInputStream &rStrm)
Imports the font scheme from a DXF record.
OUString createDxfStyle(sal_Int32 nDxfId) const
Creates the style sheet described by the DXF with the passed identifier.
const sal_Int32 OOX_COLOR_BUTTONBACK
System window background color (BIFF5+).
rtl_TextEncoding getTextEncoding() const
Returns the text encoding used to import/export byte strings.
unsigned char readuChar()
static bool equalFills(sal_Int32 nFillId1, sal_Int32 nFillId2)
Returns true, if the specified fills are equal.
CellStyleModel()
True = style not visible in GUI.
Xf(const WorkbookHelper &rHelper)
Accessor class to ScDocument.
CellStyleBuffer maCellStyles
List of cell styles.
void finalizeImport()
Final processing after import of all style settings.
ApiSolidFillData()
True = fill data is valid.
std::shared_ptr< Xf > XfRef
OUString createCellStyle(sal_Int32 nXfId) const
Creates the style sheet described by the style XF with the passed identifier.
Contains XML pattern fill attributes from the patternFill element.
XfVector maCellXfs
List of cell area fill objects.
std::shared_ptr< Dxf > DxfRef
bool mbBold
Escapement style.
StylesBuffer & getStyles() const
Returns all cell formatting objects read from the styles substream.
PatternFillModel(bool bDxf)
True = pattern used.
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
ApiSolidFillData maApiData
void importDxfFlag(sal_Int32 nElement, SequenceInputStream &rStrm)
Imports a font style flag from a DXF record.
Contains XML gradient fill attributes from the gradientFill element.
void fillToItemSet(SfxItemSet &rSet) const
void importPaletteColor(const AttributeList &rAttribs)
Appends a new color to the color palette.
void importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
void importColor(const AttributeList &rAttribs, double fPosition)
Sets a color from the color element in a gradient fill.
NumberFormatsBuffer maNumFmts
List of font objects.
std::shared_ptr< Border > BorderRef
Contains API font name, family, and charset for a script type.
NONE
bool mbEscapementUsed
True = underline style is used.
sal_Int32 scaleToMm100(double fValue, Unit eUnit) const
Converts the passed value to 1/100 millimeters.
GraphicHelper & getGraphicHelper() const
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6063
void setBiff12Data(sal_uInt32 nFlags)
Sets the alignment attributes from the passed BIFF12 XF record data.
const sal_Int32 OOX_COLOR_WINDOWTEXT3
AUTO
ColorMap maColors
Bottom convergence for type path.
void setProperties(const css::uno::Sequence< OUString > &rPropNames, const css::uno::Sequence< css::uno::Any > &rValues)
sal_Int32 mnLevel
Identifier for builtin styles.
void forEachMem(FuncType pFunc) const
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
sal_Int32 mnRotation
CTL text direction.
sal_uInt16 readuInt16()
BorderModel(bool bDxf)
True = bottom-left to top-right on.
void importAttribs(sal_Int32 nElement, const AttributeList &rAttribs)
Sets font formatting attributes for the passed element.
CellStyleVector maBuiltinStyles
SvxCellVerJustify
const ScPatternAttr * pPattern
Definition: attarray.hxx:83
Alignment maAlignment
Cell XF or style XF model data.
bool mbShrink
True = multi-line text.
LINESTYLE_NONE
void finalizeImport(bool bRTL)
Final processing after import of all style settings.
std::shared_ptr< CellStyle > CellStyleRef
static bool equalBorders(sal_Int32 nBorderId1, sal_Int32 nBorderId2)
Returns true, if the specified borders are equal.
ScPatternAttrPtr mpPattern
const ::Color API_RGB_TRANSPARENT(0xffffffff)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
BorderVector maBorders
List of all number format codes.
DxfVector maDxfs
All built-in and user defined cell styles.
void importDxfBgColor(SequenceInputStream &rStrm)
Imports the background color from a DXF record.
bool mbUsed
True = transparent area.
int nCount
void importDxfUnderline(SequenceInputStream &rStrm)
Imports the font underline style from a DXF record.
bool hasAttribute(sal_Int32 nAttrToken) const
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_HOR_JUSTIFY_METHOD(130)
::oox::core::FilterBase & getBaseFilter() const
Returns the base filter object (base class of all filters).
AttrList(const ScPatternAttr *pDefPatternAttr)
NumberFormatRef mxNumFmt
Font data.
bool mbStrikeoutUsed
True = font posture (italic) is used.
void setBiffWeight(sal_uInt16 nWeight)
ApiFontUsedFlags maUsedFlags
const sal_Int32 OOX_COLOR_CHWINDOWBACK
System window text color (BIFF8 charts).
SCTAB Tab() const
Definition: address.hxx:271
void insertCellStyle(CellStyleRef const &xCellStyle)
Inserts the passed cell style object into the internal maps.
const sal_uInt8 WINDOWS_CHARSET_DEFAULT
SC_DLLPUBLIC void ResetParent()
Definition: stlsheet.cxx:121
Style maTop
void importBorder(const AttributeList &rAttribs)
Sets global border attributes from the border element.
XfRef createStyleXf()
Creates a new empty style formatting object.
Contains cell fill attributes, either a pattern fill or a gradient fill.
FillRef const & createFill(bool bAlwaysNew=true)
Creates a new empty fill object.
STRIKEOUT_SINGLE
FAMILY_DECORATIVE
BorderLineModel maBottom
Top line format.
sal_Int16 mnEscapement
Font color.
sal_uInt8 GetBlue() const
void applyPatternToAttrList(AttrList &rAttrs, SCROW nRow1, SCROW nRow2, sal_Int32 nForceScNumFmt)
sal_Int32 mnXfId
Cell style name.
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
ExcelGraphicHelper(const WorkbookHelper &rHelper)
ProtectionModel()
True = formula is hidden.
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
XfModel maModel
Calc number format.
void SetColor(const Color &rCol)
NumberFormatRef importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
bool getFlag(Type nBitField, Type nMask)
sal_Int16 mnWritingMode
Text rotation angle.
void importStyle(sal_Int32 nElement, const AttributeList &rAttribs)
Sets border attributes for the border line with the passed element identifier.
css::table::CellOrientation meOrientation
AlignmentModel()
True = justify last line in block text.
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
#define SAL_N_ELEMENTS(arr)
virtual sal_Int64 tell() const override
Contains attributes of a cell style, e.g.
sal_Int32 meRotationRef
Cell protection data.
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
exports com.sun.star. text
::ScStyleSheet * getCellStyleSheet(sal_Int32 nXfId) const
Color maFillColor
Pattern foreground color.
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
BorderRef mxBorder
Protection data.
FontVector maFonts
Color palette.
FontType
void importGradientFill(const AttributeList &rAttribs)
Sets attributes of a gradientFill element.
sal_Int32 mnFillId
Index to list of cell borders.
bool mbUnderlineUsed
True = font height is used.
std::shared_ptr< NumberFormat > NumberFormatRef
::SvxCellVerJustify GetScVerAlign() const
bool mbStrikeout
True = italic characters.
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
def right
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
ApiScriptFontName maAsianFont
Font name for latin scripts.
bool mbBorderUsed
Diagonal bottom-left to top-right line format.
static void PutItem(SfxItemSet &rItemSet, const SfxPoolItem &rItem, sal_uInt16 nWhichId, bool bSkipPoolDef)
Puts the item into the passed item set.
Definition: ftools.cxx:210
const ::Color API_RGB_WHITE(0xFFFFFF)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
bool needsRichTextFormat() const
Returns true, if the font requires rich text formatting in Calc.
int i
ApiFontUsedFlags(bool bAllUsed)
True = shadow style is used.
::FontFamily lcl_getFontFamily(sal_Int32 nFamily)
void setBiffPattern(sal_Int32 nPattern)
Sets the passed BIFF pattern identifier.
SequenceInputStream & operator>>(SequenceInputStream &rStrm, BinAddress &orPos)
BorderRef getBorder(sal_Int32 nBorderId) const
Returns the specified border object.
void setPaletteClr(sal_Int32 nPaletteIdx)
void importColor(const AttributeList &rAttribs)
Imports the color from the passed attribute list.
bool mbDiagUsed
True = left/right/top/bottom line format used.
#define PALETTE_EGA_COLORS_DARK
Standard EGA colors), dark.
AutoFormatModel()
True = apply protection from autoformatting.
sal_Int16 mnFamily
Font name.
BorderLineModel maRight
Left line format.
sal_Int32 mnType
std::shared_ptr< Alignment > mxAlignment
Number format data.
const ScPatternAttr * mpDefPattern
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
bool mbDiagTLtoBR
Diagonal line format.
css::uno::Reference< css::container::XNameContainer > getCellStyleFamily() const
Returns the cell styles container from the Calc document.
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
::Color getColor(const GraphicHelper &rGraphicHelper,::Color nPhClr=API_RGB_TRANSPARENT) const
sal_Int8 mnEscapeHeight
Escapement style.
FontRef getFont(sal_Int32 nFontId) const
Returns the specified font object.
void writeFillToItemSet(SfxItemSet &rItemSet, sal_Int32 nFillId, bool bSkipPoolDefs) const
Writes the fill attributes of the specified fill data to the passed property map. ...
const FontModel & getDefaultFontModel() const
Returns the model of the default application font (used in the "Normal" cell style).
sal_uInt32 fillToItemSet(SfxItemSet &rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs) const
static OUString readString(SequenceInputStream &rStrm, bool b32BitLen=true)
Reads a BIFF12 string with leading 16-bit or 32-bit length field.
Definition: biffhelper.cxx:78
void importDxf(SequenceInputStream &rStrm)
Imports the DXF record from the passed stream.
OUString getDefaultStyleName() const
Returns the default style sheet for unused cells.
XfModel()
True = area data used.
sal_Int32 mnIndent
Text rotation angle.
css::table::CellHoriJustify meHorJustify
bool mbItalic
True = bold characters.
void importDxfFgColor(SequenceInputStream &rStrm)
Imports the pattern color from a DXF record.
bool mbOutlineUsed
True = strike out style is used.
Style maLeft
LINESTYLE_SINGLE
float u
bool mbFontUsed
True = cell XF, false = style XF.
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
bool mbBorderUsed
True = cell protection used.
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
AlignmentModel maModel
void finalizeImport()
Final processing after import of all style settings.
XML_TOKEN_INVALID
std::shared_ptr< Font > FontRef
PITCH_DONTKNOW
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4788
ApiFontData()
True = shadowed chgaracters.
bool operator==(const ApiAlignmentData &rLeft, const ApiAlignmentData &rRight)
Style maRight
const ApiAlignmentData & getApiData() const
Returns the converted API alignment data struct.
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
sal_Int32 mnFontId
Index to parent style XF.
void finalizeImport(const OUString &rFinalName)
Stores the passed final style name and creates the cell style, if it is user-defined or modified buil...
SVX_ROTATE_MODE_BOTTOM
ApiBorderData maApiData
sal_Int32 mnCharSet
Font family.
ITALIC_NONE
ApiScriptFontName maCmplxFont
Font name for east-asian scripts.
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
FontPitch
NumberFormatRef importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
void writeBorderToItemSet(SfxItemSet &rItemSet, sal_Int32 nBorderId, bool bSkipPoolDefs) const
Writes the specified number format to the passed property map.
double mfRight
Left convergence for type path.
::ScStyleSheet * mpStyleSheet
Rotation reference dependent on border.
#define PALETTE_EGA_COLORS_LIGHT
Standard EGA colors, bright.
void importDxfName(SequenceInputStream &rStrm)
Imports the font name from a DXF record.
bool mbShadow
True = outlined characters.
FontRef getFontFromCellXf(sal_Int32 nXfId) const
Returns the font object of the specified cell XF.
enumrange< T >::Iterator end(enumrange< T >)
sal_Int32 mnPattern
Background fill color.
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
Definition: patattr.cxx:1169
SCCOL Col() const
Definition: address.hxx:267
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
void setBiffStyle(sal_Int32 nLineStyle)
Sets the passed BIFF line style.
bool isDefaultStyle() const
Returns true, if this style represents the default document cell style.
css::awt::FontDescriptor maDesc
Font name for complex scripts.
NORMAL
void importCellStyle(const AttributeList &rAttribs)
Imports passed attributes from the cellStyle element.
FontRef const & createFont(bool bAlwaysNew=true)
Creates a new empty font object.
Digit width of document default font.
GradientModelRef mxGradientModel
void setBiff12Scheme(sal_uInt8 nScheme)
void importColorId(SequenceInputStream &rStrm)
Imports a 32-bit palette color identifier from the passed BIFF12 stream.
OUString createCellStyle(sal_Int32 nXfId) const
Creates the style sheet described by the style XF with the passed identifier.
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
bool mbOutline
True = Strike out characters.
void readGradientStop(SequenceInputStream &rStrm, bool bDxf)
Reads BIFF12 gradient stop settings from a FILL or DXF record.
void setTheme(sal_Int32 nThemeIdx, double fTint=0.0)
Sets the color to the passed theme index.
NumberFormatRef createNumFmt(sal_uInt32 nNumFmtId, const OUString &rFmtCode)
Inserts a new number format.
sal_uInt8 GetGreen() const
double mfAngle
Gradient type, linear or path.
#define SAL_MIN_INT16
void finalizeImport()
Final processing after import of all style settings.
const sal_Int16 API_LINE_MEDIUM
FontFamily
void setSchemeClr(sal_Int32 nToken)
std::map< OUString, sal_Int32 > CellStyleNameMap
constexpr TypedWhichId< SvxFrameDirectionItem > ATTR_WRITINGDIR(138)
void fillToItemSet(SfxItemSet &rItemSet, bool bEditEngineText, bool bSkipPoolDefs=false) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:18
DefTokenId nToken
Definition: qproform.cxx:400
size_t mnAppendIndex
List of RGB values.
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
FillRef mxFill
Border data.
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
ProtectionModel maModel
ApiBorderData()
True = diagonal line format used.
FontWeight
sal_Int64 getRemaining() const
void setSrgbClr(sal_Int32 nRgb)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_VER_JUSTIFY_METHOD(133)
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
Protection maProtection
Cell alignment data.
OptValue< sal_Int32 > getIntegerHex(sal_Int32 nAttrToken) const
virtual ::Color getPaletteColor(sal_Int32 nPaletteIdx) const override
Derived classes may implement to resolve a palette index to an RGB color.
mapped_type get(key_type nKey) const
void importDxfWeight(SequenceInputStream &rStrm)
Imports the font weight from a DXF record.
void finalizeImport()
Final processing after import of all style settings.
FillVector maFills
List of cell border objects.
void finalizeImport()
Final processing after import of all style settings.
bool hasAnyOuterBorder() const
Returns true, if any of the outer border lines is visible.
bool convertBorderLine(css::table::BorderLine2 &rBorderLine, const BorderLineModel &rModel)
Converts border line data to an API struct, returns true, if the line is marked as used...
virtual void seek(sal_Int64 nPos) override
const sal_Int16 API_LINE_THICK
DxfStyleMap maDxfStyles
List of differential extlst cell styles.
Contains XML attributes of a single border line.
bool mbWrapText
Indentation.
sal_uInt32 writeNumFmtToItemSet(SfxItemSet &rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs) const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
#define SAL_WARN_IF(condition, area, stream)
ApiBorderLine maBLtoTR
Diagonal top-left to bottom-right line format.
BorderLineModel(bool bDxf)
True = line format used.
ITALIC_NORMAL
unsigned char sal_uInt8
#define SAL_MAX_UINT8
void writeToPropertySet(PropertySet &rPropSet) const
Writes all font attributes to the passed property set.
sal_Int32 mnTextDir
Vertical alignment.
bool mbSchemeUsed
True = font color is used.
double mfBottom
Top convergence for type path.
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
sal_Int32 mnEscapement
Underline style.
bool mbCustom
True = builtin style.
void importDxfGradient(SequenceInputStream &rStrm)
Imports gradient settings from a DXF record.
bool mbHidden
True = customized builtin style.
BorderModel maModel
VCL_DLLPUBLIC float ConvertFontWeight(FontWeight eWeight)
bool mbBold
ApiAlignmentData maApiData
Alignment model data.
OUString maName
const sal_Int16 API_ESCAPE_SUPERSCRIPT
No escapement.
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: stlpool.cxx:71
FAMILY_SWISS
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
void importDxfStop(SequenceInputStream &rStrm)
Imports gradient stop settings from a DXF record.
bool mbJustLastLine
True = shrink to fit cell size.
ApiScriptFontName maLatinFont
ApiCellProtection maCellProt
#define SAL_MAX_INT16
void importProtection(const AttributeList &rAttribs)
Sets all attributes from the protection element.
virtual SC_DLLPUBLIC SfxItemSet & GetItemSet() override
Definition: stlsheet.cxx:126
bool mbCreated
Final style name used in API.
Alignment(const WorkbookHelper &rHelper)
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
ApiBorderLine maRight
Left line format.
CellStyleVector maUserStyles
All built-in cell styles.
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
sal_Int32 mnVerJustifyMethod
Vertical alignment.
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
FontRef createFont()
Creates a new empty font object.
sal_Int16 mnTextEnc
Font family.
bool mbPatternUsed
True = background fill color used.
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
ApiProtectionData maApiData
Protection model data.
Represents a cell format or a cell style (called XF, extended format).
void setIndexed(sal_Int32 nPaletteIdx, double fTint=0.0)
Sets the color to the passed palette index.
const char * name
void setBiffHeight(sal_uInt16 nHeight)
void importPatternFill(const AttributeList &rAttribs)
Sets attributes of a patternFill element.
const sal_Int16 API_ESCAPE_NONE
const sal_Int8 API_ESCAPEHEIGHT_DEFAULT
Relative character height if not escaped.
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
FontRef getFont() const
Returns the referred font object.
void addExcelTintTransformation(double fTint)
Border(const WorkbookHelper &rHelper, bool bDxf)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6068
bool mbPostureUsed
True = font weight (boldness) is used.
BorderLineModel maTop
Right line format.
Contains all API cell protection attributes.
ApiScriptFontName()
Font text encoding.
FontModel maModel
bool mbAlignUsed
True = number format used.
void importFill(SequenceInputStream &rStrm)
Imports the FILL record from the passed stream.
Contains all data for a cell format or cell style.
ApiFontData maApiData
const ::ScPatternAttr & createPattern(bool bSkipPoolDefs=false)
SvxEscapement
OUString createExtDxfStyle(sal_Int32 nDxfId) const
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
void importAlignment(const AttributeList &rAttribs)
Sets all attributes from the alignment element.
void importPaletteColor(const AttributeList &rAttribs)
Appends a new color from the passed attributes.
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
void appendColor(::Color nRGBValue)
Appends the passed color.
void importDxfPattern(SequenceInputStream &rStrm)
Imports the fill pattern from a DXF record.
BorderLineModel maDiagonal
Bottom line format.
static bool isLatinScript(const ScPatternAttr &rPat, ScDocument &rDoc)
Check if the attribute pattern has a number format that only produces latin script output...
Definition: numformat.cxx:33
ThemeBuffer & getTheme() const
Returns the office theme object read from the theme substorage.
BorderLineModel * getBorderLine(sal_Int32 nElement)
Returns the border line struct specified by the passed XML token identifier.
FontModel()
True = shadowed chgaracters.
const sal_Int32 OOX_COLOR_FONTAUTO
Note text color.
bool mbShadowUsed
True = outline style is used.
CellStyleRef importCellStyle(const AttributeList &rAttribs)
Appends and returns a new named cell style object.
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
bool mbBuiltin
Level for builtin column/row styles.
sal_Int32 mnHorJustifyMethod
Horizontal alignment.
DxfRef createDxf()
Creates a new empty differential formatting object.
void finalizeImport()
Final processing after import of all style settings.
void writeCellXfToDoc(ScDocumentImport &rDoc, const ScRange &rRange, sal_Int32 nXfId) const
Writes the cell formatting attributes of the specified XF to the passed property set.
void importAlignment(const AttributeList &rAttribs)
Sets all attributes from the alignment element.
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
OUString getDefaultStyleName() const
Returns the default style sheet for unused cells.
XfVector maStyleXfs
List of cell formats.
::ScStyleSheet * getCellStyleSheet(sal_Int32 nXfId) const
::ScStyleSheet * mpStyleSheet
True = style sheet created.
::Color getColorByToken(sal_Int32 nToken) const
Returns the theme color with the specified token identifier.
Definition: themebuffer.cxx:40
BorderRef createBorder()
Creates a new empty border object.
bool isEof() const
LINESTYLE_DOUBLE
bool mbNumFmtUsed
True = font index used.
Color mnColor
bool mbDiagBLtoTR
True = top-left to bottom-right on.
void importFgColor(const AttributeList &rAttribs)
Sets the pattern color from the fgColor element.
STRIKEOUT_NONE
FontRef getDefaultFont() const
Returns the default application font (used in the "Normal" cell style).
const sal_Int32 OOX_COLOR_NOTEBACK
Automatic frame border (BIFF8 charts).
StylesBuffer(const WorkbookHelper &rHelper)
bool mbWrapText
Indentation.
sal_Int32 mnScheme
Font color.
sal_Int32 mnBuiltinId
Formatting for this cell style.
static ScStyleSheet & MakeCellStyleSheet(ScStyleSheetPool &rPool, const OUString &rStyleName, bool bForceName)
Creates and returns a cell style sheet and inserts it into the pool.
Definition: ftools.cxx:253
FontLineStyle
void finalizeImport()
Final processing after import of all style settings.
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
ColorPalette(const WorkbookHelper &rHelper)
Constructs the color palette with predefined color values.
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
::Color getSystemColor(sal_Int32 nToken,::Color nDefaultRgb=API_RGB_TRANSPARENT) const
SCROW nEndRow
Definition: attarray.hxx:82
bool isCellXf() const
Returns true, if the XF is a cell XF, and false, if it is a style XF.
sal_Int32 mnBorderId
Index to number format list.
static rtl_TextEncoding GetSystemTextEncoding()
Returns system text encoding for byte string conversion.
Definition: ftools.cxx:112
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
CellStyleBuffer(const WorkbookHelper &rHelper)
bool mbTransparent
Fill color.
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
FontStrikeout
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
const OUString * GetStyleName() const
Definition: patattr.cxx:1164
std::shared_ptr< Protection > mxProtection
Alignment data.
void setRgb(::Color nRgbValue, double fTint=0.0)
Sets the color to the passed RGB value.
ApiAlignmentData()
True = shrink to fit cell size.
bool mbShadow
True = outlined characters.
bool mbFillColorUsed
True = pattern foreground color used.
static bool LineToSvxLine(const css::table::BorderLine &rLine, editeng::SvxBorderLine &rSvxLine, bool bConvert)
::SvxCellHorJustify GetScHorAlign() const
OptValue< sal_Int32 > getToken(sal_Int32 nAttrToken) const
void readGradient(SequenceInputStream &rStrm)
Reads BIFF12 gradient settings from a FILL or DXF record.
void createCellStyle()
Creates the style sheet in the document described by this cell style object.
void importXf(const AttributeList &rAttribs, bool bCellXf)
Sets all attributes from the xf element.
void finalizeImport()
Final processing after import of all style settings.
bool isBuiltin() const
Returns true, if this style is a builtin style.
sal_Int16 nValue
Style maBottom
void finalizeImport()
Final processing after import of all style settings.
const sal_Int32 OOX_COLOR_CHWINDOWTEXT
System button background color (face color).
bool mbCellXf
Index to list of cell areas.
std::vector< ScAttrEntry > maAttrs
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
const sal_Int16 API_LINE_NONE
Font auto color (system window text color).
ScDocument & getDoc()