LibreOffice Module sc (master)  1
xechart.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 <xechart.hxx>
21 
22 #include <com/sun/star/i18n/XBreakIterator.hpp>
23 #include <com/sun/star/i18n/ScriptType.hpp>
24 #include <com/sun/star/drawing/FillStyle.hpp>
25 #include <com/sun/star/drawing/XShapes.hpp>
26 #include <com/sun/star/chart/XChartDocument.hpp>
27 #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
28 #include <com/sun/star/chart/ChartAxisPosition.hpp>
29 #include <com/sun/star/chart/ChartLegendExpansion.hpp>
30 #include <com/sun/star/chart/DataLabelPlacement.hpp>
31 #include <com/sun/star/chart/ErrorBarStyle.hpp>
32 #include <com/sun/star/chart/MissingValueTreatment.hpp>
33 #include <com/sun/star/chart/TimeInterval.hpp>
34 #include <com/sun/star/chart/TimeUnit.hpp>
35 #include <com/sun/star/chart/XAxisSupplier.hpp>
36 #include <com/sun/star/chart/XDiagramPositioning.hpp>
37 #include <com/sun/star/chart2/XChartDocument.hpp>
38 #include <com/sun/star/chart2/XDiagram.hpp>
39 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
40 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
41 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
42 #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
43 #include <com/sun/star/chart2/XTitled.hpp>
44 #include <com/sun/star/chart2/XColorScheme.hpp>
45 #include <com/sun/star/chart2/data/XDataSource.hpp>
46 #include <com/sun/star/chart2/AxisType.hpp>
47 #include <com/sun/star/chart2/CurveStyle.hpp>
48 #include <com/sun/star/chart2/DataPointGeometry3D.hpp>
49 #include <com/sun/star/chart2/DataPointLabel.hpp>
50 #include <com/sun/star/chart2/LegendPosition.hpp>
51 #include <com/sun/star/chart2/RelativePosition.hpp>
52 #include <com/sun/star/chart2/RelativeSize.hpp>
53 #include <com/sun/star/chart2/StackingDirection.hpp>
54 #include <com/sun/star/chart2/TickmarkStyle.hpp>
55 
56 #include <tools/gen.hxx>
58 
59 #include <document.hxx>
60 #include <compiler.hxx>
61 #include <tokenarray.hxx>
62 #include <xeescher.hxx>
63 #include <xeformula.hxx>
64 #include <xehelper.hxx>
65 #include <xepage.hxx>
66 #include <xestyle.hxx>
67 #include <xltools.hxx>
68 
69 #include <memory>
70 
71 using ::com::sun::star::uno::Any;
72 using ::com::sun::star::uno::Reference;
73 using ::com::sun::star::uno::Sequence;
74 using ::com::sun::star::uno::UNO_QUERY;
75 using ::com::sun::star::uno::UNO_QUERY_THROW;
76 using ::com::sun::star::uno::UNO_SET_THROW;
77 using ::com::sun::star::uno::Exception;
78 using ::com::sun::star::beans::XPropertySet;
79 using ::com::sun::star::i18n::XBreakIterator;
80 using ::com::sun::star::frame::XModel;
81 using ::com::sun::star::drawing::XShape;
82 using ::com::sun::star::drawing::XShapes;
83 
84 using ::com::sun::star::chart2::IncrementData;
85 using ::com::sun::star::chart2::RelativePosition;
86 using ::com::sun::star::chart2::RelativeSize;
87 using ::com::sun::star::chart2::ScaleData;
88 using ::com::sun::star::chart2::SubIncrement;
89 using ::com::sun::star::chart2::XAxis;
90 using ::com::sun::star::chart2::XChartDocument;
91 using ::com::sun::star::chart2::XChartTypeContainer;
92 using ::com::sun::star::chart2::XColorScheme;
93 using ::com::sun::star::chart2::XCoordinateSystem;
94 using ::com::sun::star::chart2::XCoordinateSystemContainer;
95 using ::com::sun::star::chart2::XChartType;
96 using ::com::sun::star::chart2::XDataSeries;
97 using ::com::sun::star::chart2::XDataSeriesContainer;
98 using ::com::sun::star::chart2::XDiagram;
99 using ::com::sun::star::chart2::XFormattedString;
100 using ::com::sun::star::chart2::XLegend;
101 using ::com::sun::star::chart2::XRegressionCurve;
102 using ::com::sun::star::chart2::XRegressionCurveContainer;
103 using ::com::sun::star::chart2::XTitle;
104 using ::com::sun::star::chart2::XTitled;
105 
106 using ::com::sun::star::chart2::data::XDataSequence;
107 using ::com::sun::star::chart2::data::XDataSource;
108 using ::com::sun::star::chart2::data::XLabeledDataSequence;
109 
110 using ::formula::FormulaToken;
111 using ::formula::FormulaTokenArrayPlainIterator;
112 
113 namespace cssc = ::com::sun::star::chart;
114 namespace cssc2 = ::com::sun::star::chart2;
115 
116 // Helpers ====================================================================
117 
118 namespace {
119 
120 XclExpStream& operator<<( XclExpStream& rStrm, const XclChRectangle& rRect )
121 {
122  return rStrm << rRect.mnX << rRect.mnY << rRect.mnWidth << rRect.mnHeight;
123 }
124 
125 void lclSaveRecord( XclExpStream& rStrm, XclExpRecordRef const & xRec )
126 {
127  if( xRec )
128  xRec->Save( rStrm );
129 }
130 
132 template< typename Type >
133 void lclSaveRecord( XclExpStream& rStrm, XclExpRecordRef const & xRec, sal_uInt16 nRecId, Type nValue )
134 {
135  if( xRec )
136  {
137  XclExpValueRecord< Type >( nRecId, nValue ).Save( rStrm );
138  xRec->Save( rStrm );
139  }
140 }
141 
142 template<typename ValueType, typename KeyType>
143 void lclSaveRecord(XclExpStream& rStrm, ValueType* pRec, sal_uInt16 nRecId, KeyType nValue)
144 {
145  if (pRec)
146  {
147  XclExpValueRecord<KeyType>(nRecId, nValue).Save(rStrm);
148  pRec->Save(rStrm);
149  }
150 }
151 
152 void lclWriteChFrBlockRecord( XclExpStream& rStrm, const XclChFrBlock& rFrBlock, bool bBegin )
153 {
154  sal_uInt16 nRecId = bBegin ? EXC_ID_CHFRBLOCKBEGIN : EXC_ID_CHFRBLOCKEND;
155  rStrm.StartRecord( nRecId, 12 );
156  rStrm << nRecId << EXC_FUTUREREC_EMPTYFLAGS << rFrBlock.mnType << rFrBlock.mnContext << rFrBlock.mnValue1 << rFrBlock.mnValue2;
157  rStrm.EndRecord();
158 }
159 
160 template< typename Type >
161 bool lclIsAutoAnyOrGetValue( Type& rValue, const Any& rAny )
162 {
163  return !rAny.hasValue() || !(rAny >>= rValue);
164 }
165 
166 bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, bool bLogScale )
167 {
168  bool bIsAuto = lclIsAutoAnyOrGetValue( rfValue, rAny );
169  if( !bIsAuto && bLogScale )
170  rfValue = log( rfValue ) / log( 10.0 );
171  return bIsAuto;
172 }
173 
174 sal_uInt16 lclGetTimeValue( const XclExpRoot& rRoot, double fSerialDate, sal_uInt16 nTimeUnit )
175 {
176  DateTime aDateTime = rRoot.GetDateTimeFromDouble( fSerialDate );
177  switch( nTimeUnit )
178  {
180  return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 );
182  return ::limit_cast< sal_uInt16, sal_uInt16 >( 12 * (aDateTime.GetYear() - rRoot.GetBaseYear()) + aDateTime.GetMonth() - 1, 0, SAL_MAX_INT16 );
184  return ::limit_cast< sal_uInt16, sal_uInt16 >( aDateTime.GetYear() - rRoot.GetBaseYear(), 0, SAL_MAX_INT16 );
185  default:
186  OSL_ENSURE( false, "lclGetTimeValue - unexpected time unit" );
187  }
188  return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 );
189 }
190 
191 bool lclConvertTimeValue( const XclExpRoot& rRoot, sal_uInt16& rnValue, const Any& rAny, sal_uInt16 nTimeUnit )
192 {
193  double fSerialDate = 0;
194  bool bAuto = lclIsAutoAnyOrGetValue( fSerialDate, rAny );
195  if( !bAuto )
196  rnValue = lclGetTimeValue( rRoot, fSerialDate, nTimeUnit );
197  return bAuto;
198 }
199 
200 sal_uInt16 lclGetTimeUnit( sal_Int32 nApiTimeUnit )
201 {
202  switch( nApiTimeUnit )
203  {
204  case cssc::TimeUnit::DAY: return EXC_CHDATERANGE_DAYS;
205  case cssc::TimeUnit::MONTH: return EXC_CHDATERANGE_MONTHS;
206  case cssc::TimeUnit::YEAR: return EXC_CHDATERANGE_YEARS;
207  default: OSL_ENSURE( false, "lclGetTimeUnit - unexpected time unit" );
208  }
209  return EXC_CHDATERANGE_DAYS;
210 }
211 
212 bool lclConvertTimeInterval( sal_uInt16& rnValue, sal_uInt16& rnTimeUnit, const Any& rAny )
213 {
214  cssc::TimeInterval aInterval;
215  bool bAuto = lclIsAutoAnyOrGetValue( aInterval, rAny );
216  if( !bAuto )
217  {
218  rnValue = ::limit_cast< sal_uInt16, sal_Int32 >( aInterval.Number, 1, SAL_MAX_UINT16 );
219  rnTimeUnit = lclGetTimeUnit( aInterval.TimeUnit );
220  }
221  return bAuto;
222 }
223 
224 } // namespace
225 
226 // Common =====================================================================
227 
230 {
231  typedef ::std::vector< XclChFrBlock > XclChFrBlockVector;
232 
234  XclChFrBlockVector maWrittenFrBlocks;
235  XclChFrBlockVector maUnwrittenFrBlocks;
236 
237  explicit XclExpChRootData( XclExpChChart& rChartData ) : mrChartData( rChartData ) {}
238 
240  void RegisterFutureRecBlock( const XclChFrBlock& rFrBlock );
242  void InitializeFutureRecBlock( XclExpStream& rStrm );
244  void FinalizeFutureRecBlock( XclExpStream& rStrm );
245 };
246 
248 {
249  maUnwrittenFrBlocks.push_back( rFrBlock );
250 }
251 
253 {
254  // first call from a future record writes all missing CHFRBLOCKBEGIN records
255  if( maUnwrittenFrBlocks.empty() )
256  return;
257 
258  // write the leading CHFRINFO record
259  if( maWrittenFrBlocks.empty() )
260  {
261  rStrm.StartRecord( EXC_ID_CHFRINFO, 20 );
263  rStrm << sal_uInt16( 0x0850 ) << sal_uInt16( 0x085A ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x086A ) << sal_uInt16( 0x086B );
264  rStrm.EndRecord();
265  }
266  // write all unwritten CHFRBLOCKBEGIN records
267  for( const auto& rUnwrittenFrBlock : maUnwrittenFrBlocks )
268  {
269  OSL_ENSURE( rUnwrittenFrBlock.mnType != EXC_CHFRBLOCK_TYPE_UNKNOWN, "XclExpChRootData::InitializeFutureRecBlock - unknown future record block type" );
270  lclWriteChFrBlockRecord( rStrm, rUnwrittenFrBlock, true );
271  }
272  // move all record infos to vector of written blocks
273  maWrittenFrBlocks.insert( maWrittenFrBlocks.end(), maUnwrittenFrBlocks.begin(), maUnwrittenFrBlocks.end() );
274  maUnwrittenFrBlocks.clear();
275 }
276 
278 {
279  OSL_ENSURE( !maUnwrittenFrBlocks.empty() || !maWrittenFrBlocks.empty(), "XclExpChRootData::FinalizeFutureRecBlock - no future record level found" );
280  if( !maUnwrittenFrBlocks.empty() )
281  {
282  // no future record has been written, just forget the topmost level
283  maUnwrittenFrBlocks.pop_back();
284  }
285  else if( !maWrittenFrBlocks.empty() )
286  {
287  // write the CHFRBLOCKEND record for the topmost block and delete it
288  lclWriteChFrBlockRecord( rStrm, maWrittenFrBlocks.back(), false );
289  maWrittenFrBlocks.pop_back();
290  }
291 }
292 
294  XclExpRoot( rRoot ),
295  mxChData( std::make_shared<XclExpChRootData>( rChartData ) )
296 {
297 }
298 
300 {
301 }
302 
303 Reference< XChartDocument > const & XclExpChRoot::GetChartDocument() const
304 {
305  return mxChData->mxChartDoc;
306 }
307 
309 {
310  return mxChData->mrChartData;
311 }
312 
314 {
315  return mxChData->mxTypeInfoProv->GetTypeInfo( eType );
316 }
317 
318 const XclChTypeInfo& XclExpChRoot::GetChartTypeInfo( std::u16string_view rServiceName ) const
319 {
320  return mxChData->mxTypeInfoProv->GetTypeInfoFromService( rServiceName );
321 }
322 
324 {
325  return mxChData->mxFmtInfoProv->GetFormatInfo( eObjType );
326 }
327 
328 void XclExpChRoot::InitConversion( css::uno::Reference< css::chart2::XChartDocument > const & xChartDoc, const tools::Rectangle& rChartRect ) const
329 {
330  mxChData->InitConversion( GetRoot(), xChartDoc, rChartRect );
331 }
332 
334 {
335  mxChData->FinishConversion();
336 }
337 
338 bool XclExpChRoot::IsSystemColor( const Color& rColor, sal_uInt16 nSysColorIdx ) const
339 {
340  XclExpPalette& rPal = GetPalette();
341  return rPal.IsSystemColor( nSysColorIdx ) && (rColor == rPal.GetDefColor( nSysColorIdx ));
342 }
343 
344 void XclExpChRoot::SetSystemColor( Color& rColor, sal_uInt32& rnColorId, sal_uInt16 nSysColorIdx ) const
345 {
346  OSL_ENSURE( GetPalette().IsSystemColor( nSysColorIdx ), "XclExpChRoot::SetSystemColor - invalid color index" );
347  rColor = GetPalette().GetDefColor( nSysColorIdx );
348  rnColorId = XclExpPalette::GetColorIdFromIndex( nSysColorIdx );
349 }
350 
351 sal_Int32 XclExpChRoot::CalcChartXFromHmm( sal_Int32 nPosX ) const
352 {
353  return ::limit_cast< sal_Int32, double >( (nPosX - mxChData->mnBorderGapX) / mxChData->mfUnitSizeX, 0, EXC_CHART_TOTALUNITS );
354 }
355 
356 sal_Int32 XclExpChRoot::CalcChartYFromHmm( sal_Int32 nPosY ) const
357 {
358  return ::limit_cast< sal_Int32, double >( (nPosY - mxChData->mnBorderGapY) / mxChData->mfUnitSizeY, 0, EXC_CHART_TOTALUNITS );
359 }
360 
361 XclChRectangle XclExpChRoot::CalcChartRectFromHmm( const css::awt::Rectangle& rRect ) const
362 {
363  XclChRectangle aRect;
364  aRect.mnX = CalcChartXFromHmm( rRect.X );
365  aRect.mnY = CalcChartYFromHmm( rRect.Y );
366  aRect.mnWidth = CalcChartXFromHmm( rRect.Width );
367  aRect.mnHeight = CalcChartYFromHmm( rRect.Height );
368  return aRect;
369 }
370 
372  const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode ) const
373 {
375  rLineFmt, *mxChData->mxLineDashTable, rPropSet, ePropMode );
376 }
377 
379  const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode ) const
380 {
381  return GetChartPropSetHelper().ReadAreaProperties( rAreaFmt, rPropSet, ePropMode );
382 }
383 
385  XclChEscherFormat& rEscherFmt, XclChPicFormat& rPicFmt,
386  const ScfPropertySet& rPropSet, XclChPropertyMode ePropMode ) const
387 {
388  GetChartPropSetHelper().ReadEscherProperties( rEscherFmt, rPicFmt,
389  *mxChData->mxGradientTable, *mxChData->mxHatchTable, *mxChData->mxBitmapTable, rPropSet, ePropMode );
390 }
391 
392 sal_uInt16 XclExpChRoot::ConvertFont( const ScfPropertySet& rPropSet, sal_Int16 nScript ) const
393 {
394  XclFontData aFontData;
395  GetFontPropSetHelper().ReadFontProperties( aFontData, rPropSet, EXC_FONTPROPSET_CHART, nScript );
396  return GetFontBuffer().Insert( aFontData, EXC_COLOR_CHARTTEXT );
397 }
398 
400 {
401  sal_Int32 nApiRot = 0;
402  rPropSet.GetProperty( nApiRot, EXC_CHPROP_STARTINGANGLE );
403  return static_cast< sal_uInt16 >( (450 - (nApiRot % 360)) % 360 );
404 }
405 
407 {
408  mxChData->RegisterFutureRecBlock( rFrBlock );
409 }
410 
412 {
413  mxChData->InitializeFutureRecBlock( rStrm );
414 }
415 
417 {
418  mxChData->FinalizeFutureRecBlock( rStrm );
419 }
420 
422  sal_uInt16 nFrType, sal_uInt16 nRecId, std::size_t nRecSize ) :
423  XclExpRecord( nRecId, nRecSize ),
424  XclExpChRoot( rRoot ),
425  maFrBlock( nFrType )
426 {
427 }
428 
430 {
431 }
432 
434 {
435  // header record
436  XclExpRecord::Save( rStrm );
437  // group records
438  if( !HasSubRecords() )
439  return;
440 
441  // register the future record context corresponding to this record group
443  // CHBEGIN record
445  // embedded records
446  WriteSubRecords( rStrm );
447  // finalize the future records, must be done before the closing CHEND
448  FinalizeFutureRecBlock( rStrm );
449  // CHEND record
450  XclExpEmptyRecord( EXC_ID_CHEND ).Save( rStrm );
451 }
452 
454 {
455  return true;
456 }
457 
458 void XclExpChGroupBase::SetFutureRecordContext( sal_uInt16 nFrContext, sal_uInt16 nFrValue1, sal_uInt16 nFrValue2 )
459 {
460  maFrBlock.mnContext = nFrContext;
461  maFrBlock.mnValue1 = nFrValue1;
462  maFrBlock.mnValue2 = nFrValue2;
463 }
464 
466  XclFutureRecType eRecType, sal_uInt16 nRecId, std::size_t nRecSize ) :
467  XclExpFutureRecord( eRecType, nRecId, nRecSize ),
468  XclExpChRoot( rRoot )
469 {
470 }
471 
473 {
474  InitializeFutureRecBlock( rStrm );
475  XclExpFutureRecord::Save( rStrm );
476 }
477 
478 // Frame formatting ===========================================================
479 
480 XclExpChFramePos::XclExpChFramePos( sal_uInt16 nTLMode ) :
482 {
483  maData.mnTLMode = nTLMode;
485 }
486 
488 {
489  rStrm << maData.mnTLMode << maData.mnBRMode << maData.maRect;
490 }
491 
493  XclExpRecord( EXC_ID_CHLINEFORMAT, (rRoot.GetBiff() == EXC_BIFF8) ? 12 : 10 ),
494  mnColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWTEXT ) )
495 {
496 }
497 
499 {
500  switch( eDefFrameType )
501  {
503  SetAuto( true );
504  break;
506  SetAuto( false );
508  break;
509  default:
510  OSL_FAIL( "XclExpChLineFormat::SetDefault - unknown frame type" );
511  }
512 }
513 
515  const ScfPropertySet& rPropSet, XclChObjectType eObjType )
516 {
517  const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType );
518  rRoot.ConvertLineFormat( maData, rPropSet, rFmtInfo.mePropMode );
519  if( HasLine() )
520  {
521  // detect system color, set color identifier (TODO: detect automatic series line)
522  if( (eObjType != EXC_CHOBJTYPE_LINEARSERIES) && rRoot.IsSystemColor( maData.maColor, rFmtInfo.mnAutoLineColorIdx ) )
523  {
524  // store color index from automatic format data
526  // try to set automatic mode
527  bool bAuto = (maData.mnPattern == EXC_CHLINEFORMAT_SOLID) && (maData.mnWeight == rFmtInfo.mnAutoLineWeight);
529  }
530  else
531  {
532  // user defined color - register in palette
534  }
535  }
536  else
537  {
538  // no line - set default system color
540  }
541 }
542 
544 {
545  return
546  ((eDefFrameType == EXC_CHFRAMETYPE_INVISIBLE) && !HasLine()) ||
547  ((eDefFrameType == EXC_CHFRAMETYPE_AUTO) && IsAuto());
548 }
549 
551 {
553  if( rStrm.GetRoot().GetBiff() == EXC_BIFF8 )
554  rStrm << rStrm.GetRoot().GetPalette().GetColorIndex( mnColorId );
555 }
556 
557 namespace {
558 
560 XclExpChLineFormatRef lclCreateLineFormat( const XclExpChRoot& rRoot,
561  const ScfPropertySet& rPropSet, XclChObjectType eObjType )
562 {
563  XclExpChLineFormatRef xLineFmt = new XclExpChLineFormat( rRoot );
564  xLineFmt->Convert( rRoot, rPropSet, eObjType );
565  const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType );
566  if( rFmtInfo.mbDeleteDefFrame && xLineFmt->IsDefault( rFmtInfo.meDefFrameType ) )
567  xLineFmt.clear();
568  return xLineFmt;
569 }
570 
571 } // namespace
572 
574  XclExpRecord( EXC_ID_CHAREAFORMAT, (rRoot.GetBiff() == EXC_BIFF8) ? 16 : 12 ),
575  mnPattColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWBACK ) ),
576  mnBackColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWTEXT ) )
577 {
578 }
579 
581  const ScfPropertySet& rPropSet, XclChObjectType eObjType )
582 {
583  const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType );
584  bool bComplexFill = rRoot.ConvertAreaFormat( maData, rPropSet, rFmtInfo.mePropMode );
585  if( HasArea() )
586  {
587  bool bSolid = maData.mnPattern == EXC_PATT_SOLID;
588  // detect system color, set color identifier (TODO: detect automatic series area)
589  if( (eObjType != EXC_CHOBJTYPE_FILLEDSERIES) && rRoot.IsSystemColor( maData.maPattColor, rFmtInfo.mnAutoPattColorIdx ) )
590  {
591  // store color index from automatic format data
593  // set automatic mode
595  }
596  else
597  {
598  // user defined color - register color in palette
600  }
601  // background color (default system color for solid fills)
602  if( bSolid )
604  else
606  }
607  else
608  {
609  // no area - set default system colors
612  }
613  return bComplexFill;
614 }
615 
617 {
618  switch( eDefFrameType )
619  {
621  SetAuto( true );
622  break;
624  SetAuto( false );
626  break;
627  default:
628  OSL_FAIL( "XclExpChAreaFormat::SetDefault - unknown frame type" );
629  }
630 }
631 
633 {
634  return
635  ((eDefFrameType == EXC_CHFRAMETYPE_INVISIBLE) && !HasArea()) ||
636  ((eDefFrameType == EXC_CHFRAMETYPE_AUTO) && IsAuto());
637 }
638 
640 {
642  if( rStrm.GetRoot().GetBiff() == EXC_BIFF8 )
643  {
644  const XclExpPalette& rPal = rStrm.GetRoot().GetPalette();
645  rStrm << rPal.GetColorIndex( mnPattColorId ) << rPal.GetColorIndex( mnBackColorId );
646  }
647 }
648 
651  mnColor1Id( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWBACK ) ),
652  mnColor2Id( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWBACK ) )
653 {
655 }
656 
658 {
659  const XclChFormatInfo& rFmtInfo = GetFormatInfo( eObjType );
660  ConvertEscherFormat( maData, maPicFmt, rPropSet, rFmtInfo.mePropMode );
661  // register colors in palette
664 }
665 
667 {
668  return static_cast< bool >(maData.mxEscherSet);
669 }
670 
672 {
673  if( maData.mxEscherSet )
674  {
675  // replace RGB colors with palette indexes in the Escher container
676  const XclExpPalette& rPal = GetPalette();
677  maData.mxEscherSet->AddOpt( ESCHER_Prop_fillColor, 0x08000000 | rPal.GetColorIndex( mnColor1Id ) );
678  maData.mxEscherSet->AddOpt( ESCHER_Prop_fillBackColor, 0x08000000 | rPal.GetColorIndex( mnColor2Id ) );
679 
680  // save the record group
681  XclExpChGroupBase::Save( rStrm );
682  }
683 }
684 
686 {
687  // no subrecords for gradients
689 }
690 
692 {
693  rStrm.StartRecord( EXC_ID_CHPICFORMAT, 14 );
694  rStrm << maPicFmt.mnBmpMode << sal_uInt16( 0 ) << maPicFmt.mnFlags << maPicFmt.mfScale;
695  rStrm.EndRecord();
696 }
697 
698 sal_uInt32 XclExpChEscherFormat::RegisterColor( sal_uInt16 nPropId )
699 {
700  sal_uInt32 nBGRValue;
701  if( maData.mxEscherSet && maData.mxEscherSet->GetOpt( nPropId, nBGRValue ) )
702  {
703  // swap red and blue
704  Color aColor( nBGRValue & 0xff, (nBGRValue >> 8) & 0xff, (nBGRValue >> 16) & 0xff );
705  return GetPalette().InsertColor( aColor, EXC_COLOR_CHARTAREA );
706  }
708 }
709 
711 {
712  OSL_ENSURE( maData.mxEscherSet, "XclExpChEscherFormat::WriteBody - missing property container" );
713  // write Escher property container via temporary memory stream
714  SvMemoryStream aMemStrm;
715  maData.mxEscherSet->Commit( aMemStrm );
716  aMemStrm.FlushBuffer();
717  aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
718  rStrm.CopyFromStream( aMemStrm );
719 }
720 
722 {
723 }
724 
726 {
727 }
728 
730  const ScfPropertySet& rPropSet, XclChObjectType eObjType )
731 {
732  // line format
733  mxLineFmt = new XclExpChLineFormat( rRoot );
734  mxLineFmt->Convert( rRoot, rPropSet, eObjType );
735  // area format (only for frame objects)
736  if( !rRoot.GetFormatInfo( eObjType ).mbIsFrame )
737  return;
738 
739  mxAreaFmt = new XclExpChAreaFormat( rRoot );
740  bool bComplexFill = mxAreaFmt->Convert( rRoot, rPropSet, eObjType );
741  if( (rRoot.GetBiff() == EXC_BIFF8) && bComplexFill )
742  {
743  mxEscherFmt = new XclExpChEscherFormat( rRoot );
744  mxEscherFmt->Convert( rPropSet, eObjType );
745  if( mxEscherFmt->IsValid() )
746  mxAreaFmt->SetAuto( false );
747  else
748  mxEscherFmt.clear();
749  }
750 }
751 
753  XclChFrameType eDefFrameType, bool bIsFrame )
754 {
755  // line format
756  mxLineFmt = new XclExpChLineFormat( rRoot );
757  mxLineFmt->SetDefault( eDefFrameType );
758  // area format (only for frame objects)
759  if( bIsFrame )
760  {
761  mxAreaFmt = new XclExpChAreaFormat( rRoot );
762  mxAreaFmt->SetDefault( eDefFrameType );
763  mxEscherFmt.clear();
764  }
765 }
766 
768 {
769  return
770  (!mxLineFmt || mxLineFmt->IsDefault( eDefFrameType )) &&
771  (!mxAreaFmt || mxAreaFmt->IsDefault( eDefFrameType ));
772 }
773 
775 {
776  lclSaveRecord( rStrm, mxLineFmt );
777  lclSaveRecord( rStrm, mxAreaFmt );
778  lclSaveRecord( rStrm, mxEscherFmt );
779 }
780 
783  meObjType( eObjType )
784 {
785 }
786 
787 void XclExpChFrame::Convert( const ScfPropertySet& rPropSet )
788 {
789  ConvertFrameBase( GetChRoot(), rPropSet, meObjType );
790 }
791 
792 void XclExpChFrame::SetAutoFlags( bool bAutoPos, bool bAutoSize )
793 {
796 }
797 
799 {
800  return IsDefaultFrameBase( GetFormatInfo( meObjType ).meDefFrameType );
801 }
802 
804 {
806 }
807 
809 {
810  switch( meObjType )
811  {
812  // wall/floor frame without CHFRAME header record
815  WriteFrameRecords( rStrm );
816  break;
817  default:
818  XclExpChGroupBase::Save( rStrm );
819  }
820 }
821 
823 {
824  WriteFrameRecords( rStrm );
825 }
826 
828 {
829  rStrm << maData.mnFormat << maData.mnFlags;
830 }
831 
832 namespace {
833 
835 XclExpChFrameRef lclCreateFrame( const XclExpChRoot& rRoot,
836  const ScfPropertySet& rPropSet, XclChObjectType eObjType )
837 {
838  XclExpChFrameRef xFrame = new XclExpChFrame( rRoot, eObjType );
839  xFrame->Convert( rPropSet );
840  if( xFrame->IsDeleteable() )
841  xFrame.clear();
842  return xFrame;
843 }
844 
845 } // namespace
846 
847 // Source links ===============================================================
848 
849 namespace {
850 
851 void lclAddDoubleRefData(
852  ScTokenArray& orArray, const FormulaToken& rToken,
853  SCTAB nScTab1, SCCOL nScCol1, SCROW nScRow1,
854  SCTAB nScTab2, SCCOL nScCol2, SCROW nScRow2 )
855 {
856  ScComplexRefData aComplexRef;
857  aComplexRef.InitRange(ScRange(nScCol1,nScRow1,nScTab1,nScCol2,nScRow2,nScTab2));
858  aComplexRef.Ref1.SetFlag3D( true );
859 
860  if( orArray.GetLen() > 0 )
861  orArray.AddOpCode( ocUnion );
862 
863  OSL_ENSURE( (rToken.GetType() == ::formula::svDoubleRef) || (rToken.GetType() == ::formula::svExternalDoubleRef),
864  "lclAddDoubleRefData - double reference token expected");
865  if( rToken.GetType() == ::formula::svExternalDoubleRef )
867  rToken.GetIndex(), rToken.GetString(), aComplexRef);
868  else
869  orArray.AddDoubleReference( aComplexRef );
870 }
871 
872 } // namespace
873 
876  XclExpChRoot( rRoot )
877 {
878  maData.mnDestType = nDestType;
880 }
881 
882 sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > const & xDataSeq, bool bSplitToColumns, sal_uInt16 nDefCount )
883 {
884  mxLinkFmla.reset();
886 
887  if( !xDataSeq.is() )
888  return nDefCount;
889 
890  // Compile the range representation string into token array. Note that the
891  // source range text depends on the current grammar.
892  OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation();
893  ScCompiler aComp( GetDoc(), ScAddress(), GetDoc().GetGrammar() );
894  std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(aRangeRepr));
895  if( !pArray )
896  return nDefCount;
897 
898  ScTokenArray aArray(GetRoot().GetDoc());
899  sal_uInt32 nValueCount = 0;
900  FormulaTokenArrayPlainIterator aIter(*pArray);
901  for( const FormulaToken* pToken = aIter.First(); pToken; pToken = aIter.Next() )
902  {
903  switch( pToken->GetType() )
904  {
905  case ::formula::svSingleRef:
906  case ::formula::svExternalSingleRef:
907  // for a single ref token, just add it to the new token array as is
908  if( aArray.GetLen() > 0 )
909  aArray.AddOpCode( ocUnion );
910  aArray.AddToken( *pToken );
911  ++nValueCount;
912  break;
913 
914  case ::formula::svDoubleRef:
915  case ::formula::svExternalDoubleRef:
916  {
917  // split 3-dimensional ranges into single sheets
918  const ScComplexRefData& rComplexRef = *pToken->GetDoubleRef();
919  ScAddress aAbs1 = rComplexRef.Ref1.toAbs(GetRoot().GetDoc(), ScAddress());
920  ScAddress aAbs2 = rComplexRef.Ref2.toAbs(GetRoot().GetDoc(), ScAddress());
921  for (SCTAB nScTab = aAbs1.Tab(); nScTab <= aAbs2.Tab(); ++nScTab)
922  {
923  // split 2-dimensional ranges into single columns
924  if (bSplitToColumns && (aAbs1.Col() < aAbs2.Col()) && (aAbs1.Row() < aAbs2.Row()))
925  for (SCCOL nScCol = aAbs1.Col(); nScCol <= aAbs2.Col(); ++nScCol)
926  lclAddDoubleRefData(aArray, *pToken, nScTab, nScCol, aAbs1.Row(), nScTab, nScCol, aAbs2.Row());
927  else
928  lclAddDoubleRefData(aArray, *pToken, nScTab, aAbs1.Col(), aAbs1.Row(), nScTab, aAbs2.Col(), aAbs2.Row());
929  }
930  sal_uInt32 nTabs = static_cast<sal_uInt32>(aAbs2.Tab() - aAbs1.Tab() + 1);
931  sal_uInt32 nCols = static_cast<sal_uInt32>(aAbs2.Col() - aAbs1.Col() + 1);
932  sal_uInt32 nRows = static_cast<sal_uInt32>(aAbs2.Row() - aAbs1.Row() + 1);
933  nValueCount += nCols * nRows * nTabs;
934  }
935  break;
936 
937  default:;
938  }
939  }
940 
941  const ScAddress aBaseCell;
944  return ulimit_cast< sal_uInt16 >( nValueCount, EXC_CHDATAFORMAT_MAXPOINTCOUNT );
945 }
946 
947 void XclExpChSourceLink::ConvertString( const OUString& aString )
948 {
950 }
951 
952 sal_uInt16 XclExpChSourceLink::ConvertStringSequence( const Sequence< Reference< XFormattedString > >& rStringSeq )
953 {
954  mxString.reset();
955  sal_uInt16 nFontIdx = EXC_FONT_APP;
956  if( rStringSeq.hasElements() )
957  {
959  Reference< XBreakIterator > xBreakIt = GetDoc().GetBreakIterator();
960  namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
961 
962  // convert all formatted string entries from the sequence
963  for( const Reference< XFormattedString >& rString : rStringSeq )
964  {
965  if( rString.is() )
966  {
967  sal_uInt16 nWstrnFontIdx = EXC_FONT_NOTFOUND;
968  sal_uInt16 nAsianFontIdx = EXC_FONT_NOTFOUND;
969  sal_uInt16 nCmplxFontIdx = EXC_FONT_NOTFOUND;
970  OUString aText = rString->getString();
971  ScfPropertySet aStrProp( rString );
972 
973  // #i63255# get script type for leading weak characters
974  sal_Int16 nLastScript = XclExpStringHelper::GetLeadingScriptType( GetRoot(), aText );
975 
976  // process all script portions
977  sal_Int32 nPortionPos = 0;
978  sal_Int32 nTextLen = aText.getLength();
979  while( nPortionPos < nTextLen )
980  {
981  // get script type and end position of next script portion
982  sal_Int16 nScript = xBreakIt->getScriptType( aText, nPortionPos );
983  sal_Int32 nPortionEnd = xBreakIt->endOfScript( aText, nPortionPos, nScript );
984 
985  // reuse previous script for following weak portions
986  if( nScript == ApiScriptType::WEAK )
987  nScript = nLastScript;
988 
989  // Excel start position of this portion
990  sal_uInt16 nXclPortionStart = mxString->Len();
991  // add portion text to Excel string
992  XclExpStringHelper::AppendString( *mxString, GetRoot(), aText.subView( nPortionPos, nPortionEnd - nPortionPos ) );
993  if( nXclPortionStart < mxString->Len() )
994  {
995  // find font index variable dependent on script type
996  sal_uInt16& rnFontIdx = (nScript == ApiScriptType::COMPLEX) ? nCmplxFontIdx :
997  ((nScript == ApiScriptType::ASIAN) ? nAsianFontIdx : nWstrnFontIdx);
998 
999  // insert font into buffer (if not yet done)
1000  if( rnFontIdx == EXC_FONT_NOTFOUND )
1001  rnFontIdx = ConvertFont( aStrProp, nScript );
1002 
1003  // insert font index into format run vector
1004  mxString->AppendFormat( nXclPortionStart, rnFontIdx );
1005  }
1006 
1007  // go to next script portion
1008  nLastScript = nScript;
1009  nPortionPos = nPortionEnd;
1010  }
1011  }
1012  }
1013  if( !mxString->IsEmpty() )
1014  {
1015  // get leading font index
1016  const XclFormatRunVec& rFormats = mxString->GetFormats();
1017  OSL_ENSURE( !rFormats.empty() && (rFormats.front().mnChar == 0),
1018  "XclExpChSourceLink::ConvertStringSequenc - missing leading format" );
1019  // remove leading format run, if entire string is equally formatted
1020  if( rFormats.size() == 1 )
1021  nFontIdx = mxString->RemoveLeadingFont();
1022  else if( !rFormats.empty() )
1023  nFontIdx = rFormats.front().mnFontIdx;
1024  // add trailing format run, if string is rich-formatted
1025  if( mxString->IsRich() )
1026  mxString->AppendTrailingFormat( EXC_FONT_APP );
1027  }
1028  }
1029  return nFontIdx;
1030 }
1031 
1032 void XclExpChSourceLink::ConvertNumFmt( const ScfPropertySet& rPropSet, bool bPercent )
1033 {
1034  sal_Int32 nApiNumFmt = 0;
1035  if( bPercent ? rPropSet.GetProperty( nApiNumFmt, EXC_CHPROP_PERCENTAGENUMFMT ) : rPropSet.GetProperty( nApiNumFmt, EXC_CHPROP_NUMBERFORMAT ) )
1036  {
1038  maData.mnNumFmtIdx = GetNumFmtBuffer().Insert( static_cast< sal_uInt32 >( nApiNumFmt ) );
1039  }
1040 }
1041 
1042 void XclExpChSourceLink::AppendString( std::u16string_view rStr )
1043 {
1044  if (!mxString)
1045  return;
1047 }
1048 
1050 {
1051  // CHFORMATRUNS record
1052  if( mxString && mxString->IsRich() )
1053  {
1054  std::size_t nRecSize = (1 + mxString->GetFormatsCount()) * ((GetBiff() == EXC_BIFF8) ? 2 : 1);
1055  rStrm.StartRecord( EXC_ID_CHFORMATRUNS, nRecSize );
1056  mxString->WriteFormats( rStrm, true );
1057  rStrm.EndRecord();
1058  }
1059  // CHSOURCELINK record
1060  XclExpRecord::Save( rStrm );
1061  // CHSTRING record
1062  if( mxString && !mxString->IsEmpty() )
1063  {
1064  rStrm.StartRecord( EXC_ID_CHSTRING, 2 + mxString->GetSize() );
1065  rStrm << sal_uInt16( 0 ) << *mxString;
1066  rStrm.EndRecord();
1067  }
1068 }
1069 
1071 {
1072  rStrm << maData.mnDestType
1073  << maData.mnLinkType
1074  << maData.mnFlags
1075  << maData.mnNumFmtIdx
1076  << mxLinkFmla;
1077 }
1078 
1079 // Text =======================================================================
1080 
1081 XclExpChFont::XclExpChFont( sal_uInt16 nFontIdx ) :
1082  XclExpUInt16Record( EXC_ID_CHFONT, nFontIdx )
1083 {
1084 }
1085 
1086 XclExpChObjectLink::XclExpChObjectLink( sal_uInt16 nLinkTarget, const XclChDataPointPos& rPointPos ) :
1088 {
1089  maData.mnTarget = nLinkTarget;
1090  maData.maPointPos = rPointPos;
1091 }
1092 
1094 {
1096 }
1097 
1100 {
1101 }
1102 
1104  bool bShowCateg, bool bShowValue, bool bShowPercent, bool bShowBubble )
1105 {
1106  // label value flags
1112 
1113  // label value separator
1115  if( maData.maSeparator.isEmpty() )
1116  maData.maSeparator = " ";
1117 }
1118 
1120 {
1122  rStrm << maData.mnFlags << aXclSep;
1123 }
1124 
1126 {
1127 }
1128 
1129 void XclExpChFontBase::ConvertFontBase( const XclExpChRoot& rRoot, sal_uInt16 nFontIdx )
1130 {
1131  if( const XclExpFont* pFont = rRoot.GetFontBuffer().GetFont( nFontIdx ) )
1132  {
1133  XclExpChFontRef xFont = new XclExpChFont( nFontIdx );
1134  SetFont( xFont, pFont->GetFontData().maColor, pFont->GetFontColorId() );
1135  }
1136 }
1137 
1139 {
1140  ConvertFontBase( rRoot, rRoot.ConvertFont( rPropSet, rRoot.GetDefApiScript() ) );
1141 }
1142 
1143 void XclExpChFontBase::ConvertRotationBase(const ScfPropertySet& rPropSet, bool bSupportsStacked )
1144 {
1145  sal_uInt16 nRotation = XclChPropSetHelper::ReadRotationProperties( rPropSet, bSupportsStacked );
1146  SetRotation( nRotation );
1147 }
1148 
1150  XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_TEXT, EXC_ID_CHTEXT, (rRoot.GetBiff() == EXC_BIFF8) ? 32 : 26 ),
1151  mnTextColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWTEXT ) )
1152 {
1153 }
1154 
1155 void XclExpChText::SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId )
1156 {
1157  mxFont = xFont;
1158  maData.maTextColor = rColor;
1160  mnTextColorId = nColorId;
1161 }
1162 
1163 void XclExpChText::SetRotation( sal_uInt16 nRotation )
1164 {
1165  maData.mnRotation = nRotation;
1167 }
1168 
1169 void XclExpChText::ConvertTitle( Reference< XTitle > const & xTitle, sal_uInt16 nTarget, const OUString* pSubTitle )
1170 {
1171  switch( nTarget )
1172  {
1177  }
1178 
1179  mxSrcLink.clear();
1180  mxObjLink = new XclExpChObjectLink( nTarget, XclChDataPointPos( 0, 0 ) );
1181 
1182  if( xTitle.is() )
1183  {
1184  // title frame formatting
1185  ScfPropertySet aTitleProp( xTitle );
1186  mxFrame = lclCreateFrame( GetChRoot(), aTitleProp, EXC_CHOBJTYPE_TEXT );
1187 
1188  // string sequence
1190  sal_uInt16 nFontIdx = mxSrcLink->ConvertStringSequence( xTitle->getText() );
1191  if (pSubTitle)
1192  {
1193  // append subtitle as the 2nd line of the title.
1194  OUString aSubTitle = "\n" + *pSubTitle;
1195  mxSrcLink->AppendString(aSubTitle);
1196  }
1197 
1198  ConvertFontBase( GetChRoot(), nFontIdx );
1199 
1200  // rotation
1201  ConvertRotationBase( aTitleProp, true );
1202 
1203  // manual text position - only for main title
1205  if( nTarget == EXC_CHOBJLINK_TITLE )
1206  {
1207  Any aRelPos;
1208  if( aTitleProp.GetAnyProperty( aRelPos, EXC_CHPROP_RELATIVEPOSITION ) && aRelPos.has< RelativePosition >() ) try
1209  {
1210  // calculate absolute position for CHTEXT record
1211  Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
1212  Reference< XShape > xTitleShape( xChart1Doc->getTitle(), UNO_SET_THROW );
1213  css::awt::Point aPos = xTitleShape->getPosition();
1214  css::awt::Size aSize = xTitleShape->getSize();
1215  css::awt::Rectangle aRect( aPos.X, aPos.Y, aSize.Width, aSize.Height );
1216  maData.maRect = CalcChartRectFromHmm( aRect );
1218  // manual title position implies manual plot area
1220  // calculate the default title position in chart units
1221  sal_Int32 nDefPosX = ::std::max< sal_Int32 >( (EXC_CHART_TOTALUNITS - maData.maRect.mnWidth) / 2, 0 );
1222  sal_Int32 nDefPosY = 85;
1223  // set the position relative to the standard position
1224  XclChRectangle& rFrameRect = mxFramePos->GetFramePosData().maRect;
1225  rFrameRect.mnX = maData.maRect.mnX - nDefPosX;
1226  rFrameRect.mnY = maData.maRect.mnY - nDefPosY;
1227  }
1228  catch( Exception& )
1229  {
1230  }
1231  }
1232  }
1233  else
1234  {
1236  }
1237 }
1238 
1240 {
1243  ConvertFontBase( GetChRoot(), rPropSet );
1244 }
1245 
1247  const XclChTypeInfo& rTypeInfo, const XclChDataPointPos& rPointPos )
1248 {
1250 
1251  cssc2::DataPointLabel aPointLabel;
1252  if( !rPropSet.GetProperty( aPointLabel, EXC_CHPROP_LABEL ) )
1253  return false;
1254 
1255  // percentage only allowed in pie and donut charts
1256  bool bIsPie = rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE;
1257  // bubble sizes only allowed in bubble charts
1258  bool bIsBubble = rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES;
1259  OSL_ENSURE( (GetBiff() == EXC_BIFF8) || !bIsBubble, "XclExpChText::ConvertDataLabel - bubble charts only in BIFF8" );
1260 
1261  // raw show flags
1262  bool bShowValue = !bIsBubble && aPointLabel.ShowNumber; // Chart2 uses 'ShowNumber' for bubble size
1263  bool bShowPercent = bIsPie && aPointLabel.ShowNumberInPercent; // percentage only in pie/donut charts
1264  bool bShowCateg = aPointLabel.ShowCategoryName;
1265  bool bShowBubble = bIsBubble && aPointLabel.ShowNumber; // Chart2 uses 'ShowNumber' for bubble size
1266  bool bShowAny = bShowValue || bShowPercent || bShowCateg || bShowBubble;
1267 
1268  // create the CHFRLABELPROPS record for extended settings in BIFF8
1269  if( bShowAny && (GetBiff() == EXC_BIFF8) )
1270  {
1272  mxLabelProps->Convert( rPropSet, bShowCateg, bShowValue, bShowPercent, bShowBubble );
1273  }
1274 
1275  // restrict to combinations allowed in CHTEXT
1276  if( bShowPercent ) bShowValue = false; // percent wins over value
1277  if( bShowValue ) bShowCateg = false; // value wins over category
1278  if( bShowValue || bShowCateg ) bShowBubble = false; // value or category wins over bubble size
1279 
1280  // set all flags
1283  ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWPERCENT, bShowPercent );
1285  ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWCATEGPERC, bShowPercent && bShowCateg );
1287  ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWSYMBOL, bShowAny && aPointLabel.ShowLegendSymbol );
1289 
1290  if( bShowAny )
1291  {
1292  // font settings
1293  ConvertFontBase( GetChRoot(), rPropSet );
1294  ConvertRotationBase( rPropSet, false );
1295  // label placement
1296  sal_Int32 nPlacement = 0;
1297  sal_uInt16 nLabelPos = EXC_CHTEXT_POS_AUTO;
1298  if( rPropSet.GetProperty( nPlacement, EXC_CHPROP_LABELPLACEMENT ) )
1299  {
1300  using namespace cssc::DataLabelPlacement;
1301  if( nPlacement == rTypeInfo.mnDefaultLabelPos )
1302  {
1303  nLabelPos = EXC_CHTEXT_POS_DEFAULT;
1304  }
1305  else switch( nPlacement )
1306  {
1307  case AVOID_OVERLAP: nLabelPos = EXC_CHTEXT_POS_AUTO; break;
1308  case CENTER: nLabelPos = EXC_CHTEXT_POS_CENTER; break;
1309  case TOP: nLabelPos = EXC_CHTEXT_POS_ABOVE; break;
1310  case TOP_LEFT: nLabelPos = EXC_CHTEXT_POS_LEFT; break;
1311  case LEFT: nLabelPos = EXC_CHTEXT_POS_LEFT; break;
1312  case BOTTOM_LEFT: nLabelPos = EXC_CHTEXT_POS_LEFT; break;
1313  case BOTTOM: nLabelPos = EXC_CHTEXT_POS_BELOW; break;
1314  case BOTTOM_RIGHT: nLabelPos = EXC_CHTEXT_POS_RIGHT; break;
1315  case RIGHT: nLabelPos = EXC_CHTEXT_POS_RIGHT; break;
1316  case TOP_RIGHT: nLabelPos = EXC_CHTEXT_POS_RIGHT; break;
1317  case INSIDE: nLabelPos = EXC_CHTEXT_POS_INSIDE; break;
1318  case OUTSIDE: nLabelPos = EXC_CHTEXT_POS_OUTSIDE; break;
1319  case NEAR_ORIGIN: nLabelPos = EXC_CHTEXT_POS_AXIS; break;
1320  default: OSL_FAIL( "XclExpChText::ConvertDataLabel - unknown label placement type" );
1321  }
1322  }
1323  ::insert_value( maData.mnFlags2, nLabelPos, 0, 4 );
1324  // source link (contains number format)
1326  if( bShowValue || bShowPercent )
1327  // percentage format wins over value format
1328  mxSrcLink->ConvertNumFmt( rPropSet, bShowPercent );
1329  // object link
1330  mxObjLink = new XclExpChObjectLink( EXC_CHOBJLINK_DATA, rPointPos );
1331  }
1332 
1333  /* Return true to indicate valid label settings:
1334  - for existing labels at entire series
1335  - for any settings at single data point (to be able to delete a point label) */
1336  return bShowAny || (rPointPos.mnPointIdx != EXC_CHDATAFORMAT_ALLPOINTS);
1337 }
1338 
1340 {
1341  // required flags
1343  if( GetBiff() == EXC_BIFF8 )
1344  ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWCATEG ); // must set this to make equation visible in Excel
1345  // frame formatting
1346  mxFrame = lclCreateFrame( GetChRoot(), rPropSet, EXC_CHOBJTYPE_TEXT );
1347  // font settings
1350  ConvertFontBase( GetChRoot(), rPropSet );
1351  // source link (contains number format)
1353  mxSrcLink->ConvertNumFmt( rPropSet, false );
1354  // object link
1355  mxObjLink = new XclExpChObjectLink( EXC_CHOBJLINK_DATA, rPointPos );
1356 }
1357 
1359 {
1360  sal_uInt16 nFlags = 0;
1365  return nFlags;
1366 }
1367 
1369 {
1370  // CHFRAMEPOS record
1371  lclSaveRecord( rStrm, mxFramePos );
1372  // CHFONT record
1373  lclSaveRecord( rStrm, mxFont );
1374  // CHSOURCELINK group
1375  lclSaveRecord( rStrm, mxSrcLink );
1376  // CHFRAME group
1377  lclSaveRecord( rStrm, mxFrame );
1378  // CHOBJECTLINK record
1379  lclSaveRecord( rStrm, mxObjLink );
1380  // CHFRLABELPROPS record
1381  lclSaveRecord( rStrm, mxLabelProps );
1382 }
1383 
1385 {
1386  rStrm << maData.mnHAlign
1387  << maData.mnVAlign
1388  << maData.mnBackMode
1389  << maData.maTextColor
1390  << maData.maRect
1391  << maData.mnFlags;
1392 
1393  if( GetBiff() == EXC_BIFF8 )
1394  {
1395  rStrm << GetPalette().GetColorIndex( mnTextColorId )
1396  << maData.mnFlags2
1397  << maData.mnRotation;
1398  }
1399 }
1400 
1401 namespace {
1402 
1404 XclExpChTextRef lclCreateTitle( const XclExpChRoot& rRoot, Reference< XTitled > const & xTitled, sal_uInt16 nTarget,
1405  const OUString* pSubTitle = nullptr )
1406 {
1407  Reference< XTitle > xTitle;
1408  if( xTitled.is() )
1409  xTitle = xTitled->getTitleObject();
1410 
1411  XclExpChTextRef xText = new XclExpChText( rRoot );
1412  xText->ConvertTitle( xTitle, nTarget, pSubTitle );
1413  /* Do not delete the CHTEXT group for the main title. A missing CHTEXT
1414  will be interpreted as auto-generated title showing the series title in
1415  charts that contain exactly one data series. */
1416  if( (nTarget != EXC_CHOBJLINK_TITLE) && !xText->HasString() )
1417  xText.clear();
1418 
1419  return xText;
1420 }
1421 
1422 }
1423 
1424 // Data series ================================================================
1425 
1427  XclExpRecord( EXC_ID_CHMARKERFORMAT, (rRoot.GetBiff() == EXC_BIFF8) ? 20 : 12 ),
1428  mnLineColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWTEXT ) ),
1429  mnFillColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWBACK ) )
1430 {
1431 }
1432 
1434  const ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx )
1435 {
1436  XclChPropSetHelper::ReadMarkerProperties( maData, rPropSet, nFormatIdx );
1437  /* Set marker line/fill color to series line color.
1438  TODO: remove this if OOChart supports own colors in markers. */
1439  Color aLineColor;
1440  if( rPropSet.GetColorProperty( aLineColor, EXC_CHPROP_COLOR ) )
1441  maData.maLineColor = maData.maFillColor = aLineColor;
1442  // register colors in palette
1443  RegisterColors( rRoot );
1444 }
1445 
1447  const ScfPropertySet& rPropSet, bool bCloseSymbol )
1448 {
1449  // clear the automatic flag
1451  // symbol type and color
1452  if( bCloseSymbol )
1453  {
1454  // set symbol type for the 'close' data series
1457  // set symbol line/fill color to series line color
1458  Color aLineColor;
1459  if( rPropSet.GetColorProperty( aLineColor, EXC_CHPROP_COLOR ) )
1460  {
1461  maData.maLineColor = maData.maFillColor = aLineColor;
1462  RegisterColors( rRoot );
1463  }
1464  }
1465  else
1466  {
1467  // set invisible symbol
1469  }
1470 }
1471 
1473 {
1474  if( HasMarker() )
1475  {
1476  if( HasLineColor() )
1478  if( HasFillColor() )
1480  }
1481 }
1482 
1484 {
1486  if( rStrm.GetRoot().GetBiff() == EXC_BIFF8 )
1487  {
1488  const XclExpPalette& rPal = rStrm.GetRoot().GetPalette();
1490  }
1491 }
1492 
1495 {
1496 }
1497 
1499 {
1500  double fApiDist(0.0);
1501  if( rPropSet.GetProperty( fApiDist, EXC_CHPROP_OFFSET ) )
1502  SetValue( limit_cast< sal_uInt16 >( fApiDist * 100.0, 0, 100 ) );
1503 }
1504 
1507 {
1508 }
1509 
1511 {
1512  sal_Int32 nApiType(0);
1513  if( !rPropSet.GetProperty( nApiType, EXC_CHPROP_GEOMETRY3D ) )
1514  return;
1515 
1516  using namespace cssc2::DataPointGeometry3D;
1517  switch( nApiType )
1518  {
1519  case CUBOID:
1522  break;
1523  case PYRAMID:
1526  break;
1527  case CYLINDER:
1530  break;
1531  case CONE:
1534  break;
1535  default:
1536  OSL_FAIL( "XclExpCh3dDataFormat::Convert - unknown 3D bar format" );
1537  }
1538 }
1539 
1541 {
1542  rStrm << maData.mnBase << maData.mnTop;
1543 }
1544 
1547 {
1548 }
1549 
1551  const XclChDataPointPos& rPointPos, sal_uInt16 nFormatIdx ) :
1553 {
1554  maData.maPointPos = rPointPos;
1555  maData.mnFormatIdx = nFormatIdx;
1556 }
1557 
1559 {
1560  // line and area formatting
1561  ConvertFrameBase( GetChRoot(), rPropSet, rTypeInfo.GetSeriesObjectType() );
1562 
1563  // data point symbols
1564  bool bIsFrame = rTypeInfo.IsSeriesFrameFormat();
1565  if( !bIsFrame )
1566  {
1568  mxMarkerFmt->Convert( GetChRoot(), rPropSet, maData.mnFormatIdx );
1569  }
1570 
1571  // pie segments
1572  if( rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE )
1573  {
1574  mxPieFmt = new XclExpChPieFormat();
1575  mxPieFmt->Convert( rPropSet );
1576  }
1577 
1578  // 3D bars (only allowed for entire series in BIFF8)
1579  if( IsSeriesFormat() && (GetBiff() == EXC_BIFF8) && rTypeInfo.mb3dChart && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR) )
1580  {
1582  mx3dDataFmt->Convert( rPropSet );
1583  }
1584 
1585  // spline
1586  if( IsSeriesFormat() && rTypeInfo.mbSpline && !bIsFrame )
1588 
1589  // data point labels
1590  XclExpChTextRef xLabel = new XclExpChText( GetChRoot() );
1591  if( xLabel->ConvertDataLabel( rPropSet, rTypeInfo, maData.maPointPos ) )
1592  {
1593  // CHTEXT groups for data labels are stored in global CHCHART group
1594  GetChartData().SetDataLabel( xLabel );
1595  mxAttLabel = new XclExpChAttachedLabel( xLabel->GetAttLabelFlags() );
1596  }
1597 }
1598 
1599 void XclExpChDataFormat::ConvertStockSeries( const ScfPropertySet& rPropSet, bool bCloseSymbol )
1600 {
1601  // set line format to invisible
1603  // set symbols to invisible or to 'close' series symbol
1605  mxMarkerFmt->ConvertStockSymbol( GetChRoot(), rPropSet, bCloseSymbol );
1606 }
1607 
1609 {
1610  ConvertFrameBase( GetChRoot(), rPropSet, eObjType );
1611 }
1612 
1614 {
1615  lclSaveRecord( rStrm, mx3dDataFmt );
1616  WriteFrameRecords( rStrm );
1617  lclSaveRecord( rStrm, mxPieFmt );
1618  lclSaveRecord( rStrm, mxMarkerFmt );
1619  lclSaveRecord( rStrm, mxSeriesFmt );
1620  lclSaveRecord( rStrm, mxAttLabel );
1621 }
1622 
1624 {
1625  rStrm << maData.maPointPos.mnPointIdx
1627  << maData.mnFormatIdx
1628  << maData.mnFlags;
1629 }
1630 
1633  XclExpChRoot( rRoot )
1634 {
1635 }
1636 
1637 bool XclExpChSerTrendLine::Convert( Reference< XRegressionCurve > const & xRegCurve, sal_uInt16 nSeriesIdx )
1638 {
1639  if( !xRegCurve.is() )
1640  return false;
1641 
1642  // trend line type
1643  ScfPropertySet aCurveProp( xRegCurve );
1644 
1645  OUString aService = aCurveProp.GetServiceName();
1646  if( aService == "com.sun.star.chart2.LinearRegressionCurve" )
1647  {
1649  maData.mnOrder = 1;
1650  }
1651  else if( aService == "com.sun.star.chart2.ExponentialRegressionCurve" )
1652  {
1654  }
1655  else if( aService == "com.sun.star.chart2.LogarithmicRegressionCurve" )
1656  {
1658  }
1659  else if( aService == "com.sun.star.chart2.PotentialRegressionCurve" )
1660  {
1662  }
1663  else if( aService == "com.sun.star.chart2.PolynomialRegressionCurve" )
1664  {
1666  sal_Int32 aDegree;
1667  aCurveProp.GetProperty(aDegree, EXC_CHPROP_POLYNOMIAL_DEGREE);
1668  maData.mnOrder = static_cast<sal_uInt8> (aDegree);
1669  }
1670  else if( aService == "com.sun.star.chart2.MovingAverageRegressionCurve" )
1671  {
1673  sal_Int32 aPeriod;
1674  aCurveProp.GetProperty(aPeriod, EXC_CHPROP_MOVING_AVERAGE_PERIOD);
1675  maData.mnOrder = static_cast<sal_uInt8> (aPeriod);
1676  }
1677  else
1678  {
1679  return false;
1680  }
1681 
1684  bool bIsForceIntercept = false;
1685  aCurveProp.GetProperty(bIsForceIntercept, EXC_CHPROP_FORCE_INTERCEPT);
1686  if (bIsForceIntercept)
1688 
1689  // line formatting
1690  XclChDataPointPos aPointPos( nSeriesIdx );
1691  mxDataFmt = new XclExpChDataFormat( GetChRoot(), aPointPos, 0 );
1692  mxDataFmt->ConvertLine( aCurveProp, EXC_CHOBJTYPE_TRENDLINE );
1693 
1694  // #i83100# show equation and correlation coefficient
1695  ScfPropertySet aEquationProp( xRegCurve->getEquationProperties() );
1696  maData.mnShowEquation = aEquationProp.GetBoolProperty( EXC_CHPROP_SHOWEQUATION ) ? 1 : 0;
1697  maData.mnShowRSquared = aEquationProp.GetBoolProperty( EXC_CHPROP_SHOWCORRELATION ) ? 1 : 0;
1698 
1699  // #i83100# formatting of the equation text box
1700  if( (maData.mnShowEquation != 0) || (maData.mnShowRSquared != 0) )
1701  {
1702  mxLabel = new XclExpChText( GetChRoot() );
1703  mxLabel->ConvertTrendLineEquation( aEquationProp, aPointPos );
1704  }
1705 
1706  // missing features
1707  // #i5085# manual trend line size
1708  // #i34093# manual crossing point
1709  return true;
1710 }
1711 
1713 {
1714  rStrm << maData.mnLineType
1715  << maData.mnOrder
1716  << maData.mfIntercept
1721 }
1722 
1725  XclExpChRoot( rRoot )
1726 {
1727  maData.mnBarType = nBarType;
1728 }
1729 
1730 bool XclExpChSerErrorBar::Convert( XclExpChSourceLink& rValueLink, sal_uInt16& rnValueCount, const ScfPropertySet& rPropSet )
1731 {
1732  sal_Int32 nBarStyle = 0;
1733  bool bOk = rPropSet.GetProperty( nBarStyle, EXC_CHPROP_ERRORBARSTYLE );
1734  if( bOk )
1735  {
1736  switch( nBarStyle )
1737  {
1738  case cssc::ErrorBarStyle::ABSOLUTE:
1741  break;
1742  case cssc::ErrorBarStyle::RELATIVE:
1745  break;
1746  case cssc::ErrorBarStyle::STANDARD_DEVIATION:
1749  break;
1750  case cssc::ErrorBarStyle::STANDARD_ERROR:
1752  break;
1753  case cssc::ErrorBarStyle::FROM_DATA:
1754  {
1755  bOk = false;
1757  Reference< XDataSource > xDataSource( rPropSet.GetApiPropertySet(), UNO_QUERY );
1758  if( xDataSource.is() )
1759  {
1760  // find first sequence with current role
1762  Reference< XDataSequence > xValueSeq;
1763 
1764  const Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences();
1765  for( const Reference< XLabeledDataSequence >& rLabeledSeq : aLabeledSeqVec )
1766  {
1767  Reference< XDataSequence > xTmpValueSeq = rLabeledSeq->getValues();
1768  ScfPropertySet aValueProp( xTmpValueSeq );
1769  OUString aCurrRole;
1770  if( aValueProp.GetProperty( aCurrRole, EXC_CHPROP_ROLE ) && (aCurrRole == aRole) )
1771  {
1772  xValueSeq = xTmpValueSeq;
1773  break;
1774  }
1775  }
1776  if( xValueSeq.is() )
1777  {
1778  // #i86465# pass value count back to series
1779  rnValueCount = maData.mnValueCount = rValueLink.ConvertDataSequence( xValueSeq, true );
1780  bOk = maData.mnValueCount > 0;
1781  }
1782  }
1783  }
1784  break;
1785  default:
1786  bOk = false;
1787  }
1788  }
1789  return bOk;
1790 }
1791 
1793 {
1794  rStrm << maData.mnBarType
1795  << maData.mnSourceType
1796  << maData.mnLineEnd
1797  << sal_uInt8( 1 ) // must be 1 to make line visible
1798  << maData.mfValue
1799  << maData.mnValueCount;
1800 }
1801 
1802 namespace {
1803 
1805 ScfPropertySet lclGetPointPropSet( Reference< XDataSeries > const & xDataSeries, sal_Int32 nPointIdx )
1806 {
1807  ScfPropertySet aPropSet;
1808  try
1809  {
1810  aPropSet.Set( xDataSeries->getDataPointByIndex( nPointIdx ) );
1811  }
1812  catch( Exception& )
1813  {
1814  OSL_FAIL( "lclGetPointPropSet - no data point property set" );
1815  }
1816  return aPropSet;
1817 }
1818 
1819 } // namespace
1820 
1821 XclExpChSeries::XclExpChSeries( const XclExpChRoot& rRoot, sal_uInt16 nSeriesIdx ) :
1822  XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_SERIES, EXC_ID_CHSERIES, (rRoot.GetBiff() == EXC_BIFF8) ? 12 : 8 ),
1823  mnGroupIdx( EXC_CHSERGROUP_NONE ),
1824  mnSeriesIdx( nSeriesIdx ),
1825  mnParentIdx( EXC_CHSERIES_INVALID )
1826 {
1827  // CHSOURCELINK records are always required, even if unused
1831  if( GetBiff() == EXC_BIFF8 )
1833 }
1834 
1836  Reference< XDiagram > const & xDiagram, Reference< XDataSeries > const & xDataSeries,
1837  const XclChExtTypeInfo& rTypeInfo, sal_uInt16 nGroupIdx, sal_uInt16 nFormatIdx )
1838 {
1839  bool bOk = false;
1840  Reference< XDataSource > xDataSource( xDataSeries, UNO_QUERY );
1841  if( xDataSource.is() )
1842  {
1843  Reference< XDataSequence > xYValueSeq, xTitleSeq, xXValueSeq, xBubbleSeq;
1844 
1845  // find first sequence with role 'values-y'
1846  const Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences();
1847  for( const Reference< XLabeledDataSequence >& rLabeledSeq : aLabeledSeqVec )
1848  {
1849  Reference< XDataSequence > xTmpValueSeq = rLabeledSeq->getValues();
1850  ScfPropertySet aValueProp( xTmpValueSeq );
1851  OUString aRole;
1852  if( aValueProp.GetProperty( aRole, EXC_CHPROP_ROLE ) )
1853  {
1854  if( !xYValueSeq.is() && (aRole == EXC_CHPROP_ROLE_YVALUES) )
1855  {
1856  xYValueSeq = xTmpValueSeq;
1857  if( !xTitleSeq.is() )
1858  xTitleSeq = rLabeledSeq->getLabel(); // ignore role of label sequence
1859  }
1860  else if( !xXValueSeq.is() && !rTypeInfo.mbCategoryAxis && (aRole == EXC_CHPROP_ROLE_XVALUES) )
1861  {
1862  xXValueSeq = xTmpValueSeq;
1863  }
1864  else if( !xBubbleSeq.is() && (rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES) && (aRole == EXC_CHPROP_ROLE_SIZEVALUES) )
1865  {
1866  xBubbleSeq = xTmpValueSeq;
1867  xTitleSeq = rLabeledSeq->getLabel(); // ignore role of label sequence
1868  }
1869  }
1870  }
1871 
1872  bOk = xYValueSeq.is();
1873  if( bOk )
1874  {
1875  // chart type group index
1876  mnGroupIdx = nGroupIdx;
1877 
1878  // convert source links
1879  maData.mnValueCount = mxValueLink->ConvertDataSequence( xYValueSeq, true );
1880  mxTitleLink->ConvertDataSequence( xTitleSeq, true );
1881 
1882  // X values of XY charts
1883  maData.mnCategCount = mxCategLink->ConvertDataSequence( xXValueSeq, false, maData.mnValueCount );
1884 
1885  // size values of bubble charts
1886  if( mxBubbleLink )
1887  mxBubbleLink->ConvertDataSequence( xBubbleSeq, false, maData.mnValueCount );
1888 
1889  // series formatting
1890  XclChDataPointPos aPointPos( mnSeriesIdx );
1891  ScfPropertySet aSeriesProp( xDataSeries );
1892  mxSeriesFmt = new XclExpChDataFormat( GetChRoot(), aPointPos, nFormatIdx );
1893  mxSeriesFmt->ConvertDataSeries( aSeriesProp, rTypeInfo );
1894 
1895  // trend lines
1896  CreateTrendLines( xDataSeries );
1897 
1898  // error bars
1901 
1902  if( maData.mnValueCount > 0 )
1903  {
1904  const sal_Int32 nMaxPointCount = maData.mnValueCount;
1905 
1906  /* #i91063# Create missing fill properties in pie/doughnut charts.
1907  If freshly created (never saved to ODF), these charts show
1908  varying point colors but do not return these points via API. */
1909  if( xDiagram.is() && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE) )
1910  {
1911  Reference< XColorScheme > xColorScheme = xDiagram->getDefaultColorScheme();
1912  if( xColorScheme.is() )
1913  {
1914  static const OUStringLiteral aFillStyleName = u"FillStyle";
1915  static const OUStringLiteral aColorName = u"Color";
1916  namespace cssd = ::com::sun::star::drawing;
1917  for( sal_Int32 nPointIdx = 0; nPointIdx < nMaxPointCount; ++nPointIdx )
1918  {
1919  aPointPos.mnPointIdx = static_cast< sal_uInt16 >( nPointIdx );
1920  ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, nPointIdx );
1921  // test that the point fill style is solid, but no color is set
1922  cssd::FillStyle eFillStyle = cssd::FillStyle_NONE;
1923  if( aPointProp.GetProperty( eFillStyle, aFillStyleName ) &&
1924  (eFillStyle == cssd::FillStyle_SOLID) &&
1925  !aPointProp.HasProperty( aColorName ) )
1926  {
1927  aPointProp.SetProperty( aColorName, xColorScheme->getColorByIndex( nPointIdx ) );
1928  }
1929  }
1930  }
1931  }
1932 
1933  // data point formatting
1934  Sequence< sal_Int32 > aPointIndexes;
1935  if( aSeriesProp.GetProperty( aPointIndexes, EXC_CHPROP_ATTRIBDATAPOINTS ) && aPointIndexes.hasElements() )
1936  {
1937  for( const sal_Int32 nPointIndex : std::as_const(aPointIndexes) )
1938  {
1939  if (nPointIndex >= nMaxPointCount)
1940  break;
1941  aPointPos.mnPointIdx = static_cast< sal_uInt16 >( nPointIndex );
1942  ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, nPointIndex );
1943  XclExpChDataFormatRef xPointFmt = new XclExpChDataFormat( GetChRoot(), aPointPos, nFormatIdx );
1944  xPointFmt->ConvertDataSeries( aPointProp, rTypeInfo );
1945  maPointFmts.AppendRecord( xPointFmt );
1946  }
1947  }
1948  }
1949  }
1950  }
1951  return bOk;
1952 }
1953 
1954 bool XclExpChSeries::ConvertStockSeries( css::uno::Reference< css::chart2::XDataSeries > const & xDataSeries,
1955  std::u16string_view rValueRole, sal_uInt16 nGroupIdx, sal_uInt16 nFormatIdx, bool bCloseSymbol )
1956 {
1957  bool bOk = false;
1958  Reference< XDataSource > xDataSource( xDataSeries, UNO_QUERY );
1959  if( xDataSource.is() )
1960  {
1961  Reference< XDataSequence > xYValueSeq, xTitleSeq;
1962 
1963  // find first sequence with passed role
1964  const Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences();
1965  for( const Reference< XLabeledDataSequence >& rLabeledSeq : aLabeledSeqVec )
1966  {
1967  Reference< XDataSequence > xTmpValueSeq = rLabeledSeq->getValues();
1968  ScfPropertySet aValueProp( xTmpValueSeq );
1969  OUString aRole;
1970  if( aValueProp.GetProperty( aRole, EXC_CHPROP_ROLE ) && (aRole == rValueRole) )
1971  {
1972  xYValueSeq = xTmpValueSeq;
1973  xTitleSeq = rLabeledSeq->getLabel(); // ignore role of label sequence
1974  break;
1975  }
1976  }
1977 
1978  bOk = xYValueSeq.is();
1979  if( bOk )
1980  {
1981  // chart type group index
1982  mnGroupIdx = nGroupIdx;
1983  // convert source links
1984  maData.mnValueCount = mxValueLink->ConvertDataSequence( xYValueSeq, true );
1985  mxTitleLink->ConvertDataSequence( xTitleSeq, true );
1986  // series formatting
1987  ScfPropertySet aSeriesProp( xDataSeries );
1989  mxSeriesFmt->ConvertStockSeries( aSeriesProp, bCloseSymbol );
1990  }
1991  }
1992  return bOk;
1993 }
1994 
1995 bool XclExpChSeries::ConvertTrendLine( const XclExpChSeries& rParent, Reference< XRegressionCurve > const & xRegCurve )
1996 {
1997  InitFromParent( rParent );
1998 
2000  bool bOk = mxTrendLine->Convert( xRegCurve, mnSeriesIdx );
2001  if( bOk )
2002  {
2003  OUString aName;
2004  ScfPropertySet aProperties( xRegCurve );
2005  aProperties.GetProperty(aName, EXC_CHPROP_CURVENAME);
2006  mxTitleLink->ConvertString(aName);
2007 
2008  mxSeriesFmt = mxTrendLine->GetDataFormat();
2009  GetChartData().SetDataLabel( mxTrendLine->GetDataLabel() );
2010  }
2011  return bOk;
2012 }
2013 
2014 bool XclExpChSeries::ConvertErrorBar( const XclExpChSeries& rParent, const ScfPropertySet& rPropSet, sal_uInt8 nBarId )
2015 {
2016  InitFromParent( rParent );
2017  // error bar settings
2018  mxErrorBar = new XclExpChSerErrorBar( GetChRoot(), nBarId );
2019  bool bOk = mxErrorBar->Convert( *mxValueLink, maData.mnValueCount, rPropSet );
2020  if( bOk )
2021  {
2022  // error bar formatting
2024  mxSeriesFmt->ConvertLine( rPropSet, EXC_CHOBJTYPE_ERRORBAR );
2025  }
2026  return bOk;
2027 }
2028 
2029 void XclExpChSeries::ConvertCategSequence( Reference< XLabeledDataSequence > const & xCategSeq )
2030 {
2031  if( xCategSeq.is() )
2032  maData.mnCategCount = mxCategLink->ConvertDataSequence( xCategSeq->getValues(), false );
2033 }
2034 
2036 {
2037  lclSaveRecord( rStrm, mxTitleLink );
2038  lclSaveRecord( rStrm, mxValueLink );
2039  lclSaveRecord( rStrm, mxCategLink );
2040  lclSaveRecord( rStrm, mxBubbleLink );
2041  lclSaveRecord( rStrm, mxSeriesFmt );
2042  maPointFmts.Save( rStrm );
2047  lclSaveRecord( rStrm, mxTrendLine );
2048  lclSaveRecord( rStrm, mxErrorBar );
2049 }
2050 
2052 {
2053  // index to parent series is stored 1-based
2054  mnParentIdx = rParent.mnSeriesIdx + 1;
2055  /* #i86465# MSO2007 SP1 expects correct point counts in child series
2056  (there was no problem in Excel2003 or Excel2007 without SP1...) */
2059 }
2060 
2061 void XclExpChSeries::CreateTrendLines( css::uno::Reference< css::chart2::XDataSeries > const & xDataSeries )
2062 {
2063  Reference< XRegressionCurveContainer > xRegCurveCont( xDataSeries, UNO_QUERY );
2064  if( xRegCurveCont.is() )
2065  {
2066  const Sequence< Reference< XRegressionCurve > > aRegCurveSeq = xRegCurveCont->getRegressionCurves();
2067  for( const Reference< XRegressionCurve >& rRegCurve : aRegCurveSeq )
2068  {
2070  if( xSeries && !xSeries->ConvertTrendLine( *this, rRegCurve ) )
2072  }
2073  }
2074 }
2075 
2077  const OUString& rBarPropName, sal_uInt8 nPosBarId, sal_uInt8 nNegBarId )
2078 {
2079  Reference< XPropertySet > xErrorBar;
2080  if( rPropSet.GetProperty( xErrorBar, rBarPropName ) && xErrorBar.is() )
2081  {
2082  ScfPropertySet aErrorProp( xErrorBar );
2083  CreateErrorBar( aErrorProp, EXC_CHPROP_SHOWPOSITIVEERROR, nPosBarId );
2084  CreateErrorBar( aErrorProp, EXC_CHPROP_SHOWNEGATIVEERROR, nNegBarId );
2085  }
2086 }
2087 
2089  const OUString& rShowPropName, sal_uInt8 nBarId )
2090 {
2091  if( rPropSet.GetBoolProperty( rShowPropName ) )
2092  {
2094  if( xSeries && !xSeries->ConvertErrorBar( *this, rPropSet, nBarId ) )
2096  }
2097 }
2098 
2100 {
2102  if( GetBiff() == EXC_BIFF8 )
2104 }
2105 
2106 // Chart type groups ==========================================================
2107 
2110  XclExpChRoot( rRoot ),
2111  maTypeInfo( rRoot.GetChartTypeInfo( EXC_CHTYPEID_UNKNOWN ) )
2112 {
2113 }
2114 
2115 void XclExpChType::Convert( Reference< XDiagram > const & xDiagram, Reference< XChartType > const & xChartType,
2116  sal_Int32 nApiAxesSetIdx, bool bSwappedAxesSet, bool bHasXLabels )
2117 {
2118  if( !xChartType.is() )
2119  return;
2120 
2121  maTypeInfo = GetChartTypeInfo( xChartType->getChartType() );
2122  // special handling for some chart types
2123  switch( maTypeInfo.meTypeCateg )
2124  {
2125  case EXC_CHTYPECATEG_BAR:
2126  {
2128  ::set_flag( maData.mnFlags, EXC_CHBAR_HORIZONTAL, bSwappedAxesSet );
2129  ScfPropertySet aTypeProp( xChartType );
2130  Sequence< sal_Int32 > aInt32Seq;
2131  maData.mnOverlap = 0;
2132  if( aTypeProp.GetProperty( aInt32Seq, EXC_CHPROP_OVERLAPSEQ ) && (nApiAxesSetIdx < aInt32Seq.getLength()) )
2133  maData.mnOverlap = limit_cast< sal_Int16 >( -aInt32Seq[ nApiAxesSetIdx ], -100, 100 );
2134  maData.mnGap = 150;
2135  if( aTypeProp.GetProperty( aInt32Seq, EXC_CHPROP_GAPWIDTHSEQ ) && (nApiAxesSetIdx < aInt32Seq.getLength()) )
2136  maData.mnGap = limit_cast< sal_uInt16 >( aInt32Seq[ nApiAxesSetIdx ], 0, 500 );
2137  }
2138  break;
2139  case EXC_CHTYPECATEG_RADAR:
2141  break;
2142  case EXC_CHTYPECATEG_PIE:
2143  {
2144  ScfPropertySet aTypeProp( xChartType );
2145  bool bDonut = aTypeProp.GetBoolProperty( EXC_CHPROP_USERINGS );
2147  maData.mnPieHole = bDonut ? 50 : 0;
2148  // #i85166# starting angle of first pie slice
2149  ScfPropertySet aDiaProp( xDiagram );
2151  }
2152  break;
2154  if( GetBiff() == EXC_BIFF8 )
2156  break;
2157  default:;
2158  }
2160 }
2161 
2162 void XclExpChType::SetStacked( bool bPercent )
2163 {
2164  switch( maTypeInfo.meTypeCateg )
2165  {
2166  case EXC_CHTYPECATEG_LINE:
2169  break;
2170  case EXC_CHTYPECATEG_BAR:
2173  maData.mnOverlap = -100;
2174  break;
2175  default:;
2176  }
2177 }
2178 
2180 {
2181  switch( GetRecId() )
2182  {
2183  case EXC_ID_CHBAR:
2184  rStrm << maData.mnOverlap << maData.mnGap << maData.mnFlags;
2185  break;
2186 
2187  case EXC_ID_CHLINE:
2188  case EXC_ID_CHAREA:
2189  case EXC_ID_CHRADARLINE:
2190  case EXC_ID_CHRADARAREA:
2191  rStrm << maData.mnFlags;
2192  break;
2193 
2194  case EXC_ID_CHPIE:
2195  rStrm << maData.mnRotation << maData.mnPieHole;
2196  if( GetBiff() == EXC_BIFF8 )
2197  rStrm << maData.mnFlags;
2198  break;
2199 
2200  case EXC_ID_CHSCATTER:
2201  if( GetBiff() == EXC_BIFF8 )
2203  break;
2204 
2205  default:
2206  OSL_FAIL( "XclExpChType::WriteBody - unknown chart type" );
2207  }
2208 }
2209 
2212 {
2213 }
2214 
2215 void XclExpChChart3d::Convert( const ScfPropertySet& rPropSet, bool b3dWallChart )
2216 {
2217  sal_Int32 nRotationY = 0;
2218  rPropSet.GetProperty( nRotationY, EXC_CHPROP_ROTATIONVERTICAL );
2219  sal_Int32 nRotationX = 0;
2220  rPropSet.GetProperty( nRotationX, EXC_CHPROP_ROTATIONHORIZONTAL );
2221  sal_Int32 nPerspective = 15;
2222  rPropSet.GetProperty( nPerspective, EXC_CHPROP_PERSPECTIVE );
2223 
2224  if( b3dWallChart )
2225  {
2226  // Y rotation (Excel [0..359], Chart2 [-179,180])
2227  if( nRotationY < 0 ) nRotationY += 360;
2228  maData.mnRotation = static_cast< sal_uInt16 >( nRotationY );
2229  // X rotation a.k.a. elevation (Excel [-90..90], Chart2 [-179,180])
2230  maData.mnElevation = limit_cast< sal_Int16 >( nRotationX, -90, 90 );
2231  // perspective (Excel and Chart2 [0,100])
2232  maData.mnEyeDist = limit_cast< sal_uInt16 >( nPerspective, 0, 100 );
2233  // flags
2234  maData.mnFlags = 0;
2238  }
2239  else
2240  {
2241  // Y rotation not used in pie charts, but 'first pie slice angle'
2243  // X rotation a.k.a. elevation (map Chart2 [-80,-10] to Excel [10..80])
2244  maData.mnElevation = limit_cast< sal_Int16 >( (nRotationX + 270) % 180, 10, 80 );
2245  // perspective (Excel and Chart2 [0,100])
2246  maData.mnEyeDist = limit_cast< sal_uInt16 >( nPerspective, 0, 100 );
2247  // flags
2248  maData.mnFlags = 0;
2249  }
2250 }
2251 
2253 {
2254  rStrm << maData.mnRotation
2255  << maData.mnElevation
2256  << maData.mnEyeDist
2257  << maData.mnRelHeight
2258  << maData.mnRelDepth
2259  << maData.mnDepthGap
2260  << maData.mnFlags;
2261 }
2262 
2265 {
2266 }
2267 
2269 {
2270  // frame properties
2271  mxFrame = lclCreateFrame( GetChRoot(), rPropSet, EXC_CHOBJTYPE_LEGEND );
2272  // text properties
2273  mxText = new XclExpChText( GetChRoot() );
2274  mxText->ConvertLegend( rPropSet );
2275 
2276  // legend position and size
2277  Any aRelPosAny, aRelSizeAny;
2278  rPropSet.GetAnyProperty( aRelPosAny, EXC_CHPROP_RELATIVEPOSITION );
2279  rPropSet.GetAnyProperty( aRelSizeAny, EXC_CHPROP_RELATIVESIZE );
2280  cssc::ChartLegendExpansion eApiExpand = cssc::ChartLegendExpansion_CUSTOM;
2281  rPropSet.GetProperty( eApiExpand, EXC_CHPROP_EXPANSION );
2282  if( aRelPosAny.has< RelativePosition >() || ((eApiExpand == cssc::ChartLegendExpansion_CUSTOM) && aRelSizeAny.has< RelativeSize >()) )
2283  {
2284  try
2285  {
2286  /* The 'RelativePosition' or 'RelativeSize' properties are used as
2287  indicator of manually changed legend position/size, but due to
2288  the different anchor modes used by this property (in the
2289  RelativePosition.Anchor member) it cannot be used to calculate
2290  the position easily. For this, the Chart1 API will be used
2291  instead. */
2292  Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
2293  Reference< XShape > xChart1Legend( xChart1Doc->getLegend(), UNO_SET_THROW );
2294  // coordinates in CHLEGEND record written but not used by Excel
2296  XclChFramePos& rFramePos = mxFramePos->GetFramePosData();
2297  rFramePos.mnTLMode = EXC_CHFRAMEPOS_CHARTSIZE;
2298  css::awt::Point aLegendPos = xChart1Legend->getPosition();
2299  rFramePos.maRect.mnX = maData.maRect.mnX = CalcChartXFromHmm( aLegendPos.X );
2300  rFramePos.maRect.mnY = maData.maRect.mnY = CalcChartYFromHmm( aLegendPos.Y );
2301  // legend size, Excel expects points in CHFRAMEPOS record
2303  css::awt::Size aLegendSize = xChart1Legend->getSize();
2304  rFramePos.maRect.mnWidth = o3tl::convert(aLegendSize.Width, o3tl::Length::mm100, o3tl::Length::pt);
2305  rFramePos.maRect.mnHeight = o3tl::convert(aLegendSize.Height, o3tl::Length::mm100, o3tl::Length::pt);
2306  maData.maRect.mnWidth = CalcChartXFromHmm( aLegendSize.Width );
2307  maData.maRect.mnHeight = CalcChartYFromHmm( aLegendSize.Height );
2308  eApiExpand = cssc::ChartLegendExpansion_CUSTOM;
2309  // manual legend position implies manual plot area
2312  // a CHFRAME record with cleared auto flags is needed
2313  if( !mxFrame )
2315  mxFrame->SetAutoFlags( false, false );
2316  }
2317  catch( Exception& )
2318  {
2319  OSL_FAIL( "XclExpChLegend::Convert - cannot get legend shape" );
2321  eApiExpand = cssc::ChartLegendExpansion_HIGH;
2322  }
2323  }
2324  else
2325  {
2326  cssc2::LegendPosition eApiPos = cssc2::LegendPosition_LINE_END;
2327  rPropSet.GetProperty( eApiPos, EXC_CHPROP_ANCHORPOSITION );
2328  switch( eApiPos )
2329  {
2330  case cssc2::LegendPosition_LINE_START: maData.mnDockMode = EXC_CHLEGEND_LEFT; break;
2331  case cssc2::LegendPosition_LINE_END: maData.mnDockMode = EXC_CHLEGEND_RIGHT; break;
2332  case cssc2::LegendPosition_PAGE_START: maData.mnDockMode = EXC_CHLEGEND_TOP; break;
2333  case cssc2::LegendPosition_PAGE_END: maData.mnDockMode = EXC_CHLEGEND_BOTTOM; break;
2334  default:
2335  OSL_FAIL( "XclExpChLegend::Convert - unrecognized legend position" );
2337  eApiExpand = cssc::ChartLegendExpansion_HIGH;
2338  }
2339  }
2340  ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand == cssc::ChartLegendExpansion_HIGH );
2341 
2342  // other flags
2344  const sal_uInt16 nAutoFlags = EXC_CHLEGEND_DOCKED | EXC_CHLEGEND_AUTOPOSX | EXC_CHLEGEND_AUTOPOSY;
2346 }
2347 
2349 {
2350  lclSaveRecord( rStrm, mxFramePos );
2351  lclSaveRecord( rStrm, mxText );
2352  lclSaveRecord( rStrm, mxFrame );
2353 }
2354 
2356 {
2358 }
2359 
2362  meObjType( eObjType )
2363 {
2364 }
2365 
2367 {
2368  if( rPropSet.Is() )
2369  ConvertFrameBase( GetChRoot(), rPropSet, meObjType );
2370  else
2372 }
2373 
2375 {
2376  WriteFrameRecords( rStrm );
2377 }
2378 
2380 {
2381  rStrm << sal_uInt16(100); // Distance between bars (CHDROPBAR record).
2382 }
2383 
2384 XclExpChTypeGroup::XclExpChTypeGroup( const XclExpChRoot& rRoot, sal_uInt16 nGroupIdx ) :
2386  maType( rRoot ),
2387  maTypeInfo( maType.GetTypeInfo() )
2388 {
2389  maData.mnGroupIdx = nGroupIdx;
2390 }
2391 
2393  Reference< XDiagram > const & xDiagram, Reference< XChartType > const & xChartType,
2394  sal_Int32 nApiAxesSetIdx, bool b3dChart, bool bSwappedAxesSet, bool bHasXLabels )
2395 {
2396  // chart type settings
2397  maType.Convert( xDiagram, xChartType, nApiAxesSetIdx, bSwappedAxesSet, bHasXLabels );
2398 
2399  // spline - TODO: get from single series (#i66858#)
2400  ScfPropertySet aTypeProp( xChartType );
2401  cssc2::CurveStyle eCurveStyle;
2402  bool bSpline = aTypeProp.GetProperty( eCurveStyle, EXC_CHPROP_CURVESTYLE ) &&
2403  (eCurveStyle != cssc2::CurveStyle_LINES);
2404 
2405  // extended type info
2406  maTypeInfo.Set( maType.GetTypeInfo(), b3dChart, bSpline );
2407 
2408  // 3d chart settings
2409  if( maTypeInfo.mb3dChart ) // only true, if Excel chart supports 3d mode
2410  {
2411  mxChart3d = new XclExpChChart3d();
2412  ScfPropertySet aDiaProp( xDiagram );
2413  mxChart3d->Convert( aDiaProp, Is3dWallChart() );
2414  }
2415 }
2416 
2418  Reference< XDiagram > const & xDiagram, Reference< XChartType > const & xChartType,
2419  sal_Int32 nGroupAxesSetIdx, bool bPercent, bool bConnectBars )
2420 {
2421  Reference< XDataSeriesContainer > xSeriesCont( xChartType, UNO_QUERY );
2422  if( !xSeriesCont.is() )
2423  return;
2424 
2425  std::vector< Reference< XDataSeries > > aSeriesVec;
2426 
2427  // copy data series attached to the current axes set to the vector
2428  const Sequence< Reference< XDataSeries > > aSeriesSeq = xSeriesCont->getDataSeries();
2429  for( const Reference< XDataSeries >& rSeries : aSeriesSeq )
2430  {
2431  ScfPropertySet aSeriesProp( rSeries );
2432  sal_Int32 nSeriesAxesSetIdx(0);
2433  if( aSeriesProp.GetProperty( nSeriesAxesSetIdx, EXC_CHPROP_ATTAXISINDEX ) && (nSeriesAxesSetIdx == nGroupAxesSetIdx) )
2434  aSeriesVec.push_back( rSeries );
2435  }
2436 
2437  // Are there any series in the current axes set?
2438  if( aSeriesVec.empty() )
2439  return;
2440 
2441  // stacking direction (stacked/percent/deep 3d) from first series
2442  ScfPropertySet aSeriesProp( aSeriesVec.front() );
2443  cssc2::StackingDirection eStacking;
2444  if( !aSeriesProp.GetProperty( eStacking, EXC_CHPROP_STACKINGDIR ) )
2445  eStacking = cssc2::StackingDirection_NO_STACKING;
2446 
2447  // stacked or percent chart
2448  if( maTypeInfo.mbSupportsStacking && (eStacking == cssc2::StackingDirection_Y_STACKING) )
2449  {
2450  // percent overrides simple stacking
2451  maType.SetStacked( bPercent );
2452 
2453  // connected data points (only in stacked bar charts)
2454  if (bConnectBars && (maTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR))
2455  {
2456  sal_uInt16 nKey = EXC_CHCHARTLINE_CONNECT;
2457  m_ChartLines.insert(std::make_pair(nKey, std::make_unique<XclExpChLineFormat>(GetChRoot())));
2458  }
2459  }
2460  else
2461  {
2462  // reverse series order for some unstacked 2D chart types
2464  ::std::reverse( aSeriesVec.begin(), aSeriesVec.end() );
2465  }
2466 
2467  // deep 3d chart or clustered 3d chart (stacked is not clustered)
2468  if( (eStacking == cssc2::StackingDirection_NO_STACKING) && Is3dWallChart() )
2469  mxChart3d->SetClustered();
2470 
2471  // varied point colors
2473 
2474  // process all series
2475  for( const auto& rxSeries : aSeriesVec )
2476  {
2477  // create Excel series object, stock charts need special processing
2479  CreateAllStockSeries( xChartType, rxSeries );
2480  else
2481  CreateDataSeries( xDiagram, rxSeries );
2482  }
2483 }
2484 
2485 void XclExpChTypeGroup::ConvertCategSequence( Reference< XLabeledDataSequence > const & xCategSeq )
2486 {
2487  for( size_t nIdx = 0, nSize = maSeries.GetSize(); nIdx < nSize; ++nIdx )
2488  maSeries.GetRecord( nIdx )->ConvertCategSequence( xCategSeq );
2489 }
2490 
2492 {
2493  if( rPropSet.GetBoolProperty( EXC_CHPROP_SHOW ) )
2494  {
2495  mxLegend = new XclExpChLegend( GetChRoot() );
2496  mxLegend->Convert( rPropSet );
2497  }
2498 }
2499 
2501 {
2502  maType.Save( rStrm );
2503  lclSaveRecord( rStrm, mxChart3d );
2504  lclSaveRecord( rStrm, mxLegend );
2505  lclSaveRecord( rStrm, mxUpBar );
2506  lclSaveRecord( rStrm, mxDownBar );
2507  for (auto const& it : m_ChartLines)
2508  {
2509  lclSaveRecord( rStrm, it.second.get(), EXC_ID_CHCHARTLINE, it.first );
2510  }
2511 }
2512 
2514 {
2515  return static_cast< sal_uInt16 >( maSeries.GetSize() );
2516 }
2517 
2519  Reference< XDiagram > const & xDiagram, Reference< XDataSeries > const & xDataSeries )
2520 {
2521  // let chart create series object with correct series index
2523  if( xSeries )
2524  {
2525  if( xSeries->ConvertDataSeries( xDiagram, xDataSeries, maTypeInfo, GetGroupIdx(), GetFreeFormatIdx() ) )
2526  maSeries.AppendRecord( xSeries );
2527  else
2529  }
2530 }
2531 
2533  Reference< XChartType > const & xChartType, Reference< XDataSeries > const & xDataSeries )
2534 {
2535  // create existing series objects
2536  bool bHasOpen = CreateStockSeries( xDataSeries, EXC_CHPROP_ROLE_OPENVALUES, false );
2537  bool bHasHigh = CreateStockSeries( xDataSeries, EXC_CHPROP_ROLE_HIGHVALUES, false );
2538  bool bHasLow = CreateStockSeries( xDataSeries, EXC_CHPROP_ROLE_LOWVALUES, false );
2539  bool bHasClose = CreateStockSeries( xDataSeries, EXC_CHPROP_ROLE_CLOSEVALUES, !bHasOpen );
2540 
2541  // formatting of special stock chart elements
2542  ScfPropertySet aTypeProp( xChartType );
2543  // hi-lo lines
2544  if( bHasHigh && bHasLow && aTypeProp.GetBoolProperty( EXC_CHPROP_SHOWHIGHLOW ) )
2545  {
2546  ScfPropertySet aSeriesProp( xDataSeries );
2548  xLineFmt->Convert( GetChRoot(), aSeriesProp, EXC_CHOBJTYPE_HILOLINE );
2549  sal_uInt16 nKey = EXC_CHCHARTLINE_HILO;
2550  m_ChartLines.insert(std::make_pair(nKey, std::make_unique<XclExpChLineFormat>(GetChRoot())));
2551  }
2552  // dropbars
2553  if( !(bHasOpen && bHasClose) )
2554  return;
2555 
2556  // dropbar type is dependent on position in the file - always create both
2557  Reference< XPropertySet > xWhitePropSet, xBlackPropSet;
2558  // white dropbar format
2559  aTypeProp.GetProperty( xWhitePropSet, EXC_CHPROP_WHITEDAY );
2560  ScfPropertySet aWhiteProp( xWhitePropSet );
2562  mxUpBar->Convert( aWhiteProp );
2563  // black dropbar format
2564  aTypeProp.GetProperty( xBlackPropSet, EXC_CHPROP_BLACKDAY );
2565  ScfPropertySet aBlackProp( xBlackPropSet );
2567  mxDownBar->Convert( aBlackProp );
2568 }
2569 
2570 bool XclExpChTypeGroup::CreateStockSeries( Reference< XDataSeries > const & xDataSeries,
2571  std::u16string_view rValueRole, bool bCloseSymbol )
2572 {
2573  bool bOk = false;
2574  // let chart create series object with correct series index
2576  if( xSeries )
2577  {
2578  bOk = xSeries->ConvertStockSeries( xDataSeries,
2579  rValueRole, GetGroupIdx(), GetFreeFormatIdx(), bCloseSymbol );
2580  if( bOk )
2581  maSeries.AppendRecord( xSeries );
2582  else
2584  }
2585  return bOk;
2586 }
2587 
2589 {
2590  rStrm.WriteZeroBytes( 16 );
2591  rStrm << maData.mnFlags << maData.mnGroupIdx;
2592 }
2593 
2594 // Axes =======================================================================
2595 
2598  XclExpChRoot( rRoot )
2599 {
2600 }
2601 
2602 void XclExpChLabelRange::Convert( const ScaleData& rScaleData, const ScfPropertySet& rChart1Axis, bool bMirrorOrient )
2603 {
2604  /* Base time unit (using the property 'ExplicitTimeIncrement' from the old
2605  chart API allows to detect axis type (date axis, if property exists),
2606  and to receive the base time unit currently used in case the base time
2607  unit is set to 'automatic'. */
2608  cssc::TimeIncrement aTimeIncrement;
2609  if( rChart1Axis.GetProperty( aTimeIncrement, EXC_CHPROP_EXPTIMEINCREMENT ) )
2610  {
2611  // property exists -> this is a date axis currently
2613 
2614  // automatic base time unit, if the UNO Any 'rScaleData.TimeIncrement.TimeResolution' does not contain a valid value...
2615  bool bAutoBase = !rScaleData.TimeIncrement.TimeResolution.has< cssc::TimeIncrement >();
2617 
2618  // ...but get the current base time unit from the property of the old chart API
2619  sal_Int32 nApiTimeUnit = 0;
2620  bool bValidBaseUnit = aTimeIncrement.TimeResolution >>= nApiTimeUnit;
2621  OSL_ENSURE( bValidBaseUnit, "XclExpChLabelRange::Convert - cannot get base time unit" );
2622  maDateData.mnBaseUnit = bValidBaseUnit ? lclGetTimeUnit( nApiTimeUnit ) : EXC_CHDATERANGE_DAYS;
2623 
2624  /* Min/max values depend on base time unit, they specify the number of
2625  days, months, or years starting from null date. */
2626  bool bAutoMin = lclConvertTimeValue( GetRoot(), maDateData.mnMinDate, rScaleData.Minimum, maDateData.mnBaseUnit );
2628  bool bAutoMax = lclConvertTimeValue( GetRoot(), maDateData.mnMaxDate, rScaleData.Maximum, maDateData.mnBaseUnit );
2630  }
2631 
2632  // automatic axis type detection
2633  ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTODATE, rScaleData.AutoDateAxis );
2634 
2635  // increment
2636  bool bAutoMajor = lclConvertTimeInterval( maDateData.mnMajorStep, maDateData.mnMajorUnit, rScaleData.TimeIncrement.MajorTimeInterval );
2638  bool bAutoMinor = lclConvertTimeInterval( maDateData.mnMinorStep, maDateData.mnMinorUnit, rScaleData.TimeIncrement.MinorTimeInterval );
2640 
2641  // origin
2642  double fOrigin = 0.0;
2643  if( !lclIsAutoAnyOrGetValue( fOrigin, rScaleData.Origin ) )
2644  maLabelData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 );
2645 
2646  // reverse order
2647  if( (rScaleData.Orientation == cssc2::AxisOrientation_REVERSE) != bMirrorOrient )
2649 }
2650 
2652 {
2653  cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE;
2654  rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION );
2655  double fCrossingPos = 1.0;
2656  rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE );
2657 
2659  switch( eAxisPos )
2660  {
2661  case cssc::ChartAxisPosition_ZERO:
2662  case cssc::ChartAxisPosition_START:
2663  maLabelData.mnCross = 1;
2665  break;
2666  case cssc::ChartAxisPosition_END:
2668  break;
2669  case cssc::ChartAxisPosition_VALUE:
2670  maLabelData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 );
2672  if( bDateAxis )
2673  maDateData.mnCross = lclGetTimeValue( GetRoot(), fCrossingPos, maDateData.mnBaseUnit );
2674  break;
2675  default:
2676  maLabelData.mnCross = 1;
2678  }
2679 }
2680 
2682 {
2683  // the CHLABELRANGE record
2684  XclExpRecord::Save( rStrm );
2685 
2686  // the CHDATERANGE record with date axis settings (BIFF8 only)
2687  if( GetBiff() != EXC_BIFF8 )
2688  return;
2689 
2690  rStrm.StartRecord( EXC_ID_CHDATERANGE, 18 );
2691  rStrm << maDateData.mnMinDate
2698  << maDateData.mnCross
2699  << maDateData.mnFlags;
2700  rStrm.EndRecord();
2701 }
2702 
2704 {
2706 }
2707 
2710  XclExpChRoot( rRoot )
2711 {
2712 }
2713 
2714 void XclExpChValueRange::Convert( const ScaleData& rScaleData )
2715 {
2716  // scaling algorithm
2717  bool bLogScale = ScfApiHelper::GetServiceName( rScaleData.Scaling ) == "com.sun.star.chart2.LogarithmicScaling";
2719 
2720  // min/max
2721  bool bAutoMin = lclIsAutoAnyOrGetScaledValue( maData.mfMin, rScaleData.Minimum, bLogScale );
2723  bool bAutoMax = lclIsAutoAnyOrGetScaledValue( maData.mfMax, rScaleData.Maximum, bLogScale );
2725 
2726  // origin
2727  bool bAutoCross = lclIsAutoAnyOrGetScaledValue( maData.mfCross, rScaleData.Origin, bLogScale );
2729 
2730  // major increment
2731  const IncrementData& rIncrementData = rScaleData.IncrementData;
2732  const bool bAutoMajor = lclIsAutoAnyOrGetValue( maData.mfMajorStep, rIncrementData.Distance ) || (maData.mfMajorStep <= 0.0);
2734  // minor increment
2735  const Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements;
2736  sal_Int32 nCount = 0;
2737 
2738  // tdf#114168 If IntervalCount is 5, then enable automatic minor calculation.
2739  // During import, if minorUnit is set and majorUnit not, then it is impossible
2740  // to calculate IntervalCount.
2741  const bool bAutoMinor = bLogScale || bAutoMajor || !rSubIncrementSeq.hasElements() ||
2742  lclIsAutoAnyOrGetValue( nCount, rSubIncrementSeq[ 0 ].IntervalCount ) || (nCount < 1) || (nCount == 5);
2743 
2744  if( maData.mfMajorStep && !bAutoMinor )
2745  maData.mfMinorStep = maData.mfMajorStep / nCount;
2747 
2748  // reverse order
2749  ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_REVERSE, rScaleData.Orientation == cssc2::AxisOrientation_REVERSE );
2750 }
2751 
2753 {
2754  cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE;
2755  double fCrossingPos = 0.0;
2756  if( !(rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION ) && rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE )) )
2757  return;
2758 
2759  switch( eAxisPos )
2760  {
2761  case cssc::ChartAxisPosition_ZERO:
2762  case cssc::ChartAxisPosition_START:
2764  break;
2765  case cssc::ChartAxisPosition_END:
2767  break;
2768  case cssc::ChartAxisPosition_VALUE:
2770  maData.mfCross = ::get_flagvalue< double >( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE, log( fCrossingPos ) / log( 10.0 ), fCrossingPos );
2771  break;
2772  default:
2774  }
2775 }
2776 
2778 {
2779  rStrm << maData.mfMin
2780  << maData.mfMax
2781  << maData.mfMajorStep
2782  << maData.mfMinorStep
2783  << maData.mfCross
2784  << maData.mnFlags;
2785 }
2786 
2787 namespace {
2788 
2789 sal_uInt8 lclGetXclTickPos( sal_Int32 nApiTickmarks )
2790 {
2791  using namespace cssc2::TickmarkStyle;
2792  sal_uInt8 nXclTickPos = 0;
2793  ::set_flag( nXclTickPos, EXC_CHTICK_INSIDE, ::get_flag( nApiTickmarks, INNER ) );
2794  ::set_flag( nXclTickPos, EXC_CHTICK_OUTSIDE, ::get_flag( nApiTickmarks, OUTER ) );
2795  return nXclTickPos;
2796 }
2797 
2798 } // namespace
2799 
2801  XclExpRecord( EXC_ID_CHTICK, (rRoot.GetBiff() == EXC_BIFF8) ? 30 : 26 ),
2802  XclExpChRoot( rRoot ),
2803  mnTextColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWTEXT ) )
2804 {
2805 }
2806 
2807 void XclExpChTick::Convert( const ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo, sal_uInt16 nAxisType )
2808 {
2809  // tick mark style
2810  sal_Int32 nApiTickmarks = 0;
2811  if( rPropSet.GetProperty( nApiTickmarks, EXC_CHPROP_MAJORTICKS ) )
2812  maData.mnMajor = lclGetXclTickPos( nApiTickmarks );
2813  if( rPropSet.GetProperty( nApiTickmarks, EXC_CHPROP_MINORTICKS ) )
2814  maData.mnMinor = lclGetXclTickPos( nApiTickmarks );
2815 
2816  // axis labels
2817  if( (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) && (nAxisType == EXC_CHAXIS_X) )
2818  {
2819  /* Radar charts disable their category labels via chart type, not via
2820  axis, and axis labels are always 'near axis'. */
2822  }
2823  else if( !rPropSet.GetBoolProperty( EXC_CHPROP_DISPLAYLABELS ) )
2824  {
2825  // no labels
2827  }
2828  else if( rTypeInfo.mb3dChart && (nAxisType == EXC_CHAXIS_Y) )
2829  {
2830  // Excel expects 'near axis' at Y axes in 3D charts
2832  }
2833  else
2834  {
2835  cssc::ChartAxisLabelPosition eApiLabelPos = cssc::ChartAxisLabelPosition_NEAR_AXIS;
2836  rPropSet.GetProperty( eApiLabelPos, EXC_CHPROP_LABELPOSITION );
2837  switch( eApiLabelPos )
2838  {
2839  case cssc::ChartAxisLabelPosition_NEAR_AXIS:
2840  case cssc::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE: maData.mnLabelPos = EXC_CHTICK_NEXT; break;
2841  case cssc::ChartAxisLabelPosition_OUTSIDE_START: maData.mnLabelPos = EXC_CHTICK_LOW; break;
2842  case cssc::ChartAxisLabelPosition_OUTSIDE_END: maData.mnLabelPos = EXC_CHTICK_HIGH; break;
2843  default: maData.mnLabelPos = EXC_CHTICK_NEXT;
2844  }
2845  }
2846 }
2847 
2848 void XclExpChTick::SetFontColor( const Color& rColor, sal_uInt32 nColorId )
2849 {
2850  maData.maTextColor = rColor;
2852  mnTextColorId = nColorId;
2853 }
2854 
2855 void XclExpChTick::SetRotation( sal_uInt16 nRotation )
2856 {
2857  maData.mnRotation = nRotation;
2860 }
2861 
2863 {
2864  rStrm << maData.mnMajor
2865  << maData.mnMinor
2866  << maData.mnLabelPos
2867  << maData.mnBackMode;
2868  rStrm.WriteZeroBytes( 16 );
2869  rStrm << maData.maTextColor
2870  << maData.mnFlags;
2871  if( GetBiff() == EXC_BIFF8 )
2873 }
2874 
2875 namespace {
2876 
2878 Reference< XAxis > lclGetApiAxis( Reference< XCoordinateSystem > const & xCoordSystem,
2879  sal_Int32 nApiAxisDim, sal_Int32 nApiAxesSetIdx )
2880 {
2881  Reference< XAxis > xAxis;
2882  if( (nApiAxisDim >= 0) && xCoordSystem.is() ) try
2883  {
2884  xAxis = xCoordSystem->getAxisByDimension( nApiAxisDim, nApiAxesSetIdx );
2885  }
2886  catch( Exception& )
2887  {
2888  }
2889  return xAxis;
2890 }
2891 
2892 Reference< cssc::XAxis > lclGetApiChart1Axis( Reference< XChartDocument > const & xChartDoc,
2893  sal_Int32 nApiAxisDim, sal_Int32 nApiAxesSetIdx )
2894 {
2895  Reference< cssc::XAxis > xChart1Axis;
2896  try
2897  {
2898  Reference< cssc::XChartDocument > xChart1Doc( xChartDoc, UNO_QUERY_THROW );
2899  Reference< cssc::XAxisSupplier > xChart1AxisSupp( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
2900  switch( nApiAxesSetIdx )
2901  {
2903  xChart1Axis = xChart1AxisSupp->getAxis( nApiAxisDim );
2904  break;
2906  xChart1Axis = xChart1AxisSupp->getSecondaryAxis( nApiAxisDim );
2907  break;
2908  }
2909  }
2910  catch( Exception& )
2911  {
2912  }
2913  return xChart1Axis;
2914 }
2915 
2916 } // namespace
2917 
2918 XclExpChAxis::XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType ) :
2920  mnNumFmtIdx( EXC_FORMAT_NOTFOUND )
2921 {
2922  maData.mnType = nAxisType;
2923 }
2924 
2925 void XclExpChAxis::SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId )
2926 {
2927  mxFont = xFont;
2928  if( mxTick )
2929  mxTick->SetFontColor( rColor, nColorId );
2930 }
2931 
2932 void XclExpChAxis::SetRotation( sal_uInt16 nRotation )
2933 {
2934  if( mxTick )
2935  mxTick->SetRotation( nRotation );
2936 }
2937 
2938 void XclExpChAxis::Convert( Reference< XAxis > const & xAxis, Reference< XAxis > const & xCrossingAxis,
2939  Reference< cssc::XAxis > const & xChart1Axis, const XclChExtTypeInfo& rTypeInfo )
2940 {
2941  ScfPropertySet aAxisProp( xAxis );
2942  bool bCategoryAxis = ((GetAxisType() == EXC_CHAXIS_X) && rTypeInfo.mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z);
2943 
2944  // axis line format -------------------------------------------------------
2945 
2947  mxAxisLine->Convert( GetChRoot(), aAxisProp, EXC_CHOBJTYPE_AXISLINE );
2948  // #i58688# axis enabled
2949  mxAxisLine->SetShowAxis( aAxisProp.GetBoolProperty( EXC_CHPROP_SHOW ) );
2950 
2951  // axis scaling and increment ---------------------------------------------
2952 
2953  ScfPropertySet aCrossingProp( xCrossingAxis );
2954  if( bCategoryAxis )
2955  {
2957  mxLabelRange->SetTicksBetweenCateg( rTypeInfo.mbTicksBetweenCateg );
2958  if( xAxis.is() )
2959  {
2960  ScfPropertySet aChart1AxisProp( xChart1Axis );
2961  // #i71684# radar charts have reversed rotation direction
2962  mxLabelRange->Convert( xAxis->getScaleData(), aChart1AxisProp, (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) );
2963  }
2964  // get position of crossing axis on this axis from passed axis object
2965  if( aCrossingProp.Is() )
2966  mxLabelRange->ConvertAxisPosition( aCrossingProp );
2967  }
2968  else
2969  {
2971  if( xAxis.is() )
2972  mxValueRange->Convert( xAxis->getScaleData() );
2973  // get position of crossing axis on this axis from passed axis object
2974  if( aCrossingProp.Is() )
2975  mxValueRange->ConvertAxisPosition( aCrossingProp );
2976  }
2977 
2978  // axis caption text ------------------------------------------------------
2979 
2980  // axis ticks properties
2981  mxTick = new XclExpChTick( GetChRoot() );
2982  mxTick->Convert( aAxisProp, rTypeInfo, GetAxisType() );
2983 
2984  // axis label formatting and rotation
2985  ConvertFontBase( GetChRoot(), aAxisProp );
2986  ConvertRotationBase( aAxisProp, true );
2987 
2988  // axis number format
2989  sal_Int32 nApiNumFmt = 0;
2990  if( !bCategoryAxis && aAxisProp.GetProperty( nApiNumFmt, EXC_CHPROP_NUMBERFORMAT ) )
2991  {
2992  bool bLinkNumberFmtToSource = false;
2993  if ( !aAxisProp.GetProperty( bLinkNumberFmtToSource, EXC_CHPROP_NUMBERFORMAT_LINKSRC ) || !bLinkNumberFmtToSource )
2994  mnNumFmtIdx = GetNumFmtBuffer().Insert( static_cast< sal_uInt32 >( nApiNumFmt ) );
2995  }
2996 
2997  // grid -------------------------------------------------------------------
2998 
2999  if( !xAxis.is() )
3000  return;
3001 
3002  // main grid
3003  ScfPropertySet aGridProp( xAxis->getGridProperties() );
3004  if( aGridProp.GetBoolProperty( EXC_CHPROP_SHOW ) )
3005  mxMajorGrid = lclCreateLineFormat( GetChRoot(), aGridProp, EXC_CHOBJTYPE_GRIDLINE );
3006  // sub grid
3007  Sequence< Reference< XPropertySet > > aSubGridPropSeq = xAxis->getSubGridProperties();
3008  if( aSubGridPropSeq.hasElements() )
3009  {
3010  ScfPropertySet aSubGridProp( aSubGridPropSeq[ 0 ] );
3011  if( aSubGridProp.GetBoolProperty( EXC_CHPROP_SHOW ) )
3012  mxMinorGrid = lclCreateLineFormat( GetChRoot(), aSubGridProp, EXC_CHOBJTYPE_GRIDLINE );
3013  }
3014 }
3015 
3016 void XclExpChAxis::ConvertWall( css::uno::Reference< css::chart2::XDiagram > const & xDiagram )
3017 {
3018  if( !xDiagram.is() )
3019  return;
3020 
3021  switch( GetAxisType() )
3022  {
3023  case EXC_CHAXIS_X:
3024  {
3025  ScfPropertySet aWallProp( xDiagram->getWall() );
3026  mxWallFrame = lclCreateFrame( GetChRoot(), aWallProp, EXC_CHOBJTYPE_WALL3D );
3027  }
3028  break;
3029  case EXC_CHAXIS_Y:
3030  {
3031  ScfPropertySet aFloorProp( xDiagram->getFloor() );
3032  mxWallFrame = lclCreateFrame( GetChRoot(), aFloorProp, EXC_CHOBJTYPE_FLOOR3D );
3033  }
3034  break;
3035  default:
3036  mxWallFrame.clear();
3037  }
3038 }
3039 
3041 {
3042  lclSaveRecord( rStrm, mxLabelRange );
3043  lclSaveRecord( rStrm, mxValueRange );
3046  lclSaveRecord( rStrm, mxTick );
3047  lclSaveRecord( rStrm, mxFont );
3048  lclSaveRecord( rStrm, mxAxisLine, EXC_ID_CHAXISLINE, EXC_CHAXISLINE_AXISLINE );
3049  lclSaveRecord( rStrm, mxMajorGrid, EXC_ID_CHAXISLINE, EXC_CHAXISLINE_MAJORGRID );
3050  lclSaveRecord( rStrm, mxMinorGrid, EXC_ID_CHAXISLINE, EXC_CHAXISLINE_MINORGRID );
3051  lclSaveRecord( rStrm, mxWallFrame, EXC_ID_CHAXISLINE, EXC_CHAXISLINE_WALLS );
3052 }
3053 
3055 {
3056  rStrm << maData.mnType;
3057  rStrm.WriteZeroBytes( 16 );
3058 }
3059 
3060 XclExpChAxesSet::XclExpChAxesSet( const XclExpChRoot& rRoot, sal_uInt16 nAxesSetId ) :
3062 {
3063  maData.mnAxesSetId = nAxesSetId;
3064  SetFutureRecordContext( 0, nAxesSetId );
3065 
3066  /* Need to set a reasonable size for the plot area, otherwise Excel will
3067  move away embedded shapes while auto-sizing the plot area. This is just
3068  a wild guess, but will be fixed with implementing manual positioning of
3069  chart elements. */
3070  maData.maRect.mnX = 262;
3071  maData.maRect.mnY = 626;
3072  maData.maRect.mnWidth = 3187;
3073  maData.maRect.mnHeight = 2633;
3074 }
3075 
3076 sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > const & xDiagram, sal_uInt16 nFirstGroupIdx )
3077 {
3078  /* First unused chart type group index is passed to be able to continue
3079  counting of chart type groups for secondary axes set. */
3080  sal_uInt16 nGroupIdx = nFirstGroupIdx;
3081  Reference< XCoordinateSystemContainer > xCoordSysCont( xDiagram, UNO_QUERY );
3082  if( xCoordSysCont.is() )
3083  {
3084  Sequence< Reference< XCoordinateSystem > > aCoordSysSeq = xCoordSysCont->getCoordinateSystems();
3085  if( aCoordSysSeq.hasElements() )
3086  {
3087  /* Process first coordinate system only. Import filter puts all
3088  chart types into one coordinate system. */
3089  Reference< XCoordinateSystem > xCoordSystem = aCoordSysSeq[ 0 ];
3090  sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex();
3091 
3092  // 3d mode
3093  bool b3dChart = xCoordSystem.is() && (xCoordSystem->getDimension() == 3);
3094 
3095  // percent charts
3096  namespace ApiAxisType = cssc2::AxisType;
3097  Reference< XAxis > xApiYAxis = lclGetApiAxis( xCoordSystem, EXC_CHART_AXIS_Y, nApiAxesSetIdx );
3098  bool bPercent = xApiYAxis.is() && (xApiYAxis->getScaleData().AxisType == ApiAxisType::PERCENT);
3099 
3100  // connector lines in bar charts
3101  ScfPropertySet aDiaProp( xDiagram );
3102  bool bConnectBars = aDiaProp.GetBoolProperty( EXC_CHPROP_CONNECTBARS );
3103 
3104  // swapped axes sets
3105  ScfPropertySet aCoordSysProp( xCoordSystem );
3106  bool bSwappedAxesSet = aCoordSysProp.GetBoolProperty( EXC_CHPROP_SWAPXANDYAXIS );
3107 
3108  // X axis for later use
3109  Reference< XAxis > xApiXAxis = lclGetApiAxis( xCoordSystem, EXC_CHART_AXIS_X, nApiAxesSetIdx );
3110  // X axis labels
3111  ScfPropertySet aXAxisProp( xApiXAxis );
3112  bool bHasXLabels = aXAxisProp.GetBoolProperty( EXC_CHPROP_DISPLAYLABELS );
3113 
3114  // process chart types
3115  Reference< XChartTypeContainer > xChartTypeCont( xCoordSystem, UNO_QUERY );
3116  if( xChartTypeCont.is() )
3117  {
3118  const Sequence< Reference< XChartType > > aChartTypeSeq = xChartTypeCont->getChartTypes();
3119  for( const Reference< XChartType >& rChartType : aChartTypeSeq )
3120  {
3121  XclExpChTypeGroupRef xTypeGroup = new XclExpChTypeGroup( GetChRoot(), nGroupIdx );
3122  xTypeGroup->ConvertType( xDiagram, rChartType, nApiAxesSetIdx, b3dChart, bSwappedAxesSet, bHasXLabels );
3123  /* If new chart type group cannot be inserted into a combination
3124  chart with existing type groups, insert all series into last
3125  contained chart type group instead of creating a new group. */
3126  XclExpChTypeGroupRef xLastGroup = GetLastTypeGroup();
3127  if( xLastGroup && !(xTypeGroup->IsCombinable2d() && xLastGroup->IsCombinable2d()) )
3128  {
3129  xLastGroup->ConvertSeries( xDiagram, rChartType, nApiAxesSetIdx, bPercent, bConnectBars );
3130  }
3131  else
3132  {
3133  xTypeGroup->ConvertSeries( xDiagram, rChartType, nApiAxesSetIdx, bPercent, bConnectBars );
3134  if( xTypeGroup->IsValidGroup() )
3135  {
3136  maTypeGroups.AppendRecord( xTypeGroup );
3137  ++nGroupIdx;
3138  }
3139  }
3140  }
3141  }
3142 
3143  if( XclExpChTypeGroup* pGroup = GetFirstTypeGroup().get() )
3144  {
3145  const XclChExtTypeInfo& rTypeInfo = pGroup->GetTypeInfo();
3146 
3147  // create axes according to chart type (no axes for pie and donut charts)
3148  if( rTypeInfo.meTypeCateg != EXC_CHTYPECATEG_PIE )
3149  {
3152  if( pGroup->Is3dDeepChart() )
3154  }
3155 
3156  // X axis category ranges
3157  if( rTypeInfo.mbCategoryAxis && xApiXAxis.is() )
3158  {
3159  const ScaleData aScaleData = xApiXAxis->getScaleData();
3160  for( size_t nIdx = 0, nSize = maTypeGroups.GetSize(); nIdx < nSize; ++nIdx )
3161  maTypeGroups.GetRecord( nIdx )->ConvertCategSequence( aScaleData.Categories );
3162  }
3163 
3164  // legend
3165  if( xDiagram.is() && (GetAxesSetId() == EXC_CHAXESSET_PRIMARY) )
3166  {
3167  Reference< XLegend > xLegend = xDiagram->getLegend();
3168  if( xLegend.is() )
3169  {
3170  ScfPropertySet aLegendProp( xLegend );
3171  pGroup->ConvertLegend( aLegendProp );
3172  }
3173  }
3174  }
3175  }
3176  }
3177 
3178  // wall/floor/diagram frame formatting
3179  if( xDiagram.is() && (GetAxesSetId() == EXC_CHAXESSET_PRIMARY) )
3180  {
3181  XclExpChTypeGroupRef xTypeGroup = GetFirstTypeGroup();
3182  if( xTypeGroup && xTypeGroup->Is3dWallChart() )
3183  {
3184  // wall/floor formatting (3D charts)
3185  if( mxXAxis )
3186  mxXAxis->ConvertWall( xDiagram );
3187  if( mxYAxis )
3188  mxYAxis->ConvertWall( xDiagram );
3189  }
3190  else
3191  {
3192  // diagram background formatting
3193  ScfPropertySet aWallProp( xDiagram->getWall() );
3194  mxPlotFrame = lclCreateFrame( GetChRoot(), aWallProp, EXC_CHOBJTYPE_PLOTFRAME );
3195  }
3196  }
3197 
3198  // inner and outer plot area position and size
3199  try
3200  {
3201  Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
3202  Reference< cssc::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
3203  // set manual flag in chart data
3204  if( !xPositioning->isAutomaticDiagramPositioning() )
3206  // the CHAXESSET record contains the inner plot area
3207  maData.maRect = CalcChartRectFromHmm( xPositioning->calculateDiagramPositionExcludingAxes() );
3208  // the embedded CHFRAMEPOS record contains the outer plot area
3210  // for pie charts, always use inner plot area size to exclude the data labels as Excel does
3211  const XclExpChTypeGroup* pFirstTypeGroup = GetFirstTypeGroup().get();
3212  bool bPieChart = pFirstTypeGroup && (pFirstTypeGroup->GetTypeInfo().meTypeCateg == EXC_CHTYPECATEG_PIE);
3213  mxFramePos->GetFramePosData().maRect = bPieChart ? maData.maRect :
3214  CalcChartRectFromHmm( xPositioning->calculateDiagramPositionIncludingAxes() );
3215  }
3216  catch( Exception& )
3217  {
3218  }
3219 
3220  // return first unused chart type group index for next axes set
3221  return nGroupIdx;
3222 }
3223 
3225 {
3226  XclExpChTypeGroupRef xTypeGroup = GetFirstTypeGroup();
3227  return xTypeGroup && xTypeGroup->Is3dChart();
3228 }
3229 
3231 {
3232  lclSaveRecord( rStrm, mxFramePos );
3233  lclSaveRecord( rStrm, mxXAxis );
3234  lclSaveRecord( rStrm, mxYAxis );
3235  lclSaveRecord( rStrm, mxZAxis );
3236  lclSaveRecord( rStrm, mxXAxisTitle );
3237  lclSaveRecord( rStrm, mxYAxisTitle );
3238  lclSaveRecord( rStrm, mxZAxisTitle );
3239  if( mxPlotFrame )
3240  {
3242  mxPlotFrame->Save( rStrm );
3243  }
3244  maTypeGroups.Save( rStrm );
3245 }
3246 
3248 {
3249  return maTypeGroups.GetFirstRecord();
3250 }
3251 
3253 {
3254  return maTypeGroups.GetLastRecord();
3255 }
3256 
3258  XclExpChAxisRef& rxChAxis, sal_uInt16 nAxisType,
3259  XclExpChTextRef& rxChAxisTitle, sal_uInt16 nTitleTarget,
3260  Reference< XCoordinateSystem > const & xCoordSystem, const XclChExtTypeInfo& rTypeInfo,
3261  sal_Int32 nCrossingAxisDim )
3262 {
3263  // create and convert axis object
3264  rxChAxis = new XclExpChAxis( GetChRoot(), nAxisType );
3265  sal_Int32 nApiAxisDim = rxChAxis->GetApiAxisDimension();
3266  sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex();
3267  Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx );
3268  Reference< XAxis > xCrossingAxis = lclGetApiAxis( xCoordSystem, nCrossingAxisDim, nApiAxesSetIdx );
3269  Reference< cssc::XAxis > xChart1Axis = lclGetApiChart1Axis( GetChartDocument(), nApiAxisDim, nApiAxesSetIdx );
3270  rxChAxis->Convert( xAxis, xCrossingAxis, xChart1Axis, rTypeInfo );
3271 
3272  // create and convert axis title
3273  Reference< XTitled > xTitled( xAxis, UNO_QUERY );
3274  rxChAxisTitle = lclCreateTitle( GetChRoot(), xTitled, nTitleTarget );
3275 }
3276 
3278 {
3279  rStrm << maData.mnAxesSetId << maData.maRect;
3280 }
3281 
3282 // The chart object ===========================================================
3283 
3284 static void lcl_getChartSubTitle(const Reference<XChartDocument>& xChartDoc,
3285  OUString& rSubTitle)
3286 {
3287  Reference< css::chart::XChartDocument > xChartDoc1(xChartDoc, UNO_QUERY);
3288  if (!xChartDoc1.is())
3289  return;
3290 
3291  Reference< XPropertySet > xProp(xChartDoc1->getSubTitle(), UNO_QUERY);
3292  if (!xProp.is())
3293  return;
3294 
3295  OUString aTitle;
3296  Any any = xProp->getPropertyValue("String");
3297  if (any >>= aTitle)
3298  rSubTitle = aTitle;
3299 }
3300 
3302  Reference< XChartDocument > const & xChartDoc, const tools::Rectangle& rChartRect ) :
3304 {
3305  Size aPtSize = o3tl::convert( rChartRect.GetSize(), o3tl::Length::mm100, o3tl::Length::pt );
3306  // rectangle is stored in 16.16 fixed-point format
3307  maRect.mnX = maRect.mnY = 0;
3308  maRect.mnWidth = static_cast< sal_Int32 >( aPtSize.Width() << 16 );
3309  maRect.mnHeight = static_cast< sal_Int32 >( aPtSize.Height() << 16 );
3310 
3311  // global chart properties (default values)
3315 
3316  // always create both axes set objects
3317  mxPrimAxesSet = std::make_shared<XclExpChAxesSet>( GetChRoot(), EXC_CHAXESSET_PRIMARY );
3318  mxSecnAxesSet = std::make_shared<XclExpChAxesSet>( GetChRoot(), EXC_CHAXESSET_SECONDARY );
3319 
3320  if( !xChartDoc.is() )
3321  return;
3322 
3323  Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
3324 
3325  // global chart properties (only 'include hidden cells' attribute for now)
3326  ScfPropertySet aDiagramProp( xDiagram );
3327  bool bIncludeHidden = aDiagramProp.GetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS );
3329 
3330  // initialize API conversion (remembers xChartDoc and rChartRect internally)
3331  InitConversion( xChartDoc, rChartRect );
3332 
3333  // chart frame
3334  ScfPropertySet aFrameProp( xChartDoc->getPageBackground() );
3335  mxFrame = lclCreateFrame( GetChRoot(), aFrameProp, EXC_CHOBJTYPE_BACKGROUND );
3336 
3337  // chart title
3338  Reference< XTitled > xTitled( xChartDoc, UNO_QUERY );
3339  OUString aSubTitle;
3340  lcl_getChartSubTitle(xChartDoc, aSubTitle);
3341  mxTitle = lclCreateTitle( GetChRoot(), xTitled, EXC_CHOBJLINK_TITLE,
3342  !aSubTitle.isEmpty() ? &aSubTitle : nullptr );
3343 
3344  // diagrams (axes sets)
3345  sal_uInt16 nFreeGroupIdx = mxPrimAxesSet->Convert( xDiagram, 0 );
3346  if( !mxPrimAxesSet->Is3dChart() )
3347  mxSecnAxesSet->Convert( xDiagram, nFreeGroupIdx );
3348 
3349  // treatment of missing values
3350  ScfPropertySet aDiaProp( xDiagram );
3351  sal_Int32 nMissingValues = 0;
3352  if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) )
3353  {
3354  using namespace cssc::MissingValueTreatment;
3355  switch( nMissingValues )
3356  {
3357  case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break;
3358  case USE_ZERO: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_ZERO; break;
3359  case CONTINUE: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_INTERPOLATE; break;
3360  }
3361  }
3362 
3363  // finish API conversion
3364  FinishConversion();
3365 }
3366 
3368 {
3369  XclExpChSeriesRef xSeries;
3370  sal_uInt16 nSeriesIdx = static_cast< sal_uInt16 >( maSeries.GetSize() );
3371  if( nSeriesIdx <= EXC_CHSERIES_MAXSERIES )
3372  {
3373  xSeries = new XclExpChSeries( GetChRoot(), nSeriesIdx );
3374  maSeries.AppendRecord( xSeries );
3375  }
3376  return xSeries;
3377 }
3378 
3380 {
3381  if( !maSeries.IsEmpty() )
3383 }
3384 
3386 {
3387  if( xText )
3388  maLabels.AppendRecord( xText );
3389 }
3390 
3392 {
3393  // this flag does not exist in BIFF5
3394  if( GetBiff() == EXC_BIFF8 )
3396 }
3397 
3399 {
3400  // background format
3401  lclSaveRecord( rStrm, mxFrame );
3402 
3403  // data series
3404  maSeries.Save( rStrm );
3405 
3406  // CHPROPERTIES record
3407  rStrm.StartRecord( EXC_ID_CHPROPERTIES, 4 );
3408  rStrm << maProps.mnFlags << maProps.mnEmptyMode << sal_uInt8( 0 );
3409  rStrm.EndRecord();
3410 
3411  // axes sets (always save primary axes set)
3412  sal_uInt16 nUsedAxesSets = mxSecnAxesSet->IsValidAxesSet() ? 2 : 1;
3413  XclExpUInt16Record( EXC_ID_CHUSEDAXESSETS, nUsedAxesSets ).Save( rStrm );
3414  mxPrimAxesSet->Save( rStrm );
3415  if( mxSecnAxesSet->IsValidAxesSet() )
3416  mxSecnAxesSet->Save( rStrm );
3417 
3418  // chart title and data labels
3419  lclSaveRecord( rStrm, mxTitle );
3420  maLabels.Save( rStrm );
3421 }
3422 
3424 {
3425  rStrm << maRect;
3426 }
3427 
3429  const Reference< XModel >& rxModel, const Size& rChartSize ) :
3430  XclExpRoot( rRoot )
3431 {
3432  if( rChartSize.IsEmpty() )
3433  return;
3434 
3435  ScfPropertySet aPropSet( rxModel );
3436  Reference< XShapes > xShapes;
3437  if( !(aPropSet.GetProperty( xShapes, EXC_CHPROP_ADDITIONALSHAPES ) && xShapes.is() && (xShapes->getCount() > 0)) )
3438  return;
3439 
3440  /* Create a new independent object manager with own DFF stream for the
3441  DGCONTAINER, pass global manager as parent for shared usage of
3442  global DFF data (picture container etc.). */
3443  mxObjMgr = std::make_shared<XclExpEmbeddedObjectManager>( GetObjectManager(), rChartSize, EXC_CHART_TOTALUNITS, EXC_CHART_TOTALUNITS );
3444  // initialize the drawing object list
3445  mxObjMgr->StartSheet();
3446  // process the draw page (convert all shapes)
3447  mxObjRecs = mxObjMgr->ProcessDrawing( xShapes );
3448  // finalize the DFF stream
3449  mxObjMgr->EndDocument();
3450 }
3451 
3453 {
3454 }
3455 
3457 {
3458  if( mxObjRecs )
3459  mxObjRecs->Save( rStrm );
3460 }
3461 
3462 XclExpChart::XclExpChart( const XclExpRoot& rRoot, Reference< XModel > const & xModel, const tools::Rectangle& rChartRect ) :
3464  XclExpRoot( rRoot )
3465 {
3466  AppendNewRecord( new XclExpChartPageSettings( rRoot ) );
3468  AppendNewRecord( new XclExpChartDrawing( rRoot, xModel, rChartRect.GetSize() ) );
3470 
3471  Reference< XChartDocument > xChartDoc( xModel, UNO_QUERY );
3472  AppendNewRecord( new XclExpChChart( rRoot, xChartDoc, rChartRect ) );
3473 }
3474 
3475 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetValue(const Type &rValue)
Sets a new record value.
Definition: xerecord.hxx:210
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:2500
XclChPropertyMode
Specifies the type of a formatting.
Definition: xlchart.hxx:1080
Color maTextColor
Definition: xlchart.hxx:1045
const sal_uInt16 EXC_CHSERGROUP_NONE
Definition: xlchart.hxx:611
ObjectType meObjType
SC_DLLPUBLIC const css::uno::Reference< css::i18n::XBreakIterator > & GetBreakIterator()
Definition: documen6.cxx:40
XclFontPropSetHelper & GetFontPropSetHelper() const
Returns the property set helper for fonts.
Definition: xlroot.cxx:418
const sal_uInt8 EXC_CHPROPS_EMPTY_SKIP
Manual plot area layout in CHFRAMEPOS record.
Definition: xlchart.hxx:603
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
Definition: token.cxx:2281
Color maPattColor
Definition: xlchart.hxx:800
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:47
Type
XclExpChAxis(const XclExpChRoot &rRoot, sal_uInt16 nAxisType)
Definition: xechart.cxx:2918
XclChDataFormat maData
Definition: xechart.hxx:641
const sal_uInt16 EXC_CHDATERANGE_AUTOMAJOR
Definition: xlchart.hxx:713
XclExpChTextRef mxXAxisTitle
The Z axis (CHAXIS group).
Definition: xechart.hxx:1109
sal_uInt16 mnValueCount
Number of category entries.
Definition: xlchart.hxx:944
XclExpChFrLabelProps(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1098
const sal_uInt16 EXC_ID_CHPICFORMAT
true = 2d wall/gridlines, no floor.
Definition: xlchart.hxx:544
virtual void Save(XclExpStream &rStrm) override
Writes the complete record list.
Definition: xerecord.hxx:375
XclExpChSeriesRef CreateSeries()
Creates, registers and returns a new data series object.
Definition: xechart.cxx:3367
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
XclExpChLineFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:492
const XclChTypeInfo & GetTypeInfo() const
Returns the chart type info struct for the contained chart type.
Definition: xechart.hxx:781
OUString maType
const sal_uInt16 EXC_CHFRBLOCK_TYPE_AXESSET
Definition: xlchart.hxx:178
formula::FormulaToken * AddExternalDoubleReference(sal_uInt16 nFileId, const svl::SharedString &rTabName, const ScComplexRefData &rRef)
Definition: token.cxx:2312
const sal_Int32 EXC_CHART_TOTALUNITS
API secondary axes set index.
Definition: xlchart.hxx:162
bool HasLine() const
Returns true, if the line style is set to something visible.
Definition: xechart.hxx:241
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:3040
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:691
XclExpChFrameRef mxPlotFrame
The Z axis title (CHTEXT group).
Definition: xechart.hxx:1112
const XclExpChRoot & GetChRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xechart.hxx:91
XclChFrBlockVector maUnwrittenFrBlocks
Stack of future record levels already written out.
Definition: xechart.cxx:235
const sal_uInt8 EXC_CHTICK_OUTSIDE
Definition: xlchart.hxx:403
const sal_uInt16 EXC_ID_CHBAR
Definition: xlchart.hxx:347
Text boxes (titles, data point labels).
Definition: xlchart.hxx:1117
XclExpChAreaFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:573
const sal_uInt8 EXC_CH3DDATAFORMAT_STRAIGHT
Circular base.
Definition: xlchart.hxx:699
XclExpChGroupBase(const XclExpChRoot &rRoot, sal_uInt16 nFrType, sal_uInt16 nRecId, std::size_t nRecSize=0)
Definition: xechart.cxx:421
XclExpChDropBarRef mxDownBar
White dropbars (CHDROPBAR group).
Definition: xechart.hxx:935
const sal_uInt16 EXC_CHAXESSET_PRIMARY
Definition: xlchart.hxx:582
sal_uInt8 mnEmptyMode
Additional flags.
Definition: xlchart.hxx:999
double mfScale
Additional flags.
Definition: xlchart.hxx:827
constexpr OUStringLiteral EXC_CHPROP_SHOWHIGHLOW
Definition: xlchart.hxx:118
XclExpChSourceLinkRef mxSrcLink
Relative text frame position (CHFRAMEPOS record).
Definition: xechart.hxx:527
void RegisterFutureRecBlock(const XclChFrBlock &rFrBlock)
Called from XclExpChGroupBase::Save, registers a new future record level.
Definition: xechart.cxx:406
The CH3DDATAFORMAT record containing the bar type in 3D bar charts.
Definition: xechart.hxx:586
XclExpChFramePosRef mxFramePos
Contents of the CHAXESSET record.
Definition: xechart.hxx:1105
const sal_uInt16 EXC_ID_CHAREAFORMAT
Definition: xlchart.hxx:293
sal_uInt8 mnBackMode
Position of labels relative to axis.
Definition: xlchart.hxx:1049
constexpr OUStringLiteral EXC_CHPROP_LABELPOSITION
Definition: xlchart.hxx:89
sal_uInt32 RegisterColor(sal_uInt16 nPropId)
Inserts a color from the contained Escher property set into the color palette.
Definition: xechart.cxx:698
Base class for complex chart classes, provides access to other components of the chart.
Definition: xechart.hxx:79
const sal_uInt16 EXC_ID_CHSERIES
Definition: xlchart.hxx:224
The CHPIEFORMAT record containing data point formatting data for pie segments.
Definition: xechart.hxx:574
bool Convert(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts area formatting properties from the passed property set.
Definition: xechart.cxx:580
const sal_uInt16 EXC_ID_CHFRAMEPOS
Definition: xlchart.hxx:638
void RegisterFutureRecBlock(const XclChFrBlock &rFrBlock)
Registers a new future record level.
Definition: xechart.cxx:247
void SetStacked(bool bPercent)
Sets stacking mode (standard or percent) for the series in this chart type group. ...
Definition: xechart.cxx:2162
void CreateErrorBars(const ScfPropertySet &rPropSet, const OUString &rBarPropName, sal_uInt8 nPosBarId, sal_uInt8 nNegBarId)
Tries to create positive and negative error bar series objects (called at parent series).
Definition: xechart.cxx:2076
XclChLabelRange maLabelData
Definition: xechart.hxx:963
const sal_Int32 EXC_CHART_AXESSET_SECONDARY
API primary axes set index.
Definition: xlchart.hxx:160
constexpr OUStringLiteral EXC_CHPROP_MISSINGVALUETREATMENT
Definition: xlchart.hxx:95
XclExpChSourceLinkRef mxValueLink
Link data for series title.
Definition: xechart.hxx:748
bool ConvertDataSeries(css::uno::Reference< css::chart2::XDiagram > const &xDiagram, css::uno::Reference< css::chart2::XDataSeries > const &xDataSeries, const XclChExtTypeInfo &rTypeInfo, sal_uInt16 nGroupIdx, sal_uInt16 nFormatIdx)
Converts the passed data series (source links and formatting).
Definition: xechart.cxx:1835
Stores global data needed in various classes of the Chart export filter.
Definition: xechart.cxx:229
const sal_uInt8 EXC_CHSERERR_YPLUS
Definition: xlchart.hxx:672
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:1613
Contains all page (print) settings records for a chart object.
Definition: xepage.hxx:111
const sal_uInt16 EXC_ID_CHFRBLOCKBEGIN
Definition: xlchart.hxx:175
const sal_uInt16 EXC_CHTEXT_POS_AUTO
Definition: xlchart.hxx:493
const sal_uInt8 EXC_CHSERERR_CUSTOM
Definition: xlchart.hxx:678
Represents a complete substream of records enclosed into a pair of BOF/EOF records.
Definition: xerecord.hxx:409
This class is used to export Excel record streams.
Definition: xestream.hxx:72
const sal_uInt8 EXC_CHSERERR_STDERR
Definition: xlchart.hxx:679
Contains information for a chart type.
Definition: xlchart.hxx:1206
SCROW Row() const
Definition: address.hxx:274
sal_uInt16 GetAxisType() const
Returns the type of this axis.
Definition: xechart.hxx:1035
sal_uInt16 mnFlags
Marker type (none, diamond, ...).
Definition: xlchart.hxx:892
sal_uInt16 mnType
Definition: xlchart.hxx:769
XclChFrameType
Enumerates different types to handle missing frame objects.
Definition: xlchart.hxx:1131
XclExpRecordRef mxSeriesFmt
Pie segment format (CHPIEFORMAT record).
Definition: xechart.hxx:644
const sal_uInt8 EXC_CHSRCLINK_WORKSHEET
Definition: xlchart.hxx:661
bool Convert(XclExpChSourceLink &rValueLink, sal_uInt16 &rnValueCount, const ScfPropertySet &rPropSet)
Converts the passed error bar settings, returns true if error bar type is supported.
Definition: xechart.cxx:1730
sal_Int32 mnX
Definition: xlchart.hxx:744
Background area of a cell.
Definition: xestyle.hxx:50
XclExpChAttLabelRef mxAttLabel
3D bar format (CH3DDATAFORMAT record).
Definition: xechart.hxx:646
const sal_uInt16 EXC_CHLEGEND_STACKED
Definition: xlchart.hxx:342
void FinalizeFutureRecBlock(XclExpStream &rStrm)
Called from XclExpChGroupBase::Save, finalizes the current future record level.
Definition: xechart.cxx:416
void SetAuto(bool bAuto)
Sets or clears the automatic flag.
Definition: xechart.hxx:265
constexpr OUStringLiteral EXC_CHPROP_CROSSOVERPOSITION
Definition: xlchart.hxx:62
EscherPropSetRef mxEscherSet
Item set for Escher properties import.
Definition: xlchart.hxx:817
virtual void Save(XclExpStream &rStrm) override
Saves the header record.
Definition: xechart.cxx:433
sal_Int32 mnDefaultLabelPos
Mode for varying point colors.
Definition: xlchart.hxx:1213
XclChFramePos maData
Definition: xechart.hxx:217
const sal_uInt16 EXC_CHFRBLOCK_TYPE_LEGEND
Definition: xlchart.hxx:184
const sal_uInt16 EXC_CHDATERANGE_DAYS
Recognize date/text automatically.
Definition: xlchart.hxx:720
const sal_uInt16 EXC_ID_CHPLOTFRAME
Definition: xlchart.hxx:530
sal_uInt16 mnBackMode
Vertical alignment.
Definition: xlchart.hxx:876
bool IsAuto() const
Returns true, if the line format is set to automatic.
Definition: xechart.hxx:239
static sal_uInt8 GetXclOrientFromRot(sal_uInt16 nXclRot)
Calculates BIFF2-BIFF5 text orientation from BIFF8 rotation angle.
Definition: xltools.cxx:189
sal_uInt16 mnRelHeight
Eye distance to chart (0...100).
Definition: xlchart.hxx:970
const sal_uInt16 EXC_ID_CHFORMAT
Definition: xlchart.hxx:634
bool IsDefault(XclChFrameType eDefFrameType) const
Returns true, if the area contains default formatting according to the passed frame type...
Definition: xechart.cxx:632
const sal_uInt16 EXC_CHSERIES_MAXSERIES
Definition: xlchart.hxx:231
const sal_uInt16 EXC_CHOBJLINK_YAXIS
Chart title.
Definition: xlchart.hxx:507
sal_uInt16 mnBubbleSize
Hole size in donut chart (CHPIE).
Definition: xlchart.hxx:958
Record identifier and empty flags field.
Definition: xlconst.hxx:239
void ConvertLineFormat(XclChLineFormat &rLineFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode) const
Reads all line properties from the passed property set.
Definition: xechart.cxx:371
const sal_uInt8 EXC_CH3DDATAFORMAT_CIRC
Rectangular base.
Definition: xlchart.hxx:697
void AppendRecord(RecType *pRec)
Appends a record to the list.
Definition: xerecord.hxx:348
bool Convert(css::uno::Reference< css::chart2::XRegressionCurve > const &xRegCurve, sal_uInt16 nSeriesIdx)
Converts the passed trend line, returns true if trend line type is supported.
Definition: xechart.cxx:1637
XclExpChType maType
Contents of the CHTYPEGROUP record.
Definition: xechart.hxx:929
virtual bool HasSubRecords() const
Derived classes return whether there are any records embedded in this group.
Definition: xechart.cxx:453
XclExpChLabelRange(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2596
const sal_uInt8 EXC_CHTICK_INSIDE
Definition: xlchart.hxx:402
const sal_uInt16 EXC_CHTEXT_AUTOGEN
Label text generated from chart data.
Definition: xlchart.hxx:476
const sal_uInt16 EXC_ID_CHFORMATRUNS
Definition: xlchart.hxx:648
Series trend line.
Definition: xlchart.hxx:1123
XclExpChSerErrorBar(const XclExpChRoot &rRoot, sal_uInt8 nBarType)
Definition: xechart.cxx:1723
bool IsSeriesFormat() const
Returns true, if this objects describes the formatting of an entire series.
Definition: xechart.hxx:632
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:193
const sal_uInt16 EXC_CHTEXT_POS_RIGHT
Definition: xlchart.hxx:492
Series formatting in a chart supporting line formatting only.
Definition: xlchart.hxx:1119
constexpr OUStringLiteral EXC_CHPROP_ANCHORPOSITION
Definition: xlchart.hxx:55
Represents the CHTYPEGROUP record group describing a group of series.
Definition: xechart.hxx:874
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:2348
const sal_uInt8 EXC_CHSRCLINK_DIRECTLY
Definition: xlchart.hxx:660
Bar charts (horizontal or vertical).
Definition: xlchart.hxx:1190
const sal_uInt16 EXC_CHATTLABEL_SHOWPERCENT
Definition: xlchart.hxx:307
XclExpChChart(const XclExpRoot &rRoot, css::uno::Reference< css::chart2::XChartDocument > const &xChartDoc, const tools::Rectangle &rChartRect)
Definition: xechart.cxx:3301
XclExpRecordList< XclExpChText > maLabels
Chart title (CHTEXT group).
Definition: xechart.hxx:1160
std::map< sal_uInt16, std::unique_ptr< XclExpChLineFormat > > m_ChartLines
Black dropbars (CHDROPBAR group).
Definition: xechart.hxx:937
XclExpChAxesSet(const XclExpChRoot &rRoot, sal_uInt16 nAxesSetId)
Definition: xechart.cxx:3060
const sal_uInt8 EXC_CHSRCLINK_TITLE
Definition: xlchart.hxx:654
bool IsSystemColor(const Color &rColor, sal_uInt16 nSysColorIdx) const
Returns true, if the passed color equals to the specified system color.
Definition: xechart.cxx:338
sal_Int32 CalcChartYFromHmm(sal_Int32 nPosY) const
Converts the passed vertical coordinate from 1/100 mm to Excel chart units.
Definition: xechart.cxx:356
virtual ~XclExpChRoot() override
Definition: xechart.cxx:299
virtual void SetFont(XclExpChFontRef xFont, const Color &rColor, sal_uInt32 nColorId) override
Sets font color and color identifier to internal data structures.
Definition: xechart.cxx:2925
void SetDefaultFrameBase(const XclExpChRoot &rRoot, XclChFrameType eDefFrameType, bool bIsFrame)
Sets the frame formatting to the specified default type.
Definition: xechart.cxx:752
virtual void SetFont(XclExpChFontRef xFont, const Color &rColor, sal_uInt32 nColorId) override
Sets font color and color identifier to internal data structures.
Definition: xechart.cxx:1155
const sal_uInt16 EXC_ID_CHTEXT
No default text available.
Definition: xlchart.hxx:460
const sal_uInt16 EXC_CHFRAMEPOS_CHARTSIZE
Definition: xlchart.hxx:644
Reference< XFrame > xFrame
const sal_uInt8 EXC_CHTEXT_ALIGN_TOPLEFT
Definition: xlchart.hxx:462
sal_uInt16 Insert(const XclFontData &rFontData, XclExpColorType eColorType, bool bAppFont=false)
Inserts a new font with the passed font data into the buffer if not present.
Definition: xestyle.cxx:1192
XclExpChFrameRef mxWallFrame
Minor grid line format (CHLINEFORMAT record).
Definition: xechart.hxx:1054
double mfForecastBack
Counter to forecast forward.
Definition: xlchart.hxx:918
const sal_uInt16 EXC_CHAXISLINE_AXISLINE
Definition: xlchart.hxx:443
const sal_uInt16 EXC_CHVALUERANGE_MAXCROSS
Axis direction reversed.
Definition: xlchart.hxx:428
High/low lines in stock charts.
Definition: xlchart.hxx:1126
const sal_uInt16 EXC_CHTEXT_POS_MOVED
Definition: xlchart.hxx:494
constexpr OUStringLiteral EXC_CHPROP_EXPTIMEINCREMENT
Definition: xlchart.hxx:78
virtual void SetRotation(sal_uInt16 nRotation) override
Sets text rotation to internal data structures.
Definition: xechart.cxx:1163
const sal_uInt16 EXC_CHOBJLINK_TITLE
No link target.
Definition: xlchart.hxx:506
const sal_uInt8 EXC_CHSERTREND_EXPONENTIAL
If order is 1, trend line is linear.
Definition: xlchart.hxx:627
const sal_uInt16 EXC_CHBAR_HORIZONTAL
Definition: xlchart.hxx:349
static void AppendString(XclExpString &rXclString, const XclExpRoot &rRoot, std::u16string_view rString)
Appends an unformatted string to an Excel string object.
Definition: xehelper.cxx:544
const sal_uInt16 EXC_CHTEXT_POS_AXIS
Definition: xlchart.hxx:488
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
Base class for chart future records.
Definition: xechart.hxx:193
const sal_uInt16 EXC_ID_CHCHART
Definition: xlchart.hxx:220
void CreateDataSeries(css::uno::Reference< css::chart2::XDiagram > const &xDiagram, css::uno::Reference< css::chart2::XDataSeries > const &xDataSeries)
Creates all data series of any chart type except stock charts.
Definition: xechart.cxx:2518
constexpr OUStringLiteral EXC_CHPROP_ROTATIONHORIZONTAL
Definition: xlchart.hxx:111
This struct helps reading and writing Excel fonts.
Definition: xlstyle.hxx:285
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
bool CreateStockSeries(css::uno::Reference< css::chart2::XDataSeries > const &xDataSeries, std::u16string_view rValueRole, bool bCloseSymbol)
Creates a single data series of a stock chart.
Definition: xechart.cxx:2570
void Convert(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, sal_uInt16 nFormatIdx)
Converts symbol properties from the passed property set.
Definition: xechart.cxx:1433
std::unique_ptr< ScTokenArray > CompileString(const OUString &rFormula)
Tokenize formula expression string into an array of tokens.
Definition: compiler.cxx:4661
Represents the CHDROPBAR record group describing pos/neg bars in line charts.
Definition: xechart.hxx:847
constexpr OUStringLiteral PERCENT(u"Percent")
constexpr OUStringLiteral EXC_CHPROP_CURVESTYLE
Definition: xlchart.hxx:64
sal_uInt16 mnFlags
Crossing position of other axis.
Definition: xlchart.hxx:1038
const sal_uInt16 EXC_CHCHARTLINE_CONNECT
Hi-lo lines.
Definition: xlchart.hxx:387
Base class for chart record groups.
Definition: xechart.hxx:166
const sal_uInt16 EXC_CHATTLABEL_SHOWVALUE
Definition: xlchart.hxx:306
constexpr OUStringLiteral EXC_CHPROP_COLOR
Definition: xlchart.hxx:60
Contains information about auto formatting of a specific chart object type.
Definition: xlchart.hxx:1138
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
Definition: xeroot.cxx:87
sal_uInt16 mnRotation
Additional flags.
Definition: xlchart.hxx:1051
constexpr OUStringLiteral EXC_CHPROP_OVERLAPSEQ
Definition: xlchart.hxx:101
XclChFrBlockVector maWrittenFrBlocks
The chart data object.
Definition: xechart.cxx:234
sal_uInt8 mnShowEquation
Polynomial order or moving average counter.
Definition: xlchart.hxx:921
const sal_uInt16 EXC_CHLEGEND_AUTOSERIES
Definition: xlchart.hxx:339
const sal_uInt16 EXC_ID_CHRADARLINE
Definition: xlchart.hxx:565
constexpr OUStringLiteral EXC_CHPROP_SHOWNEGATIVEERROR
Definition: xlchart.hxx:119
XclExpChFrLabelPropsRef mxLabelProps
Link target for this text object.
Definition: xechart.hxx:531
sal_uInt64 Seek(sal_uInt64 nPos)
const sal_uInt16 EXC_CHRADAR_AXISLABELS
Definition: xlchart.hxx:568
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:2374
void SetAuto(bool bAuto)
Sets or clears the automatic flag.
Definition: xechart.hxx:231
const sal_uInt16 EXC_CHTEXT_POS_ABOVE
Definition: xlchart.hxx:489
bool GetBoolProperty(const OUString &rPropName) const
Gets the specified Boolean property from the property set.
Definition: fapihelper.cxx:188
XclExpChTextRef mxYAxisTitle
The X axis title (CHTEXT group).
Definition: xechart.hxx:1110
XclExpChSeriesList maSeries
Extended chart type info.
Definition: xechart.hxx:931
XclExpChart(const XclExpRoot &rRoot, css::uno::Reference< css::frame::XModel > const &xModel, const tools::Rectangle &rChartRect)
Definition: xechart.cxx:3462
const sal_uInt16 EXC_ID_CHMARKERFORMAT
Definition: xlchart.hxx:269
void Convert(const ScfPropertySet &rPropSet)
Converts all legend settings from the passed property set.
Definition: xechart.cxx:2268
sal_uInt8 mnLabelPos
Type of tick marks of minor grid.
Definition: xlchart.hxx:1048
const sal_uInt8 EXC_CHPROPS_EMPTY_INTERPOLATE
Plot empty values as zero.
Definition: xlchart.hxx:605
const sal_uInt16 EXC_CHFRBLOCK_TYPE_TEXT
Definition: xlchart.hxx:179
sal_uInt32 mnColor2Id
First fill color identifier.
Definition: xechart.hxx:315
const sal_uInt16 EXC_ID_CH3DDATAFORMAT
Definition: xlchart.hxx:694
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
XclExpChartDrawing(const XclExpRoot &rRoot, const css::uno::Reference< css::frame::XModel > &rxModel, const Size &rChartSize)
Definition: xechart.cxx:3428
sal_uInt16 mnParentIdx
0-based series index.
Definition: xechart.hxx:758
bool mbIsFrame
true = Delete default frame formatting on export.
Definition: xlchart.hxx:1148
::std::vector< XclChFrBlock > XclChFrBlockVector
Definition: xechart.cxx:231
XclExpChFrameRef mxFrame
List of series data (CHSERIES groups).
Definition: xechart.hxx:1154
virtual void Save(XclExpStream &rStrm) override
Writes the entire record group.
Definition: xechart.cxx:808
ReturnType limit_cast(Type nValue, ReturnType nMin, ReturnType nMax)
Returns the value, if it is not less than nMin and not greater than nMax, otherwise one of the limits...
Definition: ftools.hxx:63
constexpr OUStringLiteral EXC_CHPROP_STARTINGANGLE
Definition: xlchart.hxx:123
const sal_uInt16 EXC_CHVALUERANGE_LOGSCALE
Definition: xlchart.hxx:426
constexpr OUStringLiteral EXC_CHPROP_MAJORTICKS
Definition: xlchart.hxx:92
const sal_uInt8 EXC_CHLEGEND_TOP
Definition: xlchart.hxx:329
const sal_uInt16 EXC_CHATTLABEL_SHOWCATEGPERC
Definition: xlchart.hxx:308
sal_uInt16 GetGroupIdx() const
Returns the index of this chart type group format.
Definition: xechart.hxx:895
std::shared_ptr< T > make_shared(Args &&...args)
sal_uInt16 mnMaxDate
Minimum value on axis.
Definition: xlchart.hxx:1019
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:285
sal_uInt16 Convert(css::uno::Reference< css::chart2::XDiagram > const &xDiagram, sal_uInt16 nFirstGroupIdx)
Converts the passed diagram to chart record data.
Definition: xechart.cxx:3076
constexpr OUStringLiteral EXC_CHPROP_ROLE
Definition: xlchart.hxx:110
const sal_uInt16 EXC_ID_CHPIEFORMAT
Definition: xlchart.hxx:300
XclChRectangle maRect
Definition: xlchart.hxx:1068
constexpr OUStringLiteral EXC_CHPROP_MINORTICKS
Definition: xlchart.hxx:94
const sal_uInt16 EXC_CHSERIES_INVALID
Maximum valid series index.
Definition: xlchart.hxx:232
XclExpChType(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2108
XclChSeries maData
Definition: xechart.hxx:746
void ConvertStockSeries(const ScfPropertySet &rPropSet, bool bCloseSymbol)
Sets default formatting for a series in a stock chart.
Definition: xechart.cxx:1599
sal_Int32 mnY
X position of the object in 1/4000 of chart width.
Definition: xlchart.hxx:745
XclExpChSourceLinkRef mxBubbleLink
Link data for series category names.
Definition: xechart.hxx:750
Pie chart.
Definition: xlchart.hxx:1178
virtual ~XclExpChGroupBase() override
Definition: xechart.cxx:429
ocUnion
Missing frame represents automatic formatting.
Definition: xlchart.hxx:1134
constexpr OUStringLiteral EXC_CHPROP_CURVENAME
Definition: xlchart.hxx:65
XclExpChValueRangeRef mxValueRange
Category scaling (CHLABELRANGE record).
Definition: xechart.hxx:1048
XclExpChDataFormatRef mxSeriesFmt
Link data for series bubble sizes.
Definition: xechart.hxx:751
const sal_uInt16 EXC_CHCHART3D_REAL3D
Definition: xlchart.hxx:536
sal_uInt16 ConvertFont(const ScfPropertySet &rPropSet, sal_Int16 nScript) const
Reads font properties from the passed property set.
Definition: xechart.cxx:392
constexpr OUStringLiteral EXC_CHPROP_SHOWCORRELATION
Definition: xlchart.hxx:115
const sal_uInt16 EXC_CHTICK_AUTOCOLOR
Definition: xlchart.hxx:413
void ConvertRotationBase(const ScfPropertySet &rPropSet, bool bSupportsStacked)
Converts rotation settings, calls virtual function SetRotation().
Definition: xechart.cxx:1143
void ConvertFontBase(const XclExpChRoot &rRoot, sal_uInt16 nFontIdx)
Creates a CHFONT record from the passed font index, calls virtual function SetFont().
Definition: xechart.cxx:1129
sal_uInt8 mnBarType
Number of custom error values.
Definition: xlchart.hxx:931
XclExpChRootData(XclExpChChart &rChartData)
Stack of future record levels not yet written out.
Definition: xechart.cxx:237
sal_uInt16 mnMinorStep
Time unit for major step.
Definition: xlchart.hxx:1022
OUString GetStringProperty(const OUString &rPropName) const
Gets the specified Boolean property from the property set.
Definition: fapihelper.cxx:194
const sal_uInt16 EXC_CHTEXT_POS_OUTSIDE
Definition: xlchart.hxx:485
void Convert(const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts complex area formatting from the passed property set.
Definition: xechart.cxx:657
constexpr OUStringLiteral EXC_CHPROP_ROTATIONVERTICAL
Definition: xlchart.hxx:112
XclExpChDataFormatRef mxDataFmt
Contents of the CHSERTRENDLINE record.
Definition: xechart.hxx:671
const sal_uInt16 EXC_ID_CHFONT
Definition: xlchart.hxx:498
virtual ~XclExpChFontBase()
Definition: xechart.cxx:1125
sal_uInt16 mnValueType
Data type for category entries.
Definition: xlchart.hxx:941
const sal_uInt16 EXC_FORMAT_NOTFOUND
Definition: xlstyle.hxx:69
constexpr OUStringLiteral EXC_CHPROP_EXPANSION
Definition: xlchart.hxx:77
const XclExpFont * GetFont(sal_uInt16 nXclFont) const
Returns the specified font from font list.
Definition: xestyle.cxx:1182
XclFutureRecType
Enumerates different header types of future records.
Definition: xlconst.hxx:236
sal_uInt16 GetRecId() const
Returns the current record ID.
Definition: xerecord.hxx:156
sal_Int32 mnHeight
Width of the object in 1/4000 of chart width.
Definition: xlchart.hxx:747
const sal_uInt16 EXC_ID_CHAXESSET
Definition: xlchart.hxx:580
XclExpChFramePosRef mxFramePos
Contents of the CHTEXT record.
Definition: xechart.hxx:526
constexpr OUStringLiteral EXC_CHPROP_STACKINGDIR
Definition: xlchart.hxx:122
const sal_uInt16 EXC_CHVALUERANGE_AUTOMAX
Definition: xlchart.hxx:422
const sal_uInt16 EXC_CHOBJLINK_ZAXIS
Data series/point.
Definition: xlchart.hxx:510
void SetDataLabel(XclExpChTextRef const &xText)
Stores a CHTEXT group that describes a data point label.
Definition: xechart.cxx:3385
XclExpChFutureRecordBase(const XclExpChRoot &rRoot, XclFutureRecType eRecType, sal_uInt16 nRecId, std::size_t nRecSize)
Definition: xechart.cxx:465
tuple log
void SetDefault(XclChFrameType eDefFrameType)
Sets the line format to the specified default type.
Definition: xechart.cxx:498
constexpr tools::Long Width() const
sal_uInt32 mnTextColorId
Extended data label properties (CHFRLABELPROPS record).
Definition: xechart.hxx:532
void Convert(const ScfPropertySet &rPropSet)
Converts and writes the contained frame data to the passed property set.
Definition: xechart.cxx:2366
const sal_uInt16 EXC_ID_CHDROPBAR
Definition: xlchart.hxx:557
constexpr OUStringLiteral EXC_CHPROP_RELATIVESIZE
Definition: xlchart.hxx:108
Axis grid line format.
Definition: xlchart.hxx:1122
XclExpChSourceLinkRef mxCategLink
Link data for series values.
Definition: xechart.hxx:749
XclExpChTextRef mxTitle
Secondary axes set (CHAXESSET group).
Definition: xechart.hxx:1158
sal_uInt32 mnMarkerSize
Fill color.
Definition: xlchart.hxx:890
XclExpChAxesSetRef mxPrimAxesSet
Chart properties (CHPROPERTIES record).
Definition: xechart.hxx:1156
const sal_uInt16 EXC_CHFRBLOCK_TYPE_CHART
Definition: xlchart.hxx:187
sal_uInt16 mnFlags
Separator between label values.
Definition: xlchart.hxx:865
constexpr OUStringLiteral EXC_CHPROP_NUMBERFORMAT
Definition: xlchart.hxx:98
Access to global data from other classes.
Definition: xeroot.hxx:112
constexpr OUStringLiteral EXC_CHPROP_INTERCEPT_VALUE
Definition: xlchart.hxx:85
const sal_uInt16 EXC_FONT_APP
Definition: xlstyle.hxx:76
Extended chart type information and access functions.
Definition: xlchart.hxx:1228
sal_uInt16 mnFlags
Background mode: transparent, opaque.
Definition: xlchart.hxx:877
XclChAxesSet maData
Definition: xechart.hxx:1104
sal_uInt16 mnMajorStep
Maximum value on axis.
Definition: xlchart.hxx:1020
XclChAxis maData
Definition: xechart.hxx:1046
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2252
const sal_uInt16 EXC_ID_CHTYPEGROUP
Definition: xlchart.hxx:319
Additional data label settings in the future record CHFRLABELPROPS.
Definition: xechart.hxx:449
sal_uInt32 mnPattColorId
Contents of the CHAREAFORMAT record.
Definition: xechart.hxx:281
RecType * GetLastRecord() const
Returns reference to the last existing record or empty reference, if list is empty.
Definition: xerecord.hxx:339
sal_uInt16 mnPieHole
Rotation angle of first pie (CHPIE).
Definition: xlchart.hxx:957
sal_uInt16 mnPattern
Line color.
Definition: xlchart.hxx:791
void Convert(const ScfPropertySet &rPropSet, bool bShowCateg, bool bShowValue, bool bShowPercent, bool bShowBubble)
Converts separator and the passed data label flags.
Definition: xechart.cxx:1103
XclExpChDropBarRef mxUpBar
Chart legend (CHLEGEND group).
Definition: xechart.hxx:934
XclExpChPieFormatRef mxPieFmt
Data point marker (CHMARKERFORMAT record).
Definition: xechart.hxx:643
PropertiesInfo aProperties
constexpr OUStringLiteral EXC_CHPROP_EXTRAPOLATE_FORWARD
Definition: xlchart.hxx:79
const sal_uInt16 EXC_FONT_NOTFOUND
Application font index.
Definition: xlstyle.hxx:77
sal_uInt16 mnType
Definition: xlchart.hxx:1058
XclChPropSetHelper & GetChartPropSetHelper() const
Returns the property set helper for the chart filters.
Definition: xlroot.cxx:423
std::shared_ptr< XclExpObjectManager > mxObjMgr
Definition: xechart.hxx:1178
const sal_uInt16 EXC_ID_CHAXIS
Connector lines in stacked bar charts.
Definition: xlchart.hxx:391
Series formatting in a chart supporting area formatting.
Definition: xlchart.hxx:1120
constexpr OUStringLiteral EXC_CHPROP_VARYCOLORSBY
Definition: xlchart.hxx:130
#define SAL_MAX_UINT16
constexpr OUStringLiteral EXC_CHPROP_RIGHTANGLEDAXES
Definition: xlchart.hxx:109
const sal_uInt16 EXC_CHDATAFORMAT_MAXPOINTCOUNT
Definition: xlchart.hxx:238
XclChTick maData
Definition: xechart.hxx:1004
ReturnType ulimit_cast(Type nValue, ReturnType nMax)
Returns the value, if it is not greater than nMax, otherwise nMax.
Definition: ftools.hxx:53
sal_uInt16 GetMonth() const
XclCh3dDataFormat maData
Definition: xechart.hxx:598
const sal_uInt16 EXC_ID_CHDATAFORMAT
Invalid series index (for internal use).
Definition: xlchart.hxx:236
void ConvertTrendLineEquation(const ScfPropertySet &rPropSet, const XclChDataPointPos &rPointPos)
Converts all settings of the passed trend line equation box.
Definition: xechart.cxx:1339
Omit flags on empty string (default: read/write always). BIFF8 only.
const sal_uInt16 EXC_CHPROPS_MANPLOTAREA
Do not resize chart with window.
Definition: xlchart.hxx:600
sal_uInt32 mnColor1Id
Image options, e.g. stretched, stacked (CHPICFORMAT record).
Definition: xechart.hxx:314
const sal_uInt16 EXC_ID_CHESCHERFORMAT
Definition: xlchart.hxx:726
const sal_uInt16 EXC_CHDATERANGE_AUTODATE
Other axis crosses at own maximum.
Definition: xlchart.hxx:718
constexpr OUStringLiteral EXC_CHPROP_EXTRAPOLATE_BACKWARD
Definition: xlchart.hxx:80
sal_Int16 mnWeight
Line pattern (solid, dashed, ...).
Definition: xlchart.hxx:792
int nCount
XclChObjectType meObjType
Definition: xechart.hxx:862
sal_uInt8 mnSourceType
Type of the error bar (X/Y).
Definition: xlchart.hxx:932
sal_uInt16 mnFlags
Space between series.
Definition: xlchart.hxx:973
sal_uInt16 mnNumFmtIdx
Wall/floor format (sub records of CHFRAME group).
Definition: xechart.hxx:1055
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:3054
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xechart.cxx:2681
virtual ~XclExpChartDrawing() override
Definition: xechart.cxx:3452
sal_uInt16 mnRecId
Chart type category this type belongs to.
Definition: xlchart.hxx:1210
const sal_uInt8 EXC_CHSERTREND_LOGARITHMIC
Definition: xlchart.hxx:628
SCTAB Tab() const
Definition: address.hxx:283
Represents the CHLEGEND record group describing the chart legend.
Definition: xechart.hxx:819
bool mbReverseSeries
true = Series can be stacked on each other.
Definition: xlchart.hxx:1223
const sal_uInt16 EXC_ID_CHFRLABELPROPS
Definition: xlchart.hxx:203
const sal_uInt8 EXC_CHLEGEND_LEFT
Definition: xlchart.hxx:331
XclChMarkerFormat maData
Definition: xechart.hxx:566
const sal_uInt16 EXC_ID_CHOBJECTLINK
Definition: xlchart.hxx:502
sal_uInt16 mnFlags
Formatting index for automatic colors.
Definition: xlchart.hxx:909
::std::vector< XclFormatRun > XclFormatRunVec
A vector with all formatting runs for a rich-string.
Definition: xlstring.hxx:85
sal_uInt16 GetFreeFormatIdx() const
Returns an unused format index to be used for the next created series.
Definition: xechart.cxx:2513
sal_uInt8 mnDockMode
Position of the legend.
Definition: xlchart.hxx:981
Represents the CHCHART3D record that contains 3D view settings.
Definition: xechart.hxx:792
const sal_uInt8 EXC_CHSRCLINK_DEFAULT
Definition: xlchart.hxx:659
void Convert(const ScfPropertySet &rPropSet, const XclChExtTypeInfo &rTypeInfo, sal_uInt16 nAxisType)
Converts axis tick mark settings.
Definition: xechart.cxx:2807
const sal_uInt16 EXC_ID_CHATTACHEDLABEL
Definition: xlchart.hxx:304
XclChPropertyMode mePropMode
Object type for automatic format.
Definition: xlchart.hxx:1141
const sal_uInt16 EXC_CHFRBLOCK_TEXT_AXISTITLE
Definition: xlchart.hxx:194
const sal_uInt16 EXC_CHFRBLOCK_TYPE_AXIS
Definition: xlchart.hxx:180
constexpr OUStringLiteral EXC_CHPROP_RELATIVEPOSITION
Definition: xlchart.hxx:107
void Convert(const ScfPropertySet &rPropSet)
Sets 3d bar properties from the passed property set.
Definition: xechart.cxx:1510
bool mbDeleteDefFrame
true = Create missing frame objects on import.
Definition: xlchart.hxx:1147
const sal_Int32 EXC_CHART_AXIS_Y
API X axis index.
Definition: xlchart.hxx:156
sal_uInt32 InsertColor(const Color &rColor, XclExpColorType eType, sal_uInt16 nAutoDefault=0)
Inserts the color into the list and updates weighting.
Definition: xestyle.cxx:766
constexpr OUStringLiteral EXC_CHPROP_GEOMETRY3D
Definition: xlchart.hxx:83
XclExpChLegendRef mxLegend
3D settings (CHCHART3D record).
Definition: xechart.hxx:933
sal_uInt8 mnLineEnd
Type of source values.
Definition: xlchart.hxx:933
sal_uInt16 mnFlags
Line weight (hairline, single, ...).
Definition: xlchart.hxx:793
bool IsSeriesFrameFormat() const
Returns true, if this chart type supports area formatting for its series.
Definition: xlchart.hxx:1238
XclExpChSerErrorBarRef mxErrorBar
Trend line settings (CHSERTRENDLINE record).
Definition: xechart.hxx:755
const sal_uInt16 EXC_CHTEXT_SHOWCATEGPERC
Automatic text background mode (transparent/opaque).
Definition: xlchart.hxx:479
constexpr OUStringLiteral EXC_CHPROP_ATTRIBDATAPOINTS
Definition: xlchart.hxx:58
sal_uInt8 mnVAlign
Horizontal alignment.
Definition: xlchart.hxx:875
bool ReadAreaProperties(XclChAreaFormat &rAreaFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode)
Reads solid area properties from the passed property set.
Definition: xlchart.cxx:727
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2777
XclExpChFrameRef mxFrame
Legend text format (CHTEXT group).
Definition: xechart.hxx:837
void RegisterColors(const XclExpChRoot &rRoot)
Registers marker colors in palette and stores color identifiers.
Definition: xechart.cxx:1472
void Convert(const css::chart2::ScaleData &rScaleData, const ScfPropertySet &rChart1Axis, bool bMirrorOrient)
Converts category axis scaling settings.
Definition: xechart.cxx:2602
Represents the CHDATAFORMAT record group containing data point properties.
Definition: xechart.hxx:618
OUString GetServiceName() const
Returns the service name provided via the XServiceName interface, or an empty string on error...
Definition: fapihelper.cxx:150
sal_uInt16 mnSeriesIdx
Definition: xlchart.hxx:755
bool IsDeleteable() const
Returns true, if the frame object can be deleted because it contains default formats.
Definition: xechart.cxx:803
const sal_uInt16 EXC_ID_CHFRBLOCKEND
Definition: xlchart.hxx:176
constexpr OUStringLiteral EXC_CHPROP_ROLE_XVALUES
Definition: xlchart.hxx:141
void FlushBuffer()
XclChRectangle CalcChartRectFromHmm(const css::awt::Rectangle &rRect) const
Converts the passed rectangle from 1/100 mm to Excel chart units.
Definition: xechart.cxx:361
Contains the type and context of a block of future records which are guarded by CHFRBLOCKBEGIN and CH...
Definition: xlchart.hxx:767
sal_uInt16 GetLen() const
void Convert(const ScfPropertySet &rPropSet)
Sets pie segment properties from the passed property set.
Definition: xechart.cxx:1498
Chart background.
Definition: xlchart.hxx:1113
XclChEscherFormat maData
Definition: xechart.hxx:312
const sal_uInt8 EXC_CHLEGEND_NOTDOCKED
Definition: xlchart.hxx:332
const sal_uInt16 EXC_CHSCATTER_BUBBLES
Bubble width refers to value.
Definition: xlchart.hxx:377
bool mbTicksBetweenCateg
true = Insert unstacked series in reverse order.
Definition: xlchart.hxx:1224
const sal_uInt8 EXC_CHTICK_HIGH
Below diagram/right of diagram.
Definition: xlchart.hxx:407
constexpr OUStringLiteral EXC_CHPROP_OFFSET
Definition: xlchart.hxx:100
sal_uInt16 mnTickFreq
Frequency of labels.
Definition: xlchart.hxx:1010
AxisType
The method of calculating the axis min or max value.
constexpr OUStringLiteral EXC_CHPROP_POSITIVEERROR
Definition: xlchart.hxx:105
double mfMax
Minimum value on axis.
Definition: xlchart.hxx:1034
sal_uInt16 mnFlags
Definition: xlchart.hxx:998
sal_Int16 GetYear() const
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:3423
sal_uInt32 mnTextColorId
Contents of the CHTICK record.
Definition: xechart.hxx:1005
sal_uInt16 mnTLMode
Object dependent position data.
Definition: xlchart.hxx:782
XclChObjectType
Enumerates different object types for specific automatic formatting behaviour.
Definition: xlchart.hxx:1110
const sal_uInt16 EXC_CHDATERANGE_AUTOMIN
Definition: xlchart.hxx:711
const sal_uInt16 EXC_ID_CHSERIESFORMAT
Line end: t-shape.
Definition: xlchart.hxx:686
const sal_uInt32 RIGHT
constexpr OUStringLiteral EXC_CHPROP_PERSPECTIVE
Definition: xlchart.hxx:104
const sal_uInt16 EXC_ID_CHSERTRENDLINE
Definition: xlchart.hxx:624
void ConvertCategSequence(css::uno::Reference< css::chart2::data::XLabeledDataSequence > const &xCategSeq)
Converts and inserts category ranges for all inserted series.
Definition: xechart.cxx:2029
FormulaToken * AddToken(const FormulaToken &)
bool IsAuto() const
Returns true, if the area format is set to automatic.
Definition: xechart.hxx:270
XclExpChChart & mrChartData
Definition: xechart.cxx:233
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, const ParamIfsResult &rRes)
Definition: interpre.hxx:71
Radar charts (linear or filled).
Definition: xlchart.hxx:1192
Represents the CHSERIES record group describing a data series in a chart.
Definition: xechart.hxx:701
constexpr OUStringLiteral EXC_CHPROP_WEIGHT
Definition: xlchart.hxx:131
XclExpChSeriesList maSeries
Position of the chart on the sheet (CHCHART record).
Definition: xechart.hxx:1153
double mfMinorStep
Distance for major grid lines.
Definition: xlchart.hxx:1036
const sal_uInt16 EXC_ID_CHCHARTLINE
Definition: xlchart.hxx:383
Stores all data of an Excel font and provides export of FONT records.
Definition: xestyle.hxx:153
XclExpRecordList< XclExpChDataFormat > maPointFmts
CHDATAFORMAT group for series format.
Definition: xechart.hxx:753
const sal_uInt16 EXC_ID_CHAREA
Definition: xlchart.hxx:357
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:1368
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
virtual void Save(XclExpStream &rStrm) override
Writes the CHESCHERFORMAT record group to the stream, if complex formatting is extant.
Definition: xechart.cxx:671
A record with a single value of type Type.
Definition: xerecord.hxx:198
XclChValueRange maData
Definition: xechart.hxx:983
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
Defined name.
Definition: xlformula.hxx:167
const sal_uInt16 EXC_CHFRBLOCK_TEXT_TITLE
For internal use only.
Definition: xlchart.hxx:192
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:487
void CreateAllStockSeries(css::uno::Reference< css::chart2::XChartType > const &xChartType, css::uno::Reference< css::chart2::XDataSeries > const &xDataSeries)
Creates all data series of a stock chart.
Definition: xechart.cxx:2532
bool IsDefault() const
Returns true, if the frame object contains default formats.
Definition: xechart.cxx:798
bool IsEmpty() const
XclExpChMarkerFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1426
const sal_uInt16 EXC_CHCHARTLINE_HILO
Drop lines.
Definition: xlchart.hxx:386
XclExpChMarkerFormatRef mxMarkerFmt
Contents of the CHDATAFORMAT record.
Definition: xechart.hxx:642
const sal_uInt16 EXC_CHLINEFORMAT_NONE
Definition: xlchart.hxx:254
sal_uInt32 mnFillColorId
Border line color identifier.
Definition: xechart.hxx:568
sal_uInt16 GetColorIndex(sal_uInt32 nColorId) const
Returns the Excel palette index of the color with passed color ID.
Definition: xestyle.cxx:781
const sal_uInt16 EXC_CHFRBLOCK_TEXT_DATALABEL
Definition: xlchart.hxx:195
const sal_uInt16 EXC_ID_PROTECT
Definition: xlconst.hxx:170
const sal_uInt16 EXC_ID_CHSOURCELINK
Definition: xlchart.hxx:652
sal_uInt16 mnFlags
Fill pattern.
Definition: xlchart.hxx:803
constexpr OUStringLiteral EXC_CHPROP_ERRORBARY
Definition: xlchart.hxx:76
XclExpChAxesSetRef mxSecnAxesSet
Primary axes set (CHAXESSET group).
Definition: xechart.hxx:1157
const sal_uInt16 EXC_CHAXESSET_SECONDARY
Definition: xlchart.hxx:583
XclExpChTick(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2800
DateTime GetDateTimeFromDouble(double fValue) const
Converts a floating-point value to a date/time value.
Definition: xlroot.cxx:352
const sal_uInt8 EXC_CHLEGEND_RIGHT
Definition: xlchart.hxx:330
Represents the CHSERTRENDLINE record containing settings for a trend line.
Definition: xechart.hxx:652
const sal_uInt16 EXC_CHTYPEGROUP_VARIEDCOLORS
Definition: xlchart.hxx:321
void WriteFrameRecords(XclExpStream &rStrm)
Writes all contained frame records to the passed stream.
Definition: xechart.cxx:774
const sal_uInt16 EXC_CHFRAME_AUTOSIZE
Definition: xlchart.hxx:520
const sal_uInt16 EXC_CHLINE_STACKED
Definition: xlchart.hxx:359
void SetManualPlotArea()
Sets the plot area position and size to manual mode.
Definition: xechart.cxx:3391
void InitializeFutureRecBlock(XclExpStream &rStrm)
Called from XclExpChFutureRecordBase::Save, Initializes the current future record level...
Definition: xechart.cxx:411
Floor formatting in 3d charts.
Definition: xlchart.hxx:1116
BOTTOM_RIGHT
const sal_uInt16 EXC_ID_CHDATERANGE
Definition: xlchart.hxx:709
const XclChExtTypeInfo & GetTypeInfo() const
Returns the chart type info struct for the contained chart type.
Definition: xechart.hxx:897
sal_uInt16 Insert(sal_uInt32 nScNumFmt)
Inserts a number format into the format buffer.
Definition: xestyle.cxx:1356
constexpr OUStringLiteral EXC_CHPROP_ROLE_CLOSEVALUES
Definition: xlchart.hxx:144
void SetFlag3D(bool bVal)
Definition: refdata.hxx:89
const sal_uInt16 EXC_CHTEXT_SHOWVALUE
Legend symbol for data point caption.
Definition: xlchart.hxx:473
void ConvertFrameBase(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts frame formatting properties from the passed property set.
Definition: xechart.cxx:729
const sal_uInt16 EXC_CHDATERANGE_YEARS
Definition: xlchart.hxx:722
#define STREAM_SEEK_TO_BEGIN
XclExpChSerTrendLine(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1631
const sal_uInt16 EXC_CHFRLABELPROPS_SHOWBUBBLE
Definition: xlchart.hxx:209
sal_uInt16 mnSeriesIdx
Chart type group (CHTYPEGROUP group) this series is assigned to.
Definition: xechart.hxx:757
const sal_uInt16 EXC_COLOR_CHWINDOWTEXT
System button background color (face color).
Definition: xlstyle.hxx:210
const sal_uInt8 EXC_CHPROPS_EMPTY_ZERO
Skip empty values.
Definition: xlchart.hxx:604
XclChDataPointPos maPointPos
Definition: xlchart.hxx:907
void ConvertCategSequence(css::uno::Reference< css::chart2::data::XLabeledDataSequence > const &xCategSeq)
Converts and inserts category ranges for all inserted series.
Definition: xechart.cxx:2485
sal_Int16 SCCOL
Definition: types.hxx:21
const sal_uInt16 EXC_CHFRLABELPROPS_SHOWCATEG
Definition: xlchart.hxx:206
8-bit string length field (default: 16-bit).
const sal_uInt8 EXC_CHSERERR_FIXED
Definition: xlchart.hxx:676
XclExpPalette & GetPalette() const
Returns the color buffer.
Definition: xeroot.cxx:105
const sal_uInt16 EXC_ID_CHPROPERTIES
Definition: xlchart.hxx:595
Color GetDefColor(sal_uInt16 nXclIndex) const
Returns the default color for a (non-zero-based) Excel color or COL_AUTO on error.
Definition: xlstyle.cxx:142
bool ConvertAreaFormat(XclChAreaFormat &rAreaFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode) const
Reads solid area properties from the passed property set.
Definition: xechart.cxx:378
const sal_uInt16 EXC_CHTEXT_SHOWCATEG
Show bubble size.
Definition: xlchart.hxx:482
const sal_uInt8 EXC_CHSERERR_XPLUS
For internal use only.
Definition: xlchart.hxx:670
XclChTypeGroup maData
Definition: xechart.hxx:928
sal_Int32 GetApiAxesSetIndex() const
Returns the axes set index used by the chart API.
Definition: xechart.hxx:1081
const sal_uInt16 EXC_ID_CHLABELRANGE
This bit is always set in BIFF5+.
Definition: xlchart.hxx:433
XclExpChLabelRangeRef mxLabelRange
Contents of the CHAXIS record.
Definition: xechart.hxx:1047
sal_uInt16 mnValueCount
Fixed value for several source types.
Definition: xlchart.hxx:930
void RemoveRecord(size_t nPos)
Removes the record at the specified position from the list.
Definition: xerecord.hxx:369
XclExpChText(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1149
const sal_uInt16 EXC_ID_CHTICK
For internal use only.
Definition: xlchart.hxx:400
XclExpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
Definition: xeroot.cxx:117
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1119
const sal_Int32 EXC_CHART_AXIS_X
For internal use only.
Definition: xlchart.hxx:155
const sal_uInt8 EXC_CHSERERR_XMINUS
Definition: xlchart.hxx:671
bool IsDefaultFrameBase(XclChFrameType eDefFrameType) const
Returns true, if the frame contains default formatting (as if the frame is missing).
Definition: xechart.cxx:767
bool HasFillColor() const
Returns true, if fill area of markers is visible.
Definition: xechart.hxx:557
sal_uInt16 mnLabelFreq
Crossing position of other axis.
Definition: xlchart.hxx:1009
XclChExtTypeInfo maTypeInfo
Chart type (e.g. CHBAR, CHLINE, ...).
Definition: xechart.hxx:930
sal_uInt16 mnEyeDist
Elevation (-90...+90deg).
Definition: xlchart.hxx:969
const sal_uInt16 EXC_ID_CHSERPARENT
Definition: xlchart.hxx:620
ScSingleRefData Ref1
Definition: refdata.hxx:124
constexpr OUStringLiteral EXC_CHPROP_LABELSEPARATOR
Definition: xlchart.hxx:90
static void lcl_getChartSubTitle(const Reference< XChartDocument > &xChartDoc, OUString &rSubTitle)
Definition: xechart.cxx:3284
const Any & any
XclExpChEscherFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:649
sal_uInt16 GetBaseYear() const
Returns the base year depending on the current null date (1900 or 1904).
Definition: xlroot.cxx:332
virtual void SetRotation(sal_uInt16 nRotation) override
Sets text rotation to internal data structures.
Definition: xechart.cxx:2932
XclChFrBlock maFrBlock
Definition: xechart.hxx:187
const sal_uInt16 EXC_CHVALUERANGE_AUTOCROSS
Definition: xlchart.hxx:425
const sal_uInt16 EXC_CHFRBLOCK_TYPE_FRAME
Definition: xlchart.hxx:183
XclExpChChart3dRef mxChart3d
List of series data (CHSERIES groups).
Definition: xechart.hxx:932
void InitializeFutureRecBlock(XclExpStream &rStrm)
Initializes the current future record level (writes all unwritten CHFRBLOCKBEGIN records).
Definition: xechart.cxx:252
constexpr OUStringLiteral EXC_CHPROP_SHOWEQUATION
Definition: xlchart.hxx:116
Stores all used colors in the document.
Definition: xestyle.hxx:74
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
XclExpChValueRange(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2708
ScSingleRefData Ref2
Definition: refdata.hxx:125
XclExpChFontRef mxFont
Axis ticks (CHTICK record).
Definition: xechart.hxx:1050
sal_uInt16 mnMinorUnit
Distance for minor grid lines.
Definition: xlchart.hxx:1023
float u
const sal_uInt16 EXC_CHDATERANGE_AUTOMINOR
Definition: xlchart.hxx:714
static sal_uInt16 ConvertPieRotation(const ScfPropertySet &rPropSet)
Reads the pie rotation property and returns the converted angle.
Definition: xechart.cxx:399
sal_Int16 mnAutoLineWeight
Automatic line color index.
Definition: xlchart.hxx:1143
const sal_uInt16 EXC_CHTEXT_SHOWSYMBOL
Automatic text color.
Definition: xlchart.hxx:472
sal_Int16 mnOverlap
Definition: xlchart.hxx:954
constexpr OUStringLiteral EXC_CHPROP_BLACKDAY
Definition: xlchart.hxx:59
sal_uInt16 mnFlags
Crossing position of other axis.
Definition: xlchart.hxx:1026
void SetSystemColor(Color &rColor, sal_uInt32 &rnColorId, sal_uInt16 nSysColorIdx) const
Sets a system color and the respective color identifier.
Definition: xechart.cxx:344
void EndRecord()
Checks and corrects real record length.
Definition: xestream.cxx:125
sal_uInt16 mnAxesSetId
Position of the axes set (inner plot area).
Definition: xlchart.hxx:1069
XclExpChLineFormatRef mxAxisLine
Index into font buffer (CHFONT record).
Definition: xechart.hxx:1051
const sal_uInt16 EXC_CHFRBLOCK_TYPE_UNKNOWN
Definition: xlchart.hxx:190
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
void SetDefault(XclChFrameType eDefFrameType)
Sets the area format to the specified default type.
Definition: xechart.cxx:616
static OUString GetServiceName(const css::uno::Reference< css::uno::XInterface > &xInt)
Returns the service name provided via the XServiceName interface, or an empty string on error...
Definition: fapihelper.cxx:57
const sal_uInt16 EXC_CHFRAMEPOS_ABSSIZE_POINTS
Definition: xlchart.hxx:641
sal_Int16 mnElevation
Rotation (0...359deg).
Definition: xlchart.hxx:968
bool GetColorProperty(Color &rColor, const OUString &rPropName) const
Gets the specified color property from the property set.
Definition: fapihelper.cxx:201
const sal_uInt16 EXC_CHPICFORMAT_NONE
Definition: xlchart.hxx:546
XclChTypeInfo maTypeInfo
Contents of the chart type record.
Definition: xechart.hxx:788
const sal_uInt16 EXC_CHAXISLINE_MAJORGRID
Axis line itself.
Definition: xlchart.hxx:444
XclExpChEscherFormatRef mxEscherFmt
Area format (CHAREAFORMAT record).
Definition: xechart.hxx:349
sal_Int32 CalcChartXFromHmm(sal_Int32 nPosX) const
Converts the passed horizontal coordinate from 1/100 mm to Excel chart units.
Definition: xechart.cxx:351
const sal_uInt16 EXC_CHFRLABELPROPS_SHOWPERCENT
Definition: xlchart.hxx:208
const sal_uInt16 EXC_CHPROPS_SHOWVISIBLEONLY
Manual series allocation.
Definition: xlchart.hxx:598
const sal_uInt16 EXC_CHDATERANGE_AUTOMAX
Definition: xlchart.hxx:712
const sal_uInt16 EXC_ID_CHLEGEND
Varied colors for points.
Definition: xlchart.hxx:325
sal_uInt16 mnFlags
Bubble type in bubble chart (CHSCATTER).
Definition: xlchart.hxx:960
static sal_Int16 GetLeadingScriptType(const XclExpRoot &rRoot, const OUString &rString)
Returns the script type first text portion different to WEAK, or the system default script type...
Definition: xehelper.cxx:639
const sal_uInt16 EXC_CHTEXT_SHOWBUBBLE
Data point caption as percent.
Definition: xlchart.hxx:481
const sal_uInt16 EXC_CHFRBLOCK_TYPE_SERIES
Definition: xlchart.hxx:186
sal_uInt8 mnHAlign
Text color.
Definition: xlchart.hxx:874
const sal_uInt16 EXC_CHFRLABELPROPS_SHOWVALUE
Definition: xlchart.hxx:207
void FinalizeFutureRecBlock(XclExpStream &rStrm)
Finalizes the current future record level (writes CHFRBLOCKEND record if needed). ...
Definition: xechart.cxx:277
sal_uInt16 mnBubbleType
Bubble size in bubble chart (CHSCATTER).
Definition: xlchart.hxx:959
bool Is3dChart() const
Returns true, if the chart is three-dimensional.
Definition: xechart.cxx:3224
rtl::Reference< XclExpRecordBase > mxObjRecs
Definition: xechart.hxx:1179
bool IsSystemColor(sal_uInt16 nXclIndex) const
Returns true, if the passed Excel color index is a system color.
Definition: xlstyle.hxx:262
const sal_uInt16 EXC_ID_CHUNITS
Definition: xlchart.hxx:213
The CHATTACHEDLABEL record that contains the type of a data point label.
Definition: xechart.hxx:604
sal_uInt16 mnFlags
Frequency of ticks.
Definition: xlchart.hxx:1011
sal_uInt16 mnMajorUnit
Distance for major grid lines.
Definition: xlchart.hxx:1021
Line in a chart.
Definition: xestyle.hxx:52
constexpr OUStringLiteral EXC_CHPROP_ROLE_LOWVALUES
Definition: xlchart.hxx:145
constexpr OUStringLiteral EXC_CHPROP_GAPWIDTHSEQ
Definition: xlchart.hxx:82
XclExpChRoot(const XclExpRoot &rRoot, XclExpChChart &rChartData)
Definition: xechart.cxx:293
RecType * GetFirstRecord() const
Returns reference to the first existing record or empty reference, if list is empty.
Definition: xerecord.hxx:336
const sal_uInt16 EXC_CHBAR_PERCENT
Definition: xlchart.hxx:351
const sal_uInt8 EXC_CHFRINFO_EXCELXP2003
Definition: xlchart.hxx:170
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
XclChObjectType meObjType
Contents of the CHFRAME record.
Definition: xechart.hxx:382
const sal_uInt16 EXC_CHSERIESFORMAT_SMOOTHED
Definition: xlchart.hxx:688
const sal_uInt8 EXC_CHSERTREND_MOVING_AVG
Definition: xlchart.hxx:630
const sal_uInt8 EXC_CHLEGEND_BOTTOM
Definition: xlchart.hxx:327
XclExpChTypeGroupRef GetFirstTypeGroup() const
Returns first inserted chart type group.
Definition: xechart.cxx:3247
Represents the group of DFF and OBJ records containing all drawing shapes embedded in the chart objec...
Definition: xechart.hxx:1166
void CopyFromStream(SvStream &rInStrm, sal_uInt64 nBytes=STREAM_SEEK_TO_END)
Copies nBytes bytes from current position of the stream rInStrm.
Definition: xestream.cxx:288
constexpr OUStringLiteral EXC_CHPROP_SWAPXANDYAXIS
Definition: xlchart.hxx:124
void ConvertLegend(const ScfPropertySet &rPropSet)
Creates a legend object and converts all legend settings.
Definition: xechart.cxx:2491
sal_uInt16 mnDepthGap
Depth relative to width.
Definition: xlchart.hxx:972
void ConvertDataSeries(const ScfPropertySet &rPropSet, const XclChExtTypeInfo &rTypeInfo)
Converts the passed data series or data point formatting.
Definition: xechart.cxx:1558
bool HasMarker() const
Returns true, if markers are enabled.
Definition: xechart.hxx:553
sal_uInt16 mnFlags
Format type of the frame.
Definition: xlchart.hxx:835
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1540
const sal_uInt16 EXC_CHLEGEND_DOCKED
Definition: xlchart.hxx:338
Represents the CHCHART record group describing the chart contents.
Definition: xechart.hxx:1127
sal_Int32 mnWidth
Y position of the object in 1/4000 of chart height.
Definition: xlchart.hxx:746
constexpr OUStringLiteral EXC_CHPROP_SHOW
Definition: xlchart.hxx:114
void AppendNewRecord(XclExpRecordBase *pRec)
Appends a newly created record to the list.
Definition: xerecord.hxx:361
XclExpChChart & GetChartData() const
Returns a reference to the parent chart data object.
Definition: xechart.cxx:308
sal_uInt8 mnOrder
Type of the trend line.
Definition: xlchart.hxx:920
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
void SetFontColor(const Color &rColor, sal_uInt32 nColorId)
Sets font color and color identifier to internal data structures.
Definition: xechart.cxx:2848
XclChTypeId
Enumerates all kinds of different chart types.
Definition: xlchart.hxx:1168
sal_uInt16 mnBubbleCount
Number of value entries.
Definition: xlchart.hxx:945
bool Is3dChart() const
Returns true, if the chart is three-dimensional.
Definition: xechart.hxx:899
const sal_uInt16 EXC_CHFRBLOCK_TYPE_DATAFORMAT
Definition: xlchart.hxx:188
const sal_uInt16 EXC_CHTEXT_POS_LEFT
Definition: xlchart.hxx:491
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:3398
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1792
sal_Int16 GetDefApiScript() const
Returns the default script type, e.g.
Definition: xlroot.hxx:155
SCCOL Col() const
Definition: address.hxx:279
constexpr OUStringLiteral EXC_CHPROP_NUMBERFORMAT_LINKSRC
Definition: xlchart.hxx:99
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
XclExpChRootDataRef mxChData
Definition: xechart.hxx:158
sal_uInt16 mnValue2
Optional primary value for current context.
Definition: xlchart.hxx:772
bool IsDefault(XclChFrameType eDefFrameType) const
Returns true, if the line contains default formatting according to the passed frame type...
Definition: xechart.cxx:543
const sal_uInt16 EXC_CHFRBLOCK_TYPE_TYPEGROUP
Definition: xlchart.hxx:181
const sal_uInt16 EXC_CHATTLABEL_SHOWCATEG
Smoothed line.
Definition: xlchart.hxx:310
Line charts (line, area, stock charts).
Definition: xlchart.hxx:1191
Filled radar chart.
Definition: xlchart.hxx:1177
#define ESCHER_Prop_fillBackColor
XclExpValueRecord< sal_uInt16 > XclExpUInt16Record
A record containing an unsigned 16-bit value.
Definition: xerecord.hxx:247
const sal_uInt16 EXC_ID_CHSERERRORBAR
Definition: xlchart.hxx:667
bool Is() const
Returns true, if the contained XPropertySet interface is valid.
Definition: fapihelper.hxx:128
const sal_uInt8 EXC_CHSERERR_STDDEV
Definition: xlchart.hxx:677
void Convert(const css::chart2::ScaleData &rScaleData)
Converts value axis scaling settings.
Definition: xechart.cxx:2714
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:822
XclExpChTypeGroupRef GetLastTypeGroup() const
Returns last inserted chart type group.
Definition: xechart.cxx:3252
XclExpChTextRef mxLabel
Formatting settings of the trend line.
Definition: xechart.hxx:672
Scatter (XY) chart.
Definition: xlchart.hxx:1181
void ReadFontProperties(XclFontData &rFontData, const ScfPropertySet &rPropSet, XclFontPropSetType eType, sal_Int16 nScript=-1)
Reads all font properties from the passed property set.
Definition: xlstyle.cxx:625
Default string settings.
const sal_uInt16 EXC_CHCHART3D_HASWALLS
true = automatic height to width ratio.
Definition: xlchart.hxx:539
top left cell of area
sal_uInt8 mnMajor
Tick labels color.
Definition: xlchart.hxx:1046
constexpr OUStringLiteral EXC_CHPROP_LABEL
Definition: xlchart.hxx:87
const sal_uInt16 EXC_CHAXIS_Z
Definition: xlchart.hxx:395
sal_uInt16 mnGroupIdx
Error bar settings (CHSERERRORBAR record).
Definition: xechart.hxx:756
sal_uInt16 mnRotation
Gap between bars (CHBAR).
Definition: xlchart.hxx:956
constexpr OUStringLiteral EXC_CHPROP_ROLE_HIGHVALUES
Definition: xlchart.hxx:146
constexpr OUStringLiteral EXC_CHPROP_ADDITIONALSHAPES
Definition: xlchart.hxx:54
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:550
sal_uInt8 mnBase
Definition: xlchart.hxx:899
#define ESCHER_Prop_fillColor
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
Definition: token.cxx:2264
const sal_uInt32 BOTTOM
sal_uInt16 mnCross
Time unit for axis values.
Definition: xlchart.hxx:1025
RecType * GetRecord(size_t nPos) const
Returns reference to an existing record or empty reference on error.
Definition: xerecord.hxx:333
void InitFromParent(const XclExpChSeries &rParent)
Initializes members of this series to represent a child of the passed series.
Definition: xechart.cxx:2051