LibreOffice Module sc (master)  1
xlchart.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 <xlchart.hxx>
21 
22 #include <com/sun/star/container/XNameContainer.hpp>
23 #include <com/sun/star/awt/Size.hpp>
24 #include <com/sun/star/awt/Gradient.hpp>
25 #include <com/sun/star/drawing/Hatch.hpp>
26 #include <com/sun/star/drawing/LineDash.hpp>
27 #include <com/sun/star/drawing/LineStyle.hpp>
28 #include <com/sun/star/drawing/FillStyle.hpp>
29 #include <com/sun/star/drawing/BitmapMode.hpp>
30 #include <com/sun/star/chart/DataLabelPlacement.hpp>
31 #include <com/sun/star/chart/XAxisXSupplier.hpp>
32 #include <com/sun/star/chart/XAxisYSupplier.hpp>
33 #include <com/sun/star/chart/XAxisZSupplier.hpp>
34 #include <com/sun/star/chart/XChartDocument.hpp>
35 #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
36 #include <com/sun/star/chart2/Symbol.hpp>
37 #include <com/sun/star/chart2/XChartDocument.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 
40 #include <o3tl/string_view.hxx>
41 #include <sal/macros.h>
42 #include <sal/mathconf.h>
43 #include <svl/itemset.hxx>
44 #include <svx/xfillit0.hxx>
45 #include <svx/xflclit.hxx>
46 #include <svx/xfltrit.hxx>
47 #include <svx/xflgrit.hxx>
48 #include <svx/xbtmpit.hxx>
49 #include <svx/unomid.hxx>
51 #include <xlroot.hxx>
52 #include <xlstyle.hxx>
53 #include <xltools.hxx>
54 
55 using namespace css;
56 
57 // Common =====================================================================
58 
60  mnX( 0 ),
61  mnY( 0 ),
62  mnWidth( 0 ),
63  mnHeight( 0 )
64 {
65 }
66 
67 XclChDataPointPos::XclChDataPointPos( sal_uInt16 nSeriesIdx, sal_uInt16 nPointIdx ) :
68  mnSeriesIdx( nSeriesIdx ),
69  mnPointIdx( nPointIdx )
70 {
71 }
72 
73 bool operator<( const XclChDataPointPos& rL, const XclChDataPointPos& rR )
74 {
75  return (rL.mnSeriesIdx < rR.mnSeriesIdx) ||
76  ((rL.mnSeriesIdx == rR.mnSeriesIdx) && (rL.mnPointIdx < rR.mnPointIdx));
77 }
78 
80  mnType( nType ),
81  mnContext( 0 ),
82  mnValue1( 0 ),
83  mnValue2( 0 )
84 {
85 }
86 
87 // Frame formatting ===========================================================
88 
90  mnTLMode( EXC_CHFRAMEPOS_PARENT ),
91  mnBRMode( EXC_CHFRAMEPOS_PARENT )
92 {
93 }
94 
96  maColor( COL_BLACK ),
97  mnPattern( EXC_CHLINEFORMAT_SOLID ),
100 {
101 }
102 
104  maPattColor( COL_WHITE ),
105  maBackColor( COL_BLACK ),
106  mnPattern( EXC_PATT_SOLID ),
108 {
109 }
110 
112 {
113 }
114 
116 {
117 }
118 
120  mnBmpMode( EXC_CHPICFORMAT_NONE ),
122  mfScale( 0.5 )
123 {
124 }
125 
127  mnFormat( EXC_CHFRAME_STANDARD ),
129 {
130 }
131 
132 // Source links ===============================================================
133 
135  mnDestType( EXC_CHSRCLINK_TITLE ),
136  mnLinkType( EXC_CHSRCLINK_DEFAULT ),
137  mnFlags( 0 ),
138  mnNumFmtIdx( 0 )
139 {
140 }
141 
142 // Text =======================================================================
143 
145  mnTarget( EXC_CHOBJLINK_NONE )
146 {
147 }
148 
150  mnFlags( 0 )
151 {
152 }
153 
155  maTextColor( COL_BLACK ),
156  mnHAlign( EXC_CHTEXT_ALIGN_CENTER ),
157  mnVAlign( EXC_CHTEXT_ALIGN_CENTER ),
158  mnBackMode( EXC_CHTEXT_TRANSPARENT ),
160  mnFlags2( EXC_CHTEXT_POS_DEFAULT ),
161  mnRotation( EXC_ROT_NONE )
162 {
163 }
164 
165 // Data series ================================================================
166 
168  maLineColor( COL_BLACK ),
170  mnMarkerSize( EXC_CHMARKERFORMAT_SINGLESIZE ),
171  mnMarkerType( EXC_CHMARKERFORMAT_NOSYMBOL ),
173 {
174 };
175 
177  mnBase( EXC_CH3DDATAFORMAT_RECT ),
179 {
180 }
181 
183  mnFormatIdx( EXC_CHDATAFORMAT_DEFAULT ),
184  mnFlags( 0 )
185 {
186 }
187 
189  mfForecastFor( 0.0 ),
190  mfForecastBack( 0.0 ),
191  mnLineType( EXC_CHSERTREND_POLYNOMIAL ),
192  mnOrder( 1 ),
193  mnShowEquation( 0 ),
194  mnShowRSquared( 0 )
195 {
196  /* Set all bits in mfIntercept to 1 (that is -1.#NAN) to indicate that
197  there is no interception point. Cannot use ::rtl::math::setNan() here
198  cause it misses the sign bit. */
199  sal_math_Double* pDouble = reinterpret_cast< sal_math_Double* >( &mfIntercept );
200  pDouble->w32_parts.msw = pDouble->w32_parts.lsw = 0xFFFFFFFF;
201 }
202 
204  mfValue( 0.0 ),
205  mnValueCount( 1 ),
206  mnBarType( EXC_CHSERERR_NONE ),
207  mnSourceType( EXC_CHSERERR_FIXED ),
208  mnLineEnd( EXC_CHSERERR_END_TSHAPE )
209 {
210 }
211 
213  mnCategType( EXC_CHSERIES_NUMERIC ),
215  mnBubbleType( EXC_CHSERIES_NUMERIC ),
216  mnCategCount( 0 ),
217  mnValueCount( 0 ),
218  mnBubbleCount( 0 )
219 {
220 }
221 
222 // Chart type groups ==========================================================
223 
225  mnOverlap( 0 ),
226  mnGap( 150 ),
227  mnRotation( 0 ),
228  mnPieHole( 0 ),
229  mnBubbleSize( 100 ),
230  mnBubbleType( EXC_CHSCATTER_AREA ),
231  mnFlags( 0 )
232 {
233 }
234 
236  mnRotation( 20 ),
237  mnElevation( 15 ),
238  mnEyeDist( 30 ),
239  mnRelHeight( 100 ),
240  mnRelDepth( 100 ),
241  mnDepthGap( 150 ),
243 {
244 }
245 
247  mnDockMode( EXC_CHLEGEND_RIGHT ),
248  mnSpacing( EXC_CHLEGEND_MEDIUM ),
251 {
252 }
253 
255  mnFlags( 0 ),
256  mnGroupIdx( EXC_CHSERGROUP_NONE )
257 {
258 }
259 
261  mnFlags( 0 ),
262  mnEmptyMode( EXC_CHPROPS_EMPTY_SKIP )
263 {
264 }
265 
266 // Axes =======================================================================
267 
269  mnCross( 1 ),
270  mnLabelFreq( 1 ),
271  mnTickFreq( 1 ),
272  mnFlags( 0 )
273 {
274 }
275 
277  mnMinDate( 0 ),
278  mnMaxDate( 0 ),
279  mnMajorStep( 0 ),
280  mnMajorUnit( EXC_CHDATERANGE_DAYS ),
281  mnMinorStep( 0 ),
282  mnMinorUnit( EXC_CHDATERANGE_DAYS ),
283  mnBaseUnit( EXC_CHDATERANGE_DAYS ),
284  mnCross( 0 ),
289 {
290 }
291 
293  mfMin( 0.0 ),
294  mfMax( 0.0 ),
295  mfMajorStep( 0.0 ),
296  mfMinorStep( 0.0 ),
297  mfCross( 0.0 ),
301 {
302 }
303 
305  maTextColor( COL_BLACK ),
307  mnMinor( 0 ),
308  mnLabelPos( EXC_CHTICK_NEXT ),
309  mnBackMode( EXC_CHTICK_TRANSPARENT ),
311  mnRotation( EXC_ROT_NONE )
312 {
313 }
314 
317 {
318 }
319 
321 {
322  sal_Int32 nApiAxisDim = EXC_CHART_AXIS_NONE;
323  switch( mnType )
324  {
325  case EXC_CHAXIS_X: nApiAxisDim = EXC_CHART_AXIS_X; break;
326  case EXC_CHAXIS_Y: nApiAxisDim = EXC_CHART_AXIS_Y; break;
327  case EXC_CHAXIS_Z: nApiAxisDim = EXC_CHART_AXIS_Z; break;
328  }
329  return nApiAxisDim;
330 }
331 
333  mnAxesSetId( EXC_CHAXESSET_PRIMARY )
334 {
335 }
336 
338 {
339  sal_Int32 nApiAxesSetIdx = EXC_CHART_AXESSET_NONE;
340  switch( mnAxesSetId )
341  {
342  case EXC_CHAXESSET_PRIMARY: nApiAxesSetIdx = EXC_CHART_AXESSET_PRIMARY; break;
343  case EXC_CHAXESSET_SECONDARY: nApiAxesSetIdx = EXC_CHART_AXESSET_SECONDARY; break;
344  }
345  return nApiAxesSetIdx;
346 }
347 
348 // Static helper functions ====================================================
349 
350 sal_uInt16 XclChartHelper::GetSeriesLineAutoColorIdx( sal_uInt16 nFormatIdx )
351 {
352  static const sal_uInt16 spnLineColors[] =
353  {
354  32, 33, 34, 35, 36, 37, 38, 39,
355  40, 41, 42, 43, 44, 45, 46, 47,
356  48, 49, 50, 51, 52, 53, 54, 55,
357  56, 57, 58, 59, 60, 61, 62, 8,
358  9, 10, 11, 12, 13, 14, 15, 16,
359  17, 18, 19, 20, 21, 22, 23, 24,
360  25, 26, 27, 28, 29, 30, 31, 63
361  };
362  return spnLineColors[ nFormatIdx % SAL_N_ELEMENTS( spnLineColors ) ];
363 }
364 
365 sal_uInt16 XclChartHelper::GetSeriesFillAutoColorIdx( sal_uInt16 nFormatIdx )
366 {
367  static const sal_uInt16 spnFillColors[] =
368  {
369  24, 25, 26, 27, 28, 29, 30, 31,
370  32, 33, 34, 35, 36, 37, 38, 39,
371  40, 41, 42, 43, 44, 45, 46, 47,
372  48, 49, 50, 51, 52, 53, 54, 55,
373  56, 57, 58, 59, 60, 61, 62, 63,
374  8, 9, 10, 11, 12, 13, 14, 15,
375  16, 17, 18, 19, 20, 21, 22, 23
376  };
377  return spnFillColors[ nFormatIdx % SAL_N_ELEMENTS( spnFillColors ) ];
378 }
379 
381 {
382  static const sal_uInt8 spnTrans[] = { 0x00, 0x40, 0x20, 0x60, 0x70 };
383  return spnTrans[ (nFormatIdx / 56) % SAL_N_ELEMENTS( spnTrans ) ];
384 }
385 
386 sal_uInt16 XclChartHelper::GetAutoMarkerType( sal_uInt16 nFormatIdx )
387 {
388  static const sal_uInt16 spnSymbols[] = {
392  return spnSymbols[ nFormatIdx % SAL_N_ELEMENTS( spnSymbols ) ];
393 }
394 
395 bool XclChartHelper::HasMarkerFillColor( sal_uInt16 nMarkerType )
396 {
397  static const bool spbFilled[] = {
398  false, true, true, true, false, false, false, false, true, false };
399  return (nMarkerType < SAL_N_ELEMENTS( spbFilled )) && spbFilled[ nMarkerType ];
400 }
401 
403 {
404  switch( nBarType )
405  {
410  default: OSL_FAIL( "XclChartHelper::GetErrorBarValuesRole - unknown bar type" );
411  }
412  return OUString();
413 }
414 
415 // Chart formatting info provider =============================================
416 
417 namespace {
418 
419 const XclChFormatInfo spFmtInfos[] =
420 {
421  // object type property mode auto line color auto line weight auto pattern color missing frame type create delete isframe
438 };
439 
440 }
441 
443 {
444  for(auto const &rIt : spFmtInfos)
445  maInfoMap[ rIt.meObjType ] = &rIt;
446 }
447 
449 {
450  XclFmtInfoMap::const_iterator aIt = maInfoMap.find( eObjType );
451  OSL_ENSURE( aIt != maInfoMap.end(), "XclChFormatInfoProvider::GetFormatInfo - unknown object type" );
452  return (aIt == maInfoMap.end()) ? *spFmtInfos : *aIt->second;
453 }
454 
455 // Chart type info provider ===================================================
456 
457 namespace {
458 
459 // chart type service names
460 const char SERVICE_CHART2_AREA[] = "com.sun.star.chart2.AreaChartType";
461 const char SERVICE_CHART2_CANDLE[] = "com.sun.star.chart2.CandleStickChartType";
462 const char SERVICE_CHART2_COLUMN[] = "com.sun.star.chart2.ColumnChartType";
463 const char SERVICE_CHART2_LINE[] = "com.sun.star.chart2.LineChartType";
464 const char SERVICE_CHART2_NET[] = "com.sun.star.chart2.NetChartType";
465 const char SERVICE_CHART2_FILLEDNET[] = "com.sun.star.chart2.FilledNetChartType";
466 const char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType";
467 const char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType";
468 const char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType";
469 const char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo
470 
471 namespace csscd = css::chart::DataLabelPlacement;
472 
473 const XclChTypeInfo spTypeInfos[] =
474 {
475  // chart type chart type category record id service varied point color def label pos comb2d 3d polar area2d area3d 1stvis xcateg swap stack revers betw
476  { EXC_CHTYPEID_BAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true },
477  { EXC_CHTYPEID_HORBAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, false, true, false, true, true, false, true, true, true, false, true },
478  { EXC_CHTYPEID_LINE, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_LINE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, true, false, false, true, false, true, false, true, false, false },
479  { EXC_CHTYPEID_AREA, EXC_CHTYPECATEG_LINE, EXC_ID_CHAREA, SERVICE_CHART2_AREA, EXC_CHVARPOINT_NONE, csscd::CENTER, true, true, false, true, true, false, true, false, true, true, false },
480  { EXC_CHTYPEID_STOCK, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_CANDLE, EXC_CHVARPOINT_NONE, csscd::RIGHT, true, false, false, false, false, false, true, false, true, false, false },
481  { EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false },
482  { EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_FILLEDNET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, true, false },
483  { EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false },
484  { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, false, false },
485  { EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false },
486  { EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false },
487  { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false },
488  { EXC_CHTYPEID_SURFACE, EXC_CHTYPECATEG_SURFACE, EXC_ID_CHSURFACE, SERVICE_CHART2_SURFACE, EXC_CHVARPOINT_NONE, csscd::RIGHT, false, true, false, true, true, false, true, false, false, false, false },
489  { EXC_CHTYPEID_UNKNOWN, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true }
490 };
491 
492 } // namespace
493 
495  XclChTypeInfo( rTypeInfo ),
496  mb3dChart( false ),
497  mbSpline( false )
498 {
499 }
500 
501 void XclChExtTypeInfo::Set( const XclChTypeInfo& rTypeInfo, bool b3dChart, bool bSpline )
502 {
503  static_cast< XclChTypeInfo& >( *this ) = rTypeInfo;
504  mb3dChart = mbSupports3d && b3dChart;
505  mbSpline = bSpline;
506 }
507 
509 {
510  for(const auto &rIt : spTypeInfos)
511  maInfoMap[ rIt.meTypeId ] = &rIt;
512 }
513 
515 {
516  XclChTypeInfoMap::const_iterator aIt = maInfoMap.find( eTypeId );
517  OSL_ENSURE( aIt != maInfoMap.end(), "XclChTypeInfoProvider::GetTypeInfo - unknown chart type" );
518  return (aIt == maInfoMap.end()) ? *maInfoMap.rbegin()->second : *aIt->second;
519 }
520 
522 {
523  for(const auto &rIt : spTypeInfos)
524  {
525  if(rIt.mnRecId == nRecId)
526  return rIt;
527  }
528  OSL_FAIL( "XclChTypeInfoProvider::GetTypeInfoFromRecId - unknown record id" );
530 }
531 
532 const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfoFromService( std::u16string_view rServiceName ) const
533 {
534  for(auto const &rIt : spTypeInfos)
535  if( o3tl::equalsAscii( rServiceName, rIt.mpcServiceName ) )
536  return rIt;
537  OSL_FAIL( "XclChTypeInfoProvider::GetTypeInfoFromService - unknown service name" );
539 }
540 
541 // Property helpers ===========================================================
542 
543 XclChObjectTable::XclChObjectTable(uno::Reference<lang::XMultiServiceFactory> const & xFactory,
544  const OUString& rServiceName, const OUString& rObjNameBase ) :
545  mxFactory( xFactory ),
546  maServiceName( rServiceName ),
547  maObjNameBase( rObjNameBase ),
548  mnIndex( 0 )
549 {
550 }
551 
552 uno::Any XclChObjectTable::GetObject( const OUString& rObjName )
553 {
554  // get object table
555  if( !mxContainer.is() )
557  OSL_ENSURE( mxContainer.is(), "XclChObjectTable::GetObject - container not found" );
558 
559  uno::Any aObj;
560  if( mxContainer.is() )
561  {
562  // get object from container
563  try
564  {
565  aObj = mxContainer->getByName( rObjName );
566  }
567  catch (uno::Exception &)
568  {
569  OSL_FAIL( "XclChObjectTable::GetObject - object not found" );
570  }
571  }
572  return aObj;
573 }
574 
576 {
577 
578  // create object table
579  if( !mxContainer.is() )
581  OSL_ENSURE( mxContainer.is(), "XclChObjectTable::InsertObject - container not found" );
582 
583  OUString aObjName;
584  if( mxContainer.is() )
585  {
586  // create new unused identifier
587  do
588  {
589  aObjName = maObjNameBase + OUString::number( ++mnIndex );
590  }
591  while( mxContainer->hasByName( aObjName ) );
592 
593  // insert object
594  try
595  {
596  mxContainer->insertByName( aObjName, rObj );
597  }
598  catch (uno::Exception &)
599  {
600  OSL_FAIL( "XclChObjectTable::InsertObject - cannot insert object" );
601  aObjName.clear();
602  }
603  }
604  return aObjName;
605 }
606 
607 // Property names -------------------------------------------------------------
608 
609 namespace {
610 
612 const char* const sppcLineNamesCommon[] =
613  { "LineStyle", "LineWidth", "LineColor", "LineTransparence", "LineDashName", nullptr };
615 const char* const sppcLineNamesLinear[] =
616  { "LineStyle", "LineWidth", "Color", "Transparency", "LineDashName", nullptr };
618 const char* const sppcLineNamesFilled[] =
619  { "BorderStyle", "BorderWidth", "BorderColor", "BorderTransparency", "BorderDashName", nullptr };
620 
622 const char* const sppcAreaNamesCommon[] = { "FillStyle", "FillColor", "FillTransparence", nullptr };
624 const char* const sppcAreaNamesFilled[] = { "FillStyle", "Color", "Transparency", nullptr };
626 const char* const sppcGradNamesCommon[] = { "FillStyle", "FillGradientName", nullptr };
628 const char* const sppcGradNamesFilled[] = { "FillStyle", "GradientName", nullptr };
630 const char* const sppcHatchNamesCommon[] = { "FillStyle", "FillHatchName", "FillColor", "FillBackground", nullptr };
632 const char* const sppcHatchNamesFilled[] = { "FillStyle", "HatchName", "Color", "FillBackground", nullptr };
634 const char* const sppcBitmapNames[] = { "FillStyle", "FillBitmapName", "FillBitmapMode", nullptr };
635 
636 } // namespace
637 
639  maLineHlpCommon( sppcLineNamesCommon ),
640  maLineHlpLinear( sppcLineNamesLinear ),
641  maLineHlpFilled( sppcLineNamesFilled ),
642  maAreaHlpCommon( sppcAreaNamesCommon ),
643  maAreaHlpFilled( sppcAreaNamesFilled ),
644  maGradHlpCommon( sppcGradNamesCommon ),
645  maGradHlpFilled( sppcGradNamesFilled ),
646  maHatchHlpCommon( sppcHatchNamesCommon ),
647  maHatchHlpFilled( sppcHatchNamesFilled ),
648  maBitmapHlp( sppcBitmapNames )
649 {
650 }
651 
652 // read properties ------------------------------------------------------------
653 
655  XclChLineFormat& rLineFmt, XclChObjectTable& rDashTable,
656  const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode )
657 {
658  // read properties from property set
659  drawing::LineStyle eApiStyle = drawing::LineStyle_NONE;
660  sal_Int32 nApiWidth = 0;
661  sal_Int16 nApiTrans = 0;
662  uno::Any aDashNameAny;
663 
664  ScfPropSetHelper& rLineHlp = GetLineHelper( ePropMode );
665  rLineHlp.ReadFromPropertySet( rPropSet );
666  rLineHlp >> eApiStyle >> nApiWidth >> rLineFmt.maColor >> nApiTrans >> aDashNameAny;
667 
668  // clear automatic flag
669  ::set_flag( rLineFmt.mnFlags, EXC_CHLINEFORMAT_AUTO, false );
670 
671  // line width
672  if( nApiWidth <= 0 ) rLineFmt.mnWeight = EXC_CHLINEFORMAT_HAIR;
673  else if( nApiWidth <= 35 ) rLineFmt.mnWeight = EXC_CHLINEFORMAT_SINGLE;
674  else if( nApiWidth <= 70 ) rLineFmt.mnWeight = EXC_CHLINEFORMAT_DOUBLE;
675  else rLineFmt.mnWeight = EXC_CHLINEFORMAT_TRIPLE;
676 
677  // line style
678  switch( eApiStyle )
679  {
680  case drawing::LineStyle_NONE:
681  rLineFmt.mnPattern = EXC_CHLINEFORMAT_NONE;
682  break;
683  case drawing::LineStyle_SOLID:
684  {
685  if( nApiTrans < 13 ) rLineFmt.mnPattern = EXC_CHLINEFORMAT_SOLID;
686  else if( nApiTrans < 38 ) rLineFmt.mnPattern = EXC_CHLINEFORMAT_DARKTRANS;
687  else if( nApiTrans < 63 ) rLineFmt.mnPattern = EXC_CHLINEFORMAT_MEDTRANS;
688  else if( nApiTrans < 100 ) rLineFmt.mnPattern = EXC_CHLINEFORMAT_LIGHTTRANS;
689  else rLineFmt.mnPattern = EXC_CHLINEFORMAT_NONE;
690  }
691  break;
692  case drawing::LineStyle_DASH:
693  {
695  OUString aDashName;
696  drawing::LineDash aApiDash;
697  if( (aDashNameAny >>= aDashName) && (rDashTable.GetObject( aDashName ) >>= aApiDash) )
698  {
699  // reorder dashes that are shorter than dots
700  if( (aApiDash.Dashes == 0) || (aApiDash.DashLen < aApiDash.DotLen) )
701  {
702  ::std::swap( aApiDash.Dashes, aApiDash.Dots );
703  ::std::swap( aApiDash.DashLen, aApiDash.DotLen );
704  }
705  // ignore dots that are nearly equal to dashes
706  if( aApiDash.DotLen * 3 > aApiDash.DashLen * 2 )
707  aApiDash.Dots = 0;
708 
709  // convert line dash to predefined Excel dash types
710  if( (aApiDash.Dashes == 1) && (aApiDash.Dots >= 1) )
711  // one dash and one or more dots
712  rLineFmt.mnPattern = (aApiDash.Dots == 1) ?
714  else if( aApiDash.Dashes >= 1 )
715  // one or more dashes and no dots (also: dash-dash-dot)
716  rLineFmt.mnPattern = (aApiDash.DashLen < 250) ?
718  }
719  }
720  break;
721  default:
722  OSL_FAIL( "XclChPropSetHelper::ReadLineProperties - unknown line style" );
724  }
725 }
726 
728  const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode )
729 {
730  // read properties from property set
731  drawing::FillStyle eApiStyle = drawing::FillStyle_NONE;
732  sal_Int16 nTransparency = 0;
733 
734  ScfPropSetHelper& rAreaHlp = GetAreaHelper( ePropMode );
735  rAreaHlp.ReadFromPropertySet( rPropSet );
736  rAreaHlp >> eApiStyle >> rAreaFmt.maPattColor >> nTransparency;
737 
738  // clear automatic flag
739  ::set_flag( rAreaFmt.mnFlags, EXC_CHAREAFORMAT_AUTO, false );
740 
741  // set fill style transparent or solid (set solid for anything but transparent)
742  rAreaFmt.mnPattern = (eApiStyle == drawing::FillStyle_NONE) ? EXC_PATT_NONE : EXC_PATT_SOLID;
743 
744  // return true to indicate complex fill (gradient, bitmap, solid transparency)
745  return (eApiStyle != drawing::FillStyle_NONE) && ((eApiStyle != drawing::FillStyle_SOLID) || (nTransparency > 0));
746 }
747 
749  XclChEscherFormat& rEscherFmt, XclChPicFormat& rPicFmt,
750  XclChObjectTable& rGradientTable, XclChObjectTable& rHatchTable, XclChObjectTable& rBitmapTable,
751  const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode )
752 {
753  // read style and transparency properties from property set
754  drawing::FillStyle eApiStyle = drawing::FillStyle_NONE;
755  Color aColor;
756  sal_Int16 nTransparency = 0;
757 
758  ScfPropSetHelper& rAreaHlp = GetAreaHelper( ePropMode );
759  rAreaHlp.ReadFromPropertySet( rPropSet );
760  rAreaHlp >> eApiStyle >> aColor >> nTransparency;
761 
762  switch( eApiStyle )
763  {
764  case drawing::FillStyle_SOLID:
765  {
766  OSL_ENSURE( nTransparency > 0, "XclChPropSetHelper::ReadEscherProperties - unexpected solid area without transparency" );
767  if( (0 < nTransparency) && (nTransparency <= 100) )
768  {
769  // convert to Escher properties
770  sal_uInt32 nEscherColor = 0x02000000;
771  ::insert_value( nEscherColor, aColor.GetBlue(), 16, 8 );
772  ::insert_value( nEscherColor, aColor.GetGreen(), 8, 8 );
773  ::insert_value( nEscherColor, aColor.GetRed(), 0, 8 );
774  sal_uInt32 nEscherOpacity = static_cast< sal_uInt32 >( (100 - nTransparency) * 655.36 );
775  rEscherFmt.mxEscherSet = std::make_shared<EscherPropertyContainer>();
776  rEscherFmt.mxEscherSet->AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
777  rEscherFmt.mxEscherSet->AddOpt( ESCHER_Prop_fillColor, nEscherColor );
778  rEscherFmt.mxEscherSet->AddOpt( ESCHER_Prop_fillOpacity, nEscherOpacity );
779  rEscherFmt.mxEscherSet->AddOpt( ESCHER_Prop_fillBackColor, 0x02FFFFFF );
780  rEscherFmt.mxEscherSet->AddOpt( ESCHER_Prop_fillBackOpacity, 0x00010000 );
781  rEscherFmt.mxEscherSet->AddOpt( ESCHER_Prop_fNoFillHitTest, 0x001F001C );
782  }
783  }
784  break;
785  case drawing::FillStyle_GRADIENT:
786  {
787  // extract gradient from global gradient table
788  OUString aGradientName;
789  ScfPropSetHelper& rGradHlp = GetGradientHelper( ePropMode );
790  rGradHlp.ReadFromPropertySet( rPropSet );
791  rGradHlp >> eApiStyle >> aGradientName;
792  awt::Gradient aGradient;
793  if( rGradientTable.GetObject( aGradientName ) >>= aGradient )
794  {
795  // convert to Escher properties
796  rEscherFmt.mxEscherSet = std::make_shared<EscherPropertyContainer>();
797  rEscherFmt.mxEscherSet->CreateGradientProperties( aGradient );
798  }
799  }
800  break;
801  case drawing::FillStyle_HATCH:
802  {
803  // extract hatch from global hatch table
804  OUString aHatchName;
805  bool bFillBackground;
806  ScfPropSetHelper& rHatchHlp = GetHatchHelper( ePropMode );
807  rHatchHlp.ReadFromPropertySet( rPropSet );
808  rHatchHlp >> eApiStyle >> aHatchName >> aColor >> bFillBackground;
809  drawing::Hatch aHatch;
810  if( rHatchTable.GetObject( aHatchName ) >>= aHatch )
811  {
812  // convert to Escher properties
813  rEscherFmt.mxEscherSet = std::make_shared<EscherPropertyContainer>();
814  rEscherFmt.mxEscherSet->CreateEmbeddedHatchProperties( aHatch, aColor, bFillBackground );
816  }
817  }
818  break;
819  case drawing::FillStyle_BITMAP:
820  {
821  // extract bitmap URL from global bitmap table
822  OUString aBitmapName;
823  drawing::BitmapMode eApiBmpMode;
824  maBitmapHlp.ReadFromPropertySet( rPropSet );
825  maBitmapHlp >> eApiStyle >> aBitmapName >> eApiBmpMode;
826  uno::Reference<awt::XBitmap> xBitmap;
827  if (rBitmapTable.GetObject( aBitmapName ) >>= xBitmap)
828  {
829  // convert to Escher properties
830  rEscherFmt.mxEscherSet = std::make_shared<EscherPropertyContainer>();
831  rEscherFmt.mxEscherSet->CreateEmbeddedBitmapProperties( xBitmap, eApiBmpMode );
832  rPicFmt.mnBmpMode = (eApiBmpMode == drawing::BitmapMode_REPEAT) ?
834  }
835  }
836  break;
837  default:
838  OSL_FAIL( "XclChPropSetHelper::ReadEscherProperties - unknown fill style" );
839  }
840 }
841 
843  XclChMarkerFormat& rMarkerFmt, const ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx )
844 {
845  chart2::Symbol aApiSymbol;
846  if( !rPropSet.GetProperty( aApiSymbol, EXC_CHPROP_SYMBOL ) )
847  return;
848 
849  // clear automatic flag
850  ::set_flag( rMarkerFmt.mnFlags, EXC_CHMARKERFORMAT_AUTO, false );
851 
852  // symbol style
853  switch( aApiSymbol.Style )
854  {
855  case chart2::SymbolStyle_NONE:
857  break;
858  case chart2::SymbolStyle_STANDARD:
859  switch( aApiSymbol.StandardSymbol )
860  {
861  case 0: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_SQUARE; break; // square
862  case 1: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_DIAMOND; break; // diamond
863  case 2: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_STDDEV; break; // arrow down
864  case 3: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_TRIANGLE; break; // arrow up
865  case 4: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_DOWJ; break; // arrow right, same as import
866  case 5: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_PLUS; break; // arrow left
867  case 6: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_CROSS; break; // bow tie
868  case 7: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_STAR; break; // sand glass
869  case 8: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_CIRCLE; break; // circle new in LibO3.5
870  case 9: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_DIAMOND; break; // star new in LibO3.5
871  case 10: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_CROSS; break; // X new in LibO3.5
872  case 11: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_PLUS; break; // plus new in LibO3.5
873  case 12: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_STAR; break; // asterisk new in LibO3.5
874  case 13: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_STDDEV; break; // horizontal bar new in LibO3.5
875  case 14: rMarkerFmt.mnMarkerType = EXC_CHMARKERFORMAT_STAR; break; // vertical bar new in LibO3.5
876  default: rMarkerFmt.mnMarkerType = XclChartHelper::GetAutoMarkerType( nFormatIdx );
877  }
878  break;
879  default:
880  rMarkerFmt.mnMarkerType = XclChartHelper::GetAutoMarkerType( nFormatIdx );
881  }
882  bool bHasFillColor = XclChartHelper::HasMarkerFillColor( rMarkerFmt.mnMarkerType );
883  ::set_flag( rMarkerFmt.mnFlags, EXC_CHMARKERFORMAT_NOFILL, !bHasFillColor );
884 
885  // symbol size
886  sal_Int32 nApiSize = (aApiSymbol.Size.Width + aApiSymbol.Size.Height + 1) / 2;
887  rMarkerFmt.mnMarkerSize = XclTools::GetTwipsFromHmm( nApiSize );
888 
889  // symbol colors
890  rMarkerFmt.maLineColor = Color( ColorTransparency, aApiSymbol.BorderColor );
891  rMarkerFmt.maFillColor = Color( ColorTransparency, aApiSymbol.FillColor );
892 }
893 
894 sal_uInt16 XclChPropSetHelper::ReadRotationProperties( const ScfPropertySet& rPropSet, bool bSupportsStacked )
895 {
896  // chart2 handles rotation as double in the range [0,360)
897  double fAngle = 0.0;
898  rPropSet.GetProperty( fAngle, EXC_CHPROP_TEXTROTATION );
899  bool bStacked = bSupportsStacked && rPropSet.GetBoolProperty( EXC_CHPROP_STACKCHARACTERS );
900  return bStacked ? EXC_ROT_STACKED :
901  XclTools::GetXclRotation( Degree100(static_cast< sal_Int32 >( fAngle * 100.0 + 0.5 )) );
902 }
903 
904 // write properties -----------------------------------------------------------
905 
907  ScfPropertySet& rPropSet, XclChObjectTable& rDashTable,
908  const XclChLineFormat& rLineFmt, XclChPropertyMode ePropMode )
909 {
910  // line width
911  sal_Int32 nApiWidth = 0; // 0 is the width of a hair line
912  switch( rLineFmt.mnWeight )
913  {
914  case EXC_CHLINEFORMAT_SINGLE: nApiWidth = 35; break;
915  case EXC_CHLINEFORMAT_DOUBLE: nApiWidth = 70; break;
916  case EXC_CHLINEFORMAT_TRIPLE: nApiWidth = 105; break;
917  }
918 
919  // line style
920  drawing::LineStyle eApiStyle = drawing::LineStyle_NONE;
921  sal_Int16 nApiTrans = 0;
922  sal_Int32 nDotLen = ::std::min< sal_Int32 >( rLineFmt.mnWeight + 105, 210 );
923  drawing::LineDash aApiDash( drawing::DashStyle_RECT, 0, nDotLen, 0, 4 * nDotLen, nDotLen );
924 
925  switch( rLineFmt.mnPattern )
926  {
928  eApiStyle = drawing::LineStyle_SOLID;
929  break;
931  eApiStyle = drawing::LineStyle_SOLID; nApiTrans = 25;
932  break;
934  eApiStyle = drawing::LineStyle_SOLID; nApiTrans = 50;
935  break;
937  eApiStyle = drawing::LineStyle_SOLID; nApiTrans = 75;
938  break;
940  eApiStyle = drawing::LineStyle_DASH; aApiDash.Dashes = 1;
941  break;
943  eApiStyle = drawing::LineStyle_DASH; aApiDash.Dots = 1;
944  break;
946  eApiStyle = drawing::LineStyle_DASH; aApiDash.Dashes = aApiDash.Dots = 1;
947  break;
949  eApiStyle = drawing::LineStyle_DASH; aApiDash.Dashes = 1; aApiDash.Dots = 2;
950  break;
951  }
952 
953  // line color
954  sal_Int32 nApiColor = sal_Int32( rLineFmt.maColor );
955 
956  // try to insert the dash style and receive its name
957  uno::Any aDashNameAny;
958  if( eApiStyle == drawing::LineStyle_DASH )
959  {
960  OUString aDashName = rDashTable.InsertObject( uno::Any( aApiDash ) );
961  if( !aDashName.isEmpty() )
962  aDashNameAny <<= aDashName;
963  }
964 
965  // write the properties
966  ScfPropSetHelper& rLineHlp = GetLineHelper( ePropMode );
967  rLineHlp.InitializeWrite();
968  rLineHlp << eApiStyle << nApiWidth << nApiColor << nApiTrans << aDashNameAny;
969  rLineHlp.WriteToPropertySet( rPropSet );
970 }
971 
973  const XclChAreaFormat& rAreaFmt, XclChPropertyMode ePropMode )
974 {
975  drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
976  Color aColor;
977 
978  // fill color
979  if( rAreaFmt.mnPattern != EXC_PATT_NONE )
980  {
981  eFillStyle = drawing::FillStyle_SOLID;
982  aColor = XclTools::GetPatternColor( rAreaFmt.maPattColor, rAreaFmt.maBackColor, rAreaFmt.mnPattern );
983  }
984 
985  // write the properties
986  ScfPropSetHelper& rAreaHlp = GetAreaHelper( ePropMode );
987  rAreaHlp.InitializeWrite();
988  rAreaHlp << eFillStyle << aColor << sal_Int16(0)/*nTransparency*/;
989  rAreaHlp.WriteToPropertySet( rPropSet );
990 }
991 
993  XclChObjectTable& rGradientTable, XclChObjectTable& rBitmapTable,
994  const XclChEscherFormat& rEscherFmt, const XclChPicFormat* pPicFmt,
995  sal_uInt32 nDffFillType, XclChPropertyMode ePropMode )
996 {
997  if( !rEscherFmt.mxItemSet )
998  return;
999 
1000  const XFillStyleItem* pStyleItem = rEscherFmt.mxItemSet->GetItem<XFillStyleItem>( XATTR_FILLSTYLE, false );
1001  if( !pStyleItem )
1002  return;
1003 
1004  switch( pStyleItem->GetValue() )
1005  {
1006  case drawing::FillStyle_SOLID:
1007  // #i84812# Excel 2007 writes Escher properties for solid fill
1008  if( const XFillColorItem* pColorItem = rEscherFmt.mxItemSet->GetItem<XFillColorItem>( XATTR_FILLCOLOR, false ) )
1009  {
1010  // get solid transparence too
1011  const XFillTransparenceItem* pTranspItem = rEscherFmt.mxItemSet->GetItem<XFillTransparenceItem>( XATTR_FILLTRANSPARENCE, false );
1012  sal_uInt16 nTransp = pTranspItem ? pTranspItem->GetValue() : 0;
1013  ScfPropSetHelper& rAreaHlp = GetAreaHelper( ePropMode );
1014  rAreaHlp.InitializeWrite();
1015  rAreaHlp << drawing::FillStyle_SOLID << pColorItem->GetColorValue() << static_cast< sal_Int16 >( nTransp );
1016  rAreaHlp.WriteToPropertySet( rPropSet );
1017  }
1018  break;
1019  case drawing::FillStyle_GRADIENT:
1020  if( const XFillGradientItem* pGradItem = rEscherFmt.mxItemSet->GetItem<XFillGradientItem>( XATTR_FILLGRADIENT, false ) )
1021  {
1022  uno::Any aGradientAny;
1023  if( pGradItem->QueryValue( aGradientAny, MID_FILLGRADIENT ) )
1024  {
1025  OUString aGradName = rGradientTable.InsertObject( aGradientAny );
1026  if( !aGradName.isEmpty() )
1027  {
1028  ScfPropSetHelper& rGradHlp = GetGradientHelper( ePropMode );
1029  rGradHlp.InitializeWrite();
1030  rGradHlp << drawing::FillStyle_GRADIENT << aGradName;
1031  rGradHlp.WriteToPropertySet( rPropSet );
1032  }
1033  }
1034  }
1035  break;
1036  case drawing::FillStyle_BITMAP:
1037  if( const XFillBitmapItem* pBmpItem = rEscherFmt.mxItemSet->GetItem<XFillBitmapItem>( XATTR_FILLBITMAP, false ) )
1038  {
1039  uno::Any aBitmapAny;
1040  if (pBmpItem->QueryValue(aBitmapAny, MID_BITMAP))
1041  {
1042  OUString aBmpName = rBitmapTable.InsertObject( aBitmapAny );
1043  if( !aBmpName.isEmpty() )
1044  {
1045  /* #i71810# Caller decides whether to use a CHPICFORMAT record for bitmap mode.
1046  If not passed, detect fill mode from the DFF property 'fill-type'. */
1047  bool bStretch = pPicFmt ? (pPicFmt->mnBmpMode == EXC_CHPICFORMAT_STRETCH) : (nDffFillType == mso_fillPicture);
1048  drawing::BitmapMode eApiBmpMode = bStretch ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_REPEAT;
1050  maBitmapHlp << drawing::FillStyle_BITMAP << aBmpName << eApiBmpMode;
1051  maBitmapHlp.WriteToPropertySet( rPropSet );
1052  }
1053  }
1054  }
1055  break;
1056  default:
1057  OSL_FAIL( "XclChPropSetHelper::WriteEscherProperties - unknown fill mode" );
1058  }
1059 }
1060 
1062  ScfPropertySet& rPropSet, const XclChMarkerFormat& rMarkerFmt )
1063 {
1064  // symbol style
1065  chart2::Symbol aApiSymbol;
1066  aApiSymbol.Style = chart2::SymbolStyle_STANDARD;
1067  switch( rMarkerFmt.mnMarkerType )
1068  {
1069  case EXC_CHMARKERFORMAT_NOSYMBOL: aApiSymbol.Style = chart2::SymbolStyle_NONE; break;
1070  case EXC_CHMARKERFORMAT_SQUARE: aApiSymbol.StandardSymbol = 0; break; // square
1071  case EXC_CHMARKERFORMAT_DIAMOND: aApiSymbol.StandardSymbol = 1; break; // diamond
1072  case EXC_CHMARKERFORMAT_TRIANGLE: aApiSymbol.StandardSymbol = 3; break; // arrow up
1073  case EXC_CHMARKERFORMAT_CROSS: aApiSymbol.StandardSymbol = 10; break; // X, legacy bow tie
1074  case EXC_CHMARKERFORMAT_STAR: aApiSymbol.StandardSymbol = 12; break; // asterisk, legacy sand glass
1075  case EXC_CHMARKERFORMAT_DOWJ: aApiSymbol.StandardSymbol = 4; break; // arrow right, same as export
1076  case EXC_CHMARKERFORMAT_STDDEV: aApiSymbol.StandardSymbol = 13; break; // horizontal bar, legacy arrow down
1077  case EXC_CHMARKERFORMAT_CIRCLE: aApiSymbol.StandardSymbol = 8; break; // circle, legacy arrow right
1078  case EXC_CHMARKERFORMAT_PLUS: aApiSymbol.StandardSymbol = 11; break; // plus, legacy arrow left
1079  default: break;
1080  }
1081 
1082  // symbol size
1083  sal_Int32 nApiSize = XclTools::GetHmmFromTwips( rMarkerFmt.mnMarkerSize );
1084  aApiSymbol.Size = awt::Size( nApiSize, nApiSize );
1085 
1086  // symbol colors
1087  aApiSymbol.FillColor = sal_Int32( rMarkerFmt.maFillColor );
1088  aApiSymbol.BorderColor = ::get_flag( rMarkerFmt.mnFlags, EXC_CHMARKERFORMAT_NOLINE ) ?
1089  aApiSymbol.FillColor : sal_Int32( rMarkerFmt.maLineColor );
1090 
1091  // set the property
1092  rPropSet.SetProperty( EXC_CHPROP_SYMBOL, aApiSymbol );
1093 }
1094 
1096  ScfPropertySet& rPropSet, sal_uInt16 nRotation, bool bSupportsStacked )
1097 {
1098  if( nRotation != EXC_CHART_AUTOROTATION )
1099  {
1100  // chart2 handles rotation as double in the range [0,360)
1101  double fAngle = XclTools::GetScRotation( nRotation, 0_deg100 ).get() / 100.0;
1102  rPropSet.SetProperty( EXC_CHPROP_TEXTROTATION, fAngle );
1103  if( bSupportsStacked )
1104  rPropSet.SetProperty( EXC_CHPROP_STACKCHARACTERS, nRotation == EXC_ROT_STACKED );
1105  }
1106 }
1107 
1108 // private --------------------------------------------------------------------
1109 
1111 {
1112  switch( ePropMode )
1113  {
1117  default: OSL_FAIL( "XclChPropSetHelper::GetLineHelper - unknown property mode" );
1118  }
1119  return maLineHlpCommon;
1120 }
1121 
1123 {
1124  switch( ePropMode )
1125  {
1128  default: OSL_FAIL( "XclChPropSetHelper::GetAreaHelper - unknown property mode" );
1129  }
1130  return maAreaHlpCommon;
1131 }
1132 
1134 {
1135  switch( ePropMode )
1136  {
1139  default: OSL_FAIL( "XclChPropSetHelper::GetGradientHelper - unknown property mode" );
1140  }
1141  return maGradHlpCommon;
1142 }
1143 
1145 {
1146  switch( ePropMode )
1147  {
1150  default: OSL_FAIL( "XclChPropSetHelper::GetHatchHelper - unknown property mode" );
1151  }
1152  return maHatchHlpCommon;
1153 }
1154 
1155 namespace {
1156 
1157 /* The following local functions implement getting the XShape interface of all
1158  supported title objects (chart and axes). This needs some effort due to the
1159  design of the old Chart1 API used to access these objects. */
1160 
1162 uno::Reference<drawing::XShape> lclGetMainTitleShape(const uno::Reference<chart::XChartDocument> & rxChart1Doc)
1163 {
1164  ScfPropertySet aPropSet(rxChart1Doc);
1165  if (rxChart1Doc.is() && aPropSet.GetBoolProperty("HasMainTitle"))
1166  return rxChart1Doc->getTitle();
1167  return uno::Reference<drawing::XShape>();
1168 }
1169 
1170 uno::Reference<drawing::XShape> lclGetXAxisTitleShape(const uno::Reference<chart::XChartDocument> & rxChart1Doc)
1171 {
1172  uno::Reference<chart::XAxisXSupplier> xAxisSupp(rxChart1Doc->getDiagram(), uno::UNO_QUERY);
1173  ScfPropertySet aPropSet(xAxisSupp);
1174  if (xAxisSupp.is() && aPropSet.GetBoolProperty("HasXAxisTitle"))
1175  return xAxisSupp->getXAxisTitle();
1176  return uno::Reference<drawing::XShape>();
1177 }
1178 
1179 uno::Reference<drawing::XShape> lclGetYAxisTitleShape(const uno::Reference<chart::XChartDocument> & rxChart1Doc )
1180 {
1181  uno::Reference<chart::XAxisYSupplier> xAxisSupp(rxChart1Doc->getDiagram(), uno::UNO_QUERY);
1182  ScfPropertySet aPropSet(xAxisSupp);
1183  if (xAxisSupp.is() && aPropSet.GetBoolProperty("HasYAxisTitle"))
1184  return xAxisSupp->getYAxisTitle();
1185  return uno::Reference<drawing::XShape>();
1186 }
1187 
1188 uno::Reference<drawing::XShape> lclGetZAxisTitleShape(const uno::Reference<chart::XChartDocument> & rxChart1Doc )
1189 {
1190  uno::Reference<chart::XAxisZSupplier> xAxisSupp(rxChart1Doc->getDiagram(), uno::UNO_QUERY);
1191  ScfPropertySet aPropSet(xAxisSupp);
1192  if (xAxisSupp.is() && aPropSet.GetBoolProperty("HasZAxisTitle"))
1193  return xAxisSupp->getZAxisTitle();
1194  return uno::Reference<drawing::XShape>();
1195 }
1196 
1197 uno::Reference<drawing::XShape> lclGetSecXAxisTitleShape(const uno::Reference<chart::XChartDocument> & rxChart1Doc)
1198 {
1199  uno::Reference<chart::XSecondAxisTitleSupplier> xAxisSupp(rxChart1Doc->getDiagram(), uno::UNO_QUERY);
1200  ScfPropertySet aPropSet(xAxisSupp);
1201  if (xAxisSupp.is() && aPropSet.GetBoolProperty("HasSecondaryXAxisTitle"))
1202  return xAxisSupp->getSecondXAxisTitle();
1203  return uno::Reference<drawing::XShape>();
1204 }
1205 
1206 uno::Reference<drawing::XShape> lclGetSecYAxisTitleShape(const uno::Reference<chart::XChartDocument> & rxChart1Doc)
1207 {
1208  uno::Reference<chart::XSecondAxisTitleSupplier> xAxisSupp(rxChart1Doc->getDiagram(), uno::UNO_QUERY);
1209  ScfPropertySet aPropSet(xAxisSupp);
1210  if (xAxisSupp.is() && aPropSet.GetBoolProperty("HasSecondaryYAxisTitle"))
1211  return xAxisSupp->getSecondYAxisTitle();
1212  return uno::Reference<drawing::XShape>();
1213 }
1214 
1215 } // namespace
1216 
1218  : mxTypeInfoProv(std::make_shared<XclChTypeInfoProvider>())
1219  , mxFmtInfoProv(std::make_shared<XclChFormatInfoProvider>())
1220  , mnBorderGapX(0)
1221  , mnBorderGapY(0)
1222  , mfUnitSizeX(0.0)
1223  , mfUnitSizeY(0.0)
1224 {
1225  // remember some title shape getter functions
1226  maGetShapeFuncs[ XclChTextKey( EXC_CHTEXTTYPE_TITLE ) ] = lclGetMainTitleShape;
1232 }
1233 
1235 {
1236 }
1237 
1238 void XclChRootData::InitConversion(const XclRoot& rRoot, const uno::Reference<chart2::XChartDocument> & rxChartDoc, const tools::Rectangle& rChartRect)
1239 {
1240  // remember chart document reference and chart shape position/size
1241  OSL_ENSURE( rxChartDoc.is(), "XclChRootData::InitConversion - missing chart document" );
1242  mxChartDoc = rxChartDoc;
1243  maChartRect = rChartRect;
1244 
1245  // Excel excludes a border of 5 pixels in each direction from chart area
1246  mnBorderGapX = rRoot.GetHmmFromPixelX( 5.0 );
1247  mnBorderGapY = rRoot.GetHmmFromPixelY( 5.0 );
1248 
1249  // size of a chart unit in 1/100 mm
1252 
1253  // create object tables
1254  uno::Reference<lang::XMultiServiceFactory> xFactory(mxChartDoc, uno::UNO_QUERY);
1255  mxLineDashTable = std::make_shared<XclChObjectTable>(xFactory, SERVICE_DRAWING_DASHTABLE, "Excel line dash ");
1256  mxGradientTable = std::make_shared<XclChObjectTable>(xFactory, SERVICE_DRAWING_GRADIENTTABLE, "Excel gradient ");
1257  mxHatchTable = std::make_shared<XclChObjectTable>(xFactory, SERVICE_DRAWING_HATCHTABLE, "Excel hatch ");
1258  mxBitmapTable = std::make_shared<XclChObjectTable>(xFactory, SERVICE_DRAWING_BITMAPTABLE, "Excel bitmap ");
1259 }
1260 
1262 {
1263  // forget formatting object tables
1264  mxBitmapTable.reset();
1265  mxHatchTable.reset();
1266  mxGradientTable.reset();
1267  mxLineDashTable.reset();
1268  // forget chart document reference
1269  mxChartDoc.clear();
1270 }
1271 
1272 uno::Reference<drawing::XShape> XclChRootData::GetTitleShape(const XclChTextKey& rTitleKey) const
1273 {
1274  XclChGetShapeFuncMap::const_iterator aIt = maGetShapeFuncs.find( rTitleKey );
1275  OSL_ENSURE( aIt != maGetShapeFuncs.end(), "XclChRootData::GetTitleShape - invalid title key" );
1276  uno::Reference<chart::XChartDocument> xChart1Doc( mxChartDoc, uno::UNO_QUERY );
1277  uno::Reference<drawing::XShape> xTitleShape;
1278  if (xChart1Doc.is() && (aIt != maGetShapeFuncs.end()))
1279  xTitleShape = (aIt->second)(xChart1Doc);
1280  return xTitleShape;
1281 }
1282 
1283 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define MID_FILLGRADIENT
ScfPropSetHelper maBitmapHlp
Properties for hatches in filled series.
Definition: xlchart.hxx:1395
XclChPropertyMode
Specifies the type of a formatting.
Definition: xlchart.hxx:1080
const sal_uInt16 EXC_CHSERGROUP_NONE
Definition: xlchart.hxx:611
const sal_uInt8 EXC_CHPROPS_EMPTY_SKIP
Manual plot area layout in CHFRAMEPOS record.
Definition: xlchart.hxx:603
Color maPattColor
Definition: xlchart.hxx:800
double mnHeight
XclChLineFormat()
Additional flags.
Definition: xlchart.cxx:95
const sal_uInt16 EXC_CHDATERANGE_AUTOMAJOR
Definition: xlchart.hxx:713
const sal_uInt16 EXC_CHLINEFORMAT_DASHDOT
Definition: xlchart.hxx:252
const sal_uInt16 EXC_CHMARKERFORMAT_CIRCLE
Definition: xlchart.hxx:279
const sal_uInt16 EXC_ID_CHLINE
Definition: xlchart.hxx:356
const sal_uInt16 EXC_CHTEXT_POS_DEFAULT
Data point caption is category name.
Definition: xlchart.hxx:484
const sal_uInt16 EXC_CHPICFORMAT_LEFTRIGHT
Definition: xlchart.hxx:553
const sal_Int32 EXC_CHART_TOTALUNITS
API secondary axes set index.
Definition: xlchart.hxx:162
const sal_uInt8 EXC_CHTICK_OUTSIDE
Definition: xlchart.hxx:403
const sal_uInt8 EXC_CHTEXT_ALIGN_CENTER
Horizontal: left, vertical: top.
Definition: xlchart.hxx:463
const sal_uInt16 EXC_ID_CHBAR
Definition: xlchart.hxx:347
Text boxes (titles, data point labels).
Definition: xlchart.hxx:1117
const sal_uInt8 EXC_CH3DDATAFORMAT_STRAIGHT
Circular base.
Definition: xlchart.hxx:699
No varied colors supported.
Definition: xlchart.hxx:1201
const sal_uInt8 EXC_CHSERERR_END_TSHAPE
Line end: blank.
Definition: xlchart.hxx:682
const sal_uInt16 EXC_CHAXESSET_PRIMARY
Definition: xlchart.hxx:582
void WriteLineProperties(ScfPropertySet &rPropSet, XclChObjectTable &rDashTable, const XclChLineFormat &rLineFmt, XclChPropertyMode ePropMode)
Writes all line properties to the passed property set.
Definition: xlchart.cxx:906
mso_fillPicture
XclChTypeInfoMap maInfoMap
Definition: xlchart.hxx:1260
sal_uInt8 GetRed() const
const sal_Int32 EXC_CHART_AXESSET_SECONDARY
API primary axes set index.
Definition: xlchart.hxx:160
XclChTick()
Tick labels angle (BIFF8+).
Definition: xlchart.cxx:304
const sal_uInt8 EXC_CHSERERR_YPLUS
Definition: xlchart.hxx:672
XclChMarkerFormat()
Additional flags.
Definition: xlchart.cxx:167
Contains information for a chart type.
Definition: xlchart.hxx:1206
sal_uInt16 mnFlags
Marker type (none, diamond, ...).
Definition: xlchart.hxx:892
XclChLabelRange()
Additional flags.
Definition: xlchart.cxx:268
Line chart.
Definition: xlchart.hxx:1173
const sal_uInt16 EXC_CHLEGEND_STACKED
Definition: xlchart.hxx:342
constexpr OUStringLiteral EXC_CHPROP_TEXTROTATION
Definition: xlchart.hxx:128
EscherPropSetRef mxEscherSet
Item set for Escher properties import.
Definition: xlchart.hxx:817
static sal_uInt8 GetXclRotation(Degree100 nScRot)
Calculates the Excel angle value from an angle in 1/100 of degrees.
Definition: xltools.cxx:162
const sal_uInt16 EXC_CHDATERANGE_DAYS
Recognize date/text automatically.
Definition: xlchart.hxx:720
sal_Int16 mnValueType
XclChAreaFormat()
Additional flags.
Definition: xlchart.cxx:103
XclChFrame()
Additional flags.
Definition: xlchart.cxx:126
ScfPropSetHelper & GetGradientHelper(XclChPropertyMode ePropMode)
Returns a gradient property set helper according to the passed property mode.
Definition: xlchart.cxx:1133
const XclChFormatInfo & GetFormatInfo(XclChObjectType eObjType) const
Returns an info struct about auto formatting for the passed object type.
Definition: xlchart.cxx:448
const sal_uInt8 EXC_ROT_STACKED
Text rotation: 90 deg clockwise.
Definition: xlconst.hxx:141
const sal_uInt8 EXC_CHTICK_INSIDE
Definition: xlchart.hxx:402
Series trend line.
Definition: xlchart.hxx:1123
double mfUnitSizeX
Border gap to chart space in 1/100mm.
Definition: xlchart.hxx:1418
Series formatting in a chart supporting line formatting only.
Definition: xlchart.hxx:1119
Bar charts (horizontal or vertical).
Definition: xlchart.hxx:1190
void WriteEscherProperties(ScfPropertySet &rPropSet, XclChObjectTable &rGradientTable, XclChObjectTable &rBitmapTable, const XclChEscherFormat &rEscherFmt, const XclChPicFormat *pPicFmt, sal_uInt32 nDffFillType, XclChPropertyMode ePropMode)
Writes gradient or bitmap area properties to the passed property set.
Definition: xlchart.cxx:992
ScfPropSetHelper maLineHlpCommon
Definition: xlchart.hxx:1386
const sal_uInt8 EXC_CHSRCLINK_TITLE
Definition: xlchart.hxx:654
High/low lines in stock charts.
Definition: xlchart.hxx:1126
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
uno::Reference< presentation::XTransitionFactory > mxFactory
const sal_uInt16 EXC_CHDATAFORMAT_DEFAULT
Maximum number of data points.
Definition: xlchart.hxx:239
XclChRectangle()
Height of the object in 1/4000 of chart height.
Definition: xlchart.cxx:59
XclChRootData()
Size of a chart Y unit (1/4000 of chart height) in 1/100 mm.
Definition: xlchart.cxx:1217
Contains information about auto formatting of a specific chart object type.
Definition: xlchart.hxx:1138
const sal_uInt16 EXC_CHMARKERFORMAT_DIAMOND
Definition: xlchart.hxx:273
XclChLegend()
Additional flags.
Definition: xlchart.cxx:246
Provides access to chart auto formatting for all available object types.
Definition: xlchart.hxx:1152
const sal_uInt16 EXC_CHLEGEND_AUTOSERIES
Definition: xlchart.hxx:339
const sal_uInt16 EXC_ID_CHRADARLINE
Definition: xlchart.hxx:565
Scatter and bubble charts.
Definition: xlchart.hxx:1194
bool GetBoolProperty(const OUString &rPropName) const
Gets the specified Boolean property from the property set.
Definition: fapihelper.cxx:188
static bool HasMarkerFillColor(sal_uInt16 nMarkerType)
Returns true, if the passed marker type is filled.
Definition: xlchart.cxx:395
Data point connector line.
Definition: xlchart.hxx:1125
void set_flag(Type &rnBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in rnBitField.
Definition: ftools.hxx:95
static void WriteRotationProperties(ScfPropertySet &rPropSet, sal_uInt16 nRotation, bool bSupportsStacked)
Writes rotation properties to the passed property set.
Definition: xlchart.cxx:1095
XclChSeries()
Number of bubble entries.
Definition: xlchart.cxx:212
sal_Int32 GetHmmFromPixelX(double fPixelX) const
Calculates the width of the passed number of pixels in 1/100 mm.
Definition: xlroot.cxx:239
basegfx::BColor maColor
XclChSerTrendLine()
1 = Show R-squared.
Definition: xlchart.cxx:188
css::uno::Reference< css::drawing::XShape > GetTitleShape(const XclChTextKey &rTitleKey) const
Returns the drawing shape interface of the specified title object.
Definition: xlchart.cxx:1272
const sal_uInt16 EXC_CHSERIES_NUMERIC
Definition: xlchart.hxx:227
std::shared_ptr< T > make_shared(Args &&...args)
XclChGetShapeFuncMap maGetShapeFuncs
Container for bitmap fill styles.
Definition: xlchart.hxx:1415
Bubble chart.
Definition: xlchart.hxx:1182
#define ESCHER_Prop_fillBackOpacity
Pie chart.
Definition: xlchart.hxx:1178
Missing frame represents automatic formatting.
Definition: xlchart.hxx:1134
css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory
Definition: xlchart.hxx:1301
const sal_uInt16 EXC_CHTICK_AUTOCOLOR
Definition: xlchart.hxx:413
A map key for text and title objects.
Definition: xlchart.hxx:1277
XclFmtInfoMap maInfoMap
Definition: xlchart.hxx:1162
bool equalsAscii(std::u16string_view s1, const char *s2)
const sal_uInt16 EXC_ID_CHPIEEXT
Sharp top, truncated.
Definition: xlchart.hxx:705
Pie-to-pie or pie-to-bar chart.
Definition: xlchart.hxx:1180
const sal_uInt16 EXC_CHVALUERANGE_AUTOMAX
Definition: xlchart.hxx:422
static sal_uInt8 GetSeriesFillAutoTransp(sal_uInt16 nFormatIdx)
Returns a transparency value for automatic series fill colors.
Definition: xlchart.cxx:380
const sal_uInt16 EXC_CHLINEFORMAT_DOT
Definition: xlchart.hxx:251
FuncFlags mnFlags
Information about all parameters.
bool mbSupports3d
true = Types can be combined in one axes set.
Definition: xlchart.hxx:1215
Axis grid line format.
Definition: xlchart.hxx:1122
sal_uInt32 mnMarkerSize
Fill color.
Definition: xlchart.hxx:890
SfxItemSetRef mxItemSet
Definition: xlchart.hxx:816
const sal_Int32 EXC_CHART_AXIS_Z
API Y axis index.
Definition: xlchart.hxx:157
OUString maObjNameBase
Service name to create the container.
Definition: xlchart.hxx:1304
sal_uInt16 mnPattern
Line color.
Definition: xlchart.hxx:791
static Degree100 GetScRotation(sal_uInt16 nXclRot, Degree100 nRotForStacked)
Calculates an angle (in 1/100 of degrees) from an Excel angle value.
Definition: xltools.cxx:154
sal_uInt16 mnType
Definition: xlchart.hxx:1058
Series formatting in a chart supporting area formatting.
Definition: xlchart.hxx:1120
const sal_uInt16 EXC_CHAXIS_NONE
Definition: xlchart.hxx:396
bool mb3dChart
const sal_uInt16 EXC_CHDATERANGE_AUTODATE
Other axis crosses at own maximum.
Definition: xlchart.hxx:718
void WriteAreaProperties(ScfPropertySet &rPropSet, const XclChAreaFormat &rAreaFmt, XclChPropertyMode ePropMode)
Writes solid area properties to the passed property set.
Definition: xlchart.cxx:972
sal_Int16 mnWeight
Line pattern (solid, dashed, ...).
Definition: xlchart.hxx:792
const sal_uInt16 EXC_CHPICFORMAT_FRONTBACK
Definition: xlchart.hxx:552
const sal_uInt16 EXC_CHMARKERFORMAT_PLUS
Definition: xlchart.hxx:280
ScfPropSetHelper maHatchHlpFilled
Properties for hatches in common objects.
Definition: xlchart.hxx:1394
ScfPropSetHelper maLineHlpFilled
Properties for lines in linear series.
Definition: xlchart.hxx:1388
const sal_uInt16 EXC_CHPICFORMAT_STACK
Bitmap stretched to area.
Definition: xlchart.hxx:548
tools::Rectangle maChartRect
The chart document.
Definition: xlchart.hxx:1408
constexpr tools::Long GetWidth() const
constexpr OUStringLiteral EXC_CHPROP_ROLE_ERRORBARS_NEGX
Definition: xlchart.hxx:136
constexpr OUStringLiteral SERVICE_DRAWING_HATCHTABLE
Definition: xlchart.hxx:43
const sal_Int16 EXC_CHLINEFORMAT_SINGLE
Definition: xlchart.hxx:260
const sal_uInt8 EXC_CHSRCLINK_DEFAULT
Definition: xlchart.hxx:659
void InitializeWrite()
Must be called before reading or storing property values in the helper.
Definition: fapihelper.cxx:336
const sal_Int32 EXC_CHART_AXIS_Y
API X axis index.
Definition: xlchart.hxx:156
Specific to data series drawn as lines.
Definition: xlchart.hxx:1084
const sal_uInt16 EXC_CHMARKERFORMAT_NOFILL
Definition: xlchart.hxx:288
#define ESCHER_Prop_fillOpacity
sal_uInt16 mnFlags
Line weight (hairline, single, ...).
Definition: xlchart.hxx:793
bool ReadAreaProperties(XclChAreaFormat &rAreaFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode)
Reads solid area properties from the passed property set.
Definition: xlchart.cxx:727
sal_uInt8 GetBlue() const
constexpr OUStringLiteral SERVICE_DRAWING_GRADIENTTABLE
Definition: xlchart.hxx:42
sal_uInt16 mnSeriesIdx
Definition: xlchart.hxx:755
sal_Int32 GetApiAxesSetIndex() const
Returns the axes set index used by the chart API.
Definition: xlchart.cxx:337
void ReadFromPropertySet(const ScfPropertySet &rPropSet)
Reads all values from the passed property set.
Definition: fapihelper.cxx:307
Chart background.
Definition: xlchart.hxx:1113
static sal_uInt16 GetAutoMarkerType(sal_uInt16 nFormatIdx)
Returns an automatic symbol index for the passed format index.
Definition: xlchart.cxx:386
#define SAL_N_ELEMENTS(arr)
const sal_uInt8 EXC_CHTICK_TRANSPARENT
Next to axis.
Definition: xlchart.hxx:410
void WriteToPropertySet(ScfPropertySet &rPropSet) const
Writes all values to the passed property set.
Definition: fapihelper.cxx:353
XclChDataFormat()
Additional flags.
Definition: xlchart.cxx:182
ScfPropSetHelper & GetHatchHelper(XclChPropertyMode ePropMode)
Returns a hatch property set helper according to the passed property mode.
Definition: xlchart.cxx:1144
const sal_uInt16 EXC_CHFRAME_STANDARD
Definition: xlchart.hxx:517
virtual ~XclChRootData()
Definition: xlchart.cxx:1234
XclChObjectType
Enumerates different object types for specific automatic formatting behaviour.
Definition: xlchart.hxx:1110
ESCHER_FillSolid
const sal_uInt16 EXC_CHDATERANGE_AUTOMIN
Definition: xlchart.hxx:711
static sal_Int32 GetHmmFromTwips(sal_Int32 nTwips)
Returns the length in 1/100 mm calculated from a length in twips.
Definition: xltools.cxx:302
const sal_uInt16 EXC_CHMARKERFORMAT_STDDEV
Definition: xlchart.hxx:278
Radar charts (linear or filled).
Definition: xlchart.hxx:1192
const sal_uInt16 EXC_ID_CHAREA
Definition: xlchart.hxx:357
double mfUnitSizeY
Size of a chart X unit (1/4000 of chart width) in 1/100 mm.
Definition: xlchart.hxx:1419
UNDERLYING_TYPE get() const
const sal_Int16 EXC_CHLINEFORMAT_HAIR
Definition: xlchart.hxx:259
static sal_uInt16 GetTwipsFromHmm(sal_Int32 nHmm)
Returns the length in twips calculated from a length in 1/100 mm.
Definition: xltools.cxx:282
OUString InsertObject(const css::uno::Any &rObj)
Inserts a named formatting object into the chart document.
Definition: xlchart.cxx:575
void ReadLineProperties(XclChLineFormat &rLineFmt, XclChObjectTable &rDashTable, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode)
Reads all line properties from the passed property set.
Definition: xlchart.cxx:654
const sal_uInt8 EXC_CHSERERR_YMINUS
Definition: xlchart.hxx:673
Horizontal bar chart.
Definition: xlchart.hxx:1172
constexpr OUStringLiteral EXC_CHPROP_ROLE_ERRORBARS_POSY
Definition: xlchart.hxx:139
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
const sal_uInt16 EXC_CHLINEFORMAT_NONE
Definition: xlchart.hxx:254
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
bool operator<(const XclChDataPointPos &rL, const XclChDataPointPos &rR)
Definition: xlchart.cxx:73
sal_uInt16 mnFlags
Fill pattern.
Definition: xlchart.hxx:803
Common objects, no special handling.
Definition: xlchart.hxx:1083
const XclChTypeInfo & GetTypeInfoFromRecId(sal_uInt16 nRecId) const
Returns the first fitting chart type info for an Excel chart type record identifier.
Definition: xlchart.cxx:521
const sal_uInt16 EXC_CHAXESSET_SECONDARY
Definition: xlchart.hxx:583
const sal_uInt8 EXC_CHLEGEND_RIGHT
Definition: xlchart.hxx:330
const sal_uInt16 EXC_CHFRAME_AUTOSIZE
Definition: xlchart.hxx:520
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
Floor formatting in 3d charts.
Definition: xlchart.hxx:1116
const sal_uInt16 EXC_CHTEXT_TRANSPARENT
Definition: xlchart.hxx:468
void FinishConversion()
Finishes the API chart document conversion.
Definition: xlchart.cxx:1261
const sal_uInt16 EXC_CHSCATTER_AREA
Definition: xlchart.hxx:374
sal_Int32 mnType
void InitConversion(const XclRoot &rRoot, const css::uno::Reference< css::chart2::XChartDocument > &rxChartDoc, const tools::Rectangle &rChartRect)
Starts the API chart document conversion.
Definition: xlchart.cxx:1238
const sal_uInt16 EXC_COLOR_CHWINDOWTEXT
System button background color (face color).
Definition: xlstyle.hxx:210
const sal_uInt8 EXC_CHSERERR_FIXED
Definition: xlchart.hxx:676
const sal_uInt8 EXC_CHSERERR_XPLUS
For internal use only.
Definition: xlchart.hxx:670
constexpr OUStringLiteral SERVICE_DRAWING_DASHTABLE
Definition: xlchart.hxx:41
const sal_uInt8 EXC_CHSERERR_XMINUS
Definition: xlchart.hxx:671
const sal_Int32 EXC_CHART_AXIS_X
For internal use only.
Definition: xlchart.hxx:155
const sal_uInt16 EXC_CHVALUERANGE_AUTOCROSS
Definition: xlchart.hxx:425
static Color GetPatternColor(const Color &rPattColor, const Color &rBackColor, sal_uInt16 nXclPattern)
Returns the best fitting color for an Excel pattern area format.
Definition: xltools.cxx:350
Donut chart.
Definition: xlchart.hxx:1179
const sal_Int32 EXC_CHART_AXIS_NONE
Automatic rotation, e.g. axis labels (internal use only).
Definition: xlchart.hxx:154
const sal_Int32 EXC_CHART_AXESSET_PRIMARY
For internal use only.
Definition: xlchart.hxx:159
sal_Int32 mnWeight
const sal_uInt16 EXC_CHDATERANGE_AUTOMINOR
Definition: xlchart.hxx:714
sal_Int32 GetHmmFromPixelY(double fPixelY) const
Calculates the height of the passed number of pixels in 1/100 mm.
Definition: xlroot.cxx:244
const sal_uInt16 EXC_CHMARKERFORMAT_CROSS
Definition: xlchart.hxx:275
sal_uInt16 mnAxesSetId
Position of the axes set (inner plot area).
Definition: xlchart.hxx:1069
ScfPropSetHelper maGradHlpCommon
Properties for areas in filled series.
Definition: xlchart.hxx:1391
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:75
XclChDateRange()
Additional flags.
Definition: xlchart.cxx:276
const sal_uInt16 EXC_CHPICFORMAT_NONE
Definition: xlchart.hxx:546
const sal_uInt16 EXC_CHDATERANGE_AUTOMAX
Definition: xlchart.hxx:712
XclChFramePos()
Bottom-right position mode.
Definition: xlchart.cxx:89
const sal_uInt16 EXC_CHLINEFORMAT_DASHDOTDOT
Definition: xlchart.hxx:253
ColorTransparency
XclChFrBlock(sal_uInt16 nType)
Optional secondary value for current context.
Definition: xlchart.cxx:79
const sal_uInt16 EXC_CHLINEFORMAT_MEDTRANS
Definition: xlchart.hxx:256
const sal_uInt16 EXC_CHMARKERFORMAT_STAR
Definition: xlchart.hxx:276
const sal_uInt16 EXC_CHCHART3D_AUTOHEIGHT
false = Z axis, true = clustered/stacked.
Definition: xlchart.hxx:538
const sal_uInt16 EXC_CHMARKERFORMAT_NOSYMBOL
Definition: xlchart.hxx:271
Linear radar chart.
Definition: xlchart.hxx:1176
XclChType()
Additional flags (all chart types).
Definition: xlchart.cxx:224
XclChChart3d()
Additional flags.
Definition: xlchart.cxx:235
static css::uno::Reference< css::uno::XInterface > CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > &xFactory, const OUString &rServiceName)
Creates an instance from the passed service name, using the passed service factory.
constexpr OUStringLiteral EXC_CHPROP_ROLE_ERRORBARS_NEGY
Definition: xlchart.hxx:137
const sal_uInt16 EXC_CHLEGEND_DOCKED
Definition: xlchart.hxx:338
const sal_uInt8 EXC_CHTICK_NEXT
Above diagram/left of diagram.
Definition: xlchart.hxx:408
const sal_uInt16 EXC_CHLINEFORMAT_AUTO
Definition: xlchart.hxx:264
const sal_uInt16 EXC_CHLINEFORMAT_SOLID
Definition: xlchart.hxx:249
XclChTypeId
Enumerates all kinds of different chart types.
Definition: xlchart.hxx:1168
Line charts (line, area, stock charts).
Definition: xlchart.hxx:1191
const sal_uInt16 EXC_CHMARKERFORMAT_TRIANGLE
Definition: xlchart.hxx:274
Filled radar chart.
Definition: xlchart.hxx:1177
const sal_Int16 EXC_CHLINEFORMAT_TRIPLE
Definition: xlchart.hxx:262
#define ESCHER_Prop_fillBackColor
const sal_uInt16 EXC_CHOBJLINK_NONE
Definition: xlchart.hxx:505
ScfPropSetHelper maAreaHlpCommon
Properties for lines in filled series.
Definition: xlchart.hxx:1389
Scatter (XY) chart.
Definition: xlchart.hxx:1181
uno::Sequence< double > maFillColor
sal_Int32 mnIndex
Base of names for inserted objects.
Definition: xlchart.hxx:1305
XclChObjectTableRef mxGradientTable
Container for line dash styles.
Definition: xlchart.hxx:1412
sal_Int32 mnTop
const sal_uInt16 EXC_CHAXIS_Z
Definition: xlchart.hxx:395
sal_uInt8 GetGreen() const
#define ESCHER_Prop_fillColor
XclChAxis()
Axis type.
Definition: xlchart.cxx:315
ScfPropSetHelper maGradHlpFilled
Properties for gradients in common objects.
Definition: xlchart.hxx:1392
XclChObjectTableRef mxBitmapTable
Container for hatch fill styles.
Definition: xlchart.hxx:1414
const sal_uInt16 EXC_CHTEXT_AUTOFILL
Text object is removed.
Definition: xlchart.hxx:478
A wrapper for a UNO property set.
Definition: fapihelper.hxx:103
const sal_Int32 EXC_CHART_AXESSET_NONE
API Z axis index.
Definition: xlchart.hxx:158
const sal_uInt16 EXC_CHMARKERFORMAT_AUTO
Automatic symbol size for triple lines.
Definition: xlchart.hxx:287
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
XclChObjectTableRef mxLineDashTable
Provides info about auto formatting.
Definition: xlchart.hxx:1411
const sal_uInt16 EXC_CHDATERANGE_AUTOBASE
Definition: xlchart.hxx:716
const sal_uInt16 EXC_COLOR_CHBORDERAUTO
System window background color (BIFF8 charts).
Definition: xlstyle.hxx:212
static OUString GetErrorBarValuesRole(sal_uInt8 nBarType)
Returns the role name for a manual data source for error bars.
Definition: xlchart.cxx:402
ScfPropSetHelper maAreaHlpFilled
Properties for areas in common objects.
Definition: xlchart.hxx:1390
Area chart.
Definition: xlchart.hxx:1174
const sal_uInt16 EXC_CHVALUERANGE_AUTOMIN
Definition: xlchart.hxx:421
constexpr OUStringLiteral SERVICE_DRAWING_BITMAPTABLE
Definition: xlchart.hxx:40
const sal_uInt8 EXC_PATT_SOLID
Definition: xlstyle.hxx:55
sal_uInt16 mnPointIdx
Series index of series or a data point.
Definition: xlchart.hxx:756
XclChSerErrorBar()
Type of the line ends.
Definition: xlchart.cxx:203
void Set(const XclChTypeInfo &rTypeInfo, bool b3dChart, bool bSpline)
Definition: xlchart.cxx:501
XclChFrLabelProps()
Flags indicating which values to be displayed.
Definition: xlchart.cxx:149
ScfPropSetHelper & GetAreaHelper(XclChPropertyMode ePropMode)
Returns an area property set helper according to the passed property mode.
Definition: xlchart.cxx:1122
const sal_uInt32 EXC_CHMARKERFORMAT_SINGLESIZE
Automatic symbol size for hair lines.
Definition: xlchart.hxx:283
XclChDataPointPos(sal_uInt16 nSeriesIdx=EXC_CHSERIES_INVALID, sal_uInt16 nPointIdx=EXC_CHDATAFORMAT_ALLPOINTS)
Index of a data point inside a series.
Definition: xlchart.cxx:67
unsigned char sal_uInt8
ScfPropSetHelper maHatchHlpCommon
Properties for gradients in filled series.
Definition: xlchart.hxx:1393
OUString maServiceName
Container for the objects.
Definition: xlchart.hxx:1303
const sal_uInt16 EXC_CHVALUERANGE_BIT8
Other axis crosses at own maximum.
Definition: xlchart.hxx:429
const OUString maServiceName
Specifies the position of a data series or data point.
Definition: xlchart.hxx:753
#define ESCHER_Prop_fNoFillHitTest
const sal_uInt16 EXC_CHART_AUTOROTATION
Definition: xlchart.hxx:152
XclChValueRange()
Additional flags.
Definition: xlchart.cxx:292
sal_Int32 mnBorderGapY
Border gap to chart space in 1/100mm.
Definition: xlchart.hxx:1417
const sal_uInt16 EXC_CHFRAMEPOS_PARENT
Definition: xlchart.hxx:642
XclChProperties()
Plotting mode for empty cells.
Definition: xlchart.cxx:260
const sal_uInt16 EXC_CHLEGEND_AUTOPOSX
Definition: xlchart.hxx:340
const sal_uInt16 EXC_COLOR_CHWINDOWBACK
System window text color (BIFF8 charts).
Definition: xlstyle.hxx:211
eFillStyle
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
static sal_uInt16 GetSeriesLineAutoColorIdx(sal_uInt16 nFormatIdx)
Returns a palette index for automatic series line colors.
Definition: xlchart.cxx:350
static sal_uInt16 GetSeriesFillAutoColorIdx(sal_uInt16 nFormatIdx)
Returns a palette index for automatic series fill colors.
Definition: xlchart.cxx:365
constexpr OUStringLiteral EXC_CHPROP_ROLE_ERRORBARS_POSX
Definition: xlchart.hxx:138
const sal_uInt16 EXC_CHPICFORMAT_STRETCH
For internal use only.
Definition: xlchart.hxx:547
sal_Int32 mnBorderGapX
Maps title shape getter functions.
Definition: xlchart.hxx:1416
const sal_uInt8 EXC_CHSERTREND_POLYNOMIAL
Definition: xlchart.hxx:626
XclChPicFormat()
Picture scaling (units).
Definition: xlchart.cxx:119
static sal_uInt16 ReadRotationProperties(const ScfPropertySet &rPropSet, bool bSupportsStacked)
Reads rotation properties from the passed property set.
Definition: xlchart.cxx:894
const sal_uInt16 EXC_CHVALUERANGE_AUTOMAJOR
Definition: xlchart.hxx:423
#define ESCHER_Prop_fillType
double mnWidth
Surface chart.
Definition: xlchart.hxx:1183
ScfPropSetHelper & GetLineHelper(XclChPropertyMode ePropMode)
Returns a line property set helper according to the passed property mode.
Definition: xlchart.cxx:1110
XclChAxesSet()
Primary/secondary axes set.
Definition: xlchart.cxx:332
XclChExtTypeInfo(const XclChTypeInfo &rTypeInfo)
Series lines are smoothed.
Definition: xlchart.cxx:494
void insert_value(Type &rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount)
Inserts a value into a bitfield.
Definition: ftools.hxx:102
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
constexpr OUStringLiteral EXC_CHPROP_SYMBOL
Definition: xlchart.hxx:125
static void WriteMarkerProperties(ScfPropertySet &rPropSet, const XclChMarkerFormat &rMarkerFmt)
Writes all marker properties to the passed property set.
Definition: xlchart.cxx:1061
sal_uInt16 mnMarkerType
Size of a marker.
Definition: xlchart.hxx:891
Color maFillColor
Border line color.
Definition: xlchart.hxx:889
css::uno::Reference< css::chart2::XChartDocument > mxChartDoc
Definition: xlchart.hxx:1407
Axis line format.
Definition: xlchart.hxx:1121
XclChObjectTableRef mxHatchTable
Container for gradient fill styles.
Definition: xlchart.hxx:1413
const sal_uInt8 EXC_ROT_NONE
Text orientation: 90 deg clockwise.
Definition: xlconst.hxx:138
Wall formatting in 3d charts.
Definition: xlchart.hxx:1115
XclChTypeGroup()
Chart type group index.
Definition: xlchart.cxx:254
Only supported, if type group contains only one series.
Definition: xlchart.hxx:1202
double mfScale
const sal_uInt16 EXC_CHLINEFORMAT_LIGHTTRANS
Definition: xlchart.hxx:257
void SetProperty(const OUString &rPropName, const Type &rValue)
Puts the passed value into the property set.
Definition: fapihelper.hxx:174
const sal_uInt8 EXC_PATT_NONE
Definition: xlstyle.hxx:54
Color maBackColor
Pattern color.
Definition: xlchart.hxx:801
const sal_uInt16 EXC_ID_CHSCATTER
Definition: xlchart.hxx:372
static void ReadMarkerProperties(XclChMarkerFormat &rMarkerFmt, const ScfPropertySet &rPropSet, sal_uInt16 nFormatIdx)
Reads all marker properties from the passed property set.
Definition: xlchart.cxx:842
Reference< XSingleServiceFactory > xFactory
const sal_uInt16 EXC_CHFRAME_AUTOPOS
Definition: xlchart.hxx:521
const sal_uInt16 EXC_CHLINEFORMAT_DASH
Definition: xlchart.hxx:250
ScfPropSetHelper maLineHlpLinear
Properties for lines in common objects.
Definition: xlchart.hxx:1387
sal_uInt16 mnPattern
Pattern background color.
Definition: xlchart.hxx:802
const sal_uInt16 EXC_CHPICFORMAT_TOPBOTTOM
Bitmap scaled to axis scale.
Definition: xlchart.hxx:551
XclChObjectTable(css::uno::Reference< css::lang::XMultiServiceFactory > const &xFactory, const OUString &rServiceName, const OUString &rObjNameBase)
Definition: xlchart.cxx:543
sal_uInt16 mnBmpMode
Definition: xlchart.hxx:825
constexpr OUStringLiteral EXC_CHPROP_STACKCHARACTERS
Definition: xlchart.hxx:121
const sal_uInt16 EXC_ID_CHSURFACE
Definition: xlchart.hxx:573
const sal_uInt16 EXC_ID_CHPIE
Definition: xlchart.hxx:365
const sal_uInt16 EXC_CHVALUERANGE_AUTOMINOR
Definition: xlchart.hxx:424
const sal_uInt16 EXC_CHMARKERFORMAT_DOWJ
Definition: xlchart.hxx:277
const XclChTypeInfo & GetTypeInfoFromService(std::u16string_view rServiceName) const
Returns the first fitting chart type info for the passed service name.
Definition: xlchart.cxx:532
int mnIndex
const sal_uInt16 EXC_CHDATERANGE_AUTOCROSS
Definition: xlchart.hxx:717
Generic helper class for reading from and writing to property sets.
Definition: fapihelper.hxx:213
XclChEscherFormat()
Container for Escher properties export.
Definition: xlchart.cxx:111
const XclChTypeInfo & GetTypeInfo(XclChTypeId eType) const
Returns chart type info for a unique chart type identifier.
Definition: xlchart.cxx:514
const sal_uInt8 EXC_CHLEGEND_MEDIUM
Definition: xlchart.hxx:335
const sal_uInt16 EXC_CHMARKERFORMAT_SQUARE
Definition: xlchart.hxx:272
css::uno::Reference< css::container::XNameContainer > mxContainer
Factory to create the container.
Definition: xlchart.hxx:1302
const sal_uInt16 EXC_CHMARKERFORMAT_NOLINE
Definition: xlchart.hxx:289
Access to global data for a filter object (imported or exported document) from other classes...
Definition: xlroot.hxx:127
White-day drop bar in stock charts.
Definition: xlchart.hxx:1127
Vertical bar chart.
Definition: xlchart.hxx:1171
sal_Int32 GetApiAxisDimension() const
Returns the axis dimension index used by the chart API.
Definition: xlchart.cxx:320
bool GetProperty(Type &rValue, const OUString &rPropName) const
Gets the specified property from the property set.
Definition: fapihelper.hxx:148
void ReadEscherProperties(XclChEscherFormat &rEscherFmt, XclChPicFormat &rPicFmt, XclChObjectTable &rGradientTable, XclChObjectTable &rHatchTable, XclChObjectTable &rBitmapTable, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode)
Reads gradient or bitmap area properties from the passed property set.
Definition: xlchart.cxx:748
const sal_Int16 EXC_CHLINEFORMAT_DOUBLE
Definition: xlchart.hxx:261
Wall formatting in 2d charts.
Definition: xlchart.hxx:1114
const sal_uInt16 EXC_CHTEXT_AUTOCOLOR
Definition: xlchart.hxx:471
const sal_uInt8 EXC_CHSERERR_NONE
Definition: xlchart.hxx:669
const sal_uInt16 EXC_CHAREAFORMAT_AUTO
Definition: xlchart.hxx:295
double mfIntercept
Definition: xlchart.hxx:916
const sal_uInt16 EXC_CHLINEFORMAT_DARKTRANS
Definition: xlchart.hxx:255
#define MID_BITMAP
const sal_uInt8 EXC_CH3DDATAFORMAT_RECT
Definition: xlchart.hxx:696
Series error bar.
Definition: xlchart.hxx:1124
Pie and donut charts.
Definition: xlchart.hxx:1193
const sal_uInt16 EXC_CHLEGEND_AUTOPOSY
Definition: xlchart.hxx:341
const sal_uInt16 EXC_CHAXIS_Y
Definition: xlchart.hxx:394
const sal_uInt16 EXC_CHAXIS_X
Definition: xlchart.hxx:393
css::uno::Any GetObject(const OUString &rObjName)
Returns a named formatting object from the chart document.
Definition: xlchart.cxx:552
bool m_bDetectedRangeSegmentation false
constexpr tools::Long GetHeight() const
XclChText()
Text object rotation (BIFF8+).
Definition: xlchart.cxx:154
bool mbSpline
Chart is actually a 3D chart.
Definition: xlchart.hxx:1231
const sal_uInt16 EXC_CHTICK_AUTOROT
Definition: xlchart.hxx:415
XclCh3dDataFormat()
Top edge mode.
Definition: xlchart.cxx:176
const sal_uInt16 EXC_ID_CHRADARAREA
Definition: xlchart.hxx:566
Provides access to chart type info structs for all available chart types.
Definition: xlchart.hxx:1246