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
71using ::com::sun::star::uno::Any;
72using ::com::sun::star::uno::Reference;
73using ::com::sun::star::uno::Sequence;
74using ::com::sun::star::uno::UNO_QUERY;
75using ::com::sun::star::uno::UNO_QUERY_THROW;
76using ::com::sun::star::uno::UNO_SET_THROW;
77using ::com::sun::star::uno::Exception;
78using ::com::sun::star::beans::XPropertySet;
79using ::com::sun::star::i18n::XBreakIterator;
80using ::com::sun::star::frame::XModel;
81using ::com::sun::star::drawing::XShape;
82using ::com::sun::star::drawing::XShapes;
83
84using ::com::sun::star::chart2::IncrementData;
85using ::com::sun::star::chart2::RelativePosition;
86using ::com::sun::star::chart2::RelativeSize;
87using ::com::sun::star::chart2::ScaleData;
88using ::com::sun::star::chart2::SubIncrement;
89using ::com::sun::star::chart2::XAxis;
90using ::com::sun::star::chart2::XChartDocument;
91using ::com::sun::star::chart2::XChartTypeContainer;
92using ::com::sun::star::chart2::XColorScheme;
93using ::com::sun::star::chart2::XCoordinateSystem;
94using ::com::sun::star::chart2::XCoordinateSystemContainer;
95using ::com::sun::star::chart2::XChartType;
96using ::com::sun::star::chart2::XDataSeries;
97using ::com::sun::star::chart2::XDataSeriesContainer;
98using ::com::sun::star::chart2::XDiagram;
99using ::com::sun::star::chart2::XFormattedString;
100using ::com::sun::star::chart2::XLegend;
101using ::com::sun::star::chart2::XRegressionCurve;
102using ::com::sun::star::chart2::XRegressionCurveContainer;
103using ::com::sun::star::chart2::XTitle;
104using ::com::sun::star::chart2::XTitled;
105
106using ::com::sun::star::chart2::data::XDataSequence;
107using ::com::sun::star::chart2::data::XDataSource;
108using ::com::sun::star::chart2::data::XLabeledDataSequence;
109
110using ::formula::FormulaToken;
111using ::formula::FormulaTokenArrayPlainIterator;
112
113namespace cssc = ::com::sun::star::chart;
114namespace cssc2 = ::com::sun::star::chart2;
115
116// Helpers ====================================================================
117
118namespace {
119
120XclExpStream& operator<<( XclExpStream& rStrm, const XclChRectangle& rRect )
121{
122 return rStrm << rRect.mnX << rRect.mnY << rRect.mnWidth << rRect.mnHeight;
123}
124
125void lclSaveRecord( XclExpStream& rStrm, XclExpRecordRef const & xRec )
126{
127 if( xRec )
128 xRec->Save( rStrm );
129}
130
132template< typename Type >
133void 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
142template<typename ValueType, typename KeyType>
143void 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
152void 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
160template< typename Type >
161bool lclIsAutoAnyOrGetValue( Type& rValue, const Any& rAny )
162{
163 return !rAny.hasValue() || !(rAny >>= rValue);
164}
165
166bool 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
174sal_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
191bool 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
200sal_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 }
210}
211
212bool 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
236
237 explicit XclExpChRootData( XclExpChChart& rChartData ) : mrChartData( rChartData ) {}
238
240 void RegisterFutureRecBlock( const XclChFrBlock& rFrBlock );
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
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
303Reference< 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
318const 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
328void 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
338bool 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
344void 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
351sal_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
356sal_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
361XclChRectangle 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
392sal_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
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
447 // finalize the future records, must be done before the closing CHEND
449 // CHEND record
451}
452
454{
455 return true;
456}
457
458void 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{
476}
477
478// Frame formatting ===========================================================
479
482{
483 maData.mnTLMode = nTLMode;
485}
486
488{
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
557namespace {
558
560XclExpChLineFormatRef 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();
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 ) );
679
680 // save the record group
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
698sal_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
788{
789 ConvertFrameBase( GetChRoot(), rPropSet, meObjType );
790}
791
792void 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
816 break;
817 default:
819 }
820}
821
823{
825}
826
828{
830}
831
832namespace {
833
835XclExpChFrameRef 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
849namespace {
850
851void 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
882sal_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
947void XclExpChSourceLink::ConvertString( const OUString& aString )
948{
950}
951
952sal_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
1032void 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
1042void 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
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{
1074 << maData.mnFlags
1076 << mxLinkFmla;
1077}
1078
1079// Text =======================================================================
1080
1081XclExpChFont::XclExpChFont( sal_uInt16 nFontIdx ) :
1083{
1084}
1085
1086XclExpChObjectLink::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
1129void 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
1143void 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
1155void XclExpChText::SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId )
1156{
1157 mxFont = xFont;
1158 maData.maTextColor = rColor;
1160 mnTextColorId = nColorId;
1161}
1162
1163void XclExpChText::SetRotation( sal_uInt16 nRotation )
1164{
1165 maData.mnRotation = nRotation;
1167}
1168
1169void 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 );
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
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
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
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{
1387 << maData.mnVAlign
1390 << maData.maRect
1391 << maData.mnFlags;
1392
1393 if( GetBiff() == EXC_BIFF8 )
1394 {
1396 << maData.mnFlags2
1397 << maData.mnRotation;
1398 }
1399}
1400
1401namespace {
1402
1404XclExpChTextRef 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{
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 {
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
1599void 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 );
1617 lclSaveRecord( rStrm, mxPieFmt );
1618 lclSaveRecord( rStrm, mxMarkerFmt );
1619 lclSaveRecord( rStrm, mxSeriesFmt );
1620 lclSaveRecord( rStrm, mxAttLabel );
1621}
1622
1624{
1628 << maData.mnFlags;
1629}
1630
1633 XclExpChRoot( rRoot )
1634{
1635}
1636
1637bool 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() );
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{
1715 << maData.mnOrder
1721}
1722
1725 XclExpChRoot( rRoot )
1726{
1727 maData.mnBarType = nBarType;
1728}
1729
1730bool 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{
1796 << maData.mnLineEnd
1797 << sal_uInt8( 1 ) // must be 1 to make line visible
1798 << maData.mfValue
1800}
1801
1802namespace {
1803
1805ScfPropertySet 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
1821XclExpChSeries::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
1954bool 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
1995bool 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 );
2006 mxTitleLink->ConvertString(aName);
2007
2008 mxSeriesFmt = mxTrendLine->GetDataFormat();
2009 GetChartData().SetDataLabel( mxTrendLine->GetDataLabel() );
2010 }
2011 return bOk;
2012}
2013
2014bool 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
2029void 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 );
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
2061void 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
2115void 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 {
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;
2141 break;
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
2162void XclExpChType::SetStacked( bool bPercent )
2163{
2164 switch( maTypeInfo.meTypeCateg )
2165 {
2169 break;
2173 maData.mnOverlap = -100;
2174 break;
2175 default:;
2176 }
2177}
2178
2180{
2181 switch( GetRecId() )
2182 {
2183 case EXC_ID_CHBAR:
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:
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
2215void 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{
2256 << maData.mnEyeDist
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();
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{
2377}
2378
2380{
2381 rStrm << sal_uInt16(100); // Distance between bars (CHDROPBAR record).
2382}
2383
2384XclExpChTypeGroup::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
2485void 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 {
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
2570bool 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 );
2592}
2593
2594// Axes =======================================================================
2595
2598 XclExpChRoot( rRoot )
2599{
2600}
2601
2602void 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
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 );
2700 rStrm.EndRecord();
2701}
2702
2704{
2706}
2707
2710 XclExpChRoot( rRoot )
2711{
2712}
2713
2714void 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 )
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
2783 << maData.mfCross
2784 << maData.mnFlags;
2785}
2786
2787namespace {
2788
2789sal_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
2807void 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;
2844 }
2845 }
2846}
2847
2848void XclExpChTick::SetFontColor( const Color& rColor, sal_uInt32 nColorId )
2849{
2850 maData.maTextColor = rColor;
2852 mnTextColorId = nColorId;
2853}
2854
2855void XclExpChTick::SetRotation( sal_uInt16 nRotation )
2856{
2857 maData.mnRotation = nRotation;
2860}
2861
2863{
2865 << maData.mnMinor
2867 << maData.mnBackMode;
2868 rStrm.WriteZeroBytes( 16 );
2870 << maData.mnFlags;
2871 if( GetBiff() == EXC_BIFF8 )
2873}
2874
2875namespace {
2876
2878Reference< 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
2892Reference< 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
2918XclExpChAxis::XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType ) :
2920 mnNumFmtIdx( EXC_FORMAT_NOTFOUND )
2921{
2922 maData.mnType = nAxisType;
2923}
2924
2925void XclExpChAxis::SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId )
2926{
2927 mxFont = xFont;
2928 if( mxTick )
2929 mxTick->SetFontColor( rColor, nColorId );
2930}
2931
2932void XclExpChAxis::SetRotation( sal_uInt16 nRotation )
2933{
2934 if( mxTick )
2935 mxTick->SetRotation( nRotation );
2936}
2937
2938void 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
3016void 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 );
3052}
3053
3055{
3056 rStrm << maData.mnType;
3057 rStrm.WriteZeroBytes( 16 );
3058}
3059
3060XclExpChAxesSet::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
3076sal_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. */
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 {
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{
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 }
3245}
3246
3248{
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{
3280}
3281
3282// The chart object ===========================================================
3283
3284static 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{
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
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 );
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
3462XclExpChart::XclExpChart( const XclExpRoot& rRoot, Reference< XModel > const & xModel, const tools::Rectangle& rChartRect ) :
3464 XclExpRoot( rRoot )
3465{
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: */
PropertiesInfo aProperties
const Any & any
sal_Int16 GetYear() const
sal_uInt16 GetMonth() const
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
std::unique_ptr< ScTokenArray > CompileString(const OUString &rFormula)
Tokenize formula expression string into an array of tokens.
Definition: compiler.cxx:4687
SC_DLLPUBLIC const css::uno::Reference< css::i18n::XBreakIterator > & GetBreakIterator()
Definition: documen6.cxx:40
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
Definition: token.cxx:2265
formula::FormulaToken * AddExternalDoubleReference(sal_uInt16 nFileId, const svl::SharedString &rTabName, const ScComplexRefData &rRef)
Definition: token.cxx:2313
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
Definition: token.cxx:2282
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
A wrapper for a UNO property set.
Definition: fapihelper.hxx:104
const css::uno::Reference< css::beans::XPropertySet > & GetApiPropertySet() const
Returns the contained XPropertySet interface.
Definition: fapihelper.hxx:131
void SetProperty(const OUString &rPropName, const Type &rValue)
Puts the passed value into the property set.
Definition: fapihelper.hxx:174
void Set(css::uno::Reference< css::beans::XPropertySet > const &xPropSet)
Sets the passed UNO property set and releases the old UNO property set.
bool GetBoolProperty(const OUString &rPropName) const
Gets the specified Boolean property from the property set.
Definition: fapihelper.cxx:188
bool GetProperty(Type &rValue, const OUString &rPropName) const
Gets the specified property from the property set.
Definition: fapihelper.hxx:148
OUString GetServiceName() const
Returns the service name provided via the XServiceName interface, or an empty string on error.
Definition: fapihelper.cxx:150
bool GetAnyProperty(css::uno::Any &rValue, const OUString &rPropName) const
Gets the specified property from the property set.
Definition: fapihelper.cxx:171
OUString GetStringProperty(const OUString &rPropName) const
Gets the specified Boolean property from the property set.
Definition: fapihelper.cxx:194
bool GetColorProperty(Color &rColor, const OUString &rPropName) const
Gets the specified color property from the property set.
Definition: fapihelper.cxx:201
bool HasProperty(const OUString &rPropName) const
Returns true, if the property set contains the specified property.
Definition: fapihelper.cxx:157
bool Is() const
Returns true, if the contained XPropertySet interface is valid.
Definition: fapihelper.hxx:128
bool IsEmpty() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
sal_uInt64 Seek(sal_uInt64 nPos)
void FlushBuffer()
static sal_uInt16 ReadRotationProperties(const ScfPropertySet &rPropSet, bool bSupportsStacked)
Reads rotation properties from the passed property set.
Definition: xlchart.cxx:895
static void ReadMarkerProperties(XclChMarkerFormat &rMarkerFmt, const ScfPropertySet &rPropSet, sal_uInt16 nFormatIdx)
Reads all marker properties from the passed property set.
Definition: xlchart.cxx:843
void ReadLineProperties(XclChLineFormat &rLineFmt, XclChObjectTable &rDashTable, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode)
Reads all line properties from the passed property set.
Definition: xlchart.cxx:655
bool ReadAreaProperties(XclChAreaFormat &rAreaFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode)
Reads solid area properties from the passed property set.
Definition: xlchart.cxx:728
void ReadEscherProperties(XclChEscherFormat &rEscherFmt, XclChPicFormat &rPicFmt, XclChObjectTable &rGradientTable, XclChObjectTable &rHatchTable, XclChObjectTable &rBitmapTable, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode)
Reads gradient or bitmap area properties from the passed property set.
Definition: xlchart.cxx:749
static OUString GetErrorBarValuesRole(sal_uInt8 nBarType)
Returns the role name for a manual data source for error bars.
Definition: xlchart.cxx:403
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 IsSystemColor(sal_uInt16 nXclIndex) const
Returns true, if the passed Excel color index is a system color.
Definition: xlstyle.hxx:262
Record which contains a Boolean value.
Definition: xerecord.hxx:255
The CH3DDATAFORMAT record containing the bar type in 3D bar charts.
Definition: xechart.hxx:587
XclCh3dDataFormat maData
Definition: xechart.hxx:598
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1540
void Convert(const ScfPropertySet &rPropSet)
Sets 3d bar properties from the passed property set.
Definition: xechart.cxx:1510
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:639
XclChAreaFormat maData
Definition: xechart.hxx:280
bool IsAuto() const
Returns true, if the area format is set to automatic.
Definition: xechart.hxx:270
bool HasArea() const
Returns true, if the area style is set to something visible.
Definition: xechart.hxx:272
sal_uInt32 mnPattColorId
Contents of the CHAREAFORMAT record.
Definition: xechart.hxx:281
sal_uInt32 mnBackColorId
Pattern color identifier.
Definition: xechart.hxx:282
bool Convert(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts area formatting properties from the passed property set.
Definition: xechart.cxx:580
void SetAuto(bool bAuto)
Sets or clears the automatic flag.
Definition: xechart.hxx:265
XclExpChAreaFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:573
void SetDefault(XclChFrameType eDefFrameType)
Sets the area format to the specified default type.
Definition: xechart.cxx:616
bool IsDefault(XclChFrameType eDefFrameType) const
Returns true, if the area contains default formatting according to the passed frame type.
Definition: xechart.cxx:632
The CHATTACHEDLABEL record that contains the type of a data point label.
Definition: xechart.hxx:605
XclExpChAttachedLabel(sal_uInt16 nFlags)
Definition: xechart.cxx:1545
XclExpChTextRef mxYAxisTitle
The X axis title (CHTEXT group).
Definition: xechart.hxx:1110
bool Is3dChart() const
Returns true, if the chart is three-dimensional.
Definition: xechart.cxx:3224
XclExpChAxesSet(const XclExpChRoot &rRoot, sal_uInt16 nAxesSetId)
Definition: xechart.cxx:3060
XclExpChTextRef mxXAxisTitle
The Z axis (CHAXIS group).
Definition: xechart.hxx:1109
XclExpChTypeGroupRef GetFirstTypeGroup() const
Returns first inserted chart type group.
Definition: xechart.cxx:3247
XclExpChAxisRef mxZAxis
The Y axis (CHAXIS group).
Definition: xechart.hxx:1108
XclExpChAxisRef mxYAxis
The X axis (CHAXIS group).
Definition: xechart.hxx:1107
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:3230
XclExpChFrameRef mxPlotFrame
The Z axis title (CHTEXT group).
Definition: xechart.hxx:1112
XclExpChFramePosRef mxFramePos
Contents of the CHAXESSET record.
Definition: xechart.hxx:1105
XclExpChAxisRef mxXAxis
Outer plot area position (CHFRAMEPOS record).
Definition: xechart.hxx:1106
XclExpChTypeGroupRef GetLastTypeGroup() const
Returns last inserted chart type group.
Definition: xechart.cxx:3252
sal_Int32 GetApiAxesSetIndex() const
Returns the axes set index used by the chart API.
Definition: xechart.hxx:1081
void ConvertAxis(XclExpChAxisRef &rxChAxis, sal_uInt16 nAxisType, XclExpChTextRef &rxChAxisTitle, sal_uInt16 nTitleTarget, css::uno::Reference< css::chart2::XCoordinateSystem > const &xCoordSystem, const XclChExtTypeInfo &rTypeInfo, sal_Int32 nCrossingAxisDim)
Converts a complete axis object including axis title.
Definition: xechart.cxx:3257
XclChAxesSet maData
Definition: xechart.hxx:1104
sal_uInt16 GetAxesSetId() const
Returns the index of the axes set (primary/secondary).
Definition: xechart.hxx:1079
XclExpChTextRef mxZAxisTitle
The Y axis title (CHTEXT group).
Definition: xechart.hxx:1111
XclExpRecordList< XclExpChTypeGroup > maTypeGroups
Plot area (CHPLOTFRAME group).
Definition: xechart.hxx:1114
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
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:3277
Represents the CHAXIS record group describing an entire chart axis.
Definition: xechart.hxx:1017
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:3054
XclExpChLabelRangeRef mxLabelRange
Contents of the CHAXIS record.
Definition: xechart.hxx:1047
XclExpChLineFormatRef mxMinorGrid
Major grid line format (CHLINEFORMAT record).
Definition: xechart.hxx:1053
XclExpChFrameRef mxWallFrame
Minor grid line format (CHLINEFORMAT record).
Definition: xechart.hxx:1054
XclExpChLineFormatRef mxAxisLine
Index into font buffer (CHFONT record).
Definition: xechart.hxx:1051
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 ConvertWall(css::uno::Reference< css::chart2::XDiagram > const &xDiagram)
Converts and writes 3D wall/floor properties from the passed diagram.
Definition: xechart.cxx:3016
XclExpChFontRef mxFont
Axis ticks (CHTICK record).
Definition: xechart.hxx:1050
XclExpChValueRangeRef mxValueRange
Category scaling (CHLABELRANGE record).
Definition: xechart.hxx:1048
sal_uInt16 mnNumFmtIdx
Wall/floor format (sub records of CHFRAME group).
Definition: xechart.hxx:1055
XclExpChLineFormatRef mxMajorGrid
Axis line format (CHLINEFORMAT record).
Definition: xechart.hxx:1052
virtual void SetRotation(sal_uInt16 nRotation) override
Sets text rotation to internal data structures.
Definition: xechart.cxx:2932
XclExpChTickRef mxTick
Value scaling (CHVALUERANGE record).
Definition: xechart.hxx:1049
XclChAxis maData
Definition: xechart.hxx:1046
XclExpChAxis(const XclExpChRoot &rRoot, sal_uInt16 nAxisType)
Definition: xechart.cxx:2918
sal_uInt16 GetAxisType() const
Returns the type of this axis.
Definition: xechart.hxx:1035
void Convert(css::uno::Reference< css::chart2::XAxis > const &xAxis, css::uno::Reference< css::chart2::XAxis > const &xCrossingAxis, css::uno::Reference< css::chart::XAxis > const &xChart1Axis, const XclChExtTypeInfo &rTypeInfo)
Converts formatting and scaling settings from the passed axis.
Definition: xechart.cxx:2938
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:3040
Represents the CHCHART3D record that contains 3D view settings.
Definition: xechart.hxx:793
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2252
XclChChart3d maData
Definition: xechart.hxx:809
void Convert(const ScfPropertySet &rPropSet, bool b3dWallChart)
Converts 3d settings for the passed chart type.
Definition: xechart.cxx:2215
Represents the CHCHART record group describing the chart contents.
Definition: xechart.hxx:1128
XclExpRecordList< XclExpChText > maLabels
Chart title (CHTEXT group).
Definition: xechart.hxx:1160
void RemoveLastSeries()
Removes the last created data series object from the series list.
Definition: xechart.cxx:3379
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:3398
void SetManualPlotArea()
Sets the plot area position and size to manual mode.
Definition: xechart.cxx:3391
XclChRectangle maRect
Definition: xechart.hxx:1152
XclExpChAxesSetRef mxSecnAxesSet
Primary axes set (CHAXESSET group).
Definition: xechart.hxx:1157
XclExpChChart(const XclExpRoot &rRoot, css::uno::Reference< css::chart2::XChartDocument > const &xChartDoc, const tools::Rectangle &rChartRect)
Definition: xechart.cxx:3301
XclExpChFrameRef mxFrame
List of series data (CHSERIES groups).
Definition: xechart.hxx:1154
XclChProperties maProps
Chart frame format (CHFRAME group).
Definition: xechart.hxx:1155
XclExpChTextRef mxTitle
Secondary axes set (CHAXESSET group).
Definition: xechart.hxx:1158
XclExpChSeriesRef CreateSeries()
Creates, registers and returns a new data series object.
Definition: xechart.cxx:3367
XclExpChAxesSetRef mxPrimAxesSet
Chart properties (CHPROPERTIES record).
Definition: xechart.hxx:1156
XclExpChSeriesList maSeries
Position of the chart on the sheet (CHCHART record).
Definition: xechart.hxx:1153
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:3423
void SetDataLabel(XclExpChTextRef const &xText)
Stores a CHTEXT group that describes a data point label.
Definition: xechart.cxx:3385
Represents the CHDATAFORMAT record group containing data point properties.
Definition: xechart.hxx:619
bool IsSeriesFormat() const
Returns true, if this objects describes the formatting of an entire series.
Definition: xechart.hxx:632
XclChDataFormat maData
Definition: xechart.hxx:641
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1623
void ConvertDataSeries(const ScfPropertySet &rPropSet, const XclChExtTypeInfo &rTypeInfo)
Converts the passed data series or data point formatting.
Definition: xechart.cxx:1558
void ConvertStockSeries(const ScfPropertySet &rPropSet, bool bCloseSymbol)
Sets default formatting for a series in a stock chart.
Definition: xechart.cxx:1599
void ConvertLine(const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts line formatting for the specified object (e.g.
Definition: xechart.cxx:1608
XclExpRecordRef mxSeriesFmt
Pie segment format (CHPIEFORMAT record).
Definition: xechart.hxx:644
XclExpChPieFormatRef mxPieFmt
Data point marker (CHMARKERFORMAT record).
Definition: xechart.hxx:643
XclExpChDataFormat(const XclExpChRoot &rRoot, const XclChDataPointPos &rPointPos, sal_uInt16 nFormatIdx)
Definition: xechart.cxx:1550
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:1613
XclExpChAttLabelRef mxAttLabel
3D bar format (CH3DDATAFORMAT record).
Definition: xechart.hxx:646
XclExpCh3dDataFormatRef mx3dDataFmt
Series properties (CHSERIESFORMAT record).
Definition: xechart.hxx:645
XclExpChMarkerFormatRef mxMarkerFmt
Contents of the CHDATAFORMAT record.
Definition: xechart.hxx:642
Represents the CHDROPBAR record group describing pos/neg bars in line charts.
Definition: xechart.hxx:848
void Convert(const ScfPropertySet &rPropSet)
Converts and writes the contained frame data to the passed property set.
Definition: xechart.cxx:2366
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2379
XclChObjectType meObjType
Definition: xechart.hxx:862
XclExpChDropBar(const XclExpChRoot &rRoot, XclChObjectType eObjType)
Definition: xechart.cxx:2360
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:2374
virtual void Save(XclExpStream &rStrm) override
Writes the CHESCHERFORMAT record group to the stream, if complex formatting is extant.
Definition: xechart.cxx:671
XclChPicFormat maPicFmt
Fill properties for complex areas (CHESCHERFORMAT record).
Definition: xechart.hxx:313
XclChEscherFormat maData
Definition: xechart.hxx:312
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:710
sal_uInt32 RegisterColor(sal_uInt16 nPropId)
Inserts a color from the contained Escher property set into the color palette.
Definition: xechart.cxx:698
XclExpChEscherFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:649
sal_uInt32 mnColor2Id
First fill color identifier.
Definition: xechart.hxx:315
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:691
bool IsValid() const
Returns true, if the object contains valid formatting data.
Definition: xechart.cxx:666
virtual bool HasSubRecords() const override
Returns true, if this record group contains a CHPICFORMAT record.
Definition: xechart.cxx:685
sal_uInt32 mnColor1Id
Image options, e.g. stretched, stacked (CHPICFORMAT record).
Definition: xechart.hxx:314
void Convert(const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts complex area formatting from the passed property set.
Definition: xechart.cxx:657
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
virtual void SetFont(XclExpChFontRef xFont, const Color &rColor, sal_uInt32 nColorId)=0
Derived classes set font color and color identifier to internal data structures.
virtual ~XclExpChFontBase()
Definition: xechart.cxx:1125
virtual void SetRotation(sal_uInt16 nRotation)=0
Derived classes set text rotation to internal data structures.
The CHFONT record containing a font index for text objects.
Definition: xechart.hxx:426
XclExpChFont(sal_uInt16 nFontIdx)
Definition: xechart.cxx:1081
Additional data label settings in the future record CHFRLABELPROPS.
Definition: xechart.hxx:450
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1119
XclChFrLabelProps maData
Definition: xechart.hxx:464
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
XclExpChFrLabelProps(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1098
XclExpChEscherFormatRef mxEscherFmt
Area format (CHAREAFORMAT record).
Definition: xechart.hxx:349
void WriteFrameRecords(XclExpStream &rStrm)
Writes all contained frame records to the passed stream.
Definition: xechart.cxx:774
XclExpChLineFormatRef mxLineFmt
Definition: xechart.hxx:347
XclExpChAreaFormatRef mxAreaFmt
Line format (CHLINEFORMAT record).
Definition: xechart.hxx:348
void ConvertFrameBase(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts frame formatting properties from the passed property set.
Definition: xechart.cxx:729
virtual ~XclExpChFrameBase()
Definition: xechart.cxx:725
bool IsDefaultFrameBase(XclChFrameType eDefFrameType) const
Returns true, if the frame contains default formatting (as if the frame is missing).
Definition: xechart.cxx:767
void SetDefaultFrameBase(const XclExpChRoot &rRoot, XclChFrameType eDefFrameType, bool bIsFrame)
Sets the frame formatting to the specified default type.
Definition: xechart.cxx:752
XclExpChFramePos(sal_uInt16 nTLMode)
Definition: xechart.cxx:480
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:487
XclChFramePos maData
Definition: xechart.hxx:217
Represents the CHFRAME record group containing object frame properties.
Definition: xechart.hxx:358
bool IsDefault() const
Returns true, if the frame object contains default formats.
Definition: xechart.cxx:798
virtual void Save(XclExpStream &rStrm) override
Writes the entire record group.
Definition: xechart.cxx:808
XclChObjectType meObjType
Contents of the CHFRAME record.
Definition: xechart.hxx:382
bool IsDeleteable() const
Returns true, if the frame object can be deleted because it contains default formats.
Definition: xechart.cxx:803
void SetAutoFlags(bool bAutoPos, bool bAutoSize)
Sets the specified automatic flags.
Definition: xechart.cxx:792
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:822
void Convert(const ScfPropertySet &rPropSet)
Converts frame formatting properties from the passed property set.
Definition: xechart.cxx:787
XclChFrame maData
Definition: xechart.hxx:381
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:827
XclExpChFrame(const XclExpChRoot &rRoot, XclChObjectType eObjType)
Definition: xechart.cxx:781
Base class for chart future records.
Definition: xechart.hxx:194
XclExpChFutureRecordBase(const XclExpChRoot &rRoot, XclFutureRecType eRecType, sal_uInt16 nRecId, std::size_t nRecSize)
Definition: xechart.cxx:465
virtual void Save(XclExpStream &rStrm) override
Writes missing CHFRBLOCKBEGIN records and this record.
Definition: xechart.cxx:472
Base class for chart record groups.
Definition: xechart.hxx:167
virtual ~XclExpChGroupBase() override
Definition: xechart.cxx:429
virtual void Save(XclExpStream &rStrm) override
Saves the header record.
Definition: xechart.cxx:433
virtual bool HasSubRecords() const
Derived classes return whether there are any records embedded in this group.
Definition: xechart.cxx:453
void SetFutureRecordContext(sal_uInt16 nFrContext, sal_uInt16 nFrValue1=0, sal_uInt16 nFrValue2=0)
Sets context information for future record blocks.
Definition: xechart.cxx:458
XclExpChGroupBase(const XclExpChRoot &rRoot, sal_uInt16 nFrType, sal_uInt16 nRecId, std::size_t nRecSize=0)
Definition: xechart.cxx:421
virtual void WriteSubRecords(XclExpStream &rStrm)=0
Derived classes implement writing any records embedded in this group.
XclChFrBlock maFrBlock
Definition: xechart.hxx:187
XclExpChLabelRange(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2596
void Convert(const css::chart2::ScaleData &rScaleData, const ScfPropertySet &rChart1Axis, bool bMirrorOrient)
Converts category axis scaling settings.
Definition: xechart.cxx:2602
XclChDateRange maDateData
Contents of the CHLABELRANGE record.
Definition: xechart.hxx:964
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xechart.cxx:2681
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2703
XclChLabelRange maLabelData
Definition: xechart.hxx:963
void ConvertAxisPosition(const ScfPropertySet &rPropSet)
Converts position settings of a crossing axis at this axis.
Definition: xechart.cxx:2651
Represents the CHLEGEND record group describing the chart legend.
Definition: xechart.hxx:820
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2355
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:2348
XclExpChTextRef mxText
Legend frame position (CHFRAMEPOS record).
Definition: xechart.hxx:836
void Convert(const ScfPropertySet &rPropSet)
Converts all legend settings from the passed property set.
Definition: xechart.cxx:2268
XclExpChFrameRef mxFrame
Legend text format (CHTEXT group).
Definition: xechart.hxx:837
XclExpChLegend(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2263
XclChLegend maData
Definition: xechart.hxx:834
XclExpChFramePosRef mxFramePos
Contents of the CHLEGEND record.
Definition: xechart.hxx:835
bool IsDefault(XclChFrameType eDefFrameType) const
Returns true, if the line contains default formatting according to the passed frame type.
Definition: xechart.cxx:543
bool IsAuto() const
Returns true, if the line format is set to automatic.
Definition: xechart.hxx:239
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:550
XclChLineFormat maData
Definition: xechart.hxx:249
void Convert(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, XclChObjectType eObjType)
Converts line formatting properties from the passed property set.
Definition: xechart.cxx:514
bool HasLine() const
Returns true, if the line style is set to something visible.
Definition: xechart.hxx:241
XclExpChLineFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:492
void SetAuto(bool bAuto)
Sets or clears the automatic flag.
Definition: xechart.hxx:231
sal_uInt32 mnColorId
Contents of the CHLINEFORMAT record.
Definition: xechart.hxx:250
void SetDefault(XclChFrameType eDefFrameType)
Sets the line format to the specified default type.
Definition: xechart.cxx:498
The CHMARKERFORMAT record containing data point marker formatting data.
Definition: xechart.hxx:541
void ConvertStockSymbol(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, bool bCloseSymbol)
Converts symbol properties for stock charts from the passed property set.
Definition: xechart.cxx:1446
bool HasFillColor() const
Returns true, if fill area of markers is visible.
Definition: xechart.hxx:557
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1483
void RegisterColors(const XclExpChRoot &rRoot)
Registers marker colors in palette and stores color identifiers.
Definition: xechart.cxx:1472
void Convert(const XclExpChRoot &rRoot, const ScfPropertySet &rPropSet, sal_uInt16 nFormatIdx)
Converts symbol properties from the passed property set.
Definition: xechart.cxx:1433
sal_uInt32 mnFillColorId
Border line color identifier.
Definition: xechart.hxx:568
bool HasMarker() const
Returns true, if markers are enabled.
Definition: xechart.hxx:553
bool HasLineColor() const
Returns true, if border line of markers is visible.
Definition: xechart.hxx:555
sal_uInt32 mnLineColorId
Contents of the CHMARKERFORMAT record.
Definition: xechart.hxx:567
XclChMarkerFormat maData
Definition: xechart.hxx:566
XclExpChMarkerFormat(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1426
The CHPIEFORMAT record containing data point formatting data for pie segments.
Definition: xechart.hxx:575
void Convert(const ScfPropertySet &rPropSet)
Sets pie segment properties from the passed property set.
Definition: xechart.cxx:1498
Base class for complex chart classes, provides access to other components of the chart.
Definition: xechart.hxx:80
void FinalizeFutureRecBlock(XclExpStream &rStrm)
Called from XclExpChGroupBase::Save, finalizes the current future record level.
Definition: xechart.cxx:416
sal_Int32 CalcChartXFromHmm(sal_Int32 nPosX) const
Converts the passed horizontal coordinate from 1/100 mm to Excel chart units.
Definition: xechart.cxx:351
XclExpChChart & GetChartData() const
Returns a reference to the parent chart data object.
Definition: xechart.cxx:308
void FinishConversion() const
Finishes the API chart document conversion.
Definition: xechart.cxx:333
void ConvertLineFormat(XclChLineFormat &rLineFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode) const
Reads all line properties from the passed property set.
Definition: xechart.cxx:371
static sal_uInt16 ConvertPieRotation(const ScfPropertySet &rPropSet)
Reads the pie rotation property and returns the converted angle.
Definition: xechart.cxx:399
void ConvertEscherFormat(XclChEscherFormat &rEscherFmt, XclChPicFormat &rPicFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode) const
Reads gradient or bitmap area properties from the passed property set.
Definition: xechart.cxx:384
XclChRectangle CalcChartRectFromHmm(const css::awt::Rectangle &rRect) const
Converts the passed rectangle from 1/100 mm to Excel chart units.
Definition: xechart.cxx:361
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 InitializeFutureRecBlock(XclExpStream &rStrm)
Called from XclExpChFutureRecordBase::Save, Initializes the current future record level.
Definition: xechart.cxx:411
const XclChFormatInfo & GetFormatInfo(XclChObjectType eObjType) const
Returns an info struct about auto formatting for the passed object type.
Definition: xechart.cxx:323
XclExpChRootDataRef mxChData
Definition: xechart.hxx:158
sal_Int32 CalcChartYFromHmm(sal_Int32 nPosY) const
Converts the passed vertical coordinate from 1/100 mm to Excel chart units.
Definition: xechart.cxx:356
const XclChTypeInfo & GetChartTypeInfo(XclChTypeId eType) const
Returns chart type info for a unique chart type identifier.
Definition: xechart.cxx:313
sal_uInt16 ConvertFont(const ScfPropertySet &rPropSet, sal_Int16 nScript) const
Reads font properties from the passed property set.
Definition: xechart.cxx:392
const XclExpChRoot & GetChRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xechart.hxx:91
void InitConversion(css::uno::Reference< css::chart2::XChartDocument > const &xChartDoc, const tools::Rectangle &rChartRect) const
Starts the API chart document conversion.
Definition: xechart.cxx:328
virtual ~XclExpChRoot() override
Definition: xechart.cxx:299
void RegisterFutureRecBlock(const XclChFrBlock &rFrBlock)
Called from XclExpChGroupBase::Save, registers a new future record level.
Definition: xechart.cxx:406
bool ConvertAreaFormat(XclChAreaFormat &rAreaFmt, const ScfPropertySet &rPropSet, XclChPropertyMode ePropMode) const
Reads solid area properties from the passed property set.
Definition: xechart.cxx:378
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
XclExpChRoot(const XclExpRoot &rRoot, XclExpChChart &rChartData)
Definition: xechart.cxx:293
css::uno::Reference< css::chart2::XChartDocument > const & GetChartDocument() const
Returns the API Chart document model.
Definition: xechart.cxx:303
Represents the CHSERERRORBAR record containing settings for error bars.
Definition: xechart.hxx:679
XclExpChSerErrorBar(const XclExpChRoot &rRoot, sal_uInt8 nBarType)
Definition: xechart.cxx:1723
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1792
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
XclChSerErrorBar maData
Definition: xechart.hxx:690
Represents the CHSERTRENDLINE record containing settings for a trend line.
Definition: xechart.hxx:653
XclExpChDataFormatRef mxDataFmt
Contents of the CHSERTRENDLINE record.
Definition: xechart.hxx:671
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
XclChSerTrendLine maData
Definition: xechart.hxx:670
XclExpChSerTrendLine(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1631
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1712
XclExpChTextRef mxLabel
Formatting settings of the trend line.
Definition: xechart.hxx:672
Represents the CHSERIES record group describing a data series in a chart.
Definition: xechart.hxx:702
bool ConvertErrorBar(const XclExpChSeries &rParent, const ScfPropertySet &rPropSet, sal_uInt8 nBarId)
Converts the passed error bar settings (called at error bar child series).
Definition: xechart.cxx:2014
void CreateErrorBar(const ScfPropertySet &rPropSet, const OUString &rShowPropName, sal_uInt8 nBarId)
Tries to create an error bar series object (called at parent series).
Definition: xechart.cxx:2088
XclExpChSeries(const XclExpChRoot &rRoot, sal_uInt16 nSeriesIdx)
Definition: xechart.cxx:1821
XclExpChSerTrendLineRef mxTrendLine
CHDATAFORMAT groups for data point formats.
Definition: xechart.hxx:754
XclChSeries maData
Definition: xechart.hxx:746
void InitFromParent(const XclExpChSeries &rParent)
Initializes members of this series to represent a child of the passed series.
Definition: xechart.cxx:2051
XclExpChSerErrorBarRef mxErrorBar
Trend line settings (CHSERTRENDLINE record).
Definition: xechart.hxx:755
void ConvertCategSequence(css::uno::Reference< css::chart2::data::XLabeledDataSequence > const &xCategSeq)
Converts and inserts category ranges for all inserted series.
Definition: xechart.cxx:2029
XclExpChSourceLinkRef mxTitleLink
Contents of the CHSERIES record.
Definition: xechart.hxx:747
sal_uInt16 mnGroupIdx
Error bar settings (CHSERERRORBAR record).
Definition: xechart.hxx:756
void CreateTrendLines(css::uno::Reference< css::chart2::XDataSeries > const &xDataSeries)
Tries to create trend line series objects (called at parent series).
Definition: xechart.cxx:2061
XclExpChSourceLinkRef mxValueLink
Link data for series title.
Definition: xechart.hxx:748
sal_uInt16 mnParentIdx
0-based series index.
Definition: xechart.hxx:758
XclExpRecordList< XclExpChDataFormat > maPointFmts
CHDATAFORMAT group for series format.
Definition: xechart.hxx:753
XclExpChDataFormatRef mxSeriesFmt
Link data for series bubble sizes.
Definition: xechart.hxx:751
XclExpChSourceLinkRef mxBubbleLink
Link data for series category names.
Definition: xechart.hxx:750
bool ConvertTrendLine(const XclExpChSeries &rParent, css::uno::Reference< css::chart2::XRegressionCurve > const &xRegCurve)
Converts the passed error bar settings (called at trend line child series).
Definition: xechart.cxx:1995
sal_uInt16 mnSeriesIdx
Chart type group (CHTYPEGROUP group) this series is assigned to.
Definition: xechart.hxx:757
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2099
XclExpChSourceLinkRef mxCategLink
Link data for series values.
Definition: xechart.hxx:749
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
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:2035
bool ConvertStockSeries(css::uno::Reference< css::chart2::XDataSeries > const &xDataSeries, std::u16string_view rValueRole, sal_uInt16 nGroupIdx, sal_uInt16 nFormatIdx, bool bCloseSymbol)
Converts the passed data series for stock charts.
Definition: xechart.cxx:1954
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
Represents the CHTEXT record group containing text object properties.
Definition: xechart.hxx:494
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:1368
void ConvertTitle(css::uno::Reference< css::chart2::XTitle > const &xTitle, sal_uInt16 nTarget, const OUString *pSubTitle)
Converts all text settings of the passed title text object.
Definition: xechart.cxx:1169
XclExpChText(const XclExpChRoot &rRoot)
Definition: xechart.cxx:1149
virtual void SetRotation(sal_uInt16 nRotation) override
Sets text rotation to internal data structures.
Definition: xechart.cxx:1163
XclExpChFrLabelPropsRef mxLabelProps
Link target for this text object.
Definition: xechart.hxx:531
XclExpChFontRef mxFont
Text object frame properties (CHFRAME group).
Definition: xechart.hxx:529
void ConvertTrendLineEquation(const ScfPropertySet &rPropSet, const XclChDataPointPos &rPointPos)
Converts all settings of the passed trend line equation box.
Definition: xechart.cxx:1339
void ConvertLegend(const ScfPropertySet &rPropSet)
Converts all text settings of the passed legend.
Definition: xechart.cxx:1239
XclExpChSourceLinkRef mxSrcLink
Relative text frame position (CHFRAMEPOS record).
Definition: xechart.hxx:527
XclExpChFrameRef mxFrame
Linked data (CHSOURCELINK with CHSTRING record).
Definition: xechart.hxx:528
sal_uInt32 mnTextColorId
Extended data label properties (CHFRLABELPROPS record).
Definition: xechart.hxx:532
XclExpChFramePosRef mxFramePos
Contents of the CHTEXT record.
Definition: xechart.hxx:526
XclChText maData
Definition: xechart.hxx:525
XclExpChObjectLinkRef mxObjLink
Index into font buffer (CHFONT record).
Definition: xechart.hxx:530
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:1384
sal_uInt16 GetAttLabelFlags() const
Returns the flags needed for the CHATTACHEDLABEL record.
Definition: xechart.cxx:1358
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
bool ConvertDataLabel(const ScfPropertySet &rPropSet, const XclChTypeInfo &rTypeInfo, const XclChDataPointPos &rPointPos)
Converts all settings of the passed data point caption text object.
Definition: xechart.cxx:1246
void Convert(const ScfPropertySet &rPropSet, const XclChExtTypeInfo &rTypeInfo, sal_uInt16 nAxisType)
Converts axis tick mark settings.
Definition: xechart.cxx:2807
void SetRotation(sal_uInt16 nRotation)
Sets text rotation to internal data structures.
Definition: xechart.cxx:2855
sal_uInt32 mnTextColorId
Contents of the CHTICK record.
Definition: xechart.hxx:1005
XclExpChTick(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2800
void SetFontColor(const Color &rColor, sal_uInt32 nColorId)
Sets font color and color identifier to internal data structures.
Definition: xechart.cxx:2848
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2862
XclChTick maData
Definition: xechart.hxx:1004
Represents the CHTYPEGROUP record group describing a group of series.
Definition: xechart.hxx:875
XclExpChType maType
Contents of the CHTYPEGROUP record.
Definition: xechart.hxx:929
XclChTypeGroup maData
Definition: xechart.hxx:928
void ConvertType(css::uno::Reference< css::chart2::XDiagram > const &xDiagram, css::uno::Reference< css::chart2::XChartType > const &xChartType, sal_Int32 nApiAxesSetIdx, bool b3dChart, bool bSwappedAxesSet, bool bHasXLabels)
Converts the passed chart type to Excel type settings.
Definition: xechart.cxx:2392
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
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2588
XclExpChLegendRef mxLegend
3D settings (CHCHART3D record).
Definition: xechart.hxx:933
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
sal_uInt16 GetFreeFormatIdx() const
Returns an unused format index to be used for the next created series.
Definition: xechart.cxx:2513
virtual void WriteSubRecords(XclExpStream &rStrm) override
Writes all embedded records.
Definition: xechart.cxx:2500
XclExpChDropBarRef mxDownBar
White dropbars (CHDROPBAR group).
Definition: xechart.hxx:935
void ConvertCategSequence(css::uno::Reference< css::chart2::data::XLabeledDataSequence > const &xCategSeq)
Converts and inserts category ranges for all inserted series.
Definition: xechart.cxx:2485
XclExpChDropBarRef mxUpBar
Chart legend (CHLEGEND group).
Definition: xechart.hxx:934
const XclChExtTypeInfo & GetTypeInfo() const
Returns the chart type info struct for the contained chart type.
Definition: xechart.hxx:897
XclExpChSeriesList maSeries
Extended chart type info.
Definition: xechart.hxx:931
void ConvertLegend(const ScfPropertySet &rPropSet)
Creates a legend object and converts all legend settings.
Definition: xechart.cxx:2491
sal_uInt16 GetGroupIdx() const
Returns the index of this chart type group format.
Definition: xechart.hxx:895
XclExpChTypeGroup(const XclExpChRoot &rRoot, sal_uInt16 nGroupIdx)
Definition: xechart.cxx:2384
void ConvertSeries(css::uno::Reference< css::chart2::XDiagram > const &xDiagram, css::uno::Reference< css::chart2::XChartType > const &xChartType, sal_Int32 nGroupAxesSetIdx, bool bPercent, bool bConnectorLines)
Converts and inserts all series from the passed chart type.
Definition: xechart.cxx:2417
XclChExtTypeInfo maTypeInfo
Chart type (e.g. CHBAR, CHLINE, ...).
Definition: xechart.hxx:930
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
XclExpChChart3dRef mxChart3d
List of series data (CHSERIES groups).
Definition: xechart.hxx:932
std::map< sal_uInt16, std::unique_ptr< XclExpChLineFormat > > m_ChartLines
Black dropbars (CHDROPBAR group).
Definition: xechart.hxx:937
bool Is3dWallChart() const
Returns true, if chart type supports wall and floor format.
Definition: xechart.hxx:901
bool Is3dChart() const
Returns true, if the chart is three-dimensional.
Definition: xechart.hxx:899
const XclChTypeInfo & GetTypeInfo() const
Returns the chart type info struct for the contained chart type.
Definition: xechart.hxx:781
void SetStacked(bool bPercent)
Sets stacking mode (standard or percent) for the series in this chart type group.
Definition: xechart.cxx:2162
void Convert(css::uno::Reference< css::chart2::XDiagram > const &xDiagram, css::uno::Reference< css::chart2::XChartType > const &xChartType, sal_Int32 nApiAxesSetIdx, bool bSwappedAxesSet, bool bHasXLabels)
Converts the passed chart type and the contained data series.
Definition: xechart.cxx:2115
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2179
XclChTypeInfo maTypeInfo
Contents of the chart type record.
Definition: xechart.hxx:788
XclChType maData
Definition: xechart.hxx:787
XclExpChType(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2108
XclChValueRange maData
Definition: xechart.hxx:983
XclExpChValueRange(const XclExpChRoot &rRoot)
Definition: xechart.cxx:2708
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: xechart.cxx:2777
void ConvertAxisPosition(const ScfPropertySet &rPropSet)
Converts position settings of a crossing axis at this axis.
Definition: xechart.cxx:2752
void Convert(const css::chart2::ScaleData &rScaleData)
Converts value axis scaling settings.
Definition: xechart.cxx:2714
Represents the group of DFF and OBJ records containing all drawing shapes embedded in the chart objec...
Definition: xechart.hxx:1167
virtual void Save(XclExpStream &rStrm) override
Overwrite this method to do any operation while saving the record.
Definition: xechart.cxx:3456
std::shared_ptr< XclExpObjectManager > mxObjMgr
Definition: xechart.hxx:1178
virtual ~XclExpChartDrawing() override
Definition: xechart.cxx:3452
XclExpChartDrawing(const XclExpRoot &rRoot, const css::uno::Reference< css::frame::XModel > &rxModel, const Size &rChartSize)
Definition: xechart.cxx:3428
rtl::Reference< XclExpRecordBase > mxObjRecs
Definition: xechart.hxx:1179
Contains all page (print) settings records for a chart object.
Definition: xepage.hxx:112
XclExpChart(const XclExpRoot &rRoot, css::uno::Reference< css::frame::XModel > const &xModel, const tools::Rectangle &rChartRect)
Definition: xechart.cxx:3462
A record without body.
Definition: xerecord.hxx:184
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:1193
const XclExpFont * GetFont(sal_uInt16 nXclFont) const
Returns the specified font from font list.
Definition: xestyle.cxx:1183
Stores all data of an Excel font and provides export of FONT records.
Definition: xestyle.hxx:155
XclTokenArrayRef CreateFormula(XclFormulaType eType, const ScTokenArray &rScTokArr, const ScAddress *pScBasePos=nullptr, XclExpRefLog *pRefLog=nullptr)
Creates and returns the token array of a formula.
Definition: xeformula.cxx:2644
virtual void Save(XclExpStream &rStrm) override
Writes the extended record header and calls WriteBody().
Definition: xerecord.cxx:206
sal_uInt16 Insert(sal_uInt32 nScNumFmt)
Inserts a number format into the format buffer.
Definition: xestyle.cxx:1357
Stores all used colors in the document.
Definition: xestyle.hxx:76
sal_uInt32 InsertColor(const Color &rColor, XclExpColorType eType, sal_uInt16 nAutoDefault=0)
Inserts the color into the list and updates weighting.
Definition: xestyle.cxx:767
sal_uInt16 GetColorIndex(sal_uInt32 nColorId) const
Returns the Excel palette index of the color with passed color ID.
Definition: xestyle.cxx:782
static sal_uInt32 GetColorIdFromIndex(sal_uInt16 nIndex)
Returns the color ID representing a fixed Excel palette index (i.e.
Definition: xestyle.cxx:772
RecType * GetLastRecord() const
Returns reference to the last existing record or empty reference, if list is empty.
Definition: xerecord.hxx:339
RecType * GetFirstRecord() const
Returns reference to the first existing record or empty reference, if list is empty.
Definition: xerecord.hxx:336
void AppendNewRecord(RecType *pRec)
Appends a newly created record to the list.
Definition: xerecord.hxx:361
size_t GetSize() const
Definition: xerecord.hxx:327
void RemoveRecord(size_t nPos)
Removes the record at the specified position from the list.
Definition: xerecord.hxx:369
bool IsEmpty() const
Definition: xerecord.hxx:326
virtual void Save(XclExpStream &rStrm) override
Writes the complete record list.
Definition: xerecord.hxx:375
void AppendRecord(RecType *pRec)
Appends a record to the list.
Definition: xerecord.hxx:348
RecType * GetRecord(size_t nPos) const
Returns reference to an existing record or empty reference on error.
Definition: xerecord.hxx:333
Base class for single records with any content.
Definition: xerecord.hxx:143
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
sal_uInt16 GetRecId() const
Returns the current record ID.
Definition: xerecord.hxx:156
void SetRecId(sal_uInt16 nRecId)
Sets a new record ID.
Definition: xerecord.hxx:161
Access to global data from other classes.
Definition: xeroot.hxx:113
XclExpFontBuffer & GetFontBuffer() const
Returns the font buffer.
Definition: xeroot.cxx:112
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
Definition: xeroot.cxx:88
XclExpObjectManager & GetObjectManager() const
Returns the drawing object manager.
Definition: xeroot.cxx:148
XclExpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
Definition: xeroot.cxx:118
XclExpPalette & GetPalette() const
Returns the color buffer.
Definition: xeroot.cxx:106
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
This class is used to export Excel record streams.
Definition: xestream.hxx:73
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:645
static XclExpStringRef CreateString(const XclExpRoot &rRoot, const OUString &rString, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Creates a new unformatted string from the passed string.
Definition: xehelper.cxx:531
static void AppendString(XclExpString &rXclString, const XclExpRoot &rRoot, std::u16string_view rString)
Appends an unformatted string to an Excel string object.
Definition: xehelper.cxx:550
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:48
Represents a complete substream of records enclosed into a pair of BOF/EOF records.
Definition: xerecord.hxx:410
A record with a single value of type Type.
Definition: xerecord.hxx:199
void SetValue(const Type &rValue)
Sets a new record value.
Definition: xerecord.hxx:210
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
sal_Int16 GetDefApiScript() const
Returns the default script type, e.g.
Definition: xlroot.hxx:155
XclChPropSetHelper & GetChartPropSetHelper() const
Returns the property set helper for the chart filters.
Definition: xlroot.cxx:424
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
DateTime GetDateTimeFromDouble(double fValue) const
Converts a floating-point value to a date/time value.
Definition: xlroot.cxx:353
sal_uInt16 GetBaseYear() const
Returns the base year depending on the current null date (1900 or 1904).
Definition: xlroot.cxx:333
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:286
XclFontPropSetHelper & GetFontPropSetHelper() const
Returns the property set helper for fonts.
Definition: xlroot.cxx:419
static sal_uInt8 GetXclOrientFromRot(sal_uInt16 nXclRot)
Calculates BIFF2-BIFF5 text orientation from BIFF8 rotation angle.
Definition: xltools.cxx:189
FormulaToken * AddToken(const FormulaToken &)
sal_uInt16 GetLen() const
constexpr Size GetSize() const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
@ TOP_LEFT
top left cell of area
float u
#define ESCHER_Prop_fillBackColor
#define ESCHER_Prop_fillColor
DocumentType eType
void insert_value(Type &rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount)
Inserts a value into a bitfield.
Definition: ftools.hxx:102
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 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
OUString aName
const sal_uInt32 LEFT
const sal_uInt32 TOP
const sal_uInt32 BOTTOM
const sal_uInt32 RIGHT
@ Exception
Type
BOTTOM_LEFT
BOTTOM_RIGHT
TOP_RIGHT
void SvStream & rStrm
std::shared_ptr< T > make_shared(Args &&... args)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
log
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, const ParamIfsResult &rRes)
Definition: interpre.hxx:71
AxisType
The method of calculating the axis min or max value.
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
ObjectType meObjType
ocUnion
#define STREAM_SEEK_TO_BEGIN
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
void InitRange(const ScRange &rRange)
Definition: refdata.hxx:130
ScSingleRefData Ref2
Definition: refdata.hxx:125
ScSingleRefData Ref1
Definition: refdata.hxx:124
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:193
void SetFlag3D(bool bVal)
Definition: refdata.hxx:89
sal_uInt8 mnBase
Definition: xlchart.hxx:899
sal_uInt8 mnTop
Base form.
Definition: xlchart.hxx:900
Color maPattColor
Definition: xlchart.hxx:800
Color maBackColor
Pattern color.
Definition: xlchart.hxx:801
sal_uInt16 mnFlags
Fill pattern.
Definition: xlchart.hxx:803
sal_uInt16 mnPattern
Pattern background color.
Definition: xlchart.hxx:802
XclChRectangle maRect
Definition: xlchart.hxx:1068
sal_uInt16 mnAxesSetId
Position of the axes set (inner plot area).
Definition: xlchart.hxx:1069
sal_uInt16 mnType
Definition: xlchart.hxx:1058
sal_uInt16 mnRelDepth
Height relative to width.
Definition: xlchart.hxx:971
sal_uInt16 mnEyeDist
Elevation (-90...+90deg).
Definition: xlchart.hxx:969
sal_uInt16 mnRelHeight
Eye distance to chart (0...100).
Definition: xlchart.hxx:970
sal_uInt16 mnRotation
Definition: xlchart.hxx:967
sal_uInt16 mnFlags
Space between series.
Definition: xlchart.hxx:973
sal_uInt16 mnDepthGap
Depth relative to width.
Definition: xlchart.hxx:972
sal_Int16 mnElevation
Rotation (0...359deg).
Definition: xlchart.hxx:968
XclChDataPointPos maPointPos
Definition: xlchart.hxx:907
sal_uInt16 mnFormatIdx
Position of the data point or series.
Definition: xlchart.hxx:908
sal_uInt16 mnFlags
Formatting index for automatic colors.
Definition: xlchart.hxx:909
Specifies the position of a data series or data point.
Definition: xlchart.hxx:754
sal_uInt16 mnSeriesIdx
Definition: xlchart.hxx:755
sal_uInt16 mnPointIdx
Series index of series or a data point.
Definition: xlchart.hxx:756
sal_uInt16 mnMajorStep
Maximum value on axis.
Definition: xlchart.hxx:1020
sal_uInt16 mnFlags
Crossing position of other axis.
Definition: xlchart.hxx:1026
sal_uInt16 mnMinorUnit
Distance for minor grid lines.
Definition: xlchart.hxx:1023