summaryrefslogtreecommitdiffstats
path: root/bf_sch/source/core/sch_chtmodel.cxx
blob: 707871cd8b17a469ebd7b2964720274b66e68f44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifdef _MSC_VER
#pragma optimize("e",off)

#pragma hdrstop
#endif

class SbxArray;

#include <bf_svx/svdoutl.hxx>

#include "itempool.hxx"

#include <bf_svx/svdpage.hxx>

#include <bf_svx/svdetc.hxx>

#include <bf_svx/eeitem.hxx>
#include <bf_sfx2/app.hxx>
#ifndef _ZFORLIST_HXX
#ifndef _ZFORLIST_DECLARE_TABLE
#define _ZFORLIST_DECLARE_TABLE
#endif
#include <bf_svtools/zforlist.hxx>
#endif
#include <bf_svx/svdorect.hxx>
#include <bf_svx/xlnclit.hxx>
#include <bf_svx/xlnwtit.hxx>
#include <bf_svx/xflclit.hxx>
#include "schattr.hxx"
#include "memchrt.hxx"

#ifndef _SVX_CHRTITEM_HXX
#define ITEMID_DOUBLE           0
#define ITEMID_CHARTTEXTORDER   SCHATTR_TEXT_ORDER
#define ITEMID_CHARTTEXTORIENT  SCHATTR_TEXT_ORIENT
#define ITEMID_CHARTLEGENDPOS   SCHATTR_LEGEND_POS
#define ITEMID_CHARTDATADESCR   SCHATTR_DATADESCR_DESCR
#define ITEMID_LANGUAGE           EE_CHAR_LANGUAGE

#include <bf_svtools/eitem.hxx>

#include <bf_svx/chrtitem.hxx>
#endif

#define ITEMID_FONT        EE_CHAR_FONTINFO
#define ITEMID_COLOR       EE_CHAR_COLOR
#define ITEMID_FONTHEIGHT  EE_CHAR_FONTHEIGHT
#include <bf_svx/fontitem.hxx>
#include <bf_svx/fhgtitem.hxx>
#include <bf_svx/colritem.hxx>
#include <bf_svx/svxids.hrc>
#include <i18npool/lang.h>

#include <bf_svx/xlineit0.hxx>

// header for LinguMgr
#include <bf_svx/unolingu.hxx>
// header for class SvtLinguConfig
#include <bf_svtools/lingucfg.hxx>
// header for getProcessServiceFactory
#include <comphelper/processfactory.hxx>

#ifndef _CHTMODEL_HXX
#include <chtmodel.hxx>
#include <globfunc.hxx>
#endif
#include "schattr.hxx"
#include "charttyp.hxx"

#include "float.h"


#include "pairs.hxx"
#include "stlpool.hxx"
#include "schresid.hxx"
#include "glob.hrc"

#include "chaxis.hxx"

#include "chtscene.hxx"
#include "bf_svx/def3d.hxx"

#include "docshell.hxx"
#include <com/sun/star/chart/ChartDataChangeEvent.hpp>
#include <bf_svx/unolingu.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <bf_svx/langitem.hxx>
#include <bf_svtools/undo.hxx>

#include <legacysmgr/legacy_binfilters_smgr.hxx>
namespace binfilter {

using ::rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::linguistic2;

#define LINGUPROP_DEFLOCALE         "DefaultLocale"
#define LINGUPROP_CJKLOCALE         "DefaultLocale_CJK"
#define LINGUPROP_CTLLOCALE         "DefaultLocale_CTL"


/************************************************************************/

/*************************************************************************
|*
|* Konstruktor
|*
\************************************************************************/

using namespace ::com::sun::star;

/*N*/ ChartModel::ChartModel( const String& rPalettePath, SfxObjectShell* pDocSh ) :
/*N*/   SdrModel( rPalettePath, NULL, (static_cast< SvPersist* >(pDocSh))),
/*N*/   bClearDepth(FALSE),
/*N*/   bNewOrLoadCompleted(FALSE),//aus SchChartDocument::
/*N*/   pDocShell(pDocSh), //aus SchChartDocument::
/*N*/   bAttrAutoStorage(FALSE),
/*N*/   pChartDataBuffered(NULL),
/*N*/   pChartRefOutDev(NULL),
/*N*/   nChartStatus( CHS_USER_QUERY ),
/*N*/   pAutoPilot(NULL),//#46895#
/*N*/   pSdrObjList(NULL),
/*N*/   bResizePie(TRUE),
/*N*/   nPieRadius(0),
/*N*/   pOwnNumFormatter(FALSE),
/*N*/   pNumFormatter(NULL),
/*N*/   nBarPercentWidth(100),   //#50116#
/*N*/   nNumLinesInColChart(0),   //#50212#
/*N*/   m_nDefaultColorSet(0),  //#50037#
/*N*/   aChartRect (Rectangle ()),
/*N*/   aInitialSize (Size ()),
/*N*/   pChItemPool (new SchItemPool),
/*N*/   pScene (0),
/*N*/   aLightVec (new Vector3D (1, 1, 1)), // old: aLightVec (new Vector3D (0, 0, 1)),
/*N*/   pChartData (0),
/*N*/   fMinData (0.0),
/*N*/   fMaxData (0.0),
/*N*/   fAmbientIntensity(0.6),
/*N*/   aAmbientColor(RGBColor(COL_WHITE)),
/*N*/   fSpotIntensity (0.6),
/*N*/   aSpotColor(RGBColor(COL_WHITE)),
/*N*/   eChartStyle (CHSTYLE_2D_COLUMN),
/*N*/   eOldChartStyle (CHSTYLE_3D_XYZSYMBOLS),
/*N*/   pDefaultColors (0),
/*N*/   bTextScalable (TRUE),
/*N*/   bIsCopied (FALSE),
/*N*/   bLegendVisible (TRUE),
/*N*/   bShowAverage (FALSE),
/*N*/   eErrorKind (CHERROR_NONE),
/*N*/   eIndicate (CHINDICATE_NONE),
/*N*/   eRegression (CHREGRESS_NONE),
/*N*/   fIndicatePercent (0.0),
/*N*/   fIndicateBigError (0.0),
/*N*/   fIndicatePlus (0.0),
/*N*/   fIndicateMinus (0.0),
/*N*/   nSplineDepth (3),
/*N*/   nGranularity (20),
/*N*/   bSwitch3DColRow (FALSE), // FG: reiner Zwischenspeicher, damit die ChartScene das nicht als Parameter bekommt
/*N*/                            //     ist immer gleich bSwitchRowCol, das aber wird durchs Chart als Parameter
/*N*/                            //     durchgereicht.
/*N*/   nMarkLen (100),
/*N*/   nPieHeight (20),
/*N*/   pPieSegOfs (0),
/*N*/   nPieSegCount (0),
/*N*/   nXAngle (100), // old: nXAngle (200),
/*N*/   nYAngle (250), // old: nYAngle (350),
/*N*/   nZAngle (0),
/*N*/   bCanRebuild (TRUE),
/*N*/   bShowMainTitle (TRUE),
/*N*/   bShowSubTitle (FALSE),
/*N*/   bShowXAxisTitle (FALSE),
/*N*/   bShowYAxisTitle (FALSE),
/*N*/   bShowZAxisTitle (FALSE),
/*N*/   aMainTitle (String ()),
/*N*/   aSubTitle (String ()),
/*N*/   aXAxisTitle (String ()),
/*N*/   aYAxisTitle (String ()),
/*N*/   aZAxisTitle (String ()),
/*N*/   bShowXGridMain (TRUE),
/*N*/   bShowXGridHelp (FALSE),
/*N*/   bShowYGridMain (FALSE),
/*N*/   bShowYGridHelp (FALSE),
/*N*/   bShowZGridMain (FALSE),
/*N*/   bShowZGridHelp (FALSE),
/*N*/   bShowDataDescr(TRUE),
/*N*/   pChartXAxis(NULL),
/*N*/   pChartYAxis(NULL),
/*N*/   pChartZAxis(NULL),
/*N*/   pChartAAxis(NULL),
/*N*/   pChartBAxis(NULL),
/*N*/   pTmpXItems(NULL),
/*N*/   pTmpYItems(NULL),
/*N*/   pTmpZItems(NULL),
/*N*/   eDataDescr (CHDESCR_NONE),
/*N*/   bShowSym (FALSE),
/*N*/   bSwitchData (TRUE),
/*N*/   bNoBuildChart( FALSE ),
/*N*/   bShouldBuildChart( TRUE ),
/*N*/   bReadError (FALSE),
/*N*/   mbIsInitialized(FALSE),
/*N*/   pOutliner(NULL),
/*N*/       // FG: nMoreData >=12
/*N*/   bFormatXAxisTextInMultipleLinesIfNecessary (TRUE),
/*N*/   bFormatYAxisTextInMultipleLinesIfNecessary (FALSE),
/*N*/   bFormatZAxisTextInMultipleLinesIfNecessary (FALSE),
/*N*/   bFormatLegendTextInMultipleLinesIfNecessary (TRUE),
/*N*/       // FG: nMoreData >=13
/*N*/   nXAxisTextMaximumNumberOfLines(2),
/*N*/   nYAxisTextMaximumNumberOfLines(1),
/*N*/   nZAxisTextMaximumNumberOfLines(1),
/*N*/   nWidthOfFirstXAxisText (0),
/*N*/   nWidthOfLastXAxisText (0),
/*N*/   aTitleTopCenter(-1,-1),
/*N*/   aSubTitleTopCenter(-1,-1),
/*N*/   aDiagramRectangle(-1,-1,-1,-1),
/*N*/   aLastDiagramRectangle(-1,-1,-1,-1),
/*N*/   aLegendTopLeft(-1,-1),
/*N*/   aTitleXAxisPosition (-1,-1),
/*N*/   aTitleYAxisPosition(-1,-1),
/*N*/   aTitleZAxisPosition (-1,-1),
/*N*/   eAdjustXAxesTitle(CHADJUST_TOP_CENTER),
/*N*/   eAdjustYAxesTitle(CHADJUST_TOP_CENTER),
/*N*/   eAdjustZAxesTitle(CHADJUST_TOP_CENTER),
/*N*/   bUseRelativePositionsForChartGroups(FALSE),
/*N*/   bAdjustMarginsForLegend(TRUE),
/*N*/   bAdjustMarginsForMainTitle(TRUE),
/*N*/   bAdjustMarginsForSubTitle(TRUE),
/*N*/   bAdjustMarginsForXAxisTitle(TRUE),
/*N*/   bAdjustMarginsForYAxisTitle(TRUE),
/*N*/   bAdjustMarginsForZAxisTitle(TRUE),
/*N*/   bDiagramHasBeenMovedOrResized(FALSE),
/*N*/   bMainTitleHasBeenMoved(FALSE),
/*N*/   bSubTitleHasBeenMoved(FALSE),
/*N*/   bLegendHasBeenMoved(FALSE),
/*N*/   bXAxisTitleHasBeenMoved(FALSE),
/*N*/   bYAxisTitleHasBeenMoved(FALSE),
/*N*/   bZAxisTitleHasBeenMoved(FALSE),
/*N*/   aInitialSizefor3d (-1,-1),    // FG: Zwischenspeicher fuer InitalSize (siehe chtmod3d.cxx, Position3DAxisTitles
/*N*/   pTestTextObj(NULL),  //  FG: fuer GetHeightOfnRows, ein Dummy-Textpointer
/*N*/   nXLastNumFmt(-1),
/*N*/   nYLastNumFmt(-1),
/*N*/   nBLastNumFmt(-1),
/*N*/   eLanguage( LANGUAGE_SYSTEM ),
/*N*/   eLanguageCJK( LANGUAGE_SYSTEM ),
/*N*/   eLanguageCTL( LANGUAGE_SYSTEM ),
/*N*/   eProjection(PR_PERSPECTIVE),
/*N*/   mpDocStor( NULL ),
/*N*/   m_pUndoActionFromDraw(NULL),
/*N*/   m_bDeleteUndoActionNotificationFromDraw(TRUE)
/*N*/ {
/*N*/   SdrModel::SetNotifyUndoActionHdl(LINK( this, ChartModel, NotifyUndoActionHdl ));
/*N*/
/*N*/     if( pDocSh != NULL )
/*N*/     {
/*N*/         // enable swapping of metafiles and bitmaps that
/*N*/         // might be in a chart as additional objects
/*N*/         SetSwapGraphics( TRUE );
/*N*/     }
/*N*/
/*N*/   aLightVec->Normalize ();
/*N*/
/*N*/   SetScaleUnit(MAP_100TH_MM);
/*N*/   SetScaleFraction(Fraction(1, 1));
/*N*/   SetDefaultFontHeight(847);     // 24pt
/*N*/
/*N*/   SfxItemPool* pPool = &GetItemPool();
/*N*/   pPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
/*N*/   pPool->SetPoolDefaultItem( SfxBoolItem(EE_PARA_HYPHENATE, TRUE) );
/*N*/   pPool->SetPoolDefaultItem(Svx3DPercentDiagonalItem (5));
/*N*/
/*N*/   pOwnNumFormatter = new SvNumberFormatter( ::legacy_binfilters::getLegacyProcessServiceFactory(),
/*N*/                                             LANGUAGE_SYSTEM );
/*N*/   pOwnNumFormatter->ChangeStandardPrec( 15 );
/*N*/
/*N*/   // append pool to end of pool chain
/*N*/   for (;;)
/*N*/   {
/*N*/       SfxItemPool* pSecondary = pPool->GetSecondaryPool();
/*N*/       if (!pSecondary)
/*N*/           break;
/*N*/
/*N*/       pPool = pSecondary;
/*N*/   }
/*N*/
/*N*/   pPool->SetSecondaryPool(pChItemPool);
/*N*/
/*N*/   SfxItemPool* pMasterPool = &GetItemPool();
/*N*/   pMasterPool->FreezeIdRanges();
/*N*/
/*N*/   // get current language
/*N*/   pOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this);
/*N*/   GetDrawOutliner();
/*N*/
/*N*/   try
/*N*/   {
/*N*/         // set language properties
/*N*/         SvtLinguConfig aLinguConfig;
/*N*/         SvtLinguOptions aLinguOptions;
/*N*/
/*N*/         if( aLinguConfig.GetOptions( aLinguOptions ) )
/*N*/         {
/*N*/             SetLanguage( aLinguOptions.nDefaultLanguage,     EE_CHAR_LANGUAGE );
/*N*/             SetLanguage( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK );
/*N*/             SetLanguage( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL );
/*N*/         }
/*N*/     }
/*N*/   catch( uno::Exception aEx )
/*N*/   {
/*N*/ #if OSL_DEBUG_LEVEL > 1
/*N*/         rtl::OString aBStr(rtl::OUStringToOString(aEx.Message, RTL_TEXTENCODING_ASCII_US));
/*N*/         OSL_TRACE( "LinguProperties threw exception: %s", aBStr.getStr());
/*N*/ #endif
/*N*/   }
/*N*/
/*N*/   // init item sets for chart objects
/*N*/   pTitleAttr          = new SfxItemSet(*pItemPool, nTitleWhichPairs);
/*N*/   pMainTitleAttr      = new SfxItemSet(*pItemPool, nTitleWhichPairs);
/*N*/   pSubTitleAttr       = new SfxItemSet(*pItemPool, nTitleWhichPairs);
/*N*/   pXAxisTitleAttr     = new SfxItemSet(*pItemPool, nTitleWhichPairs);
/*N*/   pYAxisTitleAttr     = new SfxItemSet(*pItemPool, nTitleWhichPairs);
/*N*/   pZAxisTitleAttr     = new SfxItemSet(*pItemPool, nTitleWhichPairs);
/*N*/   pAxisAttr           = new SfxItemSet(*pItemPool, nAllAxisWhichPairs);
/*N*/   pGridAttr           = new SfxItemSet(*pItemPool, nGridWhichPairs);
/*N*/   pXGridMainAttr      = new SfxItemSet(*pItemPool, nGridWhichPairs);
/*N*/   pYGridMainAttr      = new SfxItemSet(*pItemPool, nGridWhichPairs);
/*N*/   pZGridMainAttr      = new SfxItemSet(*pItemPool, nGridWhichPairs);
/*N*/   pXGridHelpAttr      = new SfxItemSet(*pItemPool, nGridWhichPairs);
/*N*/   pYGridHelpAttr      = new SfxItemSet(*pItemPool, nGridWhichPairs);
/*N*/   pZGridHelpAttr      = new SfxItemSet(*pItemPool, nGridWhichPairs);
/*N*/   pDiagramAreaAttr    = new SfxItemSet(*pItemPool, nDiagramAreaWhichPairs);
/*N*/   pDiagramWallAttr    = new SfxItemSet(*pItemPool, nDiagramAreaWhichPairs);
/*N*/   pDiagramFloorAttr   = new SfxItemSet(*pItemPool, nDiagramAreaWhichPairs);
/*N*/   pLegendAttr         = new SfxItemSet(*pItemPool, nLegendWhichPairs);
/*N*/   pChartAttr          = new SfxItemSet(*pItemPool, nChartWhichPairs);
/*N*/   pDummyAttr          = new SfxItemSet(*pItemPool, nRowWhichPairs);
/*N*/
/*N*/   pStockLineAttr      = new SfxItemSet(*pItemPool, nRowWhichPairs);
/*N*/   pStockLossAttr      = new SfxItemSet(*pItemPool, nRowWhichPairs);
/*N*/   pStockPlusAttr      = new SfxItemSet(*pItemPool, nRowWhichPairs);
/*N*/
/*N*/   SdrPage* pPage = GetPage(0);
/*N*/   if (pPage) aInitialSize = pPage->GetSize();
/*N*/
/*N*/   CreateDefaultColors ();
/*N*/   eChartLinePoints[0] =
/*N*/   eChartLinePoints[1] =
/*N*/   eChartLinePoints[2] =
/*N*/   eChartLinePoints[3] =
/*N*/   eChartLinePoints[4] =
/*N*/   eChartLinePoints[5] =
/*N*/   eChartLinePoints[6] =
/*N*/   eChartLinePoints[7] =
/*N*/   eChartLinePoints[8] = 0;
/*N*/
/*N*/   Font aLatinFont( OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, GetLanguage( EE_CHAR_LANGUAGE ), DEFAULTFONT_FLAGS_ONLYONE ) );
/*N*/   SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
/*N*/                             aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
/*N*/
/*N*/   Font aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE ) );
/*N*/   SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
/*N*/                                aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
/*N*/
/*N*/   Font aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) );
/*N*/   SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
/*N*/                                aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
/*N*/
/*N*/   // main title
/*N*/   pTitleAttr->Put(aSvxFontItem);
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 459, 100, EE_CHAR_FONTHEIGHT )); // 13pt
/*N*/   pTitleAttr->Put(aSvxFontItemCJK);
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 459, 100, EE_CHAR_FONTHEIGHT_CJK )); // 13pt
/*N*/   pTitleAttr->Put(aSvxFontItemCTL);
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 459, 100, EE_CHAR_FONTHEIGHT_CTL )); // 13pt
/*N*/   pTitleAttr->Put(XLineStyleItem(XLINE_NONE));
/*N*/   pTitleAttr->Put(XFillStyleItem(XFILL_NONE));
/*N*/   pTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC));
/*N*/   pMainTitleAttr->Put(*pTitleAttr);
/*N*/
/*N*/   // sub title
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 388, 100, EE_CHAR_FONTHEIGHT )); // 11pt
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 388, 100, EE_CHAR_FONTHEIGHT_CJK )); // 11pt
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 388, 100, EE_CHAR_FONTHEIGHT_CTL )); // 11pt
/*N*/   pSubTitleAttr->Put(*pTitleAttr);
/*N*/
/*N*/   // axis titles
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 318, 100, EE_CHAR_FONTHEIGHT )); // 9pt
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 318, 100, EE_CHAR_FONTHEIGHT_CJK )); // 9pt
/*N*/   pTitleAttr->Put(SvxFontHeightItem( 318, 100, EE_CHAR_FONTHEIGHT_CTL )); // 9pt
/*N*/   pXAxisTitleAttr->Put(*pTitleAttr);
/*N*/   pYAxisTitleAttr->Put(*pTitleAttr);
/*N*/   pZAxisTitleAttr->Put(*pTitleAttr);
/*N*/
/*N*/   // general axis attributies: are also set in class ChartAxis()
/*N*/   // (BM) => deprecated and therefore removed here
/*N*/
/*N*/     Color aAreaBackColor( RGBColor( COL_WHITE ));
/*N*/   pDiagramAreaAttr->Put(XLineStyleItem(XLINE_NONE));
/*N*/   pDiagramAreaAttr->Put(XFillColorItem(String(), aAreaBackColor));
/*N*/
/*N*/     // set the page color (in a chart this is the color of the area)
/*N*/     // at the outliner
/*N*/     if( pOutliner )
/*N*/         pOutliner->SetBackgroundColor( aAreaBackColor );
/*N*/
/*N*/   pDiagramWallAttr->Put(XLineStyleItem(XLINE_NONE));
/*N*/   pDiagramWallAttr->Put(XFillStyleItem(XFILL_NONE));
/*N*/
/*N*/   pDiagramFloorAttr->Put(XLineStyleItem(XLINE_NONE));
/*N*/   pDiagramFloorAttr->Put(XFillColorItem(String(), Color(153, 153, 153)));
/*N*/
/*N*/   pLegendAttr->Put(aSvxFontItem);
/*N*/   pLegendAttr->Put(aSvxFontItemCJK);
/*N*/   pLegendAttr->Put(aSvxFontItemCTL);
/*N*/   pLegendAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT ));    // 6pt #72012#
/*N*/   pLegendAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CJK ));    // 6pt #72012#
/*N*/   pLegendAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CTL ));    // 6pt #72012#
/*N*/   pLegendAttr->Put(XFillStyleItem(XFILL_NONE));
/*N*/
/*N*/   //Todo: ueberpruefen, ob noch korekkt, es wird der default-ChartTyp erzeugt und der
/*N*/   //AttrSet in pChartAttr gesetzt
/*N*/   ChartType aTyp((SvxChartStyle) CHSTYLE_2D_COLUMN);
/*N*/   aTyp.GetAttrSet(pChartAttr);
/*N*/
/*N*/   // the dummy attribute is (mainly!) used for data row defaults
/*N*/   // so avoid setting (pool) default values here as fixed
/*N*/   pDummyAttr->Put( aSvxFontItem );
/*N*/   pDummyAttr->Put( aSvxFontItemCJK );
/*N*/   pDummyAttr->Put( aSvxFontItemCTL );
/*N*/   pDummyAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT )); // 6pt #72012#
/*N*/   pDummyAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CJK )); // 6pt #72012#
/*N*/   pDummyAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CTL )); // 6pt #72012#
/*N*/
/*N*/   // what are these needed for?
/*N*/   pDummyAttr->Put (SfxInt32Item (SCHATTR_DUMMY0, (INT32) eChartStyle));
/*N*/   pDummyAttr->Put (SfxInt32Item (SCHATTR_DUMMY1, 0));
/*N*/
/*N*/   pStockLossAttr->Put(XFillColorItem(String(), RGBColor(COL_BLACK)));
/*N*/   pStockPlusAttr->Put(XFillColorItem(String(), RGBColor(COL_WHITE)));
/*N*/
/*N*/   // this test object is for calculating the text height in GetHeightOfnRows
/*N*/   // (chtmode1.cxx) without creating a new object for each call.
/*N*/   pTestTextObj = new SdrRectObj (OBJ_TEXT, Rectangle(0, 0, 10, 10) /*, aTestStr*/);
/*N*/
/*N*/   //Aus SchChartDocument::
/*N*/   SetStyleSheetPool(new SchStyleSheetPool(*pItemPool));
/*N*/   ((SdrOutliner*)pDrawOutliner)->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool);
/*N*/   pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool);
/*N*/
/*N*/   // Layer anlegen
/*N*/
/*N*/   SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
/*N*/   rLayerAdmin.NewLayer( SchResId( STR_LAYOUT ).toString() );
/*N*/   rLayerAdmin.NewLayer( SchResId( STR_CONTROLS ).toString() );
/*N*/
/*N*/
/*N*/   //Wichtig! die Achsen muessen jetzt erstellt werden, dies darf erst nach dem
/*N*/   //anlegen des ItemPools und der Defaults passieren!
/*N*/   pChartXAxis = new ChartAxis( this, CHART_AXIS_X, CHAXIS_AXIS_X );
/*N*/   pChartYAxis = new ChartAxis( this, CHART_AXIS_Y, CHAXIS_AXIS_Y );
/*N*/   pChartZAxis = new ChartAxis( this, CHART_AXIS_Z, CHAXIS_AXIS_Z );
/*N*/   pChartBAxis = new ChartAxis( this, CHART_AXIS_Y, CHAXIS_AXIS_B );
/*N*/   pChartAAxis = new ChartAxis( this, CHART_AXIS_X, CHAXIS_AXIS_A );
/*N*/
/*N*/   pChartYAxis->IfNoDataLookAt( CHAXIS_AXIS_B ); //Falls Achse nur ein Spiegelbild ist....
/*N*/   pChartBAxis->IfNoDataLookAt( CHAXIS_AXIS_Y ); //d.h. keine eigenen Datenreihen besitzt
/*N*/
/*N*/   aBarY1.Assign(this,pChartYAxis);
/*N*/   aBarY2.Assign(this,pChartBAxis);
/*N*/
/*N*/   pChartXAxis->SetAllAxisAttr(pAxisAttr);
/*N*/   pChartYAxis->SetAllAxisAttr(pAxisAttr);
/*N*/   pChartZAxis->SetAllAxisAttr(pAxisAttr);
/*N*/   pChartAAxis->SetAllAxisAttr(pAxisAttr);
/*N*/   pChartBAxis->SetAllAxisAttr(pAxisAttr);
/*N*/
/*N*/   pChartXAxis->SetGridAttrList(pYGridMainAttr);//XGrid->YAchse :(  (u.U.)
/*N*/   pChartYAxis->SetGridAttrList(pXGridMainAttr);
/*N*/
/*N*/   SetNumberFormatter( pOwnNumFormatter );             // sets number formatter also for all axes
/*N*/
/*N*/   long nTmp=pNumFormatter->GetStandardFormat(NUMBERFORMAT_NUMBER, LANGUAGE_SYSTEM);
/*N*/   SetNumFmt(CHOBJID_DIAGRAM_X_AXIS,nTmp,FALSE);
/*N*/   SetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,nTmp,FALSE);
/*N*/   SetNumFmt(CHOBJID_DIAGRAM_Z_AXIS,nTmp,FALSE);
/*N*/   SetNumFmt(CHOBJID_DIAGRAM_A_AXIS,nTmp,FALSE);
/*N*/   SetNumFmt(CHOBJID_DIAGRAM_B_AXIS,nTmp,FALSE);
/*N*/
/*N*/   pChartBAxis->ShowAxis(FALSE);
/*N*/   pChartBAxis->ShowDescr(FALSE);
/*N*/   pChartAAxis->ShowAxis(FALSE);
/*N*/   pChartAAxis->ShowDescr(FALSE);
/*N*/
/*N*/   pSdrObjList=new SdrObjList(this,NULL);
/*N*/
/*N*/     // #99528# change auto-font color according to default diagram area
/*N*/     PageColorChanged( *pDiagramAreaAttr );
/*N*/ }

/*************************************************************************
|*
|* Destruktor
|*
\************************************************************************/
void ChartModel::ClearItemSetLists()
{
    for (size_t i = 0, nCount = aDataRowAttrList.size(); i < nCount; i++)
        delete aDataRowAttrList[ i ];
    aDataRowAttrList.clear();

    for (size_t i = 0, nCount = aRegressAttrList.size(); i < nCount; i++)
        delete aRegressAttrList[ i ];
    aRegressAttrList.clear();

    for (size_t i = 0, nCount = aDataPointAttrList.size(); i < nCount; i++)
        delete aDataPointAttrList[ i ];
    aDataPointAttrList.clear();

    for (size_t i = 0, nCount = aSwitchDataPointAttrList.size(); i < nCount; i++)
        delete aSwitchDataPointAttrList[ i ];
    aSwitchDataPointAttrList.clear();

    for (size_t i = 0, nCount = aAverageAttrList.size(); i < nCount; i++)
        delete aAverageAttrList[ i ];
    aAverageAttrList.clear();

    for (size_t i = 0, nCount = aErrorAttrList.size(); i < nCount; i++)
        delete aErrorAttrList[ i ];
    aErrorAttrList.clear();

}

/*N*/ ChartModel::~ChartModel()
/*N*/ {
/*N*/   if(pTmpXItems)
/*N*/       delete pTmpXItems;
/*N*/   if(pTmpYItems)
/*N*/       delete pTmpYItems;
/*N*/   if(pTmpZItems)
/*N*/       delete pTmpZItems;
/*N*/
/*N*/   if(pChartRefOutDev)
/*?*/       delete pChartRefOutDev;
/*N*/
/*N*/   Clear();//aus SchChartDocument::
/*N*/
/*N*/   delete pTitleAttr;
/*N*/   delete pMainTitleAttr;
/*N*/   delete pSubTitleAttr;
/*N*/   delete pXAxisTitleAttr;
/*N*/   delete pYAxisTitleAttr;
/*N*/   delete pZAxisTitleAttr;
/*N*/   delete pAxisAttr;
/*N*/
/*N*/   delete pChartXAxis;
/*N*/   delete pChartYAxis;
/*N*/   delete pChartZAxis;
/*N*/   delete pChartAAxis;
/*N*/   delete pChartBAxis;
/*N*/
/*N*/   delete pGridAttr;
/*N*/   delete pXGridMainAttr;
/*N*/   delete pYGridMainAttr;
/*N*/   delete pZGridMainAttr;
/*N*/   delete pXGridHelpAttr;
/*N*/   delete pYGridHelpAttr;
/*N*/   delete pZGridHelpAttr;
/*N*/   delete pDiagramAreaAttr;
/*N*/   delete pDiagramWallAttr;
/*N*/   delete pDiagramFloorAttr;
/*N*/   delete pLegendAttr;
/*N*/   delete pChartAttr;
/*N*/   delete pDummyAttr;
/*N*/   delete aLightVec;
/*N*/
/*N*/   delete pStockLineAttr;
/*N*/   delete pStockLossAttr;
/*N*/   delete pStockPlusAttr;
/*N*/
/*N*/   DestroyDefaultColors();
/*N*/   delete pOutliner;
/*N*/   ClearItemSetLists();
/*N*/
/*N*/   // suche nach dem ChartPool in der Poolkette, loesche alle verbindungen
/*N*/   // und vernichte den pool. vorgehen ist unabhaengig von der anzahl
/*N*/   // der vorangehendem pools. [RB]
/*N*/   SfxItemPool* pPool = &GetItemPool();
/*N*/
/*N*/   for (;;)
/*N*/   {
/*N*/       SfxItemPool* pSecondary = pPool->GetSecondaryPool();
/*N*/       if (pSecondary == pChItemPool)
/*N*/       {
/*N*/           pPool->SetSecondaryPool (NULL);
/*N*/           break;
/*N*/       }
/*N*/
/*N*/       pPool = pSecondary;
/*N*/   }
/*N*/
/*N*/   delete pChItemPool;
/*N*/
/*N*/   delete pOwnNumFormatter;
/*N*/
/*N*/   delete[] pPieSegOfs;
/*N*/
/*N*/   if(pChartData)
/*N*/   {
/*N*/       if(pChartData->DecreaseRefCount())
/*N*/           delete pChartData;
/*N*/       pChartData=NULL;
/*N*/   }
/*N*/
/*N*/   if (pTestTextObj != NULL) delete pTestTextObj;
/*N*/
/*N*/
/*N*/
/*N*/   SdrObject *pObj;
/*N*/   while(pSdrObjList->GetObjCount())
/*?*/       if((pObj=pSdrObjList->RemoveObject(0)))
/*?*/           delete  pObj;
/*N*/   delete pSdrObjList;
/*N*/
/*N*/   if(m_pUndoActionFromDraw) delete m_pUndoActionFromDraw;
/*N*/ }

/*************************************************************************
|*
|* Chart-Datenstruktur auswechseln; bisherige wird ggf. geloescht;
|* Liefert TRUE, wenn die Chart-Datenstruktur gewechselt wurde.
|*
\************************************************************************/

/*N*/ BOOL ChartModel::ChangeChartData(SchMemChart& rData, BOOL bNewTitles,BOOL bDontBuild)
/*N*/ {
/*N*/   if (pChartData == &rData) return FALSE;
/*N*/   else
/*N*/   {
/*N*/       SetChartData(rData, bNewTitles);
/*N*/
/*N*/       if( pDocShell &&
/*N*/           pDocShell->ISA( SchChartDocShell ))
/*N*/       {
/*N*/           chart::ChartDataChangeEvent aEvent;
/*N*/           aEvent.Type = chart::ChartDataChangeType_ALL;
/*N*/           aEvent.StartColumn = 0;
/*N*/           aEvent.EndColumn = 0;
/*N*/           aEvent.StartRow = 0;
/*N*/           aEvent.EndRow = 0;
/*N*/           (static_cast< SchChartDocShell* >(pDocShell))->DataModified( aEvent );
/*N*/       }
/*N*/
/*N*/       if(!bDontBuild)
/*N*/           BuildChart(FALSE);
/*N*/       return TRUE;
/*N*/   }
/*N*/ }

/*************************************************************************
|*
|* Datenzeilen in Reihen/Spalten umschalten;
|* Liefert bei Umschaltung TRUE
|*
\************************************************************************/

/*N*/ BOOL ChartModel::ChangeSwitchData(BOOL bSwitch)
/*N*/ {
/*N*/   if (bSwitchData == bSwitch) return FALSE;
/*N*/   else
/*N*/   {
/*N*/       bSwitchData = bSwitch;
/*N*/
/*N*/ #ifndef NO_56798_FIX //#56798# QuickFix 5.0-Final
/*N*/       if( IsReal3D() )
/*N*/       {
/*?*/           bClearDepth=TRUE;
/*?*/           for( size_t i = 0, nORow = aDataRowAttrList.size(); i < nORow; i++ )
/*?*/               aDataRowAttrList[ i ]->ClearItem(SDRATTR_3DOBJ_DEPTH);
/*?*/           SfxItemSet* pAttributes;

/*?*/           for( size_t i = 0, nORow = aDataPointAttrList.size(); i < nORow; i++ )
/*?*/           {
/*?*/               pAttributes = aDataPointAttrList[ i ];
/*?*/               if (pAttributes != NULL)
/*?*/                   pAttributes->ClearItem(SDRATTR_3DOBJ_DEPTH);
/*?*/           }

/*?*/           for( size_t i = 0, nORow = aSwitchDataPointAttrList.size(); i < nORow; i++ )
/*?*/           {
/*?*/               pAttributes = aSwitchDataPointAttrList[ i ];
/*?*/               if (pAttributes != NULL)
/*?*/                   pAttributes->ClearItem(SDRATTR_3DOBJ_DEPTH);
/*?*/           }
/*N*/       }
/*N*/ #endif
/*N*/
/*N*/         // the number of series may change, so the attribute list
/*N*/         // must be adapted
/*N*/         InitDataAttrs();
/*N*/
/*N*/       // BM: #68764#
/*N*/       // if global data descriptions are on transfer them to new rows
/*N*/       if( eDataDescr != CHDESCR_NONE )
/*N*/       {
/*?*/           ChangeDataDescr( eDataDescr, bShowSym, -1, FALSE );
/*N*/       }
/*N*/
/*N*/       BuildChart(FALSE);
/*N*/       return TRUE;
/*N*/   }
/*N*/ }




/** @descr  Set up the line attributes of every data row.  This includes
        the line style, width, and color.  Style is set to solid, width to
        the minimal width (if the given mode is not SETLINES_COMPAT).
        The color depends on the given mode.
        If the chart is a stock chart then all the lines are simply switched
        off (by setting line style XLINE_NONE).  No other attributes are
        modified.
    @param  nMode   Specifies the line color of each data row.
            SETLINES_COMPAT and SETLINES_FILLCOLOR set the line color
                to the fill color.  SETLINES_COMPAT does not change line
                style nor width.
            SETLINES_REVERSE sets the fill color to the line color.
            SETLINES_BLACK sets the line color to black.
*/
/*N*/ void ChartModel::SetupLineColors( const long nMode, long nStartIndex ) //#54870#
/*N*/ {
/*N*/   long    nRow,
/*N*/           nRowCnt;
/*N*/
/*N*/   //  The Row count depends (again) on wether the data set is transposed
/*N*/   //  (switched) or not.  Because this returns the wrong value in case of
/*N*/   //  a pie chart, then we access the raw row count without regarding the
/*N*/   //  transpose switch.
/*N*/   if (IsPieChart())
/*N*/       nRowCnt = GetColCount(); // ChartData()->GetRowCount();
/*N*/   else
/*N*/       nRowCnt = GetRowCount();
/*N*/
/*N*/     long nUpperIndex = ::std::min( static_cast< ULONG >( nRowCnt ), static_cast <ULONG > (aDataRowAttrList.size() ) );
/*N*/
/*N*/     if( nStartIndex < nUpperIndex )
/*N*/     {
/*N*/         if (HasStockLines())
/*N*/         {
/*N*/             //    Switch off lines for stock charts.
/*N*/             for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ )
/*N*/                 aDataRowAttrList[ nRow ]->Put(XLineStyleItem(XLINE_NONE));
/*N*/         }
/*N*/         else
/*N*/         {
/*N*/             //    Initialize the item set that will be set to all data rows.
/*N*/             //    If nMode==SETLINES_COMPAT initialization is skipped and only
/*N*/             //    the line colors are set to the fill colors.
/*N*/             SfxItemSet rAttr(GetItemPool(),XATTR_START,XATTR_END);
/*N*/             if(nMode != SETLINES_COMPAT)
/*N*/             {
/*N*/                 //    Default values represent a solid black line of minimal width.
/*N*/                 rAttr.Put(XLineStyleItem(XLINE_SOLID));
/*N*/                 rAttr.Put(XLineColorItem(String(),RGBColor(COL_BLACK)));
/*N*/                 rAttr.Put(XLineWidthItem (0));
/*N*/             }
/*N*/
/*N*/             //    Set the itemset rAttr to all data rows.  Depending on nMode it is first
/*N*/             //    modified so that the line color is set to the fill color or the other
/*N*/             //    way round.
/*N*/             //    The for loop and switch statement changed places in order to not
/*N*/             //    having to execute the switch statement in every iteration.
/*N*/             switch(nMode)
/*N*/             {
/*N*/                 case SETLINES_COMPAT:
/*N*/                 case SETLINES_FILLCOLOR:
/*N*/                     //    Set the line colors to the former fill colors.
/*N*/                     for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ )
/*N*/                         if(IsLine(nRow))
/*N*/                         {
/*N*/                             rAttr.Put(XLineColorItem(String(),
/*N*/                                                      ((XFillColorItem &)GetDataRowAttr(nRow).Get(XATTR_FILLCOLOR)).
/*N*/                                                      GetValue()));
/*N*/                             aDataRowAttrList[ nRow ]->Put(rAttr);
/*N*/                         }
/*N*/                     break;
/*N*/
/*N*/                 case SETLINES_REVERSE:
/*N*/                     //    Set the fill colors to the former line colors.
/*?*/                     for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ )
/*?*/                         if(IsLine(nRow))
/*?*/                         {
/*?*/                             rAttr.Put(XFillColorItem(String(),
/*?*/                                                      ((XLineColorItem &)GetDataRowAttr(nRow).Get(XATTR_LINECOLOR)).
/*?*/                                                      GetValue()));
/*?*/                             aDataRowAttrList[ nRow ]->Put(rAttr);
/*?*/                         }
/*?*/                     break;
/*N*/
/*N*/                 case SETLINES_BLACK:
/*N*/                     //    Set the default values to all data rows.
/*N*/                     for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ )
/*N*/                     {
/*N*/                         aDataRowAttrList[ nRow ]->Put(rAttr);
/*N*/                     }
/*N*/                     break;
/*N*/             }
/*N*/         }
/*N*/   }
/*N*/ }

/*************************************************************************
|*
|* Charttyp aendern;
|* Liefert bei neuem Charttyp TRUE.
|*
\************************************************************************/
// BM: src566b: ChangeChart doesn't execute BuildChart any more!
/*N*/ BOOL ChartModel::ChangeChart( SvxChartStyle eStyle, bool bSetDefaultAttr /* = true */ )
/*N*/ {
/*N*/   if( eStyle == CHSTYLE_ADDIN )
/*N*/   {
/*?*/       eChartStyle = eStyle;
/*?*/       return FALSE;
/*N*/   }
/*N*/   else if( eStyle == eChartStyle )
/*N*/   {
/*N*/       return FALSE;
/*N*/   }
/*N*/   else
/*N*/   {
/*N*/       // if chart style is reset disable addin
/*N*/       if( ! GetChartStatusFlag( CHS_KEEP_ADDIN ))
/*N*/       {
/*N*/           mxChartAddIn = NULL;
/*N*/       }
/*N*/
/*N*/       bResizePie=TRUE;
/*N*/
/*N*/       // OldChartStyle merken
/*N*/       eOldChartStyle = eChartStyle;
/*N*/
/*N*/       //########### Ab hier werden defaultwerte umgesetzt:######### :
/*N*/
/*N*/       //Wenn Linien, aber nicht 3D, dann muss evtl. bei
/*N*/       //Typwechsel die Linienfarbe neu defaultet werden!
/*N*/
/*N*/       long nRefLine=0;//Bei StockChart 3,4 ist die erste Zeile keine Linie
/*N*/       if(GetRowCount()>1)
/*N*/           nRefLine=1;
/*N*/
/*N*/         // #101164# a combi chart may contain lines for all but the first series
/*N*/         if( eOldChartStyle == CHSTYLE_2D_LINE_COLUMN ||
/*N*/             eOldChartStyle == CHSTYLE_2D_LINE_STACKEDCOLUMN )
/*N*/             nRefLine = 0;
/*N*/
/*N*/       BOOL bOldIsLine=IsLine(nRefLine)&& !Is3DChart();//#54870#//Verbund-Charts OK???
/*N*/       BOOL bOldIsStock=HasStockLines();
/*N*/       BOOL bOldIs3D=IsReal3D();
/*N*/       BOOL bOldHadStockBars=HasStockBars();
/*N*/       BOOL bOldXY = IsXYChart();
/*N*/       IsNetChart();
/*N*/       BOOL bOldPie = IsPieChart();
/*N*/       BOOL bOldDonut = IsDonutChart();
/*N*/
/*N*/       eChartStyle = eStyle;
/*N*/
/*N*/       BOOL bNewIsLine=IsLine(nRefLine) && !Is3DChart();//#54870#
/*N*/       BOOL bNewIs3D=IsReal3D();
/*N*/
/*N*/         // data row attributes are used for data points in a piechart
/*N*/         // therefore these need to be initialized correctly
/*N*/         BOOL bMustInitDataAttrs = (bOldPie || IsPieChart() || IsDonutChart() || bOldDonut);
/*N*/
/*N*/         if( eStyle == CHSTYLE_3D_PIE )
/*N*/       {
/*?*/           for( short i = 0; i < nPieSegCount; i++ )
/*?*/               SetPieSegOfs( i, 0 );
/*N*/       }

/*N*/         if( bSetDefaultAttr )
/*?*/         {
/*?*/             // BM: use gray (15%) background (wall) for some charts
/*?*/             if( HasDefaultGrayWall() != HasDefaultGrayWall( &eOldChartStyle ) )
/*?*/             {
/*?*/                 if( HasDefaultGrayWall() )
/*?*/                 {
/*?*/                     pDiagramWallAttr->Put( XFillStyleItem( XFILL_SOLID ));
/*?*/                     pDiagramWallAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) );
/*?*/
/*?*/                     pLegendAttr->Put( XFillStyleItem( XFILL_SOLID ));
/*?*/                     pLegendAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) );
/*?*/                 }
/*?*/                 else
/*?*/                 {
/*?*/                     pDiagramWallAttr->Put( XFillStyleItem( XFILL_NONE ));
/*?*/                     pDiagramWallAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) );
/*?*/
/*?*/                     pLegendAttr->Put( XFillStyleItem( XFILL_NONE ));
/*?*/                     pLegendAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) );
/*?*/                 }
/*?*/             }
/*?*/
/*?*/             // BM: use gray (15%) background (area) for some charts
/*?*/             if( HasDefaultGrayArea() != HasDefaultGrayArea( &eOldChartStyle ) )
/*?*/             {
/*?*/                 if( HasDefaultGrayArea() )
/*?*/                 {
/*?*/                     pDiagramAreaAttr->Put( XFillStyleItem( XFILL_SOLID ));
/*?*/                     pDiagramAreaAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) );
/*?*/
/*?*/                     pLegendAttr->Put( XFillStyleItem( XFILL_SOLID ));
/*?*/                     pLegendAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) );
/*?*/                 }
/*?*/                 else
/*?*/                 {
/*?*/                     pDiagramAreaAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) );
/*?*/
/*?*/                     pLegendAttr->Put( XFillStyleItem( XFILL_NONE ));
/*?*/                     pLegendAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) );
/*?*/                 }
/*?*/             }
/*?*/         }
/*?*/
/*N*/         if(bNewIsLine != bOldIsLine)
/*N*/       {
/*?*/             // map old line colors to new fill colors
/*?*/             if( bNewIsLine )
/*?*/             {
/*?*/                 if( bOldPie )
/*?*/                 {
/*?*/                     InitDataAttrs();
/*?*/                     bMustInitDataAttrs = FALSE;
/*?*/                 }
/*?*/                 SetupLineColors( SETLINES_COMPAT );
/*?*/             }
/*?*/             else
/*?*/             {
/*?*/                 if( IsPieChart() )
/*?*/                 {
/*?*/                     InitDataAttrs();
/*?*/                     bMustInitDataAttrs = FALSE;
/*?*/                 }
/*?*/                 SetupLineColors( SETLINES_BLACK );
/*?*/             }
/*?*/
/*?*/       }

/*N*/         if( bMustInitDataAttrs )
/*N*/         {
/*?*/             InitDataAttrs();
/*?*/             bMustInitDataAttrs = FALSE;
/*N*/         }
/*N*/
/*N*/       if(bOldXY!=IsXYChart())
/*N*/       {
/*?*/           if(bOldXY)
/*?*/               aDataRowAttrList[ 0 ]->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));//wird evtl. unten ge?dert, s.u. StockCharts
/*?*/           else
/*?*/               aDataRowAttrList[ 0 ]->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_X));
/*?*/
/*?*/           CheckForNewAxisNumFormat();         // BM #59532#
/*N*/       }
/*N*/
/*N*/
/*N*/       long nRowCnt = aDataRowAttrList.size();
/*N*/       if( (bOldIsStock && !HasStockLines()) || (bOldIs3D && !bNewIs3D) )
/*N*/       {
                long n=0;
/*?*/           for(n=0;n<nRowCnt;n++)
/*?*/               aDataRowAttrList[ n ]->Put(XLineStyleItem(XLINE_SOLID));

/*?*/           long nColCnt=aDataPointAttrList.size();
/*?*/           SfxItemSet* pAttributes;
/*?*/           for(n=0;n<nColCnt;n++)
/*?*/           {
/*?*/               pAttributes = aDataPointAttrList[ n ];
/*?*/               if (pAttributes != NULL)
/*?*/                   pAttributes->ClearItem(XATTR_LINESTYLE);
/*?*/           }

/*?*/           nColCnt=aSwitchDataPointAttrList.size();
/*?*/           for(n=0;n<nColCnt;n++)
/*?*/           {
/*?*/               pAttributes = aSwitchDataPointAttrList[ n ];
/*?*/               if (pAttributes != NULL)
/*?*/                   pAttributes->ClearItem(XATTR_LINESTYLE);
/*?*/           }
/*?*/       }
/*N*/       if( (!bOldIsStock && HasStockLines()) || (!bOldIs3D && bNewIs3D) )
/*N*/       {
                long n=0;
/*N*/           for(n=0;n<nRowCnt;n++)
/*N*/               aDataRowAttrList[ n ]->Put(XLineStyleItem(XLINE_NONE));

/*N*/           long nColCnt=aDataPointAttrList.size();
/*N*/           SfxItemSet* pAttributes;
/*N*/           for(n=0;n<nColCnt;n++)
/*N*/           {
/*N*/               pAttributes = aDataPointAttrList[ n ];
/*N*/               if (pAttributes != NULL)
/*?*/                   pAttributes->ClearItem(XATTR_LINESTYLE);
/*N*/           }

/*N*/           nColCnt=aSwitchDataPointAttrList.size();
/*N*/           for(n=0;n<nColCnt;n++)
/*N*/           {
/*N*/               pAttributes = aSwitchDataPointAttrList[ n ];
/*N*/               if (pAttributes != NULL)
/*?*/                   pAttributes->ClearItem(XATTR_LINESTYLE);
/*N*/           }
/*N*/       }
/*N*/       if( HasStockBars() )//Hat Balken im Hintergrund (ab jetzt oder Typ 3 <-> 4, #65070#)
/*N*/       {
/*?*/           if(nRowCnt)
/*?*/           {
/*?*/               aDataRowAttrList[ 0 ]->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));
/*?*/               aDataRowAttrList[ 0 ]->Put(XLineStyleItem(XLINE_SOLID));
/*?*/           }
/*?*/           for(long n=1;n<nRowCnt;n++)
/*?*/               aDataRowAttrList[ n ]->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y));
/*?*/           pChartBAxis->ShowAxis(TRUE);
/*?*/           pChartBAxis->ShowDescr(TRUE);
/*?*/           SfxItemSet aSet(*pItemPool,SCHATTR_AXIS_AUTO_ORIGIN,SCHATTR_AXIS_AUTO_ORIGIN);
/*?*/           aSet.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN,TRUE));
/*?*/           pChartBAxis->SetAttributes(aSet);
/*?*/
/*?*/             // #100923#
/*?*/             SfxItemSet aSet2( *pItemPool, SCHATTR_AXIS_AUTO_ORIGIN, SCHATTR_AXIS_ORIGIN );
/*?*/             aSet2.Put( SfxBoolItem( SCHATTR_AXIS_AUTO_ORIGIN, FALSE ));
/*?*/           aSet2.Put( SvxDoubleItem( 0.0, SCHATTR_Y_AXIS_ORIGIN ));
/*?*/             pChartYAxis->SetAttributes( aSet2 );
/*?*/         }
/*?*/
/*N*/       if(bOldHadStockBars && !HasStockBars())//hat jetzt keine Balken mehr
/*?*/       {
/*?*/           for(long n=0;n<nRowCnt;n++)
/*?*/               aDataRowAttrList[ n ]->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));
/*?*/           if(IsXYChart())
/*?*/               aDataRowAttrList[ 0 ]->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_X));
/*?*/           pChartBAxis->ShowAxis(FALSE);
/*?*/           pChartBAxis->ShowDescr(FALSE);
/*?*/       }

        // use default position if base type changed
/*N*/       ChartType aOldType( eOldChartStyle );
/*N*/       ChartType aNewType( eChartStyle );
/*N*/
/*N*/       if( aOldType.GetBaseType() !=
/*N*/           aNewType.GetBaseType() )
/*N*/       {
/*?*/           SetUseRelativePositions( FALSE );
/*N*/       }
/*N*/
/*N*/       Matrix4D aTmp;
/*N*/       aSceneMatrix = aTmp;
/*N*/       if(IsPieChart() && IsReal3D() )
/*N*/       {
/*?*/           aSceneMatrix.RotateX(-F_PI/3);
/*?*/           if(pScene)
/*?*/               pScene->NbcSetTransform(aSceneMatrix);
/*N*/       }
/*N*/       else if(pScene)
/*?*/           pScene->NbcSetTransform(aSceneMatrix);
/*N*/
/*N*/
/*N*/       if( IsReal3D()) //#56798# QuickFix 5.0-Final
/*N*/       {
/*N*/           bClearDepth=TRUE;
/*N*/           size_t i, nORow=aDataRowAttrList.size();
/*N*/           for(i=0;i<nORow;i++)
/*N*/           {
/*N*/               aDataRowAttrList[ i ]->ClearItem( SDRATTR_3DOBJ_DEPTH );
/*N*/               aDataRowAttrList[ i ]->Put( Svx3DDoubleSidedItem( TRUE ));
/*N*/           }
/*N*/           nORow=aDataPointAttrList.size();
/*N*/           SfxItemSet* pAttributes;
/*N*/           for(i=0;i<nORow;i++)
/*N*/           {
/*N*/               pAttributes = aDataPointAttrList[ i ];
/*N*/               if (pAttributes != NULL)
/*N*/               {
/*?*/                   pAttributes->ClearItem( SDRATTR_3DOBJ_DEPTH );
/*?*/                   pAttributes->ClearItem( SDRATTR_3DOBJ_DOUBLE_SIDED );
/*N*/               }
/*N*/           }
/*N*/           nORow=aSwitchDataPointAttrList.size();
/*N*/           for(i=0;i<nORow;i++)
/*N*/           {
/*N*/               pAttributes = aSwitchDataPointAttrList[ i ];
/*N*/               if (pAttributes != NULL)
/*N*/               {
/*?*/                   pAttributes->ClearItem( SDRATTR_3DOBJ_DEPTH );
/*?*/                   pAttributes->ClearItem( SDRATTR_3DOBJ_DOUBLE_SIDED );
/*N*/               }
/*N*/           }
/*N*/
/*N*/           // switch off rounded edges for:
/*N*/           // area charts
/*N*/           Svx3DPercentDiagonalItem aItem(
/*N*/                   (eStyle == CHSTYLE_3D_AREA || eStyle == CHSTYLE_3D_STACKEDAREA || eStyle == CHSTYLE_3D_PERCENTAREA ||
/*N*/                     eStyle == CHSTYLE_3D_PIE )
/*N*/                   ? 0 : 5 );
/*N*/
/*N*/           // item-set for whole chart used if item in series is not set
/*N*/           pDummyAttr->Put( aItem );
/*N*/
/*N*/           for( i = 0; i < aDataRowAttrList.size(); i++ )
/*N*/           {
/*N*/               aDataRowAttrList[ i ]->Put( aItem );
/*N*/           }
/*N*/       }
/*N*/
/*N*/       //  If set to xy-chart or certain stock chart variants then turn on
/*N*/       //  automatic calculation of the origin for all y-axes as default.
/*N*/       //  This affects the second y-axis even if it is not (yet) visible.
/*N*/       //  This was previously done in the autopilot but belongs here
/*N*/       //  because XML loading calls this method but not the autopilot.
/*N*/       if (    IsXYChart()
/*N*/           ||  (eChartStyle == CHSTYLE_2D_STOCK_1)
/*N*/           ||  (eChartStyle == CHSTYLE_2D_STOCK_2))
/*N*/       {
/*?*/           SfxItemSet aAutoOrigin (*pItemPool, SCHATTR_AXIS_AUTO_ORIGIN, SCHATTR_AXIS_AUTO_ORIGIN);
/*?*/           aAutoOrigin.Put (SfxBoolItem (SCHATTR_AXIS_AUTO_ORIGIN, TRUE));
/*?*/           pChartYAxis->SetAttributes (aAutoOrigin);
/*?*/           //  The second y-axis exists (pChartBAxis!=NULL) even if it is not
/*?*/           //  visible.
/*?*/           pChartBAxis->SetAttributes (aAutoOrigin);
/*N*/       }
/*N*/
/*N*/       SetUseRelativePositions(TRUE);// New arrangement (see SID_NEW_ARRANGEMENT)
/*N*/       eOldChartStyle = eChartStyle;
/*N*/
/*N*/       //  Set the number of data series that are displayed as lines to a fixed value.
/*N*/       //  This is one for the combined chart types of columns/stacked columns and lines
/*N*/       //  and zero for all other chart types.
/*N*/
/*N*/         // #104525# however the default for a combi-chart is one line.  So if
/*N*/         // the setting is on 0, we have to change it to 1.
/*N*/         if( ( eStyle == CHSTYLE_2D_LINE_COLUMN
/*N*/               || eStyle == CHSTYLE_2D_LINE_STACKEDCOLUMN )
/*N*/             && GetNumLinesColChart() == 0 )
/*N*/         {
/*?*/             SetNumLinesColChart( 1 );
/*N*/         }
/*N*/
/*N*/         // broadcast UIFeature chang
/*N*/         // #85069# introduced because the 3d effect flyer has to be disabled for 2d charts
/*N*/         Broadcast( SfxSimpleHint( SFX_HINT_MODECHANGED ));
/*N*/
/*N*/       return TRUE;
/*N*/   }
/*N*/ }

/*************************************************************************
|*
|* Language setzen
|*
\************************************************************************/

/*N*/ void ChartModel::SetLanguage( const LanguageType eLang, const USHORT nId )
/*N*/ {
/*N*/   BOOL bLclChanged = FALSE;
/*N*/
/*N*/   if( nId == EE_CHAR_LANGUAGE && eLanguage != eLang )
/*N*/   {
/*N*/       eLanguage = eLang;
/*N*/       bLclChanged = TRUE;
/*N*/   }
/*N*/   else if( nId == EE_CHAR_LANGUAGE_CJK && eLanguageCJK != eLang )
/*N*/   {
/*N*/       eLanguageCJK = eLang;
/*N*/       bLclChanged = TRUE;
/*N*/   }
/*N*/   else if( nId == EE_CHAR_LANGUAGE_CTL && eLanguageCTL != eLang )
/*N*/   {
/*N*/       eLanguageCTL = eLang;
/*N*/       bLclChanged = TRUE;
/*N*/   }
/*N*/
/*N*/   if( bLclChanged )
/*N*/   {
/*N*/       GetDrawOutliner().SetDefaultLanguage( eLang );
/*N*/       pOutliner->SetDefaultLanguage( eLang );
/*N*/       pItemPool->SetPoolDefaultItem( SvxLanguageItem( eLang, nId ) );
/*N*/       SetChanged( bLclChanged );
/*N*/   }
/*N*/ }


/*************************************************************************
|*
|* Return language
|*
\************************************************************************/

/*N*/ LanguageType ChartModel::GetLanguage( const USHORT nId ) const
/*N*/ {
/*N*/   LanguageType eLangType = eLanguage;
/*N*/
/*N*/   if( nId == EE_CHAR_LANGUAGE_CJK )
/*N*/       eLangType = eLanguageCJK;
/*N*/   else if( nId == EE_CHAR_LANGUAGE_CTL )
/*N*/       eLangType = eLanguageCTL;
/*N*/
/*N*/   return eLangType;
/*N*/ }

IMPL_LINK( ChartModel, NotifyUndoActionHdl, SfxUndoAction*, pUndo )
{
    DBG_ASSERT(!m_pUndoActionFromDraw, "New UndoAction from Draw received while elder is not handled yet");
    if(m_bDeleteUndoActionNotificationFromDraw)
    {
        if(pUndo)
            delete pUndo;
    }
    else
    {
        m_pUndoActionFromDraw = pUndo;
    }
    return 1;
}}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */