1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: chtmodel.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
35 //------------------------------------------------------------------
37 // dieses Define dient nur zum Testen und darf auf keinen Fall aktiv bleiben
38 // Bei Umstellungen alle Files nach SIG_CHARTMODELDEFSCHDOC durchsuchen
39 // #define ChartModel SchChartDocument
40 //------------------------------------------------------------------
41 //STRIP008 class SdrObjGroup;
42 //STRIP008 class SdrRectObj;
44 //STRIP008 class SchModelData;
46 #ifndef _E3D_POLYGON3D_HXX //autogen
47 #include <bf_svx/polygn3d.hxx>
49 #ifndef _E3D_EXTRUD3D_HXX //autogen
50 #include <bf_svx/extrud3d.hxx>
52 #ifndef _E3D_OBJ3D_HXX
53 #include "bf_svx/obj3d.hxx"
57 #include "bf_svx/poly3d.hxx"
60 #ifndef _VIEWPT3D_HXX //autogen
61 #include <bf_svx/viewpt3d.hxx>
64 #ifndef _SV_FIELD_HXX //autogen
65 #include <vcl/field.hxx>
67 #ifndef _SVDTRANS_HXX //autogen
68 #include <bf_svx/svdtrans.hxx>
70 #ifndef _GEN_HXX //autogen
71 #include <tools/gen.hxx>
73 #ifndef _COLOR_HXX //autogen
74 #include <tools/color.hxx>
76 #ifndef _LIST_HXX //autogen
77 #include <tools/list.hxx>
79 #ifndef _SVX_CHRTITEM_HXX //autogen
80 #include <bf_svx/chrtitem.hxx>
82 #ifndef _STRING_HXX //autogen
83 #include <tools/string.hxx>
85 #ifndef _OUTLINER_HXX //autogen
86 #include <bf_svx/svdoutl.hxx>
88 #ifndef _SCH_ADJUST_HXX //autogen
91 #ifndef _SVDOTEXT_HXX //autogen
92 #include <bf_svx/svdotext.hxx>
94 #ifndef _SVDOBJ_HXX //autogen
95 #include <bf_svx/svdobj.hxx>
97 #ifndef _SFXITEMSET_HXX //autogen
98 #include <bf_svtools/itemset.hxx>
100 #ifndef _SVDOBJ_HXX //autogen
101 #include <bf_svx/svdobj.hxx>
103 #ifndef _SVDMODEL_HXX //autogen
104 #include <bf_svx/svdmodel.hxx>
106 #ifndef _PERSIST_HXX //autogen
107 #include <bf_so3/persist.hxx>
109 #ifndef _SFX_OBJSH_HXX //autogen
110 #include <bf_sfx2/objsh.hxx>
113 #include "defines.hxx"
115 #include "chartbar.hxx"
117 #ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_
118 #include <com/sun/star/util/XRefreshable.hpp>
122 namespace binfilter
{
124 class SvNumberFormatter
;
125 class SvNumberFormatterIndexTable
;
137 class E3dCompoundObject
;
141 class SchDataLogBook
;
143 struct DataDescription
;
146 DECLARE_LIST(ItemSetList
, SfxItemSet
*)//STRIP008 DECLARE_LIST(ItemSetList, SfxItemSet*);
147 DECLARE_LIST(DescrList
, E3dLabelObj
*)//STRIP008 DECLARE_LIST(DescrList, E3dLabelObj*);
149 #define VERTICAL_LINE aLine[0].Y() = rRect.Bottom(); aLine[1].Y() = rRect.Top();
150 #define HORIZONTAL_LINE aLine[0].X() = rRect.Left(); aLine[1].X() = rRect.Right();
151 #define LONGMARKS ((nMarkLen * 3) / 2)
152 #define TEXTHEIGHT_OFS 2
153 #define DEFAULT_COLCNT 3
154 #define DEFAULT_ROWCNT 4
156 // base diagram types
157 #define CHTYPE_INVALID 0
159 #define CHTYPE_LINE 1
160 #define CHTYPE_LINESYMB 2 // this one has to be removed !! (why?)
161 #define CHTYPE_AREA 3
162 #define CHTYPE_COLUMN 4 // is also a bar-type
164 #define CHTYPE_CIRCLE 6
167 #define CHTYPE_DONUT 9
168 #define CHTYPE_STOCK 10
169 #define CHTYPE_ADDIN 11
171 #define SETLINES_BLACK 1
172 #define SETLINES_FILLCOLOR 2
173 #define SETLINES_COMPAT 3
174 #define SETLINES_REVERSE 4
176 #define SYMBOLMODE_LEGEND 1 // symbol for leged (default)
177 #define SYMBOLMODE_DESCRIPTION 2 // symbol for series data description
178 #define SYMBOLMODE_LINE 3 // unused (line as symbol)
179 #define SYMBOLMODE_ROW 4 // unused (symbol for series)
181 #define SETFLAG( status, flag ) (status)|= (flag)
182 #define RESETFLAG( status, flag ) (status) = ((status) | (flag)) - (flag)
183 #define ISFLAGSET( status, flag ) (((status) & (flag)) != 0)
185 #define CHS_USER_QUERY 0 // ask for sorting data for xy charts
186 #define CHS_USER_NOQUERY 1 // do not ask for sorting
187 #define CHS_KEEP_ADDIN 2 // if this flag is set a change of chart
188 // type keeps the reference to the AddIn
189 #define CHS_NO_ADDIN_REFRESH 4 // used to avoid recursion in BuildChart
191 #define CHART_NUM_SYMBOLS 8 // number of different polygons as symbols
193 #define CHART_AXIS_PRIMARY_X 1 // never change these defines (persistent) !!!
194 #define CHART_AXIS_PRIMARY_Y 2
195 #define CHART_AXIS_PRIMARY_Z 3
196 #define CHART_AXIS_SECONDARY_Y 4
197 #define CHART_AXIS_SECONDARY_X 5
199 #define CHART_TRACE( w ) DBG_TRACE1( "SCH(%lx):" #w, (long)this )
200 #define CHART_TRACE1( w,a ) DBG_TRACE2( "SCH(%lx):" #w, (long)this, a )
201 #define CHART_TRACE2( w,a,b ) DBG_TRACE3( "SCH(%lx):" #w, (long)this, a,b )
202 #define CHART_TRACE3( w,a,b,c ) DBG_TRACE4( "SCH(%lx):" #w, (long)this, a,b,c )
203 #define CHART_TRACE4( w,a,b,c,d ) DBG_TRACE5( "SCH(%lx):" #w, (long)this, a,b,c,d )
205 class ChartModel
: public SdrModel
212 ChartModel( const String
& rPalettePath
, SfxObjectShell
* pDocSh
);
213 virtual ~ChartModel();
216 virtual void SetChanged( FASTBOOL bFlag
= TRUE
);
217 virtual SdrModel
* AllocModel() const;
218 virtual SdrPage
* AllocPage( FASTBOOL bMasterPage
);
220 void NewOrLoadCompleted( USHORT eMode
);
221 void AdjustPrinter();
223 BOOL
IsInitialized() const;
225 void InitChartData( BOOL bNewTitles
= TRUE
);
227 void BuildChart( BOOL bCheckRange
,
228 long whatTitle
= 0 );
229 SdrObjGroup
* CreateChart( const Rectangle
& rRect
);
231 BOOL
ChangeChart( SvxChartStyle eStyle
, bool bSetDefaultAttr
= true );
232 BOOL
ChangeChartData( SchMemChart
& rData
,
233 BOOL bNewTitles
= TRUE
,
234 BOOL bDontBuild
= FALSE
);
236 void InitDataAttrs();
237 void SetChartData( SchMemChart
& rData
,
238 BOOL bNewTitles
= TRUE
);
239 SchMemChart
* GetChartData() const;
240 /// @descr avoid BuildChart invocation during edit. remember changes in data for later change (SP2) #61907#
241 void SetChartDataBuffered( SchMemChart
& rData
,
242 BOOL bNewTitles
= TRUE
);
244 double GetData( long nCol
,
246 BOOL bPercent
= FALSE
,
247 BOOL bRowData
= TRUE
) const;
248 long GetColCount() const;
249 long GetRowCount() const;
251 BOOL
ChangeSwitchData(BOOL bSwitch
);
252 inline BOOL
IsSwitchData() const;
253 /// dependent of chart type (donut => toggle result)
254 inline BOOL
IsDataSwitched() const;
256 void SetTextFromObject( SdrTextObj
* pObj
, OutlinerParaObject
* pTextObject
);
257 void PrepareOld3DStorage();
258 void CleanupOld3DStorage();
263 { return (Is3DChart() /*&& !IsPieChart()*/); }
264 BOOL
HasBarConnectors( long nRow
) const
265 { return (BOOL
)(m_nDefaultColorSet
&CHSPECIAL_TRACELINES
); }
266 inline void SetBarConnectors( BOOL bOn
, long nRow
);
268 BOOL
IsCol( long nRow
) const;
269 BOOL
IsArea( long nRow
);
271 /// return TRUE if the current chart type supports a given axis type
272 BOOL
CanAxis( long nAxisId
) const;
274 SdrObject
* CreateSymbol( Point aPoint
,
277 SfxItemSet
&aDataAttr
,
279 BOOL bInsert
= TRUE
);
281 void GenerateSymbolAttr( SfxItemSet
& rSymbolAttr
, // #63904#
283 const long nMode
= SYMBOLMODE_LEGEND
);
284 ChartAxis
* GetAxisByUID( long nUId
);
285 void PrepareAxisStorage();
286 ChartAxis
* GetAxis( long nId
);
287 BOOL
HasSecondYAxis() const;
288 /// is the x-axis vertical, ie we have bars not columns
289 BOOL
IsXVertikal() const { return IsBar(); }
291 void DrawStockBars( SdrObjList
* pList
, const Rectangle
& rRect
);
292 BOOL
HasStockBars( SvxChartStyle
* pStyle
= NULL
);
293 void DrawStockLines(SdrObjList
* pList
,const Rectangle
& rRect
);
294 BOOL
HasStockLines( SvxChartStyle
* pStyle
=NULL
);
295 BOOL
HasStockRects( SvxChartStyle
* pStyle
=NULL
);
297 /// core methods for chart::XChartDocument / frame::XModel
300 BOOL
IsLockedBuild();
302 long GetChartShapeType();
304 void SetAttributes( const long nId
,
305 const SfxItemSet
& rAttr
,
306 BOOL bMerge
= TRUE
);
307 void SetAutoPilot( Window
*pWindow
) { pAutoPilot
= pWindow
; } // #46895#
309 void Create2DXYTitles( Rectangle
& rRect
, BOOL bSwitchColRow
);
311 // status flag methods
312 void SetChartStatus( const long nStatus
) { nChartStatus
= nStatus
; }
313 void SetChartStatusFlag( const long flag
) { SETFLAG( nChartStatus
, flag
); }
314 void ResetChartStatusFlag( const long flag
) { RESETFLAG( nChartStatus
, flag
); }
315 long GetChartStatus() { return nChartStatus
; }
316 BOOL
GetChartStatusFlag( const long flag
) { return ISFLAGSET( nChartStatus
, flag
); }
318 void SetupLineColors( const long nMode
, long nStartIndex
= 0 ); //#54870#
320 //Einige (bald alle) Objekte setzen durch Implementation der NbcSetAttributes-Methode
321 //die ChartModel-Attributsspeicher automatisch. Dies ist nicht immer notwendig und
322 //sollte dann abgeschaltet werden, z.B. während des BuildChart
324 /** Most chart objects have overloaded NbcSetAttributes methods for setting
325 draw items at the object specific item sets. This is not always
326 necessary and can be disabled with this method.
327 @returns value that was valid before
329 inline BOOL
SetAttrAutoStorage( const BOOL b
);
331 void SetTitle( const long nId
, const String
& rTitle
);
332 String
GetTitle( const long nId
); // BM
333 void SetHasBeenMoved( const long nId
, BOOL bMoved
= TRUE
);
334 SdrObject
* GetObjectWithId( const long nId
, const long nCol
= 0, const long nRow
= 0 );
336 void StoreObjectsAttributes( SdrObject
* pObj
,
337 const SfxItemSet
& rAttr
,
338 FASTBOOL bReplaceAll
); // #52277#
340 void GetAttr( const long nObjId
, SfxItemSet
& rAttr
, const long nIndex1
= -1 );
341 SfxItemSet
& GetAttr( const long nObjId
, const long nIndex1
= -1) const;
342 BOOL
ChangeAttr( const SfxItemSet
& rAttr
, const long nId
, const long nIndex1
= -1 );
344 /// after binary load restore non-persistent 3d items from scene (is stored completely)
345 void Rescue3DObjAttr( SdrObjList
* pList
); // #52277#
347 /** set number of lines in a bar/line combination chart. This value
348 determines the number of series that should be represented as line
349 beginning from the last series, eg when set to 2 the last two series
350 are lines. This is not availably via GUI, but only via API
352 void SetNumLinesColChart( const long nSet
, BOOL bForceStyleChange
= FALSE
);
353 long GetNumLinesColChart() const { return nNumLinesInColChart
; } // #50212#
355 inline void SetBarPercentWidth( const long nWidth
);
356 long GetBarPercentWidth() const { return nBarPercentWidth
; } // #50116#
358 long GetDefaultColorSet() const { return m_nDefaultColorSet
; } // #50037#
360 /** set an item to the given item set
361 this method is necessary, because for some items (gradients, hatches etc.)
362 special handling is needed (names have to be generated for later XML export)
364 used by PutItemSetWithNameCreation() */
365 void SetItemWithNameCreation( SfxItemSet
& rDestItemSet
, const SfxPoolItem
* pNewItem
);
367 /** Put the new item set into the destination set and generate names for attributes
368 that need this (gradients, hatches etc.)
370 void PutItemSetWithNameCreation( SfxItemSet
& rDestItemSet
, const SfxItemSet
& rNewItemSet
);
372 /** @descr Set the attributes that are used by CalcTextSizeOfOneText.
373 Because the setting of the attributes is rather expensive,
374 better set them once, outside of loops and pass
375 bSetTextAttributes=FALSE to CalcTextSizeOfOneText.
376 @param rTextAttributes These attributes are set to the outliner object pOutliner.
377 @see CalcTextSizeOfOneText */
378 void SetTextAttributes( SfxItemSet
& rTextAttributes
);
380 SdrRectObj
* CreateTextObj( UINT16 nId
,
383 const SfxItemSet
&rAttr
,
385 ChartAdjust eAdjust
= CHADJUST_TOP_LEFT
,
386 const long nMaximumWidth
= -1);
388 Size
CalcMaxDescrSize( BOOL bRowDescr
,
389 SvxChartTextOrient eOrient
,
390 const UINT32 nNumberFormat
,
392 const long MaximumWidth
= -1,
393 Pair
* pFirstAndLast
= NULL
);
396 double GetVariantY( long nRow
);
397 double GetSigmaY( long nRow
);
398 double GetBigErrorY( long nRow
, double fError
);
401 /// returns TRUE, if change requires BuildChart - currently always TRUE !
402 BOOL
IsAttrChangeNeedsBuildChart( const SfxItemSet
& rAttr
);
405 BOOL
SetBaseType( long nBaseType
);
407 // chart features (see chtmode7.cxx)
408 long GetBaseType() const;
410 BOOL
IsPercent() const;
411 BOOL
IsStacked() const;
413 BOOL
IsPieChart() const;
414 BOOL
Is3DChart() const;
415 BOOL
IsNetChart() const;
416 BOOL
IsStackedChart() const;
417 BOOL
IsPercentChart() const;
418 BOOL
IsAxisChart() const;
419 BOOL
IsSplineChart() const;
420 inline BOOL
IsDonutChart() const;
422 // features for series
423 BOOL
HasSymbols( const long nRow
= 0 ) const;
424 BOOL
IsLine( const long nRow
= 0 ) const;
426 // chart features for current chart (default) or the given type
427 BOOL
IsNegativeChart( SvxChartStyle
* pStyle
= NULL
) const;
428 BOOL
IsSignedChart( SvxChartStyle
* pStyle
= NULL
) const;
429 BOOL
IsXYChart( SvxChartStyle
* pStyle
= NULL
) const;
434 SfxItemPool
& GetPool() { return *pItemPool
; }
435 SfxObjectShell
* GetObjectShell() { return pDocShell
; }
437 ProjectionType
GetProjection() { return eProjection
; }
439 SdrObject
* GetDataPointObj( long nCol
, long nRow
);
442 BOOL
HasAxis( long nObjectId
= CHOBJID_ANY
) const;
444 const SfxItemSet
& GetLegendAttr() const;
446 SfxItemSet
GetFullLegendAttr() const;
448 BOOL
ChangeAxisAttr( const SfxItemSet
& rAttr
,
449 SdrObjGroup
* pAxisObj
,
450 BOOL bMerge
= TRUE
);
452 SfxItemSet
GetFullAxisAttr( const SdrObjGroup
* pAxisObj
, bool bOnlyInserted
= false ) const;
454 void PutDataRowAttrAll( const SfxItemSet
& rAttr
,
456 BOOL bClearPoints
= TRUE
);
457 void PutDataRowAttr( long nRow
,
458 const SfxItemSet
& rAttr
,
460 BOOL bClearPoints
= TRUE
);
462 const SfxItemSet
& GetDataRowAttr( long nRow
) const;
464 void PutDataPointAttr( long nCol
,
466 const SfxItemSet
& rAttr
,
467 BOOL bMerge
= TRUE
);
469 const SfxItemSet
& GetDataPointAttr( long nCol
,long nRow
) const;
470 void ClearDataPointAttr( long nCol
, long nRow
, const SfxItemSet
& rAttr
);
471 SfxItemSet
GetFullDataPointAttr( long nCol
, long nRow
) const;
472 SfxItemSet
& MergeDataPointAttr( SfxItemSet
& rAttr
, long nCol
, long nRow
) const;
474 /** @descr Return the raw attributes for the specified data point. The returned
475 pointer is NULL if the attributes have not been explicitely set (that is
476 the normal case). The attributes of the data row are not merged in.
477 @param nCol Column of the data point.
478 @param nRow Row of the data point.
479 @return The returned value is either a pointer to an item set or NULL if no
480 attributes for this specific data point have been set or the given
481 coordinates are not valid.
483 const SfxItemSet
* GetRawDataPointAttr (long nCol
,long nRow
) const;
485 /** @descr Attributes for single data points are only stored explicitely if they
486 differ from those of their data rows. This method returns a flag that
487 indicates wether there exists an item set for the specified data point.
488 @param nCol Column of the data point.
489 @param nRow Row of the data point.
490 @return When an item set for the specified data point exists then TRUE is
493 BOOL
IsDataPointAttrSet( long nCol
, long nRow
) const;
496 void ChangeDataDescr( SvxChartDataDescr eDescr
,
498 long nRowToChange
= -1,
499 BOOL bBuildChart
= TRUE
);
501 BOOL
ResizePage( const Size
& rNewSize
);
503 SvNumberFormatter
* GetNumFormatter() const;
505 SdrOutliner
* GetOutliner() const;
508 void GetAttr( SfxItemSet
& rAttr
);
509 void PutAttr( const SfxItemSet
& rAttr
);
511 ChartScene
* GetScene();
515 BOOL
ChangeStatistics( const SfxItemSet
& rNewAttr
);
517 void SetShowLegend( BOOL bNewShow
);
519 // ToDo: Remove duplicate method declaration where possible
520 inline BOOL
& TextScalability();
521 inline BOOL
TextScalability() const;
523 inline BOOL
& ShowAverage();
524 inline BOOL
ShowAverage() const;
526 inline BOOL
& IsCopied ();
527 inline BOOL
IsCopied() const;
538 SvxChartStyle
& ChartStyle();
539 SvxChartStyle
ChartStyle() const;
542 long PieSegOfs( long nCol
) const;
544 BOOL
& ShowMainTitle();
546 String
& MainTitle ();
548 BOOL
& ShowSubTitle();
552 BOOL
& ShowXAxisTitle();
554 String
& XAxisTitle();
556 BOOL
& ShowYAxisTitle();
558 String
& YAxisTitle();
560 BOOL
& ShowZAxisTitle();
562 String
& ZAxisTitle();
564 BOOL
& ShowXGridMain();
566 BOOL
& ShowXGridHelp();
568 BOOL
& ShowYGridMain();
570 BOOL
& ShowYGridHelp();
572 BOOL
& ShowZGridMain();
574 BOOL
& ShowZGridHelp();
581 Size
& InitialSize();
586 int & SplineDepth() { return nSplineDepth
; }
588 String
& ColText( long nCol
);
590 String
& RowText( long nRow
);
593 long GetAxisUID( long nRow
);
595 void SetShowDataDescr( const BOOL b
) { bShowDataDescr
= b
; }
597 BOOL
ShowXDescr() const;
598 void ShowXDescr( BOOL b
);
599 BOOL
ShowYDescr() const;
600 void ShowYDescr( BOOL b
);
601 BOOL
ShowZAxis() const;
602 void ShowZAxis( BOOL b
);
603 BOOL
ShowXAxis() const;
604 void ShowXAxis( BOOL b
);
605 BOOL
ShowYAxis() const;
606 void ShowYAxis( BOOL b
);
607 BOOL
ShowZDescr() const;
608 void ShowZDescr( BOOL b
);
610 UINT32
GetNumFmt( long nObjId
, BOOL bPercent
);
611 void SetNumFmt( long nObjId
, UINT32 nFmt
, BOOL bPercent
);
613 BOOL
CheckForNewAxisNumFormat();
614 BOOL
UsesOwnNumberFormatter() { return ( pNumFormatter
== pOwnNumFormatter
); }
616 void SetSpotColor( const Color
& rCol
) { aSpotColor
= rCol
; }
618 void SetAmbientIntensity( const double fIntensity
) { fAmbientIntensity
= fIntensity
; }
619 void SetAmbientColor( const Color
& rCol
) { aAmbientColor
= rCol
; }
621 /// @descr FG: Is called from ChartScene::FitInSnapRect only. bSwitch3DRowCol has to be TRUE (?)
622 void Position3DAxisTitles( const Rectangle
& rXDescrOutRect
);
624 void SetPieSegOfs( long nCol
,
627 void ClearItemSetLists();
630 // FG: Diese Abfrage soll ermoeglichen, dass man den linken und den rechten Rand
631 // Notfalls nachregeln kann, wenn die Beschriftung unter den Datenpunkten zentriert ist,
632 // da der erste Datenpunkt auf der Y-Achse liegt und der letzte Datenpunkt meist genau
633 // da, wo das Diagramm aufhoert.
634 BOOL
IsDescriptionCenteredUnderDataPoint();
636 inline BOOL
GetFormatXAxisTextInMultipleLinesIfNecessary();
637 inline void SetFormatXAxisTextInMultipleLinesIfNecessary( BOOL value
);
639 inline BOOL
GetFormatYAxisTextInMultipleLinesIfNecessary();
640 inline void SetFormatYAxisTextInMultipleLinesIfNecessary( BOOL value
);
642 inline BOOL
GetFormatZAxisTextInMultipleLinesIfNecessary();
643 inline void SetFormatZAxisTextInMultipleLinesIfNecessary( BOOL value
);
645 inline BOOL
GetFormatLegendTextInMultipleLinesIfNecessary();
646 inline void SetFormatLegendTextInMultipleLinesIfNecessary( BOOL value
);
648 inline BOOL
GetUseRelativePositions() { return bUseRelativePositionsForChartGroups
; }
649 void SetUseRelativePositions( BOOL value
);
651 void SetAdjustMarginsForLegend( BOOL value
) { bAdjustMarginsForLegend
= value
; }
652 BOOL
GetAdjustMarginsForLegend() { return bAdjustMarginsForLegend
; }
654 void SetAdjustMarginsForMainTitle( BOOL value
) { bAdjustMarginsForMainTitle
= value
; }
655 BOOL
GetAdjustMarginsForMainTitle() { return bAdjustMarginsForMainTitle
; }
657 void SetAdjustMarginsForSubTitle( BOOL value
) { bAdjustMarginsForSubTitle
= value
; }
658 BOOL
GetAdjustMarginsForSubTitle() { return bAdjustMarginsForSubTitle
; }
660 void SetAdjustMarginsForXAxisTitle( BOOL value
) { bAdjustMarginsForXAxisTitle
= value
; }
661 BOOL
GetAdjustMarginsForXAxisTitle() { return bAdjustMarginsForXAxisTitle
; }
663 void SetAdjustMarginsForYAxisTitle( BOOL value
) { bAdjustMarginsForYAxisTitle
= value
; }
664 BOOL
GetAdjustMarginsForYAxisTitle() { return bAdjustMarginsForYAxisTitle
; }
666 void SetAdjustMarginsForZAxisTitle( BOOL value
) { bAdjustMarginsForZAxisTitle
= value
; }
667 BOOL
GetAdjustMarginsForZAxisTitle() { return bAdjustMarginsForZAxisTitle
; }
669 BOOL
GetDiagramHasBeenMovedOrResized() { return bDiagramHasBeenMovedOrResized
; }
670 void SetDiagramHasBeenMovedOrResized( BOOL value
) { bDiagramHasBeenMovedOrResized
=value
; }
672 BOOL
GetMainTitleHasBeenMoved() { return bMainTitleHasBeenMoved
; }
673 void SetMainTitleHasBeenMoved( BOOL value
) { bMainTitleHasBeenMoved
= value
; }
675 BOOL
GetSubTitleHasBeenMoved() { return bSubTitleHasBeenMoved
; }
676 void SetSubTitleHasBeenMoved( BOOL value
) { bSubTitleHasBeenMoved
= value
; }
678 BOOL
GetLegendHasBeenMoved() { return bLegendHasBeenMoved
; }
679 void SetLegendHasBeenMoved( BOOL value
) { bLegendHasBeenMoved
= value
; }
681 BOOL
GetXAxisTitleHasBeenMoved() { return bXAxisTitleHasBeenMoved
; }
682 void SetXAxisTitleHasBeenMoved( BOOL value
) { bXAxisTitleHasBeenMoved
= value
; }
684 BOOL
GetYAxisTitleHasBeenMoved() { return bYAxisTitleHasBeenMoved
; }
685 void SetYAxisTitleHasBeenMoved( BOOL value
) { bYAxisTitleHasBeenMoved
= value
; }
687 BOOL
GetZAxisTitleHasBeenMoved() { return bZAxisTitleHasBeenMoved
; }
688 void SetZAxisTitleHasBeenMoved( BOOL value
) { bZAxisTitleHasBeenMoved
= value
; }
690 inline void SetDiagramRectangle( const Rectangle
&rNewRect
, bool bStoreLast
= true );
691 void SetChartRect( Rectangle
&rValue
) { aChartRect
= rValue
; }
692 Rectangle
& GetChartRect() { return aChartRect
; }
693 void SetLegendPos( const Point
& rPos
) { aLegendTopLeft
= rPos
; }
695 long GetPieRadius() const { return nPieRadius
; }
696 BOOL
HasDefaultGrayArea( SvxChartStyle
* pStyle
= NULL
) const;
697 BOOL
HasDefaultGrayWall( SvxChartStyle
* pStyle
= NULL
) const;
699 void SetNumberFormatter( SvNumberFormatter
* );
700 void DataRangeChanged( long _nOldRowCnt
= 0, long _nOldColCnt
= 0 );
701 void TranslateAllNumFormatIds( SvNumberFormatterIndexTable
* );
703 /** set new doc shell if there was no one before
704 returns true if new shell was set */
705 BOOL
SetObjectShell( SfxObjectShell
* pDocSh
);
707 void SetChartAddIn( ::com::sun::star::uno::Reference
< ::com::sun::star::util::XRefreshable
>& xChartAddin
);
708 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XRefreshable
> GetChartAddIn() const { return mxChartAddIn
; }
710 /// fills the itemset with an intersection of all data row attributes
711 void GetDataRowAttrAll( SfxItemSet
& rOutAttributes
);
713 LanguageType
GetLanguage( const USHORT nId
) const;
714 void SetLanguage( const LanguageType eLang
, const USHORT nId
);
716 virtual void HandsOff();
718 /** The outer sequence contains a sequence for each series. The inner sequence may be empty
719 (default) or contains a list of data-point indices that have attributes (items) differing
720 from the series attributes.
722 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< sal_Int32
> > GetSetDataPointList();
724 /** Whenever the page color changes, the outliner has to be
725 informed about that for auto-colors of text-objects.
727 Note: The page of a chart is always completely covered be the
728 chart area, thus this method should always be called when the
729 background of the chart area changes.
731 void PageColorChanged( const SfxItemSet
& rItems
);
733 /** introduced for #101318#:
735 The chart-internal number formatter is necessary to render values for
736 the UI with a higher standard precision than the one you might get
737 externally (from Calc). As you should not modify the precision of an
738 external number formatter, this one comes in handy.
740 Note that for the dialog only the standard format is used, i.e., any
741 user-defined formats that are only available in the external formatter
742 are not required here.
744 This method is used by SchAttribTabDlg::PageCreated (attrib.cxx)
746 @returns the chart internal number formatter
750 Rectangle
GetDiagramRectangle() { return aDiagramRectangle
; }
752 DECL_LINK( NotifyUndoActionHdl
, SfxUndoAction
* );
753 SfxUndoAction
* GetAndReleaseUndoActionFromDraw() { SfxUndoAction
* pRet
= m_pUndoActionFromDraw
; m_pUndoActionFromDraw
= NULL
; return pRet
;}
754 void SetDeleteUndoActionNotificationFromDraw(BOOL bDelete
) { m_bDeleteUndoActionNotificationFromDraw
=bDelete
;}
756 // friend declarations
757 friend SvStream
& operator << ( SvStream
& rOut
, const ChartModel
& rDoc
);
758 friend SvStream
& operator >> ( SvStream
& rIn
, ChartModel
& rDoc
);
760 friend class SchModelData
;
763 // remark: currently there are no classes that are derived from ChartModel
764 // and also the distinction between private and protected was not very
765 // obvious. So there is no protected section any more
773 ChartBarDescriptor aBarY1
;
774 ChartBarDescriptor aBarY2
;
776 DescrList aXDescrList
;
777 DescrList aYDescrList
;
778 DescrList aZDescrList
;
781 BOOL bNewOrLoadCompleted
;
782 SfxObjectShell
* pDocShell
;
783 BOOL bAttrAutoStorage
;
785 SchMemChart
* pChartDataBuffered
; // save data in buffer while editing chart #61907#
787 OutputDevice
* pChartRefOutDev
;
790 Window
* pAutoPilot
; // #46895#
792 SdrObjList
* pSdrObjList
;
793 Matrix4D aSceneMatrix
;
797 SvNumberFormatter
* pOwnNumFormatter
;
798 SvNumberFormatter
* pNumFormatter
; // points either to pOwnNumFormatter or calc's number formatter
800 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XRefreshable
> mxChartAddIn
;
802 long nBarPercentWidth
; // #50116#
803 long nNumLinesInColChart
;
804 long m_nDefaultColorSet
; // #50037#
806 SchDataLogBook
* pLogBook
;
807 Rectangle aChartRect
;
810 SchItemPool
* pChItemPool
;
815 SchMemChart
* pChartData
;
818 double fAmbientIntensity
;
820 double fSpotIntensity
;
822 SvxChartStyle eChartStyle
;
823 SvxChartStyle eOldChartStyle
;
824 int eChartLinePoints
[ LINE_POINT_COUNT
];
826 List
* pDefaultColors
;
832 SvxChartKindError eErrorKind
;
833 SvxChartIndicate eIndicate
;
834 SvxChartRegress eRegression
;
835 double fIndicatePercent
;
836 double fIndicateBigError
;
837 double fIndicatePlus
;
838 double fIndicateMinus
;
842 /** This member is a temporary storage. I don't understand the comment, so
843 I can't translate it into english, so I leave it in german, maybe an important hint someday:
845 FG: Reiner Zwischenspeicher, wird in chtmod3d.cxx gesetzt und im selben
846 File in Position3DAxisTitles im selben File abgefragt, weil die
847 ChartScene::FitInSnapRect das nicht als Parameter bekommen kann, da
848 diese von der Polyscene gerufen wird. */
849 BOOL bSwitch3DColRow
;
863 BOOL bShowXAxisTitle
;
864 BOOL bShowYAxisTitle
;
865 BOOL bShowZAxisTitle
;
880 BOOL bShowDataDescr
; // show description for all series (esp. important for auto pilot)
882 SfxItemSet
* pTitleAttr
;
883 SfxItemSet
* pMainTitleAttr
;
884 SfxItemSet
* pSubTitleAttr
;
885 SfxItemSet
* pXAxisTitleAttr
;
886 SfxItemSet
* pYAxisTitleAttr
;
887 SfxItemSet
* pZAxisTitleAttr
;
888 SfxItemSet
* pAxisAttr
;
890 ChartAxis
* pChartXAxis
;
891 ChartAxis
* pChartYAxis
;
892 ChartAxis
* pChartZAxis
;
893 ChartAxis
* pChartAAxis
; // secondary x axis
894 ChartAxis
* pChartBAxis
; // secondary y axis
896 SfxItemSet
* pGridAttr
;
897 SfxItemSet
* pXGridMainAttr
;
898 SfxItemSet
* pYGridMainAttr
;
899 SfxItemSet
* pZGridMainAttr
;
900 SfxItemSet
* pXGridHelpAttr
;
901 SfxItemSet
* pYGridHelpAttr
;
902 SfxItemSet
* pZGridHelpAttr
;
903 SfxItemSet
* pDiagramAreaAttr
;
904 SfxItemSet
* pDiagramWallAttr
;
905 SfxItemSet
* pDiagramFloorAttr
;
906 SfxItemSet
* pLegendAttr
;
907 SfxItemSet
* pDummyAttr
;
909 SfxItemSet
* pStockLineAttr
;
910 SfxItemSet
* pStockLossAttr
;
911 SfxItemSet
* pStockPlusAttr
;
914 SfxItemSet
* pTmpXItems
;
915 SfxItemSet
* pTmpYItems
;
916 SfxItemSet
* pTmpZItems
;
918 SfxItemSet
* pChartAttr
;
920 ItemSetList aDataRowAttrList
;
921 ItemSetList aDataPointAttrList
;
922 ItemSetList aSwitchDataPointAttrList
;
923 ItemSetList aRegressAttrList
;
924 ItemSetList aAverageAttrList
;
925 ItemSetList aErrorAttrList
;
927 // this is for 'old 3d storage' (whatever that is ;-)
928 ItemSetList aTmpDataRowAttrList
;
929 ItemSetList aTmpDataPointAttrList
;
930 ItemSetList aTmpSwitchDataPointAttrList
;
933 SvxChartDataDescr eDataDescr
;
937 BOOL bNoBuildChart
; // BuildChart does nothing if this is true
938 BOOL bShouldBuildChart
; // This is set when BuildChart was called and bNoBuildChart was TRUE
940 BOOL mbIsInitialized
;
942 SdrOutliner
* pOutliner
;
944 /// short: textbreak enabled
945 BOOL bFormatXAxisTextInMultipleLinesIfNecessary
;
946 BOOL bFormatYAxisTextInMultipleLinesIfNecessary
;
947 BOOL bFormatZAxisTextInMultipleLinesIfNecessary
;
948 BOOL bFormatLegendTextInMultipleLinesIfNecessary
;
950 /// maximum number of lines for textbreak
951 int nXAxisTextMaximumNumberOfLines
;
952 int nYAxisTextMaximumNumberOfLines
;
953 int nZAxisTextMaximumNumberOfLines
;
955 long nWidthOfFirstXAxisText
;
956 long nWidthOfLastXAxisText
;
958 // positions of chart objects
959 Point aTitleTopCenter
;
960 Point aSubTitleTopCenter
;
961 Rectangle aDiagramRectangle
;
962 Rectangle aLastDiagramRectangle
; // ?
963 Point aLegendTopLeft
;
965 Point aTitleXAxisPosition
;
966 Point aTitleYAxisPosition
;
967 Point aTitleZAxisPosition
;
969 ChartAdjust eAdjustXAxesTitle
;
970 ChartAdjust eAdjustYAxesTitle
;
971 ChartAdjust eAdjustZAxesTitle
;
973 // FG: Falls dieser gesetzt ist so wird bei einem Resize (eigentlich bei jedem Buildchart)
974 // die relative Position der Gruppenobjekte zur Seite beachtet.
975 // Je nach Objekt bleibt die linke obere Ecke oder das Zentrum an der gleichen Stelle.
977 /** On resize objects remember their position relatively to the page if
978 this member is TRUE. For some objects the upper left corner is
979 preserved for others the center position */
980 BOOL bUseRelativePositionsForChartGroups
;
982 /// on manual move of chart objects the calculation of space left has to be changed
983 BOOL bAdjustMarginsForLegend
;
984 BOOL bAdjustMarginsForMainTitle
;
985 BOOL bAdjustMarginsForSubTitle
;
986 BOOL bAdjustMarginsForXAxisTitle
;
987 BOOL bAdjustMarginsForYAxisTitle
;
988 BOOL bAdjustMarginsForZAxisTitle
;
990 /// keep track if objects have manually been repositioned
991 BOOL bDiagramHasBeenMovedOrResized
;
992 BOOL bMainTitleHasBeenMoved
;
993 BOOL bSubTitleHasBeenMoved
;
994 BOOL bLegendHasBeenMoved
;
995 BOOL bXAxisTitleHasBeenMoved
;
996 BOOL bYAxisTitleHasBeenMoved
;
997 BOOL bZAxisTitleHasBeenMoved
;
999 Size aInitialSizefor3d
;
1001 /** test object for calculating the height of two rows
1002 @see GetHeightOfnRows */
1003 SdrRectObj
* pTestTextObj
;
1009 /// document languages
1010 LanguageType eLanguage
;
1011 LanguageType eLanguageCJK
;
1012 LanguageType eLanguageCTL
;
1014 ProjectionType eProjection
;
1016 /// for late loading of graphics
1017 mutable SotStorage
* mpDocStor
;
1018 mutable SotStorageRef mxPictureStorage
;
1019 mutable SotStorageStreamRef mxDocStream
;
1022 SfxUndoAction
* m_pUndoActionFromDraw
;
1023 BOOL m_bDeleteUndoActionNotificationFromDraw
;
1029 bool UsesSourceFormat( long nAxisUID
, SfxItemSet
** pItemSetPointer
= NULL
);
1031 USHORT
GetRegressStrId( long nRow
);
1032 void ResizeText( SfxItemSet
*pTextAttr
, Size aPageSize
, BOOL bResizePage
=TRUE
);
1034 void DeleteObject( SdrObject
* pObj
);
1037 void SetTextAttr( SdrTextObj
&rTextObj
,
1038 const SfxItemSet
&rAttr
,
1039 const long nMaximumWidth
= -1 );
1041 /** @descr This method calculates the size of the bounding box of the text that is already
1042 set at the outliner pOutliner. If MaximumWidth > 0 then the text will be split
1043 (umgebrochen) exactly once at this width.
1044 [Falls der Schalter ChangeBorder auf TRUE steht wird der untere
1045 Rand nachgeregelt, dass muss uber den Schalter passieren, da sonst nicht
1046 zwischen reinen Abfragen und einer Abfrage um eine Aenderung zu erzielen
1047 unterschieden werden kann.]
1048 @param eOrient Distinguishes between horizontal and stacked vertical text orientation.
1049 @param rTextAttr Text attributes determining the text appearence.
1050 @param pOutliner This object does the actual calculation of the bbox size.
1051 @param MaximumWidth Width of predefined text split (if >0).
1052 @param bGetRotated If TRUE then the rotated text (according to the current text rotation)
1053 is used for calculating the bounding box.
1054 @param bSetTextAttributes Only if this flag is TRUE then the attributes rTextAttr are
1055 set to the given outliner. Otherwise they are ignored. This is used to move the
1056 expensive setting of attributes out out loops while at the same time keep the method's
1057 signiture (almost) unchanged.
1058 @see SetTextAttributes
1060 Size
CalcTextSizeOfOneText( SvxChartTextOrient eOrient
,
1061 SfxItemSet
& rTextAttr
,
1062 SdrOutliner
* pOutliner
,
1064 BOOL bGetRotated
= FALSE
,
1065 BOOL bUseTextAttributes
= TRUE
);
1067 SdrObjGroup
* CreateLegend( const Rectangle
&aRect
);
1069 void StoreAttributes( SvStream
& rOut
) const;
1070 void LoadAttributes( SvStream
& rIn
);
1072 void Create2DBackplane( Rectangle
& rRect
,
1073 SdrObjList
& rObjList
,
1075 USHORT eStackMode
);
1077 SdrObjGroup
* Create2DColChart (Rectangle aRect
);
1078 SdrObjGroup
* Create2DRowLineChart (Rectangle aRect
);
1079 SdrObjGroup
* Create2DPieChart (Rectangle aRect
);
1080 SdrObjGroup
* Create2DDonutChart (Rectangle aRect
);
1081 SdrObjGroup
* Create2DNetChart (Rectangle aRect
);
1082 SdrObjGroup
* Create2DXYChart (Rectangle aRect
);
1084 void Create3DBackplanes( Rectangle
& rRect
,
1095 BOOL bSwitchColRow
);
1097 SdrObjGroup
* Create3DDeepChart (Rectangle
&rRect
);
1098 SdrObjGroup
* Create3DFlatChart (Rectangle
&rRect
);
1099 SdrObjGroup
* Create3DNewPieChart (Rectangle
&rRect
);
1101 SdrTextObj
* CreateTitle( SfxItemSet
* pTitleAttr
,
1104 const String
& rText
,
1106 ChartAdjust
* pTextDirection
= NULL
);
1108 void CreateAndInsert3DAxesTitles( Rectangle
&rRect
, BOOL bSwitchColRow
);
1110 E3dCompoundObject
* Create3DBar( Vector3D aPos
,
1116 double nMinPos
= 0.0,
1117 double nOriPos
= 0.0,
1118 double nMaxPos
= 0.0 );
1120 E3dObject
* Create3DObject ( UINT16 ID
);
1121 E3dObject
* Create3DAxisObj ( UINT16 nId
);
1122 E3dScene
* Create3DScene ( UINT16 nId
);
1124 void Create3DPolyObject( const SfxItemSet
* pAttr
,
1125 E3dPolygonObj
* pMyObject
,
1127 E3dObject
* pParent
);
1129 void Create3DExtrudePolyObj( const SfxItemSet
* pAttr
,
1130 E3dExtrudeObj
* pMyObject
,
1132 E3dObject
* pParent
);
1134 ChartScene
* CreateScene( const Rectangle
& rRect
,
1135 const Vector3D
& aLightVec
,
1136 double fSpotIntensity
,
1138 double fAmbientIntensity
,
1139 Color
& aAmbientColor
);
1141 void SetAxisAttributes( const SfxItemSet
* pAttr
,
1142 const SdrObjGroup
* pAxisObj
);
1147 void Dirty2D( long nRowCnt
,
1149 SdrObjList
** pDescrLists
,
1151 DataDescription
* pDescription
);
1154 /// this method shouldn't be used because it is not axis-oriented (why does it exist then?)
1156 /// this one is axis-oriented (whatever that means)
1158 void CreateDefaultColors();
1159 void DestroyDefaultColors();
1164 // ChangeDataRowAttr sub methods
1166 // ChangeDataPointAttr sub methods
1169 // BuildChart sub methods
1170 void CreateRectsAndTitles( long whatTitle
);
1171 void CalculateUpperBorder();
1172 void ResizeChart( const Size
& rPageSize
);
1173 BOOL
CheckRanges( BOOL bCheckAlways
);
1174 void DeleteChartObjects();
1175 void ScaleText( long nTitle
, const Size
& rPageSize
);
1177 void DoShowMainTitle( USHORT
& rIndex
, const long nYOfs
);
1178 void DoShowSubTitle( USHORT
& rIndex
, const long nYOfs
);
1179 void DoShowLegend( const Rectangle
& rWholeRect
,
1185 void LogBookAttrData();
1186 void SetDefAttrRow( SfxItemSet
* pDataRowAttr
, const long i
);
1188 SdrRectObj
* CreateRect( Rectangle
& rRect
,
1191 SfxItemSet
& rAttr
);
1193 SdrObject
* CreatePieSegment( SfxItemSet
& rAttr
,
1201 SdrObject
* CreateDonutSegment( SfxItemSet
& aAttr
,
1210 void Position2DAxisTitles( const Rectangle
& rRect
,
1213 long nTitleBottom
);
1222 inline void ChartModel::SetBarConnectors( BOOL bOn
, long nRow
)
1224 m_nDefaultColorSet
= bOn
1225 ? m_nDefaultColorSet
|CHSPECIAL_TRACELINES
1226 :(m_nDefaultColorSet
|CHSPECIAL_TRACELINES
) - CHSPECIAL_TRACELINES
;
1229 inline BOOL
ChartModel::SetAttrAutoStorage( const BOOL b
)
1231 BOOL ret
= bAttrAutoStorage
;
1232 bAttrAutoStorage
= b
;
1237 inline void ChartModel::SetBarPercentWidth( const long nWidth
)
1239 if( nWidth
<= 100 &&
1241 nBarPercentWidth
= nWidth
;
1244 inline BOOL
& ChartModel::IsCopied()
1249 inline BOOL
ChartModel::IsCopied() const
1254 inline BOOL
& ChartModel::TextScalability()
1256 return bTextScalable
;
1259 inline BOOL
ChartModel::TextScalability() const
1261 return bTextScalable
;
1264 inline BOOL
& ChartModel::ShowAverage()
1266 return bShowAverage
;
1269 inline BOOL
ChartModel::ShowAverage() const
1271 return bShowAverage
;
1274 inline BOOL
ChartModel::IsSwitchData() const
1279 inline BOOL
ChartModel::IsDataSwitched() const
1282 return ! bSwitchData
;
1287 inline BOOL
ChartModel::IsDonutChart() const
1289 return ( eChartStyle
== CHSTYLE_2D_DONUT1
||
1290 eChartStyle
== CHSTYLE_2D_DONUT2
);
1293 inline BOOL
ChartModel::GetFormatXAxisTextInMultipleLinesIfNecessary()
1295 return bFormatXAxisTextInMultipleLinesIfNecessary
;
1297 inline void ChartModel::SetFormatXAxisTextInMultipleLinesIfNecessary( BOOL value
)
1299 bFormatXAxisTextInMultipleLinesIfNecessary
= value
;
1302 inline BOOL
ChartModel::GetFormatYAxisTextInMultipleLinesIfNecessary()
1304 return bFormatYAxisTextInMultipleLinesIfNecessary
;
1306 inline void ChartModel::SetFormatYAxisTextInMultipleLinesIfNecessary( BOOL value
)
1308 bFormatYAxisTextInMultipleLinesIfNecessary
= value
;
1311 inline BOOL
ChartModel::GetFormatZAxisTextInMultipleLinesIfNecessary()
1313 return bFormatZAxisTextInMultipleLinesIfNecessary
;
1315 inline void ChartModel::SetFormatZAxisTextInMultipleLinesIfNecessary( BOOL value
)
1317 bFormatZAxisTextInMultipleLinesIfNecessary
= value
;
1320 inline BOOL
ChartModel::GetFormatLegendTextInMultipleLinesIfNecessary()
1322 return bFormatLegendTextInMultipleLinesIfNecessary
;
1324 inline void ChartModel::SetFormatLegendTextInMultipleLinesIfNecessary( BOOL value
)
1326 bFormatLegendTextInMultipleLinesIfNecessary
= value
;
1329 inline void ChartModel::SetDiagramRectangle( const Rectangle
&rNewRect
, bool bStoreLast
)
1332 aLastDiagramRectangle
= aDiagramRectangle
;
1333 aDiagramRectangle
= rNewRect
;
1336 } //namespace binfilter
1337 #endif // _CHTMODEL_HXX