summaryrefslogtreecommitdiff
path: root/chart2/source/controller/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/dialogs')
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.hrc219
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.src546
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.hrc216
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.src546
-rw-r--r--chart2/source/controller/dialogs/ChangingResource.cxx55
-rw-r--r--chart2/source/controller/dialogs/ChangingResource.hxx65
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx1288
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.hxx320
-rw-r--r--chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx55
-rw-r--r--chart2/source/controller/dialogs/CommonResources.hrc82
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx1350
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.hxx209
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx926
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.hxx181
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx843
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx200
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx857
-rw-r--r--chart2/source/controller/dialogs/RangeEdit.cxx73
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionButton.cxx59
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionHelper.cxx201
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionListener.cxx78
-rw-r--r--chart2/source/controller/dialogs/ResourceIds.hrc87
-rw-r--r--chart2/source/controller/dialogs/Strings.src606
-rw-r--r--chart2/source/controller/dialogs/Strings_AdditionalControls.src60
-rw-r--r--chart2/source/controller/dialogs/Strings_ChartTypes.src156
-rw-r--r--chart2/source/controller/dialogs/Strings_Scale.src47
-rw-r--r--chart2/source/controller/dialogs/Strings_Statistic.src75
-rw-r--r--chart2/source/controller/dialogs/TabPages.hrc176
-rw-r--r--chart2/source/controller/dialogs/TextDirectionListBox.cxx63
-rw-r--r--chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx73
-rw-r--r--chart2/source/controller/dialogs/TitleDialogData.cxx127
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.cxx81
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.hrc38
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.src60
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx142
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx270
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.hrc35
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.src42
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx436
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.cxx392
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.hrc55
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.src145
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.cxx256
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.hrc36
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.src51
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx167
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc49
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src102
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx77
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc35
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.src45
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx137
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc34
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.src46
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertLegend.cxx81
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertLegend.hrc34
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertLegend.src50
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTitle.cxx70
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTitle.hrc34
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTitle.src45
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTrendline.cxx117
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTrendline.hrc34
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTrendline.src51
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.cxx89
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.hxx57
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx653
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.src42
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.cxx121
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.hrc43
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.src51
-rw-r--r--chart2/source/controller/dialogs/hidother.src119
-rw-r--r--chart2/source/controller/dialogs/makefile.mk205
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.cxx115
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.hxx70
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.src52
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx422
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.hxx107
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel_IDs.hrc48
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc172
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar.cxx773
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc66
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc231
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.cxx268
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.hxx93
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc35
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc83
-rw-r--r--chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc62
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.cxx158
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.hxx78
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.src52
-rw-r--r--chart2/source/controller/dialogs/res_Titles.cxx227
-rw-r--r--chart2/source/controller/dialogs/res_Titles.hrc50
-rw-r--r--chart2/source/controller/dialogs/res_Titles.hxx80
-rw-r--r--chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc152
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.cxx285
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.hxx86
-rw-r--r--chart2/source/controller/dialogs/res_Trendline_IDs.hrc47
-rw-r--r--chart2/source/controller/dialogs/res_Trendline_tmpl.hrc126
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx366
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc41
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx102
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.src101
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx300
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc43
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx115
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.src150
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx653
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc49
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx148
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.src165
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.cxx326
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.hxx102
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.src189
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx501
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.hxx115
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.src295
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx1166
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hrc65
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hxx128
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.src262
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.cxx77
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.hxx67
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.src45
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx1079
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hrc53
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx182
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.src174
-rw-r--r--chart2/source/controller/dialogs/tp_DataSourceControls.cxx60
-rw-r--r--chart2/source/controller/dialogs/tp_DataSourceControls.hxx73
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.cxx103
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.hxx68
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.src41
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.cxx91
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.hxx72
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.src68
-rw-r--r--chart2/source/controller/dialogs/tp_Location.cxx74
-rw-r--r--chart2/source/controller/dialogs/tp_Location.hrc35
-rw-r--r--chart2/source/controller/dialogs/tp_Location.hxx79
-rw-r--r--chart2/source/controller/dialogs/tp_Location.src76
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.cxx107
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.hxx61
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.src39
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx129
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hrc43
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hxx70
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.src90
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx417
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hrc43
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hxx127
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.src97
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx521
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hxx129
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.src193
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx316
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hrc48
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx98
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.src179
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx129
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.hxx72
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.src96
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.cxx80
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.hxx62
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.src41
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx190
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc53
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx96
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src95
167 files changed, 29924 insertions, 0 deletions
diff --git a/chart2/source/controller/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc
new file mode 100644
index 000000000000..d3aa3ebbff2f
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps.hrc
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Bitmaps.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BITMAPS_HRC
+#define CHART_BITMAPS_HRC
+
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+
+#ifndef STD_MASKCOLOR
+#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
+#endif
+
+//-----------------------------------------------------------------------------
+// chart types
+// Images:
+
+#define IMG_TYPE_COLUMN (RID_APP_START + 1)
+#define IMG_TYPE_BAR (RID_APP_START + 2)
+#define IMG_TYPE_PIE (RID_APP_START + 3)
+#define IMG_TYPE_AREA (RID_APP_START + 4)
+#define IMG_TYPE_LINE (RID_APP_START + 5)
+#define IMG_TYPE_XY (RID_APP_START + 6)
+#define IMG_TYPE_BUBBLE (RID_APP_START + 7)
+#define IMG_TYPE_NET (RID_APP_START + 8)
+#define IMG_TYPE_STOCK (RID_APP_START + 9)
+#define IMG_TYPE_COLUMN_LINE (RID_APP_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
+
+//----------------------
+// Column Chart Subtypes
+#define BMP_COLUMNS_2D_1 (RID_APP_START + 1)
+#define BMP_COLUMNS_2D_2 (RID_APP_START + 2)
+#define BMP_COLUMNS_2D_3 (RID_APP_START + 3)
+
+#define BMP_COLUMNS_3D (RID_APP_START + 4)
+#define BMP_COLUMNS_3D_1 (RID_APP_START + 5)
+#define BMP_COLUMNS_3D_2 (RID_APP_START + 6)
+#define BMP_COLUMNS_3D_3 (RID_APP_START + 7)
+
+#define BMP_SAEULE_3D_1 (RID_APP_START + 8)
+#define BMP_SAEULE_3D_2 (RID_APP_START + 9)
+#define BMP_SAEULE_3D_3 (RID_APP_START + 10)
+#define BMP_SAEULE_3D_4 (RID_APP_START + 11)
+
+#define BMP_KEGEL_3D_1 (RID_APP_START + 12)
+#define BMP_KEGEL_3D_2 (RID_APP_START + 13)
+#define BMP_KEGEL_3D_3 (RID_APP_START + 14)
+#define BMP_KEGEL_3D_4 (RID_APP_START + 15)
+
+#define BMP_PYRAMID_3D_1 (RID_APP_START + 16)
+#define BMP_PYRAMID_3D_2 (RID_APP_START + 17)
+#define BMP_PYRAMID_3D_3 (RID_APP_START + 18)
+#define BMP_PYRAMID_3D_4 (RID_APP_START + 19)
+
+//----------------------
+// Bar Chart Subtypes
+
+#define BMP_BARS_2D_1 (RID_APP_START + 20)
+#define BMP_BARS_2D_2 (RID_APP_START + 21)
+#define BMP_BARS_2D_3 (RID_APP_START + 22)
+
+#define BMP_BARS_3D (RID_APP_START + 23)
+#define BMP_BARS_3D_1 (RID_APP_START + 24)
+#define BMP_BARS_3D_2 (RID_APP_START + 25)
+#define BMP_BARS_3D_3 (RID_APP_START + 26)
+
+#define BMP_ROEHRE_3D_1 (RID_APP_START + 27)
+#define BMP_ROEHRE_3D_2 (RID_APP_START + 28)
+#define BMP_ROEHRE_3D_3 (RID_APP_START + 29)
+#define BMP_ROEHRE_3D_4 (RID_APP_START + 30)
+
+#define BMP_KEGELQ_3D_1 (RID_APP_START + 31)
+#define BMP_KEGELQ_3D_2 (RID_APP_START + 32)
+#define BMP_KEGELQ_3D_3 (RID_APP_START + 33)
+#define BMP_KEGELQ_3D_4 (RID_APP_START + 34)
+
+#define BMP_PYRAMIDQ_3D_1 (RID_APP_START + 35)
+#define BMP_PYRAMIDQ_3D_2 (RID_APP_START + 36)
+#define BMP_PYRAMIDQ_3D_3 (RID_APP_START + 37)
+#define BMP_PYRAMIDQ_3D_4 (RID_APP_START + 38)
+
+//----------------------
+// Pie and Donut Chart Subtypes
+
+#define BMP_CIRCLES_2D (RID_APP_START + 39)
+#define BMP_CIRCLES_2D_EXPLODED (RID_APP_START + 40)
+#define BMP_CIRCLES_3D (RID_APP_START + 41)
+#define BMP_CIRCLES_3D_EXPLODED (RID_APP_START + 42)
+#define BMP_DONUT_2D (RID_APP_START + 43)
+#define BMP_DONUT_2D_EXPLODED (RID_APP_START + 44)
+#define BMP_DONUT_3D (RID_APP_START + 45)
+#define BMP_DONUT_3D_EXPLODED (RID_APP_START + 46)
+
+//----------------------
+// Points and Lines Chart Subtypes
+
+#define BMP_POINTS_XVALUES (RID_APP_START + 47)
+#define BMP_POINTS_XCATEGORY (RID_APP_START + 48)
+#define BMP_POINTS_STACKED (RID_APP_START + 49)
+
+
+#define BMP_LINE_P_XVALUES (RID_APP_START + 50)
+#define BMP_LINE_O_XVALUES (RID_APP_START + 51)
+#define BMP_LINE3D_XVALUES (RID_APP_START + 52)
+
+#define BMP_LINE_P_XCATEGORY (RID_APP_START + 53)
+#define BMP_LINE_O_XCATEGORY (RID_APP_START + 54)
+#define BMP_LINE3D_XCATEGORY (RID_APP_START + 55)
+
+#define BMP_LINE_P_STACKED (RID_APP_START + 56)
+#define BMP_LINE_O_STACKED (RID_APP_START + 57)
+#define BMP_LINE3D_STACKED (RID_APP_START + 58)
+
+#define BMP_LINE_P_XVALUES_SMOOTH (RID_APP_START + 59)
+#define BMP_LINE_O_XVALUES_SMOOTH (RID_APP_START + 60)
+#define BMP_LINE3D_XVALUES_SMOOTH (RID_APP_START + 61)
+
+#define BMP_LINE_P_XCATEGORY_SMOOTH (RID_APP_START + 62)
+#define BMP_LINE_O_XCATEGORY_SMOOTH (RID_APP_START + 63)
+#define BMP_LINE3D_XCATEGORY_SMOOTH (RID_APP_START + 64)
+
+#define BMP_LINE_P_STACKED_SMOOTH (RID_APP_START + 65)
+#define BMP_LINE_O_STACKED_SMOOTH (RID_APP_START + 66)
+#define BMP_LINE3D_STACKED_SMOOTH (RID_APP_START + 67)
+
+//----------------------
+// Area Chart Subtypes
+
+#define BMP_AREAS_2D (RID_APP_START + 68)
+#define BMP_AREAS_2D_1 (RID_APP_START + 69)
+#define BMP_AREAS_2D_3 (RID_APP_START + 70)
+#define BMP_AREAS_3D (RID_APP_START + 71)
+#define BMP_AREAS_3D_1 (RID_APP_START + 72)
+#define BMP_AREAS_3D_2 (RID_APP_START + 73)
+
+//----------------------
+// Net Chart Subtypes
+
+#define BMP_NET (RID_APP_START + 74)
+#define BMP_NET_STACK (RID_APP_START + 75)
+#define BMP_NET_SYMB (RID_APP_START + 76)
+#define BMP_NET_SYMB_STACK (RID_APP_START + 77)
+#define BMP_NET_LINESYMB (RID_APP_START + 78)
+#define BMP_NET_LINESYMB_STACK (RID_APP_START + 79)
+#define BMP_NET_FILL (RID_APP_START + 80)
+#define BMP_NET_FILL_STACK (RID_APP_START + 81)
+
+//----------------------
+// Stock Chart Subtypes
+
+#define BMP_STOCK_1 (RID_APP_START + 82)
+#define BMP_STOCK_2 (RID_APP_START + 83)
+#define BMP_STOCK_3 (RID_APP_START + 84)
+#define BMP_STOCK_4 (RID_APP_START + 85)
+
+//----------------------
+// Column + Line Chart Subtypes
+
+#define BMP_COLUMN_LINE (RID_APP_START + 86)
+#define BMP_COLUMN_LINE_STACKED (RID_APP_START + 87)
+
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1 (RID_APP_START + 88)
+
+//-----------------------------------------------------------------------------
+//further Images:
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 1
+#define BMP_INDICATE_BOTH_VERTI (RID_APP_START + 89)
+#define BMP_INDICATE_UP (RID_APP_START + 90)
+#define BMP_INDICATE_DOWN (RID_APP_START + 91)
+#define BMP_INDICATE_BOTH_HORI (RID_APP_START + 97)
+#define BMP_INDICATE_RIGHT (RID_APP_START + 98)
+#define BMP_INDICATE_LEFT (RID_APP_START + 99)
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 2
+#define BMP_REGRESSION_NONE (RID_APP_START + 92)
+#define BMP_REGRESSION_LINEAR (RID_APP_START + 93)
+#define BMP_REGRESSION_LOG (RID_APP_START + 94)
+#define BMP_REGRESSION_EXP (RID_APP_START + 95)
+#define BMP_REGRESSION_POWER (RID_APP_START + 96)
+
+// hide-button for range-choosing
+#define IMG_SELECTRANGE (RID_APP_START + 100)
+
+// CHART_BITMAPS_HRC
+#endif
diff --git a/chart2/source/controller/dialogs/Bitmaps.src b/chart2/source/controller/dialogs/Bitmaps.src
new file mode 100644
index 000000000000..67d8588897d8
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps.src
@@ -0,0 +1,546 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Bitmaps.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Bitmaps.hrc"
+
+Image IMG_TYPE_COLUMN
+{
+ ImageBitmap = Bitmap { File = "typecolumn_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_BAR
+{
+ ImageBitmap = Bitmap { File = "typebar_16.png " ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_PIE
+{
+ ImageBitmap = Bitmap { File = "typepie_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_LINE
+{
+ ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_XY
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_AREA
+{
+ ImageBitmap = Bitmap { File = "typearea_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_NET
+{
+ ImageBitmap = Bitmap { File = "typenet_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_STOCK
+{
+ ImageBitmap = Bitmap { File = "typestock_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_COLUMN_LINE
+{
+ ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_BUBBLE
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1
+{
+ File = "bubble_52x60.png" ;
+};
+Bitmap BMP_AREAS_2D
+{
+ File = "areas_52x60.png" ;
+};
+Bitmap BMP_AREAS_2D_1
+{
+ File = "areaspiled_52x60.png" ;
+};
+Bitmap BMP_AREAS_2D_3
+{
+ File = "areasfull_52x60.png" ;
+};
+Bitmap BMP_AREAS_3D
+{
+ File = "areaspiled3d_52x60.png" ;
+};
+Bitmap BMP_AREAS_3D_1
+{
+ File = "areas3d_52x60.png" ;
+};
+Bitmap BMP_AREAS_3D_2
+{
+ File = "areasfull3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_BARS_2D_1
+{
+ File = "bar_52x60.png" ;
+};
+Bitmap BMP_BARS_2D_2
+{
+ File = "barstack_52x60.png" ;
+};
+Bitmap BMP_BARS_2D_3
+{
+ File = "barpercent_52x60.png" ;
+};
+Bitmap BMP_BARS_3D
+{
+ File = "bar3ddeep_52x60.png" ;
+};
+Bitmap BMP_BARS_3D_1
+{
+ File = "bar3d_52x60.png" ;
+};
+Bitmap BMP_BARS_3D_2
+{
+ File = "barstack3d_52x60.png" ;
+};
+Bitmap BMP_BARS_3D_3
+{
+ File = "barpercent3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_CIRCLES_2D
+{
+ File = "pie_52x60.png" ;
+};
+Bitmap BMP_CIRCLES_2D_EXPLODED
+{
+ File = "pieexploded_52x60.png" ;
+};
+Bitmap BMP_CIRCLES_3D
+{
+ File = "pie3d_52x60.png" ;
+};
+Bitmap BMP_CIRCLES_3D_EXPLODED
+{
+ File = "pie3dexploded_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_DONUT_2D
+{
+ File = "donut_52x60.png" ;
+};
+Bitmap BMP_DONUT_2D_EXPLODED
+{
+ File = "donutexploded_52x60.png" ;
+};
+Bitmap BMP_DONUT_3D
+{
+ File = "donut3d_52x60.png" ;
+};
+Bitmap BMP_DONUT_3D_EXPLODED
+{
+ File = "donut3dexploded_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_2D_1
+{
+ File = "columns_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_2D_2
+{
+ File = "columnstack_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_2D_3
+{
+ File = "columnpercent_52x60.png" ;
+};
+Bitmap BMP_COLUMN_LINE
+{
+ File = "columnline_52x60.png" ;
+};
+Bitmap BMP_COLUMN_LINE_STACKED
+{
+ File = "columnstackline_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_3D
+{
+ File = "columns3ddeep_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_3D_1
+{
+ File = "columns3d_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_3D_2
+{
+ File = "columnstack3d_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_3D_3
+{
+ File = "columnpercent3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_KEGELQ_3D_1
+{
+ File = "conehori_52x60.png" ;
+};
+Bitmap BMP_KEGELQ_3D_2
+{
+ File = "conehoristack_52x60.png" ;
+};
+Bitmap BMP_KEGELQ_3D_3
+{
+ File = "conehoripercent_52x60.png" ;
+};
+Bitmap BMP_KEGELQ_3D_4
+{
+ File = "conehorideep_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_1
+{
+ File = "cone_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_2
+{
+ File = "conestack_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_3
+{
+ File = "conepercent_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_4
+{
+ File = "conedeep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_POINTS_XVALUES
+{
+ File = "valueaxisdirectpoints_52x60.png" ;
+};
+Bitmap BMP_POINTS_XCATEGORY
+{
+ File = "nostackdirectpoints_52x60.png" ;
+};
+Bitmap BMP_POINTS_STACKED
+{
+ File = "stackdirectpoints_52x60.png" ;
+};
+//---------------------
+
+Bitmap BMP_LINE_P_XVALUES
+{
+ File = "valueaxisdirectboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES
+{
+ File = "valueaxisdirectlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES
+{
+ File = "valueaxisdirect3d_52x60.png" ;
+};
+
+
+Bitmap BMP_LINE_P_XCATEGORY
+{
+ File = "nostackdirectboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY
+{
+ File = "nostackdirectlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY
+{
+ File = "nostackdirect3d_52x60.png" ;
+};
+
+
+Bitmap BMP_LINE_P_STACKED
+{
+ File = "stackdirectboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_STACKED
+{
+ File = "stackdirectlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_STACKED
+{
+ File = "stackdirect3d_52x60.png" ;
+};
+
+//---------------------
+Bitmap BMP_LINE_P_XVALUES_SMOOTH
+{
+ File = "valueaxissmoothboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES_SMOOTH
+{
+ File = "valueaxissmoothlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES_SMOOTH
+{
+ File = "valueaxissmooth3d_52x60.png" ;
+};
+Bitmap BMP_LINE_P_XCATEGORY_SMOOTH
+{
+ File = "nostacksmoothboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY_SMOOTH
+{
+ File = "nostacksmoothlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY_SMOOTH
+{
+ File = "nostacksmooth3d_52x60.png" ;
+};
+Bitmap BMP_LINE_P_STACKED_SMOOTH
+{
+ File = "stacksmoothboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_STACKED_SMOOTH
+{
+ File = "stacksmoothlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_STACKED_SMOOTH
+{
+ File = "stacksmooth3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_NET
+{
+ File = "net_52x60.png" ;
+};
+Bitmap BMP_NET_STACK
+{
+ File = "netstack_52x60.png" ;
+};
+Bitmap BMP_NET_SYMB
+{
+ File = "netpoint_52x60.png" ;
+};
+Bitmap BMP_NET_SYMB_STACK
+{
+ File = "netpointstack_52x60.png" ;
+};
+Bitmap BMP_NET_LINESYMB
+{
+ File = "netlinepoint_52x60.png" ;
+};
+Bitmap BMP_NET_LINESYMB_STACK
+{
+ File = "netlinepointstack_52x60.png" ;
+};
+Bitmap BMP_NET_FILL
+{
+ File = "netfill_52x60.png" ;
+};
+Bitmap BMP_NET_FILL_STACK
+{
+ File = "netstackfill_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_PYRAMIDQ_3D_1
+{
+ File = "pyramindhori_52x60.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_2
+{
+ File = "pyramindhoristack_52x60.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_3
+{
+ File = "pyramindhoripercent_52x60.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_4
+{
+ File = "pyramindhorideep_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_1
+{
+ File = "pyramind_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_2
+{
+ File = "pyramindstack_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_3
+{
+ File = "pyramindpercent_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_4
+{
+ File = "pyraminddeep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_ROEHRE_3D_1
+{
+ File = "cylinderhori_52x60.png" ;
+};
+Bitmap BMP_ROEHRE_3D_2
+{
+ File = "cylinderhoristack_52x60.png" ;
+};
+Bitmap BMP_ROEHRE_3D_3
+{
+ File = "cylinderhoriprocent_52x60.png" ;
+};
+Bitmap BMP_ROEHRE_3D_4
+{
+ File = "cylinderhorideep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_SAEULE_3D_1
+{
+ File = "cylinder_52x60.png" ;
+};
+Bitmap BMP_SAEULE_3D_2
+{
+ File = "cylinderstack_52x60.png" ;
+};
+Bitmap BMP_SAEULE_3D_3
+{
+ File = "cylinderpercent_52x60.png" ;
+};
+Bitmap BMP_SAEULE_3D_4
+{
+ File = "cylinderdeep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_STOCK_1
+{
+ File = "stock_52x60.png" ;
+};
+Bitmap BMP_STOCK_2
+{
+ File = "stockblock_52x60.png" ;
+};
+Bitmap BMP_STOCK_3
+{
+ File = "stockcolumns_52x60.png" ;
+};
+Bitmap BMP_STOCK_4
+{
+ File = "stockcolumnsattach_52x60.png" ;
+};
+//---------------------
+//---------------------
+//---------------------
+//error indicator
+Image BMP_INDICATE_BOTH_VERTI
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothverti_30.png" ;
+ };
+};
+Image BMP_INDICATE_DOWN
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errordown_30.png" ;
+ };
+};
+Image BMP_INDICATE_UP
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorup_30.png" ;
+ };
+};
+Image BMP_INDICATE_BOTH_HORI
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothhori_30.png" ;
+ };
+};
+Image BMP_INDICATE_RIGHT
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorright_30.png" ;
+ };
+};
+Image BMP_INDICATE_LEFT
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorleft_30.png" ;
+ };
+};
+
+//---------------------
+//regression curves
+Image BMP_REGRESSION_NONE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regno.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LINEAR
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglin.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LOG
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglog.bmp" ;
+ };
+};
+Image BMP_REGRESSION_EXP
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regexp.bmp" ;
+ };
+};
+Image BMP_REGRESSION_POWER
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regpow.bmp" ;
+ };
+};
+//---------------------
+Image IMG_SELECTRANGE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "selectrange.png";
+ };
+ MaskColor = STD_MASKCOLOR;
+};
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
new file mode 100644
index 000000000000..71a181b92559
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Bitmaps_HC.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+
+// RID_SCH_START is 30512 (see svl/solar.hrc)
+
+// next free: 100
+
+#ifndef SC_HC_MASKCOLOR
+#define SC_HC_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
+#endif
+
+//-----------------------------------------------------------------------------
+// chart types
+// Images:
+
+#define IMG_TYPE_COLUMN_HC (RID_SCH_START + 1)
+#define IMG_TYPE_BAR_HC (RID_SCH_START + 2)
+#define IMG_TYPE_PIE_HC (RID_SCH_START + 3)
+#define IMG_TYPE_AREA_HC (RID_SCH_START + 4)
+#define IMG_TYPE_LINE_HC (RID_SCH_START + 5)
+#define IMG_TYPE_XY_HC (RID_SCH_START + 6)
+#define IMG_TYPE_BUBBLE_HC (RID_SCH_START + 7)
+#define IMG_TYPE_NET_HC (RID_SCH_START + 8)
+#define IMG_TYPE_STOCK_HC (RID_SCH_START + 9)
+#define IMG_TYPE_COLUMN_LINE_HC (RID_SCH_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
+
+//----------------------
+// Column Chart Subtypes
+#define BMP_COLUMNS_2D_1_HC (RID_SCH_START + 1)
+#define BMP_COLUMNS_2D_2_HC (RID_SCH_START + 2)
+#define BMP_COLUMNS_2D_3_HC (RID_SCH_START + 3)
+
+#define BMP_COLUMNS_3D_HC (RID_SCH_START + 4)
+#define BMP_COLUMNS_3D_1_HC (RID_SCH_START + 5)
+#define BMP_COLUMNS_3D_2_HC (RID_SCH_START + 6)
+#define BMP_COLUMNS_3D_3_HC (RID_SCH_START + 7)
+
+#define BMP_SAEULE_3D_1_HC (RID_SCH_START + 8)
+#define BMP_SAEULE_3D_2_HC (RID_SCH_START + 9)
+#define BMP_SAEULE_3D_3_HC (RID_SCH_START + 10)
+#define BMP_SAEULE_3D_4_HC (RID_SCH_START + 11)
+
+#define BMP_KEGEL_3D_1_HC (RID_SCH_START + 12)
+#define BMP_KEGEL_3D_2_HC (RID_SCH_START + 13)
+#define BMP_KEGEL_3D_3_HC (RID_SCH_START + 14)
+#define BMP_KEGEL_3D_4_HC (RID_SCH_START + 15)
+
+#define BMP_PYRAMID_3D_1_HC (RID_SCH_START + 16)
+#define BMP_PYRAMID_3D_2_HC (RID_SCH_START + 17)
+#define BMP_PYRAMID_3D_3_HC (RID_SCH_START + 18)
+#define BMP_PYRAMID_3D_4_HC (RID_SCH_START + 19)
+
+//----------------------
+// Bar Chart Subtypes
+
+#define BMP_BARS_2D_1_HC (RID_SCH_START + 20)
+#define BMP_BARS_2D_2_HC (RID_SCH_START + 21)
+#define BMP_BARS_2D_3_HC (RID_SCH_START + 22)
+
+#define BMP_BARS_3D_HC (RID_SCH_START + 23)
+#define BMP_BARS_3D_1_HC (RID_SCH_START + 24)
+#define BMP_BARS_3D_2_HC (RID_SCH_START + 25)
+#define BMP_BARS_3D_3_HC (RID_SCH_START + 26)
+
+#define BMP_ROEHRE_3D_1_HC (RID_SCH_START + 27)
+#define BMP_ROEHRE_3D_2_HC (RID_SCH_START + 28)
+#define BMP_ROEHRE_3D_3_HC (RID_SCH_START + 29)
+#define BMP_ROEHRE_3D_4_HC (RID_SCH_START + 30)
+
+#define BMP_KEGELQ_3D_1_HC (RID_SCH_START + 31)
+#define BMP_KEGELQ_3D_2_HC (RID_SCH_START + 32)
+#define BMP_KEGELQ_3D_3_HC (RID_SCH_START + 33)
+#define BMP_KEGELQ_3D_4_HC (RID_SCH_START + 34)
+
+#define BMP_PYRAMIDQ_3D_1_HC (RID_SCH_START + 35)
+#define BMP_PYRAMIDQ_3D_2_HC (RID_SCH_START + 36)
+#define BMP_PYRAMIDQ_3D_3_HC (RID_SCH_START + 37)
+#define BMP_PYRAMIDQ_3D_4_HC (RID_SCH_START + 38)
+
+//----------------------
+// Pie and Donut Chart Subtypes
+
+#define BMP_CIRCLES_2D_HC (RID_SCH_START + 39)
+#define BMP_CIRCLES_2D_EXPLODED_HC (RID_SCH_START + 40)
+#define BMP_CIRCLES_3D_HC (RID_SCH_START + 41)
+#define BMP_CIRCLES_3D_EXPLODED_HC (RID_SCH_START + 42)
+#define BMP_DONUT_2D_HC (RID_SCH_START + 43)
+#define BMP_DONUT_2D_EXPLODED_HC (RID_SCH_START + 44)
+#define BMP_DONUT_3D_HC (RID_SCH_START + 45)
+#define BMP_DONUT_3D_EXPLODED_HC (RID_SCH_START + 46)
+
+//----------------------
+// Points and Lines Chart Subtypes
+
+#define BMP_POINTS_XVALUES_HC (RID_SCH_START + 47)
+#define BMP_POINTS_XCATEGORY_HC (RID_SCH_START + 48)
+#define BMP_POINTS_STACKED_HC (RID_SCH_START + 49)
+
+#define BMP_LINE_P_XVALUES_HC (RID_SCH_START + 50)
+#define BMP_LINE_O_XVALUES_HC (RID_SCH_START + 51)
+#define BMP_LINE3D_XVALUES_HC (RID_SCH_START + 52)
+
+#define BMP_LINE_P_XCATEGORY_HC (RID_SCH_START + 53)
+#define BMP_LINE_O_XCATEGORY_HC (RID_SCH_START + 54)
+#define BMP_LINE3D_XCATEGORY_HC (RID_SCH_START + 55)
+
+#define BMP_LINE_P_STACKED_HC (RID_SCH_START + 56)
+#define BMP_LINE_O_STACKED_HC (RID_SCH_START + 57)
+#define BMP_LINE3D_STACKED_HC (RID_SCH_START + 58)
+
+#define BMP_LINE_P_XVALUES_SMOOTH_HC (RID_SCH_START + 59)
+#define BMP_LINE_O_XVALUES_SMOOTH_HC (RID_SCH_START + 60)
+#define BMP_LINE3D_XVALUES_SMOOTH_HC (RID_SCH_START + 61)
+
+#define BMP_LINE_P_XCATEGORY_SMOOTH_HC (RID_SCH_START + 62)
+#define BMP_LINE_O_XCATEGORY_SMOOTH_HC (RID_SCH_START + 63)
+#define BMP_LINE3D_XCATEGORY_SMOOTH_HC (RID_SCH_START + 64)
+
+#define BMP_LINE_P_STACKED_SMOOTH_HC (RID_SCH_START + 65)
+#define BMP_LINE_O_STACKED_SMOOTH_HC (RID_SCH_START + 66)
+#define BMP_LINE3D_STACKED_SMOOTH_HC (RID_SCH_START + 67)
+
+//----------------------
+// Area Chart Subtypes
+
+#define BMP_AREAS_2D_HC (RID_SCH_START + 68)
+#define BMP_AREAS_2D_1_HC (RID_SCH_START + 69)
+#define BMP_AREAS_2D_3_HC (RID_SCH_START + 70)
+#define BMP_AREAS_3D_HC (RID_SCH_START + 71)
+#define BMP_AREAS_3D_1_HC (RID_SCH_START + 72)
+#define BMP_AREAS_3D_2_HC (RID_SCH_START + 73)
+
+//----------------------
+// Net Chart Subtypes
+
+#define BMP_NET_HC (RID_SCH_START + 74)
+#define BMP_NET_STACK_HC (RID_SCH_START + 75)
+#define BMP_NET_SYMB_HC (RID_SCH_START + 76)
+#define BMP_NET_SYMB_STACK_HC (RID_SCH_START + 77)
+#define BMP_NET_LINESYMB_HC (RID_SCH_START + 78)
+#define BMP_NET_LINESYMB_STACK_HC (RID_SCH_START + 79)
+#define BMP_NET_FILL_HC (RID_SCH_START + 80)
+#define BMP_NET_FILL_STACK_HC (RID_SCH_START + 81)
+
+//----------------------
+// Stock Chart Subtypes
+
+#define BMP_STOCK_1_HC (RID_SCH_START + 82)
+#define BMP_STOCK_2_HC (RID_SCH_START + 83)
+#define BMP_STOCK_3_HC (RID_SCH_START + 84)
+#define BMP_STOCK_4_HC (RID_SCH_START + 85)
+
+//----------------------
+// Column + Line Chart Subtypes
+
+#define BMP_COLUMN_LINE_HC (RID_SCH_START + 86)
+#define BMP_COLUMN_LINE_STACKED_HC (RID_SCH_START + 87)
+
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1_HC (RID_SCH_START + 88)
+
+//-----------------------------------------------------------------------------
+//further Images:
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 1
+#define BMP_INDICATE_BOTH_VERTI_HC (RID_SCH_START + 89)
+#define BMP_INDICATE_UP_HC (RID_SCH_START + 90)
+#define BMP_INDICATE_DOWN_HC (RID_SCH_START + 91)
+#define BMP_INDICATE_BOTH_HORI_HC (RID_SCH_START + 97)
+#define BMP_INDICATE_RIGHT_HC (RID_SCH_START + 98)
+#define BMP_INDICATE_LEFT_HC (RID_SCH_START + 99)
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 2
+#define BMP_REGRESSION_NONE_HC (RID_SCH_START + 92)
+#define BMP_REGRESSION_LINEAR_HC (RID_SCH_START + 93)
+#define BMP_REGRESSION_LOG_HC (RID_SCH_START + 94)
+#define BMP_REGRESSION_EXP_HC (RID_SCH_START + 95)
+#define BMP_REGRESSION_POWER_HC (RID_SCH_START + 96)
+
+// hide-button for range-choosing
+#define IMG_SELECTRANGE_HC (RID_SCH_START + 100)
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.src b/chart2/source/controller/dialogs/Bitmaps_HC.src
new file mode 100644
index 000000000000..a82893273ae2
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.src
@@ -0,0 +1,546 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Bitmaps_HC.src,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Bitmaps_HC.hrc"
+
+Image IMG_TYPE_COLUMN_HC
+{
+ ImageBitmap = Bitmap { File = "typecolumn_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_BAR_HC
+{
+ ImageBitmap = Bitmap { File = "typebar_16.png " ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_PIE_HC
+{
+ ImageBitmap = Bitmap { File = "typepie_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_LINE_HC
+{
+ ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_XY_HC
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_AREA_HC
+{
+ ImageBitmap = Bitmap { File = "typearea_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_NET_HC
+{
+ ImageBitmap = Bitmap { File = "typenet_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_STOCK_HC
+{
+ ImageBitmap = Bitmap { File = "typestock_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_COLUMN_LINE_HC
+{
+ ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_BUBBLE_HC
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1_HC
+{
+ File = "bubble_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_2D_HC
+{
+ File = "areas_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_2D_1_HC
+{
+ File = "areaspiled_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_2D_3_HC
+{
+ File = "areasfull_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_3D_HC
+{
+ File = "areaspiled3d_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_3D_1_HC
+{
+ File = "areas3d_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_3D_2_HC
+{
+ File = "areasfull3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_BARS_2D_1_HC
+{
+ File = "bar_52x60_h.png" ;
+};
+Bitmap BMP_BARS_2D_2_HC
+{
+ File = "barstack_52x60_h.png" ;
+};
+Bitmap BMP_BARS_2D_3_HC
+{
+ File = "barpercent_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_HC
+{
+ File = "bar3ddeep_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_1_HC
+{
+ File = "bar3d_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_2_HC
+{
+ File = "barstack3d_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_3_HC
+{
+ File = "barpercent3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_CIRCLES_2D_HC
+{
+ File = "pie_52x60_h.png" ;
+};
+Bitmap BMP_CIRCLES_2D_EXPLODED_HC
+{
+ File = "pieexploded_52x60_h.png" ;
+};
+Bitmap BMP_CIRCLES_3D_HC
+{
+ File = "pie3d_52x60_h.png" ;
+};
+Bitmap BMP_CIRCLES_3D_EXPLODED_HC
+{
+ File = "pie3dexploded_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_DONUT_2D_HC
+{
+ File = "donut_52x60_h.png" ;
+};
+Bitmap BMP_DONUT_2D_EXPLODED_HC
+{
+ File = "donutexploded_52x60_h.png" ;
+};
+Bitmap BMP_DONUT_3D_HC
+{
+ File = "donut3d_52x60_h.png" ;
+};
+Bitmap BMP_DONUT_3D_EXPLODED_HC
+{
+ File = "donut3dexploded_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_2D_1_HC
+{
+ File = "columns_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_2D_2_HC
+{
+ File = "columnstack_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_2D_3_HC
+{
+ File = "columnpercent_52x60_h.png" ;
+};
+Bitmap BMP_COLUMN_LINE_HC
+{
+ File = "columnline_52x60_h.png" ;
+};
+Bitmap BMP_COLUMN_LINE_STACKED_HC
+{
+ File = "columnstackline_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_3D_HC
+{
+ File = "columns3ddeep_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_3D_1_HC
+{
+ File = "columns3d_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_3D_2_HC
+{
+ File = "columnstack3d_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_3D_3_HC
+{
+ File = "columnpercent3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_KEGELQ_3D_1_HC
+{
+ File = "conehori_52x60_h.png" ;
+};
+Bitmap BMP_KEGELQ_3D_2_HC
+{
+ File = "conehoristack_52x60_h.png" ;
+};
+Bitmap BMP_KEGELQ_3D_3_HC
+{
+ File = "conehoripercent_52x60_h.png" ;
+};
+Bitmap BMP_KEGELQ_3D_4_HC
+{
+ File = "conehorideep_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_1_HC
+{
+ File = "cone_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_2_HC
+{
+ File = "conestack_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_3_HC
+{
+ File = "conepercent_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_4_HC
+{
+ File = "conedeep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_POINTS_XVALUES_HC
+{
+ File = "valueaxisdirectpoints_52x60_h.png" ;
+};
+Bitmap BMP_POINTS_XCATEGORY_HC
+{
+ File = "nostackdirectpoints_52x60_h.png" ;
+};
+Bitmap BMP_POINTS_STACKED_HC
+{
+ File = "stackdirectpoints_52x60_h.png" ;
+};
+//---------------------
+
+Bitmap BMP_LINE_P_XVALUES_HC
+{
+ File = "valueaxisdirectboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES_HC
+{
+ File = "valueaxisdirectlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES_HC
+{
+ File = "valueaxisdirect3d_52x60_h.png" ;
+};
+
+
+Bitmap BMP_LINE_P_XCATEGORY_HC
+{
+ File = "nostackdirectboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY_HC
+{
+ File = "nostackdirectlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY_HC
+{
+ File = "nostackdirect3d_52x60_h.png" ;
+};
+
+
+Bitmap BMP_LINE_P_STACKED_HC
+{
+ File = "stackdirectboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_STACKED_HC
+{
+ File = "stackdirectlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_STACKED_HC
+{
+ File = "stackdirect3d_52x60_h.png" ;
+};
+
+//---------------------
+Bitmap BMP_LINE_P_XVALUES_SMOOTH_HC
+{
+ File = "valueaxissmoothboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES_SMOOTH_HC
+{
+ File = "valueaxissmoothlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES_SMOOTH_HC
+{
+ File = "valueaxissmooth3d_52x60_h.png" ;
+};
+Bitmap BMP_LINE_P_XCATEGORY_SMOOTH_HC
+{
+ File = "nostacksmoothboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY_SMOOTH_HC
+{
+ File = "nostacksmoothlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY_SMOOTH_HC
+{
+ File = "nostacksmooth3d_52x60_h.png" ;
+};
+Bitmap BMP_LINE_P_STACKED_SMOOTH_HC
+{
+ File = "stacksmoothboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_STACKED_SMOOTH_HC
+{
+ File = "stacksmoothlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_STACKED_SMOOTH_HC
+{
+ File = "stacksmooth3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_NET_HC
+{
+ File = "net_52x60_h.png" ;
+};
+Bitmap BMP_NET_STACK_HC
+{
+ File = "netstack_52x60_h.png" ;
+};
+Bitmap BMP_NET_SYMB_HC
+{
+ File = "netpoint_52x60_h.png" ;
+};
+Bitmap BMP_NET_SYMB_STACK_HC
+{
+ File = "netpointstack_52x60_h.png" ;
+};
+Bitmap BMP_NET_LINESYMB_HC
+{
+ File = "netlinepoint_52x60_h.png" ;
+};
+Bitmap BMP_NET_LINESYMB_STACK_HC
+{
+ File = "netlinepointstack_52x60_h.png" ;
+};
+Bitmap BMP_NET_FILL_HC
+{
+ File = "netfill_52x60_h.png" ;
+};
+Bitmap BMP_NET_FILL_STACK_HC
+{
+ File = "netstackfill_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_PYRAMIDQ_3D_1_HC
+{
+ File = "pyramindhori_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_2_HC
+{
+ File = "pyramindhoristack_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_3_HC
+{
+ File = "pyramindhoripercent_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_4_HC
+{
+ File = "pyramindhorideep_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_1_HC
+{
+ File = "pyramind_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_2_HC
+{
+ File = "pyramindstack_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_3_HC
+{
+ File = "pyramindpercent_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_4_HC
+{
+ File = "pyraminddeep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_ROEHRE_3D_1_HC
+{
+ File = "cylinderhori_52x60_h.png" ;
+};
+Bitmap BMP_ROEHRE_3D_2_HC
+{
+ File = "cylinderhoristack_52x60_h.png" ;
+};
+Bitmap BMP_ROEHRE_3D_3_HC
+{
+ File = "cylinderhoriprocent_52x60_h.png" ;
+};
+Bitmap BMP_ROEHRE_3D_4_HC
+{
+ File = "cylinderhorideep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_SAEULE_3D_1_HC
+{
+ File = "cylinder_52x60_h.png" ;
+};
+Bitmap BMP_SAEULE_3D_2_HC
+{
+ File = "cylinderstack_52x60_h.png" ;
+};
+Bitmap BMP_SAEULE_3D_3_HC
+{
+ File = "cylinderpercent_52x60_h.png" ;
+};
+Bitmap BMP_SAEULE_3D_4_HC
+{
+ File = "cylinderdeep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_STOCK_1_HC
+{
+ File = "stock_52x60_h.png" ;
+};
+Bitmap BMP_STOCK_2_HC
+{
+ File = "stockblock_52x60_h.png" ;
+};
+Bitmap BMP_STOCK_3_HC
+{
+ File = "stockcolumns_52x60_h.png" ;
+};
+Bitmap BMP_STOCK_4_HC
+{
+ File = "stockcolumnsattach_52x60_h.png" ;
+};
+//---------------------
+//---------------------
+//---------------------
+//error indicator
+Image BMP_INDICATE_BOTH_VERTI_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothverti_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_DOWN_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errordown_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_UP_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorup_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_BOTH_HORI_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothhori_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_RIGHT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorright_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_LEFT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorleft_30_h.png" ;
+ };
+};
+
+//---------------------
+//regression curves
+Image BMP_REGRESSION_NONE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regno_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LINEAR_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglin_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LOG_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglog_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_EXP_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regexp_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_POWER_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regpow_h.bmp" ;
+ };
+};
+//---------------------
+Image IMG_SELECTRANGE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "selectrange.png";
+ };
+ MaskColor = SC_HC_MASKCOLOR;
+};
diff --git a/chart2/source/controller/dialogs/ChangingResource.cxx b/chart2/source/controller/dialogs/ChangingResource.cxx
new file mode 100644
index 000000000000..a668cc1b41b8
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChangingResource.cxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChangingResource.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChangingResource.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ChangingResource::ChangingResource()
+ : m_pChangeListener(0)
+{
+}
+ChangingResource::~ChangingResource()
+{
+}
+void ChangingResource::setChangeListener( ResourceChangeListener* pListener )
+{
+ m_pChangeListener = pListener;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/ChangingResource.hxx b/chart2/source/controller/dialogs/ChangingResource.hxx
new file mode 100644
index 000000000000..24b24a5095ad
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChangingResource.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChangingResource.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CHANGINGRESOURCE_HXX
+#define _CHART2_CHANGINGRESOURCE_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class ChangingResource;
+class ResourceChangeListener
+{
+public:
+ virtual void stateChanged( ChangingResource* pResource ) = 0;
+};
+
+class ChangingResource
+{
+public:
+ ChangingResource();
+ virtual ~ChangingResource();
+
+ virtual void setChangeListener( ResourceChangeListener* pListener );
+
+protected:
+ ResourceChangeListener* m_pChangeListener;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
new file mode 100644
index 000000000000..fa51d17a03d8
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -0,0 +1,1288 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChartTypeDialogController.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartTypeDialogController.hxx"
+#include "ResId.hxx"
+#include "HelpIds.hrc"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "AxisHelper.hxx"
+
+#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
+#include <com/sun/star/chart2/PieChartOffsetMode.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+// header for class Image
+#include <vcl/image.hxx>
+// header for class Bitmap
+#include <vcl/bitmap.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_BITMAP(name) Bitmap( SchResId( bIsHighContrast ? name ## _HC : name ))
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+/*
+ ( C2U( "com.sun.star.chart2.template.Surface" ), CHSTYLE_3D_SURFACE)
+ ( C2U( "com.sun.star.chart2.template.Addin" ), CHSTYLE_ADDIN)
+*/
+
+ChartTypeParameter::ChartTypeParameter()
+ : nSubTypeIndex( 1 )
+ , bXAxisWithValues( false )
+ , b3DLook( false )
+ , bSymbols( true )
+ , bLines( true )
+ , eStackMode( GlobalStackMode_NONE )
+ , eCurveStyle( CurveStyle_LINES )
+ , nCurveResolution(20)
+ , nSplineOrder(3)
+ , nGeometry3D(DataPointGeometry3D::CUBOID)
+ , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , bSortByXValues(sal_False)
+{
+}
+
+ChartTypeParameter::ChartTypeParameter( sal_Int32 SubTypeIndex, bool HasXAxisWithValues
+ , bool Is3DLook, GlobalStackMode nStackMode
+ , bool HasSymbols, bool HasLines
+ , CurveStyle nCurveStyle )
+ : nSubTypeIndex( SubTypeIndex )
+ , bXAxisWithValues( HasXAxisWithValues )
+ , b3DLook( Is3DLook )
+ , bSymbols( HasSymbols )
+ , bLines( HasLines )
+ , eStackMode( nStackMode )
+ , eCurveStyle( nCurveStyle )
+ , nCurveResolution(20)
+ , nSplineOrder(3)
+ , nGeometry3D(DataPointGeometry3D::CUBOID)
+ , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , bSortByXValues(sal_False)
+{
+}
+ChartTypeParameter::~ChartTypeParameter()
+{
+}
+
+bool ChartTypeParameter::mapsToSameService( const ChartTypeParameter& rParameter ) const
+{
+ return this->mapsToSimilarService( rParameter, 0 );
+}
+bool ChartTypeParameter::mapsToSimilarService( const ChartTypeParameter& rParameter, sal_Int32 nTheHigherTheLess ) const
+{
+ sal_Int32 nMax=7;
+ if(nTheHigherTheLess>nMax)
+ return true;
+ if( this->bXAxisWithValues!=rParameter.bXAxisWithValues )
+ return nTheHigherTheLess>nMax-1;
+ if( this->b3DLook!=rParameter.b3DLook )
+ return nTheHigherTheLess>nMax-2;
+ if( this->eStackMode!=rParameter.eStackMode )
+ return nTheHigherTheLess>nMax-3;
+ if( this->nSubTypeIndex!=rParameter.nSubTypeIndex )
+ return nTheHigherTheLess>nMax-4;
+ if( this->bSymbols!=rParameter.bSymbols )
+ return nTheHigherTheLess>nMax-5;
+ if( this->bLines!=rParameter.bLines )
+ return nTheHigherTheLess>nMax-6;
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+ChartTypeDialogController::ChartTypeDialogController()
+ : bSupportsXAxisWithValues(false)
+ , bSupports3D(true)
+{
+}
+
+ChartTypeDialogController::~ChartTypeDialogController()
+{
+}
+Image ChartTypeDialogController::getImage( bool /*bIsHighContrast*/ )
+{
+ return Image();
+}
+bool ChartTypeDialogController::isSubType( const rtl::OUString& rServiceName )
+{
+ const tTemplateServiceChartTypeParameterMap& rTemplateMap = this->getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIt( rTemplateMap.find( rServiceName ));
+ if( aIt != rTemplateMap.end())
+ return true;
+ return false;
+}
+ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService(
+ const rtl::OUString& rServiceName
+ , const uno::Reference< beans::XPropertySet >& xTemplateProps )
+{
+ ChartTypeParameter aRet;
+ const tTemplateServiceChartTypeParameterMap& rTemplateMap = this->getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIt( rTemplateMap.find( rServiceName ));
+ if( aIt != rTemplateMap.end())
+ aRet = (*aIt).second;
+ if( xTemplateProps.is() )
+ {
+ try
+ {
+ xTemplateProps->getPropertyValue( C2U( "CurveStyle" )) >>= aRet.eCurveStyle;
+ xTemplateProps->getPropertyValue( C2U( "CurveResolution" )) >>= aRet.nCurveResolution;
+ xTemplateProps->getPropertyValue( C2U( "SplineOrder" )) >>= aRet.nSplineOrder;
+ }
+ catch( uno::Exception & ex )
+ {
+ //not all templates need to support CurveStyle, CurveResolution or SplineOrder
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+
+ try
+ {
+ xTemplateProps->getPropertyValue( C2U( "Geometry3D" )) >>= aRet.nGeometry3D;
+ }
+ catch( uno::Exception& ex )
+ {
+ //not all templates need to support CGeometry3D
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ return aRet;
+}
+void ChartTypeDialogController::adjustSubTypeAndEnableControls( ChartTypeParameter& /*rParameter*/ )
+{
+}
+void ChartTypeDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y;
+ break;
+ case 3:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y_PERCENT;
+ break;
+ case 4:
+ rParameter.eStackMode=GlobalStackMode_STACK_Z;
+ break;
+ default:
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ break;
+ }
+}
+void ChartTypeDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
+{
+ bool bFoundSomeMatch=false;
+
+ rParameter.bXAxisWithValues = bSupportsXAxisWithValues;
+ if( rParameter.b3DLook && !bSupports3D )
+ rParameter.b3DLook = false;
+ if(!rParameter.b3DLook && rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+
+ const tTemplateServiceChartTypeParameterMap& rMap = getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIter = rMap.begin();
+ const tTemplateServiceChartTypeParameterMap::const_iterator aEnd = rMap.end();
+ for( sal_Int32 nMatchPrecision=0; nMatchPrecision<7 && !bFoundSomeMatch; nMatchPrecision++ )
+ {
+ for( aIter = rMap.begin(); aIter != aEnd; aIter++ )
+ {
+ if( rParameter.mapsToSimilarService( (*aIter).second, nMatchPrecision ) )
+ {
+ //remind some values
+ ThreeDLookScheme aScheme = rParameter.eThreeDLookScheme;
+ sal_Int32 nCurveResolution = rParameter.nCurveResolution;
+ sal_Int32 nSplineOrder = rParameter.nSplineOrder;
+ CurveStyle eCurveStyle = rParameter.eCurveStyle;
+ sal_Int32 nGeometry3D = rParameter.nGeometry3D;
+ sal_Bool bSortByXValues = rParameter.bSortByXValues;
+
+ rParameter = (*aIter).second;
+
+ //some values should not be changed with charttype
+ rParameter.eThreeDLookScheme = aScheme;
+ rParameter.nCurveResolution = nCurveResolution;
+ rParameter.nSplineOrder =nSplineOrder;
+ rParameter.eCurveStyle = eCurveStyle;
+ rParameter.nGeometry3D = nGeometry3D;
+ rParameter.bSortByXValues = bSortByXValues;
+
+ bFoundSomeMatch = true;
+ break;
+ }
+ }
+ }
+ if(!bFoundSomeMatch)
+ {
+ if(rMap.begin()!=rMap.end())
+ rParameter = (*rMap.begin()).second;
+ else
+ rParameter = ChartTypeParameter();
+ }
+}
+rtl::OUString ChartTypeDialogController::getServiceNameForParameter( const ChartTypeParameter& rParameter ) const
+{
+ ChartTypeParameter aParameter(rParameter);
+ if( aParameter.bXAxisWithValues )
+ aParameter.eStackMode = GlobalStackMode_NONE;
+ if(!aParameter.b3DLook && aParameter.eStackMode==GlobalStackMode_STACK_Z)
+ aParameter.eStackMode = GlobalStackMode_NONE;
+ const tTemplateServiceChartTypeParameterMap& rMap = getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIter = rMap.begin();
+ const tTemplateServiceChartTypeParameterMap::const_iterator aEnd = rMap.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ if( aParameter.mapsToSameService( (*aIter).second ) )
+ return (*aIter).first;
+ }
+
+ OSL_ENSURE( false, "ChartType not implemented yet - use fallback to similar type" );
+ for( sal_Int32 nMatchPrecision=1; nMatchPrecision<8; nMatchPrecision++ )
+ {
+ for( aIter = rMap.begin(); aIter != aEnd; aIter++ )
+ {
+ if( aParameter.mapsToSimilarService( (*aIter).second, nMatchPrecision ) )
+ return (*aIter).first;
+ }
+ }
+ return ::rtl::OUString();
+}
+uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTemplate(
+ const ChartTypeParameter& rParameter
+ , const uno::Reference< lang::XMultiServiceFactory >& xTemplateManager ) const
+{
+ uno::Reference< XChartTypeTemplate > xTemplate(0);
+
+ rtl::OUString aServiceName( this->getServiceNameForParameter( rParameter ) );
+ if(aServiceName.getLength())
+ {
+ xTemplate.set( xTemplateManager->createInstance( aServiceName ), uno::UNO_QUERY );
+ if(xTemplate.is())
+ {
+ uno::Reference< beans::XPropertySet > xTemplateProps( xTemplate, uno::UNO_QUERY );
+ if(xTemplateProps.is())
+ {
+ try
+ {
+ xTemplateProps->setPropertyValue( C2U( "CurveStyle" ), uno::makeAny(rParameter.eCurveStyle) );
+ xTemplateProps->setPropertyValue( C2U( "CurveResolution" ), uno::makeAny(rParameter.nCurveResolution) );
+ xTemplateProps->setPropertyValue( C2U( "SplineOrder" ), uno::makeAny(rParameter.nSplineOrder) );
+ }
+ catch( uno::Exception & ex )
+ {
+ //not all templates need to support CurveStyle, CurveResolution or SplineOrder
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ try
+ {
+ xTemplateProps->setPropertyValue( C2U( "Geometry3D" ), uno::makeAny(rParameter.nGeometry3D) );
+ }
+ catch( uno::Exception & ex )
+ {
+ //not all templates need to support Geometry3D
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ try
+ {
+ this->setTemplateProperties( xTemplateProps );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ return xTemplate;
+}
+
+bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParameter
+ , const uno::Reference< XChartDocument >& xChartModel )
+{
+ uno::Reference< lang::XMultiServiceFactory > xTemplateManager( xChartModel->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< XChartTypeTemplate > xTemplate( this->getCurrentTemplate( rParameter, xTemplateManager ) );
+ if(xTemplate.is())
+ {
+ uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY);
+
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( xModel );
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ DiagramHelper::tTemplateWithServiceName aTemplateWithService(
+ DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
+ if( aTemplateWithService.first.is())
+ aTemplateWithService.first->resetStyles( xDiagram );
+ xTemplate->changeDiagram( xDiagram );
+ if( Application::GetSettings().GetLayoutRTL() )
+ AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
+ if( rParameter.b3DLook )
+ ThreeDHelper::setScheme( xDiagram, rParameter.eThreeDLookScheme );
+
+ //SortByXValues
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+ if( xDiaProp.is() )
+ xDiaProp->setPropertyValue( C2U( "SortByXValues" ), uno::makeAny( rParameter.bSortByXValues ) );
+ }
+ // \-- locked controllers
+ }
+ return false;
+}
+void ChartTypeDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool /*bIsHighContrast*/, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+}
+bool ChartTypeDialogController::shouldShow_XAxisTypeControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_3DLookControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_StackingControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_DeepStackingControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_SplineControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_GeometryControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_SortByXValuesResourceGroup() const
+{
+ return false;
+}
+
+void ChartTypeDialogController::showExtraControls( Window* /*pParent*/, const Point& /*rPosition*/, const Size& /*rSize*/ )
+{
+}
+void ChartTypeDialogController::hideExtraControls() const
+{
+}
+void ChartTypeDialogController::fillExtraControls( const ChartTypeParameter& /*rParameter*/
+ , const uno::Reference< XChartDocument >& /*xChartModel*/
+ , const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const
+{
+}
+void ChartTypeDialogController::setTemplateProperties( const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const throw (uno::RuntimeException)
+{
+}
+//--------------------------------------------------------------------------
+
+ColumnOrBarChartDialogController_Base::ColumnOrBarChartDialogController_Base()
+ : ChartTypeDialogController()
+{
+}
+ColumnOrBarChartDialogController_Base::~ColumnOrBarChartDialogController_Base()
+{
+}
+bool ColumnOrBarChartDialogController_Base::shouldShow_3DLookControl() const
+{
+ return true;
+}
+bool ColumnOrBarChartDialogController_Base::shouldShow_GeometryControl() const
+{
+ return true;
+}
+void ColumnOrBarChartDialogController_Base::adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter )
+{
+ if(rParameter.nSubTypeIndex>3 && !rParameter.b3DLook)
+ {
+ rParameter.nSubTypeIndex=1;
+ }
+}
+//--------------------------------------------------------------------------
+ColumnChartDialogController::ColumnChartDialogController()
+{
+}
+ColumnChartDialogController::~ColumnChartDialogController()
+{
+}
+String ColumnChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_COLUMN ));
+}
+Image ColumnChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_COLUMN );
+}
+const tTemplateServiceChartTypeParameterMap& ColumnChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Column" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedColumn" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedColumn" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDColumnFlat" ), ChartTypeParameter(1,false,true,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDColumnFlat" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDColumnDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z) )
+ ;
+ return m_aTemplateMap;
+}
+void ColumnChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ switch(rParameter.nGeometry3D)
+ {
+ case DataPointGeometry3D::CYLINDER:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_SAEULE_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_SAEULE_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_SAEULE_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_SAEULE_3D_4 ) );
+ break;
+ case DataPointGeometry3D::CONE:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_KEGEL_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_KEGEL_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_KEGEL_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_KEGEL_3D_4 ) );
+ break;
+ case DataPointGeometry3D::PYRAMID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_PYRAMID_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_PYRAMID_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_PYRAMID_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_PYRAMID_3D_4 ) );
+ break;
+ default: //DataPointGeometry3D::CUBOID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_COLUMNS_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_COLUMNS_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_COLUMNS_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_COLUMNS_3D ) );
+ break;
+ }
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_COLUMNS_2D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_COLUMNS_2D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_COLUMNS_2D_3 ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STACKED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_PERCENT )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_DEEP )) );
+}
+
+//--------------------------------------------------------------------------
+
+BarChartDialogController::BarChartDialogController()
+{
+}
+BarChartDialogController::~BarChartDialogController()
+{
+}
+String BarChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_BAR ));
+}
+Image BarChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_BAR );
+}
+const tTemplateServiceChartTypeParameterMap& BarChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Bar" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedBar" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedBar" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDBarFlat" ), ChartTypeParameter(1,false,true,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDBarFlat" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDBarDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z) )
+ ;
+ return m_aTemplateMap;
+}
+void BarChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ switch(rParameter.nGeometry3D)
+ {
+ case DataPointGeometry3D::CYLINDER:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_ROEHRE_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_ROEHRE_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_ROEHRE_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_ROEHRE_3D_4 ) );
+ break;
+ case DataPointGeometry3D::CONE:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_KEGELQ_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_KEGELQ_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_KEGELQ_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_KEGELQ_3D_4 ) );
+ break;
+ case DataPointGeometry3D::PYRAMID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_PYRAMIDQ_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_PYRAMIDQ_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_PYRAMIDQ_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_PYRAMIDQ_3D_4 ) );
+ break;
+ default: //DataPointGeometry3D::CUBOID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BARS_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_BARS_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_BARS_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_BARS_3D ) );
+ break;
+ }
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BARS_2D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_BARS_2D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_BARS_2D_3 ) );
+ }
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STACKED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_PERCENT )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_DEEP )) );
+}
+
+//--------------------------------------------------------------------------
+
+PieChartDialogController::PieChartDialogController()
+{
+}
+PieChartDialogController::~PieChartDialogController()
+{
+}
+String PieChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_PIE ));
+}
+Image PieChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_PIE );
+}
+const tTemplateServiceChartTypeParameterMap& PieChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Pie" ), ChartTypeParameter(1,false,false) )
+ ( C2U( "com.sun.star.chart2.template.PieAllExploded" ), ChartTypeParameter(2,false,false) )
+ ( C2U( "com.sun.star.chart2.template.Donut" ), ChartTypeParameter(3,false,false) )
+ ( C2U( "com.sun.star.chart2.template.DonutAllExploded" ), ChartTypeParameter(4,false,false) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDPie" ), ChartTypeParameter(1,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDPieAllExploded" ), ChartTypeParameter(2,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDDonut" ), ChartTypeParameter(3,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDDonutAllExploded" ), ChartTypeParameter(4,false,true) )
+ ;
+ return m_aTemplateMap;
+}
+void PieChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_CIRCLES_3D ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_CIRCLES_3D_EXPLODED ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_DONUT_3D ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_DONUT_3D_EXPLODED ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_CIRCLES_2D ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_CIRCLES_2D_EXPLODED ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_DONUT_2D ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_DONUT_2D_EXPLODED ) );
+ }
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_PIE_EXPLODED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_DONUT )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_DONUT_EXPLODED )) );
+}
+bool PieChartDialogController::shouldShow_3DLookControl() const
+{
+ return true;
+}
+void PieChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+//--------------------------------------------------------------------------
+LineChartDialogController::LineChartDialogController()
+{
+}
+LineChartDialogController::~LineChartDialogController()
+{
+}
+String LineChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_LINE ));
+}
+Image LineChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_LINE );
+}
+const tTemplateServiceChartTypeParameterMap& LineChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ //-------------------------------------------------------
+ ( C2U( "com.sun.star.chart2.template.Symbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE,true,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y,true,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT,true,false) )
+ ( C2U( "com.sun.star.chart2.template.LineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_NONE,true,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedLineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y,true,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedLineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT,true,true) )
+ ( C2U( "com.sun.star.chart2.template.Line" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+ //-------------------------------------------------------
+ //( C2U( "com.sun.star.chart2.template.ThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y,false,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDLineDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z,false,true) )
+ //-------------------------------------------------------
+ ;
+ return m_aTemplateMap;
+}
+void LineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( CurveStyle_LINES==rParameter.eCurveStyle )
+ {
+ //direct lines
+ if( GlobalStackMode_NONE == rParameter.eStackMode || GlobalStackMode_STACK_Z == rParameter.eStackMode )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XCATEGORY ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XCATEGORY ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XCATEGORY ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XCATEGORY ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_STACKED ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_STACKED ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_STACKED ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_STACKED ) );
+ }
+ }
+ else //CurveStyle_LINES
+ {
+ if( GlobalStackMode_NONE == rParameter.eStackMode || GlobalStackMode_STACK_Z == rParameter.eStackMode )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XCATEGORY ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XCATEGORY_SMOOTH ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XCATEGORY_SMOOTH ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XCATEGORY_SMOOTH ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_STACKED ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_STACKED_SMOOTH ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_STACKED_SMOOTH ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_STACKED_SMOOTH ) );
+ }
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_LINES_3D )) );
+}
+bool LineChartDialogController::shouldShow_StackingControl() const
+{
+ return true;
+}
+bool LineChartDialogController::shouldShow_DeepStackingControl() const
+{
+ return false;
+}
+bool LineChartDialogController::shouldShow_SplineControl() const
+{
+ return true;
+}
+void LineChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.bSymbols = true;
+ rParameter.bLines = true;
+ break;
+ case 3:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ rParameter.b3DLook = true;
+ if( rParameter.eStackMode == GlobalStackMode_NONE )
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+ break;
+ default:
+ rParameter.bSymbols = true;
+ rParameter.bLines = false;
+ break;
+ }
+
+ if(!rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_STACK_Z )
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+void LineChartDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
+{
+ if( rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_NONE )
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+
+ ChartTypeDialogController::adjustParameterToMainType( rParameter );
+}
+//--------------------------------------------------------------------------
+XYChartDialogController::XYChartDialogController()
+{
+ bSupportsXAxisWithValues = true;
+}
+XYChartDialogController::~XYChartDialogController()
+{
+}
+String XYChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_XY ));
+}
+Image XYChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_XY );
+}
+const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ //-------------------------------------------------------
+ ( C2U( "com.sun.star.chart2.template.ScatterSymbol" ), ChartTypeParameter(1,true,false,GlobalStackMode_NONE,true,false) )
+ ( C2U( "com.sun.star.chart2.template.ScatterLineSymbol" ), ChartTypeParameter(2,true,false,GlobalStackMode_NONE,true,true) )
+ ( C2U( "com.sun.star.chart2.template.ScatterLine" ), ChartTypeParameter(3,true,false,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDScatter" ), ChartTypeParameter(4,true,true,GlobalStackMode_NONE,false,true) )
+ ;
+ return m_aTemplateMap;
+}
+void XYChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( CurveStyle_LINES==rParameter.eCurveStyle )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XVALUES ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XVALUES ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XVALUES ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XVALUES ) );
+ }
+ else //CurveStyle_LINES
+ {
+ //smooth lines
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XVALUES ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XVALUES_SMOOTH ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XVALUES_SMOOTH ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XVALUES_SMOOTH ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_LINES_3D )) );
+}
+bool XYChartDialogController::shouldShow_SplineControl() const
+{
+ return true;
+}
+bool XYChartDialogController::shouldShow_SortByXValuesResourceGroup() const
+{
+ return true;
+}
+void XYChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ rParameter.b3DLook = false;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.bSymbols = true;
+ rParameter.bLines = true;
+ break;
+ case 3:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ rParameter.b3DLook = true;
+ rParameter.eStackMode=GlobalStackMode_STACK_Z;
+ break;
+ default:
+ rParameter.bSymbols = true;
+ rParameter.bLines = false;
+ break;
+ }
+}
+//--------------------------------------------------------------------------
+AreaChartDialogController::AreaChartDialogController()
+{
+}
+AreaChartDialogController::~AreaChartDialogController()
+{
+}
+String AreaChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_AREA ));
+}
+Image AreaChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_AREA );
+}
+bool AreaChartDialogController::shouldShow_3DLookControl() const
+{
+ return true;
+}
+const tTemplateServiceChartTypeParameterMap& AreaChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Area" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDArea" ), ChartTypeParameter(1,false,true,GlobalStackMode_STACK_Z) )
+ ( C2U( "com.sun.star.chart2.template.StackedArea" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDArea" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedArea" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDArea" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
+ ;
+ return m_aTemplateMap;
+}
+void AreaChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_AREAS_3D ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_AREAS_3D_1 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_AREAS_3D_2 ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_AREAS_2D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_AREAS_2D ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_AREAS_2D_3 ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( rParameter.b3DLook ? STR_DEEP : STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STACKED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_PERCENT )) );
+}
+void AreaChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.eCurveStyle = CurveStyle_LINES;
+
+ if( rParameter.nSubTypeIndex>3 )
+ rParameter.nSubTypeIndex = 1;
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y;
+ break;
+ case 3:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y_PERCENT;
+ break;
+ default:
+ if( rParameter.b3DLook )
+ rParameter.eStackMode=GlobalStackMode_STACK_Z;
+ else
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ break;
+ }
+}
+void AreaChartDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
+{
+ if( rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_NONE )
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+
+ ChartTypeDialogController::adjustParameterToMainType( rParameter );
+}
+//--------------------------------------------------------------------------
+NetChartDialogController::NetChartDialogController()
+{
+ bSupports3D = false;
+}
+NetChartDialogController::~NetChartDialogController()
+{
+}
+String NetChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_NET ));
+}
+Image NetChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_NET );
+}
+bool NetChartDialogController::shouldShow_StackingControl() const
+{
+ return true;
+}
+const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ //@todo need templates with symbols only
+ ( C2U( "com.sun.star.chart2.template.NetSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE,true,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedNetSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y,true,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ),ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT,true,false) )
+
+ ( C2U( "com.sun.star.chart2.template.Net" ), ChartTypeParameter(2,false,false,GlobalStackMode_NONE,true,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedNet" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y,true,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT,true,true) )
+
+ ( C2U( "com.sun.star.chart2.template.NetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+
+ ( C2U( "com.sun.star.chart2.template.FilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_NONE,false,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y,false,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ),ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false) )
+ ;
+ return m_aTemplateMap;
+}
+void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( GlobalStackMode_NONE == rParameter.eStackMode )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB_STACK ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB_STACK ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET_STACK ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL_STACK ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_FILLED )) );
+}
+void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.bSymbols = true;
+ rParameter.bLines = true;
+ break;
+ case 3:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = false;
+ break;
+ default:
+ rParameter.bSymbols = true;
+ rParameter.bLines = false;
+ break;
+ }
+}
+//--------------------------------------------------------------------------
+StockChartDialogController::StockChartDialogController()
+{
+ bSupports3D = false;
+}
+StockChartDialogController::~StockChartDialogController()
+{
+}
+String StockChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_STOCK ));
+}
+Image StockChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_STOCK );
+}
+const tTemplateServiceChartTypeParameterMap& StockChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), ChartTypeParameter(1) )
+ ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), ChartTypeParameter(2) )
+ ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), ChartTypeParameter(3) )
+ ( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ),ChartTypeParameter(4) )
+ ;
+ return m_aTemplateMap;
+}
+void StockChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_STOCK_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_STOCK_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_STOCK_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_STOCK_4 ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_STOCK_1 )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STOCK_2 )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_STOCK_3 )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_STOCK_4 )) );
+}
+void StockChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+//--------------------------------------------------------------------------
+CombiColumnLineChartDialogController::CombiColumnLineChartDialogController()
+ : m_pFT_NumberOfLines(0)
+ , m_pMF_NumberOfLines(0)
+{
+ bSupports3D = false;
+}
+CombiColumnLineChartDialogController::~CombiColumnLineChartDialogController()
+{
+ if(m_pFT_NumberOfLines)
+ delete m_pFT_NumberOfLines;
+ if(m_pMF_NumberOfLines)
+ delete m_pMF_NumberOfLines;
+}
+String CombiColumnLineChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_COMBI_COLUMN_LINE ));
+}
+Image CombiColumnLineChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_COLUMN_LINE );
+}
+const tTemplateServiceChartTypeParameterMap& CombiColumnLineChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.ColumnWithLine" ), ChartTypeParameter(1) )
+ ( C2U( "com.sun.star.chart2.template.StackedColumnWithLine" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ;
+ return m_aTemplateMap;
+}
+void CombiColumnLineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_COLUMN_LINE ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_COLUMN_LINE_STACKED ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_LINE_COLUMN )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_LINE_STACKEDCOLUMN )) );
+}
+void CombiColumnLineChartDialogController::showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize )
+{
+ if(!m_pFT_NumberOfLines)
+ {
+ m_pFT_NumberOfLines = new FixedText(pParent,pParent->GetStyle());
+ m_pFT_NumberOfLines->SetText( String( SchResId( STR_NUMBER_OF_LINES )) );
+ }
+ if(!m_pMF_NumberOfLines)
+ {
+ m_pMF_NumberOfLines = new MetricField(pParent,pParent->GetStyle() | WB_SPIN | WB_REPEAT | WB_BORDER );
+ m_pMF_NumberOfLines->SetDefaultUnit( FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetUnit( FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetSpinSize(1);
+ m_pMF_NumberOfLines->SetFirst( 1, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetLast( 100, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetMin( 1, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetMax( 100, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetHelpId( HID_SCH_NUM_OF_LINES );
+
+ m_pMF_NumberOfLines->SetModifyHdl( LINK( this, CombiColumnLineChartDialogController, ChangeLineCountHdl ) );
+ }
+
+ Size aDistanceSize( pParent->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,2), MapMode(MAP_APPFONT) ) );
+ Size aMFSize( pParent->LogicToPixel( Size(20,RSC_CD_TEXTBOX_HEIGHT), MapMode(MAP_APPFONT) ) );
+ m_pMF_NumberOfLines->SetSizePixel( aMFSize );
+
+ Size aFTSize(m_pFT_NumberOfLines->CalcMinimumSize(rSize.Width()-aMFSize.Width()-aDistanceSize.Width()));
+ m_pFT_NumberOfLines->SetSizePixel(aFTSize);
+
+ m_pFT_NumberOfLines->SetPosPixel( Point( rPosition.X(), rPosition.Y()+aDistanceSize.Height()) );
+ m_pMF_NumberOfLines->SetPosPixel( Point( rPosition.X()+aFTSize.Width()+aDistanceSize.Width(), rPosition.Y()) );
+
+ m_pFT_NumberOfLines->Show();
+ m_pMF_NumberOfLines->Show();
+}
+void CombiColumnLineChartDialogController::hideExtraControls() const
+{
+ if(m_pFT_NumberOfLines)
+ m_pFT_NumberOfLines->Hide();
+ if(m_pMF_NumberOfLines)
+ m_pMF_NumberOfLines->Hide();
+}
+void CombiColumnLineChartDialogController::fillExtraControls( const ChartTypeParameter& /*rParameter*/
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< beans::XPropertySet >& xTemplateProps ) const
+{
+ if(!m_pMF_NumberOfLines)
+ return;
+
+ uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY );
+
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ if(!xDiagram.is())
+ return;
+
+ sal_Int32 nNumLines = 0;
+
+ if(xTemplateProps.is())
+ try
+ {
+ xTemplateProps->getPropertyValue( C2U("NumberOfLines") ) >>= nNumLines;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ if( nNumLines < 0 )
+ nNumLines = 0;
+ m_pMF_NumberOfLines->SetValue( nNumLines );
+
+ sal_Int32 nMaxLines = ChartModelHelper::getDataSeries( xModel ).size() - 1;
+ if( nMaxLines < 0 )
+ nMaxLines = 0;
+ m_pMF_NumberOfLines->SetLast( nMaxLines );
+ m_pMF_NumberOfLines->SetMax( nMaxLines );
+}
+void CombiColumnLineChartDialogController::setTemplateProperties( const uno::Reference< beans::XPropertySet >& xTemplateProps ) const throw (uno::RuntimeException)
+{
+ if( xTemplateProps.is() )
+ {
+ sal_Int32 nNumLines = static_cast< sal_Int32 >( m_pMF_NumberOfLines->GetValue());
+ xTemplateProps->setPropertyValue( C2U( "NumberOfLines" ), uno::makeAny(nNumLines) );
+ }
+}
+
+IMPL_LINK( CombiColumnLineChartDialogController, ChangeLineCountHdl, void *, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+void CombiColumnLineChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y;
+ break;
+ default:
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ break;
+ }
+}
+//--------------------------------------------------------------------------
+BubbleChartDialogController::BubbleChartDialogController()
+{
+}
+BubbleChartDialogController::~BubbleChartDialogController()
+{
+}
+String BubbleChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_BUBBLE ));
+}
+Image BubbleChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_BUBBLE );
+}
+const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), ChartTypeParameter(1,true) ) ;
+ return m_aTemplateMap;
+}
+void BubbleChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BUBBLE_1 ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_BUBBLE_1 )) );
+}
+void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
new file mode 100644
index 000000000000..cdbda807813f
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
@@ -0,0 +1,320 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChartTypeDialogController.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CHARTTYPE_DIALOG_CONTROLLER_HXX
+#define _CHART2_CHARTTYPE_DIALOG_CONTROLLER_HXX
+
+#include "ChangingResource.hxx"
+#include "ThreeDHelper.hxx"
+#include <comphelper/InlineContainer.hxx>
+
+#include <com/sun/star/chart2/CurveStyle.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <svtools/valueset.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+enum GlobalStackMode
+{
+ GlobalStackMode_NONE,
+ GlobalStackMode_STACK_Y,
+ GlobalStackMode_STACK_Y_PERCENT,
+ GlobalStackMode_STACK_Z
+};
+
+class ChartTypeParameter
+{
+public:
+ ChartTypeParameter( sal_Int32 nSubTypeIndex, bool bXAxisWithValues=false
+ , bool b3DLook=false, GlobalStackMode eStackMode=GlobalStackMode_NONE
+ , bool _bSymbols = true, bool _bLines = true
+ , ::com::sun::star::chart2::CurveStyle eCurveStyle = ::com::sun::star::chart2::CurveStyle_LINES );
+ ChartTypeParameter();
+ virtual ~ChartTypeParameter();
+
+ bool mapsToSameService( const ChartTypeParameter& rParameter ) const;
+ bool mapsToSimilarService( const ChartTypeParameter& rParameter, sal_Int32 nTheHigherTheLess ) const;
+
+ sal_Int32 nSubTypeIndex;//starting with 1
+
+ bool bXAxisWithValues;
+ bool b3DLook;
+ bool bSymbols;
+ bool bLines;
+
+ GlobalStackMode eStackMode;
+ ::com::sun::star::chart2::CurveStyle eCurveStyle;
+
+ sal_Int32 nCurveResolution;
+ sal_Int32 nSplineOrder;
+
+ sal_Int32 nGeometry3D;
+
+ ThreeDLookScheme eThreeDLookScheme;
+ sal_Bool bSortByXValues;
+};
+
+typedef ::comphelper::MakeMap< ::rtl::OUString, ChartTypeParameter > tTemplateServiceChartTypeParameterMap;
+
+class ChartTypeDialogController : public ChangingResource
+{
+public:
+ ChartTypeDialogController();
+ virtual ~ChartTypeDialogController();
+
+ virtual String getName()=0;
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const = 0;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_XAxisTypeControl() const;
+ virtual bool shouldShow_3DLookControl() const;
+ virtual bool shouldShow_StackingControl() const;
+ virtual bool shouldShow_DeepStackingControl() const;
+ virtual bool shouldShow_SplineControl() const;
+ virtual bool shouldShow_GeometryControl() const;
+ virtual bool shouldShow_SortByXValuesResourceGroup() const;
+
+ virtual void showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize );
+ virtual void hideExtraControls() const;
+ virtual void fillExtraControls( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps=::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >() ) const;
+ virtual void setTemplateProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps ) const throw (::com::sun::star::uno::RuntimeException);
+
+ virtual bool isSubType( const rtl::OUString& rServiceName );
+ virtual ChartTypeParameter getChartTypeParameterForService( const rtl::OUString& rServiceName, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTemplateProps );
+ virtual void adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter );//if you have different counts of subtypes you may need to adjust the index
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+ virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
+ virtual rtl::OUString getServiceNameForParameter( const ChartTypeParameter& rParameter ) const;
+ virtual bool commitToModel( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xTemplateManager ) const;
+
+protected:
+ bool bSupportsXAxisWithValues;
+ bool bSupports3D;
+};
+
+class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
+{
+public:
+ ColumnOrBarChartDialogController_Base();
+ virtual ~ColumnOrBarChartDialogController_Base();
+
+ virtual bool shouldShow_3DLookControl() const;
+ virtual bool shouldShow_GeometryControl() const;
+
+ virtual void adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter );
+};
+
+class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base
+{
+public:
+ ColumnChartDialogController();
+ virtual ~ColumnChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+};
+
+class BarChartDialogController : public ColumnOrBarChartDialogController_Base
+{
+public:
+ BarChartDialogController();
+ virtual ~BarChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+};
+
+class PieChartDialogController : public ChartTypeDialogController
+{
+public:
+ PieChartDialogController();
+ virtual ~PieChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_3DLookControl() const;
+};
+
+class LineChartDialogController : public ChartTypeDialogController
+{
+public:
+ LineChartDialogController();
+ virtual ~LineChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+ virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_StackingControl() const;
+ virtual bool shouldShow_DeepStackingControl() const;
+ virtual bool shouldShow_SplineControl() const;
+};
+
+class XYChartDialogController : public ChartTypeDialogController
+{
+public:
+ XYChartDialogController();
+ virtual ~XYChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_SplineControl() const;
+ virtual bool shouldShow_SortByXValuesResourceGroup() const;
+};
+
+class AreaChartDialogController : public ChartTypeDialogController
+{
+public:
+ AreaChartDialogController();
+ virtual ~AreaChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+ virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_3DLookControl() const;
+};
+
+class NetChartDialogController : public ChartTypeDialogController
+{
+public:
+ NetChartDialogController();
+ virtual ~NetChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_StackingControl() const;
+};
+
+class StockChartDialogController : public ChartTypeDialogController
+{
+public:
+ StockChartDialogController();
+ virtual ~StockChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+};
+
+class CombiColumnLineChartDialogController : public ChartTypeDialogController
+{
+public:
+ CombiColumnLineChartDialogController();
+ virtual ~CombiColumnLineChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual void showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize );
+ virtual void hideExtraControls() const;
+ virtual void fillExtraControls( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps=::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >() ) const;
+
+ virtual void setTemplateProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps ) const throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ DECL_LINK( ChangeLineCountHdl, void* );
+
+private:
+ FixedText* m_pFT_NumberOfLines;
+ MetricField* m_pMF_NumberOfLines;
+};
+
+class BubbleChartDialogController : public ChartTypeDialogController
+{
+public:
+ BubbleChartDialogController();
+ virtual ~BubbleChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx
new file mode 100644
index 000000000000..58d3f0a2242c
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChartTypeTemplateProvider.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_DIALOGS_TEMPLATEPROVIDER_HXX
+#define _CHART2_DIALOGS_TEMPLATEPROVIDER_HXX
+
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class ChartTypeTemplateProvider
+{
+public:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate() const =0;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/CommonResources.hrc b/chart2/source/controller/dialogs/CommonResources.hrc
new file mode 100644
index 000000000000..e95c57139bff
--- /dev/null
+++ b/chart2/source/controller/dialogs/CommonResources.hrc
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CommonResources.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_HXX
+#define _CHART2_RESOURCE_HXX
+
+#define BUTTONS_OK_CANCEL_HELP( xPos, yPos, xOffset, yOffset ) \
+OKButton BTN_OK \
+{ \
+ Pos = MAP_APPFONT ( xPos , yPos ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+}; \
+CancelButton BTN_CANCEL \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset , yPos+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+HelpButton BTN_HELP \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset+xOffset , yPos+yOffset+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+};
+
+#define BUTTONS_OK_CANCEL_HELP_STACKED( xPos ) \
+BUTTONS_OK_CANCEL_HELP( xPos, 6, 0, 17 )
+
+#define BUTTONS_HELP_OK_CANCEL( xPos, yPos, xOffset, yOffset ) \
+HelpButton BTN_HELP \
+{ \
+ Pos = MAP_APPFONT ( xPos , yPos ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+OKButton BTN_OK \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset , yPos+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+}; \
+CancelButton BTN_CANCEL \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset+xOffset , yPos+yOffset+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+};
+
+#define BUTTONS_HELP_OK_CANCEL_NEXT( xPos, yPos ) \
+BUTTONS_HELP_OK_CANCEL( xPos, yPos, 53, 0 )
+
+
+#endif
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
new file mode 100644
index 000000000000..bab952cf317b
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -0,0 +1,1350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataBrowser.cxx,v $
+ * $Revision: 1.9.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+// header for class SvNumberformat
+#ifndef _ZFORMAT_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zformat.hxx>
+#endif
+// header for SvNumberFormatter
+#include <svl/zforlist.hxx>
+
+#include "DataBrowser.hxx"
+#include "DataBrowserModel.hxx"
+#include "Strings.hrc"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ResId.hxx"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "HelpIds.hrc"
+
+#include <vcl/fixed.hxx>
+#include <vcl/image.hxx>
+#include <vcl/msgbox.hxx>
+#include <rtl/math.hxx>
+
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+#include <algorithm>
+#include <functional>
+
+#define SELECT_IMAGE(name,hc) Image( SchResId( hc ? name ## _HC : name ))
+
+/* BROWSER_COLUMNSELECTION : single cells may be selected rather than only
+ entire rows
+ BROWSER_(H|V)LINES : show horizontal or vertical grid-lines
+
+ BROWSER_AUTO_(H|V)SCROLL : scroll automated horizontally or vertically when
+ cursor is moved beyond the edge of the dialog
+ BROWSER_HIGHLIGHT_NONE : Do not mark the current row with selection color
+ (usually blue)
+
+ */
+#define BROWSER_STANDARD_FLAGS \
+ BROWSER_COLUMNSELECTION | \
+ BROWSER_HLINES | BROWSER_VLINES | \
+ BROWSER_AUTO_HSCROLL | BROWSER_AUTO_VSCROLL | \
+ BROWSER_HIGHLIGHT_NONE
+
+// BROWSER_HIDECURSOR would prevent flickering in edit fields, but navigating
+// with shift up/down, and entering non-editable cells would be problematic,
+// e.g. the first cell, or when being in read-only mode
+
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+using namespace ::svt;
+
+namespace
+{
+sal_Int32 lcl_getRowInData( long nRow )
+{
+ return static_cast< sal_Int32 >( nRow );
+}
+
+sal_Int32 lcl_getColumnInData( USHORT nCol )
+{
+ return static_cast< sal_Int32 >( nCol ) - 1;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+
+// ----------------------------------------
+namespace impl
+{
+
+class SeriesHeaderEdit : public Edit
+{
+public:
+ SeriesHeaderEdit( Window * pParent );
+ virtual ~SeriesHeaderEdit();
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ void setStartColumn( sal_Int32 nStartColumn );
+ sal_Int32 getStartColumn() const;
+ void SetShowWarningBox( bool bShowWarning = true );
+
+private:
+ sal_Int32 m_nStartColumn;
+ bool m_bShowWarningBox;
+};
+
+SeriesHeaderEdit::SeriesHeaderEdit( Window * pParent ) :
+ Edit( pParent ),
+ m_nStartColumn( 0 ),
+ m_bShowWarningBox( false )
+{}
+SeriesHeaderEdit::~SeriesHeaderEdit()
+{}
+
+void SeriesHeaderEdit::setStartColumn( sal_Int32 nStartColumn )
+{
+ m_nStartColumn = nStartColumn;
+}
+
+sal_Int32 SeriesHeaderEdit::getStartColumn() const
+{
+ return m_nStartColumn;
+}
+
+void SeriesHeaderEdit::SetShowWarningBox( bool bShowWarning )
+{
+ m_bShowWarningBox = bShowWarning;
+}
+
+void SeriesHeaderEdit::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Edit::MouseButtonDown( rMEvt );
+
+ if( m_bShowWarningBox )
+ WarningBox( this, WinBits( WB_OK ),
+ String( SchResId( STR_INVALID_NUMBER ))).Execute();
+}
+
+class SeriesHeader
+{
+public:
+ explicit SeriesHeader( Window * pParent );
+
+ void SetColor( const Color & rCol );
+ void SetPos( const Point & rPos );
+ void SetWidth( sal_Int32 nWidth );
+ void SetChartType( const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bIsHighContrast );
+ void SetSeriesName( const String & rName );
+ void SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol );
+
+ void SetPixelPosX( sal_Int32 nPos );
+ void SetPixelWidth( sal_Int32 nWidth );
+
+ sal_Int32 GetStartColumn() const;
+ sal_Int32 GetEndColumn() const;
+
+ void Show();
+
+ /** call this before destroying the class. This notifies the listeners to
+ changes of the edit field for the series name.
+ */
+ void applyChanges();
+
+ void SetGetFocusHdl( const Link& rLink );
+
+ void SetEditChangedHdl( const Link & rLink );
+
+ bool HasFocus() const;
+
+private:
+ ::boost::shared_ptr< FixedImage > m_spSymbol;
+ ::boost::shared_ptr< SeriesHeaderEdit > m_spSeriesName;
+ ::boost::shared_ptr< FixedText > m_spColorBar;
+ OutputDevice * m_pDevice;
+ Link m_aChangeLink;
+
+ void notifyChanges();
+ DECL_LINK( SeriesNameChanged, void * );
+ DECL_LINK( SeriesNameEdited, void * );
+
+ /// @param bHC </TRUE> for hight-contrast image
+ static Image GetChartTypeImage(
+ const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bHC );
+
+ sal_Int32 m_nStartCol, m_nEndCol;
+ sal_Int32 m_nWidth;
+ Point m_aPos;
+ bool m_bSeriesNameChangePending;
+};
+
+SeriesHeader::SeriesHeader( Window * pParent ) :
+ m_spSymbol( new FixedImage( pParent, WB_NOBORDER )),
+ m_spSeriesName( new SeriesHeaderEdit( pParent )),
+ m_spColorBar( new FixedText( pParent, WB_NOBORDER )),
+ m_pDevice( pParent ),
+ m_nStartCol( 0 ),
+ m_nEndCol( 0 ),
+ m_nWidth( 42 ),
+ m_aPos( 0, 22 ),
+ m_bSeriesNameChangePending( false )
+{
+ m_spSeriesName->EnableUpdateData( 4 * EDIT_UPDATEDATA_TIMEOUT ); // define is in vcl/edit.hxx
+ m_spSeriesName->SetUpdateDataHdl( LINK( this, SeriesHeader, SeriesNameChanged ));
+ m_spSeriesName->SetModifyHdl( LINK( this, SeriesHeader, SeriesNameEdited ));
+ m_spSeriesName->SetSmartHelpId( SmartId( HID_SCH_DATA_SERIES_LABEL ));
+ Show();
+}
+
+void SeriesHeader::notifyChanges()
+{
+ if( m_aChangeLink.IsSet())
+ m_aChangeLink.Call( m_spSeriesName.get());
+
+ m_bSeriesNameChangePending = false;
+}
+
+void SeriesHeader::applyChanges()
+{
+ if( m_bSeriesNameChangePending )
+ {
+ notifyChanges();
+ }
+}
+
+void SeriesHeader::SetColor( const Color & rCol )
+{
+ m_spColorBar->SetControlBackground( rCol );
+}
+
+void SeriesHeader::SetPos( const Point & rPos )
+{
+ m_aPos = rPos;
+
+ // chart type symbol
+ sal_Int32 nHeight = 10;
+ Point aPos( rPos );
+ aPos.setY( aPos.getY() + 2 );
+ Size aSize( nHeight, nHeight );
+ m_spSymbol->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT ));
+ m_spSymbol->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT ));
+ aPos.setY( aPos.getY() - 2 );
+
+ // series name edit field
+ aPos.setX( aPos.getX() + nHeight + 2 );
+ aSize.setWidth( m_nWidth - nHeight - 2 );
+ nHeight = 12;
+ aSize.setHeight( nHeight );
+ m_spSeriesName->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT ));
+ m_spSeriesName->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT ));
+
+ // color bar
+ aPos.setX( rPos.getX() + 1 );
+ aPos.setY( aPos.getY() + nHeight + 2 );
+ nHeight = 3;
+ aSize.setWidth( m_nWidth - 1 );
+ aSize.setHeight( nHeight );
+ m_spColorBar->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT ));
+ m_spColorBar->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT ));
+}
+
+void SeriesHeader::SetWidth( sal_Int32 nWidth )
+{
+ m_nWidth = nWidth;
+ SetPos( m_aPos );
+}
+
+
+void SeriesHeader::SetPixelPosX( sal_Int32 nPos )
+{
+ Point aPos( m_pDevice->LogicToPixel( m_aPos, MAP_APPFONT ));
+ aPos.setX( nPos );
+ SetPos( m_pDevice->PixelToLogic( aPos, MAP_APPFONT ));
+}
+
+void SeriesHeader::SetPixelWidth( sal_Int32 nWidth )
+{
+ SetWidth( m_pDevice->PixelToLogic( Size( nWidth, 0 ), MAP_APPFONT ).getWidth());
+}
+
+void SeriesHeader::SetChartType(
+ const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bIsHighContrast )
+{
+ m_spSymbol->SetImage( GetChartTypeImage( xChartType, bSwapXAndYAxis, bIsHighContrast ));
+}
+
+void SeriesHeader::SetSeriesName( const String & rName )
+{
+ m_spSeriesName->SetText( rName );
+}
+
+void SeriesHeader::SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol )
+{
+ m_nStartCol = nStartCol;
+ m_nEndCol = (nEndCol > nStartCol) ? nEndCol : nStartCol;
+ m_spSeriesName->setStartColumn( nStartCol );
+}
+
+sal_Int32 SeriesHeader::GetStartColumn() const
+{
+ return m_nStartCol;
+}
+
+sal_Int32 SeriesHeader::GetEndColumn() const
+{
+ return m_nEndCol;
+}
+
+void SeriesHeader::Show()
+{
+ m_spSymbol->Show();
+ m_spSeriesName->Show();
+ m_spColorBar->Show();
+}
+
+void SeriesHeader::SetEditChangedHdl( const Link & rLink )
+{
+ m_aChangeLink = rLink;
+}
+
+IMPL_LINK( SeriesHeader, SeriesNameChanged, void * , EMPTYARG )
+{
+ notifyChanges();
+ return 0;
+}
+
+IMPL_LINK( SeriesHeader, SeriesNameEdited, void * , EMPTYARG )
+{
+ m_bSeriesNameChangePending = true;
+ return 0;
+}
+
+void SeriesHeader::SetGetFocusHdl( const Link& rLink )
+{
+ m_spSeriesName->SetGetFocusHdl( rLink );
+}
+
+bool SeriesHeader::HasFocus() const
+{
+ return m_spSeriesName->HasFocus();
+}
+
+// static
+Image SeriesHeader::GetChartTypeImage(
+ const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bHC )
+{
+ Image aResult;
+ if( !xChartType.is())
+ return aResult;
+ OUString aChartTypeName( xChartType->getChartType());
+
+ if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_AREA ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_AREA, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ))
+ {
+ if( bSwapXAndYAxis )
+ aResult = SELECT_IMAGE( IMG_TYPE_BAR, bHC );
+ else
+ aResult = SELECT_IMAGE( IMG_TYPE_COLUMN, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_LINE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_LINE, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_XY, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_PIE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_PIE, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET )
+ || aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_NET, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ))
+ {
+ // @todo: correct image for candle-stick type
+ aResult = SELECT_IMAGE( IMG_TYPE_STOCK, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_BUBBLE, bHC );
+ }
+
+ return aResult;
+}
+
+struct applyChangesFunctor : public ::std::unary_function< ::boost::shared_ptr< SeriesHeader >, void >
+{
+ void operator() ( ::boost::shared_ptr< SeriesHeader > spHeader )
+ {
+ spHeader->applyChanges();
+ }
+};
+
+} // namespace impl
+// ----------------------------------------
+
+namespace
+{
+
+/** returns false, if no header as the focus.
+
+ If a header has the focus, true is returned and the index of the header
+ with focus is set at pIndex if pOutIndex is not 0.
+*/
+bool lcl_SeriesHeaderHasFocus(
+ const ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader,
+ sal_Int32 * pOutIndex = 0 )
+{
+ sal_Int32 nIndex = 0;
+ for( ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > >::const_iterator aIt( rSeriesHeader.begin());
+ aIt != rSeriesHeader.end(); ++aIt, ++nIndex )
+ {
+ if( (*aIt)->HasFocus())
+ {
+ if( pOutIndex )
+ *pOutIndex = nIndex;
+ return true;
+ }
+ }
+ return false;
+}
+
+sal_Int32 lcl_getColumnInDataOrHeader(
+ USHORT nCol, const ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader )
+{
+ sal_Int32 nColIdx = 0;
+ bool bHeaderHasFocus( lcl_SeriesHeaderHasFocus( rSeriesHeader, &nColIdx ));
+
+ if( bHeaderHasFocus )
+ nColIdx = lcl_getColumnInData( static_cast< USHORT >( rSeriesHeader[nColIdx]->GetStartColumn()));
+ else
+ nColIdx = lcl_getColumnInData( nCol );
+
+ return nColIdx;
+}
+
+} // anonymous namespace
+
+
+DataBrowser::DataBrowser( Window* pParent, const ResId& rId, bool bLiveUpdate ) :
+ ::svt::EditBrowseBox( pParent, rId, EBBF_SMART_TAB_TRAVEL | EBBF_HANDLE_COLUMN_TEXT, BROWSER_STANDARD_FLAGS ),
+ m_nSeekRow( 0 ),
+ m_bIsReadOnly( false ),
+ m_bIsDirty( false ),
+ m_bLiveUpdate( bLiveUpdate ),
+ m_bDataValid( true ),
+ m_aNumberEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
+ m_aTextEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
+ m_rNumberEditController( new ::svt::FormattedFieldCellController( & m_aNumberEditField )),
+ m_rTextEditController( new ::svt::EditCellController( & m_aTextEditField ))
+{
+ double fNan;
+ ::rtl::math::setNan( & fNan );
+ m_aNumberEditField.SetDefaultValue( fNan );
+ m_aNumberEditField.TreatAsNumber( TRUE );
+ RenewTable();
+ SetClean();
+}
+
+DataBrowser::~DataBrowser()
+{
+}
+
+bool DataBrowser::MayInsertRow() const
+{
+ return ! IsReadOnly()
+ && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ));
+}
+
+bool DataBrowser::MayInsertColumn() const
+{
+ return ! IsReadOnly();
+}
+
+bool DataBrowser::MayDeleteRow() const
+{
+ return ! IsReadOnly()
+ && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
+ && ( GetCurRow() >= 0 )
+ && ( GetRowCount() > 1 );
+}
+
+bool DataBrowser::MayDeleteColumn() const
+{
+ // if a series header has the focus
+ if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
+ return true;
+
+ return ! IsReadOnly()
+ && ( GetCurColumnId() > 1 )
+ && ( ColCount() > 2 );
+}
+
+bool DataBrowser::MaySwapRows() const
+{
+ return ! IsReadOnly()
+ && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
+ && ( GetCurRow() >= 0 )
+ && ( GetCurRow() < GetRowCount() - 1 );
+}
+
+bool DataBrowser::MaySwapColumns() const
+{
+ // if a series header (except the last one) has the focus
+ {
+ sal_Int32 nColIndex(0);
+ if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders, &nColIndex ))
+ return (static_cast< sal_uInt32 >( nColIndex ) < (m_aSeriesHeaders.size() - 1));
+ }
+
+ return ! IsReadOnly()
+ && ( GetCurColumnId() > 1 )
+ && ( GetCurColumnId() < ColCount() - 1 );
+}
+
+// bool DataBrowser::MaySortRow() const
+// {
+// // not implemented
+// return false;
+// // return ! IsReadOnly() && ( GetCurRow() >= 0 );
+// }
+
+// bool DataBrowser::MaySortColumn() const
+// {
+// // not implemented
+// return false;
+// // return ! IsReadOnly() && ( GetCurColumnId() > 1 );
+// }
+
+void DataBrowser::clearHeaders()
+{
+ ::std::for_each( m_aSeriesHeaders.begin(), m_aSeriesHeaders.end(), impl::applyChangesFunctor());
+ m_aSeriesHeaders.clear();
+}
+
+void DataBrowser::RenewTable()
+{
+ if( ! m_apDataBrowserModel.get())
+ return;
+
+ long nOldRow = GetCurRow();
+ USHORT nOldColId = GetCurColumnId();
+
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ if( IsModified() )
+ SaveModified();
+
+ DeactivateCell();
+
+ RemoveColumns();
+ RowRemoved( 1, GetRowCount() );
+
+ // for row numbers
+ InsertHandleColumn( static_cast< sal_uInt16 >(
+ GetDataWindow().LogicToPixel( Size( 42, 0 )).getWidth() ));
+
+ const sal_Int32 nDefaultColumnWidth = 94;
+
+ sal_Int32 nColumnWidth( GetDataWindow().LogicToPixel( Size( nDefaultColumnWidth, 0 )).getWidth());
+ sal_Int32 nColumnCount = m_apDataBrowserModel->getColumnCount();
+ // nRowCount is a member of a base class
+ sal_Int32 nRowCountLocal = m_apDataBrowserModel->getMaxRowCount();
+ for( sal_Int32 nColIdx=1; nColIdx<=nColumnCount; ++nColIdx )
+ {
+ InsertDataColumn( static_cast< sal_uInt16 >( nColIdx ), GetColString( nColIdx ), nColumnWidth );
+ }
+
+ RowInserted( 1, nRowCountLocal );
+ GoToRow( ::std::min( nOldRow, GetRowCount() - 1 ));
+ GoToColumnId( ::std::min( nOldColId, static_cast< USHORT >( ColCount() - 1 )));
+
+ Window * pWin = this->GetParent();
+ if( !pWin )
+ pWin = this;
+
+ // fill series headers
+ clearHeaders();
+ const DataBrowserModel::tDataHeaderVector& aHeaders( m_apDataBrowserModel->getDataHeaders());
+ Link aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus ));
+ Link aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged ));
+ bool bIsHighContrast = pWin ? (pWin->GetSettings().GetStyleSettings().GetHighContrastMode()) : false;
+
+ for( DataBrowserModel::tDataHeaderVector::const_iterator aIt( aHeaders.begin());
+ aIt != aHeaders.end(); ++aIt )
+ {
+ ::boost::shared_ptr< impl::SeriesHeader > spHeader( new impl::SeriesHeader( pWin ));
+ Reference< beans::XPropertySet > xSeriesProp( aIt->m_xDataSeries, uno::UNO_QUERY );
+ sal_Int32 nColor = 0;
+ // @todo: Set "DraftColor", i.e. interpolated colors for gradients, bitmaps, etc.
+ if( xSeriesProp.is() &&
+ ( xSeriesProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Color"))) >>= nColor ))
+ spHeader->SetColor( Color( nColor ));
+ spHeader->SetChartType( aIt->m_xChartType, aIt->m_bSwapXAndYAxis, bIsHighContrast );
+ spHeader->SetSeriesName(
+ String( DataSeriesHelper::getDataSeriesLabel(
+ aIt->m_xDataSeries,
+ (aIt->m_xChartType.is() ?
+ aIt->m_xChartType->getRoleOfSequenceForSeriesLabel() :
+ OUString( RTL_CONSTASCII_USTRINGPARAM("values-y"))))));
+ // index is 1-based, as 0 is for the column that contains the row-numbers
+ spHeader->SetRange( aIt->m_nStartColumn + 1, aIt->m_nEndColumn + 1 );
+ spHeader->SetGetFocusHdl( aFocusLink );
+ spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink );
+ m_aSeriesHeaders.push_back( spHeader );
+ }
+
+ ImplAdjustHeaderControls();
+ SetDirty();
+ SetUpdateMode( bLastUpdateMode );
+ ActivateCell();
+ Invalidate();
+}
+
+String DataBrowser::GetColString( sal_Int32 nColumnId ) const
+{
+ OSL_ASSERT( m_apDataBrowserModel.get());
+ if( nColumnId > 0 )
+ return String( m_apDataBrowserModel->getRoleOfColumn( static_cast< sal_Int32 >( nColumnId ) - 1 ));
+ return String();
+}
+
+String DataBrowser::GetRowString( sal_Int32 nRow ) const
+{
+ return String::CreateFromInt32( nRow + 1 );
+}
+
+String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const
+{
+ String aResult;
+
+ if( nColumnId == 0 )
+ {
+ aResult = GetRowString( static_cast< sal_Int32 >( nRow ));
+ }
+ else if( nRow >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ sal_Int32 nColIndex = static_cast< sal_Int32 >( nColumnId ) - 1;
+
+ if( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::NUMBER )
+ {
+ double fData( m_apDataBrowserModel->getCellNumber( nColIndex, nRow ));
+ sal_Int32 nLabelColor;
+ bool bColorChanged = false;
+
+ if( ! ::rtl::math::isNan( fData ) &&
+ m_spNumberFormatterWrapper.get() )
+ aResult = String( m_spNumberFormatterWrapper->getFormattedString(
+ GetNumberFormatKey( nRow, nColumnId ),
+ fData, nLabelColor, bColorChanged ));
+ }
+ else
+ {
+ OSL_ASSERT( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::TEXT );
+ aResult = m_apDataBrowserModel->getCellText( nColIndex, nRow );
+ }
+ }
+
+ return aResult;
+}
+
+double DataBrowser::GetCellNumber( long nRow, USHORT nColumnId ) const
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ if(( nColumnId >= 1 ) && ( nRow >= 0 ) &&
+ m_apDataBrowserModel.get())
+ {
+ fResult = m_apDataBrowserModel->getCellNumber(
+ static_cast< sal_Int32 >( nColumnId ) - 1, nRow );
+ }
+
+ return fResult;
+}
+
+void DataBrowser::Resize()
+{
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ ::svt::EditBrowseBox::Resize();
+ ImplAdjustHeaderControls();
+ SetUpdateMode( bLastUpdateMode );
+}
+
+bool DataBrowser::SetReadOnly( bool bNewState )
+{
+ bool bResult = m_bIsReadOnly;
+
+ if( m_bIsReadOnly != bNewState )
+ {
+ m_bIsReadOnly = bNewState;
+ Invalidate();
+ DeactivateCell();
+ }
+
+ return bResult;
+}
+
+bool DataBrowser::IsReadOnly() const
+{
+ return m_bIsReadOnly;
+}
+
+
+void DataBrowser::SetClean()
+{
+ m_bIsDirty = false;
+}
+
+void DataBrowser::SetDirty()
+{
+ if( !m_bLiveUpdate )
+ m_bIsDirty = true;
+}
+
+void DataBrowser::CursorMoved()
+{
+ EditBrowseBox::CursorMoved();
+
+ if( GetUpdateMode() && m_aCursorMovedHdlLink.IsSet())
+ m_aCursorMovedHdlLink.Call( this );
+}
+
+void DataBrowser::SetCellModifiedHdl( const Link& rLink )
+{
+ m_aCellModifiedLink = rLink;
+}
+
+void DataBrowser::MouseButtonDown( const BrowserMouseEvent& rEvt )
+{
+ if( !m_bDataValid )
+ ShowWarningBox();
+ else
+ EditBrowseBox::MouseButtonDown( rEvt );
+}
+
+void DataBrowser::ShowWarningBox()
+{
+ WarningBox( this, WinBits( WB_OK ),
+ String( SchResId( STR_INVALID_NUMBER ))).Execute();
+}
+
+bool DataBrowser::ShowQueryBox()
+{
+ QueryBox* pQueryBox = new QueryBox( this, WB_YES_NO, String( SchResId( STR_DATA_EDITOR_INCORRECT_INPUT )));
+
+ return ( pQueryBox->Execute() == RET_YES );
+}
+
+bool DataBrowser::IsDataValid()
+{
+ bool bValid = true;
+ const sal_Int32 nRow = lcl_getRowInData( GetCurRow());
+ const sal_Int32 nCol = lcl_getColumnInData( GetCurColumnId());
+
+ if( m_apDataBrowserModel->getCellType( nCol, nRow ) == DataBrowserModel::NUMBER )
+ {
+ sal_uInt32 nDummy = 0;
+ double fDummy = 0.0;
+ String aText( m_aNumberEditField.GetText());
+
+ if( aText.Len() > 0 &&
+ m_spNumberFormatterWrapper.get() &&
+ m_spNumberFormatterWrapper->getSvNumberFormatter() &&
+ ! m_spNumberFormatterWrapper->getSvNumberFormatter()->IsNumberFormat(
+ aText, nDummy, fDummy ))
+ {
+ bValid = false;
+ }
+ }
+
+ return bValid;
+}
+
+bool DataBrowser::IsEnableItem()
+{
+ return m_bDataValid;
+}
+
+void DataBrowser::CellModified()
+{
+ m_bDataValid = IsDataValid();
+ SetDirty();
+ if( m_aCellModifiedLink.IsSet())
+ m_aCursorMovedHdlLink.Call( this );
+}
+
+void DataBrowser::SetDataFromModel(
+ const Reference< chart2::XChartDocument > & xChartDoc,
+ const Reference< uno::XComponentContext > & xContext )
+{
+ if( m_bLiveUpdate )
+ {
+ m_xChartDoc.set( xChartDoc );
+ }
+ else
+ {
+ Reference< util::XCloneable > xCloneable( xChartDoc, uno::UNO_QUERY );
+ if( xCloneable.is())
+ m_xChartDoc.set( xCloneable->createClone(), uno::UNO_QUERY );
+ }
+
+ m_apDataBrowserModel.reset( new DataBrowserModel( m_xChartDoc, xContext ));
+ m_spNumberFormatterWrapper.reset(
+ new NumberFormatterWrapper(
+ Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY )));
+
+ RenewTable();
+
+ const sal_Int32 nColCnt = m_apDataBrowserModel->getColumnCount();
+ const sal_Int32 nRowCnt = m_apDataBrowserModel->getMaxRowCount();
+ if( nRowCnt && nColCnt )
+ {
+ GoToRow( 0 );
+ GoToColumnId( 1 );
+ }
+ SetClean();
+}
+
+void DataBrowser::InsertColumn()
+{
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+
+ if( nColIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->insertDataSeries( nColIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::RemoveColumn()
+{
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+
+ if( nColIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_bDataValid = true;
+ m_apDataBrowserModel->removeDataSeries( nColIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::InsertRow()
+{
+ sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+
+ if( nRowIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->insertDataPointForAllSeries( nRowIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::RemoveRow()
+{
+ sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+
+ if( nRowIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_bDataValid = true;
+ m_apDataBrowserModel->removeDataPointForAllSeries( nRowIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::SwapColumn()
+{
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+
+ if( nColIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->swapDataSeries( nColIdx );
+
+ // keep cursor in swapped column
+ if( GetCurColumnId() < ColCount() - 1 )
+ {
+ Dispatch( BROWSER_CURSORRIGHT );
+ }
+ RenewTable();
+ }
+}
+
+void DataBrowser::SwapRow()
+{
+ sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+
+ if( nRowIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->swapDataPointForAllSeries( nRowIdx );
+
+ // keep cursor in swapped row
+ if( GetCurRow() < GetRowCount() - 1 )
+ {
+ Dispatch( BROWSER_CURSORDOWN );
+ }
+ RenewTable();
+ }
+}
+
+void DataBrowser::SetCursorMovedHdl( const Link& rLink )
+{
+ m_aCursorMovedHdlLink = rLink;
+}
+
+// implementations for ::svt::EditBrowseBox (pure virtual methods)
+void DataBrowser::PaintCell(
+ OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const
+{
+ Point aPos( rRect.TopLeft());
+ aPos.X() += 1;
+
+ String aText = GetCellText( m_nSeekRow, nColumnId );
+ Size TxtSize( GetDataWindow().GetTextWidth( aText ), GetDataWindow().GetTextHeight());
+
+ // clipping
+ if( aPos.X() < rRect.Right() || aPos.X() + TxtSize.Width() > rRect.Right() ||
+ aPos.Y() < rRect.Top() || aPos.Y() + TxtSize.Height() > rRect.Bottom())
+ rDev.SetClipRegion( rRect );
+
+ // allow for a disabled control ...
+ sal_Bool bEnabled = IsEnabled();
+ Color aOriginalColor = rDev.GetTextColor();
+ if( ! bEnabled )
+ rDev.SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() );
+
+ // TEST
+// if( nColumnId == 1 )
+// // categories
+// rDev.SetFillColor( Color( 0xff, 0xff, 0xff ));
+// else if( nColumnId == 2 )
+// // x-values
+// rDev.SetFillColor( Color( 0xf0, 0xf0, 0xff ));
+// else
+// // y-values
+// rDev.SetFillColor( Color( 0xff, 0xff, 0xf0 ));
+
+// rDev.DrawRect( rRect );
+
+ // draw the text
+ rDev.DrawText( aPos, aText );
+
+ // reset the color (if necessary)
+ if( ! bEnabled )
+ rDev.SetTextColor( aOriginalColor );
+
+ if( rDev.IsClipRegion())
+ rDev.SetClipRegion();
+}
+
+sal_Bool DataBrowser::SeekRow( long nRow )
+{
+ if( ! EditBrowseBox::SeekRow( nRow ))
+ return sal_False;
+
+ if( nRow < 0 )
+ m_nSeekRow = - 1;
+ else
+ m_nSeekRow = nRow;
+
+ return sal_True;
+}
+
+sal_Bool DataBrowser::IsTabAllowed( sal_Bool bForward ) const
+{
+ long nRow = GetCurRow();
+ long nCol = GetCurColumnId();
+
+ // column 0 is header-column
+ long nBadCol = bForward
+ ? GetColumnCount() - 1
+ : 1;
+ long nBadRow = bForward
+ ? GetRowCount() - 1
+ : 0;
+
+ if( !m_bDataValid )
+ {
+ const_cast< DataBrowser* >( this )->ShowWarningBox();
+ return sal_False;
+ }
+
+ return ( nRow != nBadRow ||
+ nCol != nBadCol );
+}
+
+::svt::CellController* DataBrowser::GetController( long nRow, sal_uInt16 nCol )
+{
+ if( m_bIsReadOnly )
+ return 0;
+
+ if( CellContainsNumbers( nRow, nCol ))
+ {
+ m_aNumberEditField.UseInputStringForFormatting();
+ m_aNumberEditField.SetFormatKey( GetNumberFormatKey( nRow, nCol ));
+ return m_rNumberEditController;
+ }
+
+ return m_rTextEditController;
+}
+
+void DataBrowser::InitController(
+ ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol )
+{
+ if( rController == m_rTextEditController )
+ {
+ String aText( GetCellText( nRow, nCol ) );
+ m_aTextEditField.SetText( aText );
+ m_aTextEditField.SetSelection( Selection( 0, aText.Len() ));
+ }
+ else if( rController == m_rNumberEditController )
+ {
+ // treat invalid and empty text as Nan
+ m_aNumberEditField.EnableNotANumber( true );
+ if( ::rtl::math::isNan( GetCellNumber( nRow, nCol )))
+ m_aNumberEditField.SetTextValue( String());
+ else
+ m_aNumberEditField.SetValue( GetCellNumber( nRow, nCol ) );
+ String aText( m_aNumberEditField.GetText());
+ m_aNumberEditField.SetSelection( Selection( 0, aText.Len()));
+ }
+ else
+ {
+ DBG_ERROR( "Invalid Controller" );
+ }
+}
+
+bool DataBrowser::CellContainsNumbers( sal_Int32 nRow, sal_uInt16 nCol ) const
+{
+ if( ! m_apDataBrowserModel.get())
+ return false;
+ return (m_apDataBrowserModel->getCellType( lcl_getColumnInData( nCol ), lcl_getRowInData( nRow )) ==
+ DataBrowserModel::NUMBER);
+}
+
+sal_uInt32 DataBrowser::GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) const
+{
+ if( ! m_apDataBrowserModel.get())
+ return 0;
+ return m_apDataBrowserModel->getNumberFormatKey( lcl_getColumnInData( nCol ), lcl_getRowInData( nRow ));
+}
+
+sal_Bool DataBrowser::SaveModified()
+{
+ if( ! IsModified() )
+ return sal_True;
+
+ sal_Bool bChangeValid = sal_True;
+
+ const sal_Int32 nRow = lcl_getRowInData( GetCurRow());
+ const sal_Int32 nCol = lcl_getColumnInData( GetCurColumnId());
+
+ DBG_ASSERT( nRow >= 0 || nCol >= 0, "This cell should not be modified!" );
+
+ switch( m_apDataBrowserModel->getCellType( nCol, nRow ))
+ {
+ case DataBrowserModel::NUMBER:
+ {
+ sal_uInt32 nDummy = 0;
+ double fDummy = 0.0;
+ String aText( m_aNumberEditField.GetText());
+ // an empty string is valid, if no numberformatter exists, all
+ // values are treated as valid
+ if( aText.Len() > 0 &&
+ m_spNumberFormatterWrapper.get() &&
+ m_spNumberFormatterWrapper->getSvNumberFormatter() &&
+ ! m_spNumberFormatterWrapper->getSvNumberFormatter()->IsNumberFormat(
+ aText, nDummy, fDummy ))
+ {
+ bChangeValid = sal_False;
+ }
+ else
+ {
+ double fData = m_aNumberEditField.GetValue();
+ bChangeValid = m_apDataBrowserModel->setCellNumber( nCol, nRow, fData );
+ }
+ }
+ break;
+ case DataBrowserModel::TEXT:
+ {
+ OUString aText( m_aTextEditField.GetText());
+ bChangeValid = m_apDataBrowserModel->setCellText( nCol, nRow, aText );
+ }
+ break;
+ }
+
+ // the first valid change changes this to true
+ if( bChangeValid )
+ {
+ RowModified( GetCurRow(), GetCurColumnId());
+ ::svt::CellController* pCtrl = GetController( GetCurRow(), GetCurColumnId());
+ if( pCtrl )
+ pCtrl->ClearModified();
+ SetDirty();
+ }
+
+ return bChangeValid;
+}
+
+bool DataBrowser::EndEditing()
+{
+ if( IsModified())
+ SaveModified();
+
+ // apply changes made to series headers
+ ::std::for_each( m_aSeriesHeaders.begin(), m_aSeriesHeaders.end(), impl::applyChangesFunctor());
+
+ if( m_bDataValid )
+ return true;
+ else
+ return ShowQueryBox();
+}
+
+sal_Int16 DataBrowser::GetFirstVisibleColumNumber() const
+{
+ return GetFirstVisibleColNumber();
+}
+
+void DataBrowser::ColumnResized( USHORT nColId )
+{
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ EditBrowseBox::ColumnResized( nColId );
+ ImplAdjustHeaderControls();
+ SetUpdateMode( bLastUpdateMode );
+}
+
+// virtual void MouseMove( const MouseEvent& rEvt );
+
+void DataBrowser::EndScroll()
+{
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ EditBrowseBox::EndScroll();
+ RenewSeriesHeaders();
+
+ SetUpdateMode( bLastUpdateMode );
+}
+
+void DataBrowser::RenewSeriesHeaders()
+{
+ Window * pWin = this->GetParent();
+ if( !pWin )
+ pWin = this;
+
+ clearHeaders();
+ DataBrowserModel::tDataHeaderVector aHeaders( m_apDataBrowserModel->getDataHeaders());
+ Link aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus ));
+ Link aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged ));
+ bool bIsHighContrast = pWin ? (pWin->GetSettings().GetStyleSettings().GetHighContrastMode()) : false;
+
+ for( DataBrowserModel::tDataHeaderVector::const_iterator aIt( aHeaders.begin());
+ aIt != aHeaders.end(); ++aIt )
+ {
+ ::boost::shared_ptr< impl::SeriesHeader > spHeader( new impl::SeriesHeader( pWin ));
+ Reference< beans::XPropertySet > xSeriesProp( aIt->m_xDataSeries, uno::UNO_QUERY );
+ sal_Int32 nColor = 0;
+ if( xSeriesProp.is() &&
+ ( xSeriesProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Color"))) >>= nColor ))
+ spHeader->SetColor( Color( nColor ));
+ spHeader->SetChartType( aIt->m_xChartType, aIt->m_bSwapXAndYAxis, bIsHighContrast );
+ spHeader->SetSeriesName(
+ String( DataSeriesHelper::getDataSeriesLabel(
+ aIt->m_xDataSeries,
+ (aIt->m_xChartType.is() ?
+ aIt->m_xChartType->getRoleOfSequenceForSeriesLabel() :
+ OUString( RTL_CONSTASCII_USTRINGPARAM("values-y"))))));
+ spHeader->SetRange( aIt->m_nStartColumn + 1, aIt->m_nEndColumn + 1 );
+ spHeader->SetGetFocusHdl( aFocusLink );
+ spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink );
+ m_aSeriesHeaders.push_back( spHeader );
+ }
+
+ ImplAdjustHeaderControls();
+}
+
+void DataBrowser::ImplAdjustHeaderControls()
+{
+ sal_uInt16 nColCount = this->GetColumnCount();
+ sal_uInt32 nCurrentPos = this->GetPosPixel().getX();
+ sal_uInt32 nMaxPos = nCurrentPos + this->GetOutputSizePixel().getWidth();
+ sal_uInt32 nStartPos = nCurrentPos;
+
+ // width of header column
+ nCurrentPos += this->GetColumnWidth( 0 );
+ tSeriesHeaderContainer::iterator aIt( m_aSeriesHeaders.begin());
+ sal_uInt16 i = this->GetFirstVisibleColumNumber();
+ while( (aIt != m_aSeriesHeaders.end()) && ((*aIt)->GetStartColumn() < i) )
+ ++aIt;
+ for( ; i < nColCount && aIt != m_aSeriesHeaders.end(); ++i )
+ {
+ if( (*aIt)->GetStartColumn() == i )
+ nStartPos = nCurrentPos;
+
+ nCurrentPos += (this->GetColumnWidth( i ));
+
+ if( (*aIt)->GetEndColumn() == i )
+ {
+ if( nStartPos < nMaxPos )
+ {
+ (*aIt)->SetPixelPosX( nStartPos + 2 );
+ (*aIt)->SetPixelWidth( nCurrentPos - nStartPos - 3 );
+ }
+ else
+ // do not hide, to get focus events. Move outside the dialog for "hiding"
+ (*aIt)->SetPixelPosX( nMaxPos + 42 );
+ ++aIt;
+ }
+ }
+}
+
+IMPL_LINK( DataBrowser, SeriesHeaderGotFocus, impl::SeriesHeaderEdit*, pEdit )
+{
+ if( pEdit )
+ {
+ pEdit->SetShowWarningBox( !m_bDataValid );
+
+ if( !m_bDataValid )
+ GoToCell( 0, 0 );
+ else
+ {
+ //DeactivateCell();
+ MakeFieldVisible( GetCurRow(), static_cast< sal_uInt16 >( pEdit->getStartColumn()), true /* bComplete */ );
+ ActivateCell();
+ m_aCursorMovedHdlLink.Call( this );
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( DataBrowser, SeriesHeaderChanged, impl::SeriesHeaderEdit*, pEdit )
+{
+ if( pEdit )
+ {
+ Reference< chart2::XDataSeries > xSeries(
+ m_apDataBrowserModel->getDataSeriesByColumn( pEdit->getStartColumn() - 1 ));
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Reference< chart2::XChartType > xChartType(
+ m_apDataBrowserModel->getHeaderForSeries( xSeries ).m_xChartType );
+ if( xChartType.is())
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ DataSeriesHelper::getDataSequenceByRole( xSource, xChartType->getRoleOfSequenceForSeriesLabel()));
+ if( xLabeledSeq.is())
+ {
+ Reference< container::XIndexReplace > xIndexReplace( xLabeledSeq->getLabel(), uno::UNO_QUERY );
+ if( xIndexReplace.is())
+ xIndexReplace->replaceByIndex(
+ 0, uno::makeAny( OUString( pEdit->GetText())));
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+sal_Int32 DataBrowser::GetTotalWidth() const
+{
+ ULONG nWidth = 0;
+ for ( USHORT nCol = 0; nCol < ColCount(); ++nCol )
+ nWidth += GetColumnWidth( nCol );
+ return static_cast< sal_Int32 >( nWidth );
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx
new file mode 100644
index 000000000000..a4147af84fcb
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowser.hxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataBrowser.hxx,v $
+ * $Revision: 1.6.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART_DATA_BROWSER_HXX
+#define CHART_DATA_BROWSER_HXX
+
+#include <svtools/editbrowsebox.hxx>
+#include <vcl/outdev.hxx>
+#include <svtools/fmtfield.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vector>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 {
+ class XChartDocument;
+ }
+}}}
+
+namespace chart
+{
+
+class DataBrowserModel;
+class NumberFormatterWrapper;
+
+namespace impl
+{
+class SeriesHeader;
+class SeriesHeaderEdit;
+}
+
+class DataBrowser : public ::svt::EditBrowseBox
+{
+protected:
+ // EditBrowseBox overridables
+ virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const;
+ virtual sal_Bool SeekRow( long nRow );
+ virtual sal_Bool IsTabAllowed( sal_Bool bForward ) const;
+ virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol );
+ virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol );
+ virtual sal_Bool SaveModified();
+ virtual void CursorMoved();
+ // called whenever the control of the current cell has been modified
+ virtual void CellModified();
+ virtual void ColumnResized( USHORT nColId );
+ virtual void EndScroll();
+ virtual void MouseButtonDown( const BrowserMouseEvent& rEvt );
+
+ void SetDirty();
+
+public:
+ DataBrowser( Window* pParent, const ResId & rId, bool bLiveUpdate );
+ virtual ~DataBrowser();
+
+ /** GetCellText returns the text at the given position
+ @param nRow
+ the number of the row
+ @param nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual String GetCellText(long nRow, USHORT nColId) const;
+
+ /** returns the number in the given cell. If a cell is empty or contains a
+ string, the result will be Nan
+ */
+ double GetCellNumber( long nRow, USHORT nColumnId ) const;
+
+ // Window
+ virtual void Resize();
+
+ /// @return old state
+ bool SetReadOnly( bool bNewState );
+ bool IsReadOnly() const;
+
+ /// reset the dirty status, if changes have been saved
+ void SetClean();
+
+ void SetDataFromModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
+// void setNumberFormatter();
+
+ // predicates to determine what actions are possible at the current cursor
+ // position. This depends on the implementation of the according mutators
+ // below. (They are used for enabling toolbar icons)
+ bool MayInsertRow() const;
+ bool MayInsertColumn() const;
+ bool MayDeleteRow() const;
+ bool MayDeleteColumn() const;
+
+ bool MaySwapRows() const;
+ bool MaySwapColumns() const;
+
+// bool MaySortRow() const;
+// bool MaySortColumn() const;
+
+ // mutators mutating data
+ void InsertRow();
+ void InsertColumn();
+ void RemoveRow();
+ void RemoveColumn();
+
+ using BrowseBox::RemoveColumn;
+ using BrowseBox::MouseButtonDown;
+
+ void SwapRow();
+ void SwapColumn();
+
+ void SetCursorMovedHdl( const Link& rLink );
+
+ void SetCellModifiedHdl( const Link& rLink );
+
+ /// confirms all pending changes to be ready to be closed
+ bool EndEditing();
+
+ // calls the protected inline-function BrowseBox::GetFirstVisibleColNumber()
+ sal_Int16 GetFirstVisibleColumNumber() const;
+
+ sal_Int32 GetTotalWidth() const;
+
+ bool CellContainsNumbers( sal_Int32 nRow, sal_uInt16 nCol ) const;
+
+ sal_uInt32 GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) const;
+
+ bool IsEnableItem();
+ bool IsDataValid();
+ void ShowWarningBox();
+ bool ShowQueryBox();
+
+ void RenewSeriesHeaders();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
+ ::std::auto_ptr< DataBrowserModel > m_apDataBrowserModel;
+
+ typedef ::std::vector< ::boost::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer;
+ tSeriesHeaderContainer m_aSeriesHeaders;
+
+ ::boost::shared_ptr< NumberFormatterWrapper > m_spNumberFormatterWrapper;
+
+ /// the row that is currently painted
+ long m_nSeekRow;
+ bool m_bIsReadOnly;
+ bool m_bIsDirty;
+ bool m_bLiveUpdate;
+ bool m_bDataValid;
+
+ FormattedField m_aNumberEditField;
+ Edit m_aTextEditField;
+
+ /// note: m_aNumberEditField must precede this member!
+ ::svt::CellControllerRef m_rNumberEditController;
+ /// note: m_aTextEditField must precede this member!
+ ::svt::CellControllerRef m_rTextEditController;
+
+ Link m_aCursorMovedHdlLink;
+ Link m_aCellModifiedLink;
+
+ void clearHeaders();
+ void RenewTable();
+ void ImplAdjustHeaderControls();
+
+ String GetColString( sal_Int32 nColumnId ) const;
+ String GetRowString( sal_Int32 nRow ) const;
+
+ DECL_LINK( SeriesHeaderGotFocus, impl::SeriesHeaderEdit* );
+ DECL_LINK( SeriesHeaderChanged, impl::SeriesHeaderEdit* );
+
+ /// not implemented: inhibit copy construction
+ DataBrowser( const DataBrowser & );
+};
+
+} // namespace chart
+
+#endif // CHART_DATA_BROWSER_HXX
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
new file mode 100644
index 000000000000..1db67c6721af
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -0,0 +1,926 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataBrowserModel.cxx,v $
+ * $Revision: 1.6.16.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DataBrowserModel.hxx"
+#include "DialogModel.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "PropertyHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "macros.hxx"
+#include "StatisticsHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+
+#include <rtl/math.hxx>
+
+#include <algorithm>
+
+#if OSL_DEBUG_LEVEL > 1
+#include <cstdio>
+#endif
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+OUString lcl_getRole(
+ const Reference< chart2::data::XDataSequence > & xSeq )
+{
+ OUString aResult;
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U("Role")) >>= aResult;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ return aResult;
+}
+
+
+OUString lcl_getRole(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+{
+ OUString aResult;
+ if( xLSeq.is())
+ aResult = lcl_getRole( xLSeq->getValues());
+ return aResult;
+}
+
+OUString lcl_getUIRoleName(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+{
+ OUString aResult( lcl_getRole( xLSeq ));
+ if( aResult.getLength())
+ aResult = ::chart::DialogModel::ConvertRoleFromInternalToUI( aResult );
+ return aResult;
+}
+
+void lcl_copyDataSequenceProperties(
+ const Reference< chart2::data::XDataSequence > & xOldSequence,
+ const Reference< chart2::data::XDataSequence > & xNewSequence )
+{
+ Reference< beans::XPropertySet > xOldSeqProp( xOldSequence, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xNewSeqProp( xNewSequence, uno::UNO_QUERY );
+ comphelper::copyProperties( xOldSeqProp, xNewSeqProp );
+}
+
+bool lcl_SequenceOfSeriesIsShared(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::data::XDataSequence > & xValues )
+{
+ bool bResult = false;
+ if( !xValues.is())
+ return bResult;
+ try
+ {
+ OUString aValuesRole( lcl_getRole( xValues ));
+ OUString aValuesRep( xValues->getSourceRangeRepresentation());
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences());
+ for( sal_Int32 i=0; i<aLSeq.getLength(); ++i )
+ if( aLSeq[i].is() &&
+ lcl_getRole( aLSeq[i] ).equals( aValuesRole ))
+ {
+ // getValues().is(), because lcl_getRole checked that already
+ bResult = (aValuesRep == aLSeq[i]->getValues()->getSourceRangeRepresentation());
+ // assumption: a role appears only once in a series
+ break;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return bResult;
+}
+
+typedef ::std::vector< Reference< chart2::data::XLabeledDataSequence > > lcl_tSharedSeqVec;
+
+lcl_tSharedSeqVec lcl_getSharedSequences( const Sequence< Reference< chart2::XDataSeries > > & rSeries )
+{
+ // @todo: if only some series share a sequence, those have to be duplicated
+ // and made unshared for all series
+ lcl_tSharedSeqVec aResult;
+ // if we have only one series, we don't want any shared sequences
+ if( rSeries.getLength() <= 1 )
+ return aResult;
+
+ Reference< chart2::data::XDataSource > xSource( rSeries[0], uno::UNO_QUERY );
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences());
+ for( sal_Int32 nIdx=0; nIdx<aLSeq.getLength(); ++nIdx )
+ {
+ Reference< chart2::data::XDataSequence > xValues( aLSeq[nIdx]->getValues());
+ bool bShared = true;
+ for( sal_Int32 nSeriesIdx=1; nSeriesIdx<rSeries.getLength(); ++nSeriesIdx )
+ {
+ bShared = lcl_SequenceOfSeriesIsShared( rSeries[nSeriesIdx], xValues );
+ if( !bShared )
+ break;
+ }
+ if( bShared )
+ aResult.push_back( aLSeq[nIdx] );
+ }
+
+ return aResult;
+}
+
+sal_Int32 lcl_getValuesRepresentationIndex(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+{
+ sal_Int32 nResult = -1;
+ if( xLSeq.is())
+ {
+ Reference< chart2::data::XDataSequence > xSeq( xLSeq->getValues());
+ if( xSeq.is())
+ {
+ OUString aRep( xSeq->getSourceRangeRepresentation());
+ nResult = aRep.toInt32();
+ }
+ }
+ return nResult;
+}
+
+struct lcl_RepresentationsOfLSeqMatch : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
+{
+ lcl_RepresentationsOfLSeqMatch( const Reference< chart2::data::XLabeledDataSequence > & xLSeq ) :
+ m_aValuesRep( xLSeq.is() ?
+ (xLSeq->getValues().is() ? xLSeq->getValues()->getSourceRangeRepresentation() : OUString())
+ : OUString() )
+ {}
+ bool operator() ( const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+ {
+ return (xLSeq.is() &&
+ xLSeq->getValues().is() &&
+ (xLSeq->getValues()->getSourceRangeRepresentation() == m_aValuesRep ));
+ }
+private:
+ OUString m_aValuesRep;
+};
+
+struct lcl_RolesOfLSeqMatch : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
+{
+ lcl_RolesOfLSeqMatch( const Reference< chart2::data::XLabeledDataSequence > & xLSeq ) :
+ m_aRole( lcl_getRole( xLSeq ))
+ {}
+ bool operator() ( const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+ {
+ return lcl_getRole( xLSeq ).equals( m_aRole );
+ }
+private:
+ OUString m_aRole;
+};
+
+bool lcl_ShowCategories( const Reference< chart2::XDiagram > & /* xDiagram */ )
+{
+ // show categories for all charts
+ return true;
+// return DiagramHelper::isCategoryDiagram( xDiagram );
+}
+
+bool lcl_ShowCategoriesAsDataLabel( const Reference< chart2::XDiagram > & xDiagram )
+{
+ return ! ::chart::DiagramHelper::isCategoryDiagram( xDiagram );
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+
+struct DataBrowserModel::tDataColumn
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
+ sal_Int32 m_nIndexInDataSeries;
+ ::rtl::OUString m_aUIRoleName;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > m_xLabeledDataSequence;
+ eCellType m_eCellType;
+ sal_Int32 m_nNumberFormatKey;
+
+ // default CTOR
+ tDataColumn() : m_nIndexInDataSeries( -1 ), m_eCellType( TEXT ), m_nNumberFormatKey( 0 ) {}
+ // "full" CTOR
+ tDataColumn(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ sal_Int32 nIndexInDataSeries,
+ ::rtl::OUString aUIRoleName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > xLabeledDataSequence,
+ eCellType aCellType,
+ sal_Int32 nNumberFormatKey ) :
+ m_xDataSeries( xDataSeries ),
+ m_nIndexInDataSeries( nIndexInDataSeries ),
+ m_aUIRoleName( aUIRoleName ),
+ m_xLabeledDataSequence( xLabeledDataSequence ),
+ m_eCellType( aCellType ),
+ m_nNumberFormatKey( nNumberFormatKey )
+ {}
+};
+
+struct DataBrowserModel::implColumnLess : public ::std::binary_function<
+ DataBrowserModel::tDataColumn, DataBrowserModel::tDataColumn, bool >
+{
+ bool operator() ( const first_argument_type & rLeft, const second_argument_type & rRight )
+ {
+ if( rLeft.m_xLabeledDataSequence.is() && rRight.m_xLabeledDataSequence.is())
+ {
+ return DialogModel::GetRoleIndexForSorting( lcl_getRole( rLeft.m_xLabeledDataSequence )) <
+ DialogModel::GetRoleIndexForSorting( lcl_getRole( rRight.m_xLabeledDataSequence ));
+ }
+ return true;
+ }
+};
+
+DataBrowserModel::DataBrowserModel(
+ const Reference< chart2::XChartDocument > & xChartDoc,
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xChartDocument( xChartDoc ),
+ m_xContext( xContext ),
+ m_apDialogModel( new DialogModel( xChartDoc, xContext ))
+{
+ updateFromModel();
+}
+
+DataBrowserModel::~DataBrowserModel()
+{}
+
+namespace
+{
+struct lcl_DataSeriesOfHeaderMatches : public ::std::unary_function< ::chart::DataBrowserModel::tDataHeader, bool >
+{
+ lcl_DataSeriesOfHeaderMatches(
+ const Reference< chart2::XDataSeries > & xSeriesToCompareWith ) :
+ m_xSeries( xSeriesToCompareWith )
+ {}
+ bool operator() ( const ::chart::DataBrowserModel::tDataHeader & rHeader )
+ {
+ return (m_xSeries == rHeader.m_xDataSeries);
+ }
+private:
+ Reference< chart2::XDataSeries > m_xSeries;
+};
+}
+
+void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ if( xDataProvider.is())
+ {
+ sal_Int32 nStartCol = 0;
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDocument ));
+ Reference< chart2::XChartType > xChartType;
+ Reference< chart2::XDataSeries > xSeries;
+ if( static_cast< tDataColumnVector::size_type >( nAfterColumnIndex ) <= m_aColumns.size())
+ xSeries.set( m_aColumns[nAfterColumnIndex].m_xDataSeries );
+
+ sal_Int32 nSeriesNumberFormat = 0;
+ if( xSeries.is())
+ {
+ xChartType.set( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ));
+ tDataHeaderVector::const_iterator aIt(
+ ::std::find_if( m_aHeaders.begin(), m_aHeaders.end(),
+ lcl_DataSeriesOfHeaderMatches( xSeries )));
+ if( aIt != m_aHeaders.end())
+ nStartCol = aIt->m_nEndColumn;
+
+ Reference< beans::XPropertySet > xSeriesProps( xSeries, uno::UNO_QUERY );
+ if( xSeriesProps.is() )
+ xSeriesProps->getPropertyValue( C2U( "NumberFormat" )) >>= nSeriesNumberFormat;
+ }
+ else
+ {
+ xChartType.set( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ));
+ nStartCol = nAfterColumnIndex;
+ }
+
+ if( xChartType.is())
+ {
+ sal_Int32 nOffset = 0;
+ if( xDiagram.is() && lcl_ShowCategories( xDiagram ))
+ ++nOffset;
+ // get shared sequences of current series
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY );
+ lcl_tSharedSeqVec aSharedSequences;
+ if( xSeriesCnt.is())
+ aSharedSequences = lcl_getSharedSequences( xSeriesCnt->getDataSeries());
+ Reference< chart2::XDataSeries > xNewSeries(
+ m_apDialogModel->insertSeriesAfter( xSeries, xChartType, true /* bCreateDataCachedSequences */ ));
+ if( xNewSeries.is())
+ {
+ {
+ Reference< chart2::data::XDataSource > xSource( xNewSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSequences(
+ xSource->getDataSequences());
+ sal_Int32 nSeqIdx = 0;
+ sal_Int32 nSeqSize = aLSequences.getLength();
+ nStartCol -= (nOffset - 1);
+ for( sal_Int32 nIndex = nStartCol;
+ (nSeqIdx < nSeqSize);
+ ++nSeqIdx )
+ {
+ lcl_tSharedSeqVec::const_iterator aSharedIt(
+ ::std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
+ lcl_RolesOfLSeqMatch( aLSequences[nSeqIdx] )));
+ if( aSharedIt != aSharedSequences.end())
+ {
+ aLSequences[nSeqIdx]->setValues( (*aSharedIt)->getValues());
+ aLSequences[nSeqIdx]->setLabel( (*aSharedIt)->getLabel());
+ }
+ else
+ {
+ xDataProvider->insertSequence( nIndex - 1 );
+
+ // values
+ Reference< chart2::data::XDataSequence > xNewSeq(
+ xDataProvider->createDataSequenceByRangeRepresentation(
+ OUString::valueOf( nIndex )));
+ lcl_copyDataSequenceProperties(
+ aLSequences[nSeqIdx]->getValues(), xNewSeq );
+ aLSequences[nSeqIdx]->setValues( xNewSeq );
+
+ // labels
+ Reference< chart2::data::XDataSequence > xNewLabelSeq(
+ xDataProvider->createDataSequenceByRangeRepresentation(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "label " )) +
+ OUString::valueOf( nIndex )));
+ lcl_copyDataSequenceProperties(
+ aLSequences[nSeqIdx]->getLabel(), xNewLabelSeq );
+ aLSequences[nSeqIdx]->setLabel( xNewLabelSeq );
+ ++nIndex;
+ }
+ }
+ }
+ }
+ if( nSeriesNumberFormat != 0 )
+ {
+ //give the new series the same number format as the former series especially for bubble charts thus the bubble size values can be edited with same format immidiately
+ Reference< beans::XPropertySet > xNewSeriesProps( xNewSeries, uno::UNO_QUERY );
+ if( xNewSeriesProps.is() )
+ xNewSeriesProps->setPropertyValue( C2U( "NumberFormat" ), uno::makeAny( nSeriesNumberFormat ) );
+ }
+
+ updateFromModel();
+ }
+ }
+ }
+}
+
+void DataBrowserModel::removeDataSeries( sal_Int32 nAtColumnIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ if( static_cast< tDataColumnVector::size_type >( nAtColumnIndex ) < m_aColumns.size())
+ {
+ Reference< chart2::XDataSeries > xSeries( m_aColumns[nAtColumnIndex].m_xDataSeries );
+ if( xSeries.is())
+ {
+ m_apDialogModel->deleteSeries(
+ xSeries, getHeaderForSeries( xSeries ).m_xChartType );
+
+ //delete sequences from internal data provider that are not used anymore
+ //but do not delete sequences that are still in use by the remaining series
+ Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ Reference< chart2::data::XDataSource > xSourceOfDeletedSeries( xSeries, uno::UNO_QUERY );
+ if( xDataProvider.is() && xSourceOfDeletedSeries.is())
+ {
+ ::std::vector< sal_Int32 > aSequenceIndexesToDelete;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequencesOfDeletedSeries( xSourceOfDeletedSeries->getDataSequences() );
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( getHeaderForSeries( xSeries ).m_xChartType, uno::UNO_QUERY );
+ if( xSeriesCnt.is())
+ {
+ Reference< chart2::data::XDataSource > xRemainingDataSource( DataSeriesHelper::getDataSource( xSeriesCnt->getDataSeries() ) );
+ if( xRemainingDataSource.is() )
+ {
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aRemainingSeq( ContainerHelper::SequenceToVector( xRemainingDataSource->getDataSequences() ) );
+ for( sal_Int32 i=0; i<aSequencesOfDeletedSeries.getLength(); ++i )
+ {
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aHitIt(
+ ::std::find_if( aRemainingSeq.begin(), aRemainingSeq.end(),
+ lcl_RepresentationsOfLSeqMatch( aSequencesOfDeletedSeries[i] )));
+ // if not used by the remaining series this sequence can be deleted
+ if( aHitIt == aRemainingSeq.end() )
+ aSequenceIndexesToDelete.push_back( lcl_getValuesRepresentationIndex( aSequencesOfDeletedSeries[i] ) );
+ }
+ }
+ }
+
+ // delete unnecessary sequences of the internal data
+ // iterate using greatest index first, so that deletion does not
+ // shift other sequences that will be deleted later
+ ::std::sort( aSequenceIndexesToDelete.begin(), aSequenceIndexesToDelete.end());
+ for( ::std::vector< sal_Int32 >::reverse_iterator aIt(
+ aSequenceIndexesToDelete.rbegin()); aIt != aSequenceIndexesToDelete.rend(); ++aIt )
+ {
+ if( *aIt != -1 )
+ xDataProvider->deleteSequence( *aIt );
+ }
+ }
+ updateFromModel();
+ }
+ }
+}
+
+void DataBrowserModel::swapDataSeries( sal_Int32 nFirstColumnIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ if( static_cast< tDataColumnVector::size_type >( nFirstColumnIndex ) < m_aColumns.size() - 1 )
+ {
+ Reference< chart2::XDataSeries > xSeries( m_aColumns[nFirstColumnIndex].m_xDataSeries );
+ if( xSeries.is())
+ {
+ m_apDialogModel->moveSeries( xSeries, DialogModel::MOVE_DOWN );
+ updateFromModel();
+ }
+ }
+}
+
+void DataBrowserModel::swapDataPointForAllSeries( sal_Int32 nFirstIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ // lockControllers
+ ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ if( xDataProvider.is())
+ xDataProvider->swapDataPointWithNextOneForAllSequences( nFirstIndex );
+ // unlockControllers
+}
+
+void DataBrowserModel::insertDataPointForAllSeries( sal_Int32 nAfterIndex )
+{
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ // lockControllers
+ ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ if( xDataProvider.is())
+ xDataProvider->insertDataPointForAllSequences( nAfterIndex );
+ // unlockControllers
+}
+
+void DataBrowserModel::removeDataPointForAllSeries( sal_Int32 nAtIndex )
+{
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ // lockControllers
+ ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ if( xDataProvider.is())
+ xDataProvider->deleteDataPointForAllSequences( nAtIndex );
+ // unlockControllers
+}
+
+DataBrowserModel::tDataHeader DataBrowserModel::getHeaderForSeries(
+ const Reference< chart2::XDataSeries > & xSeries ) const
+{
+ for( tDataHeaderVector::const_iterator aIt( m_aHeaders.begin());
+ aIt != m_aHeaders.end(); ++aIt )
+ {
+ if( aIt->m_xDataSeries == xSeries )
+ return (*aIt);
+ }
+ return tDataHeader();
+}
+
+Reference< chart2::XDataSeries >
+ DataBrowserModel::getDataSeriesByColumn( sal_Int32 nColumn ) const
+{
+ tDataColumnVector::size_type nIndex( nColumn );
+ if( nIndex < m_aColumns.size())
+ return m_aColumns[nIndex].m_xDataSeries;
+ return 0;
+}
+
+DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ )
+{
+ eCellType eResult = TEXT;
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size())
+ eResult = m_aColumns[nIndex].m_eCellType;
+ return eResult;
+}
+
+double DataBrowserModel::getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow )
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size() &&
+ m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
+ {
+ Reference< chart2::data::XNumericalDataSequence > xData(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues(), uno::UNO_QUERY );
+ if( xData.is())
+ {
+ Sequence< double > aValues( xData->getNumericalData());
+ if( nAtRow < aValues.getLength())
+ fResult = aValues[nAtRow];
+ }
+ }
+ return fResult;
+}
+
+OUString DataBrowserModel::getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow )
+{
+ OUString aResult;
+
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size() &&
+ m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
+ {
+ Reference< chart2::data::XTextualDataSequence > xData(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues(), uno::UNO_QUERY );
+ if( xData.is())
+ {
+ Sequence< OUString > aValues( xData->getTextualData());
+ if( nAtRow < aValues.getLength())
+ aResult = aValues[nAtRow];
+ }
+ }
+ return aResult;
+}
+
+sal_uInt32 DataBrowserModel::getNumberFormatKey( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ )
+{
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size())
+ return m_aColumns[ nIndex ].m_nNumberFormatKey;
+ return 0;
+}
+
+bool DataBrowserModel::setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const uno::Any & rValue )
+{
+ bool bResult = false;
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size() &&
+ m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
+ {
+ bResult = true;
+ try
+ {
+ // label
+ if( nAtRow == -1 )
+ {
+ Reference< container::XIndexReplace > xIndexReplace(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getLabel(), uno::UNO_QUERY_THROW );
+ xIndexReplace->replaceByIndex( 0, rValue );
+ }
+ else
+ {
+ Reference< container::XIndexReplace > xIndexReplace(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues(), uno::UNO_QUERY_THROW );
+ xIndexReplace->replaceByIndex( nAtRow, rValue );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex);
+ bResult = false;
+ }
+ }
+ return bResult;
+}
+
+bool DataBrowserModel::setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue )
+{
+ return (getCellType( nAtColumn, nAtRow ) == NUMBER) &&
+ setCellAny( nAtColumn, nAtRow, uno::makeAny( fValue ));
+}
+
+bool DataBrowserModel::setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::rtl::OUString & rText )
+{
+ return (getCellType( nAtColumn, nAtRow ) == TEXT) &&
+ setCellAny( nAtColumn, nAtRow, uno::makeAny( rText ));
+}
+
+sal_Int32 DataBrowserModel::getColumnCount() const
+{
+ return static_cast< sal_Int32 >( m_aColumns.size());
+}
+
+sal_Int32 DataBrowserModel::getMaxRowCount() const
+{
+ sal_Int32 nResult = 0;
+ tDataColumnVector::const_iterator aIt( m_aColumns.begin());
+ for( ; aIt != m_aColumns.end(); ++aIt )
+ {
+ if( aIt->m_xLabeledDataSequence.is())
+ {
+ Reference< chart2::data::XDataSequence > xSeq(
+ aIt->m_xLabeledDataSequence->getValues());
+ if( !xSeq.is())
+ continue;
+ sal_Int32 nLength( xSeq->getData().getLength());
+ if( nLength > nResult )
+ nResult = nLength;
+ }
+ }
+
+ return nResult;
+}
+
+OUString DataBrowserModel::getRoleOfColumn( sal_Int32 nColumnIndex ) const
+{
+ if( nColumnIndex != -1 &&
+ static_cast< sal_uInt32 >( nColumnIndex ) < m_aColumns.size())
+ return m_aColumns[ nColumnIndex ].m_aUIRoleName;
+ return OUString();
+}
+
+Reference< chart2::data::XLabeledDataSequence >
+ DataBrowserModel::getCategories() const throw()
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ return m_apDialogModel->getCategories();
+}
+
+const DataBrowserModel::tDataHeaderVector& DataBrowserModel::getDataHeaders() const
+{
+ return m_aHeaders;
+}
+
+void DataBrowserModel::updateFromModel()
+{
+ if( !m_xChartDocument.is())
+ return;
+ m_aColumns.clear();
+ m_aHeaders.clear();
+
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDocument ));
+ if( !xDiagram.is())
+ return;
+
+ // set template at DialogModel
+ uno::Reference< lang::XMultiServiceFactory > xFact( m_xChartDocument->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+ if( aTemplateAndService.first.is())
+ m_apDialogModel->setTemplate( aTemplateAndService.first );
+
+ sal_Int32 nHeaderStart = 0;
+ sal_Int32 nHeaderEnd = 0;
+ if( lcl_ShowCategories( xDiagram ))
+ {
+ Reference< chart2::data::XLabeledDataSequence > xCategories( this->getCategories());
+ tDataColumn aCategories;
+ aCategories.m_xLabeledDataSequence.set( xCategories );
+ if( lcl_ShowCategoriesAsDataLabel( xDiagram ))
+ aCategories.m_aUIRoleName = DialogModel::GetRoleDataLabel();
+ else
+ aCategories.m_aUIRoleName = lcl_getUIRoleName( xCategories );
+ aCategories.m_eCellType = TEXT;
+ m_aColumns.push_back( aCategories );
+ ++nHeaderStart;
+ }
+
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
+ if( !xCooSysCnt.is())
+ return;
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ sal_Int32 nXAxisNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( 0, aCooSysSeq[nCooSysIdx], 0, 0 );
+
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY );
+ if( xSeriesCnt.is())
+ {
+ rtl::OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( aChartTypes[nCTIdx] );
+
+ Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries());
+ lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( aSeries ));
+ for( lcl_tSharedSeqVec::const_iterator aIt( aSharedSequences.begin());
+ aIt != aSharedSequences.end(); ++aIt )
+ {
+ tDataColumn aSharedSequence;
+ aSharedSequence.m_xLabeledDataSequence = *aIt;
+ aSharedSequence.m_aUIRoleName = lcl_getUIRoleName( *aIt );
+ aSharedSequence.m_eCellType = NUMBER;
+ // as the sequences are shared it should be ok to take the first series
+ // @todo: dimension index 0 for x-values used here. This is just a guess.
+ // Also, the axis index is 0, as there is usually only one x-axis
+ aSharedSequence.m_nNumberFormatKey = nXAxisNumberFormat;
+ m_aColumns.push_back( aSharedSequence );
+ ++nHeaderStart;
+ }
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx )
+ {
+ tDataColumnVector::size_type nStartColIndex = m_aColumns.size();
+ Reference< chart2::XDataSeries > xSeries( aSeries[nSeriesIdx] );
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqs( xSource->getDataSequences());
+ if( aLSeqs.getLength() == 0 )
+ continue;
+ nHeaderEnd = nHeaderStart;
+
+ // @todo: dimension index 1 for y-values used here. This is just a guess
+ sal_Int32 nYAxisNumberFormatKey =
+ DataSeriesHelper::getNumberFormatKeyFromAxis(
+ aSeries[nSeriesIdx], aCooSysSeq[nCooSysIdx], 1 );
+
+ sal_Int32 nSeqIdx=0;
+ for( ; nSeqIdx<aLSeqs.getLength(); ++nSeqIdx )
+ {
+ sal_Int32 nSequenceNumberFormatKey = nYAxisNumberFormatKey;
+ OUString aRole = lcl_getRole( aLSeqs[nSeqIdx] );
+
+ if( aRole.equals( aRoleForDataLabelNumberFormat ) )
+ {
+ nSequenceNumberFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ), xSeries, -1, xDiagram );
+ }
+ else if( aRole.equals( C2U( "values-x" ) ) )
+ nSequenceNumberFormatKey = nXAxisNumberFormat;
+
+ if( ::std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
+ lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) == aSharedSequences.end())
+ {
+ // no shared sequence
+ m_aColumns.push_back(
+ tDataColumn(
+ aSeries[nSeriesIdx],
+ nSeqIdx,
+ lcl_getUIRoleName( aLSeqs[nSeqIdx] ),
+ aLSeqs[nSeqIdx],
+ NUMBER,
+ nSequenceNumberFormatKey ));
+ ++nHeaderEnd;
+ }
+ // else skip
+ }
+ bool bSwapXAndYAxis = false;
+ try
+ {
+ Reference< beans::XPropertySet > xProp( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY );
+ xProp->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("SwapXAndYAxis"))) >>= bSwapXAndYAxis;
+ }
+ catch( const beans::UnknownPropertyException & ex )
+ {
+ (void)ex;
+ }
+
+ // add ranges for error bars if present for a series
+ if( StatisticsHelper::usesErrorBarRanges( aSeries[nSeriesIdx], /* bYError = */ true ))
+ addErrorBarRanges( aSeries[nSeriesIdx], nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd );
+
+ m_aHeaders.push_back(
+ tDataHeader(
+ aSeries[nSeriesIdx],
+ aChartTypes[nCTIdx],
+ bSwapXAndYAxis,
+ nHeaderStart,
+ nHeaderEnd - 1 ));
+
+ nHeaderStart = nHeaderEnd;
+
+ ::std::sort( m_aColumns.begin() + nStartColIndex, m_aColumns.end(), implColumnLess() );
+ }
+ }
+ }
+ }
+ }
+}
+
+void DataBrowserModel::addErrorBarRanges(
+ const Reference< chart2::XDataSeries > & xDataSeries,
+ sal_Int32 nNumberFormatKey,
+ sal_Int32 & rInOutSequenceIndex,
+ sal_Int32 & rInOutHeaderEnd )
+{
+ try
+ {
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aSequences;
+
+ // x error bars
+ // ------------
+ Reference< chart2::data::XDataSource > xErrorSource(
+ StatisticsHelper::getErrorBars( xDataSeries, /* bYError = */ false ), uno::UNO_QUERY );
+
+ // positive x error bars
+ Reference< chart2::data::XLabeledDataSequence > xErrorLSequence(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ true,
+ /* bYError = */ false ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+ // negative x error bars
+ xErrorLSequence.set(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ false,
+ /* bYError = */ false ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+ // y error bars
+ // ------------
+ xErrorSource.set(
+ StatisticsHelper::getErrorBars( xDataSeries, /* bYError = */ true ), uno::UNO_QUERY );
+
+ // positive y error bars
+ xErrorLSequence.set(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ true,
+ /* bYError = */ true ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+ // negative y error bars
+ xErrorLSequence.set(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ false,
+ /* bYError = */ true ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+
+ for( ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aIt( aSequences.begin());
+ aIt != aSequences.end(); ++aIt )
+ {
+ m_aColumns.push_back(
+ tDataColumn(
+ xDataSeries,
+ rInOutSequenceIndex,
+ lcl_getUIRoleName( *aIt ),
+ *aIt,
+ NUMBER,
+ nNumberFormatKey ));
+ ++rInOutSequenceIndex;
+ ++rInOutHeaderEnd;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/controller/dialogs/DataBrowserModel.hxx
new file mode 100644
index 000000000000..95a3e4b2f0fa
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataBrowserModel.hxx,v $
+ * $Revision: 1.7.16.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DATABROWSERMODEL_HXX
+#define CHART2_DATABROWSERMODEL_HXX
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <memory>
+#include <vector>
+
+namespace com { namespace sun { namespace star { namespace chart2 {
+ class XDataSeries;
+ class XChartType;
+ namespace data {
+ class XLabeledDataSequence;
+ }
+}}}}
+
+namespace chart
+{
+
+class DialogModel;
+
+class DataBrowserModel
+{
+public:
+ explicit DataBrowserModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDoc,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~DataBrowserModel();
+
+ /** Inserts a new data series after the data series to which the data column
+ with index nAfterColumnIndex belongs.
+ */
+ void insertDataSeries( sal_Int32 nAfterColumnIndex );
+
+ /** Removes a data series to which the data column with index nAtColumnIndex
+ belongs.
+ */
+ void removeDataSeries( sal_Int32 nAtColumnIndex );
+
+ /** Swaps the series to which the data column with index nFirstIndex belongs
+ with the next series (which starts at an index >= nFirstIndex + 1)
+ */
+ void swapDataSeries( sal_Int32 nFirstIndex );
+ void swapDataPointForAllSeries( sal_Int32 nFirstIndex );
+
+ void insertDataPointForAllSeries( sal_Int32 nAfterIndex );
+ void removeDataPointForAllSeries( sal_Int32 nAtIndex );
+
+ enum eCellType
+ {
+ NUMBER,
+ TEXT
+ };
+
+ eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+ /// If getCellType( nAtColumn, nAtRow ) returns TEXT, the result will be Nan
+ double getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+ ::rtl::OUString getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+ sal_uInt32 getNumberFormatKey( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+
+ /// returns </TRUE> if the number could successfully be set at the given position
+ bool setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue );
+ /// returns </TRUE> if the text could successfully be set at the given position
+ bool setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::rtl::OUString & rText );
+ bool setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::com::sun::star::uno::Any & aValue );
+
+ sal_Int32 getColumnCount() const;
+ sal_Int32 getMaxRowCount() const;
+
+ // returns the UI string of the corresponding role
+ ::rtl::OUString getRoleOfColumn( sal_Int32 nColumnIndex ) const;
+
+ struct tDataHeader
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > m_xChartType;
+ bool m_bSwapXAndYAxis;
+ sal_Int32 m_nStartColumn;
+ sal_Int32 m_nEndColumn;
+
+ // default CTOR
+ tDataHeader() :
+ m_bSwapXAndYAxis( false ),
+ m_nStartColumn( -1 ),
+ m_nEndColumn( -1 )
+ {}
+ // "full" CTOR
+ tDataHeader(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > xDataSeries,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > xChartType,
+ bool bSwapXAndYAxis,
+ sal_Int32 nStartColumn,
+ sal_Int32 nEndColumn ) :
+ m_xDataSeries( xDataSeries ),
+ m_xChartType( xChartType ),
+ m_bSwapXAndYAxis( bSwapXAndYAxis ),
+ m_nStartColumn( nStartColumn ),
+ m_nEndColumn( nEndColumn )
+ {}
+ };
+
+ typedef ::std::vector< tDataHeader > tDataHeaderVector;
+
+ const tDataHeaderVector& getDataHeaders() const;
+
+ tDataHeader getHeaderForSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > &xSeries ) const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >
+ getDataSeriesByColumn( sal_Int32 nColumn ) const;
+
+private:
+ void updateFromModel();
+
+ void addErrorBarRanges(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ sal_Int32 nNumberFormatKey,
+ sal_Int32 & rInOutSequenceIndex,
+ sal_Int32 & rInOutHeaderEnd );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence >
+ getCategories() const throw();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::std::auto_ptr< DialogModel > m_apDialogModel;
+
+ struct tDataColumn;
+ struct implColumnLess;
+
+ typedef ::std::vector< tDataColumn > tDataColumnVector;
+
+ tDataColumnVector m_aColumns;
+ tDataHeaderVector m_aHeaders;
+};
+
+} // namespace chart
+
+// CHART2_DATABROWSERMODEL_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
new file mode 100644
index 000000000000..69e693911c22
--- /dev/null
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -0,0 +1,843 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DialogModel.cxx,v $
+ * $Revision: 1.7.16.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DialogModel.hxx"
+#include "RangeSelectionHelper.hxx"
+#include "PropertyHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "macros.hxx"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "ContainerHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ChartTypeHelper.hxx"
+
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+
+#include <tools/string.hxx>
+
+#include <utility>
+#include <algorithm>
+#include <iterator>
+#include <functional>
+#include <numeric>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::chart::ContainerHelper;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// ----------------------------------------
+
+namespace
+{
+const OUString lcl_aLabelRole( RTL_CONSTASCII_USTRINGPARAM( "label" ));
+
+struct lcl_ChartTypeToSeriesCnt : ::std::unary_function<
+ Reference< XChartType >, Reference< XDataSeriesContainer > >
+{
+ Reference< XDataSeriesContainer > operator() (
+ const Reference< XChartType > & xChartType )
+ {
+ return Reference< XDataSeriesContainer >::query( xChartType );
+ }
+};
+
+OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
+{
+ OUString aResult( rRoleString );
+
+ typedef ::std::map< OUString, OUString > tTranslationMap;
+ static tTranslationMap aTranslationMap;
+
+ if( aTranslationMap.size() == 0 )
+ {
+ aTranslationMap[ C2U( "categories" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_CATEGORIES )));
+ aTranslationMap[ C2U( "error-bars-x" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X_ERROR )));
+ aTranslationMap[ C2U( "error-bars-x-positive" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X_ERROR_POSITIVE )));
+ aTranslationMap[ C2U( "error-bars-x-negative" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X_ERROR_NEGATIVE )));
+ aTranslationMap[ C2U( "error-bars-y" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y_ERROR )));
+ aTranslationMap[ C2U( "error-bars-y-positive" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y_ERROR_POSITIVE )));
+ aTranslationMap[ C2U( "error-bars-y-negative" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y_ERROR_NEGATIVE )));
+ aTranslationMap[ C2U( "label" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_LABEL )));
+ aTranslationMap[ C2U( "values-first" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_FIRST )));
+ aTranslationMap[ C2U( "values-last" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_LAST )));
+ aTranslationMap[ C2U( "values-max" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_MAX )));
+ aTranslationMap[ C2U( "values-min" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_MIN )));
+ aTranslationMap[ C2U( "values-x" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X )));
+ aTranslationMap[ C2U( "values-y" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y )));
+ aTranslationMap[ C2U( "values-size" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_SIZE )));
+ }
+
+ if( bFromInternalToUI )
+ {
+ tTranslationMap::const_iterator aIt( aTranslationMap.find( rRoleString ));
+ if( aIt != aTranslationMap.end())
+ {
+ aResult = (*aIt).second;
+ }
+ }
+ else
+ {
+ tTranslationMap::const_iterator aIt(
+ ::std::find_if( aTranslationMap.begin(), aTranslationMap.end(),
+ ::std::compose1( ::std::bind2nd(
+ ::std::equal_to< tTranslationMap::mapped_type >(),
+ rRoleString ),
+ ::std::select2nd< tTranslationMap::value_type >())));
+
+ if( aIt != aTranslationMap.end())
+ aResult = (*aIt).first;
+ }
+
+ return aResult;
+}
+
+typedef ::std::map< ::rtl::OUString, sal_Int32 > lcl_tRoleIndexMap;
+
+void lcl_createRoleIndexMap( lcl_tRoleIndexMap & rOutMap )
+{
+ rOutMap.clear();
+ sal_Int32 nIndex = 0;
+
+ rOutMap[ C2U( "label" ) ] = ++nIndex;
+ rOutMap[ C2U( "categories" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-x" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-y" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-x" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-x-positive" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-x-negative" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-y" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-y-positive" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-y-negative" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-first" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-min" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-max" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-last" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-size" ) ] = ++nIndex;
+}
+
+struct lcl_DataSeriesContainerAppend : public
+ ::std::iterator< ::std::output_iterator_tag, Reference< XDataSeriesContainer > >
+{
+ typedef ::std::vector< chart::DialogModel::tSeriesWithChartTypeByName > tContainerType;
+
+ explicit lcl_DataSeriesContainerAppend( tContainerType & rCnt )
+ : m_rDestCnt( rCnt )
+ {}
+
+ lcl_DataSeriesContainerAppend & operator= ( const value_type & xVal )
+ {
+ try
+ {
+ if( xVal.is())
+ {
+ Sequence< Reference< XDataSeries > > aSeq( xVal->getDataSeries());
+ OUString aRole( RTL_CONSTASCII_USTRINGPARAM("values-y"));
+ Reference< XChartType > xCT( xVal, uno::UNO_QUERY );
+ if( xCT.is())
+ aRole = xCT->getRoleOfSequenceForSeriesLabel();
+ for( sal_Int32 nI = 0; nI < aSeq.getLength(); ++ nI )
+ {
+ m_rDestCnt.push_back(
+ chart::DialogModel::tSeriesWithChartTypeByName(
+ ::chart::DataSeriesHelper::getDataSeriesLabel( aSeq[nI], aRole ),
+ ::std::make_pair( aSeq[nI], xCT )));
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return *this;
+ }
+
+ lcl_DataSeriesContainerAppend & operator* () { return *this; }
+ lcl_DataSeriesContainerAppend & operator++ () { return *this; }
+ lcl_DataSeriesContainerAppend & operator++ (int) { return *this; }
+
+private:
+ tContainerType & m_rDestCnt;
+};
+
+struct lcl_RolesWithRangeAppend : public
+ ::std::iterator< ::std::output_iterator_tag, Reference< data::XLabeledDataSequence > >
+{
+ typedef ::chart::DialogModel::tRolesWithRanges tContainerType;
+
+ explicit lcl_RolesWithRangeAppend( tContainerType & rCnt,
+ const ::rtl::OUString & aLabelRole )
+ : m_rDestCnt( rCnt ),
+ m_aRoleForLabelSeq( aLabelRole )
+ {}
+
+ lcl_RolesWithRangeAppend & operator= ( const value_type & xVal )
+ {
+ try
+ {
+ if( xVal.is())
+ {
+ // data sequence
+ Reference< data::XDataSequence > xSeq( xVal->getValues());
+ if( xSeq.is())
+ {
+ OUString aRole;
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
+ if( xProp->getPropertyValue( C2U("Role")) >>= aRole )
+ {
+ m_rDestCnt.insert(
+ tContainerType::value_type(
+ aRole, xSeq->getSourceRangeRepresentation()));
+ // label
+ if( aRole.equals( m_aRoleForLabelSeq ))
+ {
+ Reference< data::XDataSequence > xLabelSeq( xVal->getLabel());
+ if( xLabelSeq.is())
+ {
+ m_rDestCnt.insert(
+ tContainerType::value_type(
+ lcl_aLabelRole, xLabelSeq->getSourceRangeRepresentation()));
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return *this;
+ }
+
+ lcl_RolesWithRangeAppend & operator* () { return *this; }
+ lcl_RolesWithRangeAppend & operator++ () { return *this; }
+ lcl_RolesWithRangeAppend & operator++ (int) { return *this; }
+
+private:
+ tContainerType & m_rDestCnt;
+ OUString m_aRoleForLabelSeq;
+};
+
+void lcl_SetSequenceRole(
+ const Reference< data::XDataSequence > & xSeq,
+ const OUString & rRole )
+{
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY );
+ if( xProp.is())
+ xProp->setPropertyValue( C2U("Role"), uno::makeAny( rRole ));
+}
+
+Reference< XDataSeries > lcl_CreateNewSeries(
+ const Reference< uno::XComponentContext > & xContext,
+ const Reference< XChartType > & xChartType,
+ sal_Int32 nNewSeriesIndex,
+ sal_Int32 nTotalNumberOfSeriesInCTGroup,
+ const Reference< XDiagram > & xDiagram,
+ const Reference< XChartTypeTemplate > & xTemplate,
+ bool bCreateDataCachedSequences )
+{
+ // create plain series
+ Reference< XDataSeries > xResult(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.DataSeries" ),
+ xContext ), uno::UNO_QUERY );
+ if( xTemplate.is())
+ {
+ Reference< beans::XPropertySet > xResultProp( xResult, uno::UNO_QUERY );
+ if( xResultProp.is())
+ {
+ // @deprecated: correct default color should be found by view
+ // without setting it as hard attribute
+ Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
+ if( xColorScheme.is())
+ xResultProp->setPropertyValue(
+ C2U("Color"), uno::makeAny( xColorScheme->getColorByIndex( nNewSeriesIndex )));
+ }
+ sal_Int32 nGroupIndex=0;
+ if( xChartType.is())
+ {
+ Sequence< Reference< XChartType > > aCTs(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ));
+ for( ; nGroupIndex<aCTs.getLength(); ++nGroupIndex)
+ if( aCTs[nGroupIndex] == xChartType )
+ break;
+ if( nGroupIndex == aCTs.getLength())
+ nGroupIndex = 0;
+ }
+ xTemplate->applyStyle( xResult, nGroupIndex, nNewSeriesIndex, nTotalNumberOfSeriesInCTGroup );
+ }
+
+ if( bCreateDataCachedSequences )
+ {
+ // set chart type specific roles
+ Reference< data::XDataSink > xSink( xResult, uno::UNO_QUERY );
+ if( xChartType.is() && xSink.is())
+ {
+ ::std::vector< Reference< data::XLabeledDataSequence > > aNewSequences;
+ const OUString aRoleOfSeqForSeriesLabel = xChartType->getRoleOfSequenceForSeriesLabel();
+ const OUString aLabel( String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES )));
+ const Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles());
+ const Sequence< OUString > aOptRoles( xChartType->getSupportedOptionalRoles());
+ sal_Int32 nI = 0;
+
+ for(nI=0; nI<aRoles.getLength(); ++nI)
+ {
+ if( aRoles[nI].equals( lcl_aLabelRole ))
+ continue;
+ Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence() );
+ lcl_SetSequenceRole( xSeq, aRoles[nI] );
+ // assert that aRoleOfSeqForSeriesLabel is part of the mandatory roles
+ if( aRoles[nI].equals( aRoleOfSeqForSeriesLabel ))
+ {
+ Reference< data::XDataSequence > xLabel( ::chart::DataSourceHelper::createCachedDataSequence( aLabel ));
+ lcl_SetSequenceRole( xLabel, lcl_aLabelRole );
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq, xLabel ));
+ }
+ else
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq ));
+ }
+
+ for(nI=0; nI<aOptRoles.getLength(); ++nI)
+ {
+ if( aOptRoles[nI].equals( lcl_aLabelRole ))
+ continue;
+ Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence());
+ lcl_SetSequenceRole( xSeq, aOptRoles[nI] );
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq ));
+ }
+
+ xSink->setData( ContainerToSequence( aNewSequences ));
+ }
+ }
+
+ return xResult;
+}
+
+struct lcl_addSeriesNumber : public ::std::binary_function<
+ sal_Int32, Reference< XDataSeriesContainer >, sal_Int32 >
+{
+ sal_Int32 operator() ( sal_Int32 nCurrentNumber, const Reference< XDataSeriesContainer > & xCnt ) const
+ {
+ if( xCnt.is())
+ return nCurrentNumber + (xCnt->getDataSeries().getLength());
+ return nCurrentNumber;
+ }
+};
+
+} // anonymous namespace
+
+// ----------------------------------------
+
+
+namespace chart
+{
+
+DialogModel::DialogModel(
+ const Reference< XChartDocument > & xChartDocument,
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xChartDocument( xChartDocument ),
+ m_xContext( xContext ),
+ m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) )
+{
+ createBackup();
+}
+
+DialogModel::~DialogModel()
+{}
+
+void DialogModel::setTemplate(
+ const Reference< XChartTypeTemplate > & xTemplate )
+{
+ m_xTemplate = xTemplate;
+}
+
+::boost::shared_ptr< RangeSelectionHelper >
+ DialogModel::getRangeSelectionHelper() const
+{
+ if( ! m_spRangeSelectionHelper.get())
+ m_spRangeSelectionHelper.reset(
+ new RangeSelectionHelper( m_xChartDocument ));
+
+ return m_spRangeSelectionHelper;
+}
+
+Reference< frame::XModel > DialogModel::getChartModel() const
+{
+ Reference< frame::XModel > xResult( m_xChartDocument, uno::UNO_QUERY );
+ return xResult;
+}
+
+Reference< data::XDataProvider > DialogModel::getDataProvider() const
+{
+ Reference< data::XDataProvider > xResult;
+ if( m_xChartDocument.is())
+ xResult.set( m_xChartDocument->getDataProvider());
+ return xResult;
+}
+
+::std::vector< Reference< XDataSeriesContainer > >
+ DialogModel::getAllDataSeriesContainers() const
+{
+ ::std::vector< Reference< XDataSeriesContainer > > aResult;
+
+ try
+ {
+ Reference< XDiagram > xDiagram;
+ if( m_xChartDocument.is())
+ xDiagram.set( m_xChartDocument->getFirstDiagram());
+ if( xDiagram.is())
+ {
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
+ ::std::transform(
+ aChartTypeSeq.getConstArray(), aChartTypeSeq.getConstArray() + aChartTypeSeq.getLength(),
+ ::std::back_inserter( aResult ),
+ lcl_ChartTypeToSeriesCnt() );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return aResult;
+}
+
+::std::vector< DialogModel::tSeriesWithChartTypeByName >
+ DialogModel::getAllDataSeriesWithLabel() const
+{
+ ::std::vector< tSeriesWithChartTypeByName > aResult;
+ ::std::vector< Reference< XDataSeriesContainer > > aContainers(
+ getAllDataSeriesContainers());
+
+ ::std::copy( aContainers.begin(), aContainers.end(),
+ lcl_DataSeriesContainerAppend( aResult ));
+ return aResult;
+}
+
+DialogModel::tRolesWithRanges DialogModel::getRolesWithRanges(
+ const Reference< XDataSeries > & xSeries,
+ const ::rtl::OUString & aRoleOfSequenceForLabel,
+ const Reference< chart2::XChartType > & xChartType ) const
+{
+ DialogModel::tRolesWithRanges aResult;
+ try
+ {
+ Reference< data::XDataSource > xSource( xSeries, uno::UNO_QUERY_THROW );
+ const Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
+ ::std::copy( aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength(),
+ lcl_RolesWithRangeAppend( aResult, aRoleOfSequenceForLabel ));
+ if( xChartType.is())
+ {
+ // add missing mandatory roles
+ Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles());
+ OUString aEmptyString;
+ sal_Int32 nI = 0;
+ for( nI=0; nI < aRoles.getLength(); ++nI )
+ {
+ if( aResult.find( aRoles[nI] ) == aResult.end() )
+ aResult.insert( DialogModel::tRolesWithRanges::value_type( aRoles[nI], aEmptyString ));
+ }
+
+ // add missing optional roles
+ aRoles = xChartType->getSupportedOptionalRoles();
+ for( nI=0; nI < aRoles.getLength(); ++nI )
+ {
+ if( aResult.find( aRoles[nI] ) == aResult.end() )
+ aResult.insert( DialogModel::tRolesWithRanges::value_type( aRoles[nI], aEmptyString ));
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aResult;
+}
+
+void DialogModel::moveSeries(
+ const Reference< XDataSeries > & xSeries,
+ eMoveDirection eDirection )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+
+ Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ DiagramHelper::moveSeries( xDiagram, xSeries, eDirection==MOVE_UP );
+}
+
+Reference< chart2::XDataSeries > DialogModel::insertSeriesAfter(
+ const Reference< XDataSeries > & xSeries,
+ const Reference< XChartType > & xChartType,
+ bool bCreateDataCachedSequences /* = false */ )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ Reference< XDataSeries > xNewSeries;
+
+ try
+ {
+ sal_Int32 nSeriesInChartType = 0;
+ const sal_Int32 nTotalSeries = countSeries();
+ if( xChartType.is())
+ {
+ Reference< XDataSeriesContainer > xCnt( xChartType, uno::UNO_QUERY_THROW );
+ nSeriesInChartType = xCnt->getDataSeries().getLength();
+ }
+
+ // create new series
+ xNewSeries.set(
+ lcl_CreateNewSeries(
+ m_xContext,
+ xChartType,
+ nTotalSeries, // new series' index
+ nSeriesInChartType,
+ m_xChartDocument->getFirstDiagram(),
+ m_xTemplate,
+ bCreateDataCachedSequences ));
+
+ // add new series to container
+ if( xNewSeries.is())
+ {
+ Reference< XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY_THROW );
+ ::std::vector< Reference< XDataSeries > > aSeries(
+ SequenceToVector( xSeriesCnt->getDataSeries()));
+ ::std::vector< Reference< XDataSeries > >::iterator aIt =
+ ::std::find( aSeries.begin(), aSeries.end(), xSeries );
+ if( aIt == aSeries.end())
+ // if we have no series we insert at the first position.
+ aIt = aSeries.begin();
+ else
+ // vector::insert inserts before, so we have to advance
+ ++aIt;
+ aSeries.insert( aIt, xNewSeries );
+ xSeriesCnt->setDataSeries( ContainerToSequence( aSeries ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xNewSeries;
+}
+
+void DialogModel::deleteSeries(
+ const Reference< XDataSeries > & xSeries,
+ const Reference< XChartType > & xChartType )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+
+ DataSeriesHelper::deleteSeries( xSeries, xChartType );
+}
+
+Reference< data::XLabeledDataSequence > DialogModel::getCategories() const
+{
+ Reference< data::XLabeledDataSequence > xResult;
+ try
+ {
+ if( m_xChartDocument.is())
+ {
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ xResult.set( DiagramHelper::getCategoriesFromDiagram( xDiagram ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xResult;
+}
+
+void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequence > & xCategories )
+{
+ if( m_xChartDocument.is())
+ {
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ if( xDiagram.is())
+ {
+ // categories
+ bool bSupportsCategories = true;
+
+ Reference< XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ if( xFirstChartType.is() )
+ {
+ sal_Int32 nAxisType = ChartTypeHelper::getAxisType( xFirstChartType, 0 ); // x-axis
+ bSupportsCategories = (nAxisType == AxisType::CATEGORY);
+ }
+ DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram, true, bSupportsCategories );
+ }
+ }
+}
+
+OUString DialogModel::getCategoriesRange() const
+{
+ Reference< data::XLabeledDataSequence > xLSeq( getCategories());
+ OUString aRange;
+ if( xLSeq.is())
+ {
+ Reference< data::XDataSequence > xSeq( xLSeq->getValues());
+ if( xSeq.is())
+ aRange = xSeq->getSourceRangeRepresentation();
+ }
+ return aRange;
+}
+
+bool DialogModel::isCategoryDiagram() const
+{
+ bool bRet = false;
+ if( m_xChartDocument.is())
+ bRet = DiagramHelper::isCategoryDiagram( m_xChartDocument->getFirstDiagram() );
+ return bRet;
+}
+
+void DialogModel::detectArguments(
+ OUString & rOutRangeString,
+ bool & rOutUseColumns,
+ bool & rOutFirstCellAsLabel,
+ bool & rOutHasCategories ) const
+{
+ try
+ {
+ uno::Sequence< sal_Int32 > aSequenceMapping;//todo YYYX
+
+ // Note: unused data is currently not supported in being passed to detectRangeSegmentation
+ if( m_xChartDocument.is())
+ DataSourceHelper::detectRangeSegmentation(
+ Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY_THROW ),
+ rOutRangeString, aSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+bool DialogModel::allArgumentsForRectRangeDetected() const
+{
+ return DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument );
+}
+
+void DialogModel::startControllerLockTimer()
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+}
+
+bool DialogModel::setData(
+ const Sequence< beans::PropertyValue > & rArguments )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+
+ Reference< data::XDataProvider > xDataProvider( getDataProvider());
+ if( ! xDataProvider.is() ||
+ ! m_xTemplate.is() )
+ {
+ OSL_ENSURE( false, "Model objects missing" );
+ return false;
+ }
+
+ try
+ {
+ Reference< chart2::data::XDataSource > xDataSource(
+ xDataProvider->createDataSource( rArguments ) );
+
+ Reference< chart2::XDataInterpreter > xInterpreter(
+ m_xTemplate->getDataInterpreter());
+ if( xInterpreter.is())
+ {
+ ::std::vector< Reference< XDataSeries > > aSeriesToReUse(
+ DiagramHelper::getDataSeriesFromDiagram( m_xChartDocument->getFirstDiagram()));
+ applyInterpretedData(
+ xInterpreter->interpretDataSource(
+ xDataSource, rArguments,
+ ContainerToSequence( aSeriesToReUse )),
+ aSeriesToReUse,
+ true /* bSetStyles */);
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ return false;
+ }
+
+ return true;
+}
+
+// static
+OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString )
+{
+ return lcl_ConvertRole( rRoleString, true );
+}
+
+// static
+OUString DialogModel::GetRoleDataLabel()
+{
+ return OUString( String( ::chart::SchResId( STR_OBJECT_DATALABELS )));
+}
+
+// static
+
+sal_Int32 DialogModel::GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString )
+{
+ static lcl_tRoleIndexMap aRoleIndexMap;
+
+ if( aRoleIndexMap.empty())
+ lcl_createRoleIndexMap( aRoleIndexMap );
+
+ lcl_tRoleIndexMap::const_iterator aIt( aRoleIndexMap.find( rInternalRoleString ));
+ if( aIt != aRoleIndexMap.end())
+ return aIt->second;
+
+ return 0;
+}
+
+// private methods
+
+void DialogModel::createBackup()
+{
+ OSL_ENSURE( ! m_xBackupChartDocument.is(), "Cloning already cloned model" );
+ try
+ {
+ Reference< util::XCloneable > xCloneable( m_xChartDocument, uno::UNO_QUERY_THROW );
+ m_xBackupChartDocument.set( xCloneable->createClone(), uno::UNO_QUERY_THROW );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void DialogModel::applyInterpretedData(
+ const InterpretedData & rNewData,
+ const ::std::vector< Reference< XDataSeries > > & rSeriesToReUse,
+ bool bSetStyles )
+{
+ if( ! m_xChartDocument.is())
+ return;
+
+ m_aTimerTriggeredControllerLock.startTimer();
+ Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ if( xDiagram.is())
+ {
+ // styles
+ if( bSetStyles && m_xTemplate.is() )
+ {
+ sal_Int32 nGroup = 0;
+ sal_Int32 nSeriesCounter = 0;
+ sal_Int32 nNewSeriesIndex = static_cast< sal_Int32 >( rSeriesToReUse.size());
+ const sal_Int32 nOuterSize=rNewData.Series.getLength();
+
+ for(; nGroup < nOuterSize; ++nGroup)
+ {
+ Sequence< Reference< XDataSeries > > aSeries( rNewData.Series[ nGroup ] );
+ const sal_Int32 nSeriesInGroup = aSeries.getLength();
+ for( sal_Int32 nSeries=0; nSeries<nSeriesInGroup; ++nSeries, ++nSeriesCounter )
+ {
+ if( ::std::find( rSeriesToReUse.begin(), rSeriesToReUse.end(), aSeries[nSeries] )
+ == rSeriesToReUse.end())
+ {
+ Reference< beans::XPropertySet > xSeriesProp( aSeries[nSeries], uno::UNO_QUERY );
+ if( xSeriesProp.is())
+ {
+ // @deprecated: correct default color should be found by view
+ // without setting it as hard attribute
+ Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
+ if( xColorScheme.is())
+ xSeriesProp->setPropertyValue(
+ C2U("Color"), uno::makeAny( xColorScheme->getColorByIndex( nSeriesCounter )));
+ }
+ m_xTemplate->applyStyle( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup );
+ }
+ }
+ }
+ }
+
+ // data series
+ ::std::vector< Reference< XDataSeriesContainer > > aSeriesCnt( getAllDataSeriesContainers());
+ ::std::vector< Sequence< Reference< XDataSeries > > > aNewSeries(
+ SequenceToVector( rNewData.Series ));
+
+ OSL_ASSERT( aSeriesCnt.size() == aNewSeries.size());
+
+ ::std::vector< Sequence< Reference< XDataSeries > > >::const_iterator aSrcIt( aNewSeries.begin());
+ ::std::vector< Reference< XDataSeriesContainer > >::iterator aDestIt( aSeriesCnt.begin());
+ for(; aSrcIt != aNewSeries.end() && aDestIt != aSeriesCnt.end();
+ ++aSrcIt, ++aDestIt )
+ {
+ try
+ {
+ OSL_ASSERT( (*aDestIt).is());
+ (*aDestIt)->setDataSeries( *aSrcIt );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ DialogModel::setCategories(rNewData.Categories);
+ }
+
+ OSL_ASSERT( ! rNewData.UnusedData.hasElements());
+}
+
+sal_Int32 DialogModel::countSeries() const
+{
+ ::std::vector< Reference< XDataSeriesContainer > > aCnt( getAllDataSeriesContainers());
+ return ::std::accumulate( aCnt.begin(), aCnt.end(), 0, lcl_addSeriesNumber());
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx
new file mode 100644
index 000000000000..744262cbbd1f
--- /dev/null
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DialogModel.hxx,v $
+ * $Revision: 1.4.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DIALOGMODEL_HXX
+#define CHART2_DIALOGMODEL_HXX
+
+#include "TimerTriggeredControllerLock.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vector>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+namespace com { namespace sun { namespace star { namespace chart2 {
+ class XDataSeriesContainer;
+ class XDataSeries;
+ class XChartType;
+ class XChartTypeTemplate;
+ struct InterpretedData;
+ namespace data {
+ class XDataProvider;
+ class XLabeledDataSequence;
+ }
+}}}}
+
+namespace chart
+{
+
+class RangeSelectionHelper;
+
+class DialogModel
+{
+public:
+ explicit DialogModel(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ ~DialogModel();
+
+ typedef ::std::pair<
+ ::rtl::OUString,
+ ::std::pair< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > >
+ tSeriesWithChartTypeByName;
+
+ typedef ::std::map< ::rtl::OUString, ::rtl::OUString >
+ tRolesWithRanges;
+
+ void setTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > & xTemplate );
+
+ ::boost::shared_ptr< RangeSelectionHelper >
+ getRangeSelectionHelper() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >
+ getChartModel() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataProvider >
+ getDataProvider() const;
+
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeriesContainer > >
+ getAllDataSeriesContainers() const;
+
+ ::std::vector< tSeriesWithChartTypeByName >
+ getAllDataSeriesWithLabel() const;
+
+ tRolesWithRanges getRolesWithRanges(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::rtl::OUString & aRoleOfSequenceForLabel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType ) const;
+
+ enum eMoveDirection
+ {
+ MOVE_DOWN,
+ MOVE_UP
+ };
+
+ void moveSeries( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ eMoveDirection eDirection );
+
+ /// @return the newly inserted series
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > insertSeriesAfter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType,
+ bool bCreateDataCachedSequences = false );
+
+ void deleteSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence >
+ getCategories() const;
+
+ void setCategories( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xCategories );
+
+ ::rtl::OUString getCategoriesRange() const;
+
+ bool isCategoryDiagram() const;
+
+ void detectArguments(
+ ::rtl::OUString & rOutRangeString,
+ bool & rOutUseColumns, bool & rOutFirstCellAsLabel, bool & rOutHasCategories ) const;
+
+ bool allArgumentsForRectRangeDetected() const;
+
+ bool setData( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & rArguments );
+
+ void startControllerLockTimer();
+
+ static ::rtl::OUString ConvertRoleFromInternalToUI( const ::rtl::OUString & rRoleString );
+ static ::rtl::OUString GetRoleDataLabel();
+
+ // pass a role string (not translated) and get an index that serves for
+ // relative ordering, to get e.g. x-values and y-values in the right order
+ static sal_Int32 GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >
+ m_xChartDocument;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >
+ m_xBackupChartDocument;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate >
+ m_xTemplate;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ mutable ::boost::shared_ptr< RangeSelectionHelper >
+ m_spRangeSelectionHelper;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+
+private:
+ void createBackup();
+
+ void applyInterpretedData(
+ const ::com::sun::star::chart2::InterpretedData & rNewData,
+ const ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > & rSeriesToReUse,
+ bool bSetStyles );
+
+ sal_Int32 countSeries() const;
+};
+
+} // namespace chart
+
+// CHART2_DIALOGMODEL_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
new file mode 100644
index 000000000000..fbbbca7fd826
--- /dev/null
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -0,0 +1,857 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ObjectNameProvider.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ObjectNameProvider.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "macros.hxx"
+#include "AxisHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "TitleHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+#include "CommonConverters.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "RegressionCurveHelper.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+
+// #include <unotools/syslocale.hxx>
+
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using rtl::OUString;
+
+namespace
+{
+
+OUString lcl_getDataSeriesName( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel )
+{
+ OUString aRet;
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xDiagram.is() && xSeries.is() )
+ {
+ Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ if( xChartType.is() )
+ {
+ aRet = ::chart::DataSeriesHelper::getDataSeriesLabel(
+ xSeries, xChartType->getRoleOfSequenceForSeriesLabel() ) ;
+ }
+ }
+
+ return aRet;
+}
+
+OUString lcl_getFullSeriesName( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel )
+{
+ OUString aRet = String(SchResId(STR_TIP_DATASERIES));
+ OUString aWildcard( C2U("%SERIESNAME") );
+ sal_Int32 nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) );
+ return aRet;
+}
+
+void lcl_addText( OUString& rOut, const OUString& rSeparator, const OUString& rNext )
+{
+ if( rOut.getLength() && rNext.getLength() )
+ rOut+=rSeparator;
+ if( rNext.getLength() )
+ rOut+=rNext;
+}
+
+OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal_Int32 nPointIndex,
+ const Reference< XCoordinateSystem >& xCooSys,
+ const Reference< frame::XModel >& xChartModel )
+{
+
+ OUString aRet;
+
+ Reference<data::XDataSource> xDataSource(
+ uno::Reference<data::XDataSource>( xSeries, uno::UNO_QUERY ) );
+ if(!xDataSource.is())
+ return aRet;
+
+ Sequence< Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+
+ rtl::OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size;
+ double fValue = 0;
+
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ sal_Int32 nLabelColor = 0;//dummy
+ bool bColorChanged;//dummy
+
+ for(sal_Int32 nN = aDataSequences.getLength();nN--;)
+ {
+ uno::Reference<data::XDataSequence> xDataSequence( aDataSequences[nN]->getValues());
+ if( !xDataSequence.is() )
+ continue;
+ Sequence< Any > aData( xDataSequence->getData() );
+ if( nPointIndex >= aData.getLength() )
+ continue;
+ uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ try
+ {
+ uno::Any aARole = xProp->getPropertyValue( C2U( "Role" ) );
+ rtl::OUString aRole;
+ aARole >>= aRole;
+
+ if( aRole.equals(C2U("values-x")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aX = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-y")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-first")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_First = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-min")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_Min = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-max")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_Max = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-last")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_Last = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-size")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ a_Size = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+
+ if( aX.getLength() == 0 )
+ {
+ rtl::OUString aCategory = ::rtl::OUString( String(SchResId(STR_TIP_CATEGORY_VALUE)));
+
+ replaceParamterInString( aCategory
+ , C2U("%CATEGORYVALUE")
+ , ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, nPointIndex )
+ );
+
+ aRet = aCategory;
+ }
+ else
+ {
+ aRet = aX;
+ }
+
+ OUString aSeparator(C2U(" "));
+
+ lcl_addText( aRet, aSeparator, aY );
+ lcl_addText( aRet, aSeparator, aY_First );
+ lcl_addText( aRet, aSeparator, aY_Min );
+ lcl_addText( aRet, aSeparator, aY_Max );
+ lcl_addText( aRet, aSeparator, aY_Last );
+ lcl_addText( aRet, aSeparator, a_Size );
+
+ return aRet;
+}
+
+} //end anonymous namespace
+
+rtl::OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural )
+{
+ rtl::OUString aRet;
+ switch( eObjectType )
+ {
+ case OBJECTTYPE_PAGE:
+ aRet=String(SchResId(STR_OBJECT_PAGE));
+ break;
+ case OBJECTTYPE_TITLE:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_TITLES));
+ else
+ aRet=String(SchResId(STR_OBJECT_TITLE));
+ }
+ break;
+ case OBJECTTYPE_LEGEND:
+ aRet=String(SchResId(STR_OBJECT_LEGEND));
+ break;
+ case OBJECTTYPE_LEGEND_ENTRY:
+ aRet=String(SchResId(STR_OBJECT_LEGEND_SYMBOL));//@todo change string if we do differenciate symbol and legend entry in future
+ break;
+ case OBJECTTYPE_DIAGRAM:
+ aRet=String(SchResId(STR_OBJECT_DIAGRAM));
+ break;
+ case OBJECTTYPE_DIAGRAM_WALL:
+ aRet=String(SchResId(STR_OBJECT_DIAGRAM_WALL));
+ break;
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ aRet=String(SchResId(STR_OBJECT_DIAGRAM_FLOOR));
+ break;
+ case OBJECTTYPE_AXIS:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_AXES));
+ else
+ aRet=String(SchResId(STR_OBJECT_AXIS));
+ }
+ break;
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ aRet=String(SchResId(STR_OBJECT_LABEL));//@todo maybe a more concrete name
+ break;
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID: //maybe todo: different names for subgrids
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_GRIDS));
+ else
+ aRet=String(SchResId(STR_OBJECT_GRID));
+ }
+ break;
+ case OBJECTTYPE_DATA_SERIES:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_DATASERIES_PLURAL));
+ else
+ aRet=String(SchResId(STR_OBJECT_DATASERIES));
+ }
+ break;
+ case OBJECTTYPE_DATA_POINT:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_DATAPOINTS));
+ else
+ aRet=String(SchResId(STR_OBJECT_DATAPOINT));
+ }
+ break;
+ case OBJECTTYPE_DATA_LABELS:
+ aRet=String(SchResId(STR_OBJECT_DATALABELS));
+ break;
+ case OBJECTTYPE_DATA_LABEL:
+ aRet=String(SchResId(STR_OBJECT_LABEL));
+ break;
+ case OBJECTTYPE_DATA_ERRORS:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe distinguish plural singular
+ break;
+ case OBJECTTYPE_DATA_ERRORS_X:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
+ break;
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ aRet=String(SchResId(STR_OBJECT_AVERAGE_LINE));
+ break;
+ case OBJECTTYPE_DATA_CURVE:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_CURVES));
+ else
+ aRet=String(SchResId(STR_OBJECT_CURVE));
+ }
+ break;
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ //aRet=String(SchResId());
+ break;
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ aRet=String(SchResId(STR_OBJECT_STOCK_LOSS));
+ break;
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ aRet=String(SchResId(STR_OBJECT_STOCK_GAIN));
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ aRet=String(SchResId(STR_OBJECT_CURVE_EQUATION));
+ break;
+ default: //OBJECTTYPE_UNKNOWN
+ ;
+ }
+ return aRet;
+}
+//static
+rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ rtl::OUString aRet;
+
+
+
+ Reference< XAxis > xAxis(
+ ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY );
+
+ sal_Int32 nCooSysIndex = 0;
+ sal_Int32 nDimensionIndex = 0;
+ sal_Int32 nAxisIndex = 0;
+ AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ), nCooSysIndex, nDimensionIndex, nAxisIndex );
+
+ switch(nDimensionIndex)
+ {
+ case 0://x-axis
+ if( nAxisIndex == 0 )
+ aRet=String(SchResId(STR_OBJECT_AXIS_X));
+ else
+ aRet=String(SchResId(STR_OBJECT_SECONDARY_X_AXIS));
+ break;
+ case 1://y-axis
+ if( nAxisIndex == 0 )
+ aRet=String(SchResId(STR_OBJECT_AXIS_Y));
+ else
+ aRet=String(SchResId(STR_OBJECT_SECONDARY_Y_AXIS));
+ break;
+ case 2://z-axis
+ aRet=String(SchResId(STR_OBJECT_AXIS_Z));
+ break;
+ default://axis
+ aRet=String(SchResId(STR_OBJECT_AXIS));
+ break;
+ }
+
+ return aRet;
+}
+
+//static
+OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType )
+{
+ OUString aRet;
+
+ switch(eType)
+ {
+ case TitleHelper::MAIN_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_MAIN));
+ break;
+ case TitleHelper::SUB_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SUB));
+ break;
+ case TitleHelper::X_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_X_AXIS));
+ break;
+ case TitleHelper::Y_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_Y_AXIS));
+ break;
+ case TitleHelper::Z_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_Z_AXIS));
+ break;
+ case TitleHelper::SECONDARY_X_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_X_AXIS));
+ break;
+ case TitleHelper::SECONDARY_Y_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_Y_AXIS));
+ break;
+ default:
+ DBG_ERROR("unknown title type");
+ break;
+ }
+
+ if( !aRet.getLength() )
+ aRet=String(SchResId(STR_OBJECT_TITLE));
+
+ return aRet;
+}
+
+//static
+OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel )
+{
+ OUString aRet;
+
+ Reference< XTitle > xTitle(
+ ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xTitle.is() )
+ {
+ TitleHelper::eTitleType eType;
+ if( TitleHelper::getTitleType( eType, xTitle, xChartModel ) )
+ aRet = ObjectNameProvider::getTitleNameByType( eType );
+ }
+ if( !aRet.getLength() )
+ aRet=String(SchResId(STR_OBJECT_TITLE));
+
+ return aRet;
+}
+
+//static
+rtl::OUString ObjectNameProvider::getGridName( const rtl::OUString& rObjectCID
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ rtl::OUString aRet;
+
+
+ sal_Int32 nCooSysIndex = -1;
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( rObjectCID , xChartModel ) );
+ AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram( xChartModel )
+ , nCooSysIndex , nDimensionIndex, nAxisIndex );
+
+ bool bMainGrid = (ObjectIdentifier::getObjectType( rObjectCID ) == OBJECTTYPE_GRID);
+
+ if( bMainGrid )
+ {
+ switch(nDimensionIndex)
+ {
+ case 0://x-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MAJOR_X));
+ break;
+ case 1://y-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MAJOR_Y));
+ break;
+ case 2://z-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MAJOR_Z));
+ break;
+ default://axis
+ aRet=String(SchResId(STR_OBJECT_GRID));
+ break;
+ }
+ }
+ else
+ {
+ switch(nDimensionIndex)
+ {
+ case 0://x-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MINOR_X));
+ break;
+ case 1://y-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MINOR_Y));
+ break;
+ case 2://z-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MINOR_Z));
+ break;
+ default://axis
+ aRet=String(SchResId(STR_OBJECT_GRID));
+ break;
+ }
+ }
+ return aRet;
+}
+
+rtl::OUString ObjectNameProvider::getHelpText( const rtl::OUString& rObjectCID, const Reference< chart2::XChartDocument >& xChartDocument, bool bVerbose )
+{
+ return getHelpText( rObjectCID, Reference< frame::XModel >( xChartDocument, uno::UNO_QUERY ), bVerbose );
+}
+
+rtl::OUString ObjectNameProvider::getHelpText( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel, bool bVerbose )
+{
+ rtl::OUString aRet;
+ ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) );
+ if( OBJECTTYPE_AXIS == eObjectType )
+ {
+ aRet=ObjectNameProvider::getAxisName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_GRID == eObjectType
+ || OBJECTTYPE_SUBGRID == eObjectType )
+ {
+ aRet=ObjectNameProvider::getGridName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_TITLE == eObjectType )
+ {
+ aRet=ObjectNameProvider::getTitleName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_DATA_SERIES == eObjectType )
+ {
+ aRet = lcl_getFullSeriesName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_DATA_POINT == eObjectType )
+ {
+ if( bVerbose )
+ {
+ OUString aNewLine(C2U("\n"));
+
+ aRet=String(SchResId(STR_TIP_DATAPOINT_INDEX));
+ aRet+=aNewLine;
+ aRet+=String(SchResId(STR_TIP_DATASERIES));
+ aRet+=aNewLine;
+ aRet+=String(SchResId(STR_TIP_DATAPOINT_VALUES));
+ }
+ else
+ aRet=String(SchResId(STR_TIP_DATAPOINT));
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xDiagram.is() && xSeries.is() )
+ {
+ sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() );
+
+ //replace data point index
+ sal_Int32 nIndex = -1;
+ OUString aWildcard( C2U("%POINTNUMBER") );
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::valueOf(nPointIndex+1) );
+ }
+
+ //replace data series index
+ aWildcard = C2U("%SERIESNUMBER");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ sal_Int32 nSeriesIndex = -1;
+ for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;)
+ {
+ if( aSeriesVector[nSeriesIndex] == xSeries )
+ {
+ break;
+ }
+ }
+
+ OUString aReplacement( OUString::valueOf(nSeriesIndex+1) );
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), aReplacement );
+ }
+
+ //replace point values
+ aWildcard = C2U("%POINTVALUES");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataPointValueText(
+ xSeries,nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartModel ) );
+
+ //replace series name
+ aWildcard = C2U("%SERIESNAME");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) );
+ }
+ }
+ /*
+ else if( OBJECTTYPE_DIAGRAM == eObjectType )
+ {
+ //todo different names for different diagram types ???
+ //or different names for series of diferent charttypes
+ }
+ */
+ else if( OBJECTTYPE_DATA_CURVE == eObjectType )
+ {
+ if( bVerbose )
+ {
+ aRet = String( SchResId( STR_OBJECT_CURVE_WITH_PARAMETERS ));
+ Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
+ Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ if( xCurveCnt.is())
+ {
+ Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ));
+ if( xCurve.is())
+ {
+ try
+ {
+ Reference< chart2::XRegressionCurveCalculator > xCalculator( xCurve->getCalculator(), uno::UNO_QUERY_THROW );
+ RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel );
+
+ // replace formula
+ sal_Int32 nIndex = -1;
+ OUString aWildcard( C2U("%FORMULA") );
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), xCalculator->getRepresentation());
+
+ // replace r^2
+ aWildcard = C2U("%RSQUARED");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ sal_Unicode aDecimalSep( '.' );
+ //@todo: enable this code when a localized decimal
+ //separator is also available for the formula
+// SvtSysLocale aSysLocale;
+// OUString aSep( aSysLocale.GetLocaleData().getNumDecimalSep());
+// if( aSep.getLength() == 1 )
+// aDecimalSep = aSep.toChar();
+ double fR( xCalculator->getCorrelationCoefficient());
+ aRet = aRet.replaceAt(
+ nIndex, aWildcard.getLength(),
+ ::rtl::math::doubleToUString(
+ fR*fR, rtl_math_StringFormat_G, 4, aDecimalSep, true ));
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ else
+ {
+ // non-verbose
+ aRet = ObjectNameProvider::getName( eObjectType, false );
+ }
+ }
+ else if( OBJECTTYPE_DATA_AVERAGE_LINE == eObjectType )
+ {
+ if( bVerbose )
+ {
+ aRet = String( SchResId( STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS ));
+ Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
+ Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ if( xCurveCnt.is())
+ {
+ Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getMeanValueLine( xCurveCnt ));
+ if( xCurve.is())
+ {
+ try
+ {
+ Reference< chart2::XRegressionCurveCalculator > xCalculator( xCurve->getCalculator(), uno::UNO_QUERY_THROW );
+ RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel );
+
+ sal_Unicode aDecimalSep( '.' );
+ // replace average value
+// SvtSysLocale aSysLocale;
+// OUString aSep( aSysLocale.GetLocaleData().getNumDecimalSep());
+// if( aSep.getLength() == 1 )
+// aDecimalSep = aSep.toChar();
+
+ sal_Int32 nIndex = -1;
+ OUString aWildcard( C2U("%AVERAGE_VALUE") );
+ nIndex = aRet.indexOf( aWildcard );
+ // as the curve is constant, the value at any x-value is ok
+ if( nIndex != -1 )
+ {
+ const double fMeanValue( xCalculator->getCurveValue( 0.0 ));
+ aRet = aRet.replaceAt(
+ nIndex, aWildcard.getLength(),
+ ::rtl::math::doubleToUString(
+ fMeanValue, rtl_math_StringFormat_G, 4, aDecimalSep, true ));
+ }
+
+ // replace standard deviation
+ aWildcard = C2U("%STD_DEVIATION");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ const double fStdDev( xCalculator->getCorrelationCoefficient());
+ aRet = aRet.replaceAt(
+ nIndex, aWildcard.getLength(),
+ ::rtl::math::doubleToUString(
+ fStdDev, rtl_math_StringFormat_G, 4, aDecimalSep, true ));
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ else
+ {
+ // non-verbose
+ aRet = ObjectNameProvider::getName( eObjectType, false );
+ }
+ }
+ else
+ {
+ aRet = ObjectNameProvider::getName( eObjectType, false );
+ }
+ return aRet;
+}
+
+// static
+rtl::OUString ObjectNameProvider::getSelectedObjectText( const rtl::OUString & rObjectCID, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument )
+{
+ rtl::OUString aRet;
+ ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) );
+ Reference< frame::XModel > xChartModel( xChartDocument, uno::UNO_QUERY );
+
+ if( OBJECTTYPE_DATA_POINT == eObjectType )
+ {
+ aRet = String( SchResId( STR_STATUS_DATAPOINT_MARKED ));
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xDiagram.is() && xSeries.is() )
+ {
+ sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() );
+
+ // replace data point index
+ replaceParamterInString( aRet, C2U("%POINTNUMBER"), OUString::valueOf( nPointIndex + 1 ));
+
+ // replace data series index
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ sal_Int32 nSeriesIndex = -1;
+ for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;)
+ {
+ if( aSeriesVector[nSeriesIndex] == xSeries )
+ break;
+ }
+ replaceParamterInString( aRet, C2U("%SERIESNUMBER"), OUString::valueOf( nSeriesIndex + 1 ) );
+ }
+
+ // replace point value
+ replaceParamterInString( aRet, C2U("%POINTVALUES"), lcl_getDataPointValueText(
+ xSeries, nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartModel ) );
+ }
+ }
+ else
+ {
+ // use the verbose text including the formula for trend lines
+ const bool bVerbose( OBJECTTYPE_DATA_CURVE == eObjectType || OBJECTTYPE_DATA_AVERAGE_LINE == eObjectType );
+ const OUString aHelpText( getHelpText( rObjectCID, xChartModel, bVerbose ));
+ if( aHelpText.getLength())
+ {
+ aRet = String( SchResId( STR_STATUS_OBJECT_MARKED ));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), aHelpText );
+ }
+ }
+
+ return aRet;
+}
+
+
+// static
+rtl::OUString ObjectNameProvider::getNameForCID(
+ const rtl::OUString& rObjectCID,
+ const uno::Reference< chart2::XChartDocument >& xChartDocument )
+{
+ ObjectType eType( ObjectIdentifier::getObjectType( rObjectCID ));
+ Reference< frame::XModel > xModel( xChartDocument, uno::UNO_QUERY );
+
+ switch( eType )
+ {
+ case OBJECTTYPE_AXIS:
+ return getAxisName( rObjectCID, xModel );
+ case OBJECTTYPE_TITLE:
+ return getTitleName( rObjectCID, xModel );
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ return getGridName( rObjectCID, xModel );
+ case OBJECTTYPE_DATA_SERIES:
+ return lcl_getFullSeriesName( rObjectCID, xModel );
+ //case OBJECTTYPE_LEGEND_ENTRY:
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_CURVE:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ {
+ rtl::OUString aRet = lcl_getFullSeriesName( rObjectCID, xModel );
+ aRet += C2U(" ");
+ if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL )
+ {
+ aRet += getName( OBJECTTYPE_DATA_POINT );
+ sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID );
+ aRet += C2U(" ");
+ aRet += OUString::valueOf(nPointIndex+1);
+
+ if( eType == OBJECTTYPE_DATA_LABEL )
+ {
+ aRet += C2U(" ");
+ aRet += getName( OBJECTTYPE_DATA_LABEL );
+ }
+ }
+ else
+ aRet += getName( eType );
+ return aRet;
+ }
+ default:
+ break;
+ }
+
+ return getName( eType );
+}
+
+//static
+rtl::OUString ObjectNameProvider::getName_ObjectForSeries(
+ ObjectType eObjectType,
+ const rtl::OUString& rSeriesCID,
+ const uno::Reference< chart2::XChartDocument >& xChartDocument )
+{
+ uno::Reference< frame::XModel> xChartModel( xChartDocument, uno::UNO_QUERY );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartModel ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ OUString aRet = String(SchResId(STR_OBJECT_FOR_SERIES));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, false /*bPlural*/ ) );
+ replaceParamterInString( aRet, C2U("%SERIESNAME"), lcl_getDataSeriesName( rSeriesCID, xChartModel ) );
+ return aRet;
+ }
+ else
+ return ObjectNameProvider::getName_ObjectForAllSeries( eObjectType );
+}
+
+//static
+rtl::OUString ObjectNameProvider::getName_ObjectForAllSeries( ObjectType eObjectType )
+{
+ OUString aRet = String(SchResId(STR_OBJECT_FOR_ALL_SERIES));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, true /*bPlural*/ ) );
+ return aRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/RangeEdit.cxx b/chart2/source/controller/dialogs/RangeEdit.cxx
new file mode 100644
index 000000000000..9d17ea541aff
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeEdit.cxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RangeEdit.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeEdit.hxx"
+
+namespace chart
+{
+
+//============================================================================
+// class RangeEdit
+//----------------------------------------------------------------------------
+RangeEdit::RangeEdit( Window* pParent, const ResId& rResId):
+ Edit( pParent , rResId )
+{
+ EnableUpdateData( 1000 );
+}
+
+RangeEdit::~RangeEdit()
+{
+}
+
+void RangeEdit::SetKeyInputHdl( const Link& rKeyInputLink )
+{
+ m_aKeyInputLink = rKeyInputLink;
+}
+
+void RangeEdit::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode& rKeyCode = rKEvt.GetKeyCode();
+ if( !rKeyCode.GetModifier() && rKeyCode.GetCode() == KEY_F2 )
+ {
+ if ( m_aKeyInputLink.IsSet() )
+ {
+ m_aKeyInputLink.Call( NULL );
+ }
+ }
+ else
+ Edit::KeyInput( rKEvt );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/RangeSelectionButton.cxx b/chart2/source/controller/dialogs/RangeSelectionButton.cxx
new file mode 100644
index 000000000000..9e0749e91bb3
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeSelectionButton.cxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RangeSelectionButton.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeSelectionButton.hxx"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+RangeSelectionButton::RangeSelectionButton( Window *pParent, const ResId& rResId ) :
+ ImageButton( pParent, rResId )
+{
+ SetModeImage( Image( SchResId(IMG_SELECTRANGE) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SchResId(IMG_SELECTRANGE_HC) ), BMP_COLOR_HIGHCONTRAST );
+ this->SetQuickHelpText(SchResId(STR_TIP_SELECT_RANGE));
+}
+
+RangeSelectionButton::~RangeSelectionButton()
+{
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
new file mode 100644
index 000000000000..88f93413ce67
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RangeSelectionHelper.cxx,v $
+ * $Revision: 1.4.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeSelectionHelper.hxx"
+#include "RangeSelectionListener.hxx"
+#include "macros.hxx"
+#include "ControllerLockGuard.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/XComponentSupplier.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XCellRangesAccess.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// ----------------------------------------
+
+namespace chart
+{
+
+RangeSelectionHelper::RangeSelectionHelper(
+ const Reference< chart2::XChartDocument > & xChartDocument ) :
+ m_xChartDocument( xChartDocument )
+{}
+
+RangeSelectionHelper::~RangeSelectionHelper()
+{}
+
+bool RangeSelectionHelper::hasRangeSelection()
+{
+ return getRangeSelection().is();
+}
+
+Reference< sheet::XRangeSelection > RangeSelectionHelper::getRangeSelection()
+{
+ if( !m_xRangeSelection.is() &&
+ m_xChartDocument.is() )
+ {
+ try
+ {
+ Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
+ if( xDataProvider.is())
+ m_xRangeSelection.set( xDataProvider->getRangeSelection());
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+
+ m_xRangeSelection.clear();
+ }
+ }
+
+ return m_xRangeSelection;
+}
+
+void RangeSelectionHelper::raiseRangeSelectionDocument()
+{
+ Reference< sheet::XRangeSelection > xRangeSel( getRangeSelection());
+ if( xRangeSel.is())
+ {
+ try
+ {
+ // bring document to front
+ Reference< frame::XController > xCtrl( xRangeSel, uno::UNO_QUERY );
+ if( xCtrl.is())
+ {
+ Reference< frame::XFrame > xFrame( xCtrl->getFrame());
+ if( xFrame.is())
+ {
+ Reference< awt::XTopWindow > xWin( xFrame->getContainerWindow(),
+ uno::UNO_QUERY_THROW );
+ xWin->toFront();
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+bool RangeSelectionHelper::chooseRange(
+ const OUString & aCurrentRange,
+ const OUString & aUIString,
+ RangeSelectionListenerParent & rListenerParent )
+{
+ ControllerLockGuard aGuard( Reference< frame::XModel >(m_xChartDocument, uno::UNO_QUERY ) );
+
+ bool bResult = true;
+ raiseRangeSelectionDocument();
+
+ try
+ {
+ Reference< sheet::XRangeSelection > xRangeSel( getRangeSelection());
+ if( xRangeSel.is())
+ {
+ Sequence< beans::PropertyValue > aArgs( 4 );
+ aArgs[0] = beans::PropertyValue(
+ C2U("InitialValue"), -1, uno::makeAny( aCurrentRange ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ C2U("Title"), -1,
+ uno::makeAny( aUIString ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ C2U("CloseOnMouseRelease"), -1, uno::makeAny( true ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[3] = beans::PropertyValue(
+ C2U("MultiSelectionMode"), -1, uno::makeAny( true ),
+ beans::PropertyState_DIRECT_VALUE );
+
+ if( m_xRangeSelectionListener.is() )
+ stopRangeListening();
+ m_xRangeSelectionListener.set( Reference< sheet::XRangeSelectionListener >(
+ new RangeSelectionListener( rListenerParent, aCurrentRange, Reference< frame::XModel >(m_xChartDocument, uno::UNO_QUERY ) )));
+
+ xRangeSel->addRangeSelectionListener( m_xRangeSelectionListener );
+ xRangeSel->startRangeSelection( aArgs );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ bResult = false;
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return bResult;
+}
+
+void RangeSelectionHelper::stopRangeListening( bool bRemoveListener /* = true */ )
+{
+ if( bRemoveListener &&
+ m_xRangeSelectionListener.is() &&
+ m_xRangeSelection.is() )
+ {
+ m_xRangeSelection->removeRangeSelectionListener( m_xRangeSelectionListener );
+ }
+
+ m_xRangeSelectionListener = 0;
+}
+
+bool RangeSelectionHelper::verifyCellRange( const OUString & rRangeStr )
+{
+ Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
+ if( ! xDataProvider.is())
+ return false;
+
+ return xDataProvider->createDataSequenceByRangeRepresentationPossible( rRangeStr );
+}
+
+bool RangeSelectionHelper::verifyArguments( const Sequence< beans::PropertyValue > & rArguments )
+{
+ Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
+ if( ! xDataProvider.is())
+ return false;
+
+ return xDataProvider->createDataSourcePossible( rArguments );
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/RangeSelectionListener.cxx b/chart2/source/controller/dialogs/RangeSelectionListener.cxx
new file mode 100644
index 000000000000..397124581280
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeSelectionListener.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RangeSelectionListener.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeSelectionListener.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+RangeSelectionListener::RangeSelectionListener(
+ RangeSelectionListenerParent & rParent,
+ const ::rtl::OUString & rInitialRange,
+ const Reference< frame::XModel >& xModelToLockController ) :
+ m_rParent( rParent ),
+ m_aRange( rInitialRange ),
+ m_aControllerLockGuard( xModelToLockController )
+{}
+
+RangeSelectionListener::~RangeSelectionListener()
+{}
+
+// ____ XRangeSelectionListener ____
+void SAL_CALL RangeSelectionListener::done( const sheet::RangeSelectionEvent& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_aRange = aEvent.RangeDescriptor;
+ m_rParent.listeningFinished( m_aRange );
+}
+
+void SAL_CALL RangeSelectionListener::aborted( const sheet::RangeSelectionEvent& /*aEvent*/ )
+ throw (uno::RuntimeException)
+{
+ m_rParent.listeningFinished( m_aRange );
+}
+
+// ____ XEventListener ____
+void SAL_CALL RangeSelectionListener::disposing( const lang::EventObject& /*Source*/ )
+ throw (uno::RuntimeException)
+{
+ m_rParent.disposingRangeSelection();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/ResourceIds.hrc b/chart2/source/controller/dialogs/ResourceIds.hrc
new file mode 100644
index 000000000000..8674aba240da
--- /dev/null
+++ b/chart2/source/controller/dialogs/ResourceIds.hrc
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ResourceIds.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_RESOURCE_IDS_HRC
+#define _CHART2_RESOURCE_IDS_HRC
+
+//-----------------------------------------------------------------------------
+//for strings see Strings.hrc
+
+//-----------------------------------------------------------------------------
+//for Bimaps see Bimaps.hrc and Bimaps_HC.hrc
+
+//-----------------------------------------------------------------------------
+//Dialog Ids:
+#define DLG_DIAGRAM_TYPE 743
+#define DLG_CHART_WIZARD 902
+#define DLG_DATA_SOURCE 901
+#define DLG_AXIS_OR_GRID 839
+#define DLG_DATA_DESCR 836
+#define DLG_LEGEND 835
+#define DLG_TITLE 834
+#define DLG_3D_VIEW 752
+#define DLG_OBJECT_PROPERTIES 903
+#define DLG_SPLINE_PROPERTIES 904
+#define DLG_DATA_TRENDLINE 841
+#define DLG_DATA_YERRORBAR 842
+
+//-----------------------------------------------------------------------------
+//TabPage Ids:
+#define TP_LEGEND_POS 900
+#define TP_DATA_DESCR 901
+#define TP_ALIGNMENT 902
+//#define TP_SYMBOL 906
+#define TP_LAYOUT 907
+#define TP_OPTIONS 908
+#define TP_POLAROPTIONS 909
+#define TP_AXIS_LABEL 920
+#define TP_SCALE 903
+#define TP_AXIS_POSITIONS 904
+#define TP_CHARTTYPE 910
+#define TP_RANGECHOOSER 911
+#define TP_WIZARD_TITLEANDOBJECTS 912
+#define TP_LOCATION 913
+#define TP_DATA_SOURCE 914
+
+#define TP_3D_SCENEGEOMETRY 915
+#define TP_3D_SCENEAPPEARANCE 916
+#define TP_3D_SCENEILLUMINATION 917
+
+#define TP_TRENDLINE 918
+#define TP_YERRORBAR 919
+
+//-----------------------------------------------------------------------------
+//listbox Ids:
+#define LB_BAR_GEOMETRY 1000
+#define LB_TEXT_SEPARATOR 1001
+
+//-----------------------------------------------------------------------------
+
+#endif
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
new file mode 100644
index 000000000000..b7ef643e3ff3
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -0,0 +1,606 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Strings.src,v $
+ * $Revision: 1.12.72.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_DLG_CHART_WIZARD
+{
+ Text [ en-US ] = "Chart Wizard" ;
+};
+
+String STR_DLG_SMOOTH_LINE_PROPERTIES
+{
+ Text [ en-US ] = "Smooth Lines" ;
+};
+
+String STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE
+{
+ Text [ en-US ] = "Number Format for Percentage Value" ;
+};
+
+String STR_PAGE_CHARTTYPE
+{
+ Text [ en-US ] = "Chart Type" ;
+};
+
+String STR_PAGE_DATA_RANGE
+{
+ Text [ en-US ] = "Data Range";
+};
+
+String STR_PAGE_CHART_ELEMENTS
+{
+ Text [ en-US ] = "Chart Elements";
+};
+
+String STR_PAGE_CHART_LOCATION
+{
+ Text [ en-US ] = "Chart Location";
+};
+
+String STR_PAGE_LINE
+{
+ Text [ en-US ] = "Line" ;
+};
+
+String STR_PAGE_BORDER
+{
+ Text [ en-US ] = "Borders" ;
+};
+
+String STR_PAGE_AREA
+{
+ Text [ en-US ] = "Area" ;
+};
+
+String STR_PAGE_TRANSPARENCY
+{
+ Text [ en-US ] = "Transparency";
+};
+
+String STR_PAGE_FONT
+{
+ Text [ en-US ] = "Font" ;
+};
+
+String STR_PAGE_FONT_EFFECTS
+{
+ Text [ en-US ] = "Font Effects" ;
+};
+
+String STR_PAGE_NUMBERS
+{
+ Text [ en-US ] = "Numbers" ;
+};
+
+String STR_PAGE_POSITION
+{
+ Text [ en-US ] = "Position" ;
+};
+
+String STR_PAGE_LAYOUT
+{
+ Text [ en-US ] = "Layout";
+};
+
+String STR_PAGE_OPTIONS
+{
+ Text [ en-US ] = "Options";
+};
+
+String STR_PAGE_SCALE
+{
+ Text [ en-US ] = "Scale" ;
+};
+
+String STR_PAGE_POSITIONING
+{
+ Text [ en-US ] = "Positioning" ;
+};
+
+// String STR_PAGE_STATISTICS
+// {
+// Text [ en-US ] = "Statistics" ;
+// };
+
+String STR_PAGE_TRENDLINE_TYPE
+{
+ Text[ en-US ] = "Type";
+};
+
+String STR_PAGE_YERROR_BARS
+{
+ Text[ en-US ] = "Y Error Bars";
+};
+
+String STR_PAGE_ALIGNMENT
+{
+ Text [ en-US ] = "Alignment" ;
+};
+
+String STR_PAGE_PERSPECTIVE
+{
+ Text [ en-US ] = "Perspective" ;
+};
+String STR_PAGE_APPEARANCE
+{
+ Text [ en-US ] = "Appearance" ;
+};
+String STR_PAGE_ILLUMINATION
+{
+ Text [ en-US ] = "Illumination" ;
+};
+
+String STR_PAGE_ASIAN
+{
+ Text [ en-US ] = "Asian Typography" ;
+};
+
+String STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS
+{
+ Text [ en-US ] = "Mean value line with value %AVERAGE_VALUE and standard deviation %STD_DEVIATION";
+};
+
+String STR_OBJECT_AXIS
+{
+ Text [ en-US ] = "Axis" ;
+};
+String STR_OBJECT_AXIS_X
+{
+ Text [ en-US ] = "X Axis" ;
+};
+String STR_OBJECT_AXIS_Y
+{
+ Text [ en-US ] = "Y Axis" ;
+};
+String STR_OBJECT_AXIS_Z
+{
+ Text [ en-US ] = "Z Axis" ;
+};
+String STR_OBJECT_SECONDARY_X_AXIS
+{
+ Text [ en-US ] = "Secondary X Axis" ;
+};
+String STR_OBJECT_SECONDARY_Y_AXIS
+{
+ Text [ en-US ] = "Secondary Y Axis" ;
+};
+
+String STR_OBJECT_AXES
+{
+ Text [ en-US ] = "Axes" ;
+};
+String STR_OBJECT_GRIDS
+{
+ Text [ en-US ] = "Grids" ;
+};
+String STR_OBJECT_GRID
+{
+ Text [ en-US ] = "Grid" ;
+};
+String STR_OBJECT_GRID_MAJOR_X
+{
+ Text [ en-US ] = "X Axis Major Grid" ;
+};
+String STR_OBJECT_GRID_MAJOR_Y
+{
+ Text [ en-US ] = "Y Axis Major Grid" ;
+};
+String STR_OBJECT_GRID_MAJOR_Z
+{
+ Text [ en-US ] = "Z Axis Major Grid" ;
+};
+String STR_OBJECT_GRID_MINOR_X
+{
+ Text [ en-US ] = "X Axis Minor Grid" ;
+};
+String STR_OBJECT_GRID_MINOR_Y
+{
+ Text [ en-US ] = "Y Axis Minor Grid" ;
+};
+String STR_OBJECT_GRID_MINOR_Z
+{
+ Text [ en-US ] = "Z Axis Minor Grid" ;
+};
+
+String STR_OBJECT_LEGEND
+{
+ Text [ en-US ] = "Legend" ;
+};
+
+String STR_OBJECT_TITLE
+{
+ Text [ en-US ] = "Title" ;
+};
+String STR_OBJECT_TITLES
+{
+ Text [ en-US ] = "Titles" ;
+};
+String STR_OBJECT_TITLE_MAIN
+{
+ Text [ en-US ] = "Main Title" ;
+};
+String STR_OBJECT_TITLE_SUB
+{
+ Text [ en-US ] = "Subtitle" ;
+};
+String STR_OBJECT_TITLE_X_AXIS
+{
+ Text [ en-US ] = "X Axis Title" ;
+};
+String STR_OBJECT_TITLE_Y_AXIS
+{
+ Text [ en-US ] = "Y Axis Title" ;
+};
+String STR_OBJECT_TITLE_Z_AXIS
+{
+ Text [ en-US ] = "Z Axis Title" ;
+};
+String STR_OBJECT_TITLE_SECONDARY_X_AXIS
+{
+ Text [ en-US ] = "Secondary X Axis Title" ;
+};
+String STR_OBJECT_TITLE_SECONDARY_Y_AXIS
+{
+ Text [ en-US ] = "Secondary Y Axis Title" ;
+};
+String STR_OBJECT_LABEL
+{
+ Text [ en-US ] = "Label" ;
+};
+
+String STR_OBJECT_DATALABELS
+{
+ Text [ en-US ] = "Data Labels" ;
+};
+String STR_OBJECT_DATAPOINT
+{
+ Text [ en-US ] = "Data Point" ;
+};
+String STR_OBJECT_DATAPOINTS
+{
+ Text [ en-US ] = "Data Points" ;
+};
+String STR_OBJECT_LEGEND_SYMBOL
+{
+ Text [ en-US ] = "Legend Key" ;
+};
+String STR_OBJECT_DATASERIES
+{
+ Text [ en-US ] = "Data Series" ;
+};
+String STR_OBJECT_DATASERIES_PLURAL
+{
+ Text [ en-US ] = "Data Series" ;
+};
+String STR_OBJECT_CURVE
+{
+ Text [ en-US ] = "Trend Line";
+};
+String STR_OBJECT_CURVES
+{
+ Text [ en-US ] = "Trend Lines";
+};
+String STR_OBJECT_CURVE_WITH_PARAMETERS
+{
+ Text [ en-US ] = "Trend line %FORMULA with accuracy R² = %RSQUARED";
+};
+String STR_OBJECT_AVERAGE_LINE
+{
+ Text [ en-US ] = "Mean Value Line";
+};
+String STR_OBJECT_CURVE_EQUATION
+{
+ Text[ en-US ] = "Equation";
+};
+
+String STR_OBJECT_ERROR_BARS
+{
+ Text [ en-US ] = "Error Bars";
+};
+String STR_OBJECT_STOCK_LOSS
+{
+ Text [ en-US ] = "Stock Loss";
+};
+
+String STR_OBJECT_STOCK_GAIN
+{
+ Text [ en-US ] = "Stock Gain";
+};
+
+String STR_OBJECT_PAGE
+{
+ Text [ en-US ] = "Chart Area" ;
+};
+String STR_OBJECT_DIAGRAM
+{
+ Text [ en-US ] = "Chart" ;
+};
+String STR_OBJECT_DIAGRAM_WALL
+{
+ Text [ en-US ] = "Chart Wall" ;
+};
+String STR_OBJECT_DIAGRAM_FLOOR
+{
+ Text [ en-US ] = "Chart Floor" ;
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+String STR_TIP_SELECT_RANGE
+{
+ Text [ en-US ] = "Select data range" ;
+};
+
+String STR_TIP_CHOOSECOLOR
+{
+ Text [ en-US ] = "Select a color using the color dialog" ;
+};
+
+String STR_TIP_LIGHTSOURCE_X
+{
+ Text [ en-US ] = "Light Source %LIGHTNUMBER" ;
+};
+
+String STR_TIP_DATASERIES
+{
+ Text [ en-US ] = "Data Series '%SERIESNAME'" ;
+};
+
+String STR_TIP_DATAPOINT_INDEX
+{
+ Text [ en-US ] = "Data Point %POINTNUMBER";
+};
+
+String STR_TIP_DATAPOINT_VALUES
+{
+ Text [ en-US ] = "Values: %POINTVALUES";
+};
+
+String STR_TIP_CATEGORY_VALUE
+{
+ Text [ en-US ] = "'%CATEGORYVALUE'";
+};
+
+String STR_TIP_DATAPOINT
+{
+ Text [ en-US ] = "Data Point %POINTNUMBER, data series %SERIESNUMBER, values: %POINTVALUES";
+};
+
+String STR_STATUS_DATAPOINT_MARKED
+{
+ Text [ en-US ] = "Data point %POINTNUMBER in data series %SERIESNUMBER selected, values: %POINTVALUES";
+};
+
+String STR_STATUS_OBJECT_MARKED
+{
+ Text [ en-US ] = "%OBJECTNAME selected" ;
+};
+
+String STR_STATUS_PIE_SEGMENT_EXPLODED
+{
+ Text [ en-US ] = "Pie exploded by %PERCENTVALUE percent";
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+String STR_OBJECT_FOR_SERIES
+{
+ Text [ en-US ] = "%OBJECTNAME for Data Series '%SERIESNAME'" ;
+};
+
+String STR_OBJECT_FOR_ALL_SERIES
+{
+ Text [ en-US ] = "%OBJECTNAME for all Data Series" ;
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+String STR_ACTION_EDIT_CHARTTYPE
+{
+ Text [ en-US ] = "Edit chart type" ;
+};
+String STR_ACTION_EDIT_DATA_RANGES
+{
+ Text [ en-US ] = "Edit data ranges" ;
+};
+String STR_ACTION_EDIT_3D_VIEW
+{
+ Text [ en-US ] = "Edit 3D view" ;
+};
+String STR_ACTION_EDIT_CHART_DATA
+{
+ Text [ en-US ] = "Edit chart data";
+};
+String STR_ACTION_TOGGLE_LEGEND
+{
+ Text [ en-US ] = "Legend on/off" ;
+};
+String STR_ACTION_TOGGLE_GRID_HORZ
+{
+ Text [ en-US ] = "Horizontal grid on/off" ;
+};
+String STR_ACTION_SCALE_TEXT
+{
+ Text [ en-US ] = "Scale Text" ;
+};
+String STR_ACTION_REARRANGE_CHART
+{
+ Text [ en-US ] = "Automatic Layout" ;
+};
+String STR_ACTION_NOTPOSSIBLE
+{
+ Text [ en-US ] = "This function cannot be completed with the selected objects." ;
+};
+
+String STR_COLUMN_LABEL
+{
+ Text [ en-US ] = "Column %COLUMNNUMBER" ;
+};
+String STR_ROW_LABEL
+{
+ Text [ en-US ] = "Row %ROWNUMBER" ;
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//for range didalog
+String STR_DATA_ROLE_LABEL
+{
+ Text [ en-US ] = "Name" ;
+};
+
+String STR_DATA_ROLE_X
+{
+ Text [ en-US ] = "X-Values" ;
+};
+
+String STR_DATA_ROLE_Y
+{
+ Text [ en-US ] = "Y-Values" ;
+};
+
+String STR_DATA_ROLE_SIZE
+{
+ Text [ en-US ] = "Bubble Sizes" ;
+};
+
+String STR_DATA_ROLE_X_ERROR
+{
+ Text [ en-US ] = "X-Error-Bars" ;
+};
+String STR_DATA_ROLE_X_ERROR_POSITIVE
+{
+ Text [ en-US ] = "Positive X-Error-Bars" ;
+};
+String STR_DATA_ROLE_X_ERROR_NEGATIVE
+{
+ Text [ en-US ] = "Negative X-Error-Bars" ;
+};
+
+String STR_DATA_ROLE_Y_ERROR
+{
+ Text [ en-US ] = "Y-Error-Bars" ;
+};
+String STR_DATA_ROLE_Y_ERROR_POSITIVE
+{
+ Text [ en-US ] = "Positive Y-Error-Bars" ;
+};
+String STR_DATA_ROLE_Y_ERROR_NEGATIVE
+{
+ Text [ en-US ] = "Negative Y-Error-Bars" ;
+};
+
+String STR_DATA_ROLE_FIRST
+{
+ Text [ en-US ] = "Open Values" ;
+};
+
+String STR_DATA_ROLE_LAST
+{
+ Text [ en-US ] = "Close Values" ;
+};
+
+String STR_DATA_ROLE_MIN
+{
+ Text [ en-US ] = "Low Values" ;
+};
+
+String STR_DATA_ROLE_MAX
+{
+ Text [ en-US ] = "High Values" ;
+};
+
+String STR_DATA_ROLE_CATEGORIES
+{
+ Text [ en-US ] = "Categories";
+};
+
+String STR_DATA_UNNAMED_SERIES
+{
+ Text [ en-US ] = "Unnamed Series";
+};
+
+String STR_DATA_UNNAMED_SERIES_WITH_INDEX
+{
+ Text [ en-US ] = "Unnamed Series %NUMBER" ;
+};
+
+String STR_DATA_SELECT_RANGE_FOR_SERIES
+{
+ Text [ en-US ] = "Select Range for %VALUETYPE of %SERIESNAME" ;
+};
+
+String STR_DATA_SELECT_RANGE_FOR_CATEGORIES
+{
+ Text [ en-US ] = "Select Range for Categories" ;
+};
+
+String STR_DATA_SELECT_RANGE_FOR_DATALABELS
+{
+ Text [ en-US ] = "Select Range for data labels" ;
+};
+String STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS
+{
+ Text [ en-US ] = "Select Range for Positive Error Bars" ;
+};
+String STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS
+{
+ Text [ en-US ] = "Select Range for Negative Error Bars" ;
+};
+
+String STR_DATA_EDITOR_INCORRECT_INPUT
+{
+ Text [ en-US ] = "Your last input is incorrect.\nIgnore this change and close the dialog?" ;
+};
+
+// frame direction ------------------------------------------------------------
+
+String STR_TEXT_DIRECTION_LTR
+{
+ Text [ en-US ] = "Left-to-right";
+};
+
+String STR_TEXT_DIRECTION_RTL
+{
+ Text [ en-US ] = "Right-to-left";
+};
+
+String STR_TEXT_DIRECTION_SUPER
+{
+ Text [ en-US ] = "Use superordinate object settings";
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
diff --git a/chart2/source/controller/dialogs/Strings_AdditionalControls.src b/chart2/source/controller/dialogs/Strings_AdditionalControls.src
new file mode 100644
index 000000000000..0da80dd482d2
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_AdditionalControls.src
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Strings_AdditionalControls.src,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_3DSCHEME_SIMPLE
+{
+ Text [ en-US ] = "Simple";
+};
+String STR_3DSCHEME_REALISTIC
+{
+ Text [ en-US ] = "Realistic";
+};
+String STR_3DSCHEME_CUSTOM
+{
+ Text [ en-US ] = "Custom";
+};
+
+String STR_BAR_GEOMETRY
+{
+ Text [ en-US ] = "Shape";
+};
+
+String STR_NUMBER_OF_LINES
+{
+ Text [ en-US ] = "~Number of lines";
+};
+
+String STR_TEXT_SEPARATOR
+{
+ Text [ en-US ] = "Separator";
+};
+
+//-----------------------------------
diff --git a/chart2/source/controller/dialogs/Strings_ChartTypes.src b/chart2/source/controller/dialogs/Strings_ChartTypes.src
new file mode 100644
index 000000000000..f2731b2971c2
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Strings_ChartTypes.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_TYPE_COLUMN
+{
+ Text [ en-US ] = "Column" ;
+};
+String STR_TYPE_BAR
+{
+ Text [ en-US ] = "Bar" ;
+};
+String STR_TYPE_AREA
+{
+ Text [ en-US ] = "Area" ;
+};
+String STR_TYPE_PIE
+{
+ Text [ en-US ] = "Pie" ;
+};
+String STR_PIE_EXPLODED
+{
+ Text [ en-US ] = "Exploded Pie Chart" ;
+};
+String STR_DONUT_EXPLODED
+{
+ Text [ en-US ] = "Exploded Donut Chart" ;
+};
+String STR_DONUT
+{
+ Text [ en-US ] = "Donut" ;
+};
+String STR_TYPE_LINE
+{
+ Text [ en-US ] = "Line" ;
+};
+String STR_TYPE_XY
+{
+ Text [ en-US ] = "XY (Scatter)" ;
+};
+String STR_POINTS_AND_LINES
+{
+ Text [ en-US ] = "Points and Lines" ;
+};
+String STR_POINTS_ONLY
+{
+ //@todo or symbols instead of points??
+ Text [ en-US ] = "Points Only" ;
+};
+String STR_LINES_ONLY
+{
+ Text [ en-US ] = "Lines Only" ;
+};
+String STR_LINES_3D
+{
+ Text [ en-US ] = "3D Lines" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_COMBI_COLUMN_LINE
+{
+ Text [ en-US ] = "Column and Line" ;
+};
+String STR_LINE_COLUMN
+{
+ Text [ en-US ] = "Columns and Lines" ;
+};
+String STR_LINE_STACKEDCOLUMN
+{
+ Text [ en-US ] = "Stacked Columns and Lines" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_NET
+{
+ Text [ en-US ] = "Net" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_STOCK
+{
+ Text [ en-US ] = "Stock";
+};
+String STR_STOCK_1
+{
+ Text [ en-US ] = "Stock Chart 1";
+};
+String STR_STOCK_2
+{
+ Text [ en-US ] = "Stock Chart 2";
+};
+String STR_STOCK_3
+{
+ Text [ en-US ] = "Stock Chart 3";
+};
+String STR_STOCK_4
+{
+ Text [ en-US ] = "Stock Chart 4";
+};
+//-----------------------------------------------------------------------------
+String STR_NORMAL
+{
+ Text [ en-US ] = "Normal" ;
+};
+String STR_STACKED
+{
+ Text [ en-US ] = "Stacked" ;
+};
+String STR_PERCENT
+{
+ Text [ en-US ] = "Percent Stacked" ;
+};
+
+String STR_DEEP
+{
+ Text [ en-US ] = "Deep" ;
+};
+String STR_FILLED
+{
+ Text [ en-US ] = "Filled" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_BUBBLE
+{
+ Text [ en-US ] = "Bubble" ;
+};
+String STR_BUBBLE_1
+{
+ Text [ en-US ] = "Bubble Chart" ;
+};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
diff --git a/chart2/source/controller/dialogs/Strings_Scale.src b/chart2/source/controller/dialogs/Strings_Scale.src
new file mode 100644
index 000000000000..b1234548b43d
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_Scale.src
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Strings_Scale.src,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_INVALID_NUMBER
+{
+ Text [ en-US ] = "Numbers are required. Check your input." ;
+};
+String STR_STEP_GT_ZERO
+{
+ Text [ en-US ] = "The major interval requires a positive number. Check your input." ;
+};
+String STR_BAD_LOGARITHM
+{
+ Text [ en-US ] = "The logarithmic scale requires positive numbers. Check your input." ;
+};
+String STR_MIN_GREATER_MAX
+{
+ Text [ en-US ] = "The minimum must be lower than the maximum. Check your input." ;
+};
diff --git a/chart2/source/controller/dialogs/Strings_Statistic.src b/chart2/source/controller/dialogs/Strings_Statistic.src
new file mode 100644
index 000000000000..9f6572c6ae82
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_Statistic.src
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Strings_Statistic.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+//SchStatisticTabPage and SchDataStatisticsDlg
+String STR_INDICATE_BOTH
+{
+ Text [ en-US ] = "Negative and Positive" ;
+};
+String STR_INDICATE_DOWN
+{
+ Text [ en-US ] = "Negative" ;
+};
+String STR_INDICATE_UP
+{
+ Text [ en-US ] = "Positive" ;
+};
+
+// used for own data in error bar dialog
+String STR_CONTROLTEXT_ERROR_BARS_FROM_DATA
+{
+ Text [ en-US ] = "From Data Table" ;
+};
+
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+
+String STR_REGRESSION_LINEAR
+{
+ Text [ en-US ] = "Linear Regression" ;
+};
+String STR_REGRESSION_LOG
+{
+ Text [ en-US ] = "Logarithmic Regression" ;
+};
+String STR_REGRESSION_EXP
+{
+ Text [ en-US ] = "Exponential Regression" ;
+};
+String STR_REGRESSION_POWER
+{
+ Text [ en-US ] = "Power Regression" ;
+};
+
+String STR_STATISTICS_IN_LEGEND
+{
+ Text [ en-US ] = "%REGRESSIONCURVE for %SERIESNAME" ;
+};
diff --git a/chart2/source/controller/dialogs/TabPages.hrc b/chart2/source/controller/dialogs/TabPages.hrc
new file mode 100644
index 000000000000..8c92c062ad14
--- /dev/null
+++ b/chart2/source/controller/dialogs/TabPages.hrc
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TabPages.hrc,v $
+ * $Revision: 1.7.20.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_TABPAGES_HRC
+#define CHART_TABPAGES_HRC
+
+#include "ResourceIds.hrc"
+
+//see attrib.hrc in old chart
+
+//#define TP_LEGEND_POS 900
+#define GRP_LEGEND 1
+#define FL_LEGEND_TEXTORIENT 2
+#define FT_LEGEND_TEXTDIR 3
+#define LB_LEGEND_TEXTDIR 4
+
+//#define TP_DATA_DESCR 901
+
+//#define TP_ALIGNMENT 902
+////#define FL_ORDER 2
+////#define RBT_SIDEBYSIDE 1
+////#define RBT_UPDOWN 2
+////#define RBT_DOWNUP 3
+////#define RBT_AUTOORDER 4
+
+//#define TP_STAT 905
+#define FL_TEXTBREAK 3
+#define CBX_TEXTBREAK 2
+#define CBX_TEXTOVERLAP 4
+
+//Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES
+// ID's for title rotation tabpage
+#define CTR_DIAL 6030
+#define BTN_TXTSTACKED 6031
+#define FT_DEGREES 6032
+#define NF_ORIENT 6033
+#define CTR_DUMMY 6034
+#define FT_DUMMY 6035
+#define FL_ALIGN 6037
+#define FT_TEXTDIR 6038
+#define LB_TEXTDIR 6039
+
+/*
+//Symbol-Tabpage (zum Teil sehr Aehnlich der SVX_AREA_TABPAGE) (obsolete)
+//#define TP_SYMBOL 906
+#define RBT_COLOR 1
+#define RBT_GRADIENT 2
+#define RBT_HATCHING 3
+#define RBT_BITMAP 4
+#define RBT_INVISIBLE 5
+#define LB_COLOR 1
+#define LB_GRADIENT 2
+#define LB_HATCHING 3
+#define LB_BITMAP 4
+
+#define GRP_FILL 1
+#define CTL_BITMAP_PREVIEW 6
+*/
+
+//------------
+//from old chart tplabel.hrc
+
+//#define TP_AXIS_LABEL 920
+
+#define CB_AXIS_LABEL_SCHOW_DESCR 1
+
+//#define FL_AXIS_LABEL_FORMATTING 2
+
+#define FL_AXIS_LABEL_ORIENTATION 3
+#define CT_AXIS_LABEL_DIAL 4
+#define PB_AXIS_LABEL_TEXTSTACKED 5
+#define FT_AXIS_LABEL_DEGREES 6
+#define NF_AXIS_LABEL_ORIENT 7
+#define FT_UNUSED 8
+#define CT_UNUSED 9
+
+#define FL_AXIS_LABEL_TEXTFLOW 10
+#define CB_AXIS_LABEL_TEXTOVERLAP 11
+#define CB_AXIS_LABEL_TEXTBREAK 12
+
+#define FL_AXIS_LABEL_ORDER 13
+#define RB_AXIS_LABEL_SIDEBYSIDE 14
+#define RB_AXIS_LABEL_UPDOWN 15
+#define RB_AXIS_LABEL_DOWNUP 16
+#define RB_AXIS_LABEL_AUTOORDER 17
+
+#define FL_SEPARATOR 18
+
+#define FT_AXIS_TEXTDIR 19
+#define LB_AXIS_TEXTDIR 20
+
+//#define TP_SCALE 903
+
+#define FL_SCALE 1
+
+#define TXT_MIN 1
+#define TXT_MAX 2
+#define TXT_STEP_MAIN 3
+#define TXT_STEP_HELP 4
+#define TXT_ORIGIN 5
+
+#define CBX_AUTO_MIN 1
+#define CBX_AUTO_MAX 2
+#define CBX_AUTO_STEP_MAIN 3
+#define CBX_AUTO_STEP_HELP 4
+#define CBX_AUTO_ORIGIN 5
+#define CBX_LOGARITHM 6
+#define CBX_REVERSE 7
+
+#define EDT_STEP_MAIN 1
+#define EDT_MAX 2
+#define EDT_MIN 3
+#define EDT_ORIGIN 4
+
+#define MT_STEPHELP 10
+
+//#define TP_AXIS_POSITIONS 904
+
+#define FL_AXIS_LINE 1
+#define FL_LABELS 2
+#define FL_TICKS 3
+#define FL_VERTICAL 4
+#define FL_GRIDS 5
+
+#define FT_CROSSES_OTHER_AXIS_AT 1
+#define FT_AXIS_LABEL_DISTANCE 2
+#define FT_PLACE_LABELS 3
+#define FT_MAJOR 4
+#define FT_MINOR 5
+#define FT_PLACE_TICKS 6
+
+#define LB_CROSSES_OTHER_AXIS_AT 1
+#define LB_PLACE_LABELS 2
+#define EDT_CROSSES_OTHER_AXIS_AT 3
+#define EDT_CROSSES_OTHER_AXIS_AT_CATEGORY 4
+#define EDT_AXIS_LABEL_DISTANCE 5
+#define LB_PLACE_TICKS 6
+
+#define CB_AXIS_BETWEEN_CATEGORIES 1
+#define CB_TICKS_INNER 2
+#define CB_TICKS_OUTER 3
+#define CB_MINOR_INNER 4
+#define CB_MINOR_OUTER 5
+#define CB_MAJOR_GRID 6
+#define CB_MINOR_GRID 7
+
+#define PB_MAJOR_GRID 1
+#define PB_MINOR_GRID 2
+
+#endif
diff --git a/chart2/source/controller/dialogs/TextDirectionListBox.cxx b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
new file mode 100644
index 000000000000..f049f77ee312
--- /dev/null
+++ b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TextDirectionListBox.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "TextDirectionListBox.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include <svl/languageoptions.hxx>
+#include <vcl/window.hxx>
+
+namespace chart
+{
+
+TextDirectionListBox::TextDirectionListBox( Window* pParent, const ResId& rResId, Window* pWindow1, Window* pWindow2 ) :
+ svx::FrameDirectionListBox( pParent, rResId )
+{
+ InsertEntryValue( String( SchResId( STR_TEXT_DIRECTION_LTR ) ), FRMDIR_HORI_LEFT_TOP );
+ InsertEntryValue( String( SchResId( STR_TEXT_DIRECTION_RTL ) ), FRMDIR_HORI_RIGHT_TOP );
+ InsertEntryValue( String( SchResId( STR_TEXT_DIRECTION_SUPER ) ), FRMDIR_ENVIRONMENT );
+
+ if( !SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ Hide();
+ if( pWindow1 ) pWindow1->Hide();
+ if( pWindow2 ) pWindow2->Hide();
+ }
+}
+
+TextDirectionListBox::~TextDirectionListBox()
+{
+}
+
+} //namespace chart
+
diff --git a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
new file mode 100644
index 000000000000..54d520eef94d
--- /dev/null
+++ b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TimerTriggeredControllerLock.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "TimerTriggeredControllerLock.hxx"
+
+// header for define EDIT_UPDATEDATA_TIMEOUT
+#include <vcl/edit.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+
+TimerTriggeredControllerLock::TimerTriggeredControllerLock( const uno::Reference< frame::XModel >& xModel )
+ : m_xModel( xModel )
+ , m_apControllerLockGuard()
+ , m_aTimer()
+{
+ m_aTimer.SetTimeout( 4*EDIT_UPDATEDATA_TIMEOUT );
+ m_aTimer.SetTimeoutHdl( LINK( this, TimerTriggeredControllerLock, TimerTimeout ) );
+}
+TimerTriggeredControllerLock::~TimerTriggeredControllerLock()
+{
+ m_aTimer.Stop();
+}
+
+void TimerTriggeredControllerLock::startTimer()
+{
+ if(!m_apControllerLockGuard.get())
+ m_apControllerLockGuard = std::auto_ptr< ControllerLockGuard >( new ControllerLockGuard(m_xModel) );
+ m_aTimer.Start();
+}
+IMPL_LINK( TimerTriggeredControllerLock, TimerTimeout, void*, EMPTYARG )
+{
+ m_apControllerLockGuard.reset();
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/TitleDialogData.cxx b/chart2/source/controller/dialogs/TitleDialogData.cxx
new file mode 100644
index 000000000000..4f5418df04cc
--- /dev/null
+++ b/chart2/source/controller/dialogs/TitleDialogData.cxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TitleDialogData.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "TitleDialogData.hxx"
+#include "TitleHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+TitleDialogData::TitleDialogData( ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider )
+ : aPossibilityList(7)
+ , aExistenceList(7)
+ , aTextList(7)
+ , apReferenceSizeProvider( apRefSizeProvider )
+{
+ sal_Int32 nN = 0;
+ for(nN=7;nN--;)
+ aPossibilityList[nN]=sal_True;
+ for(nN=7;nN--;)
+ aExistenceList[nN]=sal_False;
+}
+
+void TitleDialogData::readFromModel( const uno::Reference< frame::XModel>& xChartModel )
+{
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(xChartModel);
+
+ //get possibilities
+ uno::Sequence< sal_Bool > aAxisPossibilityList;
+ AxisHelper::getAxisOrGridPossibilities( aAxisPossibilityList, xDiagram );
+ this->aPossibilityList[2]=aAxisPossibilityList[0];//x axis title
+ this->aPossibilityList[3]=aAxisPossibilityList[1];//y axis title
+ this->aPossibilityList[4]=aAxisPossibilityList[2];//z axis title
+ this->aPossibilityList[5]=aAxisPossibilityList[3];//secondary x axis title
+ this->aPossibilityList[6]=aAxisPossibilityList[4];//secondary y axis title
+
+ //find out which title exsist and get their text
+ //main title:
+ for( sal_Int32 nTitleIndex = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN);
+ nTitleIndex < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END );
+ nTitleIndex++)
+ {
+ uno::Reference< XTitle > xTitle = TitleHelper::getTitle(
+ static_cast< TitleHelper::eTitleType >( nTitleIndex ), xChartModel );
+ this->aExistenceList[nTitleIndex] = xTitle.is();
+ this->aTextList[nTitleIndex]=TitleHelper::getCompleteString( xTitle );
+ }
+}
+
+bool TitleDialogData::writeDifferenceToModel(
+ const uno::Reference< frame::XModel >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext
+ , TitleDialogData* pOldState )
+{
+ bool bChanged = false;
+ for( sal_Int32 nN = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN );
+ nN < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END );
+ nN++)
+ {
+ if( !pOldState || ( pOldState->aExistenceList[nN] != this->aExistenceList[nN] ) )
+ {
+ if(this->aExistenceList[nN])
+ {
+ TitleHelper::createTitle(
+ static_cast< TitleHelper::eTitleType >( nN ), this->aTextList[nN], xChartModel, xContext,
+ apReferenceSizeProvider.get() );
+ bChanged = true;
+ }
+ else
+ {
+ TitleHelper::removeTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel );
+ bChanged = true;
+ }
+ }
+ else if( !pOldState || ( pOldState->aTextList[nN] != this->aTextList[nN] ) )
+ {
+ //change content
+ uno::Reference< XTitle > xTitle(
+ TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel ) );
+ if(xTitle.is())
+ {
+ TitleHelper::setCompleteString( this->aTextList[nN], xTitle, xContext );
+ bChanged = true;
+ }
+ }
+ }
+ return bChanged;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx
new file mode 100644
index 000000000000..74e112132d87
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_ChartType.cxx,v $
+ * $Revision: 1.15 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_ChartType.hxx"
+#include "dlg_ChartType.hrc"
+#include "ResId.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "tp_ChartType.hxx"
+#include "macros.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+ChartTypeDialog::ChartTypeDialog( Window* pParent
+ , const uno::Reference< frame::XModel >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+ : ModalDialog( pParent, SchResId( DLG_DIAGRAM_TYPE ))
+ , m_aFL( this, SchResId( FL_BUTTONS ) )
+ , m_aBtnOK( this, SchResId( BTN_OK ) )
+ , m_aBtnCancel( this, SchResId( BTN_CANCEL ) )
+ , m_aBtnHelp( this, SchResId( BTN_HELP ) )
+ , m_pChartTypeTabPage(0)
+ , m_xChartModel(xChartModel)
+ , m_xCC( xContext )
+{
+ FreeResource();
+
+ this->SetText(String(SchResId(STR_PAGE_CHARTTYPE)));
+
+ //don't create the tabpages before FreeResource, otherwise the help ids are not matched correctly
+ m_pChartTypeTabPage = new ChartTypeTabPage(this,uno::Reference< XChartDocument >::query(m_xChartModel),m_xCC,true/*live update*/,true/*hide title description*/);
+ m_pChartTypeTabPage->initializePage();
+ m_pChartTypeTabPage->Show();
+ }
+
+ChartTypeDialog::~ChartTypeDialog()
+{
+ delete m_pChartTypeTabPage;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.hrc b/chart2/source/controller/dialogs/dlg_ChartType.hrc
new file mode 100644
index 000000000000..2c7af5c390ab
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_ChartType.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define TABCTRL 1
+
+#define FL_BUTTONS 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.src b/chart2/source/controller/dialogs/dlg_ChartType.src
new file mode 100644
index 000000000000..819462716bb6
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType.src
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_ChartType.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_ChartType.hrc"
+#include "dlg_CreationWizard.hrc"
+#include "HelpIds.hrc"
+#include "SchSlotIds.hxx"
+
+// for BUTTONS_OK_CANCEL_HELP_STACKED
+#include "CommonResources.hrc"
+
+#define CHART_TYPE_DLG_HEIGHT (CHART_WIZARD_PAGEHEIGHT+18)
+#define CHART_TYPE_DLG_WIDTH (CHART_WIZARD_PAGEWIDTH - 7)
+
+ModalDialog DLG_DIAGRAM_TYPE
+{
+ HelpID = SID_DIAGRAM_TYPE ;
+
+ Size = MAP_APPFONT ( CHART_TYPE_DLG_WIDTH , CHART_TYPE_DLG_HEIGHT ) ;
+
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , CHART_TYPE_DLG_HEIGHT-24 ) ;
+ Size = MAP_APPFONT ( CHART_TYPE_DLG_WIDTH , 8 ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP( CHART_TYPE_DLG_WIDTH-161 ,CHART_TYPE_DLG_HEIGHT-17 , 53, 0 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
new file mode 100644
index 000000000000..4cbc53bf453f
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_ChartType_UNO.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_ChartType_UNO.hxx"
+#include "dlg_ChartType.hxx"
+#include "servicenames.hxx"
+#include <osl/mutex.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+uno::Reference< uno::XInterface >
+ SAL_CALL ChartTypeUnoDlg::Create(const uno::Reference< uno::XComponentContext >& _xContext)
+{
+ return *(new ChartTypeUnoDlg(_xContext));
+}
+// -----------------------------------------------------------------------------
+ChartTypeUnoDlg::ChartTypeUnoDlg( const uno::Reference< uno::XComponentContext >& _xContext )
+ : ChartTypeUnoDlg_BASE( _xContext )
+{
+}
+// -----------------------------------------------------------------------------
+ChartTypeUnoDlg::~ChartTypeUnoDlg()
+{
+ // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
+ // so this virtual-method-call the base class does does not work, we're already dead then ...
+ if (m_pDialog)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (m_pDialog)
+ destroyDialog();
+ }
+}
+//-------------------------------------------------------------------------
+// lang::XServiceInfo
+//-------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ChartTypeUnoDlg::getImplementationName() throw(uno::RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+//-------------------------------------------------------------------------
+::rtl::OUString ChartTypeUnoDlg::getImplementationName_Static() throw(uno::RuntimeException)
+{
+ return CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME;
+}
+
+//-------------------------------------------------------------------------
+::comphelper::StringSequence SAL_CALL ChartTypeUnoDlg::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+
+//-------------------------------------------------------------------------
+
+uno::Sequence< rtl::OUString > ChartTypeUnoDlg::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART_TYPE_DIALOG_SERVICE_NAME;
+ return aSNS;
+}
+//-------------------------------------------------------------------------
+uno::Sequence< sal_Int8 > SAL_CALL ChartTypeUnoDlg::getImplementationId( void ) throw( uno::RuntimeException )
+{
+ static ::cppu::OImplementationId aId;
+ return aId.getImplementationId();
+}
+//------------------------------------------------------------------------------
+void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
+{
+ beans::PropertyValue aProperty;
+ if (_rValue >>= aProperty)
+ {
+ if (0 == aProperty.Name.compareToAscii("ChartModel"))
+ m_xChartModel.set(aProperty.Value,uno::UNO_QUERY);
+ else
+ ChartTypeUnoDlg_BASE::implInitialize(_rValue);
+ }
+ else
+ ChartTypeUnoDlg_BASE::implInitialize(_rValue);
+}
+//------------------------------------------------------------------------------
+Dialog* ChartTypeUnoDlg::createDialog(Window* _pParent)
+{
+ return new ChartTypeDialog( _pParent, m_xChartModel, m_aContext.getUNOContext() );
+}
+//-------------------------------------------------------------------------
+//-------------------------------------------------------------------------
+uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo() throw(uno::RuntimeException)
+{
+ return createPropertySetInfo( getInfoHelper() );
+}
+
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& ChartTypeUnoDlg::getInfoHelper()
+{
+ return *const_cast<ChartTypeUnoDlg*>(this)->getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* ChartTypeUnoDlg::createArrayHelper( ) const
+{
+ uno::Sequence< beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
new file mode 100644
index 000000000000..3c38eb4288a3
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_CreationWizard.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_CreationWizard.hxx"
+#include "dlg_CreationWizard.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+#include "Strings.hrc"
+#include "HelpIds.hrc"
+
+#include "tp_ChartType.hxx"
+#include "tp_RangeChooser.hxx"
+#include "tp_Wizard_TitlesAndObjects.hxx"
+#include "tp_Location.hxx"
+
+#include "tp_DataSource.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "DialogModel.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+//#define LOCATION_PAGE 1
+
+#define PATH_FULL 1
+#define STATE_FIRST 0
+#define STATE_CHARTTYPE STATE_FIRST
+#define STATE_SIMPLE_RANGE 1
+#define STATE_DATA_SERIES 2
+#define STATE_OBJECTS 3
+#define STATE_LOCATION 4
+
+#ifdef LOCATION_PAGE
+#define STATE_LAST STATE_LOCATION
+#else
+#define STATE_LAST STATE_OBJECTS
+#endif
+
+namespace
+{
+#ifdef LOCATION_PAGE
+ const sal_Int32 nPageCount = 5;
+#else
+ const sal_Int32 nPageCount = 4;
+#endif
+}
+
+CreationWizard::CreationWizard( Window* pParent, const uno::Reference< frame::XModel >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext
+ , sal_Int32 nOnePageOnlyIndex )
+ : svt::RoadmapWizard( pParent, SchResId(DLG_CHART_WIZARD)
+ , ( nOnePageOnlyIndex >= 0 && nOnePageOnlyIndex < nPageCount )
+ ? WZB_HELP | WZB_CANCEL | WZB_FINISH
+ : WZB_HELP | WZB_CANCEL | WZB_PREVIOUS | WZB_NEXT | WZB_FINISH
+ )
+ , m_xChartModel(xChartModel,uno::UNO_QUERY)
+ , m_xCC( xContext )
+ , m_bIsClosable(true)
+ , m_nOnePageOnlyIndex(nOnePageOnlyIndex)
+ , m_pTemplateProvider(0)
+ , m_nFirstState(STATE_FIRST)
+ , m_nLastState(STATE_LAST)
+ , m_aTimerTriggeredControllerLock( xChartModel )
+ , m_bCanTravel( true )
+{
+ m_apDialogModel.reset( new DialogModel( m_xChartModel, m_xCC ));
+ // Do not call FreeResource(), because there are no sub-elements defined in
+ // the dialog resource
+ ShowButtonFixedLine( TRUE );
+ defaultButton( WZB_FINISH );
+
+ if( m_nOnePageOnlyIndex < 0 || m_nOnePageOnlyIndex >= nPageCount )
+ {
+ m_nOnePageOnlyIndex = -1;
+ this->setTitleBase(String(SchResId(STR_DLG_CHART_WIZARD)));
+ }
+ else
+ this->setTitleBase(String());
+
+ declarePath( PATH_FULL
+ , STATE_CHARTTYPE
+ , STATE_SIMPLE_RANGE
+ , STATE_DATA_SERIES
+ , STATE_OBJECTS
+#ifdef LOCATION_PAGE
+ , STATE_LOCATION
+#endif
+ , WZS_INVALID_STATE
+ );
+ this->SetRoadmapSmartHelpId( SmartId( HID_SCH_WIZARD_ROADMAP ) );
+ this->SetRoadmapInteractive( sal_True );
+ Size aAdditionalRoadmapSize( LogicToPixel( Size( 85, 0 ), MAP_APPFONT ) );
+ Size aSize( this->GetSizePixel() );
+ aSize.Width() += aAdditionalRoadmapSize.Width();
+ this->SetSizePixel( aSize );
+
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY );
+ bool bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider());
+
+ if( bHasOwnData )
+ {
+ this->enableState( STATE_SIMPLE_RANGE, false );
+ this->enableState( STATE_DATA_SERIES, false );
+ }
+
+ // Call ActivatePage, to create and activate the first page
+ ActivatePage();
+}
+CreationWizard::~CreationWizard()
+{
+}
+
+svt::OWizardPage* CreationWizard::createPage(WizardState nState)
+{
+ svt::OWizardPage* pRet = 0;
+ if(m_nOnePageOnlyIndex!=-1 && m_nOnePageOnlyIndex!=nState)
+ return pRet;
+ bool bDoLiveUpdate = m_nOnePageOnlyIndex == -1;
+ switch( nState )
+ {
+ case STATE_CHARTTYPE:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ ChartTypeTabPage* pChartTypeTabPage = new ChartTypeTabPage(this,m_xChartModel,m_xCC,bDoLiveUpdate);
+ pRet = pChartTypeTabPage;
+ m_pTemplateProvider = pChartTypeTabPage;
+ if( m_pTemplateProvider &&
+ m_apDialogModel.get() )
+ m_apDialogModel->setTemplate( m_pTemplateProvider->getCurrentTemplate());
+ }
+ break;
+ case STATE_SIMPLE_RANGE:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ pRet = new RangeChooserTabPage(this,*(m_apDialogModel.get()),m_pTemplateProvider,this);
+ }
+ break;
+ case STATE_DATA_SERIES:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ pRet = new DataSourceTabPage(this,*(m_apDialogModel.get()),m_pTemplateProvider,this);
+ }
+ break;
+ case STATE_OBJECTS:
+ {
+ pRet = new TitlesAndObjectsTabPage(this,m_xChartModel,m_xCC);
+ m_aTimerTriggeredControllerLock.startTimer();
+ }
+ break;
+#ifdef LOCATION_PAGE
+ case STATE_LOCATION:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ pRet = new LocationTabPage(this,m_xChartModel,m_xCC);
+ }
+ break;
+#endif
+ default:
+ break;
+ }
+ if(pRet)
+ pRet->SetText(String());//remove title of pages to not get them in the wizard title
+ return pRet;
+}
+
+sal_Bool CreationWizard::leaveState( WizardState /*_nState*/ )
+{
+ return m_bCanTravel;
+}
+
+svt::WizardTypes::WizardState CreationWizard::determineNextState( WizardState nCurrentState ) const
+{
+ if( !m_bCanTravel )
+ return WZS_INVALID_STATE;
+ if( nCurrentState == m_nLastState )
+ return WZS_INVALID_STATE;
+ svt::WizardTypes::WizardState nNextState = nCurrentState + 1;
+ while( !isStateEnabled( nNextState ) && nNextState <= m_nLastState )
+ ++nNextState;
+ return (nNextState==m_nLastState+1) ? WZS_INVALID_STATE : nNextState;
+}
+void CreationWizard::enterState(WizardState nState)
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ enableButtons( WZB_PREVIOUS, bool( nState > m_nFirstState ) );
+ enableButtons( WZB_NEXT, bool( nState < m_nLastState ) );
+ if( isStateEnabled( nState ))
+ svt::RoadmapWizard::enterState(nState);
+}
+
+bool CreationWizard::isClosable()
+{
+ //@todo
+ return m_bIsClosable;
+}
+
+void CreationWizard::setInvalidPage( TabPage * /* pTabPage */ )
+{
+ m_bCanTravel = false;
+}
+
+void CreationWizard::setValidPage( TabPage * /* pTabPage */ )
+{
+ m_bCanTravel = true;
+}
+
+String CreationWizard::getStateDisplayName( WizardState nState ) const
+{
+ USHORT nResId = 0;
+ switch( nState )
+ {
+ case STATE_CHARTTYPE:
+ nResId = STR_PAGE_CHARTTYPE;
+ break;
+ case STATE_SIMPLE_RANGE:
+ nResId = STR_PAGE_DATA_RANGE;
+ break;
+ case STATE_DATA_SERIES:
+ nResId = STR_OBJECT_DATASERIES_PLURAL;
+ break;
+ case STATE_OBJECTS:
+ nResId = STR_PAGE_CHART_ELEMENTS;
+ break;
+#ifdef LOCATION_PAGE
+ case STATE_LOCATION:
+ nResId = STR_PAGE_CHART_LOCATION;
+ break;
+#endif
+ default:
+ break;
+ }
+ return String(SchResId(nResId));
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.hrc b/chart2/source/controller/dialogs/dlg_CreationWizard.hrc
new file mode 100644
index 000000000000..832a49329765
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_CreationWizard.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define CHART_WIZARD_PAGEWIDTH 250
+#define CHART_WIZARD_PAGEHEIGHT 140
+//width 198 height 150
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.src b/chart2/source/controller/dialogs/dlg_CreationWizard.src
new file mode 100644
index 000000000000..88caf15874c5
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.src
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_CreationWizard.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "dlg_CreationWizard.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+
+ModalDialog DLG_CHART_WIZARD
+{
+ HelpID = HID_SCH_CHART_AUTO_FORMAT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT+30 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+};
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
new file mode 100644
index 000000000000..c28e0265d983
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -0,0 +1,436 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_CreationWizard_UNO.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_CreationWizard_UNO.hxx"
+#include "dlg_CreationWizard.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+#include "ContainerHelper.hxx"
+#include "TimerTriggeredControllerLock.hxx"
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+// header for define RET_CANCEL
+#include <vcl/msgbox.hxx>
+// header for class OImplementationId
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+CreationWizardUnoDlg::CreationWizardUnoDlg( const uno::Reference< uno::XComponentContext >& xContext )
+ : OComponentHelper( m_aMutex )
+ , m_xChartModel( 0 )
+ , m_xCC( xContext )
+ , m_xParentWindow( 0 )
+ , m_pDialog( 0 )
+ , m_bUnlockControllersOnExecute(false)
+{
+ uno::Reference< frame::XDesktop > xDesktop(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.frame.Desktop" ), m_xCC ), uno::UNO_QUERY );
+ if( xDesktop.is() )
+ {
+ uno::Reference< frame::XTerminateListener > xListener( this );
+ xDesktop->addTerminateListener( xListener );
+ }
+}
+CreationWizardUnoDlg::~CreationWizardUnoDlg()
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_pDialog )
+ {
+ delete m_pDialog;
+ m_pDialog = 0;
+ }
+}
+//-------------------------------------------------------------------------
+// lang::XServiceInfo
+APPHELPER_XSERVICEINFO_IMPL(CreationWizardUnoDlg,CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > CreationWizardUnoDlg
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART_WIZARD_DIALOG_SERVICE_NAME;
+ return aSNS;
+}
+
+//-------------------------------------------------------------------------
+// XInterface
+uno::Any SAL_CALL CreationWizardUnoDlg::queryInterface( const uno::Type& aType ) throw (uno::RuntimeException)
+{
+ return OComponentHelper::queryInterface( aType );
+}
+void SAL_CALL CreationWizardUnoDlg::acquire() throw ()
+{
+ OComponentHelper::acquire();
+}
+void SAL_CALL CreationWizardUnoDlg::release() throw ()
+{
+ OComponentHelper::release();
+}
+uno::Any SAL_CALL CreationWizardUnoDlg::queryAggregation( uno::Type const & rType ) throw (uno::RuntimeException)
+{
+ if (rType == ::getCppuType( (uno::Reference< ui::dialogs::XExecutableDialog > const *)0 ))
+ {
+ void * p = static_cast< ui::dialogs::XExecutableDialog * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< lang::XServiceInfo > const *)0 ))
+ {
+ void * p = static_cast< lang::XTypeProvider * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< lang::XInitialization > const *)0 ))
+ {
+ void * p = static_cast< lang::XInitialization * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< frame::XTerminateListener > const *)0 ))
+ {
+ void * p = static_cast< frame::XTerminateListener * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< beans::XPropertySet > const *)0 ))
+ {
+ void * p = static_cast< beans::XPropertySet * >( this );
+ return uno::Any( &p, rType );
+ }
+ return OComponentHelper::queryAggregation( rType );
+}
+
+//-------------------------------------------------------------------------
+#define LCL_CPPUTYPE(t) (::getCppuType( reinterpret_cast< const uno::Reference<t> *>(0)))
+
+uno::Sequence< uno::Type > CreationWizardUnoDlg::getTypes() throw(uno::RuntimeException)
+{
+ static uno::Sequence< uno::Type > aTypeList;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !aTypeList.getLength() )
+ {
+ ::std::vector< uno::Type > aTypes;
+ aTypes.push_back( LCL_CPPUTYPE( lang::XComponent ));
+ aTypes.push_back( LCL_CPPUTYPE( lang::XTypeProvider ));
+ aTypes.push_back( LCL_CPPUTYPE( uno::XAggregation ));
+ aTypes.push_back( LCL_CPPUTYPE( uno::XWeak ));
+ aTypes.push_back( LCL_CPPUTYPE( lang::XServiceInfo ));
+ aTypes.push_back( LCL_CPPUTYPE( lang::XInitialization ));
+ aTypes.push_back( LCL_CPPUTYPE( frame::XTerminateListener ));
+ aTypes.push_back( LCL_CPPUTYPE( ui::dialogs::XExecutableDialog ));
+ aTypes.push_back( LCL_CPPUTYPE( beans::XPropertySet ));
+ aTypeList = ::chart::ContainerHelper::ContainerToSequence( aTypes );
+ }
+
+ return aTypeList;
+ // \--
+}
+uno::Sequence< sal_Int8 > SAL_CALL CreationWizardUnoDlg::getImplementationId( void ) throw( uno::RuntimeException )
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+//-------------------------------------------------------------------------
+
+// XTerminateListener
+void SAL_CALL CreationWizardUnoDlg::queryTermination( const lang::EventObject& /*Event*/ ) throw( frame::TerminationVetoException, uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+
+ // we will never give a veto here
+ if( m_pDialog && !m_pDialog->isClosable() )
+ {
+ m_pDialog->ToTop();
+ throw frame::TerminationVetoException();
+ }
+}
+
+//-------------------------------------------------------------------------
+
+void SAL_CALL CreationWizardUnoDlg::notifyTermination( const lang::EventObject& /*Event*/ ) throw (uno::RuntimeException)
+{
+ // we are going down, so dispose us!
+ dispose();
+}
+
+void SAL_CALL CreationWizardUnoDlg::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
+{
+ //Listener should deregister himself and relaese all references to the closing object.
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL CreationWizardUnoDlg::setTitle( const ::rtl::OUString& /*rTitle*/ ) throw(uno::RuntimeException)
+{
+}
+//-------------------------------------------------------------------------
+void CreationWizardUnoDlg::createDialogOnDemand()
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( !m_pDialog )
+ {
+ Window* pParent = NULL;
+ if( !m_xParentWindow.is() && m_xChartModel.is() )
+ {
+ uno::Reference< frame::XController > xController(
+ m_xChartModel->getCurrentController() );
+ if( xController.is() )
+ {
+ uno::Reference< frame::XFrame > xFrame(
+ xController->getFrame() );
+ if(xFrame.is())
+ m_xParentWindow = xFrame->getContainerWindow();
+ }
+ }
+ if( m_xParentWindow.is() )
+ {
+ VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
+ if (pImplementation)
+ pParent = pImplementation->GetWindow();
+ }
+ uno::Reference< XComponent > xComp( this );
+ if( m_xChartModel.is() )
+ {
+ m_pDialog = new CreationWizard( pParent, m_xChartModel, m_xCC );
+ m_pDialog->AddEventListener( LINK( this, CreationWizardUnoDlg, DialogEventHdl ) );
+ }
+ }
+}
+//-------------------------------------------------------------------------
+IMPL_LINK( CreationWizardUnoDlg, DialogEventHdl, VclWindowEvent*, pEvent )
+{
+ if(pEvent && (pEvent->GetId() == VCLEVENT_OBJECT_DYING) )
+ m_pDialog = 0;//avoid duplicate destruction of m_pDialog
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+sal_Int16 SAL_CALL CreationWizardUnoDlg::execute( ) throw(uno::RuntimeException)
+{
+ sal_Int16 nRet = RET_CANCEL;
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( !m_pDialog )
+ return nRet;
+ TimerTriggeredControllerLock aTimerTriggeredControllerLock( m_xChartModel );
+ if( m_bUnlockControllersOnExecute && m_xChartModel.is() )
+ m_xChartModel->unlockControllers();
+ nRet = m_pDialog->Execute();
+ }
+ return nRet;
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL CreationWizardUnoDlg::initialize( const uno::Sequence< uno::Any >& aArguments ) throw(uno::Exception, uno::RuntimeException)
+{
+ const uno::Any* pArguments = aArguments.getConstArray();
+ for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
+ {
+ beans::PropertyValue aProperty;
+ if(*pArguments >>= aProperty)
+ {
+ if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) == 0 )
+ {
+ aProperty.Value >>= m_xParentWindow;
+ }
+ else if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ChartModel" ) ) == 0 )
+ {
+ aProperty.Value >>= m_xChartModel;
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
+// ____ OComponentHelper ____
+/// Called in dispose method after the listeners were notified.
+void SAL_CALL CreationWizardUnoDlg::disposing()
+{
+ m_xChartModel.clear();
+ m_xParentWindow.clear();
+
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_pDialog )
+ {
+ delete m_pDialog;
+ m_pDialog = 0;
+ }
+
+ try
+ {
+ uno::Reference< frame::XDesktop > xDesktop(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.frame.Desktop" ), m_xCC ), uno::UNO_QUERY );
+ if( xDesktop.is() )
+ {
+ uno::Reference< frame::XTerminateListener > xListener( this );
+ xDesktop->removeTerminateListener( xListener );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ // \--
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL CreationWizardUnoDlg::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+ return 0;
+}
+
+void SAL_CALL CreationWizardUnoDlg::setPropertyValue( const ::rtl::OUString& rPropertyName
+ , const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException
+ , lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( rPropertyName.equals(C2U("Position")) )
+ {
+ awt::Point aPos;
+ if( ! (rValue >>= aPos) )
+ throw lang::IllegalArgumentException( C2U("Property 'Position' requires value of type awt::Point"), 0, 0 );
+
+ //set left upper outer corner relative to screen
+ //pixels, screen position
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( m_pDialog )
+ {
+ m_pDialog->SetPosPixel( Point(0,0) );
+ Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
+
+ Point aNewOuterPos = Point( aPos.X - aRect.Left(), aPos.Y - aRect.Top() );
+ m_pDialog->SetPosPixel( aNewOuterPos );
+ }
+ }
+ else if( rPropertyName.equals(C2U("Size")) )
+ {
+ //read only property, do nothing
+ }
+ else if( rPropertyName.equals(C2U("UnlockControllersOnExecute")) )
+ {
+ if( ! (rValue >>= m_bUnlockControllersOnExecute) )
+ throw lang::IllegalArgumentException( C2U("Property 'UnlockControllers' requires value of type boolean"), 0, 0 );
+ }
+ else
+ throw beans::UnknownPropertyException( C2U("unknown property was tried to set to chart wizard"), 0 );
+}
+
+uno::Any SAL_CALL CreationWizardUnoDlg::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aRet;
+ if( rPropertyName.equals(C2U("Position")) )
+ {
+ //get left upper outer corner relative to screen
+ //pixels, screen position
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( m_pDialog )
+ {
+ Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
+ awt::Point aPoint(aRect.Left(),aRect.Top());
+ aRet = uno::makeAny( aPoint );
+ }
+ }
+ else if( rPropertyName.equals(C2U("Size")) )
+ {
+ //get outer size inclusive decoration
+ //pixels, screen position
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( m_pDialog )
+ {
+ Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
+ awt::Size aSize(aRect.GetWidth(),aRect.GetHeight());
+ aRet = uno::makeAny( aSize );
+ }
+ }
+ else if( rPropertyName.equals(C2U("UnlockControllersOnExecute")) )
+ {
+ aRet = uno::makeAny( m_bUnlockControllersOnExecute );
+ }
+ else
+ throw beans::UnknownPropertyException( C2U("unknown property was tried to get from chart wizard"), 0 );
+ return aRet;
+}
+
+void SAL_CALL CreationWizardUnoDlg::addPropertyChangeListener(
+ const ::rtl::OUString& /* aPropertyName */, const uno::Reference< beans::XPropertyChangeListener >& /* xListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL CreationWizardUnoDlg::removePropertyChangeListener(
+ const ::rtl::OUString& /* aPropertyName */, const uno::Reference< beans::XPropertyChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+void SAL_CALL CreationWizardUnoDlg::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const uno::Reference< beans::XVetoableChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+void SAL_CALL CreationWizardUnoDlg::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const uno::Reference< beans::XVetoableChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
new file mode 100644
index 000000000000..d433aaff4cb3
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_DataEditor.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_DataEditor.hxx"
+#include "dlg_DataEditor.hrc"
+#include "Strings.hrc"
+#include "DataBrowser.hxx"
+
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "SchSlotIds.hxx"
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/pathoptions.hxx>
+
+// for SfxBoolItem
+#include <svl/eitem.hxx>
+
+#include <vcl/edit.hxx>
+
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+// for storing/reading the position and size of the dialog
+// #include <svtools/viewoptions.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+
+namespace chart
+{
+
+DataEditor::DataEditor(
+ Window* pParent,
+ const Reference< chart2::XChartDocument > & xChartDoc,
+ const Reference< uno::XComponentContext > & xContext ) :
+ ModalDialog( pParent, SchResId( DLG_DIAGRAM_DATA )),
+ m_bReadOnly( false ),
+ m_apBrwData( new DataBrowser( this, SchResId( CTL_DATA ), true /* bLiveUpdate */)),
+ m_aTbxData( this, SchResId( TBX_DATA )),
+ m_xChartDoc( xChartDoc ),
+ m_xContext( xContext ),
+ m_aToolboxImageList( SchResId( IL_DIAGRAM_DATA )),
+ m_aToolboxImageListHighContrast( SchResId( IL_HC_DIAGRAM_DATA ))
+{
+ FreeResource();
+
+ // set min size to current size
+ SetMinOutputSizePixel( GetOutputSizePixel() );
+
+ ApplyImageList();
+
+ m_aTbxData.SetSizePixel( m_aTbxData.CalcWindowSizePixel() );
+ m_aTbxData.SetSelectHdl( LINK( this, DataEditor, ToolboxHdl ));
+
+ m_apBrwData->SetCursorMovedHdl( LINK( this, DataEditor, BrowserCursorMovedHdl ));
+ m_apBrwData->SetCellModifiedHdl( LINK( this, DataEditor, CellModified ));
+
+ UpdateData();
+ GrabFocus();
+ m_apBrwData->GrabFocus();
+
+ bool bReadOnly = true;
+ Reference< frame::XStorable > xStor( m_xChartDoc, uno::UNO_QUERY );
+ if( xStor.is())
+ bReadOnly = xStor->isReadonly();
+ SetReadOnly( bReadOnly );
+
+ // #101228# change buttons to flat-look if set so by user
+ SvtMiscOptions aMiscOptions;
+ const sal_Int16 nStyle( aMiscOptions.GetToolboxStyle() );
+ // react on changes
+ aMiscOptions.AddListenerLink( LINK( this, DataEditor, MiscHdl ) );
+ m_aTbxData.SetOutStyle( nStyle );
+
+ // set good window width
+ Size aWinSize( GetOutputSizePixel());
+ Size aWinSizeWithBorder( GetSizePixel());
+ Point aWinPos( OutputToAbsoluteScreenPixel( GetPosPixel()));
+ sal_Int32 nMinWidth = aWinSize.getWidth();
+ sal_Int32 nMaxWidth = GetDesktopRectPixel().getWidth() -
+ (aWinSizeWithBorder.getWidth() - aWinSize.getWidth() + aWinPos.getX()) - 10; // leave some space
+ sal_Int32 nBrowserWidth = m_apBrwData->GetTotalWidth() + 12 + 16; // plus padding + 16?
+ sal_Int32 nWindowWidth = ::std::max( nMinWidth, nBrowserWidth );
+ nWindowWidth = ::std::min( nMaxWidth, nBrowserWidth );
+ aWinSize.setWidth( nWindowWidth );
+ SetOutputSizePixel( aWinSize );
+ AdaptBrowseBoxSize();
+
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+
+ // allow travelling to toolbar with F6
+ notifySystemWindow( this, & m_aTbxData, ::comphelper::mem_fun( & TaskPaneList::AddWindow ));
+}
+
+DataEditor::~DataEditor()
+{
+ notifySystemWindow( this, & m_aTbxData, ::comphelper::mem_fun( & TaskPaneList::RemoveWindow ));
+
+ SvtMiscOptions aMiscOptions;
+ aMiscOptions.RemoveListenerLink( LINK( this, DataEditor, MiscHdl ) );
+
+ OSL_TRACE( "DataEditor: DTOR" );
+}
+
+// react on click (or keypress) on toolbar icon
+IMPL_LINK( DataEditor, ToolboxHdl, void *, EMPTYARG )
+{
+ switch( m_aTbxData.GetCurItemId() )
+ {
+ case TBI_DATA_INSERT_ROW:
+ m_apBrwData->InsertRow();
+ break;
+ case TBI_DATA_INSERT_COL:
+ m_apBrwData->InsertColumn();
+// ImplAdjustHeaderControls( true /* bRefreshFromModel */ );
+ break;
+ case TBI_DATA_DELETE_ROW:
+ m_apBrwData->RemoveRow();
+ break;
+ case TBI_DATA_DELETE_COL:
+ m_apBrwData->RemoveColumn();
+// ImplAdjustHeaderControls( true /* bRefreshFromModel */ );
+ break;
+ case TBI_DATA_SWAP_COL :
+ m_apBrwData->SwapColumn ();
+// ImplAdjustHeaderControls( true /* bRefreshFromModel */ );
+ break;
+ case TBI_DATA_SWAP_ROW :
+ m_apBrwData->SwapRow ();
+ break;
+// case TBI_DATA_SORT_COL :
+// m_apBrwData->QuickSortCol();
+// break;
+// case TBI_DATA_SORT_ROW :
+// m_apBrwData->QuickSortRow();
+// break;
+// case TBI_DATA_SORT_TABLE_COL :
+// m_apBrwData->QuickSortTableCols ();
+// break;
+// case TBI_DATA_SORT_TABLE_ROW :
+// m_apBrwData->QuickSortTableRows ();
+// break;
+ }
+
+ return 0;
+}
+
+// refresh toolbar icons according to currently selected cell in brwose box
+IMPL_LINK( DataEditor, BrowserCursorMovedHdl, void *, EMPTYARG )
+{
+ if( m_bReadOnly )
+ return 0;
+
+ if( m_apBrwData->IsEnableItem() )
+ {
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, m_apBrwData->MayInsertRow() );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, m_apBrwData->MayInsertColumn() );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, m_apBrwData->MayDeleteRow() );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, m_apBrwData->MayDeleteColumn() );
+
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, m_apBrwData->MaySwapColumns() );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, m_apBrwData->MaySwapRows() );
+ }
+ else
+ {
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, FALSE );
+ }
+// m_aTbxData.EnableItem( TBI_DATA_SORT_COL, m_apBrwData->MaySortColumn() );
+// m_aTbxData.EnableItem( TBI_DATA_SORT_ROW, m_apBrwData->MaySortRow() );
+// m_aTbxData.EnableItem( TBI_DATA_SORT_TABLE_COL, m_apBrwData->MaySortColumn() );
+// m_aTbxData.EnableItem( TBI_DATA_SORT_TABLE_ROW, m_apBrwData->MaySortRow() );
+
+ return 0;
+}
+
+// disable all modifying controls
+void DataEditor::SetReadOnly( bool bReadOnly )
+{
+ m_bReadOnly = bReadOnly;
+ if( m_bReadOnly )
+ {
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, FALSE );
+// m_aTbxData.EnableItem( TBI_DATA_SORT_COL, FALSE );
+// m_aTbxData.EnableItem( TBI_DATA_SORT_ROW, FALSE );
+// m_aTbxData.EnableItem( TBI_DATA_SORT_TABLE_ROW, FALSE );
+// m_aTbxData.EnableItem( TBI_DATA_SORT_TABLE_COL, FALSE );
+ }
+
+ m_apBrwData->SetReadOnly( m_bReadOnly );
+}
+
+IMPL_LINK( DataEditor, MiscHdl, void*, EMPTYARG )
+{
+ SvtMiscOptions aMiscOptions;
+ sal_Int16 nStyle( aMiscOptions.GetToolboxStyle() );
+
+ m_aTbxData.SetOutStyle( nStyle );
+
+ return 0L;
+}
+
+IMPL_LINK( DataEditor, CellModified, void*, EMPTYARG )
+{
+ return 0;
+}
+
+// IMPL_LINK( DataEditor, BrowserColumnResized, void*, EMPTYARG )
+// {
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+// return 0;
+// }
+
+// IMPL_LINK( DataEditor, BrowserContentScrolled, void*, EMPTYARG )
+// {
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+// return 0;
+// }
+
+void DataEditor::UpdateData()
+{
+ m_apBrwData->SetDataFromModel( m_xChartDoc, m_xContext );
+}
+
+// react on the change of the underlying document by displaying the new data
+// void DataEditor::SFX_NOTIFY(
+// SfxBroadcaster& rBC,
+// const TypeId& rBCType,
+// const SfxHint& rHint,
+// const TypeId& rHintType )
+// {
+// if( rHint.Type() == TYPE(SfxSimpleHint) )
+// {
+// // note: if dynamic_cast works this should be changed
+// switch( static_cast< const SfxSimpleHint & >( rHint ).GetId())
+// {
+// case SFX_HINT_DOCCHANGED:
+// UpdateData();
+// break;
+
+// case SFX_HINT_DYING:
+// break;
+// }
+// }
+// }
+
+// {
+// BOOL bRet = TRUE;
+
+// // confirm changes currently made and not saved
+// m_apBrwData->EndEditing();
+
+// if( m_apBrwData->IsDirty() )
+// {
+// QueryBox aSafetyQuery( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+// String( SchResId( STR_DIAGRAM_DATA_SAFETY_QUERY )));
+// long nQueryResult = aSafetyQuery.Execute();
+
+// bRet = ( nQueryResult != RET_CANCEL );
+
+// if( nQueryResult == RET_YES )
+// {
+// // save changes
+// ApplyChangesToModel();
+// }
+// }
+
+// if( bRet )
+// {
+// // close child window
+// SfxBoolItem aItem( SID_DIAGRAM_DATA, FALSE );
+// if( m_pBindings )
+// {
+// SfxDispatcher* pDisp = m_pBindings->GetDispatcher();
+// if( pDisp )
+// pDisp->Execute( SID_DIAGRAM_DATA, SFX_CALLMODE_ASYNCHRON, &aItem, 0L);
+// else
+// DBG_ERROR( "Couldn't dispatch command" );
+// }
+// }
+
+// return ( bRet? SfxFloatingWindow::Close(): FALSE );
+// }
+
+void DataEditor::AdaptBrowseBoxSize()
+{
+ Size aSize( PixelToLogic( GetResizeOutputSizePixel(), MAP_APPFONT ));
+ Size aDataSize;
+
+ aDataSize.setWidth( aSize.getWidth() - 12 );
+ aDataSize.setHeight( aSize.getHeight() - 31 -24 );
+
+ m_apBrwData->SetSizePixel( LogicToPixel( aDataSize, MAP_APPFONT ));
+}
+
+void DataEditor::Resize()
+{
+ Dialog::Resize();
+ AdaptBrowseBoxSize();
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+}
+
+BOOL DataEditor::Close()
+{
+ if( ApplyChangesToModel() )
+ return ModalDialog::Close();
+ else
+ return TRUE;
+}
+
+bool DataEditor::ApplyChangesToModel()
+{
+ return m_apBrwData->EndEditing();
+}
+
+// sets the correct toolbar icons depending on the current mode (e.g. high contrast)
+void DataEditor::ApplyImageList()
+{
+ bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ ImageList& rImgLst = bIsHighContrast
+ ? m_aToolboxImageListHighContrast
+ : m_aToolboxImageList;
+
+ m_aTbxData.SetImageList( rImgLst );
+}
+
+// add/remove a window (the toolbar) to/from the global list, so that F6
+// travels/no longer travels over this window. _rMemFunc may be
+// TaskPaneList::AddWindow or TaskPaneList::RemoveWindow
+void DataEditor::notifySystemWindow(
+ Window* pWindow, Window* pToRegister,
+ ::comphelper::mem_fun1_t< TaskPaneList, Window* > rMemFunc )
+{
+ OSL_ENSURE( pWindow, "Window must not be null!" );
+ if( !pWindow )
+ return;
+ Window* pParent = pWindow->GetParent();
+ while( pParent && ! pParent->IsSystemWindow() )
+ {
+ pParent = pParent->GetParent();
+ }
+ if ( pParent && pParent->IsSystemWindow())
+ {
+ SystemWindow* pSystemWindow = static_cast< SystemWindow* >( pParent );
+ rMemFunc( pSystemWindow->GetTaskPaneList(),( pToRegister ));
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.hrc b/chart2/source/controller/dialogs/dlg_DataEditor.hrc
new file mode 100644
index 000000000000..4ce4433fe7fd
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.hrc
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_DataEditor.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define DLG_DIAGRAM_DATA 744
+
+#define FT_POS 1
+#define TBX_EDIT 1
+#define EDT_FIELD 1
+#define TBX_DATA 2
+#define CTL_DATA 1
+
+// images for toolbox image list
+#define TBI_DATA_INSERT_ROW 1
+#define TBI_DATA_INSERT_COL 2
+#define TBI_DATA_DELETE_ROW 3
+#define TBI_DATA_DELETE_COL 4
+#define TBI_DATA_SWAP_COL 5
+#define TBI_DATA_SWAP_ROW 6
+#define TBI_DATA_TRANSFER 7
+
+// #define TBI_DATA_SORT_ROW 7
+// #define TBI_DATA_SORT_COL 8
+// #define TBI_DATA_SORT_TABLE_ROW 9
+// #define TBI_DATA_SORT_TABLE_COL 10
+// #define TBI_DATA_TRANSFER 11
+
+// image lists (normal and high-contrast) for toolbox
+#define IL_DIAGRAM_DATA 1
+#define IL_HC_DIAGRAM_DATA 2
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.src b/chart2/source/controller/dialogs/dlg_DataEditor.src
new file mode 100644
index 000000000000..116757475bbb
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.src
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_DataEditor.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_DataEditor.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+
+// Mask Color for standard images
+#define IMAGE_BUTTON_STD_MASK_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; }
+// Mask Color for high-contrast images
+#define IMAGE_BUTTON_HC_MASK_COLOR IMAGE_BUTTON_STD_MASK_COLOR
+
+#define ADDITIONAL_SPACE_ABOVE_TABLE 17
+
+ModalDialog DLG_DIAGRAM_DATA
+{
+ HelpID = SID_DIAGRAM_DATA ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 244 , 152 ) ;
+
+ Text [ en-US ] = "Data Table";
+
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = TRUE ;
+ Control CTL_DATA
+ {
+ HelpID = HID_SCH_CTL_DATA ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 24 + ADDITIONAL_SPACE_ABOVE_TABLE ) ;
+ Size = MAP_APPFONT ( 232 , 121 - ADDITIONAL_SPACE_ABOVE_TABLE ) ;
+ TabStop = TRUE ;
+ };
+ ToolBox TBX_DATA
+ {
+ HelpID = HID_SCH_TBX_DATA ;
+ SVLook = TRUE ;
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 4 , 2 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_INSERT_ROW ;
+ Identifier = TBI_DATA_INSERT_ROW ;
+ Text [ en-US ] = "Insert Row" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_INSERT_COL ;
+ Identifier = TBI_DATA_INSERT_COL ;
+ Text [ en-US ] = "Insert Series" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_DELETE_ROW ;
+ Identifier = TBI_DATA_DELETE_ROW ;
+ Text [ en-US ] = "Delete Row" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_DELETE_COL ;
+ Identifier = TBI_DATA_DELETE_COL ;
+ Text [ en-US ] = "Delete Series" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_SWAP_COL ;
+ Identifier = TBI_DATA_SWAP_COL ;
+ Text [ en-US ] = "Move Series Right" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_SWAP_ROW ;
+ Identifier = TBI_DATA_SWAP_ROW ;
+ Text [ en-US ] = "Move Row Down" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ };
+ };
+
+#define IMAGE_ID_LIST \
+ IdList = \
+ { \
+ TBI_DATA_INSERT_ROW; \
+ TBI_DATA_INSERT_COL; \
+ TBI_DATA_DELETE_ROW; \
+ TBI_DATA_DELETE_COL; \
+ TBI_DATA_SWAP_COL; \
+ TBI_DATA_SWAP_ROW; \
+ TBI_DATA_TRANSFER; \
+ }; \
+ IdCount = { 7; }
+
+ ImageList IL_DIAGRAM_DATA
+ {
+ Prefix = "dataeditor_icon";
+ MaskColor = IMAGE_BUTTON_STD_MASK_COLOR;
+ IMAGE_ID_LIST;
+ };
+
+ ImageList IL_HC_DIAGRAM_DATA
+ {
+ Prefix = "dataeditor_icon_h";
+ MaskColor = IMAGE_BUTTON_HC_MASK_COLOR;
+ IMAGE_ID_LIST;
+ };
+};
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
new file mode 100644
index 000000000000..1aa7db1f0f17
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_DataSource.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_DataSource.hxx"
+#include "dlg_DataSource.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "DiagramHelper.hxx"
+#include "DialogModel.hxx"
+#include "HelpIds.hrc"
+
+#include "tp_RangeChooser.hxx"
+#include "tp_DataSource.hxx"
+
+// for RET_OK
+#include <vcl/msgbox.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::chart;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// --------------------------------------------------------------------------------
+
+
+namespace chart
+{
+
+// ----------------------------------------
+
+class DocumentChartTypeTemplateProvider : public ChartTypeTemplateProvider
+{
+public:
+ DocumentChartTypeTemplateProvider(
+ const Reference< chart2::XChartDocument > & xDoc );
+ virtual ~DocumentChartTypeTemplateProvider();
+
+ // ____ ChartTypeTemplateProvider ____
+ virtual Reference< chart2::XChartTypeTemplate > getCurrentTemplate() const;
+
+private:
+ Reference< chart2::XChartTypeTemplate > m_xTemplate;
+};
+
+DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider(
+ const Reference< chart2::XChartDocument > & xDoc )
+{
+ if( xDoc.is())
+ {
+ Reference< chart2::XDiagram > xDia( xDoc->getFirstDiagram());
+ if( xDia.is())
+ {
+ DiagramHelper::tTemplateWithServiceName aResult(
+ DiagramHelper::getTemplateForDiagram(
+ xDia,
+ Reference< lang::XMultiServiceFactory >(
+ xDoc->getChartTypeManager(), uno::UNO_QUERY ) ));
+ m_xTemplate.set( aResult.first );
+ }
+ }
+}
+
+DocumentChartTypeTemplateProvider::~DocumentChartTypeTemplateProvider()
+{}
+
+Reference< chart2::XChartTypeTemplate > DocumentChartTypeTemplateProvider::getCurrentTemplate() const
+{
+ return m_xTemplate;
+}
+
+// ----------------------------------------
+
+class DataSourceTabControl : public TabControl
+{
+public:
+ DataSourceTabControl( Window* pParent, const ResId& rResId );
+ ~DataSourceTabControl();
+
+ virtual long DeactivatePage();
+
+ void DisableTabToggling();
+ void EnableTabToggling();
+
+private:
+ bool m_bTogglingEnabled;
+};
+
+DataSourceTabControl::DataSourceTabControl( Window* pParent, const ResId& rResId ) :
+ TabControl( pParent, rResId ),
+ m_bTogglingEnabled( true )
+{}
+
+DataSourceTabControl::~DataSourceTabControl()
+{}
+
+// Note that the result is long, but is intended to be a bool
+long DataSourceTabControl::DeactivatePage()
+{
+ bool bCanDeactivate( TabControl::DeactivatePage() != 0 );
+
+ bCanDeactivate = (bCanDeactivate && m_bTogglingEnabled);
+
+ return (bCanDeactivate ? 1 : 0 );
+}
+
+void DataSourceTabControl::DisableTabToggling()
+{
+ m_bTogglingEnabled = false;
+}
+
+void DataSourceTabControl::EnableTabToggling()
+{
+ m_bTogglingEnabled = true;
+}
+
+// ----------------------------------------
+
+// static
+USHORT DataSourceDialog::m_nLastPageId = 0;
+
+DataSourceDialog::DataSourceDialog(
+ Window * pParent,
+ const Reference< XChartDocument > & xChartDocument,
+ const Reference< uno::XComponentContext > & xContext ) :
+
+ TabDialog( pParent, SchResId( DLG_DATA_SOURCE )),
+
+ m_xChartDocument( xChartDocument ),
+ m_xContext( xContext ),
+ m_apDocTemplateProvider( new DocumentChartTypeTemplateProvider( xChartDocument )),
+ m_apDialogModel( new DialogModel( xChartDocument, xContext )),
+
+ m_pTabControl( new DataSourceTabControl( this, SchResId( TABCTRL ) )),
+ m_aBtnOK( this, SchResId( BTN_OK ) ),
+ m_aBtnCancel( this, SchResId( BTN_CANCEL ) ),
+ m_aBtnHelp( this, SchResId( BTN_HELP ) ),
+
+ m_pRangeChooserTabePage(0),
+ m_pDataSourceTabPage(0),
+ m_bRangeChooserTabIsValid( true ),
+ m_bDataSourceTabIsValid( true )
+{
+ FreeResource();
+
+ //don't create the tabpages before FreeResource, otherwise the help ids are not matched correctly
+ m_pRangeChooserTabePage = new RangeChooserTabPage( m_pTabControl, *(m_apDialogModel.get()),
+ m_apDocTemplateProvider.get(), this, true /* bHideDescription */ );
+ m_pDataSourceTabPage = new DataSourceTabPage( m_pTabControl, *(m_apDialogModel.get()),
+ m_apDocTemplateProvider.get(), this, true /* bHideDescription */ );
+
+ m_pTabControl->InsertPage( TP_RANGECHOOSER, String( SchResId( STR_PAGE_DATA_RANGE )));
+ m_pTabControl->InsertPage( TP_DATA_SOURCE, String( SchResId( STR_OBJECT_DATASERIES_PLURAL )));
+
+ m_pTabControl->SetTabPage( TP_RANGECHOOSER, m_pRangeChooserTabePage );
+ m_pTabControl->SetTabPage( TP_DATA_SOURCE, m_pDataSourceTabPage );
+
+ m_pTabControl->SelectTabPage( m_nLastPageId );
+
+ SetHelpId( HID_SCH_DLG_RANGES );
+}
+
+DataSourceDialog::~DataSourceDialog()
+{
+ delete m_pRangeChooserTabePage;
+ delete m_pDataSourceTabPage;
+
+ m_nLastPageId = m_pTabControl->GetCurPageId();
+ delete m_pTabControl;
+}
+
+short DataSourceDialog::Execute()
+{
+ short nResult = TabDialog::Execute();
+ if( nResult == RET_OK )
+ {
+ if( m_pRangeChooserTabePage )
+ m_pRangeChooserTabePage->commitPage();
+ if( m_pDataSourceTabPage )
+ m_pDataSourceTabPage->commitPage();
+ }
+ return nResult;
+}
+
+void DataSourceDialog::setInvalidPage( TabPage * pTabPage )
+{
+ if( pTabPage == m_pRangeChooserTabePage )
+ m_bRangeChooserTabIsValid = false;
+ else if( pTabPage == m_pDataSourceTabPage )
+ m_bDataSourceTabIsValid = false;
+
+ if( ! (m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid ))
+ {
+ m_aBtnOK.Enable( FALSE );
+ OSL_ASSERT( m_pTabControl );
+ // note: there seems to be no suitable mechanism to address pages by
+ // identifier, at least it is unclear what the page identifiers are.
+ // @todo: change the fixed numbers to identifiers
+ if( m_bRangeChooserTabIsValid )
+ m_pTabControl->SetCurPageId( m_pTabControl->GetPageId( 1 ));
+ else if( m_bDataSourceTabIsValid )
+ m_pTabControl->SetCurPageId( m_pTabControl->GetPageId( 0 ));
+ m_pTabControl->DisableTabToggling();
+ }
+}
+
+void DataSourceDialog::setValidPage( TabPage * pTabPage )
+{
+ if( pTabPage == m_pRangeChooserTabePage )
+ m_bRangeChooserTabIsValid = true;
+ else if( pTabPage == m_pDataSourceTabPage )
+ m_bDataSourceTabIsValid = true;
+
+ if( m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid )
+ {
+ m_aBtnOK.Enable( TRUE );
+ OSL_ASSERT( m_pTabControl );
+ m_pTabControl->EnableTabToggling();
+ }
+}
+
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.hrc b/chart2/source/controller/dialogs/dlg_DataSource.hrc
new file mode 100644
index 000000000000..c1386c706a08
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataSource.hrc
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_DataSource.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define TABCTRL 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.src b/chart2/source/controller/dialogs/dlg_DataSource.src
new file mode 100644
index 000000000000..ecf87eb49f35
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataSource.src
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_DataSource.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "dlg_DataSource.hrc"
+#include "HelpIds.hrc"
+
+// for BUTTONS_OK_CANCEL_HELP_STACKED
+#include "CommonResources.hrc"
+
+TabDialog DLG_DATA_SOURCE
+{
+ HelpID = HID_SCH_DLG_RANGES ;
+
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Data Ranges" ;
+ TabControl TABCTRL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ };
+ BUTTONS_OK_CANCEL_HELP_STACKED( 200 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
new file mode 100644
index 000000000000..859465e3fd0d
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertAxis_Grid.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "dlg_InsertAxis_Grid.hxx"
+#include "dlg_InsertAxis_Grid.hrc"
+
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "NoWarningThisInCTOR.hxx"
+#include "ObjectNameProvider.hxx"
+
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+InsertAxisOrGridDialogData::InsertAxisOrGridDialogData()
+ : aPossibilityList(6)
+ , aExistenceList(6)
+{
+ sal_Int32 nN = 0;
+ for(nN=6;nN--;)
+ aPossibilityList[nN]=true;
+ for(nN=6;nN--;)
+ aExistenceList[nN]=false;
+}
+
+//==============================
+//
+// SchAxisDlg
+//
+//==============================
+
+SchAxisDlg::SchAxisDlg( Window* pWindow
+ , const InsertAxisOrGridDialogData& rInput, BOOL bAxisDlg )
+ :
+ ModalDialog( pWindow, SchResId( DLG_AXIS_OR_GRID )),
+
+ aFlPrimary( this, SchResId( FL_PRIMARY_AXIS )),
+ aFlPrimaryGrid( this, SchResId( FL_PRIMARY_GRID )),
+ aCbPrimaryX( this, SchResId( CB_X_PRIMARY )),
+ aCbPrimaryY( this, SchResId( CB_Y_PRIMARY )),
+ aCbPrimaryZ( this, SchResId( CB_Z_PRIMARY )),
+
+ aFlSecondary( this, SchResId( FL_SECONDARY_AXIS )),
+ aFlSecondaryGrid( this, SchResId( FL_SECONDARY_GRID )),
+ aCbSecondaryX( this, SchResId( CB_X_SECONDARY )),
+ aCbSecondaryY( this, SchResId( CB_Y_SECONDARY )),
+ aCbSecondaryZ( this, SchResId( CB_Z_SECONDARY )),
+
+ aPbOK( this, SchResId( BTN_OK )),
+ aPbCancel( this, SchResId( BTN_CANCEL )),
+ aPbHelp( this, SchResId( BTN_HELP ))
+
+ //rOutAttrs( rInAttrs )
+{
+ FreeResource();
+ if(!bAxisDlg)
+ {
+ SetHelpId( SID_INSERT_GRIDS );
+ SetText( ObjectNameProvider::getName(OBJECTTYPE_GRID,true) );
+
+ aCbPrimaryX.SetHelpId( HID_SCH_CB_XGRID );
+ aCbPrimaryY.SetHelpId( HID_SCH_CB_YGRID );
+ aCbPrimaryZ.SetHelpId( HID_SCH_CB_ZGRID );
+ aCbSecondaryX.SetHelpId( HID_SCH_CB_SECONDARY_XGRID );
+ aCbSecondaryY.SetHelpId( HID_SCH_CB_SECONDARY_YGRID );
+ aCbSecondaryZ.SetHelpId( HID_SCH_CB_SECONDARY_ZGRID );
+
+ aFlPrimary.Hide();
+ aFlSecondary.Hide();
+ aFlPrimaryGrid.Show();
+ aFlSecondaryGrid.Show();
+ }
+ else
+ {
+ SetText( ObjectNameProvider::getName(OBJECTTYPE_AXIS,true) );
+
+ //todo: remove if secondary z axis are possible somewhere
+ {
+ aCbSecondaryZ.Hide();
+
+ Size aSize( GetSizePixel() );
+ //aSize.Height() -= aCbSecondaryZ.GetSizePixel().Height();
+ aSize.Height() -= ( aCbSecondaryZ.GetPosPixel().Y() - aCbSecondaryY.GetPosPixel().Y() );
+ SetSizePixel(aSize);
+ }
+ }
+
+ aCbPrimaryX.Check( rInput.aExistenceList[0] );
+ aCbPrimaryY.Check( rInput.aExistenceList[1] );
+ aCbPrimaryZ.Check( rInput.aExistenceList[2] );
+ aCbSecondaryX.Check( rInput.aExistenceList[3] );
+ aCbSecondaryY.Check( rInput.aExistenceList[4] );
+ aCbSecondaryZ.Check( rInput.aExistenceList[5] );
+
+ aCbPrimaryX.Enable( rInput.aPossibilityList[0] );
+ aCbPrimaryY.Enable( rInput.aPossibilityList[1] );
+ aCbPrimaryZ.Enable( rInput.aPossibilityList[2] );
+ aCbSecondaryX.Enable( rInput.aPossibilityList[3] );
+ aCbSecondaryY.Enable( rInput.aPossibilityList[4] );
+ aCbSecondaryZ.Enable( rInput.aPossibilityList[5] );
+}
+
+SchAxisDlg::~SchAxisDlg()
+{
+}
+
+void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
+{
+ rOutput.aExistenceList[0]=aCbPrimaryX.IsChecked();
+ rOutput.aExistenceList[1]=aCbPrimaryY.IsChecked();
+ rOutput.aExistenceList[2]=aCbPrimaryZ.IsChecked();
+ rOutput.aExistenceList[3]=aCbSecondaryX.IsChecked();
+ rOutput.aExistenceList[4]=aCbSecondaryY.IsChecked();
+ rOutput.aExistenceList[5]=aCbSecondaryZ.IsChecked();
+}
+
+SchGridDlg::SchGridDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput )
+ : SchAxisDlg( pParent, rInput, false )//rInAttrs, b3D, bNet, bSecondaryX, bSecondaryY, false )
+{
+}
+
+SchGridDlg::~SchGridDlg()
+{
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+
+
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc
new file mode 100644
index 000000000000..083e2593717e
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertAxis_Grid.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FL_PRIMARY_AXIS 1
+#define FL_SECONDARY_AXIS 2
+
+#define FL_PRIMARY_GRID 3
+#define FL_SECONDARY_GRID 4
+
+#define CB_X_PRIMARY 1
+#define CB_Y_PRIMARY 2
+#define CB_Z_PRIMARY 3
+
+#define CB_X_SECONDARY 4
+#define CB_Y_SECONDARY 5
+#define CB_Z_SECONDARY 6
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src
new file mode 100644
index 000000000000..55643f40a54c
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertAxis_Grid.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertAxis_Grid.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "CommonResources.hrc"
+#include "res_SecondaryAxisCheckBoxes.hrc"
+
+ModalDialog DLG_AXIS_OR_GRID
+{
+ HelpID = SID_INSERT_AXIS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ //Size = MAP_APPFONT ( 160 , 99 ) ;
+ Size = MAP_APPFONT ( 160 , 113 ) ;
+ Moveable = TRUE ;
+
+ FixedLine FL_PRIMARY_AXIS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Axes" ;
+ };
+ FixedLine FL_PRIMARY_GRID
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Major grids" ;
+ };
+ CheckBox CB_X_PRIMARY
+ {
+ HelpID = HID_SCH_CB_XAXIS;
+
+ Pos = MAP_APPFONT ( 12 , 14 );
+ Size = MAP_APPFONT ( 80 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~X axis";
+ };
+ CheckBox CB_Y_PRIMARY
+ {
+ HelpID = HID_SCH_CB_YAXIS;
+
+ Pos = MAP_APPFONT ( 12 , 28 );
+ Size = MAP_APPFONT ( 80 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Y axis";
+ };
+ CheckBox CB_Z_PRIMARY
+ {
+ HelpID = HID_SCH_CB_ZAXIS;
+
+ Pos = MAP_APPFONT ( 12 , 42 );
+ Size = MAP_APPFONT ( 80 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Z axis";
+ };
+
+ FixedLine FL_SECONDARY_AXIS
+ {
+ Pos = MAP_APPFONT ( 6 , 58 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Secondary axes" ;
+ };
+ FixedLine FL_SECONDARY_GRID
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 58 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Minor grids" ;
+ };
+ SECONDARYAXISCHECKBOXES( 12, 69, 0, 14 )
+ BUTTONS_OK_CANCEL_HELP_STACKED(104)
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
new file mode 100644
index 000000000000..d7eb3357e6e8
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertDataLabel.cxx,v $
+ * $Revision: 1.10.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertDataLabel.hxx"
+#include "dlg_InsertDataLabel.hrc"
+#include "ResId.hxx"
+#include "ObjectNameProvider.hxx"
+#include "res_DataLabel.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+DataLabelsDialog::DataLabelsDialog(Window* pWindow, const SfxItemSet& rInAttrs, SvNumberFormatter* pFormatter) :
+ ModalDialog(pWindow, SchResId(DLG_DATA_DESCR)),
+ m_aBtnOK(this, SchResId(BTN_OK)),
+ m_aBtnCancel(this, SchResId(BTN_CANCEL)),
+ m_aBtnHelp(this, SchResId(BTN_HELP)),
+ m_apDataLabelResources( new DataLabelResources(this,rInAttrs) ),
+ m_rInAttrs(rInAttrs)
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_LABELS ) );
+
+ m_apDataLabelResources->SetNumberFormatter( pFormatter );
+ Reset();
+}
+
+DataLabelsDialog::~DataLabelsDialog()
+{
+}
+
+void DataLabelsDialog::Reset()
+{
+ m_apDataLabelResources->Reset(m_rInAttrs);
+}
+
+void DataLabelsDialog::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apDataLabelResources->FillItemSet(rOutAttrs);
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc b/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc
new file mode 100644
index 000000000000..a6ac7c164c73
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertDataLabel.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src
new file mode 100644
index 000000000000..091628a2c73e
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertDataLabel.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertDataLabel.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+#include "res_DataLabel.hrc"
+
+ModalDialog DLG_DATA_DESCR
+{
+ HelpID = SID_INSERT_DESCRIPTION ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 316 , 185 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED(260)
+ RESOURCE_DATALABEL( 6, 7 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
new file mode 100644
index 000000000000..535b07a7df38
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertErrorBars.cxx,v $
+ * $Revision: 1.4.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertErrorBars.hxx"
+#include "dlg_InsertErrorBars.hrc"
+#include "res_ErrorBar.hxx"
+#include "ResourceIds.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "ChartModelHelper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "DiagramHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ObjectNameProvider.hxx"
+
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+InsertErrorBarsDialog::InsertErrorBarsDialog(
+ Window* pParent, const SfxItemSet& rMyAttrs,
+ const uno::Reference< chart2::XChartDocument > & xChartDocument,
+ ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) :
+ ModalDialog( pParent, SchResId( DLG_DATA_YERRORBAR )),
+ rInAttrs( rMyAttrs ),
+ aBtnOK( this, SchResId( BTN_OK )),
+ aBtnCancel( this, SchResId( BTN_CANCEL )),
+ aBtnHelp( this, SchResId( BTN_HELP )),
+ m_apErrorBarResources( new ErrorBarResources(
+ this, this, rInAttrs,
+ /* bNoneAvailable = */ true, eType ))
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) );
+
+ m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
+}
+
+InsertErrorBarsDialog::~InsertErrorBarsDialog()
+{
+}
+
+void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apErrorBarResources->FillItemSet(rOutAttrs);
+}
+
+void InsertErrorBarsDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ModalDialog::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_apErrorBarResources->FillValueSets();
+}
+
+void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
+}
+
+//static
+double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals(
+ const Reference< frame::XModel >& xChartModel,
+ const Reference< uno::XInterface >& xChartView,
+ const OUString& rSelectedObjectCID )
+{
+ double fStepWidth = 0.001;
+
+ ExplicitValueProvider* pExplicitValueProvider( ExplicitValueProvider::getExplicitValueProvider(xChartView) );
+ if( pExplicitValueProvider )
+ {
+ Reference< XAxis > xAxis;
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedObjectCID, xChartModel );
+ xAxis = DiagramHelper::getAttachedAxis( xSeries, xDiagram );
+ if(!xAxis.is())
+ xAxis = AxisHelper::getAxis( 1/*nDimensionIndex*/, true/*bMainAxis*/, xDiagram );
+ if(xAxis.is())
+ {
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
+ pExplicitValueProvider->getExplicitValuesForAxis( xAxis,aExplicitScale, aExplicitIncrement );
+
+ fStepWidth = aExplicitIncrement.Distance;
+ if( aExplicitIncrement.SubIncrements.getLength() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 )
+ fStepWidth=fStepWidth/double(aExplicitIncrement.SubIncrements[0].IntervalCount);
+ else
+ fStepWidth/=10;
+ }
+ }
+
+ return fStepWidth;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc b/chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc
new file mode 100644
index 000000000000..c545ad60edfd
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertErrorBars.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.src b/chart2/source/controller/dialogs/dlg_InsertErrorBars.src
new file mode 100644
index 000000000000..b83103ee54ae
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.src
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertErrorBars.src,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertErrorBars.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "CommonResources.hrc"
+#include "res_ErrorBar.hrc"
+
+ModalDialog DLG_DATA_YERRORBAR
+{
+// HelpID = SID_INSERT_STATISTICS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 300 , 156 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED( 244 )
+ RESOURCE_ERRORBARS( 244 - 6, 14 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
new file mode 100644
index 000000000000..036ad921679d
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertLegend.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "dlg_InsertLegend.hxx"
+#include "dlg_InsertLegend.hrc"
+#include "res_LegendPosition.hxx"
+#include "ObjectNameProvider.hxx"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+// header for enum SvxChartLegendPos
+#include <svx/chrtitem.hxx>
+// header for class SfxItemPool
+#include <svl/itempool.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+
+SchLegendDlg::SchLegendDlg(Window* pWindow, const uno::Reference< uno::XComponentContext>& xCC )
+ : ModalDialog(pWindow, SchResId(DLG_LEGEND))
+ , m_apLegendPositionResources( new LegendPositionResources(this,xCC) )
+ , aBtnOK(this, SchResId(BTN_OK))
+ , aBtnCancel(this, SchResId(BTN_CANCEL))
+ , aBtnHelp(this, SchResId(BTN_HELP))
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName(OBJECTTYPE_LEGEND) );
+}
+
+SchLegendDlg::~SchLegendDlg()
+{
+}
+
+void SchLegendDlg::init( const uno::Reference< frame::XModel >& xChartModel )
+{
+ m_apLegendPositionResources->writeToResources( xChartModel );
+}
+
+bool SchLegendDlg::writeToModel( const uno::Reference< frame::XModel >& xChartModel ) const
+{
+ m_apLegendPositionResources->writeToModel( xChartModel );
+ return true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.hrc b/chart2/source/controller/dialogs/dlg_InsertLegend.hrc
new file mode 100644
index 000000000000..723b1c0d3fda
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertLegend.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.src b/chart2/source/controller/dialogs/dlg_InsertLegend.src
new file mode 100644
index 000000000000..263c37a1df33
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.src
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertLegend.src,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertLegend.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+#include "res_LegendPosition.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+ModalDialog DLG_LEGEND
+{
+ HelpID = SID_INSERT_CHART_LEGEND ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 135 , 80 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED( 79 )
+ RESOURCE_LEGENDDISPLAY( 6, 6 )
+ RESOURCE_LEGENDPOSITION( 15, 6 + RSC_CD_FIXEDTEXT_HEIGHT +6 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.cxx b/chart2/source/controller/dialogs/dlg_InsertTitle.cxx
new file mode 100644
index 000000000000..22fddfe29afb
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTitle.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertTitle.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "dlg_InsertTitle.hxx"
+#include "dlg_InsertTitle.hrc"
+#include "res_Titles.hxx"
+#include "ResId.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "ObjectNameProvider.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchTitleDlg::SchTitleDlg(Window* pWindow, const TitleDialogData& rInput )
+ : ModalDialog(pWindow, SchResId(DLG_TITLE))
+ , m_apTitleResources( new TitleResources(this,true) )
+ , aBtnOK(this, SchResId(BTN_OK))
+ , aBtnCancel(this, SchResId(BTN_CANCEL))
+ , aBtnHelp(this, SchResId(BTN_HELP))
+{
+ FreeResource();
+
+ this->SetText( ObjectNameProvider::getName(OBJECTTYPE_TITLE,true) );
+ m_apTitleResources->writeToResources( rInput );
+}
+
+SchTitleDlg::~SchTitleDlg()
+{
+}
+
+void SchTitleDlg::getResult( TitleDialogData& rOutput )
+{
+ m_apTitleResources->readFromResources( rOutput );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.hrc b/chart2/source/controller/dialogs/dlg_InsertTitle.hrc
new file mode 100644
index 000000000000..effbc246ca9f
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTitle.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertTitle.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.src b/chart2/source/controller/dialogs/dlg_InsertTitle.src
new file mode 100644
index 000000000000..626d0b7ec481
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTitle.src
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertTitle.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertTitle.hrc"
+#include "res_Titlesx.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+
+ModalDialog DLG_TITLE
+{
+ HelpID = SID_INSERT_TITLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 220 , 156 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED(164)
+ TITLES(6,6,152,6,10)
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx
new file mode 100644
index 000000000000..042baa292f65
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertTrendline.cxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertTrendline.hxx"
+#include "dlg_InsertTrendline.hrc"
+#include "res_Trendline.hxx"
+#include "ResourceIds.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "ChartModelHelper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "DiagramHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ObjectNameProvider.hxx"
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+#include <svtools/controldims.hrc>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+namespace
+{
+void lcl_SetControlXPos( Control & rControl, long nPosPixel )
+{
+ Point aPos( rControl.GetPosPixel());
+ aPos.setX( nPosPixel );
+ rControl.SetPosPixel( aPos );
+}
+} // anonymous namespace
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet& rMyAttrs ) :
+ ModalDialog( pParent, SchResId( DLG_DATA_TRENDLINE )),
+ rInAttrs( rMyAttrs ),
+ aBtnOK( this, SchResId( BTN_OK )),
+ aBtnCancel( this, SchResId( BTN_CANCEL )),
+ aBtnHelp( this, SchResId( BTN_HELP )),
+ m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true ))
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) );
+}
+
+InsertTrendlineDialog::~InsertTrendlineDialog()
+{
+}
+
+void InsertTrendlineDialog::adjustSize()
+{
+ long nControlsRightEdge = m_apTrendlineResources->adjustControlSizes();
+ long nButtonXPos = nControlsRightEdge +
+ LogicToPixel( Size( RSC_SP_CTRL_X, 10 ), MapMode( MAP_APPFONT )).getWidth();
+ lcl_SetControlXPos( aBtnOK, nButtonXPos );
+ lcl_SetControlXPos( aBtnCancel, nButtonXPos );
+ lcl_SetControlXPos( aBtnHelp, nButtonXPos );
+
+ Size aDialogSize( GetSizePixel());
+ aDialogSize.setWidth(
+ nControlsRightEdge +
+ LogicToPixel( Size( RSC_SP_CTRL_X + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT, 0 ),
+ MapMode( MAP_APPFONT )).getWidth());
+ SetSizePixel( aDialogSize );
+}
+
+void InsertTrendlineDialog::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apTrendlineResources->FillItemSet(rOutAttrs);
+}
+
+void InsertTrendlineDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ModalDialog::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_apTrendlineResources->FillValueSets();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.hrc b/chart2/source/controller/dialogs/dlg_InsertTrendline.hrc
new file mode 100644
index 000000000000..cb9de59a5cbb
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertTrendline.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.src b/chart2/source/controller/dialogs/dlg_InsertTrendline.src
new file mode 100644
index 000000000000..002e769a1037
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.src
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_InsertTrendline.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertTrendline.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "CommonResources.hrc"
+#include "res_Trendline.hrc"
+
+// is only an initial size, will be calculated to contain all controls
+#define DLG_DATA_TRENDLINE_RES_WIDTH 130
+#define DLG_DATA_TRENDLINE_ADD_TO_RES 62
+
+ModalDialog DLG_DATA_TRENDLINE
+{
+ HelpID = SID_INSERT_STATISTICS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( DLG_DATA_TRENDLINE_RES_WIDTH + DLG_DATA_TRENDLINE_ADD_TO_RES, 172 );
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED( DLG_DATA_TRENDLINE_RES_WIDTH + DLG_DATA_TRENDLINE_ADD_TO_RES )
+ RESOURCE_TRENDLINE( DLG_DATA_TRENDLINE_RES_WIDTH, 22 )
+};
+
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
new file mode 100644
index 000000000000..184214d3c5b0
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_NumberFormat.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_NumberFormat.hxx"
+
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+
+// header for class SvxNumberInfoItem
+#define ITEMID_NUMBERINFO SID_ATTR_NUMBERFORMAT_INFO
+#include <svx/numinf.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <sfx2/tabdlg.hxx>
+
+// header for SvNumberFormatter
+#include <svl/zforlist.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+NumberFormatDialog::NumberFormatDialog(Window* pParent, SfxItemSet& rSet)
+ : SfxSingleTabDialog( pParent, rSet, 0 )
+{
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
+ if ( fnCreatePage )
+ {
+ SfxTabPage* pTabPage = (*fnCreatePage)( this, rSet );
+ pTabPage->PageCreated(rSet);
+ SetTabPage(pTabPage);
+ }
+}
+
+NumberFormatDialog::~NumberFormatDialog()
+{
+}
+
+//static
+SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool )
+{
+ static const USHORT nWhichPairs[] =
+ {
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
+ SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
+ SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
+ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE,
+ 0
+ };
+ return SfxItemSet( rItemPool, nWhichPairs );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
new file mode 100644
index 000000000000..5f42cc468771
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_NumberFormat.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DLG_NUMBERFORMAT_HXX
+#define CHART2_DLG_NUMBERFORMAT_HXX
+
+#include <sfx2/basedlgs.hxx>
+
+class Window;
+class SfxItemSet;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class NumberFormatDialog : public SfxSingleTabDialog
+{
+public:
+ NumberFormatDialog(Window* pParent, SfxItemSet& rSet);
+ ~NumberFormatDialog();
+
+ static SfxItemSet CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
new file mode 100644
index 000000000000..ec8a0eaaa784
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -0,0 +1,653 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_ObjectProperties.cxx,v $
+ * $Revision: 1.23.42.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#ifndef _ZFORLIST_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zforlist.hxx>
+#endif
+
+#include "dlg_ObjectProperties.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "TabPages.hrc"
+#include "tp_AxisLabel.hxx"
+#include "tp_DataLabel.hxx"
+#include "tp_LegendPosition.hxx"
+#include "tp_PointGeometry.hxx"
+#include "tp_Scale.hxx"
+#include "tp_AxisPositions.hxx"
+#include "tp_ErrorBars.hxx"
+#include "tp_Trendline.hxx"
+#include "tp_SeriesToAxis.hxx"
+#include "tp_TitleRotation.hxx"
+#include "tp_PolarOptions.hxx"
+#include "ResId.hxx"
+#include "ViewElementListProvider.hxx"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ObjectNameProvider.hxx"
+#include "DiagramHelper.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "AxisHelper.hxx"
+
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <svl/intitem.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <svx/svxids.hrc>
+
+#include <svx/drawitem.hxx>
+#include <svx/ofaitem.hxx>
+#include <svx/svxgrahicitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/flstitem.hxx>
+#include <svx/tabline.hxx>
+
+#include <svx/flagsdef.hxx>
+#include <svx/numinf.hxx>
+
+#include <svl/cjkoptions.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUString& rObjectCID )
+ : m_aObjectCID( rObjectCID )
+ , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
+ , m_bAffectsMultipleObjects(false)
+ , m_aLocalizedName()
+ , m_bHasGeometryProperties(false)
+ , m_bHasStatisticProperties(false)
+ , m_bProvidesSecondaryYAxis(false)
+ , m_bProvidesOverlapAndGapWidth(false)
+ , m_bProvidesBarConnectors(false)
+ , m_bHasAreaProperties(false)
+ , m_bHasSymbolProperties(false)
+ , m_bHasNumberProperties(false)
+ , m_bProvidesStartingAngle(false)
+ , m_bProvidesMissingValueTreatments(false)
+ , m_bHasScaleProperties(false)
+ , m_bCanAxisLabelsBeStaggered(false)
+ , m_bSupportingAxisPositioning(false)
+ , m_bShowAxisOrigin(false)
+ , m_bIsCrossingAxisIsCategoryAxis(false)
+ , m_aCategories()
+ , m_xChartDocument( 0 )
+{
+ rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
+ m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
+}
+ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
+{
+}
+ObjectType ObjectPropertiesDialogParameter::getObjectType() const
+{
+ return m_eObjectType;
+}
+rtl::OUString ObjectPropertiesDialogParameter::getLocalizedName() const
+{
+ return m_aLocalizedName;
+}
+
+void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
+{
+ m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
+ uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+
+ bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType);
+ bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
+
+ if( bHasSeriesProperties || bHasDataPointproperties )
+ {
+ m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
+ m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
+ m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
+
+ if( bHasSeriesProperties )
+ {
+ m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
+ m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 );
+ m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
+ m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
+ m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
+
+ m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
+ .getLength() ? true : false;
+ }
+ }
+
+ if( OBJECTTYPE_DATA_ERRORS == m_eObjectType )
+ m_bHasStatisticProperties = true;
+
+ if( OBJECTTYPE_AXIS == m_eObjectType )
+ {
+ //show scale properties only for a single axis not for multiselection
+ m_bHasScaleProperties = !m_bAffectsMultipleObjects;
+
+ if( m_bHasScaleProperties )
+ {
+ uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
+ if( xAxis.is() )
+ {
+ //no scale page for series axis
+ ScaleData aData( xAxis->getScaleData() );
+ if( chart2::AxisType::SERIES == aData.AxisType )
+ m_bHasScaleProperties = false;
+ if( chart2::AxisType::REALNUMBER == aData.AxisType || chart2::AxisType::PERCENT == aData.AxisType )
+ m_bHasNumberProperties = true;
+
+ sal_Int32 nCooSysIndex=0;
+ sal_Int32 nDimensionIndex=0;
+ sal_Int32 nAxisIndex=0;
+ if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
+ {
+ xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
+ //show positioning controls only if they make sense
+ m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
+
+ //show axis origin only for secondary y axis
+ if( 1==nDimensionIndex && 1==nAxisIndex && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
+ m_bShowAxisOrigin = true;
+ }
+
+ //is the crossin main axis a category axes?:
+ uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
+ uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
+ if( xCrossingMainAxis.is() )
+ {
+ ScaleData aScale( xCrossingMainAxis->getScaleData() );
+ m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType );
+ if( m_bIsCrossingAxisIsCategoryAxis )
+ m_aCategories = DiagramHelper::generateAutomaticCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) );
+ }
+ }
+ }
+
+ //no staggering of labels for 3D axis
+ m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
+ }
+
+ //create gui name for this object
+ {
+ if( !m_bAffectsMultipleObjects && OBJECTTYPE_AXIS == m_eObjectType )
+ {
+ m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
+ }
+ else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
+ {
+ m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
+ }
+ else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
+ {
+ m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
+ }
+ else
+ {
+ switch( m_eObjectType )
+ {
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_CURVE:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ if( m_bAffectsMultipleObjects )
+ m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
+ else
+ m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
+ break;
+ default:
+ m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
+ break;
+ }
+ }
+ }
+}
+
+bool ObjectPropertiesDialogParameter::HasGeometryProperties() const
+{
+ return m_bHasGeometryProperties;
+}
+bool ObjectPropertiesDialogParameter::HasStatisticProperties() const
+{
+ return m_bHasStatisticProperties;
+}
+bool ObjectPropertiesDialogParameter::ProvidesSecondaryYAxis() const
+{
+ return m_bProvidesSecondaryYAxis;
+}
+bool ObjectPropertiesDialogParameter::ProvidesOverlapAndGapWidth() const
+{
+ return m_bProvidesOverlapAndGapWidth;
+}
+bool ObjectPropertiesDialogParameter::ProvidesBarConnectors() const
+{
+ return m_bProvidesBarConnectors;
+}
+bool ObjectPropertiesDialogParameter::HasAreaProperties() const
+{
+ return m_bHasAreaProperties;
+}
+bool ObjectPropertiesDialogParameter::HasSymbolProperties() const
+{
+ return m_bHasSymbolProperties;
+}
+bool ObjectPropertiesDialogParameter::HasScaleProperties() const
+{
+ return m_bHasScaleProperties;
+}
+bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const
+{
+ return m_bCanAxisLabelsBeStaggered;
+}
+bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const
+{
+ return m_bShowAxisOrigin;
+}
+bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const
+{
+ return m_bSupportingAxisPositioning;
+}
+bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const
+{
+ return m_bIsCrossingAxisIsCategoryAxis;
+}
+const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const
+{
+ return m_aCategories;
+}
+bool ObjectPropertiesDialogParameter::HasNumberProperties() const
+{
+ return m_bHasNumberProperties;
+}
+bool ObjectPropertiesDialogParameter::ProvidesStartingAngle() const
+{
+ return m_bProvidesStartingAngle;
+}
+bool ObjectPropertiesDialogParameter::ProvidesMissingValueTreatments() const
+{
+ return m_bProvidesMissingValueTreatments;
+}
+uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDocument() const
+{
+ return m_xChartDocument;
+}
+
+//const USHORT nNoArrowDlg = 1100;
+const USHORT nNoArrowNoShadowDlg = 1101;
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
+ Graphic* pAutoSymbolGraphic )
+{
+ m_pSymbolShapeProperties = pSymbolShapeProperties;
+ m_pAutoSymbolGraphic = pAutoSymbolGraphic;
+}
+
+void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
+}
+
+SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
+ const SfxItemSet* pAttr,
+ const ObjectPropertiesDialogParameter* pDialogParameter,
+ const ViewElementListProvider* pViewElementListProvider,
+ const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ )
+ : SfxTabDialog(pParent, SchResId(DLG_OBJECT_PROPERTIES), pAttr)
+ , eObjectType(pDialogParameter->getObjectType())
+ , nDlgType(nNoArrowNoShadowDlg)
+ , nPageType(0)
+ , m_pParameter( pDialogParameter )
+ , m_pViewElementListProvider( pViewElementListProvider )
+ , m_pNumberFormatter(0)
+ , m_pSymbolShapeProperties(NULL)
+ , m_pAutoSymbolGraphic(NULL)
+ , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
+ , m_bOKPressed(false)
+{
+ FreeResource();
+
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
+
+ this->SetText( pDialogParameter->getLocalizedName() );
+
+ SvtCJKOptions aCJKOptions;
+
+ switch (eObjectType)
+ {
+ case OBJECTTYPE_TITLE:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+ break;
+
+ case OBJECTTYPE_LEGEND:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+ break;
+
+ case OBJECTTYPE_DATA_SERIES:
+ case OBJECTTYPE_DATA_POINT:
+ if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
+ AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
+ if( m_pParameter->ProvidesStartingAngle())
+ AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
+
+ if( m_pParameter->HasGeometryProperties() )
+ AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
+
+ if(m_pParameter->HasAreaProperties())
+ {
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ }
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
+ break;
+
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_LABELS:
+ AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+
+ break;
+
+ case OBJECTTYPE_AXIS:
+ {
+ if( m_pParameter->HasScaleProperties() )
+ AddTabPage(TP_SCALE, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL);
+
+ if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
+ AddTabPage(TP_AXIS_POSITIONS, String(SchResId(STR_PAGE_POSITIONING)), AxisPositionsTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL);
+ if( m_pParameter->HasNumberProperties() )
+ AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+ break;
+ }
+
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ break;
+
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ break;
+
+ case OBJECTTYPE_DATA_CURVE:
+ AddTabPage(TP_TRENDLINE, String(SchResId(STR_PAGE_TRENDLINE_TYPE)), TrendlineTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ break;
+
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ case OBJECTTYPE_PAGE:
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ case OBJECTTYPE_DIAGRAM_WALL:
+ case OBJECTTYPE_DIAGRAM:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ break;
+
+ case OBJECTTYPE_LEGEND_ENTRY:
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ case OBJECTTYPE_UNKNOWN:
+ // nothing
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
+ if( SvtLanguageOptions().IsCTLFontEnabled() )
+ /* When rotation is supported for equation text boxes, use
+ SchAlignmentTabPage::Create here. The special
+ SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
+ AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::CreateWithoutRotation, NULL);
+ break;
+ }
+
+ // used to find out if user left the dialog with OK. When OK is pressed but
+ // no changes were done, Cancel is returned by the SfxTabDialog. See method
+ // DialogWasClosedWithOK.
+ m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
+ GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
+}
+
+SchAttribTabDlg::~SchAttribTabDlg()
+{
+ delete m_pSymbolShapeProperties;
+ delete m_pAutoSymbolGraphic;
+}
+
+void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch (nId)
+ {
+ case TP_LAYOUT:
+ break;
+ case RID_SVXPAGE_LINE:
+ aSet.Put (SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
+ aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
+ aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+
+ if( m_pParameter->HasSymbolProperties() )
+ {
+ aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
+ if( m_pSymbolShapeProperties )
+ aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
+ if( m_pAutoSymbolGraphic )
+ aSet.Put(SvxGraphicItem(SID_GRAPHIC,*m_pAutoSymbolGraphic));
+ }
+ rPage.PageCreated(aSet);
+ //rPage.ActivatePage(*GetInputSetImpl()); //what for?
+ break;
+
+ case RID_SVXPAGE_AREA:
+ aSet.Put(SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
+ aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
+ aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
+ aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
+ aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ //rPage.ActivatePage(*GetInputSetImpl()); //what for?
+ break;
+
+ case RID_SVXPAGE_TRANSPARENCE:
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_CHAR_NAME:
+
+ //CHINA001 ((SvxCharNamePage&)rPage).
+ //CHINA001 SetFontList(SvxFontListItem(m_pViewElementListProvider->getFontList()));
+ aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST)); //CHINA001
+ rPage.PageCreated(aSet); //CHINA001
+ break;
+
+ case RID_SVXPAGE_CHAR_EFFECTS:
+ //CHINA001 ((SvxCharEffectsPage&) rPage).DisableControls( DISABLE_CASEMAP );
+ aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); //CHINA001
+ rPage.PageCreated(aSet);
+ break;
+
+ case TP_AXIS_LABEL:
+ {
+ bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
+ ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
+ break;
+ }
+
+ case TP_ALIGNMENT:
+ break;
+
+
+ case TP_AXIS_POSITIONS:
+ {
+ AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
+ if(pPage)
+ {
+ pPage->SetNumFormatter( m_pNumberFormatter );
+ if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
+ {
+ pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
+ pPage->SetCategories( m_pParameter->GetCategories() );
+ }
+ pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
+ }
+ }
+ break;
+
+ case TP_SCALE:
+ {
+ ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
+ if(pScaleTabPage)
+ {
+ pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
+ pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
+ }
+ }
+ break;
+
+ case TP_DATA_DESCR:
+ {
+ DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
+ if( pLabelPage )
+ pLabelPage->SetNumberFormatter( m_pNumberFormatter );
+ }
+ break;
+
+ case RID_SVXPAGE_NUMBERFORMAT:
+ aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
+ rPage.PageCreated(aSet);
+ break;
+
+ case TP_YERRORBAR:
+ {
+ ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
+ OSL_ASSERT( pTabPage );
+ if( pTabPage )
+ {
+ pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
+ pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
+ pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
+ }
+ break;
+ }
+ case TP_OPTIONS:
+ {
+ SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
+ if( pTabPage && m_pParameter )
+ pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
+ m_pParameter->ProvidesBarConnectors() );
+ break;
+ }
+ }
+}
+
+IMPL_LINK( SchAttribTabDlg, OKPressed, void * , EMPTYARG )
+{
+ m_bOKPressed = true;
+ return m_aOriginalOKClickHdl.Call( this );
+}
+
+bool SchAttribTabDlg::DialogWasClosedWithOK() const
+{
+ return m_bOKPressed;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.src b/chart2/source/controller/dialogs/dlg_ObjectProperties.src
new file mode 100644
index 000000000000..487a5d59271c
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.src
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_ObjectProperties.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+TabDialog DLG_OBJECT_PROPERTIES
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
new file mode 100644
index 000000000000..75a7917ad3dc
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_View3D.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_View3D.hxx"
+#include "dlg_View3D.hrc"
+#include "Strings.hrc"
+#include "TabPages.hrc"
+#include "ResId.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "tp_3D_SceneGeometry.hxx"
+#include "tp_3D_SceneAppearance.hxx"
+#include "tp_3D_SceneIllumination.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "ControllerLockGuard.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+// for RET_OK
+#include <vcl/msgbox.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+// static
+USHORT View3DDialog::m_nLastPageId = 0;
+
+View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable )
+ : TabDialog(pParent,SchResId(DLG_3D_VIEW))
+ , m_aTabControl(this,SchResId(TABCTRL))
+ , m_aBtnOK(this,SchResId(BTN_OK))
+ , m_aBtnCancel(this,SchResId(BTN_CANCEL))
+ , m_aBtnHelp(this,SchResId(BTN_HELP))
+ , m_pGeometry(0)
+ , m_pAppearance(0)
+ , m_pIllumination(0)
+ , m_aControllerLocker(xChartModel)
+{
+ FreeResource();
+
+ uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
+ m_pGeometry = new ThreeD_SceneGeometry_TabPage(&m_aTabControl,xSceneProperties,m_aControllerLocker);
+ m_pAppearance = new ThreeD_SceneAppearance_TabPage(&m_aTabControl,xChartModel,m_aControllerLocker);
+ m_pIllumination = new ThreeD_SceneIllumination_TabPage(&m_aTabControl,xSceneProperties,xChartModel,pColorTable);
+
+ m_aTabControl.InsertPage( TP_3D_SCENEGEOMETRY, String(SchResId(STR_PAGE_PERSPECTIVE)) );
+ m_aTabControl.InsertPage( TP_3D_SCENEAPPEARANCE, String(SchResId(STR_PAGE_APPEARANCE)) );
+ m_aTabControl.InsertPage( TP_3D_SCENEILLUMINATION, String(SchResId(STR_PAGE_ILLUMINATION)) );
+
+ m_aTabControl.SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
+ m_aTabControl.SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
+ m_aTabControl.SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
+
+ m_aTabControl.SelectTabPage( m_nLastPageId );
+}
+
+View3DDialog::~View3DDialog()
+{
+ delete m_pGeometry;
+ delete m_pAppearance;
+ delete m_pIllumination;
+
+ m_nLastPageId = m_aTabControl.GetCurPageId();
+}
+
+short View3DDialog::Execute()
+{
+ short nResult = TabDialog::Execute();
+ if( nResult == RET_OK )
+ {
+ if( m_pGeometry )
+ m_pGeometry->commitPendingChanges();
+ if( m_pAppearance )
+ m_pAppearance->commitPendingChanges();
+ if( m_pIllumination )
+ m_pIllumination->commitPendingChanges();
+ }
+ return nResult;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_View3D.hrc b/chart2/source/controller/dialogs/dlg_View3D.hrc
new file mode 100644
index 000000000000..d91d075dd2c7
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_View3D.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_View3D.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+//position and size defines:
+#define VIEW3D_PAGE_WIDTH 160
+#define VIEW3D_PAGE_HEIGHT 110
+
+//resource ids:
+
+#define TABCTRL 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_View3D.src b/chart2/source/controller/dialogs/dlg_View3D.src
new file mode 100644
index 000000000000..96bff67ad945
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_View3D.src
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlg_View3D.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+
+TabDialog DLG_3D_VIEW
+{
+ HelpID = SID_3D_VIEW ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT+40 ) ;
+ Text [ en-US ] = "3D View" ;
+ TabControl TABCTRL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+ };
+ BUTTONS_OK_CANCEL_HELP_STACKED(VIEW3D_PAGE_HEIGHT+3)
+};
+
diff --git a/chart2/source/controller/dialogs/hidother.src b/chart2/source/controller/dialogs/hidother.src
new file mode 100644
index 000000000000..4f409d14094b
--- /dev/null
+++ b/chart2/source/controller/dialogs/hidother.src
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hidother.src,v $
+ * $Revision: 1.7.56.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "SchSlotIds.hxx"
+
+hidspecial SID_INSERT_GRIDS {HelpId= SID_INSERT_GRIDS; };
+
+hidspecial HID_SCH_CB_XAXIS {HelpId= HID_SCH_CB_XAXIS; };
+hidspecial HID_SCH_CB_YAXIS {HelpId= HID_SCH_CB_YAXIS; };
+hidspecial HID_SCH_CB_ZAXIS {HelpId= HID_SCH_CB_ZAXIS; };
+hidspecial HID_SCH_CB_SECONDARY_XAXIS {HelpId= HID_SCH_CB_SECONDARY_XAXIS; };
+hidspecial HID_SCH_CB_SECONDARY_YAXIS {HelpId= HID_SCH_CB_SECONDARY_YAXIS; };
+hidspecial HID_SCH_CB_SECONDARY_ZAXIS {HelpId= HID_SCH_CB_SECONDARY_ZAXIS; };
+
+hidspecial HID_SCH_CB_XGRID {HelpId= HID_SCH_CB_XGRID; };
+hidspecial HID_SCH_CB_YGRID {HelpId= HID_SCH_CB_YGRID; };
+hidspecial HID_SCH_CB_ZGRID {HelpId= HID_SCH_CB_ZGRID; };
+hidspecial HID_SCH_CB_SECONDARY_XGRID {HelpId= HID_SCH_CB_SECONDARY_XGRID; };
+hidspecial HID_SCH_CB_SECONDARY_YGRID {HelpId= HID_SCH_CB_SECONDARY_YGRID; };
+hidspecial HID_SCH_CB_SECONDARY_ZGRID {HelpId= HID_SCH_CB_SECONDARY_ZGRID; };
+
+hidspecial HID_SCH_CT_INDICATE {HelpId= HID_SCH_CT_INDICATE; };
+
+hidspecial HID_SCH_STATISTIK_MEANVALUE {HelpId= HID_SCH_STATISTIK_MEANVALUE; };
+hidspecial HID_SCH_STATISTIK_NO_ERROR {HelpId= HID_SCH_STATISTIK_NO_ERROR; };
+hidspecial HID_SCH_STATISTIK_VARIANT {HelpId= HID_SCH_STATISTIK_VARIANT; };
+hidspecial HID_SCH_STATISTIK_SIGMA {HelpId= HID_SCH_STATISTIK_SIGMA; };
+hidspecial HID_SCH_STATISTIK_PERCENT {HelpId= HID_SCH_STATISTIK_PERCENT; };
+hidspecial HID_SCH_STATISTIK_FUNCTION {HelpId= HID_SCH_STATISTIK_FUNCTION; };
+hidspecial HID_SCH_STATISTIK_RANGE {HelpId= HID_SCH_STATISTIK_RANGE; };
+hidspecial HID_SCH_STATISTIK_FUNCTION_LB {HelpId= HID_SCH_STATISTIK_FUNCTION_LB; };
+hidspecial HID_SCH_STATISTIK_POSITIVE_VALUE {HelpId= HID_SCH_STATISTIK_POSITIVE_VALUE; };
+hidspecial HID_SCH_STATISTIK_POSITIVE_RANGE {HelpId= HID_SCH_STATISTIK_POSITIVE_RANGE; };
+hidspecial HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER {HelpId= HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER; };
+hidspecial HID_SCH_STATISTIK_NEGATIVE_VALUE {HelpId= HID_SCH_STATISTIK_NEGATIVE_VALUE; };
+hidspecial HID_SCH_STATISTIK_NEGATIVE_RANGE {HelpId= HID_SCH_STATISTIK_NEGATIVE_RANGE; };
+hidspecial HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER {HelpId= HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER; };
+hidspecial HID_SCH_STATISTIK_SAME_FOR_BOTH {HelpId= HID_SCH_STATISTIK_SAME_FOR_BOTH; };
+hidspecial HID_SCH_STATISTIK_SHOW_BOTH {HelpId= HID_SCH_STATISTIK_SHOW_BOTH; };
+hidspecial HID_SCH_STATISTIK_SHOW_POSITIVE {HelpId= HID_SCH_STATISTIK_SHOW_POSITIVE; };
+hidspecial HID_SCH_STATISTIK_SHOW_NEGATIVE {HelpId= HID_SCH_STATISTIK_SHOW_NEGATIVE; };
+hidspecial HID_SCH_STATISTIK_BIGERROR {HelpId= HID_SCH_STATISTIK_BIGERROR; };
+hidspecial HID_SCH_STATISTIK_CONSTERROR {HelpId= HID_SCH_STATISTIK_CONSTERROR; };
+hidspecial HID_SCH_STATISTIK_PERCENT_VALUE {HelpId= HID_SCH_STATISTIK_PERCENT_VALUE; };
+hidspecial HID_SCH_STATISTIK_BIGERROR_VALUE {HelpId= HID_SCH_STATISTIK_BIGERROR_VALUE; };
+hidspecial HID_SCH_STATISTIK_PLUS_VALUE {HelpId= HID_SCH_STATISTIK_PLUS_VALUE; };
+hidspecial HID_SCH_STATISTIK_MINUS_VALUE {HelpId= HID_SCH_STATISTIK_MINUS_VALUE; };
+
+hidspecial HID_SCH_LEGEND_SHOW {HelpId= HID_SCH_LEGEND_SHOW; };
+hidspecial HID_SCH_LEGEND_POS_LEFT {HelpId= HID_SCH_LEGEND_POS_LEFT; };
+hidspecial HID_SCH_LEGEND_POS_TOP {HelpId= HID_SCH_LEGEND_POS_TOP; };
+hidspecial HID_SCH_LEGEND_POS_RIGHT {HelpId= HID_SCH_LEGEND_POS_RIGHT; };
+hidspecial HID_SCH_LEGEND_POS_BOTTOM {HelpId= HID_SCH_LEGEND_POS_BOTTOM; };
+
+hidspecial HID_SCH_DATALABEL_VALUE {HelpId= HID_SCH_DATALABEL_VALUE; };
+hidspecial HID_SCH_DATALABEL_NUMBER {HelpId= HID_SCH_DATALABEL_NUMBER; };
+hidspecial HID_SCH_DATALABEL_PERCENT {HelpId= HID_SCH_DATALABEL_PERCENT; };
+hidspecial HID_SCH_DATALABEL_TEXT {HelpId= HID_SCH_DATALABEL_TEXT; };
+hidspecial HID_SCH_DATALABEL_SYMBOL {HelpId= HID_SCH_DATALABEL_SYMBOL; };
+hidspecial HID_SCH_PB_NUMBERFORMAT {HelpId= HID_SCH_PB_NUMBERFORMAT; };
+hidspecial HID_SCH_PB_PERCENT_NUMBERFORMAT {HelpId= HID_SCH_PB_PERCENT_NUMBERFORMAT; };
+hidspecial HID_SCH_DATALABEL_SEPARATOR {HelpId= HID_SCH_DATALABEL_SEPARATOR; };
+hidspecial HID_SCH_DATALABEL_PLACEMENT {HelpId= HID_SCH_DATALABEL_PLACEMENT; };
+hidspecial HID_SCH_TEXTDIRECTION {HelpId= HID_SCH_TEXTDIRECTION; };
+hidspecial HID_SCH_TEXTDIRECTION_TITLE {HelpId= HID_SCH_TEXTDIRECTION_TITLE; };
+hidspecial HID_SCH_TEXTDIRECTION_EQUATION {HelpId= HID_SCH_TEXTDIRECTION_EQUATION; };
+hidspecial HID_SCH_DATALABEL_ROTATION_KNOB {HelpId= HID_SCH_DATALABEL_ROTATION_KNOB; };
+hidspecial HID_SCH_DATALABEL_ROTATION_EDIT {HelpId= HID_SCH_DATALABEL_ROTATION_EDIT; };
+
+hidspecial HID_SCH_TITLE_MAIN {HelpId= HID_SCH_TITLE_MAIN; };
+hidspecial HID_SCH_TITLE_SUB {HelpId= HID_SCH_TITLE_SUB; };
+hidspecial HID_SCH_TITLE_X {HelpId= HID_SCH_TITLE_X; };
+hidspecial HID_SCH_TITLE_Y {HelpId= HID_SCH_TITLE_Y; };
+hidspecial HID_SCH_TITLE_Z {HelpId= HID_SCH_TITLE_Z; };
+hidspecial HID_SCH_TITLE_SECONDARY_X {HelpId= HID_SCH_TITLE_SECONDARY_X; };
+hidspecial HID_SCH_TITLE_SECONDARY_Y {HelpId= HID_SCH_TITLE_SECONDARY_Y; };
+
+hidspecial HID_SCH_NUM_OF_LINES {HelpId= HID_SCH_NUM_OF_LINES; };
+
+hidspecial HID_SCH_WIZARD_ROADMAP {HelpId= HID_SCH_WIZARD_ROADMAP; };
+hidspecial HID_SCH_WIN_DOCUMENT {HelpId= HID_SCH_WIN_DOCUMENT; };
+hidspecial HID_SCH_DATA_SERIES_LABEL {HelpId= HID_SCH_DATA_SERIES_LABEL; };
+
+hidspecial HID_SCH_STARTING_ANGLE_DIAL {HelpId= HID_SCH_STARTING_ANGLE_DIAL; };
+
+hidspecial HID_SCH_TRENDLINE_RB_NONE {HelpId= HID_SCH_TRENDLINE_RB_NONE; };
+hidspecial HID_SCH_TRENDLINE_RB_LINEAR {HelpId= HID_SCH_TRENDLINE_RB_LINEAR; };
+hidspecial HID_SCH_TRENDLINE_RB_LOGARITHMIC {HelpId= HID_SCH_TRENDLINE_RB_LOGARITHMIC; };
+hidspecial HID_SCH_TRENDLINE_RB_EXPONENTIAL {HelpId= HID_SCH_TRENDLINE_RB_EXPONENTIAL; };
+hidspecial HID_SCH_TRENDLINE_RB_POWER {HelpId= HID_SCH_TRENDLINE_RB_POWER; };
+hidspecial HID_SCH_TRENDLINE_SHOW_EQUATION {HelpId= HID_SCH_TRENDLINE_SHOW_EQUATION; };
+hidspecial HID_SCH_TRENDLINE_SHOW_R_SQUARED {HelpId= HID_SCH_TRENDLINE_SHOW_R_SQUARED; };
diff --git a/chart2/source/controller/dialogs/makefile.mk b/chart2/source/controller/dialogs/makefile.mk
new file mode 100644
index 000000000000..6b64f2cae8db
--- /dev/null
+++ b/chart2/source/controller/dialogs/makefile.mk
@@ -0,0 +1,205 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.19.72.1 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcdialogs
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+GEN_HID_OTHER=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# i26518 the gcc-3.0.4 requires to enhance the template-depth
+# this seems to be a compiler issue, so we recommend not to use 3.0.x anymore
+.IF "$(COM)"=="GCC"
+ CFLAGS+=-ftemplate-depth-128
+.ENDIF
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES= \
+ $(SLO)$/ObjectNameProvider.obj \
+ $(SLO)$/TimerTriggeredControllerLock.obj \
+ $(SLO)$/ChangingResource.obj \
+ $(SLO)$/DataBrowser.obj \
+ $(SLO)$/DataBrowserModel.obj \
+ $(SLO)$/DialogModel.obj \
+ $(SLO)$/TitleDialogData.obj \
+ $(SLO)$/res_Titles.obj \
+ $(SLO)$/res_TextSeparator.obj \
+ $(SLO)$/res_ErrorBar.obj \
+ $(SLO)$/res_Trendline.obj \
+ $(SLO)$/res_BarGeometry.obj \
+ $(SLO)$/res_LegendPosition.obj \
+ $(SLO)$/res_DataLabel.obj \
+ $(SLO)$/ChartTypeDialogController.obj \
+ $(SLO)$/tp_ChartType.obj \
+ $(SLO)$/tp_RangeChooser.obj \
+ $(SLO)$/tp_Wizard_TitlesAndObjects.obj \
+ $(SLO)$/tp_Location.obj \
+ $(SLO)$/tp_AxisLabel.obj \
+ $(SLO)$/tp_AxisPositions.obj \
+ $(SLO)$/tp_DataLabel.obj \
+ $(SLO)$/tp_DataSource.obj \
+ $(SLO)$/tp_DataSourceControls.obj \
+ $(SLO)$/tp_LegendPosition.obj \
+ $(SLO)$/tp_PointGeometry.obj \
+ $(SLO)$/tp_Scale.obj \
+ $(SLO)$/tp_Trendline.obj \
+ $(SLO)$/tp_ErrorBars.obj \
+ $(SLO)$/tp_SeriesToAxis.obj \
+ $(SLO)$/tp_TitleRotation.obj \
+ $(SLO)$/tp_3D_SceneGeometry.obj \
+ $(SLO)$/tp_3D_SceneAppearance.obj \
+ $(SLO)$/tp_3D_SceneIllumination.obj \
+ $(SLO)$/tp_PolarOptions.obj \
+ $(SLO)$/dlg_ObjectProperties.obj \
+ $(SLO)$/dlg_DataEditor.obj \
+ $(SLO)$/dlg_DataSource.obj \
+ $(SLO)$/dlg_View3D.obj \
+ $(SLO)$/dlg_InsertAxis_Grid.obj \
+ $(SLO)$/dlg_InsertDataLabel.obj \
+ $(SLO)$/dlg_InsertLegend.obj \
+ $(SLO)$/dlg_InsertTrendline.obj \
+ $(SLO)$/dlg_InsertErrorBars.obj \
+ $(SLO)$/dlg_InsertTitle.obj \
+ $(SLO)$/dlg_CreationWizard.obj \
+ $(SLO)$/dlg_CreationWizard_UNO.obj \
+ $(SLO)$/dlg_ChartType_UNO.obj \
+ $(SLO)$/dlg_ChartType.obj \
+ $(SLO)$/dlg_NumberFormat.obj \
+ $(SLO)$/RangeSelectionButton.obj \
+ $(SLO)$/RangeSelectionHelper.obj \
+ $(SLO)$/RangeSelectionListener.obj \
+ $(SLO)$/RangeEdit.obj \
+ $(SLO)$/TextDirectionListBox.obj
+
+# --- Resources ---------------------------------------------------------------
+
+# Bitmaps.src
+# Bitmaps_HC.src
+
+
+SRC1FILES= \
+ res_TextSeparator.src \
+ res_BarGeometry.src \
+ tp_ChartType.src \
+ tp_RangeChooser.src \
+ tp_Wizard_TitlesAndObjects.src \
+ tp_Location.src \
+ tp_AxisLabel.src \
+ tp_AxisPositions.src \
+ tp_DataLabel.src \
+ tp_DataSource.src \
+ tp_LegendPosition.src \
+ tp_PointGeometry.src \
+ tp_Scale.src \
+ tp_Trendline.src \
+ tp_ErrorBars.src \
+ tp_SeriesToAxis.src \
+ tp_TitleRotation.src \
+ tp_3D_SceneGeometry.src \
+ tp_3D_SceneAppearance.src \
+ tp_3D_SceneIllumination.src \
+ tp_PolarOptions.src \
+ dlg_ObjectProperties.src \
+ Strings_Statistic.src \
+ Strings_Scale.src \
+ Strings_ChartTypes.src \
+ Strings_AdditionalControls.src \
+ Strings.src \
+ Bitmaps.src \
+ Bitmaps_HC.src \
+ dlg_DataEditor.src \
+ dlg_DataSource.src \
+ dlg_View3D.src \
+ dlg_InsertAxis_Grid.src \
+ dlg_InsertDataLabel.src \
+ dlg_InsertLegend.src \
+ dlg_InsertTrendline.src \
+ dlg_InsertErrorBars.src \
+ dlg_InsertTitle.src \
+ dlg_ChartType.src \
+ dlg_CreationWizard.src
+
+SRS1NAME=$(TARGET)
+
+# --- Targets -----------------------------------------------------------------
+LOCALIZE_ME=res_DataLabel_tmpl.hrc res_LegendPosition_tmpl.hrc res_Trendline_tmpl.hrc res_ErrorBar_tmpl.hrc res_Titlesx_tmpl.hrc res_SecondaryAxisCheckBoxes_tmpl.hrc
+.INCLUDE: target.mk
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_DataLabel.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_LegendPosition.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_Trendline.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_ErrorBar.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_Titlesx.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_SecondaryAxisCheckBoxes.hrc
+
+#dependencies:
+
+$(SRS)$/chcdialogs.srs: \
+ Bitmaps.hrc \
+ Bitmaps_HC.hrc \
+ CommonResources.hrc \
+ ResourceIds.hrc \
+ ..$/..$/inc$/Strings.hrc \
+ TabPages.hrc \
+ dlg_CreationWizard.hrc \
+ dlg_DataSource.hrc \
+ dlg_InsertAxis_Grid.hrc \
+ dlg_InsertDataLabel.hrc \
+ dlg_InsertLegend.hrc \
+ dlg_InsertTrendline.hrc \
+ dlg_InsertErrorBars.hrc \
+ dlg_InsertTitle.hrc \
+ dlg_View3D.hrc \
+ res_Titles.hrc \
+ tp_3D_SceneAppearance.hrc \
+ tp_3D_SceneGeometry.hrc \
+ tp_3D_SceneIllumination.hrc \
+ tp_PolarOptions.hrc \
+ tp_ChartType.hrc \
+ tp_DataSource.hrc \
+ tp_Location.hrc \
+ tp_RangeChooser.hrc \
+ tp_Wizard_TitlesAndObjects.hrc
+
+# res_DataLabel.hrc \
+# res_LegendPosition.hrc \
+# res_Statistic.hrc \
+
+#$(SRS)$/chcdialogs.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
+
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.cxx b/chart2/source/controller/dialogs/res_BarGeometry.cxx
new file mode 100644
index 000000000000..a98ce3833e56
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_BarGeometry.cxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_BarGeometry.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+BarGeometryResources::BarGeometryResources( Window* pWindow )
+ : m_aFT_Geometry( pWindow, pWindow->GetStyle() )
+ , m_aLB_Geometry( pWindow, SchResId( LB_BAR_GEOMETRY ) )
+{
+ m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) );
+ m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() );
+}
+void BarGeometryResources::SetPosPixel( const Point& rPosition )
+{
+ Window* pWindow( m_aFT_Geometry.GetParent() );
+
+ Size aDistanceSize( 2,2 );
+ if( pWindow )
+ aDistanceSize = Size( pWindow->LogicToPixel( Size(0,RSC_SP_CTRL_DESC_Y), MapMode(MAP_APPFONT) ) );
+
+ m_aFT_Geometry.SetPosPixel( rPosition );
+ m_aLB_Geometry.SetPosPixel( Point( rPosition.X()+aDistanceSize.Width(), rPosition.Y()+m_aFT_Geometry.GetSizePixel().Height()+aDistanceSize.Height()) );
+}
+Size BarGeometryResources::GetSizePixel() const
+{
+ long nHeight = m_aLB_Geometry.GetPosPixel().Y()
+ - m_aFT_Geometry.GetPosPixel().Y();
+ nHeight += m_aLB_Geometry.GetSizePixel().Height();
+
+ long nWidth = m_aLB_Geometry.GetSizePixel().Width();
+ if( nWidth < m_aFT_Geometry.GetSizePixel().Width() )
+ nWidth = m_aFT_Geometry.GetSizePixel().Width();
+
+ return Size( nHeight, nWidth );
+}
+BarGeometryResources::~BarGeometryResources()
+{
+}
+
+void BarGeometryResources::SetSelectHdl( const Link& rLink )
+{
+ m_aLB_Geometry.SetSelectHdl( rLink );
+}
+
+void BarGeometryResources::Show( bool bShow )
+{
+ m_aFT_Geometry.Show( bShow );
+ m_aLB_Geometry.Show( bShow );
+}
+void BarGeometryResources::Enable( bool bEnable )
+{
+ m_aFT_Geometry.Enable( bEnable );
+ m_aLB_Geometry.Enable( bEnable );
+}
+
+USHORT BarGeometryResources::GetSelectEntryCount() const
+{
+ return m_aLB_Geometry.GetSelectEntryCount();
+}
+USHORT BarGeometryResources::GetSelectEntryPos() const
+{
+ return m_aLB_Geometry.GetSelectEntryPos();
+}
+void BarGeometryResources::SelectEntryPos( USHORT nPos )
+{
+ if( nPos < m_aLB_Geometry.GetEntryCount() )
+ m_aLB_Geometry.SelectEntryPos( nPos );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.hxx b/chart2/source/controller/dialogs/res_BarGeometry.hxx
new file mode 100644
index 000000000000..8bf2d81259a3
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_BarGeometry.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_BarGeometry.hxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_BARGEOMETRY_HXX
+#define _CHART2_RES_BARGEOMETRY_HXX
+
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class BarGeometryResources
+{
+public:
+ BarGeometryResources( Window* pParent );
+ virtual ~BarGeometryResources();
+
+ void SetPosPixel( const Point& rPosition );
+ Size GetSizePixel() const;
+
+ void Show( bool bShow );
+ void Enable( bool bEnable );
+
+ USHORT GetSelectEntryCount() const;
+ USHORT GetSelectEntryPos() const;
+ void SelectEntryPos( USHORT nPos );
+
+ void SetSelectHdl( const Link& rLink );
+
+private:
+ FixedText m_aFT_Geometry;
+ ListBox m_aLB_Geometry;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.src b/chart2/source/controller/dialogs/res_BarGeometry.src
new file mode 100644
index 000000000000..a36087b2039d
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_BarGeometry.src
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_BarGeometry.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include "HelpIds.hrc"
+
+ListBox LB_BAR_GEOMETRY
+{
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 89 , 38 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=FALSE;
+ DDExtraWidth = TRUE ;
+ HelpID = HID_SCH_LB_BAR_GEOMETRY;
+
+ StringList [ en-US ] =
+ {
+ "Box" ;
+ "Cylinder" ;
+ "Cone" ;
+ "Pyramid" ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
new file mode 100644
index 000000000000..44fd27f7d09a
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_DataLabel.cxx,v $
+ * $Revision: 1.5.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_DataLabel.hxx"
+#include "res_DataLabel_IDs.hrc"
+
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "dlg_NumberFormat.hxx"
+
+// header for class SvxNumberInfoItem
+#include <svx/numinf.hxx>
+#include <svl/eitem.hxx>
+// for SfxUInt32Item
+#include <svl/intitem.hxx>
+// header for class SfxStringItem
+#include <svl/stritem.hxx>
+//SfxIntegerListItem
+#include <svl/ilstitem.hxx>
+#include <svx/eeitem.hxx>
+#include <svx/frmdiritem.hxx>
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+#include <svx/svxids.hrc>
+// header for SvNumberFormatter
+#include <svl/zforlist.hxx>
+#include <svtools/controldims.hrc>
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+
+bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich, USHORT nSourceFormatWhich, ULONG& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
+{
+ bool bSet = false;
+ const SfxPoolItem *pItem1 = NULL;
+ if( rSet.GetItemState( nValueWhich, TRUE, &pItem1 ) == SFX_ITEM_SET )
+ {
+ const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 );
+ if( pNumItem )
+ {
+ rnFormatKeyOut = pNumItem->GetValue();
+ bSet = true;
+ }
+ }
+
+ rbSourceFormatMixedStateOut=true;
+ const SfxPoolItem *pItem2 = NULL;
+ if( rSet.GetItemState( nSourceFormatWhich, TRUE, &pItem2 ) == SFX_ITEM_SET )
+ {
+ const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 );
+ if( pBoolItem )
+ {
+ rbSourceFormatOut = pBoolItem->GetValue();
+ rbSourceFormatMixedStateOut=false;
+ }
+ }
+ return bSet;
+}
+
+void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, USHORT nWhichId, CheckBox& rCheckbox )
+{
+ rCheckbox.EnableTriState( FALSE );
+
+ const SfxPoolItem *pPoolItem = NULL;
+ if( rInAttrs.GetItemState(nWhichId, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ rCheckbox.Check( ((const SfxBoolItem*)pPoolItem)->GetValue() );
+ else
+ {
+ rCheckbox.EnableTriState( TRUE );
+ rCheckbox.SetState( STATE_DONTKNOW );
+ }
+}
+
+}//end anonymous namespace
+
+DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs )
+ : m_aCBNumber(pWindow, SchResId(CB_VALUE_AS_NUMBER)),
+ m_aPB_NumberFormatForValue(pWindow, SchResId(PB_NUMBERFORMAT)),
+ m_aCBPercent(pWindow, SchResId(CB_VALUE_AS_PERCENTAGE)),
+ m_aPB_NumberFormatForPercent(pWindow, SchResId(PB_PERCENT_NUMBERFORMAT)),
+ m_aCBCategory(pWindow, SchResId(CB_CATEGORY)),
+ m_aCBSymbol(pWindow, SchResId(CB_SYMBOL)),
+ m_aSeparatorResources(pWindow),
+ m_aFT_LabelPlacement(pWindow, SchResId(FT_LABEL_PLACEMENT)),
+ m_aLB_LabelPlacement(pWindow, SchResId(LB_LABEL_PLACEMENT)),
+ m_aFL_Rotate(pWindow, SchResId(FL_LABEL_ROTATE)),
+ m_aDC_Dial(pWindow, SchResId(CT_LABEL_DIAL)),
+ m_aFT_Degrees(pWindow, SchResId(FT_LABEL_DEGREES)),
+ m_aNF_Degrees(pWindow, SchResId(NF_LABEL_DEGREES)),
+ m_aFT_TextDirection(pWindow, SchResId(FT_LABEL_TEXTDIR)),
+ m_aLB_TextDirection(pWindow, SchResId(LB_LABEL_TEXTDIR), &m_aFT_TextDirection),
+ m_pNumberFormatter(0),
+ m_bNumberFormatMixedState(true),
+ m_bPercentFormatMixedState(true),
+ m_nNumberFormatForValue(0),
+ m_nNumberFormatForPercent(11),
+ m_bSourceFormatMixedState(true),
+ m_bPercentSourceMixedState(true),
+ m_bSourceFormatForValue(true),
+ m_bSourceFormatForPercent(true),
+ m_pWindow(pWindow),
+ m_pPool(rInAttrs.GetPool())
+{
+ //fill label placement list
+ std::map< sal_Int32, XubString > aPlacementToStringMap;
+ for( sal_Int32 nEnum=0; nEnum<m_aLB_LabelPlacement.GetEntryCount(); ++nEnum )
+ aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<USHORT>(nEnum));
+
+ ::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList;
+ const SfxPoolItem *pPoolItem = NULL;
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
+
+ m_aLB_LabelPlacement.Clear();
+ for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN )
+ {
+ USHORT nListBoxPos = static_cast<USHORT>( nN );
+ sal_Int32 nPlacement = aAvailabelPlacementList[nN];
+ m_aPlacementToListBoxMap[nPlacement]=nListBoxPos;
+ m_aListBoxToPlacementMap[nListBoxPos]=nPlacement;
+ m_aLB_LabelPlacement.InsertEntry( aPlacementToStringMap[nPlacement] );
+ }
+ m_aLB_LabelPlacement.SetDropDownLineCount(m_aLB_LabelPlacement.GetEntryCount());
+
+ //replace&resize push buttons and resize checkboxes
+ Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nPBWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() )
+ + 20; //the min with is to small to fit, hm... so add alittle
+ long nCBXWidth = ::std::max( m_aCBNumber.CalcMinimumSize().getWidth(), m_aCBPercent.CalcMinimumSize().getWidth() );
+ long nNewPBXPos = m_aCBNumber.GetPosPixel().X() + nCBXWidth + aControlDistance.Width();
+ long nPageWidth = pWindow->LogicToPixel( Size(260,185), MapMode(MAP_APPFONT) ).getWidth();
+ if( nNewPBXPos + nPBWidth > nPageWidth )
+ {
+ if( nPBWidth > nPageWidth/2 )
+ nPBWidth = nPageWidth/2;
+ nNewPBXPos = nPageWidth-nPBWidth;
+ nCBXWidth = nPageWidth-m_aCBNumber.GetPosPixel().X()-nPBWidth-aControlDistance.Width();
+ }
+ m_aPB_NumberFormatForValue.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForValue.GetPosPixel().Y() ) );
+ m_aPB_NumberFormatForPercent.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForPercent.GetPosPixel().Y() ) );
+
+ Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() );
+ aPBSize.setWidth( nPBWidth );
+ m_aPB_NumberFormatForValue.SetSizePixel( aPBSize );
+ m_aPB_NumberFormatForPercent.SetSizePixel( aPBSize );
+
+ Size aCBSize( m_aCBNumber.GetSizePixel() );
+ aCBSize.setWidth(nCBXWidth);
+ m_aCBNumber.SetSizePixel( aCBSize );
+ m_aCBPercent.SetSizePixel( aCBSize );
+
+ //place and align separator and label placement listboxes
+ Size aSize( m_aFT_LabelPlacement.GetSizePixel() );
+ aSize.setWidth( m_aFT_LabelPlacement.CalcMinimumSize().getWidth() );
+ m_aFT_LabelPlacement.SetSizePixel(aSize);
+
+ long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width();
+
+ m_aSeparatorResources.PositionBelowControl(m_aCBSymbol);
+ m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, -1, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() );
+ m_aSeparatorResources.Show(true);
+
+ aSize = m_aLB_LabelPlacement.GetSizePixel();
+ aSize.setWidth( m_aSeparatorResources.GetCurrentListBoxSize().getWidth() );
+ m_aLB_LabelPlacement.SetSizePixel(aSize);
+ m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) );
+
+ //some click handler
+ m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
+ m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
+ m_aCBNumber.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
+ m_aCBPercent.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
+ m_aCBCategory.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
+ m_aCBSymbol.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
+
+ m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
+ m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
+
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
+ if( bForbidPercentValue )
+ m_aCBPercent.Enable(false);
+ }
+
+ m_aDC_Dial.SetLinkedField( &m_aNF_Degrees );
+}
+
+DataLabelResources::~DataLabelResources()
+{
+}
+
+void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter )
+{
+ m_pNumberFormatter = pFormatter;
+}
+
+IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
+{
+ if( !m_pPool || !m_pNumberFormatter )
+ {
+ DBG_ERROR("Missing item pool or number formatter");
+ return 1;
+ }
+
+ if( pButton == &m_aPB_NumberFormatForValue && !m_aCBNumber.IsChecked())
+ m_aCBNumber.Check();
+ else if( pButton == &m_aPB_NumberFormatForPercent && !m_aCBPercent.IsChecked())
+ m_aCBPercent.Check();
+
+ SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool );
+ aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
+
+ bool bPercent = ( pButton == &m_aPB_NumberFormatForPercent );
+
+ ULONG& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue;
+ bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue;
+ bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState;
+ bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState;
+
+ if(!rbMixedState)
+ aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey ));
+ aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat ));
+
+ NumberFormatDialog aDlg(m_pWindow, aNumberSet);
+ if( bPercent )
+ aDlg.SetText( String( SchResId( STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE ) ) );
+ if( RET_OK == aDlg.Execute() )
+ {
+ const SfxItemSet* pResult = aDlg.GetOutputItemSet();
+ if( pResult )
+ {
+ bool bOldSource = rUseSourceFormat;
+ ULONG nOldFormat = rnFormatKey;
+ bool bOldMixedState = rbMixedState || rbSourceMixedState;
+
+ rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState );
+
+ //todo this maybe can be removed when the numberformatter dialog does handle mixed state for source format correctly
+ if( bOldMixedState && bOldSource == rUseSourceFormat && nOldFormat == rnFormatKey )
+ rbMixedState = rbSourceMixedState = true;
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
+{
+ if( pBox )
+ pBox->EnableTriState( FALSE );
+ EnableControls();
+ return 0;
+}
+
+void DataLabelResources::EnableControls()
+{
+ m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
+
+ //enable separator
+ {
+ long nNumberOfCheckedLabelParts = 0;
+ if( m_aCBNumber.IsChecked() )
+ ++nNumberOfCheckedLabelParts;
+ if( m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() )
+ ++nNumberOfCheckedLabelParts;
+ if( m_aCBCategory.IsChecked() )
+ ++nNumberOfCheckedLabelParts;
+ m_aSeparatorResources.Enable( nNumberOfCheckedLabelParts > 1 );
+ bool bEnableTextDir = nNumberOfCheckedLabelParts > 0;
+ m_aFT_TextDirection.Enable( bEnableTextDir );
+ m_aLB_TextDirection.Enable( bEnableTextDir );
+ bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_aLB_LabelPlacement.GetEntryCount()>1;
+ m_aFT_LabelPlacement.Enable( bEnablePlacement );
+ m_aLB_LabelPlacement.Enable( bEnablePlacement );
+ }
+
+ m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() );
+ m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() );
+
+ bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
+ m_aFL_Rotate.Enable( bEnableRotation );
+ m_aDC_Dial.Enable( bEnableRotation );
+ m_aFT_Degrees.Enable( bEnableRotation );
+ m_aNF_Degrees.Enable( bEnableRotation );
+}
+
+BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
+{
+ if( m_aCBNumber.IsChecked() )
+ {
+ if( !m_bNumberFormatMixedState )
+ rOutAttrs.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, m_nNumberFormatForValue ));
+ if( !m_bSourceFormatMixedState )
+ rOutAttrs.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_bSourceFormatForValue ));
+ }
+ if( m_aCBPercent.IsChecked() )
+ {
+ if( !m_bPercentFormatMixedState )
+ rOutAttrs.Put( SfxUInt32Item( SCHATTR_PERCENT_NUMBERFORMAT_VALUE, m_nNumberFormatForPercent ));
+ if( !m_bPercentSourceMixedState )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_bSourceFormatForPercent ));
+ }
+
+ if( m_aCBNumber.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber.IsChecked() ) );
+ if( m_aCBPercent.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent.IsChecked() ) );
+ if( m_aCBCategory.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory.IsChecked() ) );
+ if( m_aCBSymbol.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol.IsChecked()) );
+
+ rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, m_aSeparatorResources.GetValue() ) );
+ ::std::map< USHORT, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) );
+ if(aIt!=m_aListBoxToPlacementMap.end())
+ {
+ sal_Int32 nValue = aIt->second;
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) );
+ }
+
+ if( m_aLB_TextDirection.GetSelectEntryCount() > 0 )
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLB_TextDirection.GetSelectEntryValue() ) );
+
+ if( m_aDC_Dial.IsVisible() )
+ {
+ sal_Int32 nDegrees = m_aDC_Dial.GetRotation();
+ rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ }
+
+ return TRUE;
+}
+
+void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
+{
+ // default state
+ m_aCBSymbol.Enable( FALSE );
+
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol );
+
+ m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
+ m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
+
+ const SfxPoolItem *pPoolItem = NULL;
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ m_aSeparatorResources.SetValue( ((const SfxStringItem*)pPoolItem)->GetValue() );
+ else
+ m_aSeparatorResources.SetDefault();
+
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue();
+ ::std::map< sal_Int32, USHORT >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
+ if(aIt!=m_aPlacementToListBoxMap.end())
+ {
+ USHORT nPos = aIt->second;
+ m_aLB_LabelPlacement.SelectEntryPos( nPos );
+ }
+ else
+ m_aLB_LabelPlacement.SetNoSelection();
+ }
+ else
+ m_aLB_LabelPlacement.SetNoSelection();
+
+ if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ m_aLB_TextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
+
+ if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ m_aDC_Dial.SetRotation( nDegrees );
+ }
+ else
+ m_aDC_Dial.SetRotation( 0 );
+
+ EnableControls();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
new file mode 100644
index 000000000000..9d887f7fbc33
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_DataLabel.hxx,v $
+ * $Revision: 1.5.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RES_DATALABEL_HXX
+#define CHART2_RES_DATALABEL_HXX
+
+#include "res_TextSeparator.hxx"
+// header for class CheckBox
+#include <vcl/button.hxx>
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+#include "TextDirectionListBox.hxx"
+
+#include <svx/dialcontrol.hxx>
+
+class SvNumberFormatter;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class DataLabelResources
+{
+public:
+ DataLabelResources( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~DataLabelResources();
+
+ BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+ void Reset(const SfxItemSet& rInAttrs);
+
+ void SetNumberFormatter( SvNumberFormatter* pFormatter );
+
+private:
+ CheckBox m_aCBNumber;
+ PushButton m_aPB_NumberFormatForValue;
+ CheckBox m_aCBPercent;
+ PushButton m_aPB_NumberFormatForPercent;
+ CheckBox m_aCBCategory;
+ CheckBox m_aCBSymbol;
+
+ TextSeparatorResources m_aSeparatorResources;
+
+ FixedText m_aFT_LabelPlacement;
+ ListBox m_aLB_LabelPlacement;
+
+ FixedLine m_aFL_Rotate;
+ svx::DialControl m_aDC_Dial;
+ FixedText m_aFT_Degrees;
+ NumericField m_aNF_Degrees;
+
+ FixedText m_aFT_TextDirection;
+ TextDirectionListBox m_aLB_TextDirection;
+
+ ::std::map< sal_Int32, USHORT > m_aPlacementToListBoxMap;
+ ::std::map< USHORT, sal_Int32 > m_aListBoxToPlacementMap;
+
+ SvNumberFormatter* m_pNumberFormatter;
+ bool m_bNumberFormatMixedState;
+ bool m_bPercentFormatMixedState;
+ ULONG m_nNumberFormatForValue;
+ ULONG m_nNumberFormatForPercent;
+
+ bool m_bSourceFormatMixedState;
+ bool m_bPercentSourceMixedState;
+ bool m_bSourceFormatForValue;
+ bool m_bSourceFormatForPercent;
+
+ Window* m_pWindow;
+ SfxItemPool* m_pPool;
+
+ DECL_LINK(NumberFormatDialogHdl, PushButton * );
+ DECL_LINK(CheckHdl, CheckBox* );
+ void EnableControls();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc b/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc
new file mode 100644
index 000000000000..31112bdc3340
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_DataLabel_IDs.hrc,v $
+ * $Revision: 1.5.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define CB_VALUE_AS_NUMBER 1
+#define CB_VALUE_AS_PERCENTAGE 2
+#define CB_CATEGORY 3
+#define CB_SYMBOL 4
+
+#define PB_NUMBERFORMAT 20
+#define PB_PERCENT_NUMBERFORMAT 21
+
+#define FT_LABEL_PLACEMENT 2
+#define LB_LABEL_PLACEMENT 2
+
+#define FT_LABEL_TEXTDIR 31
+#define LB_LABEL_TEXTDIR 32
+
+#define FL_LABEL_ROTATE 40
+#define CT_LABEL_DIAL 40
+#define FT_LABEL_DEGREES 40
+#define NF_LABEL_DEGREES 40
diff --git a/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc b/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc
new file mode 100644
index 000000000000..bc21882dd841
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_DataLabel_tmpl.hrc,v $
+ * $Revision: 1.11.20.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_DATALABEL_HXX
+#define _CHART2_RESOURCE_DATALABEL_HXX
+
+#include "HelpIds.hrc"
+#include "res_DataLabel_IDs.hrc"
+
+#define WORKAROUND \
+ StringList [ en-US ] = \
+ { \
+ "Best fit" ; \
+ "Center" ; \
+ "Above" ; \
+ "Top left" ; \
+ "Left" ; \
+ "Bottom left" ; \
+ "Below" ; \
+ "Bottom right" ; \
+ "Right" ; \
+ "Top right" ; \
+ "Inside" ; \
+ "Outside" ; \
+ "Near origin" ; \
+ };
+
+
+#define RESOURCE_DATALABEL( xpos, ypos ) \
+CheckBox CB_VALUE_AS_NUMBER \
+{ \
+ HelpID = HID_SCH_DATALABEL_VALUE; \
+ Pos = MAP_APPFONT ( xpos , ypos ) ; \
+ Size = MAP_APPFONT ( 136 , 10 ) ; \
+ TabStop = TRUE ; \
+ Text [ en-US ] = "Show value as ~number" ; \
+}; \
+PushButton PB_NUMBERFORMAT \
+{ \
+ HelpID = HID_SCH_PB_NUMBERFORMAT; \
+ TabStop = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos-3 ) ; \
+ Size = MAP_APPFONT ( 100 , 14 ) ; \
+ Text [ en-US ] = "Number ~format..." ; \
+}; \
+CheckBox CB_VALUE_AS_PERCENTAGE \
+{ \
+ HelpID = HID_SCH_DATALABEL_PERCENT; \
+ Pos = MAP_APPFONT ( xpos , ypos+17 ) ; \
+ Size = MAP_APPFONT ( 136 , 10 ) ; \
+ TabStop = TRUE ; \
+ Text [ en-US ] = "Show value as ~percentage" ; \
+}; \
+PushButton PB_PERCENT_NUMBERFORMAT \
+{ \
+ HelpID = HID_SCH_PB_PERCENT_NUMBERFORMAT; \
+ TabStop = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos+17-3 ) ; \
+ Size = MAP_APPFONT ( 100 , 14 ) ; \
+ Text [ en-US ] = "Percentage f~ormat..." ; \
+}; \
+CheckBox CB_CATEGORY \
+{ \
+ HelpID = HID_SCH_DATALABEL_TEXT; \
+ Pos = MAP_APPFONT ( xpos , ypos+33 ); \
+ Size = MAP_APPFONT ( 254 , 10 ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "Show ~category"; \
+}; \
+CheckBox CB_SYMBOL \
+{ \
+ HelpID = HID_SCH_DATALABEL_SYMBOL; \
+ Pos = MAP_APPFONT ( xpos , ypos+49 ) ; \
+ Size = MAP_APPFONT ( 254 , 10 ) ; \
+ TabStop = TRUE ; \
+ Text [ en-US ] = "Show ~legend key" ; \
+}; \
+FixedText FT_LABEL_PLACEMENT \
+{ \
+ Pos = MAP_APPFONT ( xpos , ypos+84 ) ; \
+ Size = MAP_APPFONT ( 182 , 10 ) ; \
+ TabStop = FALSE ; \
+ Text [ en-US ] = "Place~ment"; \
+}; \
+ListBox LB_LABEL_PLACEMENT \
+{ \
+ HelpID = HID_SCH_DATALABEL_PLACEMENT; \
+ Border = TRUE ; \
+ AutoHScroll = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos+82 ) ; \
+ Size = MAP_APPFONT ( 89 , 12 ) ; \
+ TabStop = TRUE ; \
+ Group = TRUE ; \
+ DropDown=TRUE; \
+ DDExtraWidth = TRUE ; \
+ WORKAROUND \
+}; \
+FixedLine FL_LABEL_ROTATE \
+{ \
+ Pos = MAP_APPFONT ( xpos, ypos+103 ) ; \
+ Size = MAP_APPFONT ( 248, 8 ) ; \
+ Text [ en-US ] = "Rotate Text" ; \
+}; \
+Control CT_LABEL_DIAL \
+{ \
+ HelpId = HID_SCH_DATALABEL_ROTATION_KNOB ; \
+ Pos = MAP_APPFONT ( xpos+6 , ypos+116 ) ; \
+ Size = MAP_APPFONT ( 43 , 43 ) ; \
+ Text = "ABCD" ; \
+}; \
+FixedText FT_LABEL_DEGREES \
+{ \
+ Pos = MAP_APPFONT ( xpos+87 , ypos+133 ) ; \
+ Size = MAP_APPFONT ( 46, 8 ) ; \
+ Text [ en-US ] = "~Degrees" ; \
+}; \
+NumericField NF_LABEL_DEGREES \
+{ \
+ HelpId = HID_SCH_DATALABEL_ROTATION_EDIT ; \
+ Pos = MAP_APPFONT ( xpos+55 , ypos+131 ) ; \
+ Size = MAP_APPFONT ( 28 , 12 ) ; \
+ Border = TRUE ; \
+ TabStop = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 0 ; \
+ Maximum = 359 ; \
+ SpinSize = 5 ; \
+}; \
+FixedText FT_LABEL_TEXTDIR \
+{ \
+ Pos = MAP_APPFONT ( xpos , ypos+162 ) ; \
+ Size = MAP_APPFONT ( 64 , 8 ) ; \
+ Text [ en-US ] = "Te~xt direction" ; \
+}; \
+ListBox LB_LABEL_TEXTDIR \
+{ \
+ HelpID = HID_SCH_TEXTDIRECTION; \
+ Pos = MAP_APPFONT ( xpos+66 , ypos+160 ) ; \
+ Size = MAP_APPFONT ( 170 , 100 ) ; \
+ Border = TRUE; \
+ TabStop = TRUE; \
+ DropDown = TRUE; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx
new file mode 100644
index 000000000000..1f17fe39a9c0
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx
@@ -0,0 +1,773 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_ErrorBar.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_ErrorBar.hxx"
+#include "res_ErrorBar_IDs.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "RangeSelectionHelper.hxx"
+// for RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR
+#include "TabPageNotifiable.hxx"
+
+#include <rtl/math.hxx>
+#include <vcl/dialog.hxx>
+#include <svl/stritem.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
+{
+ if( pDialog )
+ {
+ pDialog->Show( bEnable ? FALSE : TRUE );
+ pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ }
+}
+
+sal_uInt16 lcl_getLbEntryPosByErrorKind( SvxChartKindError eErrorKind )
+{
+ sal_uInt16 nResult = 0;
+ switch( eErrorKind )
+ {
+ // for these cases select the default in the list box
+ case CHERROR_NONE:
+ case CHERROR_PERCENT:
+ case CHERROR_CONST:
+ case CHERROR_RANGE:
+ nResult = CHART_LB_FUNCTION_STD_DEV;
+ break;
+ case CHERROR_VARIANT:
+ nResult = CHART_LB_FUNCTION_VARIANCE;
+ break;
+ case CHERROR_SIGMA:
+ nResult = CHART_LB_FUNCTION_STD_DEV;
+ break;
+ case CHERROR_BIGERROR:
+ nResult = CHART_LB_FUNCTION_ERROR_MARGIN;
+ break;
+ case CHERROR_STDERROR:
+ nResult = CHART_LB_FUNCTION_STD_ERROR;
+ break;
+ }
+ return nResult;
+}
+} // anonymous namespace
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+enum StatIndicator
+{
+ INDICATE_BOTH,
+ INDICATE_UP,
+ INDICATE_DOWN
+};
+
+ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog,
+ const SfxItemSet& rInAttrs, bool bNoneAvailable,
+ tErrorBarType eType /* = ERROR_BAR_Y */ ) :
+
+ m_aFlErrorCategory( pParent, SchResId( FL_ERROR )),
+ m_aRbNone( pParent, SchResId( RB_NONE )),
+ m_aRbConst( pParent, SchResId( RB_CONST )),
+ m_aRbPercent( pParent, SchResId( RB_PERCENT )),
+ m_aRbFunction( pParent, SchResId( RB_FUNCTION )),
+ m_aRbRange( pParent, SchResId( RB_RANGE )),
+ m_aLbFunction( pParent, SchResId( LB_FUNCTION )),
+
+ m_aFlParameters( pParent, SchResId( FL_PARAMETERS )),
+ m_aFtPositive( pParent, SchResId( FT_POSITIVE )),
+ m_aMfPositive( pParent, SchResId( MF_POSITIVE )),
+ m_aEdRangePositive( pParent, SchResId( ED_RANGE_POSITIVE )),
+ m_aIbRangePositive( pParent, SchResId( IB_RANGE_POSITIVE )),
+ m_aFtNegative( pParent, SchResId( FT_NEGATIVE )),
+ m_aMfNegative( pParent, SchResId( MF_NEGATIVE )),
+ m_aEdRangeNegative( pParent, SchResId( ED_RANGE_NEGATIVE )),
+ m_aIbRangeNegative( pParent, SchResId( IB_RANGE_NEGATIVE )),
+ m_aCbSyncPosNeg( pParent, SchResId( CB_SYN_POS_NEG )),
+
+ m_aFlIndicate( pParent, SchResId( FL_INDICATE )),
+ m_aRbBoth( pParent, SchResId( RB_BOTH )),
+ m_aRbPositive( pParent, SchResId( RB_POSITIVE )),
+ m_aRbNegative( pParent, SchResId( RB_NEGATIVE )),
+ m_aFiBoth( pParent, SchResId( FI_BOTH )),
+ m_aFiPositive( pParent, SchResId( FI_POSITIVE )),
+ m_aFiNegative( pParent, SchResId( FI_NEGATIVE )),
+
+ m_eErrorKind( CHERROR_NONE ),
+ m_eIndicate( CHINDICATE_BOTH ),
+ m_bErrorKindUnique( true ),
+ m_bIndicatorUnique( true ),
+ m_bPlusUnique( true ),
+ m_bMinusUnique( true ),
+ m_bRangePosUnique( true ),
+ m_bRangeNegUnique( true ),
+ m_bNoneAvailable( bNoneAvailable ),
+ m_eErrorBarType( eType ),
+ m_nConstDecimalDigits( 1 ),
+ m_nConstSpinSize( 1 ),
+ m_pParentWindow( pParent ),
+ m_pParentDialog( pParentDialog ),
+ m_pCurrentRangeChoosingField( 0 ),
+ m_bHasInternalDataProvider( true )
+{
+ if( m_bNoneAvailable )
+ m_aRbNone.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ else
+ m_aRbNone.Hide();
+
+ m_aRbConst.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aRbPercent.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aRbFunction.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aRbRange.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aLbFunction.SetSelectHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+
+ m_aCbSyncPosNeg.Check( FALSE );
+ m_aCbSyncPosNeg.SetToggleHdl( LINK( this, ErrorBarResources, SynchronizePosAndNeg ));
+
+ m_aMfPositive.SetModifyHdl( LINK( this, ErrorBarResources, PosValueChanged ));
+ m_aEdRangePositive.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged ));
+ m_aEdRangeNegative.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged ));
+
+ m_aRbPositive.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged ));
+ m_aRbNegative.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged ));
+ m_aRbBoth.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged ));
+
+ m_aIbRangePositive.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange ));
+ m_aIbRangeNegative.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange ));
+ m_aIbRangePositive.SetQuickHelpText( String( SchResId( STR_TIP_SELECT_RANGE )));
+ m_aIbRangeNegative.SetQuickHelpText( String( SchResId( STR_TIP_SELECT_RANGE )));
+
+ FillValueSets();
+ Reset( rInAttrs );
+}
+
+ErrorBarResources::~ErrorBarResources()
+{
+}
+
+void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType )
+{
+ if( m_eErrorBarType != eNewType )
+ {
+ m_eErrorBarType = eNewType;
+ FillValueSets();
+ }
+}
+
+void ErrorBarResources::SetChartDocumentForRangeChoosing(
+ const uno::Reference< chart2::XChartDocument > & xChartDocument )
+{
+ if( xChartDocument.is())
+ m_bHasInternalDataProvider = xChartDocument->hasInternalDataProvider();
+ m_apRangeSelectionHelper.reset( new RangeSelectionHelper( xChartDocument ));
+
+ // has internal data provider => rename "cell range" to "from data"
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( m_bHasInternalDataProvider )
+ {
+ m_aRbRange.SetText( String( SchResId( STR_CONTROLTEXT_ERROR_BARS_FROM_DATA )));
+ }
+
+ if( m_aRbRange.IsChecked())
+ {
+ isRangeFieldContentValid( m_aEdRangePositive );
+ isRangeFieldContentValid( m_aEdRangeNegative );
+ }
+}
+
+void ErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ if( fMinorStepWidth < 0 )
+ fMinorStepWidth = -fMinorStepWidth;
+
+ sal_Int32 nExponent = static_cast< sal_Int32 >( ::rtl::math::approxFloor( log10( fMinorStepWidth )));
+ if( nExponent <= 0 )
+ {
+ // one digit precision more
+ m_nConstDecimalDigits = static_cast< sal_uInt16 >( (-nExponent) + 1 );
+ m_nConstSpinSize = 10;
+ }
+ else
+ {
+ m_nConstDecimalDigits = 0;
+ m_nConstSpinSize = static_cast< sal_Int64 >( pow( 10.0, (int)nExponent ));
+ }
+}
+
+void ErrorBarResources::UpdateControlStates()
+{
+ // function
+ bool bIsFunction = m_aRbFunction.IsChecked();
+ m_aLbFunction.Enable( bIsFunction );
+
+ // range buttons
+ bool bShowRange = ( m_aRbRange.IsChecked());
+ bool bCanChooseRange =
+ ( bShowRange &&
+ m_apRangeSelectionHelper.get() &&
+ m_apRangeSelectionHelper->hasRangeSelection());
+
+ m_aMfPositive.Show( ! bShowRange );
+ m_aMfNegative.Show( ! bShowRange );
+
+ // use range but without range chooser => hide controls
+ m_aEdRangePositive.Show( bShowRange && ! m_bHasInternalDataProvider );
+ m_aIbRangePositive.Show( bCanChooseRange );
+ m_aEdRangeNegative.Show( bShowRange && ! m_bHasInternalDataProvider );
+ m_aIbRangeNegative.Show( bCanChooseRange );
+
+ bool bShowPosNegAndSync = ! (bShowRange && m_bHasInternalDataProvider);
+ m_aFtPositive.Show( bShowPosNegAndSync );
+ m_aFtNegative.Show( bShowPosNegAndSync );
+ m_aCbSyncPosNeg.Show( bShowPosNegAndSync );
+ m_aFlParameters.Show( bShowPosNegAndSync );
+
+ // unit for metric fields
+ bool bIsErrorMargin(
+ ( m_aRbFunction.IsChecked()) &&
+ ( m_aLbFunction.GetSelectEntryPos() == CHART_LB_FUNCTION_ERROR_MARGIN ));
+ bool bIsPercentage( m_aRbPercent.IsChecked() || bIsErrorMargin );
+ String aCustomUnit;
+
+ if( bIsPercentage )
+ {
+ aCustomUnit = String( RTL_CONSTASCII_USTRINGPARAM( " %" ));
+ m_aMfPositive.SetDecimalDigits( 1 );
+ m_aMfPositive.SetSpinSize( 10 );
+ m_aMfNegative.SetDecimalDigits( 1 );
+ m_aMfNegative.SetSpinSize( 10 );
+ }
+ else
+ {
+ m_aMfPositive.SetDecimalDigits( m_nConstDecimalDigits );
+ m_aMfPositive.SetSpinSize( m_nConstSpinSize );
+ m_aMfNegative.SetDecimalDigits( m_nConstDecimalDigits );
+ m_aMfNegative.SetSpinSize( m_nConstSpinSize );
+ }
+ m_aMfPositive.SetCustomUnitText( aCustomUnit );
+ m_aMfNegative.SetCustomUnitText( aCustomUnit );
+
+ // positive and negative value fields
+ bool bPosEnabled = ( m_aRbPositive.IsChecked() || m_aRbBoth.IsChecked());
+ bool bNegEnabled = ( m_aRbNegative.IsChecked() || m_aRbBoth.IsChecked());
+ if( !( bPosEnabled || bNegEnabled ))
+ {
+ // all three controls are not checked -> ambiguous state
+ bPosEnabled = true;
+ bNegEnabled = true;
+ }
+
+ // functions with only one parameter
+ bool bOneParameterCategory =
+ bIsErrorMargin || m_aRbPercent.IsChecked();
+ if( bOneParameterCategory )
+ {
+ m_aCbSyncPosNeg.Check();
+ }
+
+ if( m_aCbSyncPosNeg.IsChecked())
+ {
+ bPosEnabled = true;
+ bNegEnabled = false;
+ }
+
+ // all functions except error margin take no arguments
+ if( m_aRbFunction.IsChecked() &&
+ ( m_aLbFunction.GetSelectEntryPos() != CHART_LB_FUNCTION_ERROR_MARGIN ))
+ {
+ bPosEnabled = false;
+ bNegEnabled = false;
+ }
+
+ // enable/disable pos/neg fields
+ m_aFtPositive.Enable( bPosEnabled );
+ m_aFtNegative.Enable( bNegEnabled );
+ if( bShowRange )
+ {
+ m_aEdRangePositive.Enable( bPosEnabled );
+ m_aIbRangePositive.Enable( bPosEnabled );
+ m_aEdRangeNegative.Enable( bNegEnabled );
+ m_aIbRangeNegative.Enable( bNegEnabled );
+ }
+ else
+ {
+ m_aMfPositive.Enable( bPosEnabled );
+ m_aMfNegative.Enable( bNegEnabled );
+ }
+
+ m_aCbSyncPosNeg.Enable(
+ !bOneParameterCategory &&
+ ( bPosEnabled || bNegEnabled ));
+
+ // mark invalid entries in the range fields
+ if( bShowRange && ! m_bHasInternalDataProvider )
+ {
+ isRangeFieldContentValid( m_aEdRangePositive );
+ isRangeFieldContentValid( m_aEdRangeNegative );
+ }
+}
+
+IMPL_LINK( ErrorBarResources, CategoryChosen, void *, )
+{
+ m_bErrorKindUnique = true;
+ SvxChartKindError eOldError = m_eErrorKind;
+
+ if( m_aRbNone.IsChecked())
+ m_eErrorKind = CHERROR_NONE;
+ else if( m_aRbConst.IsChecked())
+ m_eErrorKind = CHERROR_CONST;
+ else if( m_aRbPercent.IsChecked())
+ m_eErrorKind = CHERROR_PERCENT;
+ else if( m_aRbRange.IsChecked())
+ m_eErrorKind = CHERROR_RANGE;
+ else if( m_aRbFunction.IsChecked())
+ {
+ if( m_aLbFunction.GetSelectEntryCount() == 1 )
+ {
+ switch( m_aLbFunction.GetSelectEntryPos())
+ {
+ case CHART_LB_FUNCTION_STD_ERROR:
+ m_eErrorKind = CHERROR_STDERROR; break;
+ case CHART_LB_FUNCTION_STD_DEV:
+ m_eErrorKind = CHERROR_SIGMA; break;
+ case CHART_LB_FUNCTION_VARIANCE:
+ m_eErrorKind = CHERROR_VARIANT; break;
+ case CHART_LB_FUNCTION_ERROR_MARGIN:
+ m_eErrorKind = CHERROR_BIGERROR; break;
+ default:
+ m_bErrorKindUnique = false;
+ }
+ }
+ else
+ m_bErrorKindUnique = false;
+ }
+ else
+ {
+ OSL_ENSURE( false, "Unknown category chosen" );
+ m_bErrorKindUnique = false;
+ }
+
+ // changed to range
+ if( m_eErrorKind == CHERROR_RANGE &&
+ eOldError != CHERROR_RANGE )
+ {
+ m_aCbSyncPosNeg.Check(
+ (m_aEdRangePositive.GetText().Len() > 0) &&
+ m_aEdRangePositive.GetText().Equals(
+ m_aEdRangeNegative.GetText()));
+ }
+ // changed from range
+ else if( m_eErrorKind != CHERROR_RANGE &&
+ eOldError == CHERROR_RANGE )
+ {
+ m_aCbSyncPosNeg.Check(
+ m_aMfPositive.GetValue() == m_aMfNegative.GetValue());
+ }
+
+ UpdateControlStates();
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, SynchronizePosAndNeg, void *, EMPTYARG )
+{
+ UpdateControlStates();
+ PosValueChanged( 0 );
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, PosValueChanged, void *, EMPTYARG )
+{
+ if( m_aCbSyncPosNeg.IsChecked())
+ {
+ if( m_aRbRange.IsChecked())
+ {
+ m_aEdRangeNegative.SetText( m_aEdRangePositive.GetText());
+ m_bRangeNegUnique = m_bRangePosUnique;
+ }
+ else
+ m_aMfNegative.SetValue( m_aMfPositive.GetValue());
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, IndicatorChanged, void *, EMPTYARG )
+{
+ m_bIndicatorUnique = true;
+ if( m_aRbBoth.IsChecked())
+ m_eIndicate = CHINDICATE_BOTH;
+ else if( m_aRbPositive.IsChecked())
+ m_eIndicate = CHINDICATE_UP;
+ else if( m_aRbNegative.IsChecked())
+ m_eIndicate = CHINDICATE_DOWN;
+ else
+ m_bIndicatorUnique = false;
+
+ UpdateControlStates();
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton )
+{
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( ! m_apRangeSelectionHelper.get())
+ return 0;
+ OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
+
+ ::rtl::OUString aUIString;
+ if( pButton == &m_aIbRangePositive )
+ {
+ m_pCurrentRangeChoosingField = &m_aEdRangePositive;
+ aUIString = ::rtl::OUString( String( SchResId( STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS )));
+ }
+ else
+ {
+ m_pCurrentRangeChoosingField = &m_aEdRangeNegative;
+ aUIString = ::rtl::OUString( String( SchResId( STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS )));
+ }
+
+ OSL_ASSERT( m_pParentDialog );
+ if( m_pParentDialog )
+ {
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_apRangeSelectionHelper->chooseRange(
+ m_pCurrentRangeChoosingField->GetText(),
+ aUIString, *this );
+ }
+ else
+ m_pCurrentRangeChoosingField = 0;
+
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, RangeChanged, Edit *, pEdit )
+{
+ if( pEdit == & m_aEdRangePositive )
+ {
+ m_bRangePosUnique = true;
+ PosValueChanged( 0 );
+ }
+ else
+ {
+ m_bRangeNegUnique = true;
+ }
+
+ isRangeFieldContentValid( *pEdit );
+
+ return 0;
+}
+
+void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+ SfxItemState aState = SFX_ITEM_UNKNOWN;
+
+ // category
+ m_eErrorKind = CHERROR_NONE;
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, TRUE, &pPoolItem );
+ m_bErrorKindUnique = ( aState != SFX_ITEM_DONTCARE );
+
+ if( aState == SFX_ITEM_SET )
+ m_eErrorKind = ((const SvxChartKindErrorItem*) pPoolItem)->GetValue();
+
+ m_aLbFunction.SelectEntryPos( lcl_getLbEntryPosByErrorKind( m_eErrorKind ));
+
+ if( m_bErrorKindUnique )
+ {
+ switch( m_eErrorKind )
+ {
+ case CHERROR_NONE:
+ m_aRbNone.Check();
+ break;
+ case CHERROR_PERCENT:
+ m_aRbPercent.Check();
+ break;
+ case CHERROR_CONST:
+ m_aRbConst.Check();
+ break;
+ case CHERROR_STDERROR:
+ case CHERROR_VARIANT:
+ case CHERROR_SIGMA:
+ case CHERROR_BIGERROR:
+ m_aRbFunction.Check();
+ break;
+ case CHERROR_RANGE:
+ m_aRbRange.Check();
+ break;
+ }
+ }
+ else
+ {
+ m_aRbNone.Check( FALSE );
+ m_aRbConst.Check( FALSE );
+ m_aRbPercent.Check( FALSE );
+ m_aRbFunction.Check( FALSE );
+ }
+
+ // parameters
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, TRUE, &pPoolItem );
+ m_bPlusUnique = ( aState != SFX_ITEM_DONTCARE );
+ double fPlusValue = 0.0;
+ if( aState == SFX_ITEM_SET )
+ {
+ fPlusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
+ sal_Int32 nPlusValue = static_cast< sal_Int32 >( fPlusValue * pow(10.0,m_aMfPositive.GetDecimalDigits()) );
+ m_aMfPositive.SetValue( nPlusValue );
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, TRUE, &pPoolItem );
+ m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE );
+ double fMinusValue = 0.0;
+ if( aState == SFX_ITEM_SET )
+ {
+ fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
+ sal_Int32 nMinusValue = static_cast< sal_Int32 >( fMinusValue * pow(10.0,m_aMfNegative.GetDecimalDigits()) );
+ m_aMfNegative.SetValue( nMinusValue );
+
+ if( m_eErrorKind != CHERROR_RANGE &&
+ fPlusValue == fMinusValue )
+ m_aCbSyncPosNeg.Check();
+ }
+
+ // indicator
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, TRUE, &pPoolItem );
+ m_bIndicatorUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET)
+ m_eIndicate = ((const SvxChartIndicateItem * ) pPoolItem)->GetValue();
+
+ if( m_bIndicatorUnique )
+ {
+ switch( m_eIndicate )
+ {
+ case CHINDICATE_NONE :
+ // no longer used, use both as default
+ m_eIndicate = CHINDICATE_BOTH;
+ // fall-through intended to BOTH
+ case CHINDICATE_BOTH :
+ m_aRbBoth.Check(); break;
+ case CHINDICATE_UP :
+ m_aRbPositive.Check(); break;
+ case CHINDICATE_DOWN :
+ m_aRbNegative.Check(); break;
+ }
+ }
+ else
+ {
+ m_aRbBoth.Check( FALSE );
+ m_aRbPositive.Check( FALSE );
+ m_aRbNegative.Check( FALSE );
+ }
+
+ // ranges
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, TRUE, &pPoolItem );
+ m_bRangePosUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET )
+ {
+ String sRangePositive = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue();
+ m_aEdRangePositive.SetText( sRangePositive );
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, TRUE, &pPoolItem );
+ m_bRangeNegUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET )
+ {
+ String sRangeNegative = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue();
+ m_aEdRangeNegative.SetText( sRangeNegative );
+ if( m_eErrorKind == CHERROR_RANGE &&
+ sRangeNegative.Len() > 0 &&
+ sRangeNegative.Equals( m_aEdRangePositive.GetText()))
+ m_aCbSyncPosNeg.Check();
+ }
+
+ UpdateControlStates();
+}
+
+BOOL ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const
+{
+ if( m_bErrorKindUnique )
+ rOutAttrs.Put( SvxChartKindErrorItem( m_eErrorKind, SCHATTR_STAT_KIND_ERROR ));
+ if( m_bIndicatorUnique )
+ rOutAttrs.Put( SvxChartIndicateItem( m_eIndicate, SCHATTR_STAT_INDICATE ));
+
+ if( m_bErrorKindUnique )
+ {
+ if( m_eErrorKind == CHERROR_RANGE )
+ {
+ String aPosRange;
+ String aNegRange;
+ if( m_bHasInternalDataProvider )
+ {
+ // the strings aPosRange/aNegRange have to be set to a non-empty
+ // arbitrary string to generate error-bar sequences
+ aPosRange.Assign( sal_Unicode('x'));
+ aNegRange = aPosRange;
+ }
+ else
+ {
+ aPosRange = m_aEdRangePositive.GetText();
+ if( m_aCbSyncPosNeg.IsChecked())
+ aNegRange = aPosRange;
+ else
+ aNegRange = m_aEdRangeNegative.GetText();
+ }
+
+ if( m_bRangePosUnique )
+ rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_POS, aPosRange ));
+ if( m_bRangeNegUnique )
+ rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_NEG, aNegRange ));
+ }
+ else if( m_eErrorKind == CHERROR_CONST ||
+ m_eErrorKind == CHERROR_PERCENT ||
+ m_eErrorKind == CHERROR_BIGERROR )
+ {
+ double fPosValue = static_cast< double >( m_aMfPositive.GetValue()) /
+ pow( 10.0, m_aMfPositive.GetDecimalDigits());
+ double fNegValue = 0.0;
+
+ if( m_aCbSyncPosNeg.IsChecked())
+ fNegValue = fPosValue;
+ else
+ fNegValue = static_cast< double >( m_aMfNegative.GetValue()) /
+ pow( 10.0, m_aMfNegative.GetDecimalDigits());
+
+ rOutAttrs.Put( SvxDoubleItem( fPosValue, SCHATTR_STAT_CONSTPLUS ));
+ rOutAttrs.Put( SvxDoubleItem( fNegValue, SCHATTR_STAT_CONSTMINUS ));
+ }
+ }
+
+ return TRUE;
+}
+
+void ErrorBarResources::FillValueSets()
+{
+ bool bIsHighContrast = ( true && m_aRbConst.GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ // do not scale images, show then centered
+// m_aFiPositive.SetStyle( (m_aFiPositive.GetStyle() & (~WB_SCALE)) | WB_CENTER );
+// m_aFiNegative.SetStyle( (m_aFiNegative.GetStyle() & (~WB_SCALE)) | WB_CENTER );
+// m_aFiBoth.SetStyle( (m_aFiBoth.GetStyle() & (~WB_SCALE)) | WB_CENTER );
+
+ if( m_eErrorBarType == ERROR_BAR_Y )
+ {
+ m_aFiNegative.SetImage( SELECT_IMAGE( BMP_INDICATE_DOWN ));
+ m_aFiPositive.SetImage( SELECT_IMAGE( BMP_INDICATE_UP ));
+ m_aFiBoth.SetImage( SELECT_IMAGE( BMP_INDICATE_BOTH_VERTI ));
+ }
+ else if( m_eErrorBarType == ERROR_BAR_X )
+ {
+ m_aFiNegative.SetImage( SELECT_IMAGE( BMP_INDICATE_LEFT ));
+ m_aFiPositive.SetImage( SELECT_IMAGE( BMP_INDICATE_RIGHT ));
+ m_aFiBoth.SetImage( SELECT_IMAGE( BMP_INDICATE_BOTH_HORI ));
+ }
+}
+
+void ErrorBarResources::listeningFinished(
+ const ::rtl::OUString & rNewRange )
+{
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( ! m_apRangeSelectionHelper.get())
+ return;
+
+ // rNewRange becomes invalid after removing the listener
+ ::rtl::OUString aRange( rNewRange );
+
+// m_rDialogModel.startControllerLockTimer();
+
+ // stop listening
+ m_apRangeSelectionHelper->stopRangeListening();
+
+ // change edit field
+ if( m_pParentWindow )
+ {
+ m_pParentWindow->ToTop();
+ m_pParentWindow->GrabFocus();
+ }
+
+ if( m_pCurrentRangeChoosingField )
+ {
+ m_pCurrentRangeChoosingField->SetText( String( aRange ));
+ m_pCurrentRangeChoosingField->GrabFocus();
+ PosValueChanged( 0 );
+ }
+
+ m_pCurrentRangeChoosingField = 0;
+
+ UpdateControlStates();
+ OSL_ASSERT( m_pParentDialog );
+ if( m_pParentDialog )
+ lcl_enableRangeChoosing( false, m_pParentDialog );
+}
+
+void ErrorBarResources::disposingRangeSelection()
+{
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( m_apRangeSelectionHelper.get())
+ m_apRangeSelectionHelper->stopRangeListening( false );
+}
+
+bool ErrorBarResources::isRangeFieldContentValid( Edit & rEdit )
+{
+ ::rtl::OUString aRange( rEdit.GetText());
+ bool bIsValid = ( aRange.getLength() == 0 ) ||
+ ( m_apRangeSelectionHelper.get() &&
+ m_apRangeSelectionHelper->verifyCellRange( aRange ));
+
+ if( bIsValid || !rEdit.IsEnabled())
+ {
+ rEdit.SetControlForeground();
+ rEdit.SetControlBackground();
+ }
+ else
+ {
+ rEdit.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR );
+ rEdit.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR );
+ }
+
+ return bIsValid;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc b/chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc
new file mode 100644
index 000000000000..8bac3e9c9e87
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_ErrorBar_IDs.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_ERROR 1
+#define FL_INDICATE 2
+#define FL_PARAMETERS 3
+
+#define FT_POSITIVE 1
+#define FT_NEGATIVE 2
+
+#define RB_NONE 1
+#define RB_CONST 2
+#define RB_PERCENT 3
+#define RB_FUNCTION 4
+#define RB_BOTH 5
+#define RB_POSITIVE 6
+#define RB_NEGATIVE 7
+#define RB_RANGE 8
+
+#define ED_RANGE_POSITIVE 1
+#define ED_RANGE_NEGATIVE 2
+
+#define FI_BOTH 1
+#define FI_POSITIVE 2
+#define FI_NEGATIVE 3
+#define IB_RANGE_POSITIVE 4
+#define IB_RANGE_NEGATIVE 5
+
+#define LB_FUNCTION 1
+
+#define MF_POSITIVE 1
+#define MF_NEGATIVE 2
+
+#define CB_SYN_POS_NEG 1
+
+#define CHART_LB_FUNCTION_STD_ERROR 0
+#define CHART_LB_FUNCTION_STD_DEV 1
+#define CHART_LB_FUNCTION_VARIANCE 2
+#define CHART_LB_FUNCTION_ERROR_MARGIN 3
diff --git a/chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc b/chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc
new file mode 100644
index 000000000000..6372f3000571
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_ErrorBar_tmpl.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_ERRORBARS_HXX
+#define _CHART2_RESOURCE_ERRORBARS_HXX
+
+#include "res_ErrorBar_IDs.hrc"
+#define WORKAROUND \
+StringList [ en-US ] = \
+ { \
+ < "Standard Error" ; CHART_LB_FUNCTION_STD_ERROR ; >; \
+ < "Standard Deviation" ; CHART_LB_FUNCTION_STD_DEV ; >; \
+ < "Variance" ; CHART_LB_FUNCTION_VARIANCE ; >; \
+ < "Error Margin" ; CHART_LB_FUNCTION_ERROR_MARGIN ; >; \
+ };
+
+
+#define RESOURCE_ERRORBARS(availablewidth, yoffset) \
+FixedLine FL_ERROR \
+{ \
+ Pos = MAP_APPFONT ( 6 , 6 ) ; \
+ Size = MAP_APPFONT ( 116 , 8 ) ; \
+ Text [ en-US ] = "Error Category" ; \
+}; \
+RadioButton RB_NONE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NO_ERROR; \
+ Pos = MAP_APPFONT ( 12 , 20 ) ; \
+ Size = MAP_APPFONT ( 110 , 10 ) ; \
+ Text [ en-US ] = "~None" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_CONST \
+{ \
+ HelpID = HID_SCH_STATISTIK_CONSTERROR; \
+ Pos = MAP_APPFONT ( 12 , 20 + yoffset ) ; \
+ Size = MAP_APPFONT ( 110 , 10 ) ; \
+ Text [ en-US ] = "~Constant Value" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_PERCENT \
+{ \
+ HelpID = HID_SCH_STATISTIK_PERCENT; \
+ Pos = MAP_APPFONT ( 12 , 34 + yoffset ) ; \
+ Size = MAP_APPFONT ( 110 , 10 ) ; \
+ Text [ en-US ] = "~Percentage" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_FUNCTION \
+{ \
+ HelpID = HID_SCH_STATISTIK_FUNCTION; \
+ Pos = MAP_APPFONT ( 12 , 48 + yoffset ) ; \
+ Size = MAP_APPFONT ( 12 , 10 ) ; \
+ Text [ en-US ] = "" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_RANGE \
+{ \
+ HelpID = HID_SCH_STATISTIK_RANGE; \
+ Pos = MAP_APPFONT( 12, 62 + yoffset ) ; \
+ Size = MAP_APPFONT( 110, 10 ) ; \
+ Text [ en-US ] = "Cell ~Range" ; \
+ TabStop = TRUE ; \
+}; \
+ListBox LB_FUNCTION \
+{ \
+ HelpID = HID_SCH_STATISTIK_FUNCTION_LB; \
+ Pos = MAP_APPFONT ( 22 , 46 + yoffset ) ; \
+ Size = MAP_APPFONT ( 94 , 59 ) ; \
+ DropDown = TRUE; \
+ Border = TRUE; \
+ WORKAROUND\
+}; \
+FixedLine FL_PARAMETERS \
+{ \
+ Pos = MAP_APPFONT ( 6 , 82 + yoffset ) ; \
+ Size = MAP_APPFONT ( availablewidth - 12, 8 ) ; \
+ Text [ en-US ] = "Parameters" ; \
+}; \
+FixedText FT_POSITIVE \
+{ \
+ Pos = MAP_APPFONT ( 12 , 94 + yoffset ) ; \
+ Size = MAP_APPFONT ( 46 , 8 ) ; \
+ Text [ en-US ] = "P~ositive (+)"; \
+}; \
+MetricField MF_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_POSITIVE_VALUE; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( 60 , 92 + yoffset ) ; \
+ Size = MAP_APPFONT ( 56 , 12 ) ; \
+ TabStop = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 0 ; \
+ StrictFormat = TRUE ; \
+ Unit = FUNIT_CUSTOM ; \
+ SpinSize = 100 ; \
+ DecimalDigits = 2 ; \
+}; \
+Edit ED_RANGE_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_POSITIVE_RANGE; \
+ Border = TRUE ; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 60 , 92 + yoffset ) ; \
+ Size = MAP_APPFONT ( 90 , 12 ) ; \
+}; \
+ImageButton IB_RANGE_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 152 , 91 + yoffset ) ; \
+ Size = MAP_APPFONT ( 14 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+FixedText FT_NEGATIVE \
+{ \
+ Pos = MAP_APPFONT ( 12 , 110 + yoffset ) ; \
+ Size = MAP_APPFONT ( 46 , 8 ) ; \
+ Text [ en-US ] = "~Negative (-)"; \
+}; \
+MetricField MF_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NEGATIVE_VALUE; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( 60 , 108 + yoffset ) ; \
+ Size = MAP_APPFONT ( 56 , 12 ) ; \
+ TabStop = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 0 ; \
+ StrictFormat = TRUE ; \
+ Unit = FUNIT_CUSTOM ; \
+ SpinSize = 100 ; \
+ DecimalDigits = 2 ; \
+}; \
+Edit ED_RANGE_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NEGATIVE_RANGE; \
+ Border = TRUE ; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 60 , 108 + yoffset ) ; \
+ Size = MAP_APPFONT ( 90 , 12 ) ; \
+}; \
+ImageButton IB_RANGE_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 152 , 107 + yoffset ) ; \
+ Size = MAP_APPFONT ( 14 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+CheckBox CB_SYN_POS_NEG \
+{ \
+ HelpID = HID_SCH_STATISTIK_SAME_FOR_BOTH; \
+ Pos = MAP_APPFONT ( 12 , 126 + yoffset ); \
+ Size = MAP_APPFONT ( availablewidth - 12 , 10 ); \
+ TabStop = TRUE; \
+ Text[ en-US ] = "Same value for both"; \
+}; \
+FixedLine FL_INDICATE \
+{ \
+ Pos = MAP_APPFONT ( 130 , 6 ) ; \
+ Size = MAP_APPFONT ( availablewidth - 136 , 8 ) ; \
+ Text [ en-US ] = "Error Indicator" ; \
+}; \
+RadioButton RB_BOTH \
+{ \
+ HelpID = HID_SCH_STATISTIK_SHOW_BOTH; \
+ Pos = MAP_APPFONT ( 154 , 22 ); \
+ Size = MAP_APPFONT ( 90 , 10 ); \
+ Text[ en-US ] = "Positive ~and Negative"; \
+}; \
+RadioButton RB_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_SHOW_POSITIVE; \
+ Pos = MAP_APPFONT ( 154 , 43 ); \
+ Size = MAP_APPFONT ( 90 , 10 ); \
+ Text[ en-US ] = "Pos~itive"; \
+}; \
+RadioButton RB_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_SHOW_NEGATIVE; \
+ Pos = MAP_APPFONT ( 154 , 64 ); \
+ Size = MAP_APPFONT ( 90 , 10 ); \
+ Text[ en-US ] = "Ne~gative"; \
+}; \
+FixedImage FI_BOTH \
+{ \
+ Pos = MAP_APPFONT ( 134 , 18 ); \
+ Size = MAP_APPFONT ( 18 , 18 ); \
+}; \
+FixedImage FI_POSITIVE \
+{ \
+ Pos = MAP_APPFONT ( 134 , 39 ); \
+ Size = MAP_APPFONT ( 18 , 18 ); \
+}; \
+FixedImage FI_NEGATIVE \
+{ \
+ Pos = MAP_APPFONT ( 134 , 60 ); \
+ Size = MAP_APPFONT ( 18 , 18 ); \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx
new file mode 100644
index 000000000000..4bbe7344c78d
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_LegendPosition.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_LegendPosition.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "res_LegendPosition_IDs.hrc"
+#include "ResId.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "LegendHelper.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+
+//itemset stuff
+#include "chartview/ChartSfxItemIds.hxx"
+#include <svx/chrtitem.hxx>
+// header for class SfxItemPool
+#include <svl/itempool.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+LegendPositionResources::LegendPositionResources( Window* pWindow )
+ : m_xCC() //unused in this scenario
+ , m_aCbxShow( pWindow ) //unused in this scenario
+ , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) )
+ , m_aRbtTop( pWindow, SchResId(RBT_TOP) )
+ , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) )
+ , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) )
+{
+ m_aCbxShow.Check();//legend is assumed to be visible in this scenario
+ impl_setRadioButtonToggleHdl();
+}
+
+LegendPositionResources::LegendPositionResources( Window* pWindow, const uno::Reference< uno::XComponentContext >& xCC )
+ : m_xCC( xCC )
+ , m_aCbxShow( pWindow, SchResId(CBX_SHOWLEGEND) )
+ , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) )
+ , m_aRbtTop( pWindow, SchResId(RBT_TOP) )
+ , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) )
+ , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) )
+{
+ m_aCbxShow.SetToggleHdl( LINK( this, LegendPositionResources, PositionEnableHdl ) );
+ impl_setRadioButtonToggleHdl();
+}
+
+void LegendPositionResources::impl_setRadioButtonToggleHdl()
+{
+ m_aRbtLeft.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+ m_aRbtTop.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+ m_aRbtRight.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+ m_aRbtBottom.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+}
+
+LegendPositionResources::~LegendPositionResources()
+{
+}
+
+void LegendPositionResources::writeToResources( const uno::Reference< frame::XModel >& xChartModel )
+{
+ try
+ {
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartModel );
+ uno::Reference< beans::XPropertySet > xProp( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ //show
+ sal_Bool bShowLegend = sal_False;
+ xProp->getPropertyValue( C2U("Show") ) >>= bShowLegend;
+ m_aCbxShow.Check( bShowLegend );
+ PositionEnableHdl(0);
+
+ //position
+ chart2::LegendPosition ePos;
+ xProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos;
+ switch( ePos )
+ {
+ case chart2::LegendPosition_LINE_START:
+ m_aRbtLeft.Check();
+ break;
+ case chart2::LegendPosition_LINE_END:
+ m_aRbtRight.Check();
+ break;
+ case chart2::LegendPosition_PAGE_START:
+ m_aRbtTop.Check();
+ break;
+ case chart2::LegendPosition_PAGE_END:
+ m_aRbtBottom.Check();
+ break;
+
+ case chart2::LegendPosition_CUSTOM:
+ default:
+ m_aRbtRight.Check();
+ break;
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Reference< frame::XModel >& xChartModel ) const
+{
+ try
+ {
+ sal_Bool bShowLegend = static_cast<sal_Bool>(m_aCbxShow.IsChecked());
+ uno::Reference< beans::XPropertySet > xProp( LegendHelper::getLegend( xChartModel,m_xCC,bShowLegend ), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ //show
+ xProp->setPropertyValue( C2U("Show"), uno::makeAny( bShowLegend ));
+
+ //position
+ chart2::LegendPosition eNewPos;
+ chart2::LegendExpansion eExp = chart2::LegendExpansion_HIGH;
+
+ if( m_aRbtLeft.IsChecked() )
+ eNewPos = chart2::LegendPosition_LINE_START;
+ else if( m_aRbtRight.IsChecked() )
+ {
+ eNewPos = chart2::LegendPosition_LINE_END;
+ }
+ else if( m_aRbtTop.IsChecked() )
+ {
+ eNewPos = chart2::LegendPosition_PAGE_START;
+ eExp = chart2::LegendExpansion_WIDE;
+ }
+ else if( m_aRbtBottom.IsChecked() )
+ {
+ eNewPos = chart2::LegendPosition_PAGE_END;
+ eExp = chart2::LegendExpansion_WIDE;
+ }
+
+ xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( eNewPos ));
+ xProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExp ));
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::Any());
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+IMPL_LINK( LegendPositionResources, PositionEnableHdl, void*, EMPTYARG )
+{
+ BOOL bEnable = m_aCbxShow.IsChecked();
+
+ m_aRbtLeft.Enable( bEnable );
+ m_aRbtTop.Enable( bEnable );
+ m_aRbtRight.Enable( bEnable );
+ m_aRbtBottom.Enable( bEnable );
+
+ m_aChangeLink.Call(NULL);
+
+ return 0;
+}
+
+void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
+{
+ SvxChartLegendPos ePos = CHLEGEND_NONE;
+
+ const SfxPoolItem* pPoolItem = NULL;
+ if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS,
+ TRUE, &pPoolItem ) != SFX_ITEM_SET )
+ pPoolItem = &(rInAttrs.GetPool()->GetDefaultItem( SCHATTR_LEGEND_POS ));
+
+ if( pPoolItem )
+ ePos = ((const SvxChartLegendPosItem*)pPoolItem)->GetValue();
+
+ switch( ePos )
+ {
+ case CHLEGEND_LEFT:
+ m_aRbtLeft.Check(TRUE);
+ break;
+ case CHLEGEND_TOP:
+ m_aRbtTop.Check(TRUE);
+ break;
+ case CHLEGEND_RIGHT:
+ m_aRbtRight.Check(TRUE);
+ break;
+ case CHLEGEND_BOTTOM:
+ m_aRbtBottom.Check(TRUE);
+ break;
+ default:
+ break;
+ }
+}
+
+void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
+{
+ SvxChartLegendPos ePos;
+
+ if( m_aRbtLeft.IsChecked() )
+ ePos = CHLEGEND_LEFT;
+ else if( m_aRbtTop.IsChecked() )
+ ePos = CHLEGEND_TOP;
+ else if( m_aRbtRight.IsChecked() )
+ ePos = CHLEGEND_RIGHT;
+ else if( m_aRbtBottom.IsChecked() )
+ ePos = CHLEGEND_BOTTOM;
+ else
+ ePos = CHLEGEND_NONE;
+
+ rOutAttrs.Put(SvxChartLegendPosItem( ePos, SCHATTR_LEGEND_POS ));
+}
+
+IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton*, pRadio )
+{
+ //for each radio click ther are coming two change events
+ //first uncheck of previous button -> ignore that call
+ //the second call gives the check of the new button
+ if( pRadio && pRadio->IsChecked() )
+ m_aChangeLink.Call(NULL);
+ return 0;
+}
+
+void LegendPositionResources::SetChangeHdl( const Link& rLink )
+{
+ m_aChangeLink = rLink;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.hxx b/chart2/source/controller/dialogs/res_LegendPosition.hxx
new file mode 100644
index 000000000000..81d30eb7b294
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_LegendPosition.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_LEGENPOSITION_HXX
+#define _CHART2_RES_LEGENPOSITION_HXX
+
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LegendPositionResources
+{
+public:
+ //constructor without Display checkbox
+ LegendPositionResources( Window* pParent );
+ //constructor inclusive Display checkbox
+ LegendPositionResources( Window* pParent, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext>& xCC );
+ virtual ~LegendPositionResources();
+
+ void writeToResources( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ void writeToModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel ) const;
+
+
+ void initFromItemSet( const SfxItemSet& rInAttrs );
+ void writeToItemSet( SfxItemSet& rOutAttrs ) const;
+
+ void SetChangeHdl( const Link& rLink );
+
+ DECL_LINK( PositionEnableHdl, void* );
+ DECL_LINK( PositionChangeHdl, RadioButton* );
+
+private:
+ void impl_setRadioButtonToggleHdl();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+
+ CheckBox m_aCbxShow;
+
+ RadioButton m_aRbtLeft;
+ RadioButton m_aRbtTop;
+ RadioButton m_aRbtRight;
+ RadioButton m_aRbtBottom;
+
+ Link m_aChangeLink;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc b/chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc
new file mode 100644
index 000000000000..a6ebfed27028
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_LegendPosition_IDs.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define CBX_SHOWLEGEND 21
+#define RBT_LEFT 22
+#define RBT_TOP 23
+#define RBT_RIGHT 24
+#define RBT_BOTTOM 25
diff --git a/chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc b/chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc
new file mode 100644
index 000000000000..b0f056763f55
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_LegendPosition_tmpl.hrc,v $
+ * $Revision: 1.7.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_LEGEND_HXX
+#define _CHART2_RESOURCE_LEGEND_HXX
+
+#include "HelpIds.hrc"
+#include "res_LegendPosition_IDs.hrc"
+
+#define RESOURCE_LEGENDDISPLAY( xpos , ypos ) \
+CheckBox CBX_SHOWLEGEND \
+{ \
+ HelpID = HID_SCH_LEGEND_SHOW ; \
+ Pos = MAP_APPFONT ( xpos , ypos ) ; \
+ Size = MAP_APPFONT ( 67 , 12 ) ; \
+ Text [ en-US ] = "~Display legend" ; \
+ TabStop = TRUE ; \
+};
+
+#define RESOURCE_LEGENDPOSITION( xpos , ypos ) \
+RadioButton RBT_LEFT \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_LEFT ; \
+ Pos = MAP_APPFONT ( xpos , ypos ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Left" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RBT_RIGHT \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_RIGHT ; \
+ Pos = MAP_APPFONT ( xpos , ypos+14 ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Right" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RBT_TOP \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_TOP ; \
+ Pos = MAP_APPFONT ( xpos , ypos+28 ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Top" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RBT_BOTTOM \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_BOTTOM ; \
+ Pos = MAP_APPFONT ( xpos , ypos+42 ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Bottom" ; \
+ TabStop = TRUE ; \
+};
+
+// height of RESOURCE_LEGENDPOSITION - don't forget to update when this is changed
+#define RESOURCE_LEGENDPOSITION_HEIGHT 52
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc b/chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc
new file mode 100644
index 000000000000..9d7d0e23fd02
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_SecondaryAxisCheckBoxes_tmpl.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SECONDARYAXISCHECKBOXES_HXX
+#define _CHART2_SECONDARYAXISCHECKBOXES_HXX
+
+#define SECONDARYAXISCHECKBOXES_WIDTH 42
+#define SECONDARYAXISCHECKBOXES_HEIGHT 10
+
+#define SECONDARYAXISCHECKBOXES( xpos, ypos, xOffset, yOffset ) \
+CheckBox CB_X_SECONDARY \
+{ \
+ HelpID = HID_SCH_CB_SECONDARY_XAXIS; \
+ Pos = MAP_APPFONT ( xpos , ypos ); \
+ Size = MAP_APPFONT ( SECONDARYAXISCHECKBOXES_WIDTH , SECONDARYAXISCHECKBOXES_HEIGHT ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "X ~axis"; \
+}; \
+CheckBox CB_Y_SECONDARY \
+{ \
+ HelpID = HID_SCH_CB_SECONDARY_YAXIS; \
+ Pos = MAP_APPFONT ( xpos+xOffset , ypos+yOffset ); \
+ Size = MAP_APPFONT ( SECONDARYAXISCHECKBOXES_WIDTH , SECONDARYAXISCHECKBOXES_HEIGHT ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "Y ax~is"; \
+}; \
+CheckBox CB_Z_SECONDARY \
+{ \
+ HelpID = HID_SCH_CB_SECONDARY_ZAXIS; \
+ Pos = MAP_APPFONT ( xpos+2*xOffset , ypos+2*yOffset ); \
+ Size = MAP_APPFONT ( SECONDARYAXISCHECKBOXES_WIDTH , SECONDARYAXISCHECKBOXES_HEIGHT ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "Z axi~s"; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.cxx b/chart2/source/controller/dialogs/res_TextSeparator.cxx
new file mode 100644
index 000000000000..298499ed39d9
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_TextSeparator.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_TextSeparator.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_TextSeparator.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+TextSeparatorResources::TextSeparatorResources( Window* pWindow )
+ : m_aFT_Separator( pWindow, pWindow->GetStyle() )
+ , m_aLB_Separator( pWindow , SchResId( LB_TEXT_SEPARATOR ) )
+ , m_aEntryMap()
+ , m_nDefaultPos(0)
+{
+ m_aFT_Separator.SetText( String( SchResId( STR_TEXT_SEPARATOR )) );
+ m_aFT_Separator.SetSizePixel( m_aFT_Separator.CalcMinimumSize() );
+
+ m_aLB_Separator.SetDropDownLineCount(m_aLB_Separator.GetEntryCount());
+ m_aLB_Separator.SetSizePixel( m_aLB_Separator.CalcMinimumSize() );
+
+ m_aEntryMap[ C2U( " " ) ] = 0;
+ m_aEntryMap[ C2U( ", " ) ] = 1;
+ m_aEntryMap[ C2U( "; " ) ] = 2;
+ m_aEntryMap[ C2U( "\n" ) ] = 3;
+}
+TextSeparatorResources::~TextSeparatorResources()
+{
+}
+void TextSeparatorResources::Show( bool bShow )
+{
+ m_aFT_Separator.Show( bShow );
+ m_aLB_Separator.Show( bShow );
+}
+void TextSeparatorResources::Enable( bool bEnable )
+{
+ m_aFT_Separator.Enable( bEnable );
+ m_aLB_Separator.Enable( bEnable );
+}
+void TextSeparatorResources::PositionBelowControl( const Window& rWindow )
+{
+ Point aPoint( rWindow.GetPosPixel() );
+ Size aSize( rWindow.GetSizePixel() );
+ aPoint.Y() += aSize.Height();
+ Size aBigDistanceSize( rWindow.LogicToPixel( Size(0,RSC_SP_CTRL_Y), MapMode(MAP_APPFONT) ) );
+ aPoint.Y() += aBigDistanceSize.Height();
+
+ Size aDistanceSize( rWindow.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, (RSC_CD_DROPDOWN_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2), MapMode(MAP_APPFONT) ) );
+ aPoint.Y() += aDistanceSize.Height();
+
+ m_aFT_Separator.SetPosPixel( aPoint );
+ m_aLB_Separator.SetPosPixel( Point( aPoint.X()+m_aFT_Separator.GetSizePixel().Width()+aDistanceSize.Width(), aPoint.Y()-aDistanceSize.Height()-1) );
+}
+
+void TextSeparatorResources::AlignListBoxWidthAndXPos( long nWantedLeftBorder /*use -1 to indicate that this can be automatic*/
+ , long nWantedRightBorder /*use -1 to indicate that this can be automatic*/
+ , long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ )
+{
+ long nMinPossibleLeftBorder = m_aFT_Separator.GetPosPixel().X() + m_aFT_Separator.GetSizePixel().Width() + 1 ;
+ if( nWantedLeftBorder >= 0 && nWantedLeftBorder>nMinPossibleLeftBorder )
+ {
+ Point aPos( m_aLB_Separator.GetPosPixel() );
+ aPos.X() = nWantedLeftBorder;
+ m_aLB_Separator.SetPosPixel( aPos );
+ }
+
+ long nMinPossibleRightBorder = m_aLB_Separator.GetPosPixel().X() + m_aLB_Separator.CalcMinimumSize().Width() - 1 ;
+ if( nWantedRightBorder < m_aLB_Separator.GetPosPixel().X() + nMinimumListBoxWidth )
+ nWantedRightBorder = m_aLB_Separator.GetPosPixel().X() + nMinimumListBoxWidth;
+
+ if( nWantedRightBorder >= 0 && nWantedRightBorder > nMinPossibleRightBorder )
+ {
+ Size aSize( m_aLB_Separator.GetSizePixel() );
+ aSize.Width() = nWantedRightBorder-m_aLB_Separator.GetPosPixel().X();
+ m_aLB_Separator.SetSizePixel(aSize);
+ }
+}
+
+Point TextSeparatorResources::GetCurrentListBoxPosition() const
+{
+ return m_aLB_Separator.GetPosPixel();
+}
+
+Size TextSeparatorResources::GetCurrentListBoxSize() const
+{
+ return m_aLB_Separator.GetSizePixel();
+}
+
+void TextSeparatorResources::SetValue( const rtl::OUString& rSeparator )
+{
+ ::std::map< ::rtl::OUString, USHORT >::iterator aIter( m_aEntryMap.find(rSeparator) );
+ if( aIter == m_aEntryMap.end() )
+ m_aLB_Separator.SelectEntryPos( m_nDefaultPos );
+ else
+ m_aLB_Separator.SelectEntryPos( aIter->second );
+}
+
+void TextSeparatorResources::SetDefault()
+{
+ m_aLB_Separator.SelectEntryPos( m_nDefaultPos );
+}
+
+rtl::OUString TextSeparatorResources::GetValue() const
+{
+ USHORT nPos = m_aLB_Separator.GetSelectEntryPos();
+ ::std::map< ::rtl::OUString, USHORT >::const_iterator aIter( m_aEntryMap.begin() );
+ while( aIter != m_aEntryMap.end() )
+ {
+ if(aIter->second==nPos )
+ return aIter->first;
+ ++aIter;
+ }
+ return C2U( " " );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.hxx b/chart2/source/controller/dialogs/res_TextSeparator.hxx
new file mode 100644
index 000000000000..fb8365206fb5
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_TextSeparator.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_TextSeparator.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RES_TEXTSEPARATOR_HXX
+#define CHART2_RES_TEXTSEPARATOR_HXX
+
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+
+#include <map>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TextSeparatorResources
+{
+public:
+ TextSeparatorResources( Window* pParent );
+ virtual ~TextSeparatorResources();
+
+ void Show( bool bShow );
+ void Enable( bool bEnable );
+
+ void PositionBelowControl( const Window& rWindow );
+ void AlignListBoxWidthAndXPos( long nWantedLeftBorder /*use -1 to indicate that this can be automatic*/
+ , long nWantedRightBorder /*use -1 to indicate that this can be automatic*/
+ , long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ );
+ Point GetCurrentListBoxPosition() const;
+ Size GetCurrentListBoxSize() const;
+
+ ::rtl::OUString GetValue() const;
+ void SetValue( const ::rtl::OUString& rSeparator );
+ void SetDefault();
+
+private:
+ FixedText m_aFT_Separator;
+ ListBox m_aLB_Separator;
+
+ ::std::map< ::rtl::OUString, USHORT > m_aEntryMap;
+
+ const USHORT m_nDefaultPos;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.src b/chart2/source/controller/dialogs/res_TextSeparator.src
new file mode 100644
index 000000000000..b3616f225a3f
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_TextSeparator.src
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_TextSeparator.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include "HelpIds.hrc"
+
+ListBox LB_TEXT_SEPARATOR
+{
+ HelpID = HID_SCH_DATALABEL_SEPARATOR; \
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 89 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "Space" ;
+ "Comma" ;
+ "Semicolon" ;
+ "New line" ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/res_Titles.cxx b/chart2/source/controller/dialogs/res_Titles.cxx
new file mode 100644
index 000000000000..1ac0e4338b72
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titles.cxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Titles.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_Titles.hxx"
+#include "res_Titles.hrc"
+#include "ResId.hxx"
+#include "TitleDialogData.hxx"
+
+ #ifndef _SVT_CONTROLDIMS_HRC_
+ #include <svtools/controldims.hrc>
+ #endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+TitleResources::TitleResources( Window* pWindow, bool bShowSecondaryAxesTitle )
+ : m_aFT_Main(pWindow, SchResId(FT_MAINTITLE))
+ , m_aEd_Main(pWindow, SchResId(ED_MAINTITLE))
+ , m_aFT_Sub(pWindow, SchResId(FT_SUBTITLE))
+ , m_aEd_Sub(pWindow, SchResId(ED_SUBTITLE))
+ , m_aFL_Axes(pWindow, SchResId(FL_AXES))
+ , m_aFT_XAxis(pWindow, SchResId(FT_TITLE_X_AXIS))
+ , m_aEd_XAxis(pWindow, SchResId(ED_X_AXIS))
+ , m_aFT_YAxis(pWindow, SchResId(FT_TITLE_Y_AXIS))
+ , m_aEd_YAxis(pWindow, SchResId(ED_Y_AXIS))
+ , m_aFT_ZAxis(pWindow, SchResId(FT_TITLE_Z_AXIS))
+ , m_aEd_ZAxis(pWindow, SchResId(ED_Z_AXIS))
+ , m_aFL_SecondaryAxes(pWindow, SchResId(FL_SECONDARY_AXES))
+ , m_aFT_SecondaryXAxis(pWindow, SchResId(FT_TITLE_SECONDARY_X_AXIS))
+ , m_aEd_SecondaryXAxis(pWindow, SchResId(ED_SECONDARY_X_AXIS))
+ , m_aFT_SecondaryYAxis(pWindow, SchResId(FT_TITLE_SECONDARY_Y_AXIS))
+ , m_aEd_SecondaryYAxis(pWindow, SchResId(ED_SECONDARY_Y_AXIS))
+{
+ long nMaxTextWidth = ::std::max( m_aFT_Main.CalcMinimumSize().Width(),m_aFT_Sub.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_XAxis.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_YAxis.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_ZAxis.CalcMinimumSize().Width() ) ;
+ if( bShowSecondaryAxesTitle )
+ {
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_SecondaryXAxis.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_SecondaryYAxis.CalcMinimumSize().Width() ) ;
+ }
+
+ Size aControlDistance( m_aFT_Main.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nEditFieldXPos = m_aFT_Main.GetPosPixel().X() + nMaxTextWidth + aControlDistance.Width();
+ long nEditFieldWidth = m_aEd_Main.GetPosPixel().X() + m_aEd_Main.GetSizePixel().Width() - nEditFieldXPos;
+
+ if( nEditFieldWidth > 10 )
+ {
+ Size aFTSize( m_aFT_Main.GetSizePixel() );
+ aFTSize.Width() = nMaxTextWidth;
+ m_aFT_Main.SetSizePixel(aFTSize);
+ m_aFT_Sub.SetSizePixel(aFTSize);
+ m_aFT_XAxis.SetSizePixel(aFTSize);
+ m_aFT_YAxis.SetSizePixel(aFTSize);
+ m_aFT_ZAxis.SetSizePixel(aFTSize);
+ if( bShowSecondaryAxesTitle )
+ {
+ m_aFT_SecondaryXAxis.SetSizePixel(aFTSize);
+ m_aFT_SecondaryYAxis.SetSizePixel(aFTSize);
+ }
+
+ m_aEd_Main.SetPosPixel( Point( nEditFieldXPos, m_aEd_Main.GetPosPixel().Y() ) );
+ m_aEd_Sub.SetPosPixel( Point( nEditFieldXPos, m_aEd_Sub.GetPosPixel().Y() ) );
+ m_aEd_XAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_XAxis.GetPosPixel().Y() ) );
+ m_aEd_YAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_YAxis.GetPosPixel().Y() ) );
+ m_aEd_ZAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_ZAxis.GetPosPixel().Y() ) );
+ if(bShowSecondaryAxesTitle)
+ {
+ m_aEd_SecondaryXAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_SecondaryXAxis.GetPosPixel().Y() ) );
+ m_aEd_SecondaryYAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_SecondaryYAxis.GetPosPixel().Y() ) );
+ }
+
+ Size aEditSize( m_aEd_Main.GetSizePixel() );
+ aEditSize.Width() = nEditFieldWidth;
+ m_aEd_Main.SetSizePixel( aEditSize );
+ m_aEd_Sub.SetSizePixel( aEditSize );
+ m_aEd_XAxis.SetSizePixel( aEditSize );
+ m_aEd_YAxis.SetSizePixel( aEditSize );
+ m_aEd_ZAxis.SetSizePixel( aEditSize );
+ if(bShowSecondaryAxesTitle)
+ {
+ m_aEd_SecondaryXAxis.SetSizePixel( aEditSize );
+ m_aEd_SecondaryYAxis.SetSizePixel( aEditSize );
+ }
+ }
+
+ m_aFT_SecondaryXAxis.Show( bShowSecondaryAxesTitle );
+ m_aEd_SecondaryXAxis.Show( bShowSecondaryAxesTitle );
+ m_aFT_SecondaryYAxis.Show( bShowSecondaryAxesTitle );
+ m_aEd_SecondaryYAxis.Show( bShowSecondaryAxesTitle );
+}
+
+TitleResources::~TitleResources()
+{
+}
+
+void TitleResources::SetUpdateDataHdl( const Link& rLink )
+{
+ ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
+
+ m_aEd_Main.EnableUpdateData( nTimeout );
+ m_aEd_Main.SetUpdateDataHdl( rLink );
+
+ m_aEd_Sub.EnableUpdateData( nTimeout );
+ m_aEd_Sub.SetUpdateDataHdl( rLink );
+
+ m_aEd_XAxis.EnableUpdateData( nTimeout );
+ m_aEd_XAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_YAxis.EnableUpdateData( nTimeout );
+ m_aEd_YAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_ZAxis.EnableUpdateData( nTimeout );
+ m_aEd_ZAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_SecondaryXAxis.EnableUpdateData( nTimeout );
+ m_aEd_SecondaryXAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_SecondaryYAxis.EnableUpdateData( nTimeout );
+ m_aEd_SecondaryYAxis.SetUpdateDataHdl( rLink );
+}
+
+bool TitleResources::IsModified()
+{
+ return m_aEd_Main.IsModified()
+ || m_aEd_Sub.IsModified()
+ || m_aEd_XAxis.IsModified()
+ || m_aEd_YAxis.IsModified()
+ || m_aEd_ZAxis.IsModified()
+ || m_aEd_SecondaryXAxis.IsModified()
+ || m_aEd_SecondaryYAxis.IsModified();
+}
+
+void TitleResources::ClearModifyFlag()
+{
+ m_aEd_Main.ClearModifyFlag();
+ m_aEd_Sub.ClearModifyFlag();
+ m_aEd_XAxis.ClearModifyFlag();
+ m_aEd_YAxis.ClearModifyFlag();
+ m_aEd_ZAxis.ClearModifyFlag();
+ m_aEd_SecondaryXAxis.ClearModifyFlag();
+ m_aEd_SecondaryYAxis.ClearModifyFlag();
+}
+
+void TitleResources::writeToResources( const TitleDialogData& rInput )
+{
+ m_aFT_Main.Enable( rInput.aPossibilityList[0] );
+ m_aFT_Sub.Enable( rInput.aPossibilityList[1] );
+ m_aFT_XAxis.Enable( rInput.aPossibilityList[2] );
+ m_aFT_YAxis.Enable( rInput.aPossibilityList[3] );
+ m_aFT_ZAxis.Enable( rInput.aPossibilityList[4] );
+ m_aFT_SecondaryXAxis.Enable( rInput.aPossibilityList[5] );
+ m_aFT_SecondaryYAxis.Enable( rInput.aPossibilityList[6] );
+
+ m_aEd_Main.Enable( rInput.aPossibilityList[0] );
+ m_aEd_Sub.Enable( rInput.aPossibilityList[1] );
+ m_aEd_XAxis.Enable( rInput.aPossibilityList[2] );
+ m_aEd_YAxis.Enable( rInput.aPossibilityList[3] );
+ m_aEd_ZAxis.Enable( rInput.aPossibilityList[4] );
+ m_aEd_SecondaryXAxis.Enable( rInput.aPossibilityList[5] );
+ m_aEd_SecondaryYAxis.Enable( rInput.aPossibilityList[6] );
+
+ m_aEd_Main.SetText(rInput.aTextList[0]);
+ m_aEd_Sub.SetText(rInput.aTextList[1]);
+ m_aEd_XAxis.SetText(rInput.aTextList[2]);
+ m_aEd_YAxis.SetText(rInput.aTextList[3]);
+ m_aEd_ZAxis.SetText(rInput.aTextList[4]);
+ m_aEd_SecondaryXAxis.SetText(rInput.aTextList[5]);
+ m_aEd_SecondaryYAxis.SetText(rInput.aTextList[6]);
+}
+
+void TitleResources::readFromResources( TitleDialogData& rOutput )
+{
+ rOutput.aExistenceList[0] = static_cast<sal_Bool>(m_aEd_Main.GetText().Len()!=0);
+ rOutput.aExistenceList[1] = static_cast<sal_Bool>(m_aEd_Sub.GetText().Len()!=0);
+ rOutput.aExistenceList[2] = static_cast<sal_Bool>(m_aEd_XAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[3] = static_cast<sal_Bool>(m_aEd_YAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[4] = static_cast<sal_Bool>(m_aEd_ZAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[5] = static_cast<sal_Bool>(m_aEd_SecondaryXAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[6] = static_cast<sal_Bool>(m_aEd_SecondaryYAxis.GetText().Len()!=0);
+
+ rOutput.aTextList[0] = m_aEd_Main.GetText();
+ rOutput.aTextList[1] = m_aEd_Sub.GetText();
+ rOutput.aTextList[2] = m_aEd_XAxis.GetText();
+ rOutput.aTextList[3] = m_aEd_YAxis.GetText();
+ rOutput.aTextList[4] = m_aEd_ZAxis.GetText();
+ rOutput.aTextList[5] = m_aEd_SecondaryXAxis.GetText();
+ rOutput.aTextList[6] = m_aEd_SecondaryYAxis.GetText();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_Titles.hrc b/chart2/source/controller/dialogs/res_Titles.hrc
new file mode 100644
index 000000000000..7bc3f83685bb
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titles.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Titles.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_TITLES_HRC
+#define _CHART2_RES_TITLES_HRC
+
+#define ED_MAINTITLE 1
+#define ED_SUBTITLE 2
+#define ED_X_AXIS 3
+#define ED_Y_AXIS 4
+#define ED_Z_AXIS 5
+#define ED_SECONDARY_X_AXIS 6
+#define ED_SECONDARY_Y_AXIS 7
+#define FT_MAINTITLE 1
+#define FT_SUBTITLE 2
+#define FT_TITLE_X_AXIS 3
+#define FT_TITLE_Y_AXIS 4
+#define FT_TITLE_Z_AXIS 5
+#define FT_TITLE_SECONDARY_X_AXIS 6
+#define FT_TITLE_SECONDARY_Y_AXIS 7
+#define FL_AXES 1
+#define FL_SECONDARY_AXES 2
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_Titles.hxx b/chart2/source/controller/dialogs/res_Titles.hxx
new file mode 100644
index 000000000000..63771b821ca1
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titles.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Titles.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_TITLES_HXX
+#define _CHART2_RES_TITLES_HXX
+
+#include "TitleDialogData.hxx"
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TitleResources
+{
+public:
+ TitleResources( Window* pParent, bool bShowSecondaryAxesTitle );
+ virtual ~TitleResources();
+
+ void writeToResources( const TitleDialogData& rInput );
+ void readFromResources( TitleDialogData& rOutput );
+
+ void SetUpdateDataHdl( const Link& rLink );
+ bool IsModified();
+ void ClearModifyFlag();
+
+private:
+ FixedText m_aFT_Main;
+ Edit m_aEd_Main;
+ FixedText m_aFT_Sub;
+ Edit m_aEd_Sub;
+
+ FixedLine m_aFL_Axes;
+ FixedText m_aFT_XAxis;
+ Edit m_aEd_XAxis;
+ FixedText m_aFT_YAxis;
+ Edit m_aEd_YAxis;
+ FixedText m_aFT_ZAxis;
+ Edit m_aEd_ZAxis;
+
+ FixedLine m_aFL_SecondaryAxes;
+ FixedText m_aFT_SecondaryXAxis;
+ Edit m_aEd_SecondaryXAxis;
+ FixedText m_aFT_SecondaryYAxis;
+ Edit m_aEd_SecondaryYAxis;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc b/chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc
new file mode 100644
index 000000000000..8e305cd95c21
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Titlesx_tmpl.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_TITLES_SRC
+#define _CHART2_RES_TITLES_SRC
+
+#include "res_Titles.hrc"
+#include "HelpIds.hrc"
+
+#define TITLES_HEIGHT 12
+#define indentLabel 3
+#define fixedLinesHeight RSC_CD_FIXEDLINE_HEIGHT
+
+#define TITLES( xpos, ypos, availableWidth, indentLabel, fixedLinesHeight ) \
+Edit ED_MAINTITLE \
+{ \
+ HelpID = HID_SCH_TITLE_MAIN; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_SUBTITLE \
+{ \
+ HelpID = HID_SCH_TITLE_SUB; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+TITLES_HEIGHT+4 ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_X_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_X; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+2*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_Y_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_Y; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+3*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_Z_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_Z; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+4*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_SECONDARY_X_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_SECONDARY_X; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+5*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_SECONDARY_Y_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_SECONDARY_Y; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+6*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+FixedText FT_MAINTITLE \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2 ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Title" ; \
+}; \
+FixedText FT_SUBTITLE \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+TITLES_HEIGHT+4 ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Subtitle" ; \
+}; \
+FixedLine FL_AXES \
+{ \
+ Pos = MAP_APPFONT( xpos ,ypos+2+2*(TITLES_HEIGHT+4)+0 ); \
+ Size = MAP_APPFONT( availableWidth ,fixedLinesHeight ); \
+ Text[ en-US ] = "Axes"; \
+}; \
+FixedText FT_TITLE_X_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+2*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~X axis" ; \
+}; \
+FixedText FT_TITLE_Y_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+3*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Y axis" ; \
+}; \
+FixedText FT_TITLE_Z_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+4*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Z axis" ; \
+}; \
+FixedLine FL_SECONDARY_AXES \
+{ \
+ Pos = MAP_APPFONT( xpos ,ypos+2+5*(TITLES_HEIGHT+4)+3+(fixedLinesHeight+3) ); \
+ Size = MAP_APPFONT( availableWidth ,fixedLinesHeight ); \
+ Text[ en-US ] = "Secondary Axes"; \
+}; \
+FixedText FT_TITLE_SECONDARY_X_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+5*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "X ~axis" ; \
+}; \
+FixedText FT_TITLE_SECONDARY_Y_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+6*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "Y ax~is" ; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx
new file mode 100644
index 000000000000..b53df44463a6
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Trendline.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertTrendline.hrc"
+#include "res_Trendline.hxx"
+#include "res_Trendline_IDs.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+
+#include <vector>
+#include <algorithm>
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+namespace
+{
+template< class T >
+ long lcl_getRightEdge( T & rControl )
+{
+ return rControl.CalcMinimumSize().Width() + rControl.GetPosPixel().X() - rControl.GetParent()->GetPosPixel().X();
+}
+
+template< class T >
+ void lcl_AdjustControlSize( T & rControl )
+{
+ Size aSize( rControl.GetSizePixel());
+ aSize.setWidth( rControl.CalcMinimumSize().Width());
+ rControl.SetSizePixel( aSize );
+}
+
+void lcl_AdjustControlSize( Control & rControl, long nRightEdge )
+{
+ Size aSize( rControl.GetSizePixel());
+ Point aPosition( rControl.GetPosPixel());
+ aSize.setWidth( nRightEdge - aPosition.getX());
+ rControl.SetSizePixel( aSize );
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+enum StatTrendLine
+{
+ TRENDLINE_NONE,
+ TRENDLINE_LINE,
+ TRENDLINE_LOG,
+ TRENDLINE_EXP,
+ TRENDLINE_POW
+};
+
+TrendlineResources::TrendlineResources( Window * pParent, const SfxItemSet& rInAttrs, bool bNoneAvailable ) :
+ m_aFLType( pParent, SchResId( FL_TYPE )),
+
+ m_aRBNone( pParent, SchResId( RB_NONE )),
+ m_aRBLinear( pParent, SchResId( RB_LINEAR )),
+ m_aRBLogarithmic( pParent, SchResId( RB_LOGARITHMIC )),
+ m_aRBExponential( pParent, SchResId( RB_EXPONENTIAL )),
+ m_aRBPower( pParent, SchResId( RB_POWER )),
+
+ m_aFINone( pParent, SchResId( FI_NONE )),
+ m_aFILinear( pParent, SchResId( FI_LINEAR )),
+ m_aFILogarithmic( pParent, SchResId( FI_LOGARITHMIC )),
+ m_aFIExponential( pParent, SchResId( FI_EXPONENTIAL )),
+ m_aFIPower( pParent, SchResId( FI_POWER )),
+
+ m_aFLEquation( pParent, SchResId( FL_EQUATION )),
+ m_aCBShowEquation( pParent, SchResId( CB_SHOW_EQUATION )),
+ m_aCBShowCorrelationCoeff( pParent, SchResId( CB_SHOW_CORRELATION_COEFF )),
+ m_eTrendLineType( CHREGRESS_NONE ),
+ m_bNoneAvailable( bNoneAvailable ),
+ m_bTrendLineUnique( true )
+{
+ FillValueSets();
+
+ if( m_bNoneAvailable )
+ m_aRBNone.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ else
+ m_aRBNone.Hide();
+
+ m_aRBLinear.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ m_aRBLogarithmic.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ m_aRBExponential.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ m_aRBPower.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+
+ Reset( rInAttrs );
+ UpdateControlStates();
+}
+
+TrendlineResources::~TrendlineResources()
+{}
+
+long TrendlineResources::adjustControlSizes()
+{
+ // calculate right edge
+ ::std::vector< long > aControlRightEdges;
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBNone ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBLinear ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBLogarithmic ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBExponential ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBPower ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aCBShowEquation ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aCBShowCorrelationCoeff ));
+
+ lcl_AdjustControlSize( m_aRBNone );
+ lcl_AdjustControlSize( m_aRBLinear );
+ lcl_AdjustControlSize( m_aRBLogarithmic );
+ lcl_AdjustControlSize( m_aRBExponential );
+ lcl_AdjustControlSize( m_aRBPower );
+ lcl_AdjustControlSize( m_aCBShowEquation );
+ lcl_AdjustControlSize( m_aCBShowCorrelationCoeff );
+
+ // Note: FixedLine has no CalcMinimumSize, workaround: use a FixedText
+ FixedText aDummyTextCtrl( m_aFLType.GetParent());
+ aDummyTextCtrl.SetText( m_aFLType.GetText());
+ aControlRightEdges.push_back( lcl_getRightEdge( aDummyTextCtrl ));
+ aDummyTextCtrl.SetText( m_aFLEquation.GetText());
+ aControlRightEdges.push_back( lcl_getRightEdge( aDummyTextCtrl ));
+
+ long nRightEdgeOfControls = *(::std::max_element( aControlRightEdges.begin(), aControlRightEdges.end()));
+ // leave some more space after the longest text
+ nRightEdgeOfControls += m_aFLType.LogicToPixel( Size( 6, 0 ), MapMode( MAP_APPFONT )).getWidth();
+
+ lcl_AdjustControlSize( m_aFLType, nRightEdgeOfControls );
+ lcl_AdjustControlSize( m_aFLEquation, nRightEdgeOfControls );
+
+ return nRightEdgeOfControls;
+}
+
+IMPL_LINK( TrendlineResources, SelectTrendLine, RadioButton *, pRadioButton )
+{
+ if( pRadioButton == &m_aRBLinear )
+ m_eTrendLineType = CHREGRESS_LINEAR;
+ else if( pRadioButton == &m_aRBLogarithmic )
+ m_eTrendLineType = CHREGRESS_LOG;
+ else if( pRadioButton == &m_aRBExponential )
+ m_eTrendLineType = CHREGRESS_EXP;
+ else if( pRadioButton == &m_aRBPower )
+ m_eTrendLineType = CHREGRESS_POWER;
+ else if( pRadioButton == &m_aRBNone )
+ {
+ OSL_ASSERT( m_bNoneAvailable );
+ m_eTrendLineType = CHREGRESS_NONE;
+ }
+ m_bTrendLineUnique = true;
+
+ UpdateControlStates();
+
+ return 0;
+}
+
+void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
+{
+ const SfxPoolItem *pPoolItem = NULL;
+ SfxItemState aState = SFX_ITEM_UNKNOWN;
+
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, TRUE, &pPoolItem );
+ m_bTrendLineUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET )
+ {
+ const SvxChartRegressItem * pItem = dynamic_cast< const SvxChartRegressItem * >( pPoolItem );
+ if( pItem )
+ m_eTrendLineType = pItem->GetValue();
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, TRUE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ m_aCBShowEquation.EnableTriState( TRUE );
+ m_aCBShowEquation.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ m_aCBShowEquation.EnableTriState( FALSE );
+ if( aState == SFX_ITEM_SET )
+ m_aCBShowEquation.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, TRUE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ m_aCBShowCorrelationCoeff.EnableTriState( TRUE );
+ m_aCBShowCorrelationCoeff.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ m_aCBShowCorrelationCoeff.EnableTriState( FALSE );
+ if( aState == SFX_ITEM_SET )
+ m_aCBShowCorrelationCoeff.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue());
+ }
+
+ if( m_bTrendLineUnique )
+ {
+ switch( m_eTrendLineType )
+ {
+ case CHREGRESS_LINEAR :
+ m_aRBLinear.Check();
+ break;
+ case CHREGRESS_LOG :
+ m_aRBLogarithmic.Check();
+ break;
+ case CHREGRESS_EXP :
+ m_aRBExponential.Check();
+ break;
+ case CHREGRESS_POWER :
+ m_aRBPower.Check();
+ break;
+ case CHREGRESS_NONE:
+ OSL_ASSERT( m_bNoneAvailable );
+ m_aRBNone.Check();
+ break;
+ }
+ }
+}
+
+BOOL TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const
+{
+ if( m_bTrendLineUnique )
+ rOutAttrs.Put( SvxChartRegressItem( m_eTrendLineType, SCHATTR_REGRESSION_TYPE ));
+ if( m_aCBShowEquation.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SHOW_EQUATION, m_aCBShowEquation.IsChecked() ));
+ if( m_aCBShowCorrelationCoeff.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SHOW_COEFF, m_aCBShowCorrelationCoeff.IsChecked() ));
+ return TRUE;
+}
+
+void TrendlineResources::FillValueSets()
+{
+ bool bIsHighContrast = ( true && m_aFLType.GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ if( m_bNoneAvailable )
+ m_aFINone.SetImage( SELECT_IMAGE( BMP_REGRESSION_NONE ));
+ m_aFILinear.SetImage( SELECT_IMAGE( BMP_REGRESSION_LINEAR ));
+ m_aFILogarithmic.SetImage( SELECT_IMAGE( BMP_REGRESSION_LOG ));
+ m_aFIExponential.SetImage( SELECT_IMAGE( BMP_REGRESSION_EXP ));
+ m_aFIPower.SetImage( SELECT_IMAGE( BMP_REGRESSION_POWER ));
+}
+
+void TrendlineResources::UpdateControlStates()
+{
+ if( m_bNoneAvailable )
+ {
+ bool bEnableEquationControls = !m_bTrendLineUnique || (m_eTrendLineType != CHREGRESS_NONE);
+ m_aCBShowEquation.Enable( bEnableEquationControls );
+ m_aCBShowCorrelationCoeff.Enable( bEnableEquationControls );
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx
new file mode 100644
index 000000000000..181341f5c55e
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Trendline.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RES_TRENDLINE_HXX
+#define CHART2_RES_TRENDLINE_HXX
+
+#include <vcl/window.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/itemset.hxx>
+#include <svx/chrtitem.hxx>
+
+namespace chart
+{
+
+class TrendlineResources
+{
+public:
+ TrendlineResources( Window* pParent, const SfxItemSet& rInAttrs, bool bNoneAvailable );
+ virtual ~TrendlineResources();
+
+ void Reset(const SfxItemSet& rInAttrs);
+ BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+
+ void FillValueSets();
+
+ long adjustControlSizes();
+
+private:
+ FixedLine m_aFLType;
+ RadioButton m_aRBNone;
+ RadioButton m_aRBLinear;
+ RadioButton m_aRBLogarithmic;
+ RadioButton m_aRBExponential;
+ RadioButton m_aRBPower;
+
+ FixedImage m_aFINone;
+ FixedImage m_aFILinear;
+ FixedImage m_aFILogarithmic;
+ FixedImage m_aFIExponential;
+ FixedImage m_aFIPower;
+
+ FixedLine m_aFLEquation;
+ CheckBox m_aCBShowEquation;
+ CheckBox m_aCBShowCorrelationCoeff;
+
+ SvxChartRegress m_eTrendLineType;
+
+ bool m_bNoneAvailable;
+ bool m_bTrendLineUnique;
+
+ void UpdateControlStates();
+ DECL_LINK( SelectTrendLine, RadioButton * );
+};
+
+} // namespace chart
+
+// CHART2_RES_TRENDLINE_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/res_Trendline_IDs.hrc b/chart2/source/controller/dialogs/res_Trendline_IDs.hrc
new file mode 100644
index 000000000000..4bb318bfa7ee
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline_IDs.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Trendline_IDs.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_TYPE 1
+#define FL_EQUATION 2
+
+#define FI_NONE 1
+#define FI_LINEAR 2
+#define FI_LOGARITHMIC 3
+#define FI_EXPONENTIAL 4
+#define FI_POWER 5
+
+#define RB_NONE 1
+#define RB_LINEAR 2
+#define RB_LOGARITHMIC 3
+#define RB_EXPONENTIAL 4
+#define RB_POWER 5
+
+#define CB_SHOW_EQUATION 1
+#define CB_SHOW_CORRELATION_COEFF 2
diff --git a/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc b/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc
new file mode 100644
index 000000000000..45fc55435594
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: res_Trendline_tmpl.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_TRENDLINE_HXX
+#define _CHART2_RESOURCE_TRENDLINE_HXX
+
+#include "res_Trendline_IDs.hrc"
+#include "HelpIds.hrc"
+
+#define RESOURCE_TRENDLINE(availablewidth, yoffset) \
+FixedLine FL_TYPE \
+{ \
+ Pos = MAP_APPFONT( 6 ,6 ); \
+ Size = MAP_APPFONT( availablewidth - 12 ,8 ); \
+ Text[ en-US ] = "Regression Type"; \
+}; \
+RadioButton RB_NONE \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_NONE; \
+ Pos = MAP_APPFONT( 29, 22 ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "~None"; \
+}; \
+RadioButton RB_LINEAR \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_LINEAR; \
+ Pos = MAP_APPFONT( 29, 22 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "~Linear"; \
+}; \
+RadioButton RB_LOGARITHMIC \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_LOGARITHMIC; \
+ Pos = MAP_APPFONT( 29, 44 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "L~ogarithmic"; \
+}; \
+RadioButton RB_EXPONENTIAL \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_EXPONENTIAL; \
+ Pos = MAP_APPFONT( 29, 66 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "E~xponential"; \
+}; \
+RadioButton RB_POWER \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_POWER; \
+ Pos = MAP_APPFONT( 29, 88 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "~Power"; \
+}; \
+FixedImage FI_NONE \
+{ \
+ Pos = MAP_APPFONT( 10, 18 ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_LINEAR \
+{ \
+ Pos = MAP_APPFONT( 10, 18 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_LOGARITHMIC \
+{ \
+ Pos = MAP_APPFONT( 10, 40 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_EXPONENTIAL \
+{ \
+ Pos = MAP_APPFONT( 10, 62 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_POWER \
+{ \
+ Pos = MAP_APPFONT( 10, 84 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedLine FL_EQUATION \
+{ \
+ Pos = MAP_APPFONT( 6, 108 + yoffset ); \
+ Size = MAP_APPFONT( availablewidth - 12, 8 ); \
+ Text[ en-US ] = "Equation"; \
+}; \
+CheckBox CB_SHOW_EQUATION \
+{ \
+ HelpId = HID_SCH_TRENDLINE_SHOW_EQUATION; \
+ Pos = MAP_APPFONT( 10, 120 + yoffset ); \
+ Size = MAP_APPFONT( availablewidth - 20, 10 ); \
+ TabStop = TRUE; \
+ Text[ en-US ] = "Show ~equation"; \
+}; \
+CheckBox CB_SHOW_CORRELATION_COEFF \
+{ \
+ HelpId = HID_SCH_TRENDLINE_SHOW_R_SQUARED; \
+ Pos = MAP_APPFONT( 10, 134 + yoffset ); \
+ Size = MAP_APPFONT( availablewidth - 20, 10 ); \
+ TabStop = TRUE; \
+ Text[ en-US ] = "Show ~coefficient of determination (R²)"; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
new file mode 100644
index 000000000000..61911a23dc3d
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -0,0 +1,366 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneAppearance.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_3D_SceneAppearance.hxx"
+#include "tp_3D_SceneAppearance.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "NoWarningThisInCTOR.hxx"
+#include "ChartModelHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include "macros.hxx"
+#include <rtl/math.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+struct lcl_ModelProperties
+{
+ drawing::ShadeMode m_aShadeMode;
+ sal_Int32 m_nRoundedEdges;
+ sal_Int32 m_nObjectLines;
+ ::chart::ThreeDLookScheme m_eScheme;
+
+ lcl_ModelProperties() :
+ m_nRoundedEdges(-1),
+ m_nObjectLines(-1),
+ m_eScheme(::chart::ThreeDLookScheme_Unknown)
+ {}
+};
+
+lcl_ModelProperties lcl_getPropertiesFromModel( uno::Reference< frame::XModel > & xModel )
+{
+ lcl_ModelProperties aProps;
+ try
+ {
+ uno::Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) );
+ uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY_THROW );
+ xDiaProp->getPropertyValue( C2U("D3DSceneShadeMode")) >>= aProps.m_aShadeMode;
+ ::chart::ThreeDHelper::getRoundedEdgesAndObjectLines( xDiagram, aProps.m_nRoundedEdges, aProps.m_nObjectLines );
+ aProps.m_eScheme = ::chart::ThreeDHelper::detectScheme( xDiagram );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aProps;
+}
+
+void lcl_setShadeModeAtModel( uno::Reference< frame::XModel > & xModel, drawing::ShadeMode aShadeMode )
+{
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp(
+ ::chart::ChartModelHelper::findDiagram( xModel ), uno::UNO_QUERY_THROW );
+ xDiaProp->setPropertyValue( C2U("D3DSceneShadeMode"), uno::makeAny( aShadeMode ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // anonymous namespace
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+#define POS_3DSCHEME_SIMPLE 0
+#define POS_3DSCHEME_REALISTIC 1
+#define POS_3DSCHEME_CUSTOM 2
+
+ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(
+ Window* pWindow
+ , const uno::Reference< frame::XModel > & xChartModel
+ , ControllerLockHelper & rControllerLockHelper )
+ : TabPage ( pWindow, SchResId( TP_3D_SCENEAPPEARANCE ) )
+ , m_xChartModel ( xChartModel )
+ , m_aFT_Scheme ( this, SchResId( FT_SCHEME ) )
+ , m_aLB_Scheme ( this, SchResId( LB_SCHEME ) )
+ , m_aFL_Seperator ( this, SchResId( FL_SEPERATOR ) )
+ , m_aCB_RoundedEdge ( this, SchResId( CB_ROUNDEDEDGE ) )
+ , m_aCB_Shading ( this, SchResId( CB_SHADING ) )
+ , m_aCB_ObjectLines ( this, SchResId( CB_OBJECTLINES ) )
+ , m_bUpdateOtherControls( true )
+ , m_bCommitToModel( true )
+ , m_rControllerLockHelper( rControllerLockHelper )
+{
+ FreeResource();
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_SIMPLE)),POS_3DSCHEME_SIMPLE);
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_REALISTIC)),POS_3DSCHEME_REALISTIC);
+ m_aLB_Scheme.SetDropDownLineCount(2);
+
+ m_aLB_Scheme.SetSelectHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectSchemeHdl ) );
+
+ m_aCB_RoundedEdge.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
+ m_aCB_Shading.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectShading ) );
+ m_aCB_ObjectLines.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
+
+ m_aCB_RoundedEdge.EnableTriState( TRUE );
+ m_aCB_Shading.EnableTriState( TRUE );
+ m_aCB_ObjectLines.EnableTriState( TRUE );
+
+ initControlsFromModel();
+}
+
+ThreeD_SceneAppearance_TabPage::~ThreeD_SceneAppearance_TabPage()
+{}
+
+void ThreeD_SceneAppearance_TabPage::ActivatePage()
+{
+ updateScheme();
+}
+
+void ThreeD_SceneAppearance_TabPage::commitPendingChanges()
+{
+}
+
+void ThreeD_SceneAppearance_TabPage::applyRoundedEdgeAndObjectLinesToModel()
+{
+ if(!m_bCommitToModel)
+ return;
+
+ sal_Int32 nObjectLines = -1;
+
+ switch( m_aCB_ObjectLines.GetState())
+ {
+ case STATE_NOCHECK:
+ nObjectLines = 0;
+ break;
+ case STATE_CHECK:
+ nObjectLines = 1;
+ break;
+ case STATE_DONTKNOW:
+ nObjectLines = -1;
+ break;
+ }
+
+ sal_Int32 nCurrentRoundedEdges = -1;
+ switch( m_aCB_RoundedEdge.GetState() )
+ {
+ case STATE_NOCHECK:
+ nCurrentRoundedEdges = 0;
+ break;
+ case STATE_CHECK:
+ nCurrentRoundedEdges = 5;
+ break;
+ case STATE_DONTKNOW:
+ nCurrentRoundedEdges = -1;
+ break;
+ }
+
+ // /-- locked controllers
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+ ThreeDHelper::setRoundedEdgesAndObjectLines(
+ ::chart::ChartModelHelper::findDiagram( m_xChartModel ), nCurrentRoundedEdges, nObjectLines );
+ // \-- locked controllers
+}
+
+void ThreeD_SceneAppearance_TabPage::applyShadeModeToModel()
+{
+ if(!m_bCommitToModel)
+ return;
+
+ drawing::ShadeMode aShadeMode = drawing::ShadeMode_PHONG;
+
+ switch( m_aCB_Shading.GetState())
+ {
+ case STATE_NOCHECK:
+ aShadeMode = drawing::ShadeMode_FLAT;
+ break;
+ case STATE_CHECK:
+ aShadeMode = drawing::ShadeMode_SMOOTH;
+ break;
+ case STATE_DONTKNOW:
+ // nothing
+ break;
+ }
+
+ lcl_setShadeModeAtModel( m_xChartModel, aShadeMode );
+}
+
+void ThreeD_SceneAppearance_TabPage::initControlsFromModel()
+{
+ m_bCommitToModel = false;
+ m_bUpdateOtherControls = false;
+
+ lcl_ModelProperties aProps( lcl_getPropertiesFromModel( m_xChartModel ));
+
+ if(aProps.m_aShadeMode == drawing::ShadeMode_FLAT)
+ {
+ m_aCB_Shading.EnableTriState( FALSE );
+ m_aCB_Shading.Check(FALSE);
+ }
+ else if(aProps.m_aShadeMode == drawing::ShadeMode_SMOOTH)
+ {
+ m_aCB_Shading.EnableTriState( FALSE );
+ m_aCB_Shading.Check(TRUE);
+ }
+ else
+ {
+ m_aCB_Shading.EnableTriState( TRUE );
+ m_aCB_Shading.SetState( STATE_DONTKNOW );
+ }
+
+ if(aProps.m_nObjectLines == 0)
+ {
+ m_aCB_ObjectLines.EnableTriState( FALSE );
+ m_aCB_ObjectLines.Check(FALSE);
+ }
+ else if(aProps.m_nObjectLines==1)
+ {
+ m_aCB_ObjectLines.EnableTriState( FALSE );
+ m_aCB_ObjectLines.Check(TRUE);
+ }
+ else
+ {
+ m_aCB_ObjectLines.EnableTriState( TRUE );
+ m_aCB_ObjectLines.SetState( STATE_DONTKNOW );
+ }
+
+ if(aProps.m_nRoundedEdges >= 5)
+ {
+ m_aCB_RoundedEdge.EnableTriState( FALSE );
+ m_aCB_RoundedEdge.Check(TRUE);
+ }
+ else if(aProps.m_nRoundedEdges<0)
+ {
+ m_aCB_RoundedEdge.EnableTriState( FALSE );
+ m_aCB_RoundedEdge.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ m_aCB_RoundedEdge.EnableTriState( TRUE );
+ m_aCB_RoundedEdge.Check(FALSE);
+ }
+ m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() );
+
+ updateScheme();
+
+ m_bCommitToModel = true;
+ m_bUpdateOtherControls = true;
+}
+
+void ThreeD_SceneAppearance_TabPage::updateScheme()
+{
+ lcl_ModelProperties aProps( lcl_getPropertiesFromModel( m_xChartModel ));
+
+ if( m_aLB_Scheme.GetEntryCount() == (POS_3DSCHEME_CUSTOM+1) )
+ {
+ m_aLB_Scheme.RemoveEntry(POS_3DSCHEME_CUSTOM);
+ m_aLB_Scheme.SetDropDownLineCount(2);
+ }
+ switch( aProps.m_eScheme )
+ {
+ case ThreeDLookScheme_Simple:
+ m_aLB_Scheme.SelectEntryPos( POS_3DSCHEME_SIMPLE );
+ break;
+ case ThreeDLookScheme_Realistic:
+ m_aLB_Scheme.SelectEntryPos( POS_3DSCHEME_REALISTIC );
+ break;
+ case ThreeDLookScheme_Unknown:
+ {
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_CUSTOM)),POS_3DSCHEME_CUSTOM);
+ m_aLB_Scheme.SelectEntryPos( POS_3DSCHEME_CUSTOM );
+ m_aLB_Scheme.SetDropDownLineCount(3);
+ }
+ break;
+ }
+}
+
+IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, void*, EMPTYARG )
+{
+ if( !m_bUpdateOtherControls )
+ return 0;
+
+ {
+ // /-- locked controllers
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ uno::Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( m_xChartModel ) );
+
+ if( m_aLB_Scheme.GetSelectEntryPos() == POS_3DSCHEME_REALISTIC )
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
+ else if( m_aLB_Scheme.GetSelectEntryPos() == POS_3DSCHEME_SIMPLE )
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Simple );
+ else
+ {
+ OSL_ENSURE( false, "Invalid Entry selected" );
+ }
+ // \-- locked controllers
+ }
+
+ // update other controls
+ initControlsFromModel();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectShading, void*, EMPTYARG )
+{
+ if( !m_bUpdateOtherControls )
+ return 0;
+
+ m_aCB_Shading.EnableTriState( FALSE );
+ applyShadeModeToModel();
+ updateScheme();
+ return 0;
+}
+IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, CheckBox*, pCheckBox )
+{
+ if( !m_bUpdateOtherControls )
+ return 0;
+
+ if( pCheckBox == &m_aCB_ObjectLines )
+ {
+ m_aCB_ObjectLines.EnableTriState( FALSE );
+ m_bUpdateOtherControls = false;
+ m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() );
+ if(!m_aCB_RoundedEdge.IsEnabled())
+ m_aCB_RoundedEdge.Check(FALSE);
+ m_bUpdateOtherControls = true;
+ }
+ else
+ m_aCB_RoundedEdge.EnableTriState( FALSE );
+ applyRoundedEdgeAndObjectLinesToModel();
+ updateScheme();
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc
new file mode 100644
index 000000000000..7c2344768f46
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneAppearance.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define FT_SCHEME 1
+
+#define CB_OBJECTLINES 1
+#define CB_SHADING 2
+#define CB_ROUNDEDEDGE 3
+
+#define FL_SEPERATOR 1
+
+#define LB_SHADING 1
+#define LB_SCHEME 2
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
new file mode 100644
index 000000000000..72ef5f99a500
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneAppearance.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_3D_SCENE_APPEARANCE_HXX
+#define _CHART2_TP_3D_SCENE_APPEARANCE_HXX
+
+// header for class TabPage
+#include <vcl/tabpage.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include "ControllerLockGuard.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ThreeD_SceneAppearance_TabPage : public TabPage
+{
+public:
+ ThreeD_SceneAppearance_TabPage(
+ Window* pWindow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
+ ControllerLockHelper & rControllerLockHelper );
+ virtual ~ThreeD_SceneAppearance_TabPage();
+
+ // has to be called in case the dialog was closed with OK
+ void commitPendingChanges();
+
+ virtual void ActivatePage();
+
+private:
+ DECL_LINK( SelectSchemeHdl, void* );
+ DECL_LINK( SelectShading, void* );
+ DECL_LINK( SelectRoundedEdgeOrObjectLines, CheckBox* );
+
+ void initControlsFromModel();
+ void applyShadeModeToModel();
+ void applyRoundedEdgeAndObjectLinesToModel();
+ void updateScheme();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ m_xChartModel;
+
+ FixedText m_aFT_Scheme;
+ ListBox m_aLB_Scheme;
+
+ FixedLine m_aFL_Seperator;
+
+ CheckBox m_aCB_RoundedEdge;
+ CheckBox m_aCB_Shading;
+ CheckBox m_aCB_ObjectLines;
+
+ bool m_bUpdateOtherControls;
+ bool m_bCommitToModel;
+
+ ControllerLockHelper & m_rControllerLockHelper;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src
new file mode 100644
index 000000000000..b42db4745425
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneAppearance.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_3D_SceneAppearance.hrc"
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+
+#define WIDTH_FL 108
+#define WIDTH_LB 57
+#define WIDTH_FT 41
+
+#define HEIGHT_FL 8
+#define HEIGHT_LB 12
+#define HEIGHT_FT 10
+
+#define POS_X_0 6
+#define POS_X_1 6
+#define POS_X_2 POS_X_1+WIDTH_FT+4
+
+#define POS_Y_SCHEME 8
+#define POS_Y_SEPERATOR (POS_Y_SCHEME+13)
+
+#define POS_Y_SHADING (POS_Y_SEPERATOR+16)
+#define POS_Y_OBJECTLINES (POS_Y_SHADING+16)
+#define POS_Y_ROUNDEDEDGE (POS_Y_OBJECTLINES+16)
+
+
+TabPage TP_3D_SCENEAPPEARANCE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+
+ FixedText FT_SCHEME
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_SCHEME ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "Sche~me" ;
+ };
+ ListBox LB_SCHEME
+ {
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_SCHEME-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ;
+ };
+ FixedLine FL_SEPERATOR
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_SEPERATOR ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_FL ) ;
+ };
+
+ CheckBox CB_SHADING
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_SHADING ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ;
+ Text [ en-US ] = "~Shading" ;
+ };
+ CheckBox CB_OBJECTLINES
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_OBJECTLINES ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ;
+ Text [ en-US ] = "~Object borders" ;
+ };
+ Checkbox CB_ROUNDEDEDGE
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_ROUNDEDEDGE ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ;
+ Text [ en-US ] = "~Rounded edges" ;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
new file mode 100644
index 000000000000..dbed68f2417b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneGeometry.cxx,v $
+ *
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_3D_SceneGeometry.hxx"
+#include "tp_3D_SceneGeometry.hrc"
+#include "ResId.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "BaseGFXHelper.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include <rtl/math.hxx>
+#include <svx/unoprnms.hxx>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+//using namespace ::com::sun::star::chart2;
+
+namespace
+{
+
+void lcl_shiftAngleToValidRange( sal_Int64& rnAngleDegree )
+{
+ //valid range: ]-180,180]
+ while( rnAngleDegree<=-180 )
+ rnAngleDegree+=360;
+ while( rnAngleDegree>180 )
+ rnAngleDegree-=360;
+}
+
+void lcl_SetMetricFieldLimits( MetricField& rField, sal_Int64 nLimit )
+{
+ rField.SetMin(-1*nLimit);
+ rField.SetFirst(-1*nLimit);
+ rField.SetMax(nLimit);
+ rField.SetLast(nLimit);
+}
+
+}
+ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( Window* pWindow
+ , const uno::Reference< beans::XPropertySet > & xSceneProperties
+ , ControllerLockHelper & rControllerLockHelper )
+ : TabPage ( pWindow, SchResId( TP_3D_SCENEGEOMETRY ) )
+ , m_xSceneProperties( xSceneProperties )
+ , m_aCbxRightAngledAxes( this, SchResId( CBX_RIGHT_ANGLED_AXES ) )
+ , m_aFtXRotation ( this, SchResId( FT_X_ROTATION ) )
+ , m_aMFXRotation ( this, SchResId( MTR_FLD_X_ROTATION ) )
+ , m_aFtYRotation ( this, SchResId( FT_Y_ROTATION ) )
+ , m_aMFYRotation ( this, SchResId( MTR_FLD_Y_ROTATION ) )
+ , m_aFtZRotation ( this, SchResId( FT_Z_ROTATION ) )
+ , m_aMFZRotation ( this, SchResId( MTR_FLD_Z_ROTATION ) )
+ , m_aCbxPerspective ( this, SchResId( CBX_PERSPECTIVE ) )
+ , m_aMFPerspective ( this, SchResId( MTR_FLD_PERSPECTIVE ) )
+ , m_nXRotation(0)
+ , m_nYRotation(0)
+ , m_nZRotation(0)
+ , m_bAngleChangePending( false )
+ , m_bPerspectiveChangePending( false )
+ , m_rControllerLockHelper( rControllerLockHelper )
+{
+ FreeResource();
+
+ double fXAngle, fYAngle, fZAngle;
+ ThreeDHelper::getRotationAngleFromDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
+
+ fXAngle = BaseGFXHelper::Rad2Deg( fXAngle );
+ fYAngle = BaseGFXHelper::Rad2Deg( fYAngle );
+ fZAngle = BaseGFXHelper::Rad2Deg( fZAngle );
+
+ DBG_ASSERT( fZAngle>=-90 && fZAngle<=90, "z angle is out of valid range" );
+
+ lcl_SetMetricFieldLimits( m_aMFZRotation, 90 );
+
+ m_nXRotation = ::basegfx::fround(fXAngle*pow(10.0,m_aMFXRotation.GetDecimalDigits()));
+ m_nYRotation = ::basegfx::fround(-1.0*fYAngle*pow(10.0,m_aMFYRotation.GetDecimalDigits()));
+ m_nZRotation = ::basegfx::fround(-1.0*fZAngle*pow(10.0,m_aMFZRotation.GetDecimalDigits()));
+
+ lcl_shiftAngleToValidRange( m_nXRotation );
+ lcl_shiftAngleToValidRange( m_nYRotation );
+ lcl_shiftAngleToValidRange( m_nZRotation );
+
+ m_aMFXRotation.SetValue(m_nXRotation);
+ m_aMFYRotation.SetValue(m_nYRotation);
+ m_aMFZRotation.SetValue(m_nZRotation);
+
+ const ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
+ Link aAngleChangedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleChanged ));
+ Link aAngleEditedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleEdited ));
+
+ m_aMFXRotation.EnableUpdateData( nTimeout );
+ m_aMFXRotation.SetUpdateDataHdl( aAngleChangedLink );
+ m_aMFXRotation.SetModifyHdl( aAngleEditedLink );
+
+ m_aMFYRotation.EnableUpdateData( nTimeout );
+ m_aMFYRotation.SetUpdateDataHdl( aAngleChangedLink );
+ m_aMFYRotation.SetModifyHdl( aAngleEditedLink );
+
+ m_aMFZRotation.EnableUpdateData( nTimeout );
+ m_aMFZRotation.SetUpdateDataHdl( aAngleChangedLink );
+ m_aMFZRotation.SetModifyHdl( aAngleEditedLink );
+
+ drawing::ProjectionMode aProjectionMode = drawing::ProjectionMode_PERSPECTIVE;
+ m_xSceneProperties->getPropertyValue( C2U("D3DScenePerspective")) >>= aProjectionMode;
+ m_aCbxPerspective.Check( aProjectionMode == drawing::ProjectionMode_PERSPECTIVE );
+ m_aCbxPerspective.SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveToggled ));
+
+ sal_Int32 nPerspectivePercentage = 20;
+ m_xSceneProperties->getPropertyValue( C2U("Perspective")) >>= nPerspectivePercentage;
+ m_aMFPerspective.SetValue( nPerspectivePercentage );
+
+ m_aMFPerspective.EnableUpdateData( nTimeout );
+ m_aMFPerspective.SetUpdateDataHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveChanged ) );
+ m_aMFPerspective.SetModifyHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveEdited ) );
+ m_aMFPerspective.Enable( m_aCbxPerspective.IsChecked() );
+
+
+ //RightAngledAxes
+ sal_Bool bRightAngledAxes = false;
+
+ uno::Reference< chart2::XDiagram > xDiagram( m_xSceneProperties, uno::UNO_QUERY );
+ if( ChartTypeHelper::isSupportingRightAngledAxes(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
+ {
+ m_xSceneProperties->getPropertyValue( C2U("RightAngledAxes")) >>= bRightAngledAxes;
+ m_aCbxRightAngledAxes.SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled ));
+ m_aCbxRightAngledAxes.Check( bRightAngledAxes );
+ }
+ else
+ {
+ m_aCbxRightAngledAxes.Enable(false);
+ }
+}
+
+ThreeD_SceneGeometry_TabPage::~ThreeD_SceneGeometry_TabPage()
+{
+}
+
+void ThreeD_SceneGeometry_TabPage::commitPendingChanges()
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ if( m_bAngleChangePending )
+ applyAnglesToModel();
+ if( m_bPerspectiveChangePending )
+ applyPerspectiveToModel();
+}
+
+void ThreeD_SceneGeometry_TabPage::applyAnglesToModel()
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ double fXAngle = 0.0, fYAngle = 0.0, fZAngle = 0.0;
+
+ if( !m_aMFZRotation.IsEmptyFieldValue() )
+ m_nZRotation = m_aMFZRotation.GetValue();
+
+ fXAngle = double(m_nXRotation)/double(pow(10.0,m_aMFXRotation.GetDecimalDigits()));
+ fYAngle = double(-1.0*m_nYRotation)/double(pow(10.0,m_aMFYRotation.GetDecimalDigits()));
+ fZAngle = double(-1.0*m_nZRotation)/double(pow(10.0,m_aMFZRotation.GetDecimalDigits()));
+
+ fXAngle = BaseGFXHelper::Deg2Rad( fXAngle );
+ fYAngle = BaseGFXHelper::Deg2Rad( fYAngle );
+ fZAngle = BaseGFXHelper::Deg2Rad( fZAngle );
+
+ ThreeDHelper::setRotationAngleToDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
+
+ m_bAngleChangePending = false;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, AngleEdited, void*, EMPTYARG )
+{
+ m_nXRotation = m_aMFXRotation.GetValue();
+ m_nYRotation = m_aMFYRotation.GetValue();
+
+ m_bAngleChangePending = true;
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, AngleChanged, void*, EMPTYARG )
+{
+ applyAnglesToModel();
+ return 0;
+}
+
+void ThreeD_SceneGeometry_TabPage::applyPerspectiveToModel()
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ drawing::ProjectionMode aMode = m_aCbxPerspective.IsChecked()
+ ? drawing::ProjectionMode_PERSPECTIVE
+ : drawing::ProjectionMode_PARALLEL;
+
+ try
+ {
+ m_xSceneProperties->setPropertyValue( C2U("D3DScenePerspective"), uno::makeAny( aMode ));
+ m_xSceneProperties->setPropertyValue( C2U("Perspective"), uno::makeAny( (sal_Int32)m_aMFPerspective.GetValue() ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ m_bPerspectiveChangePending = false;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, PerspectiveEdited, void*, EMPTYARG )
+{
+ m_bPerspectiveChangePending = true;
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, PerspectiveChanged, void*, EMPTYARG )
+{
+ applyPerspectiveToModel();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, PerspectiveToggled, void*, EMPTYARG )
+{
+ m_aMFPerspective.Enable( m_aCbxPerspective.IsChecked() );
+ applyPerspectiveToModel();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, void*, EMPTYARG )
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ bool bEnableZ = !m_aCbxRightAngledAxes.IsChecked();
+ m_aFtZRotation.Enable( bEnableZ );
+ m_aMFZRotation.Enable( bEnableZ );
+ m_aMFZRotation.EnableEmptyFieldValue( !bEnableZ );
+ if( !bEnableZ )
+ {
+ m_nXRotation = m_aMFXRotation.GetValue();
+ m_nYRotation = m_aMFYRotation.GetValue();
+ m_nZRotation = m_aMFZRotation.GetValue();
+
+ m_aMFXRotation.SetValue(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nXRotation), ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes())));
+ m_aMFYRotation.SetValue(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nYRotation), ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes())));
+ m_aMFZRotation.SetEmptyFieldValue();
+
+ lcl_SetMetricFieldLimits( m_aMFXRotation, static_cast<sal_Int64>(ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes()));
+ lcl_SetMetricFieldLimits( m_aMFYRotation, static_cast<sal_Int64>(ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes()));
+ }
+ else
+ {
+ lcl_SetMetricFieldLimits( m_aMFXRotation, 180 );
+ lcl_SetMetricFieldLimits( m_aMFYRotation, 180 );
+
+ m_aMFXRotation.SetValue(m_nXRotation);
+ m_aMFYRotation.SetValue(m_nYRotation);
+ m_aMFZRotation.SetValue(m_nZRotation);
+ }
+
+ ThreeDHelper::switchRightAngledAxes( m_xSceneProperties, m_aCbxRightAngledAxes.IsChecked(), true /*bRotateLights*/ );
+
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc
new file mode 100644
index 000000000000..5f1892de2885
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneGeometry.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define FT_X_ROTATION 1
+#define FT_Y_ROTATION 2
+#define FT_Z_ROTATION 3
+
+#define MTR_FLD_X_ROTATION 1
+#define MTR_FLD_Y_ROTATION 2
+#define MTR_FLD_Z_ROTATION 3
+#define MTR_FLD_PERSPECTIVE 4
+
+#define CBX_PERSPECTIVE 1
+#define CBX_RIGHT_ANGLED_AXES 2
+
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
new file mode 100644
index 000000000000..2b56f9fcc490
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneGeometry.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_3D_SCENE_GEOMETRY_HXX
+#define _CHART2_TP_3D_SCENE_GEOMETRY_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+// header for class TabPage
+#include <vcl/tabpage.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+// header for class OKButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+
+#include "ControllerLockGuard.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ThreeD_SceneGeometry_TabPage : public TabPage
+{
+public:
+ ThreeD_SceneGeometry_TabPage( Window* pWindow,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSceneProperties,
+ ControllerLockHelper & rControllerLockHelper );
+ virtual ~ThreeD_SceneGeometry_TabPage();
+
+ // has to be called in case the dialog was closed with OK
+ void commitPendingChanges();
+
+ // is called by timer to apply changes to model
+ DECL_LINK( AngleChanged, void* );
+ // is called immediately when a field changes
+ DECL_LINK( AngleEdited, void* );
+
+ // is called by timer to apply changes to model
+ DECL_LINK( PerspectiveChanged, void* );
+ // is called immediately when a field changes
+ DECL_LINK( PerspectiveEdited, void* );
+ DECL_LINK( PerspectiveToggled, void* );
+ DECL_LINK( RightAngledAxesToggled, void* );
+
+private:
+ void fillDialogAnglesFromModel() const;
+ void applyAnglesToModel();
+ void applyPerspectiveToModel();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xSceneProperties;
+
+ CheckBox m_aCbxRightAngledAxes;
+
+ FixedText m_aFtXRotation;
+ MetricField m_aMFXRotation;
+
+ FixedText m_aFtYRotation;
+ MetricField m_aMFYRotation;
+
+ FixedText m_aFtZRotation;
+ MetricField m_aMFZRotation;
+
+ CheckBox m_aCbxPerspective;
+ MetricField m_aMFPerspective;
+
+ //to keep old values when switching to right angled axes
+ sal_Int64 m_nXRotation;
+ sal_Int64 m_nYRotation;
+ sal_Int64 m_nZRotation;
+
+ bool m_bAngleChangePending;
+ bool m_bPerspectiveChangePending;
+
+ ControllerLockHelper & m_rControllerLockHelper;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src
new file mode 100644
index 000000000000..76b2005e4963
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneGeometry.src,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_3D_SceneGeometry.hrc"
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define WIDTH_FL 108
+#define WIDTH_MF 57
+#define WIDTH_FT 50
+
+#define HEIGHT_FL 8
+#define HEIGHT_MF 12
+#define HEIGHT_FT 10
+
+#define POS_X_0 6
+#define POS_X_1 6
+#define POS_X_2 POS_X_1+WIDTH_FT+4
+
+#define POS_Y_0 (8)
+#define POS_Y_1 (POS_Y_0+RSC_CD_FIXEDTEXT_HEIGHT+10)
+#define POS_Y_2 (POS_Y_1+RSC_CD_FIXEDTEXT_HEIGHT+8)
+#define POS_Y_3 (POS_Y_2+RSC_CD_FIXEDTEXT_HEIGHT+8)
+#define POS_Y_4 (POS_Y_3+RSC_CD_FIXEDTEXT_HEIGHT+12)
+
+#define CUSTOMUNITTEXT_DEGREE \
+Border = TRUE ; \
+TabStop = TRUE ; \
+Repeat = TRUE ; \
+Spin = TRUE ; \
+Minimum = -180 ; \
+Maximum = 180 ; \
+StrictFormat = TRUE ; \
+DecimalDigits = 0 ; \
+First = -180 ; \
+Last = 180 ; \
+SpinSize = 1 ; \
+Unit = FUNIT_CUSTOM ; \
+CustomUnitText [ en-US ] = " degrees" ;
+
+TabPage TP_3D_SCENEGEOMETRY
+{
+ HelpID = SID_3D_VIEW ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+
+ CheckBox CBX_RIGHT_ANGLED_AXES
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_0 ) ;
+ Size = MAP_APPFONT ( (WIDTH_FT+WIDTH_MF) , HEIGHT_FT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Right-angled axes" ;
+ };
+ FixedText FT_X_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_1 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "~X rotation" ;
+ };
+ FixedText FT_Y_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Y rotation" ;
+ };
+ FixedText FT_Z_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_3 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Z rotation" ;
+ };
+ MetricField MTR_FLD_X_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_1-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ CUSTOMUNITTEXT_DEGREE
+ };
+ MetricField MTR_FLD_Y_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_2-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ CUSTOMUNITTEXT_DEGREE
+ };
+ MetricField MTR_FLD_Z_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_3-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ CUSTOMUNITTEXT_DEGREE
+ };
+
+ CheckBox CBX_PERSPECTIVE
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_4 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Perspective" ;
+ };
+ MetricField MTR_FLD_PERSPECTIVE
+ {
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_4-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 0 ;
+ First = 0 ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
new file mode 100644
index 000000000000..fc01dc881fc3
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -0,0 +1,653 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneIllumination.cxx,v $
+ * $Revision: 1.4.68.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_3D_SceneIllumination.hxx"
+#include "tp_3D_SceneIllumination.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "CommonConverters.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+#ifndef _SVX_DIALOGS_HRC
+#include "svx/dialogs.hrc"
+#endif
+// header for define SVX_RES
+#include <svx/dialmgr.hxx>
+#include <rtl/math.hxx>
+
+// header for class SvColorDialog
+#include <svtools/colrdlg.hxx>
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+
+#include <svx/svx3ditems.hxx>
+#include <svx/svddef.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+LightButton::LightButton( Window* pParent, const ResId& rResId, sal_Int32 nLightNumber )
+ : ImageButton( pParent, rResId )
+ , m_bLightOn(false)
+{
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF_H) ), BMP_COLOR_HIGHCONTRAST );
+
+ String aTipHelpStr( SchResId(STR_TIP_LIGHTSOURCE_X) );
+ rtl::OUString aTipHelp( aTipHelpStr );
+ const rtl::OUString aReplacementStr( RTL_CONSTASCII_USTRINGPARAM( "%LIGHTNUMBER" ));
+ sal_Int32 nIndex = aTipHelp.indexOf( aReplacementStr );
+ if( nIndex != -1 )
+ {
+ aTipHelp = aTipHelp.replaceAt(nIndex, aReplacementStr.getLength(),
+ rtl::OUString::valueOf( nLightNumber ) );
+ }
+ this->SetQuickHelpText( String( aTipHelp ) );
+}
+LightButton::~LightButton()
+{
+}
+void LightButton::switchLightOn(bool bOn)
+{
+ if( m_bLightOn==bOn )
+ return;
+ m_bLightOn = bOn;
+ if(m_bLightOn)
+ {
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_ON) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_ON_H) ), BMP_COLOR_HIGHCONTRAST );
+ }
+ else
+ {
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF_H) ), BMP_COLOR_HIGHCONTRAST );
+ }
+}
+bool LightButton::isLightOn() const
+{
+ return m_bLightOn;
+}
+
+//-----------------------------------------------------------------------------
+
+ColorButton::ColorButton( Window* pParent, const ResId& rResId )
+ : ImageButton( pParent, rResId )
+{
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_COLORDLG) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_COLORDLG_H) ), BMP_COLOR_HIGHCONTRAST );
+
+ this->SetQuickHelpText( String( SchResId(STR_TIP_CHOOSECOLOR) ) );
+}
+ColorButton::~ColorButton()
+{
+}
+
+//-----------------------------------------------------------------------------
+
+struct LightSource
+{
+ long nDiffuseColor;
+ ::com::sun::star::drawing::Direction3D aDirection;
+ bool bIsEnabled;
+
+ LightSource() :
+ nDiffuseColor( 0xcccccc ),
+ aDirection( 1.0, 1.0, -1.0 ),
+ bIsEnabled( false )
+ {}
+};
+
+struct LightSourceInfo
+{
+ LightButton* pButton;
+ LightSource aLightSource;
+
+ LightSourceInfo();
+ void initButtonFromSource();
+};
+
+LightSourceInfo::LightSourceInfo()
+ : pButton(0)
+ , aLightSource()
+{
+ aLightSource.nDiffuseColor = 0xffffff; // white
+ aLightSource.aDirection = drawing::Direction3D(1,1,1);
+ aLightSource.bIsEnabled = sal_False;
+}
+void LightSourceInfo::initButtonFromSource()
+{
+ if(!pButton)
+ return;
+ pButton->SetModeImage( Image( SVX_RES( aLightSource.bIsEnabled ? RID_SVXIMAGE_LIGHT_ON : RID_SVXIMAGE_LIGHT_OFF ) ), BMP_COLOR_NORMAL );
+ pButton->SetModeImage( Image( SVX_RES( aLightSource.bIsEnabled ? RID_SVXIMAGE_LIGHT_ON_H : RID_SVXIMAGE_LIGHT_OFF_H ) ), BMP_COLOR_HIGHCONTRAST );
+}
+
+//-----------------------------------------------------------------------------
+
+namespace
+{
+ rtl::OUString lcl_makeColorName( Color rColor )
+ {
+ String aStr(SVX_RES(RID_SVXFLOAT3D_FIX_R));
+ aStr += String::CreateFromInt32((INT32)rColor.GetRed());
+ aStr += sal_Unicode(' ');
+ aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_G));
+ aStr += String::CreateFromInt32((INT32)rColor.GetGreen());
+ aStr += sal_Unicode(' ');
+ aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_B));
+ aStr += String::CreateFromInt32((INT32)rColor.GetBlue());
+ return aStr;
+ }
+ void lcl_selectColor( ColorListBox& rListBox, const Color& rColor )
+ {
+ rListBox.SetNoSelection();
+ rListBox.SelectEntry( rColor );
+ if( rListBox.GetSelectEntryCount() == 0 )
+ {
+ USHORT nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) );
+ rListBox.SelectEntryPos( nPos );
+ }
+ }
+
+ ::chart::LightSource lcl_getLightSourceFromProperties(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ sal_Int32 nIndex )
+ {
+ ::chart::LightSource aResult;
+ if( 0 <= nIndex && nIndex < 8 )
+ {
+ ::rtl::OUString aColorPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor"));
+ ::rtl::OUString aDirectionPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection"));
+ ::rtl::OUString aEnabledPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn"));
+ ::rtl::OUString aIndex( ::rtl::OUString::valueOf( nIndex + 1 ));
+
+ try
+ {
+ xSceneProperties->getPropertyValue( aColorPropertyPrefix + aIndex ) >>= aResult.nDiffuseColor;
+ xSceneProperties->getPropertyValue( aDirectionPropertyPrefix + aIndex ) >>= aResult.aDirection;
+ xSceneProperties->getPropertyValue( aEnabledPropertyPrefix + aIndex ) >>= aResult.bIsEnabled;
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+ return aResult;
+ }
+
+ void lcl_setLightSource(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ const ::chart::LightSource & rLightSource,
+ sal_Int32 nIndex )
+ {
+ if( 0 <= nIndex && nIndex < 8 )
+ {
+ ::rtl::OUString aColorPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor"));
+ ::rtl::OUString aDirectionPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection"));
+ ::rtl::OUString aEnabledPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn"));
+ ::rtl::OUString aIndex( ::rtl::OUString::valueOf( nIndex + 1 ));
+
+ try
+ {
+ xSceneProperties->setPropertyValue( aColorPropertyPrefix + aIndex,
+ uno::makeAny( rLightSource.nDiffuseColor ));
+ xSceneProperties->setPropertyValue( aDirectionPropertyPrefix + aIndex,
+ uno::makeAny( rLightSource.aDirection ));
+ xSceneProperties->setPropertyValue( aEnabledPropertyPrefix + aIndex,
+ uno::makeAny( rLightSource.bIsEnabled ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+ }
+
+ Color lcl_getAmbientColor(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties )
+ {
+ sal_Int32 nResult = 0x000000;
+ try
+ {
+ xSceneProperties->getPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor"))) >>= nResult;
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ return Color( nResult );
+ }
+
+ void lcl_setAmbientColor(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ const Color & rColor )
+ {
+ try
+ {
+ xSceneProperties->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")),
+ uno::makeAny( rColor.GetColor()));
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( Window* pWindow
+ , const uno::Reference< beans::XPropertySet > & xSceneProperties
+ , const uno::Reference< frame::XModel >& xChartModel
+ , XColorTable* pColorTable )
+ : TabPage ( pWindow, SchResId( TP_3D_SCENEILLUMINATION ) )
+ , m_aFT_LightSource( this, SchResId( FT_LIGHTSOURCE ) )
+ , m_aBtn_Light1( this, SchResId( BTN_LIGHT_1 ), 1 )
+ , m_aBtn_Light2( this, SchResId( BTN_LIGHT_2 ), 2 )
+ , m_aBtn_Light3( this, SchResId( BTN_LIGHT_3 ), 3 )
+ , m_aBtn_Light4( this, SchResId( BTN_LIGHT_4 ), 4 )
+ , m_aBtn_Light5( this, SchResId( BTN_LIGHT_5 ), 5 )
+ , m_aBtn_Light6( this, SchResId( BTN_LIGHT_6 ), 6 )
+ , m_aBtn_Light7( this, SchResId( BTN_LIGHT_7 ), 7 )
+ , m_aBtn_Light8( this, SchResId( BTN_LIGHT_8 ), 8 )
+ , m_aLB_LightSource( this, SchResId( LB_LIGHTSOURCE ) )
+ , m_aBtn_LightSource_Color( this, SchResId( BTN_LIGHTSOURCE_COLOR ) )
+ , m_aFT_AmbientLight( this, SchResId( FT_AMBIENTLIGHT ) )
+ , m_aLB_AmbientLight( this, SchResId( LB_AMBIENTLIGHT ) )
+ , m_aBtn_AmbientLight_Color( this, SchResId( BTN_AMBIENT_COLOR ) )
+ , m_aCtl_Preview( this, SchResId( CTL_LIGHT_PREVIEW ) )
+ , m_pLightSourceInfoList(0)
+ , m_xSceneProperties( xSceneProperties )
+ , m_aTimerTriggeredControllerLock( xChartModel )
+ , m_bInCommitToModel( false )
+ , m_aModelChangeListener( LINK( this, ThreeD_SceneIllumination_TabPage, fillControlsFromModel ) )
+ , m_xChartModel( xChartModel )
+{
+ FreeResource();
+
+ if(pColorTable)
+ {
+ m_aLB_AmbientLight.Fill( pColorTable );
+ m_aLB_LightSource.Fill( pColorTable );
+ }
+ m_aLB_AmbientLight.SetDropDownLineCount(10);
+ m_aLB_LightSource.SetDropDownLineCount(10);
+
+ m_pLightSourceInfoList = new LightSourceInfo[8];
+ m_pLightSourceInfoList[0].pButton = &m_aBtn_Light1;
+ m_pLightSourceInfoList[1].pButton = &m_aBtn_Light2;
+ m_pLightSourceInfoList[2].pButton = &m_aBtn_Light3;
+ m_pLightSourceInfoList[3].pButton = &m_aBtn_Light4;
+ m_pLightSourceInfoList[4].pButton = &m_aBtn_Light5;
+ m_pLightSourceInfoList[5].pButton = &m_aBtn_Light6;
+ m_pLightSourceInfoList[6].pButton = &m_aBtn_Light7;
+ m_pLightSourceInfoList[7].pButton = &m_aBtn_Light8;
+
+ fillControlsFromModel(0);
+
+ m_aBtn_Light1.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light2.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light3.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light4.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light5.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light6.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light7.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light8.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+
+ m_aLB_AmbientLight.SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
+ m_aLB_LightSource.SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
+
+ m_aBtn_AmbientLight_Color.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
+ m_aBtn_LightSource_Color.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
+
+ m_aCtl_Preview.SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
+ m_aCtl_Preview.SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
+
+ ClickLightSourceButtonHdl(&m_aBtn_Light2);
+
+ //m_aDelyedModelChangeTimer.SetTimeout( 4*EDIT_UPDATEDATA_TIMEOUT );
+
+ m_aModelChangeListener.startListening( uno::Reference< util::XModifyBroadcaster >(m_xSceneProperties, uno::UNO_QUERY) );
+}
+
+ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
+{
+ delete[] m_pLightSourceInfoList;
+}
+
+void ThreeD_SceneIllumination_TabPage::commitPendingChanges()
+{
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void *, EMPTYARG )
+{
+ if( m_bInCommitToModel )//don't read own changes
+ return 0;
+
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ m_pLightSourceInfoList[nL].aLightSource = lcl_getLightSourceFromProperties( m_xSceneProperties, nL );
+ for( nL=0; nL<8; nL++)
+ m_pLightSourceInfoList[nL].initButtonFromSource();
+
+ lcl_selectColor( m_aLB_AmbientLight, lcl_getAmbientColor( m_xSceneProperties ));
+
+ this->updatePreview();
+
+ return 0;
+}
+
+void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLightNumber )
+{
+ ControllerLockGuard aGuard( m_xChartModel );
+ m_bInCommitToModel = true;
+ sal_Int32 nIndex( nLightNumber );
+ lcl_setLightSource( m_xSceneProperties, m_pLightSourceInfoList[nIndex].aLightSource, nIndex );
+ m_bInCommitToModel = false;
+}
+
+void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aGuard( m_xChartModel );
+ for( sal_Int32 nL=0; nL<8; nL++)
+ applyLightSourceToModel( nL );
+ m_aTimerTriggeredControllerLock.startTimer();
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, void*, EMPTYARG )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+
+ //update m_pLightSourceInfoList from preview
+ const SfxItemSet a3DLightAttributes(m_aCtl_Preview.GetSvx3DLightControl().Get3DAttributes());
+ LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
+
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor1Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff1Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection1Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[1];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor2Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff2Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection2Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[2];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor3Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff3Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection3Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[3];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor4Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff4Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection4Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[4];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor5Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff5Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection5Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[5];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor6Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff6Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection6Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[6];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor7Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff7Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection7Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[7];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor8Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff8Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection8Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue());
+
+ applyLightSourcesToModel();
+
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, void*, EMPTYARG )
+{
+ sal_uInt32 nLightNumber = m_aCtl_Preview.GetSvx3DLightControl().GetSelectedLight();
+ if(nLightNumber<8)
+ {
+ LightButton* pButton = m_pLightSourceInfoList[nLightNumber].pButton;
+ if(!pButton->IsChecked())
+ ClickLightSourceButtonHdl(pButton);
+
+ applyLightSourcesToModel();
+ }
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton )
+{
+ bool bIsAmbientLight = (pButton==&m_aBtn_AmbientLight_Color);
+ ColorLB* pListBox = ( bIsAmbientLight ? &m_aLB_AmbientLight : &m_aLB_LightSource);
+
+ SvColorDialog aColorDlg( this );
+ aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
+ if( aColorDlg.Execute() == RET_OK )
+ {
+ Color aColor( aColorDlg.GetColor());
+ lcl_selectColor( *pListBox, aColor );
+ if( bIsAmbientLight )
+ {
+ m_bInCommitToModel = true;
+ lcl_setAmbientColor( m_xSceneProperties, aColor );
+ m_bInCommitToModel = false;
+ }
+ else
+ {
+ //get active lightsource:
+ LightSourceInfo* pInfo = 0;
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ {
+ pInfo = &m_pLightSourceInfoList[nL];
+ if(pInfo->pButton->IsChecked())
+ break;
+ pInfo = 0;
+ }
+ if(pInfo)
+ applyLightSourceToModel( nL );
+ }
+ SelectColorHdl( pListBox );
+ }
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, ColorLB*, pListBox )
+{
+ if(pListBox==&m_aLB_AmbientLight)
+ {
+ m_bInCommitToModel = true;
+ lcl_setAmbientColor( m_xSceneProperties, pListBox->GetSelectEntryColor().GetColor());
+ m_bInCommitToModel = false;
+ }
+ else if(pListBox==&m_aLB_LightSource)
+ {
+ //get active lightsource:
+ LightSourceInfo* pInfo = 0;
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ {
+ pInfo = &m_pLightSourceInfoList[nL];
+ if(pInfo->pButton->IsChecked())
+ break;
+ pInfo = 0;
+ }
+ if(pInfo)
+ {
+ pInfo->aLightSource.nDiffuseColor = pListBox->GetSelectEntryColor().GetColor();
+ applyLightSourceToModel( nL );
+ }
+ }
+ this->updatePreview();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, LightButton*, pButton )
+{
+ if( !pButton )
+ return 0;
+
+ LightSourceInfo* pInfo = 0;
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ {
+ if( m_pLightSourceInfoList[nL].pButton == pButton )
+ {
+ pInfo = &m_pLightSourceInfoList[nL];
+ break;
+ }
+ }
+
+ //update light button
+ bool bIsChecked = pButton->IsChecked();
+ if(bIsChecked)
+ {
+ pButton->switchLightOn(!pButton->isLightOn());
+ if(pInfo)
+ {
+ pInfo->aLightSource.bIsEnabled=pButton->isLightOn();
+ applyLightSourceToModel( nL );
+ }
+ }
+ else
+ {
+ ControllerLockGuard aGuard( m_xChartModel );
+ for( nL=0; nL<8; nL++)
+ {
+ LightButton* pLightButton = m_pLightSourceInfoList[nL].pButton;
+ pLightButton->Check( pLightButton == pButton );
+ }
+ }
+
+ //update color list box
+ if(pInfo)
+ {
+ lcl_selectColor( m_aLB_LightSource, pInfo->aLightSource.nDiffuseColor );
+ }
+ this->updatePreview();
+ return 0;
+}
+
+void ThreeD_SceneIllumination_TabPage::updatePreview()
+{
+ SfxItemSet aItemSet(m_aCtl_Preview.GetSvx3DLightControl().Get3DAttributes());
+ LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
+
+ // AmbientColor
+ aItemSet.Put(Svx3DAmbientcolorItem(m_aLB_AmbientLight.GetSelectEntryColor()));
+
+ aItemSet.Put(Svx3DLightcolor1Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff1Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection1Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[1];
+ aItemSet.Put(Svx3DLightcolor2Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff2Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection2Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[2];
+ aItemSet.Put(Svx3DLightcolor3Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff3Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection3Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[3];
+ aItemSet.Put(Svx3DLightcolor4Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff4Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection4Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[4];
+ aItemSet.Put(Svx3DLightcolor5Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff5Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection5Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[5];
+ aItemSet.Put(Svx3DLightcolor6Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff6Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection6Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[6];
+ aItemSet.Put(Svx3DLightcolor7Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff7Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection7Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[7];
+ aItemSet.Put(Svx3DLightcolor8Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff8Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection8Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ // set lights and ambient light
+ m_aCtl_Preview.GetSvx3DLightControl().Set3DAttributes(aItemSet);
+
+ // select light
+ for(sal_uInt32 a(0); a < 8; a++)
+ {
+ if(m_pLightSourceInfoList[a].pButton->IsChecked())
+ {
+ m_aCtl_Preview.GetSvx3DLightControl().SelectLight(a);
+ m_aCtl_Preview.CheckSelection();
+ break;
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc
new file mode 100644
index 000000000000..cf8d6f562371
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneIllumination.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define FT_AMBIENTLIGHT 1
+#define FT_LIGHTSOURCE 2
+
+#define LB_AMBIENTLIGHT 1
+#define LB_LIGHTSOURCE 2
+
+#define BTN_AMBIENT_COLOR 1
+#define BTN_LIGHTSOURCE_COLOR 2
+#define BTN_LIGHT_1 3
+#define BTN_LIGHT_2 4
+#define BTN_LIGHT_3 5
+#define BTN_LIGHT_4 6
+#define BTN_LIGHT_5 7
+#define BTN_LIGHT_6 8
+#define BTN_LIGHT_7 9
+#define BTN_LIGHT_8 10
+
+#define CTL_LIGHT_PREVIEW 1
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
new file mode 100644
index 000000000000..64607a4cad63
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneIllumination.hxx,v $
+ * $Revision: 1.3.68.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_3D_SCENE_ILLUMIMATION_HXX
+#define _CHART2_TP_3D_SCENE_ILLUMIMATION_HXX
+
+#include "ModifyListenerCallBack.hxx"
+#include "TimerTriggeredControllerLock.hxx"
+
+// #ifndef _COM_SUN_STAR_CHART2_SCENEDESCRIPTOR_HPP_
+// #include <com/sun/star/chart2/SceneDescriptor.hpp>
+// #endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+// header for class TabPage
+#include <vcl/tabpage.hxx>
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class ColorLB
+#include <svx/dlgctrl.hxx>
+// header for class SvxLightCtl3D
+#include <svx/dlgctl3d.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LightButton : public ImageButton
+{
+public:
+ LightButton( Window* pParent, const ResId& rResId, sal_Int32 nLightNumber );
+ virtual ~LightButton();
+
+ void switchLightOn(bool bOn);
+ bool isLightOn() const;
+
+private:
+ bool m_bLightOn;
+};
+
+class ColorButton : public ImageButton
+{
+public:
+ ColorButton( Window* pParent, const ResId& rResId );
+ virtual ~ColorButton();
+};
+
+struct LightSourceInfo;
+
+class ThreeD_SceneIllumination_TabPage : public TabPage
+{
+public:
+ ThreeD_SceneIllumination_TabPage(
+ Window* pWindow,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSceneProperties,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel,
+ XColorTable* pColorTable=0 );
+ virtual ~ThreeD_SceneIllumination_TabPage();
+
+ // has to be called in case the dialog was closed with OK
+ void commitPendingChanges();
+
+private:
+ DECL_LINK( ClickLightSourceButtonHdl, LightButton* );
+ DECL_LINK( SelectColorHdl, ColorLB* );
+ DECL_LINK( ColorDialogHdl, Button* );
+ DECL_LINK( PreviewChangeHdl, void* );
+ DECL_LINK( PreviewSelectHdl, void* );
+
+ void updatePreview();
+
+private:
+ DECL_LINK(fillControlsFromModel, void *);
+
+ void applyLightSourceToModel( sal_uInt32 nLightNumber );
+ void applyLightSourcesToModel();
+
+ FixedText m_aFT_LightSource;
+
+ LightButton m_aBtn_Light1;
+ LightButton m_aBtn_Light2;
+ LightButton m_aBtn_Light3;
+ LightButton m_aBtn_Light4;
+ LightButton m_aBtn_Light5;
+ LightButton m_aBtn_Light6;
+ LightButton m_aBtn_Light7;
+ LightButton m_aBtn_Light8;
+
+ ColorLB m_aLB_LightSource;
+ ColorButton m_aBtn_LightSource_Color;
+
+ FixedText m_aFT_AmbientLight;
+ ColorLB m_aLB_AmbientLight;
+ ColorButton m_aBtn_AmbientLight_Color;
+
+ SvxLightCtl3D m_aCtl_Preview;
+
+ LightSourceInfo* m_pLightSourceInfoList;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xSceneProperties;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+
+ bool m_bInCommitToModel;
+
+ ModifyListenerCallBack m_aModelChangeListener;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src
new file mode 100644
index 000000000000..d2919b9078ca
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_3D_SceneIllumination.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_3D_SceneIllumination.hrc"
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+
+#define WIDTH_HEAD 108
+#define WIDTH_FT 41
+#define WIDTH_LB 57
+#define WIDTH_IB 12
+#define BUTTON_DISTANCE 14
+
+#define HEIGHT_IB 12
+#define HEIGHT_FT 10
+#define HEIGHT_LB 12
+
+#define POS_X_0 6
+#define POS_X_1 (POS_X_0+WIDTH_LB+4)
+#define POS_X_2 (POS_X_1+WIDTH_IB+6)
+
+#define WIDTH_PREVIEW (VIEW3D_PAGE_WIDTH-POS_X_2-6)
+
+#define POS_Y_LIGHTSOURCE_HEAD 3
+#define POS_Y_LIGHTSOURCE_BUTTONS (POS_Y_LIGHTSOURCE_HEAD+12)
+#define POS_Y_LIGHTSOURCE_BUTTONS_2 (POS_Y_LIGHTSOURCE_BUTTONS+HEIGHT_IB+2)
+#define POS_Y_LIGHTSOURCE (POS_Y_LIGHTSOURCE_BUTTONS_2+16)
+
+#define POS_Y_AMBIENT_HEAD (POS_Y_LIGHTSOURCE+18)
+#define POS_Y_AMBIENT (POS_Y_AMBIENT_HEAD+12)
+
+#define POS_Y_PREVIEW POS_Y_LIGHTSOURCE_BUTTONS
+
+#define HEIGHT_PREVIEW POS_Y_AMBIENT+HEIGHT_LB-POS_Y_PREVIEW
+
+TabPage TP_3D_SCENEILLUMINATION
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+
+ FixedText FT_LIGHTSOURCE
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_HEAD ) ;
+ Size = MAP_APPFONT ( WIDTH_HEAD , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Light source" ;
+ };
+ ImageButton BTN_LIGHT_1
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_2
+ {
+ Pos = MAP_APPFONT ( POS_X_0+BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_3
+ {
+ Pos = MAP_APPFONT ( POS_X_0+2*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_4
+ {
+ Pos = MAP_APPFONT ( POS_X_0+3*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_5
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_6
+ {
+ Pos = MAP_APPFONT ( POS_X_0+1*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_7
+ {
+ Pos = MAP_APPFONT ( POS_X_0+2*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_8
+ {
+ Pos = MAP_APPFONT ( POS_X_0+3*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ListBox LB_LIGHTSOURCE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE ) ;
+ Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_LIGHTSOURCE_COLOR
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_LIGHTSOURCE ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ TabStop = TRUE ;
+ };
+
+
+
+
+ FixedText FT_AMBIENTLIGHT
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_AMBIENT_HEAD ) ;
+ Size = MAP_APPFONT ( WIDTH_HEAD , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Ambient light" ;
+ };
+ ListBox LB_AMBIENTLIGHT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_AMBIENT ) ;
+ Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_AMBIENT_COLOR
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_AMBIENT ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ TabStop = TRUE ;
+ };
+
+
+
+ Control CTL_LIGHT_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_PREVIEW ) ;
+ Size = MAP_APPFONT ( WIDTH_PREVIEW , HEIGHT_PREVIEW ) ;
+ TabStop = TRUE ;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
new file mode 100644
index 000000000000..a7407b4781ee
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -0,0 +1,326 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_AxisLabel.cxx,v $
+ * $Revision: 1.10.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_AxisLabel.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+// header for SvxChartTextOrientItem / SvxChartTextOrderItem
+#include <svx/chrtitem.hxx>
+
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+#include <svx/eeitem.hxx>
+#include <svx/frmdiritem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchAxisLabelTabPage::SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, SchResId( TP_AXIS_LABEL ), rInAttrs ),
+
+ aCbShowDescription( this, SchResId( CB_AXIS_LABEL_SCHOW_DESCR ) ),
+
+ aFlOrder( this, SchResId( FL_AXIS_LABEL_ORDER ) ),
+ aRbSideBySide( this, SchResId( RB_AXIS_LABEL_SIDEBYSIDE ) ),
+ aRbUpDown( this, SchResId( RB_AXIS_LABEL_UPDOWN ) ),
+ aRbDownUp( this, SchResId( RB_AXIS_LABEL_DOWNUP ) ),
+ aRbAuto( this, SchResId( RB_AXIS_LABEL_AUTOORDER ) ),
+
+ aFlSeparator( this, SchResId( FL_SEPARATOR ) ),
+ aFlTextFlow( this, SchResId( FL_AXIS_LABEL_TEXTFLOW ) ),
+ aCbTextOverlap( this, SchResId( CB_AXIS_LABEL_TEXTOVERLAP ) ),
+ aCbTextBreak( this, SchResId( CB_AXIS_LABEL_TEXTBREAK ) ),
+
+ aFlOrient( this, SchResId( FL_AXIS_LABEL_ORIENTATION ) ),
+ aCtrlDial( this, SchResId( CT_AXIS_LABEL_DIAL ) ),
+ aFtRotate( this, SchResId( FT_AXIS_LABEL_DEGREES ) ),
+ aNfRotate( this, SchResId( NF_AXIS_LABEL_ORIENT ) ),
+ aCbStacked( this, SchResId( PB_AXIS_LABEL_TEXTSTACKED ) ),
+ aOrientHlp( aCtrlDial, aNfRotate, aCbStacked ),
+
+ m_aFtTextDirection( this, SchResId( FT_AXIS_TEXTDIR ) ),
+ m_aLbTextDirection( this, SchResId( LB_AXIS_TEXTDIR ), &m_aFtTextDirection ),
+
+ m_bShowStaggeringControls( true ),
+
+ m_nInitialDegrees( 0 ),
+ m_bHasInitialDegrees( true ),
+ m_bInitialStacking( false ),
+ m_bHasInitialStacking( true )
+{
+ FreeResource();
+
+ aCbStacked.EnableTriState( FALSE );
+ aOrientHlp.AddDependentWindow( aFlOrient );
+ aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
+
+ aCbShowDescription.SetClickHdl( LINK( this, SchAxisLabelTabPage, ToggleShowLabel ) );
+
+ // Make the fixed line separator vertical.
+ aFlSeparator.SetStyle (aFlSeparator.GetStyle() | WB_VERT);
+
+ Construct();
+}
+
+SchAxisLabelTabPage::~SchAxisLabelTabPage()
+{}
+
+void SchAxisLabelTabPage::Construct()
+{
+}
+
+
+SfxTabPage* SchAxisLabelTabPage::Create( Window* pParent, const SfxItemSet& rAttrs )
+{
+ return new SchAxisLabelTabPage( pParent, rAttrs );
+}
+
+BOOL SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ bool bStacked = false;
+ if( aOrientHlp.GetStackedState() != STATE_DONTKNOW )
+ {
+ bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
+ if( !m_bHasInitialStacking || (bStacked != m_bInitialStacking) )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
+ }
+
+ if( aCtrlDial.HasRotation() )
+ {
+ sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
+ if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) )
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ }
+
+ if( m_bShowStaggeringControls )
+ {
+ SvxChartTextOrder eOrder = CHTXTORDER_SIDEBYSIDE;
+ bool bRadioButtonChecked = true;
+
+ if( aRbUpDown.IsChecked())
+ eOrder = CHTXTORDER_UPDOWN;
+ else if( aRbDownUp.IsChecked())
+ eOrder = CHTXTORDER_DOWNUP;
+ else if( aRbAuto.IsChecked())
+ eOrder = CHTXTORDER_AUTO;
+ else if( aRbSideBySide.IsChecked())
+ eOrder = CHTXTORDER_SIDEBYSIDE;
+ else
+ bRadioButtonChecked = false;
+
+ if( bRadioButtonChecked )
+ rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_TEXT_ORDER ));
+ }
+
+ if( aCbTextOverlap.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_OVERLAP, aCbTextOverlap.IsChecked() ) );
+ if( aCbTextBreak.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXTBREAK, aCbTextBreak.IsChecked() ) );
+ if( aCbShowDescription.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, aCbShowDescription.IsChecked() ) );
+
+ if( m_aLbTextDirection.GetSelectEntryCount() > 0 )
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) );
+
+ return TRUE;
+}
+
+void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ SfxItemState aState = SFX_ITEM_UNKNOWN;
+
+ // show description ----------
+ aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ aCbShowDescription.EnableTriState( TRUE );
+ aCbShowDescription.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ aCbShowDescription.EnableTriState( FALSE );
+ BOOL bCheck = FALSE;
+ if( aState == SFX_ITEM_SET )
+ bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCbShowDescription.Check( bCheck );
+
+ if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
+ aCbShowDescription.Hide();
+ }
+
+ // Rotation as orient item or in degrees ----------
+
+ // check new degree item
+ m_nInitialDegrees = 0;
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_SET )
+ m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+
+ m_bHasInitialDegrees = aState != SFX_ITEM_DONTCARE;
+ if( m_bHasInitialDegrees )
+ aCtrlDial.SetRotation( m_nInitialDegrees );
+ else
+ aCtrlDial.SetNoRotation();
+
+ // check stacked item
+ m_bInitialStacking = false;
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_SET )
+ m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+
+ m_bHasInitialStacking = aState != SFX_ITEM_DONTCARE;
+ if( m_bHasInitialDegrees )
+ aOrientHlp.SetStackedState( m_bInitialStacking ? STATE_CHECK : STATE_NOCHECK );
+ else
+ aOrientHlp.SetStackedState( STATE_DONTKNOW );
+
+ if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
+
+ // Text overlap ----------
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_OVERLAP, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ aCbTextOverlap.EnableTriState( TRUE );
+ aCbTextOverlap.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ aCbTextOverlap.EnableTriState( FALSE );
+ BOOL bCheck = FALSE;
+ if( aState == SFX_ITEM_SET )
+ bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCbTextOverlap.Check( bCheck );
+
+ if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
+ aCbTextOverlap.Hide();
+ }
+
+ // text break ----------
+ aState = rInAttrs.GetItemState( SCHATTR_TEXTBREAK, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ aCbTextBreak.EnableTriState( TRUE );
+ aCbTextBreak.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ aCbTextBreak.EnableTriState( FALSE );
+ BOOL bCheck = FALSE;
+ if( aState == SFX_ITEM_SET )
+ bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCbTextBreak.Check( bCheck );
+
+ if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
+ {
+ aCbTextBreak.Hide();
+ if( ! aCbTextOverlap.IsVisible() )
+ aFlTextFlow.Hide();
+ }
+ }
+
+ // text order ----------
+ if( m_bShowStaggeringControls )
+ {
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_ORDER, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_SET )
+ {
+ SvxChartTextOrder eOrder = static_cast< const SvxChartTextOrderItem * >( pPoolItem )->GetValue();
+
+ switch( eOrder )
+ {
+ case CHTXTORDER_SIDEBYSIDE:
+ aRbSideBySide.Check();
+ break;
+ case CHTXTORDER_UPDOWN:
+ aRbUpDown.Check();
+ break;
+ case CHTXTORDER_DOWNUP:
+ aRbDownUp.Check();
+ break;
+ case CHTXTORDER_AUTO:
+ aRbAuto.Check();
+ break;
+ }
+ }
+ }
+
+ ToggleShowLabel( (void*)0 );
+}
+
+void SchAxisLabelTabPage::ShowStaggeringControls( BOOL bShowStaggeringControls )
+{
+ m_bShowStaggeringControls = bShowStaggeringControls;
+
+ if( !m_bShowStaggeringControls )
+ {
+ aRbSideBySide.Hide();
+ aRbUpDown.Hide();
+ aRbDownUp.Hide();
+ aRbAuto.Hide();
+ aFlOrder.Hide();
+ }
+}
+
+// event handling routines
+// -----------------------
+
+IMPL_LINK ( SchAxisLabelTabPage, ToggleShowLabel, void *, EMPTYARG )
+{
+ BOOL bEnable = ( aCbShowDescription.GetState() != STATE_NOCHECK );
+
+ aOrientHlp.Enable( bEnable );
+ aFlOrder.Enable( bEnable );
+ aRbSideBySide.Enable( bEnable );
+ aRbUpDown.Enable( bEnable );
+ aRbDownUp.Enable( bEnable );
+ aRbAuto.Enable( bEnable );
+
+ aFlTextFlow.Enable( bEnable );
+ aCbTextOverlap.Enable( bEnable );
+ aCbTextBreak.Enable( bEnable );
+
+ m_aFtTextDirection.Enable( bEnable );
+ m_aLbTextDirection.Enable( bEnable );
+
+ return 0L;
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
new file mode 100644
index 000000000000..1e0aa8e578f0
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_AxisLabel.hxx,v $
+ * $Revision: 1.8.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_AXISLABEL_HXX
+#define _CHART2_TP_AXISLABEL_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <svx/dialcontrol.hxx>
+#include <svx/wrapfield.hxx>
+#include <svx/orienthelper.hxx>
+#include "TextDirectionListBox.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class SchAxisLabelTabPage : public SfxTabPage
+{
+private:
+ CheckBox aCbShowDescription;
+
+ FixedLine aFlOrder;
+ RadioButton aRbSideBySide;
+ RadioButton aRbUpDown;
+ RadioButton aRbDownUp;
+ RadioButton aRbAuto;
+
+ FixedLine aFlSeparator;
+ FixedLine aFlTextFlow;
+ CheckBox aCbTextOverlap;
+ CheckBox aCbTextBreak;
+
+ FixedLine aFlOrient;
+ svx::DialControl aCtrlDial;
+ FixedText aFtRotate;
+ svx::WrapField aNfRotate;
+ TriStateBox aCbStacked;
+ svx::OrientationHelper aOrientHlp;
+
+ FixedText m_aFtTextDirection;
+ TextDirectionListBox m_aLbTextDirection;
+
+ BOOL m_bShowStaggeringControls;
+
+ sal_Int32 m_nInitialDegrees;
+ bool m_bHasInitialDegrees; /// false = DialControl in tristate
+ bool m_bInitialStacking;
+ bool m_bHasInitialStacking; /// false = checkbox in tristate
+
+ DECL_LINK ( ToggleShowLabel, void* );
+
+public:
+ SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SchAxisLabelTabPage();
+
+ void Construct();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+
+ void ShowStaggeringControls( BOOL bShowStaggeringControls );
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.src b/chart2/source/controller/dialogs/tp_AxisLabel.src
new file mode 100644
index 000000000000..090ef525de8f
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.src
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_AxisLabel.src,v $
+ * $Revision: 1.10.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+TabPage TP_AXIS_LABEL
+{
+ HelpID = HID_SCH_TP_AXIS_LABEL;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+
+ CheckBox CB_AXIS_LABEL_SCHOW_DESCR
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
+
+ Text [ en-US ] = "Sho~w labels";
+ };
+
+ FixedLine FL_AXIS_LABEL_ORIENTATION
+ {
+ Pos = MAP_APPFONT ( 6 , 91 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+
+ Text [ en-US ] = "Text orientation" ;
+ };
+ Control CT_AXIS_LABEL_DIAL
+ {
+ HelpId = HID_SCH_ALIGNMENT_CTR_DIAL ;
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 43 , 43 ) ;
+ Text = "ABCD" ;
+ };
+ TriStateBox PB_AXIS_LABEL_TEXTSTACKED
+ {
+ HelpId = HID_SCH_ALIGNMENT_STACKED ;
+ Pos = MAP_APPFONT ( 139 , 105 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ve~rtically stacked";
+ };
+ FixedText FT_AXIS_LABEL_DEGREES
+ {
+ Pos = MAP_APPFONT ( 93 , 122 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Degrees" ;
+ };
+ NumericField NF_AXIS_LABEL_ORIENT
+ {
+ HelpId = HID_SCH_ALIGNMENT_DEGREES ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 61 , 120 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ SpinSize = 5 ;
+ Minimum = 0 ;
+ Maximum = 359 ;
+ };
+ FixedText FT_UNUSED
+ {
+ //only necessary for constructor of SvxWinOrientation
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 204 , 117 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ };
+ Control CT_UNUSED
+ {
+ //only necessary for constructor of SvxWinOrientation
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 204 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 128 , 33 ) ;
+ Size = MAP_APPFONT ( 4 , 52 ) ;
+ };
+
+ FixedLine FL_AXIS_LABEL_TEXTFLOW
+ {
+ Pos = MAP_APPFONT ( 133 , 22 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+
+ Text [ en-US ] = "Text flow" ;
+ };
+ CheckBox CB_AXIS_LABEL_TEXTOVERLAP
+ {
+ Pos = MAP_APPFONT ( 139 , 33 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "O~verlap" ;
+ };
+ CheckBox CB_AXIS_LABEL_TEXTBREAK
+ {
+ Pos = MAP_APPFONT ( 139 , 47 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "~Break" ;
+ };
+
+
+ FixedLine FL_AXIS_LABEL_ORDER
+ {
+ Pos = MAP_APPFONT ( 6 , 22 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+
+ Text [ en-US ] = "Order" ;
+ };
+ RadioButton RB_AXIS_LABEL_SIDEBYSIDE
+ {
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "~Tile" ;
+ };
+ RadioButton RB_AXIS_LABEL_UPDOWN
+ {
+ Pos = MAP_APPFONT ( 12 , 47 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "St~agger odd" ;
+ };
+ RadioButton RB_AXIS_LABEL_DOWNUP
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Stagger ~even" ;
+ };
+ RadioButton RB_AXIS_LABEL_AUTOORDER
+ {
+ Pos = MAP_APPFONT ( 12 , 75 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "A~utomatic" ;
+ };
+
+ FixedText FT_AXIS_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 156 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Te~xt direction" ;
+ };
+ ListBox LB_AXIS_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 78 , 154 ) ;
+ Size = MAP_APPFONT ( 170 , 100 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
new file mode 100644
index 000000000000..0b10204c54bc
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
@@ -0,0 +1,501 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_AxisPositions.cxx,v $
+ * $Revision: 1.1.4.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_AxisPositions.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "Strings.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "AxisHelper.hxx"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <rtl/math.hxx>
+// header for class SvxDoubleItem
+#include <svx/chrtitem.hxx>
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+
+// header for class WarningBox
+#include <vcl/msgbox.hxx>
+
+// header for class SvNumberformat
+#ifndef _ZFORMAT_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zformat.hxx>
+#endif
+
+#include <svtools/controldims.hrc>
+
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+void lcl_newXPos( Control& rControl, long nXPos )
+{
+ Point aPos( rControl.GetPosPixel() );
+ aPos.X() = nXPos;
+ rControl.SetPosPixel(aPos);
+}
+
+void lcl_shiftY( Control& rControl, long nYDiff )
+{
+ Point aPos( rControl.GetPosPixel() );
+ aPos.Y() += nYDiff;
+ rControl.SetPosPixel(aPos);
+}
+
+}
+
+AxisPositionsTabPage::AxisPositionsTabPage(Window* pWindow,const SfxItemSet& rInAttrs)
+ : SfxTabPage(pWindow, SchResId(TP_AXIS_POSITIONS), rInAttrs)
+
+ , m_aFL_AxisLine(this,SchResId(FL_AXIS_LINE))
+ , m_aFT_CrossesAt(this,SchResId(FT_CROSSES_OTHER_AXIS_AT))
+ , m_aLB_CrossesAt(this,SchResId(LB_CROSSES_OTHER_AXIS_AT))
+ , m_aED_CrossesAt(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT))
+ , m_aED_CrossesAtCategory(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT_CATEGORY))
+ , m_aCB_AxisBetweenCategories(this, SchResId(CB_AXIS_BETWEEN_CATEGORIES))
+
+ , m_aFL_Labels(this,SchResId(FL_LABELS))
+ , m_aFT_PlaceLabels( this, SchResId( FT_PLACE_LABELS ) )
+ , m_aLB_PlaceLabels( this, SchResId( LB_PLACE_LABELS ) )
+ , m_aFT_LabelDistance( this, SchResId( FT_AXIS_LABEL_DISTANCE ) )
+ , m_aED_LabelDistance( this, SchResId( EDT_AXIS_LABEL_DISTANCE ) )
+
+ , m_aFL_Ticks(this,SchResId(FL_TICKS))
+ , m_aFT_Major(this,SchResId(FT_MAJOR))
+ , m_aCB_TicksInner(this,SchResId(CB_TICKS_INNER))
+ , m_aCB_TicksOuter(this,SchResId(CB_TICKS_OUTER))
+ , m_aFT_Minor(this,SchResId(FT_MINOR))
+ , m_aCB_MinorInner(this,SchResId(CB_MINOR_INNER))
+ , m_aCB_MinorOuter(this,SchResId(CB_MINOR_OUTER))
+
+ , m_aFL_Vertical(this,SchResId(FL_VERTICAL))
+ , m_aFT_PlaceTicks(this,SchResId(FT_PLACE_TICKS))
+ , m_aLB_PlaceTicks(this,SchResId(LB_PLACE_TICKS))
+
+ , m_aFL_Grids(this,SchResId(FL_GRIDS))
+ , m_aCB_MajorGrid(this,SchResId(CB_MAJOR_GRID))
+ , m_aPB_MajorGrid(this,SchResId(PB_MAJOR_GRID))
+ , m_aCB_MinorGrid(this,SchResId(CB_MINOR_GRID))
+ , m_aPB_MinorGrid(this,SchResId(PB_MINOR_GRID))
+
+ , m_pNumFormatter(NULL)
+ , m_bCrossingAxisIsCategoryAxis(false)
+ , m_aCategories()
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ const long nDialogWidth = GetSizePixel().Width();
+ const long nDistance = LogicToPixel( Size(RSC_SP_CTRL_X, 0), MapMode(MAP_APPFONT) ).Width();
+
+ //axis line controls
+ {
+ if( m_aFT_CrossesAt.CalcMinimumSize().Width() < m_aFT_CrossesAt.GetSizePixel().Width() )
+ {
+ m_aFT_CrossesAt.SetSizePixel(m_aFT_CrossesAt.CalcMinimumSize());
+ long nXPos = m_aFT_CrossesAt.GetPosPixel().X() + m_aFT_CrossesAt.GetSizePixel().Width() + nDistance;
+ lcl_newXPos( m_aLB_CrossesAt, nXPos );
+
+ nXPos += m_aLB_CrossesAt.GetSizePixel().Width() + nDistance;
+ lcl_newXPos( m_aED_CrossesAt, nXPos );
+ lcl_newXPos( m_aED_CrossesAtCategory, nXPos );
+ }
+ }
+
+ long nFixTextHeight = m_aFT_PlaceLabels.GetSizePixel().Height();
+ long nLabelPlacementWidth = m_aFT_PlaceLabels.CalcMinimumSize().Width();
+ long nMarkPlacementWidth = m_aFT_PlaceTicks.CalcMinimumSize().Width();
+
+
+ long nWidth_0 = ::std::max( m_aFT_Major.CalcMinimumSize().Width(), m_aFT_Minor.CalcMinimumSize().Width() );
+ nWidth_0 = ::std::max( nWidth_0, nLabelPlacementWidth );
+ nWidth_0 = ::std::max( nWidth_0, nMarkPlacementWidth );
+ nLabelPlacementWidth = nMarkPlacementWidth = nWidth_0;
+
+ //label placement
+ {
+ m_aFT_PlaceLabels.SetSizePixel( Size( nLabelPlacementWidth, nFixTextHeight ) );
+ long nXPos = m_aFT_PlaceLabels.GetPosPixel().X() + nLabelPlacementWidth + nDistance;
+ lcl_newXPos( m_aLB_PlaceLabels, nXPos );
+ m_aLB_PlaceLabels.SetSizePixel(m_aLB_PlaceLabels.CalcMinimumSize());
+ }
+
+ //tickmark placement
+ {
+ m_aFT_PlaceTicks.SetSizePixel( Size( nMarkPlacementWidth, nFixTextHeight ) );
+ long nXPos = m_aFT_PlaceTicks.GetPosPixel().X() + nMarkPlacementWidth + nDistance;
+ lcl_newXPos( m_aLB_PlaceTicks, nXPos );
+ m_aLB_PlaceTicks.SetSizePixel( m_aLB_PlaceTicks.CalcMinimumSize() );
+ }
+
+ //tickmark controls
+ {
+ long nWidth_1 = ::std::max( m_aCB_TicksInner.CalcMinimumSize().Width(), m_aCB_MinorInner.CalcMinimumSize().Width() );
+ long nWidth_2 = ::std::max( m_aCB_TicksOuter.CalcMinimumSize().Width(), m_aCB_MinorOuter.CalcMinimumSize().Width() );
+
+ long nLeftSpace = nDialogWidth - nWidth_0 - nWidth_1 - nWidth_2 - 3*nDistance;
+
+ if(nLeftSpace>=0)
+ {
+ m_aFT_Major.SetSizePixel(m_aFT_Major.CalcMinimumSize());
+ m_aFT_Minor.SetSizePixel(m_aFT_Minor.CalcMinimumSize());
+
+ m_aCB_TicksInner.SetSizePixel( m_aCB_TicksInner.CalcMinimumSize() );
+ m_aCB_MinorInner.SetSizePixel( m_aCB_MinorInner.CalcMinimumSize() );
+
+ m_aCB_TicksOuter.SetSizePixel( m_aCB_TicksOuter.CalcMinimumSize() );
+ m_aCB_MinorOuter.SetSizePixel( m_aCB_MinorOuter.CalcMinimumSize() );
+
+ long nXPos = m_aFT_Major.GetPosPixel().X() + nWidth_0 + nDistance;
+ lcl_newXPos( m_aCB_TicksInner, nXPos );
+ lcl_newXPos( m_aCB_MinorInner, nXPos );
+
+ nXPos += nWidth_1 + nDistance;
+ lcl_newXPos( m_aCB_TicksOuter, nXPos );
+ lcl_newXPos( m_aCB_MinorOuter, nXPos );
+
+ nXPos += nWidth_2 + nDistance;
+ lcl_newXPos( m_aFL_Vertical, nXPos );
+ }
+ }
+
+ //right alignement of listboxes:
+ {
+ long nLabelRightBorder = m_aLB_PlaceLabels.GetPosPixel().X() + m_aLB_PlaceLabels.GetSizePixel().Width();
+ long nTickmarksRightBorder = m_aLB_PlaceTicks.GetPosPixel().X() + m_aLB_PlaceTicks.GetSizePixel().Width();
+
+ long nNewRightBorder = ::std::max( m_aLB_CrossesAt.GetPosPixel().X() + m_aLB_CrossesAt.GetSizePixel().Width(), nLabelRightBorder);
+ nNewRightBorder = ::std::max( nTickmarksRightBorder, nNewRightBorder );
+
+ long nListBoxHeight = m_aLB_PlaceLabels.GetSizePixel().Height();
+ m_aLB_PlaceLabels.SetSizePixel( Size( m_aLB_PlaceLabels.GetSizePixel().Width()+nNewRightBorder-nLabelRightBorder, nListBoxHeight ) );
+ m_aLB_PlaceTicks.SetSizePixel( Size( m_aLB_PlaceTicks.GetSizePixel().Width()+nNewRightBorder-nTickmarksRightBorder, nListBoxHeight ) );
+ }
+
+ m_aLB_CrossesAt.SetSelectHdl( LINK( this, AxisPositionsTabPage, CrossesAtSelectHdl ) );
+ m_aLB_CrossesAt.SetDropDownLineCount( m_aLB_CrossesAt.GetEntryCount() );
+
+ m_aLB_PlaceLabels.SetSelectHdl( LINK( this, AxisPositionsTabPage, PlaceLabelsSelectHdl ) );
+ m_aLB_PlaceLabels.SetDropDownLineCount( m_aLB_PlaceLabels.GetEntryCount() );
+ m_aLB_PlaceTicks.SetDropDownLineCount( m_aLB_PlaceTicks.GetEntryCount() );
+}
+
+SfxTabPage* AxisPositionsTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
+{
+ return new AxisPositionsTabPage(pWindow, rOutAttrs);
+}
+
+BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ // axis line
+ USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_POSITION, nPos+1 ));
+ if( 2==nPos )
+ {
+ double fCrossover = m_aED_CrossesAt.GetValue();
+ if( m_bCrossingAxisIsCategoryAxis )
+ fCrossover = m_aED_CrossesAtCategory.GetSelectEntryPos()+1;
+ rOutAttrs.Put(SvxDoubleItem(fCrossover,SCHATTR_AXIS_POSITION_VALUE));
+ }
+
+ // labels
+ USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
+ if( nLabelPos != LISTBOX_ENTRY_NOTFOUND )
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_LABEL_POSITION, nLabelPos ));
+
+ // tick marks
+ long nTicks=0;
+ long nMinorTicks=0;
+
+ if(m_aCB_MinorInner.IsChecked())
+ nMinorTicks|=CHAXIS_MARK_INNER;
+ if(m_aCB_MinorOuter.IsChecked())
+ nMinorTicks|=CHAXIS_MARK_OUTER;
+ if(m_aCB_TicksInner.IsChecked())
+ nTicks|=CHAXIS_MARK_INNER;
+ if(m_aCB_TicksOuter.IsChecked())
+ nTicks|=CHAXIS_MARK_OUTER;
+
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,nTicks));
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELPTICKS,nMinorTicks));
+
+ USHORT nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos();
+ if( nMarkPos != LISTBOX_ENTRY_NOTFOUND )
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_MARK_POSITION, nMarkPos ));
+
+ return TRUE;
+}
+
+void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ //init and enable controls
+ m_aED_CrossesAt.Show( !m_bCrossingAxisIsCategoryAxis );
+ m_aED_CrossesAtCategory.Show( m_bCrossingAxisIsCategoryAxis );
+ const sal_Int32 nMaxCount = LISTBOX_ENTRY_NOTFOUND;
+ if( m_bCrossingAxisIsCategoryAxis )
+ {
+ for( sal_Int32 nN=0; nN<m_aCategories.getLength() && nN<nMaxCount; nN++ )
+ m_aED_CrossesAtCategory.InsertEntry( m_aCategories[nN] );
+
+ USHORT nCount = m_aED_CrossesAtCategory.GetEntryCount();
+ if( nCount>30 )
+ nCount=30;
+ m_aED_CrossesAtCategory.SetDropDownLineCount( nCount );
+ }
+
+ if( m_aLB_CrossesAt.GetEntryCount() > 3 )
+ {
+ if( m_bCrossingAxisIsCategoryAxis )
+ m_aLB_CrossesAt.RemoveEntry(2);
+ else
+ m_aLB_CrossesAt.RemoveEntry(3);
+ }
+
+ //fill controls
+ const SfxPoolItem *pPoolItem = NULL;
+
+ //axis line
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ {
+ bool bZero = false;
+ USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ if(nPos==0)
+ {
+ //switch to value
+ bZero = true;
+ nPos = 2;
+ }
+ else
+ nPos--;
+
+ if( nPos < m_aLB_CrossesAt.GetEntryCount() )
+ m_aLB_CrossesAt.SelectEntryPos( nPos );
+ CrossesAtSelectHdl( (void*)0 );
+
+ if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,TRUE, &pPoolItem)== SFX_ITEM_SET || bZero )
+ {
+ double fCrossover = 0.0;
+ if( !bZero )
+ fCrossover = (((const SvxDoubleItem*)pPoolItem)->GetValue());
+ if( m_bCrossingAxisIsCategoryAxis )
+ m_aED_CrossesAtCategory.SelectEntryPos( static_cast<USHORT>(::rtl::math::round(fCrossover-1.0)) );
+ else
+ m_aED_CrossesAt.SetValue(fCrossover);
+ }
+ else
+ {
+ m_aED_CrossesAtCategory.SetNoSelection();
+ m_aED_CrossesAt.SetTextValue(XubString());
+ }
+ }
+ else
+ {
+ m_aLB_CrossesAt.SetNoSelection();
+ m_aED_CrossesAt.Enable( FALSE );
+ }
+
+ // Labels
+ if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ if( nPos < m_aLB_PlaceLabels.GetEntryCount() )
+ m_aLB_PlaceLabels.SelectEntryPos( nPos );
+ }
+ else
+ m_aLB_PlaceLabels.SetNoSelection();
+ PlaceLabelsSelectHdl( (void*)0 );
+
+ // Tick marks
+ long nTicks=0,nMinorTicks=0;
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ nTicks=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ nMinorTicks=((const SfxInt32Item*)pPoolItem)->GetValue();
+
+ m_aCB_TicksInner.Check(BOOL(nTicks&CHAXIS_MARK_INNER));
+ m_aCB_TicksOuter.Check(BOOL(nTicks&CHAXIS_MARK_OUTER));
+ m_aCB_MinorInner.Check(BOOL(nMinorTicks&CHAXIS_MARK_INNER));
+ m_aCB_MinorOuter.Check(BOOL(nMinorTicks&CHAXIS_MARK_OUTER));
+
+ // Tick position
+ if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ if( nPos < m_aLB_PlaceTicks.GetEntryCount() )
+ m_aLB_PlaceTicks.SelectEntryPos( nPos );
+ }
+ else
+ m_aLB_PlaceTicks.SetNoSelection();
+
+
+ if( !m_bSupportAxisPositioning )
+ {
+ m_aFL_AxisLine.Show(false);
+ m_aFT_CrossesAt.Show(false);
+ m_aLB_CrossesAt.Show(false);
+ m_aED_CrossesAt.Show(false);
+ m_aED_CrossesAtCategory.Show(false);
+ m_aCB_AxisBetweenCategories.Show(false);
+
+ m_aFL_Labels.Show(false);
+ m_aFT_PlaceLabels.Show(false);
+ m_aLB_PlaceLabels.Show(false);
+ m_aFT_LabelDistance.Show(false);
+ m_aED_LabelDistance.Show(false);
+
+ m_aFL_Vertical.Show(false);
+ m_aFT_PlaceTicks.Show(false);
+ m_aLB_PlaceTicks.Show(false);
+
+ long nYDiff = m_aFL_AxisLine.GetPosPixel().Y() - m_aFL_Ticks.GetPosPixel().Y();
+ lcl_shiftY( m_aFL_Ticks, nYDiff );
+ lcl_shiftY( m_aFT_Major, nYDiff );
+ lcl_shiftY( m_aCB_TicksInner, nYDiff );
+ lcl_shiftY( m_aCB_TicksOuter, nYDiff );
+
+ lcl_shiftY( m_aFT_Minor, nYDiff );
+ lcl_shiftY( m_aCB_MinorInner, nYDiff );
+ lcl_shiftY( m_aCB_MinorOuter, nYDiff );
+ }
+ else if( !AxisHelper::isAxisPositioningEnabled() )
+ {
+ m_aFL_AxisLine.Enable(false);
+ m_aFT_CrossesAt.Enable(false);
+ m_aLB_CrossesAt.Enable(false);
+ m_aED_CrossesAt.Enable(false);
+ m_aED_CrossesAtCategory.Enable(false);
+ m_aCB_AxisBetweenCategories.Enable(false);
+
+ m_aFL_Labels.Enable(false);
+ m_aFT_PlaceLabels.Enable(false);
+ m_aLB_PlaceLabels.Enable(false);
+ m_aFT_LabelDistance.Enable(false);
+ m_aED_LabelDistance.Enable(false);
+
+ m_aFL_Vertical.Enable(false);
+ m_aFT_PlaceTicks.Enable(false);
+ m_aLB_PlaceTicks.Enable(false);
+
+ //todo: maybe set a special help id to all those controls
+ }
+}
+
+int AxisPositionsTabPage::DeactivatePage(SfxItemSet* pItemSet)
+{
+ if( pItemSet )
+ FillItemSet( *pItemSet );
+
+ return LEAVE_PAGE;
+}
+
+void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
+{
+ m_pNumFormatter = pFormatter;
+ m_aED_CrossesAt.SetFormatter( m_pNumFormatter );
+ m_aED_CrossesAt.UseInputStringForFormatting();
+
+ const SfxPoolItem *pPoolItem = NULL;
+ if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue();
+ m_aED_CrossesAt.SetFormatKey( nFmt );
+ }
+}
+
+void AxisPositionsTabPage::SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis )
+{
+ m_bCrossingAxisIsCategoryAxis = bCrossingAxisIsCategoryAxis;
+}
+
+void AxisPositionsTabPage::SetCategories( const ::com::sun::star::uno::Sequence< rtl::OUString >& rCategories )
+{
+ m_aCategories = rCategories;
+}
+
+void AxisPositionsTabPage::SupportAxisPositioning( bool bSupportAxisPositioning )
+{
+ m_bSupportAxisPositioning = bSupportAxisPositioning;
+}
+
+IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG )
+{
+ USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ m_aED_CrossesAt.Show( (2==nPos) && !m_bCrossingAxisIsCategoryAxis );
+ m_aED_CrossesAtCategory.Show( (2==nPos) && m_bCrossingAxisIsCategoryAxis );
+
+ if(! m_aED_CrossesAt.GetText().Len() )
+ m_aED_CrossesAt.SetValue(0.0);
+ if( 0 == m_aED_CrossesAtCategory.GetSelectEntryCount() )
+ m_aED_CrossesAtCategory.SelectEntryPos(0);
+
+ PlaceLabelsSelectHdl( (void*)0 );
+ return 0;
+}
+
+IMPL_LINK ( AxisPositionsTabPage, PlaceLabelsSelectHdl, void *, EMPTYARG )
+{
+ USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
+
+ bool bEnableTickmarkPlacement = (nLabelPos>1);
+ if( bEnableTickmarkPlacement )
+ {
+ USHORT nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ if( nLabelPos-2 == nAxisPos )
+ bEnableTickmarkPlacement=false;
+ }
+ m_aFT_PlaceTicks.Enable(bEnableTickmarkPlacement);
+ m_aLB_PlaceTicks.Enable(bEnableTickmarkPlacement);
+
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
new file mode 100644
index 000000000000..913f1a08a2f9
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_AxisPositions.hxx,v $
+ * $Revision: 1.1.4.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_AXISPOSITIONS_HXX
+#define _CHART2_TP_AXISPOSITIONS_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+#include <svtools/fmtfield.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+//class SvNumberFormatter;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class AxisPositionsTabPage : public SfxTabPage
+{
+public:
+ AxisPositionsTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+ using TabPage::DeactivatePage;
+ virtual int DeactivatePage( SfxItemSet* pItemSet = NULL );
+
+ void SetNumFormatter( SvNumberFormatter* pFormatter );
+
+ void SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis );
+ void SetCategories( const ::com::sun::star::uno::Sequence< rtl::OUString >& rCategories );
+
+ void SupportAxisPositioning( bool bSupportAxisPositioning );
+
+private: //methods:
+ DECL_LINK( CrossesAtSelectHdl, void* );
+ DECL_LINK( PlaceLabelsSelectHdl, void* );
+
+private: //member:
+ FixedLine m_aFL_AxisLine;
+ FixedText m_aFT_CrossesAt;
+ ListBox m_aLB_CrossesAt;
+ FormattedField m_aED_CrossesAt;
+ ComboBox m_aED_CrossesAtCategory;
+ CheckBox m_aCB_AxisBetweenCategories;
+
+ FixedLine m_aFL_Labels;
+ FixedText m_aFT_PlaceLabels;
+ ListBox m_aLB_PlaceLabels;
+ FixedText m_aFT_LabelDistance;
+ FormattedField m_aED_LabelDistance;
+
+ FixedLine m_aFL_Ticks;
+
+ FixedText m_aFT_Major;
+ CheckBox m_aCB_TicksInner;
+ CheckBox m_aCB_TicksOuter;
+
+ FixedText m_aFT_Minor;
+ CheckBox m_aCB_MinorInner;
+ CheckBox m_aCB_MinorOuter;
+
+ FixedLine m_aFL_Vertical;
+ FixedText m_aFT_PlaceTicks;
+ ListBox m_aLB_PlaceTicks;
+
+ FixedLine m_aFL_Grids;
+ CheckBox m_aCB_MajorGrid;
+ PushButton m_aPB_MajorGrid;
+ CheckBox m_aCB_MinorGrid;
+ PushButton m_aPB_MinorGrid;
+
+ SvNumberFormatter* m_pNumFormatter;
+
+ bool m_bCrossingAxisIsCategoryAxis;
+ ::com::sun::star::uno::Sequence< rtl::OUString > m_aCategories;
+
+ bool m_bSupportAxisPositioning;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.src b/chart2/source/controller/dialogs/tp_AxisPositions.src
new file mode 100644
index 000000000000..1628c1afaa3f
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.src
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_AxisPositions.src,v $
+ * $Revision: 1.1.4.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+#define Y0 3
+#define Y1 (Y0+13)
+#define Y2 (Y1)
+#define Y3 (Y2+16)
+#define Y4 (Y3+13)
+#define Y5 (Y4)
+#define Y6 (Y5+16)
+#define Y7 (Y6+13)
+#define Y8 (Y7+16)
+#define Y9 (Y8+16)
+#define Y10 (Y9+16)
+#define Y11 (Y10+13)
+#define Y12 (Y11+16)
+
+#define EDITWIDTH 50
+#define LABELWIDTH 88
+#define MAXLABELWIDTH 138
+
+#define X1 6
+#define X2 11
+#define X3 (X2+LABELWIDTH+4)
+#define X4 (X2+MAXLABELWIDTH+4)
+#define X5 (X4+EDITWIDTH+5)
+
+#define XTICK_1 X2
+#define XTICK_2 (XTICK_1+60)
+#define XTICK_3 (XTICK_2+60)
+#define XTICK_4 (XTICK_3+60)
+#define XTICK_5 (XTICK_4+6)
+#define TICKWIDTH 59
+
+TabPage TP_AXIS_POSITIONS
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ FixedLine FL_AXIS_LINE
+ {
+ Pos = MAP_APPFONT ( X1 , Y0 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Axis line" ;
+ };
+
+ FixedText FT_CROSSES_OTHER_AXIS_AT
+ {
+ Pos = MAP_APPFONT ( X2 , Y1 ) ;
+ Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Cross other axis at" ;
+ };
+ ListBox LB_CROSSES_OTHER_AXIS_AT
+ {
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X4 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "Start" ;
+ "End" ;
+ "Value" ;
+ "Category" ;
+ };
+ };
+ SpinField EDT_CROSSES_OTHER_AXIS_AT
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X5 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ ComboBox EDT_CROSSES_OTHER_AXIS_AT_CATEGORY
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X5 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ CheckBox CB_AXIS_BETWEEN_CATEGORIES
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( X2 , Y2 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Axis ~between categories" ;
+ };
+
+ FixedLine FL_LABELS
+ {
+ Pos = MAP_APPFONT ( X1 , Y3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Labels" ;
+ };
+ FixedText FT_PLACE_LABELS
+ {
+ Pos = MAP_APPFONT ( X2 , Y4 ) ;
+ Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Place labels" ;
+ };
+ ListBox LB_PLACE_LABELS
+ {
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X4 , Y4-2 ) ;
+ Size = MAP_APPFONT ( 89 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "Near axis" ;
+ "Near axis (other side)" ;
+ "Outside start" ;
+ "Outside end" ;
+ };
+ };
+
+ FixedText FT_AXIS_LABEL_DISTANCE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( X2 , Y5 ) ;
+ Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Distance" ;
+ };
+ SpinField EDT_AXIS_LABEL_DISTANCE
+ {
+ Hide = TRUE;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X4 , Y5-2 ) ;
+ Size = MAP_APPFONT ( 89 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedLine FL_TICKS
+ {
+ Pos = MAP_APPFONT ( X1 , Y6 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Interval marks";
+ };
+ FixedText FT_MAJOR
+ {
+ Pos = MAP_APPFONT ( XTICK_1 , Y7 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 8 ) ;
+ Text [ en-US ] = "Major:" ;
+ };
+ CheckBox CB_TICKS_INNER
+ {
+ Pos = MAP_APPFONT ( XTICK_2 , Y7 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "~Inner";
+ };
+ CheckBox CB_TICKS_OUTER
+ {
+ Pos = MAP_APPFONT ( XTICK_3 , Y7 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "~Outer";
+ };
+
+ FixedText FT_MINOR
+ {
+ Pos = MAP_APPFONT ( XTICK_1 , Y8 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 8 ) ;
+ Text [ en-US ] = "Minor:" ;
+ };
+ CheckBox CB_MINOR_INNER
+ {
+ Pos = MAP_APPFONT ( XTICK_2 , Y8 );
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "I~nner";
+ };
+ CheckBox CB_MINOR_OUTER
+ {
+ Pos = MAP_APPFONT ( XTICK_3 , Y8 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "O~uter";
+ };
+
+ FixedLine FL_VERTICAL
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( XTICK_4 , Y7 ) ;
+ Size = MAP_APPFONT ( 6 , 25 ) ;
+ Vert = TRUE ;
+ };
+
+ FixedText FT_PLACE_TICKS
+ {
+ Pos = MAP_APPFONT ( X2 , Y9 );
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Place ~marks";
+ };
+ ListBox LB_PLACE_TICKS
+ {
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y9-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "At labels" ;
+ "At axis" ;
+ "At axis and labels" ;
+ };
+ };
+
+
+ FixedLine FL_GRIDS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( X1 , Y10 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Grids";
+ };
+ CheckBox CB_MAJOR_GRID
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( X2 , Y11 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Show major ~grid" ;
+ };
+ PushButton PB_MAJOR_GRID
+ {
+ Hide = TRUE ;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( X3 , Y11-2 );
+ Size = MAP_APPFONT ( 54 , 14 );
+ Text [ en-US ] = "Mo~re...";
+ };
+ CheckBox CB_MINOR_GRID
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( X2 , Y12 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Show minor grid" ;
+ };
+ PushButton PB_MINOR_GRID
+ {
+ Hide = TRUE ;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( X3 , Y12-2 );
+ Size = MAP_APPFONT ( 54 , 14 );
+ Text [ en-US ] = "Mor~e...";
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
new file mode 100644
index 000000000000..d5f8d5d22adb
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -0,0 +1,1166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_ChartType.cxx,v $
+ * $Revision: 1.8.44.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_ChartType.hxx"
+#include "tp_ChartType.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "res_BarGeometry.hxx"
+#include "ControllerLockGuard.hxx"
+#include "macros.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+#include <tools/debug.hxx>
+
+//for auto_ptr
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_BITMAP(name) Bitmap( SchResId( bIsHighContrast ? name ## _HC : name ))
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+
+namespace
+{
+ long lcl_getDistance()
+ {
+ return 6;
+ }
+
+ sal_Bool lcl_getSortByXValues( const uno::Reference< chart2::XChartDocument >& xChartDoc )
+ {
+ sal_Bool bRet = sal_False;
+ if( xChartDoc.is() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp( xChartDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ xDiaProp->getPropertyValue( C2U( "SortByXValues" ) ) >>= bRet;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ return bRet;
+ }
+}
+
+//--------------------------------------------------------------------------
+class AxisTypeResourceGroup : public ChangingResource
+{
+public:
+ AxisTypeResourceGroup( Window* pWindow );
+ virtual ~AxisTypeResourceGroup();
+
+ void showControls( bool bShow );
+ Point getPosition();
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( AxisTypeCheckHdl, CheckBox* );
+private:
+ CheckBox m_aCB_XAxis_Categories;
+};
+AxisTypeResourceGroup::AxisTypeResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_XAxis_Categories( pWindow, SchResId( CB_X_AXIS_CATEGORIES ) )
+{
+ m_aCB_XAxis_Categories.SetToggleHdl( LINK( this, AxisTypeResourceGroup, AxisTypeCheckHdl ) );
+}
+AxisTypeResourceGroup::~AxisTypeResourceGroup()
+{
+}
+void AxisTypeResourceGroup::showControls( bool bShow )
+{
+ m_aCB_XAxis_Categories.Show(bShow);
+}
+Point AxisTypeResourceGroup::getPosition()
+{
+ return m_aCB_XAxis_Categories.GetPosPixel();
+}
+long AxisTypeResourceGroup::getHeight()
+{
+ return m_aCB_XAxis_Categories.GetSizePixel().Height();
+}
+void AxisTypeResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aCB_XAxis_Categories.SetPosPixel(rPoint);
+}
+void AxisTypeResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_XAxis_Categories.Check(!rParameter.bXAxisWithValues);
+}
+void AxisTypeResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.bXAxisWithValues = !m_aCB_XAxis_Categories.IsChecked();
+}
+IMPL_LINK( AxisTypeResourceGroup, AxisTypeCheckHdl, CheckBox*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+//--------------------------------------------------------------------------
+
+#define POS_3DSCHEME_SIMPLE 0
+#define POS_3DSCHEME_REALISTIC 1
+
+class Dim3DLookResourceGroup : public ChangingResource
+{
+public:
+ Dim3DLookResourceGroup( Window* pWindow );
+ virtual ~Dim3DLookResourceGroup();
+
+ void showControls( bool bShow );
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( Dim3DLookCheckHdl, CheckBox* );
+ DECL_LINK( SelectSchemeHdl, void* );
+
+private:
+ CheckBox m_aCB_3DLook;
+ ListBox m_aLB_Scheme;
+};
+Dim3DLookResourceGroup::Dim3DLookResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_3DLook( pWindow, SchResId( CB_3D_LOOK ) )
+ , m_aLB_Scheme( pWindow, SchResId( LB_3D_SCHEME ) )
+{
+ m_aCB_3DLook.SetToggleHdl( LINK( this, Dim3DLookResourceGroup, Dim3DLookCheckHdl ) );
+
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_SIMPLE)));
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_REALISTIC)));
+ m_aLB_Scheme.SetDropDownLineCount(2);
+
+ m_aLB_Scheme.SetSelectHdl( LINK( this, Dim3DLookResourceGroup, SelectSchemeHdl ) );
+}
+Dim3DLookResourceGroup::~Dim3DLookResourceGroup()
+{
+}
+void Dim3DLookResourceGroup::showControls( bool bShow )
+{
+ m_aCB_3DLook.Show(bShow);
+ m_aLB_Scheme.Show(bShow);
+}
+long Dim3DLookResourceGroup::getHeight()
+{
+ return m_aCB_3DLook.GetSizePixel().Height() + m_aLB_Scheme.LogicToPixel( Size(0,2), MapMode(MAP_APPFONT) ).Height();
+}
+void Dim3DLookResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aCB_3DLook.SetPosPixel(rPoint);
+ Size aSize( m_aCB_3DLook.CalcMinimumSize() );
+ m_aCB_3DLook.SetPosSizePixel(rPoint,aSize);
+ Point aLBPos(rPoint);
+ aLBPos.X() += aSize.Width()
+ + m_aLB_Scheme.LogicToPixel( Size(6,0), MapMode(MAP_APPFONT) ).Width();
+ aLBPos.Y() -= m_aLB_Scheme.LogicToPixel( Size(0,2), MapMode(MAP_APPFONT) ).Height();
+ m_aLB_Scheme.SetPosPixel(aLBPos);
+}
+void Dim3DLookResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_3DLook.Check(rParameter.b3DLook);
+ m_aLB_Scheme.Enable(rParameter.b3DLook);
+
+ if( rParameter.eThreeDLookScheme == ThreeDLookScheme_Simple )
+ m_aLB_Scheme.SelectEntryPos(POS_3DSCHEME_SIMPLE);
+ else if( rParameter.eThreeDLookScheme == ThreeDLookScheme_Realistic )
+ m_aLB_Scheme.SelectEntryPos(POS_3DSCHEME_REALISTIC);
+ else
+ m_aLB_Scheme.SetNoSelection();
+}
+void Dim3DLookResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = m_aCB_3DLook.IsChecked();
+ USHORT nPos = m_aLB_Scheme.GetSelectEntryPos();
+ if( POS_3DSCHEME_SIMPLE == nPos )
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple;
+ else if( POS_3DSCHEME_REALISTIC == nPos )
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+ else
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Unknown;
+}
+IMPL_LINK( Dim3DLookResourceGroup, Dim3DLookCheckHdl, CheckBox*, EMPTYARG )
+{
+ if(m_pChangeListener)
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+IMPL_LINK( Dim3DLookResourceGroup, SelectSchemeHdl, void*, EMPTYARG )
+{
+ if(m_pChangeListener)
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+
+class SortByXValuesResourceGroup : public ChangingResource
+{
+public:
+ SortByXValuesResourceGroup( Window* pWindow );
+ virtual ~SortByXValuesResourceGroup();
+
+ void showControls( bool bShow );
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( SortByXValuesCheckHdl, CheckBox* );
+
+private:
+ CheckBox m_aCB_XValueSorting;
+};
+SortByXValuesResourceGroup::SortByXValuesResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_XValueSorting( pWindow, SchResId( CB_XVALUE_SORTING ) )
+{
+ m_aCB_XValueSorting.SetToggleHdl( LINK( this, SortByXValuesResourceGroup, SortByXValuesCheckHdl ) );
+}
+SortByXValuesResourceGroup::~SortByXValuesResourceGroup()
+{
+}
+void SortByXValuesResourceGroup::showControls( bool bShow )
+{
+ m_aCB_XValueSorting.Show(bShow);
+}
+long SortByXValuesResourceGroup::getHeight()
+{
+ return m_aCB_XValueSorting.GetSizePixel().Height();
+}
+void SortByXValuesResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aCB_XValueSorting.SetPosPixel(rPoint);
+}
+void SortByXValuesResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_XValueSorting.Check( rParameter.bSortByXValues );
+}
+void SortByXValuesResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.bSortByXValues = m_aCB_XValueSorting.IsChecked();
+}
+IMPL_LINK( SortByXValuesResourceGroup, SortByXValuesCheckHdl, CheckBox*, EMPTYARG )
+{
+ if(m_pChangeListener)
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+//--------------------------------------------------------------------------
+class StackingResourceGroup : public ChangingResource
+{
+public:
+ StackingResourceGroup( Window* pWindow );
+ virtual ~StackingResourceGroup();
+
+ void showControls( bool bShow, bool bShowDeepStacking );
+ Point getPosition();
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( StackingChangeHdl, RadioButton* );
+ DECL_LINK( StackingEnableHdl, void* );
+
+private:
+ CheckBox m_aCB_Stacked;
+ RadioButton m_aRB_Stack_Y;
+ RadioButton m_aRB_Stack_Y_Percent;
+ RadioButton m_aRB_Stack_Z;
+
+ bool m_bShowDeepStacking;
+};
+StackingResourceGroup::StackingResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_Stacked( pWindow, SchResId( CB_STACKED ) )
+ , m_aRB_Stack_Y( pWindow, SchResId( RB_STACK_Y ) )
+ , m_aRB_Stack_Y_Percent( pWindow, SchResId( RB_STACK_Y_PERCENT ) )
+ , m_aRB_Stack_Z( pWindow, SchResId( RB_STACK_Z ) )
+ , m_bShowDeepStacking(true)
+{
+ m_aCB_Stacked.SetToggleHdl( LINK( this, StackingResourceGroup, StackingEnableHdl ) );
+ m_aRB_Stack_Y.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
+ m_aRB_Stack_Y_Percent.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
+ m_aRB_Stack_Z.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
+}
+StackingResourceGroup::~StackingResourceGroup()
+{
+}
+void StackingResourceGroup::showControls( bool bShow, bool bShowDeepStacking )
+{
+ m_bShowDeepStacking = bShowDeepStacking;
+ m_aCB_Stacked.Show(bShow);
+ m_aRB_Stack_Y.Show(bShow);
+ m_aRB_Stack_Y_Percent.Show(bShow);
+ m_aRB_Stack_Z.Show(bShow&&bShowDeepStacking);
+}
+Point StackingResourceGroup::getPosition()
+{
+ return m_aCB_Stacked.GetPosPixel();
+}
+long StackingResourceGroup::getHeight()
+{
+ RadioButton& rLastButton = m_bShowDeepStacking ? m_aRB_Stack_Z : m_aRB_Stack_Y_Percent;
+
+ long nHeight = rLastButton.GetPosPixel().Y()
+ - m_aCB_Stacked.GetPosPixel().Y();
+ nHeight += rLastButton.GetSizePixel().Height();
+ return nHeight;
+}
+void StackingResourceGroup::setPosition( const Point& rPoint )
+{
+ Point aOld = this->getPosition();
+ long nDiffY = rPoint.Y() - aOld.Y();
+ long nDiffX = rPoint.X() - aOld.X();
+ m_aCB_Stacked.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+
+ aOld = m_aRB_Stack_Y.GetPosPixel();
+ m_aRB_Stack_Y.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+
+ aOld = m_aRB_Stack_Y_Percent.GetPosPixel();
+ m_aRB_Stack_Y_Percent.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+
+ aOld = m_aRB_Stack_Z.GetPosPixel();
+ m_aRB_Stack_Z.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+}
+void StackingResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_Stacked.Check( rParameter.eStackMode!=GlobalStackMode_NONE
+ && rParameter.eStackMode!=GlobalStackMode_STACK_Z ); //todo remove this condition if z stacking radio button is really used
+ switch( rParameter.eStackMode )
+ {
+ case GlobalStackMode_STACK_Y:
+ m_aRB_Stack_Y.Check();
+ break;
+ case GlobalStackMode_STACK_Y_PERCENT:
+ m_aRB_Stack_Y_Percent.Check();
+ break;
+ case GlobalStackMode_STACK_Z:
+ //todo uncomment this condition if z stacking radio button is really used
+ /*
+ if( rParameter.b3DLook )
+ m_aRB_Stack_Z.Check();
+ else
+ */
+ m_aRB_Stack_Y.Check();
+ break;
+ default:
+ m_aRB_Stack_Y.Check();
+ break;
+ }
+ //dis/enabling
+ m_aCB_Stacked.Enable( !rParameter.bXAxisWithValues );
+ m_aRB_Stack_Y.Enable( m_aCB_Stacked.IsChecked() && !rParameter.bXAxisWithValues );
+ m_aRB_Stack_Y_Percent.Enable( m_aCB_Stacked.IsChecked() && !rParameter.bXAxisWithValues );
+ m_aRB_Stack_Z.Enable( m_aCB_Stacked.IsChecked() && rParameter.b3DLook );
+}
+void StackingResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ if(!m_aCB_Stacked.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_NONE;
+ else if(m_aRB_Stack_Y.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_STACK_Y;
+ else if(m_aRB_Stack_Y_Percent.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_STACK_Y_PERCENT;
+ else if(m_aRB_Stack_Z.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+}
+IMPL_LINK( StackingResourceGroup, StackingChangeHdl, RadioButton*, pRadio )
+{
+ //for each radio click ther are coming two change events
+ //first uncheck of previous button -> ignore that call
+ //the second call gives the check of the new button
+ if( m_pChangeListener && pRadio && pRadio->IsChecked() )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+IMPL_LINK( StackingResourceGroup, StackingEnableHdl, void*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+//--------------------------------------------------------------------------
+class SplinePropertiesDialog : public ModalDialog
+{
+public:
+ SplinePropertiesDialog( Window* pParent );
+ virtual ~SplinePropertiesDialog();
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines );
+
+ virtual void StateChanged( StateChangedType nType );
+
+private:
+ DECL_LINK( SplineModeRadioHdl, RadioButton* );
+
+ void adjustControlPositions();
+ void adjustSize();
+
+private:
+ RadioButton m_aRB_Splines_Cubic;
+ RadioButton m_aRB_Splines_B;
+
+ FixedLine m_aFL_SplineSeparator;
+
+ FixedText m_aFT_SplineResolution;
+ MetricField m_aMF_SplineResolution;
+ FixedText m_aFT_SplineOrder;
+ MetricField m_aMF_SplineOrder;
+
+ FixedLine m_aFL_DialogButtons;
+ OKButton m_aBP_OK;
+ CancelButton m_aBP_Cancel;
+ HelpButton m_aBP_Help;
+};
+
+SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent )
+ : ModalDialog( pParent, SchResId( DLG_SPLINE_PROPERTIES ) )
+ , m_aRB_Splines_Cubic( this, SchResId( RB_SPLINES_CUBIC ) )
+ , m_aRB_Splines_B( this, SchResId( RB_SPLINES_B ) )
+ , m_aFL_SplineSeparator( this, SchResId( FL_SPLINE_SEPARATOR ) )
+ , m_aFT_SplineResolution( this, SchResId( FT_SPLINE_RESOLUTION ) )
+ , m_aMF_SplineResolution( this, SchResId( MF_SPLINE_RESOLUTION ) )
+ , m_aFT_SplineOrder( this, SchResId( FT_SPLINE_ORDER ) )
+ , m_aMF_SplineOrder( this, SchResId( MF_SPLINE_ORDER ) )
+ , m_aFL_DialogButtons( this, SchResId( FL_SPLINE_DIALOGBUTTONS ) )
+ , m_aBP_OK( this, SchResId(BTN_OK) )
+ , m_aBP_Cancel( this, SchResId(BTN_CANCEL) )
+ , m_aBP_Help( this, SchResId(BTN_HELP) )
+{
+ FreeResource();
+
+ this->SetText( String( SchResId( STR_DLG_SMOOTH_LINE_PROPERTIES ) ) );
+
+ m_aRB_Splines_Cubic.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
+ m_aRB_Splines_B.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
+}
+
+SplinePropertiesDialog::~SplinePropertiesDialog()
+{
+}
+
+void SplinePropertiesDialog::StateChanged( StateChangedType nType )
+{
+ Dialog::StateChanged( nType );
+
+ if( nType == STATE_CHANGE_INITSHOW )
+ {
+ adjustControlPositions();
+ adjustSize();
+ }
+}
+
+void SplinePropertiesDialog::adjustControlPositions()
+{
+ //position of controls:
+ //----------------
+ //fixed line and Fixed texts as near as possible to radio controls
+ long nRBWidth = ::std::max( m_aRB_Splines_Cubic.CalcMinimumSize().Width(), m_aRB_Splines_B.CalcMinimumSize().Width());
+ long nFLXPos = m_aRB_Splines_Cubic.GetPosPixel().X()+nRBWidth+m_aFT_SplineOrder.LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
+ long nFTXPos = nFLXPos + m_aFL_SplineSeparator.GetSizePixel().Width() + m_aFT_SplineOrder.LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
+
+ m_aRB_Splines_Cubic.SetSizePixel( Size( nRBWidth, m_aRB_Splines_Cubic.GetSizePixel().Height() ) );
+ m_aRB_Splines_B.SetSizePixel( Size( nRBWidth, m_aRB_Splines_B.GetSizePixel().Height() ) );
+
+ m_aFL_SplineSeparator.SetPosPixel( Point( nFLXPos, m_aFL_SplineSeparator.GetPosPixel().Y() ) );
+
+ m_aFT_SplineOrder.SetPosPixel( Point( nFTXPos, m_aFT_SplineOrder.GetPosPixel().Y() ) );
+ m_aFT_SplineResolution.SetPosPixel( Point( nFTXPos, m_aFT_SplineResolution.GetPosPixel().Y() ) );
+
+ //----------------
+ //move metric controls as near to text as possible
+ long nFTWidth = ::std::max( m_aFT_SplineOrder.CalcMinimumSize().Width(), m_aFT_SplineResolution.CalcMinimumSize().Width());
+ long nMFXPos = m_aFT_SplineOrder.GetPosPixel().X()+nFTWidth+m_aFT_SplineOrder.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,0), MapMode(MAP_APPFONT) ).Width();
+
+ m_aFT_SplineOrder.SetSizePixel( Size( nFTWidth, m_aFT_SplineOrder.GetSizePixel().Height() ) );
+ m_aFT_SplineResolution.SetSizePixel( Size( nFTWidth, m_aFT_SplineResolution.GetSizePixel().Height() ) );
+
+ m_aMF_SplineOrder.SetPosPixel( Point( nMFXPos, m_aMF_SplineOrder.GetPosPixel().Y() ) );
+ m_aMF_SplineResolution.SetPosPixel( Point( nMFXPos, m_aMF_SplineResolution.GetPosPixel().Y() ) );
+}
+
+void SplinePropertiesDialog::adjustSize()
+{
+ Size aDlgSize( this->GetSizePixel() );
+ long nBorder = m_aRB_Splines_Cubic.GetPosPixel().X();
+ long nX = m_aMF_SplineOrder.GetPosPixel().X() + m_aMF_SplineOrder.GetSizePixel().Width();
+ if(aDlgSize.Width()< (nX+nBorder) )
+ {
+ aDlgSize.Width() = (nX+nBorder);
+ this->SetSizePixel(aDlgSize);
+
+ Size aLineSize( m_aFL_DialogButtons.GetSizePixel() );
+ aLineSize.Width() = aDlgSize.Width();
+ m_aFL_DialogButtons.SetSizePixel(aLineSize);
+ }
+}
+void SplinePropertiesDialog::fillControls( const ChartTypeParameter& rParameter )
+{
+ switch(rParameter.eCurveStyle)
+ {
+ case CurveStyle_CUBIC_SPLINES:
+ m_aRB_Splines_Cubic.Check();
+ break;
+ case CurveStyle_B_SPLINES:
+ m_aRB_Splines_B.Check();
+ break;
+ default:
+ m_aRB_Splines_Cubic.Check();
+ break;
+ }
+ m_aMF_SplineOrder.SetValue( rParameter.nSplineOrder );
+ m_aMF_SplineResolution.SetValue( rParameter.nCurveResolution );
+
+ //dis/enabling
+ m_aFT_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+ m_aMF_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+}
+void SplinePropertiesDialog::fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines )
+{
+ if(!bSmoothLines)
+ rParameter.eCurveStyle=CurveStyle_LINES;
+ else if(m_aRB_Splines_Cubic.IsChecked())
+ rParameter.eCurveStyle=CurveStyle_CUBIC_SPLINES;
+ else if(m_aRB_Splines_B.IsChecked())
+ rParameter.eCurveStyle=CurveStyle_B_SPLINES;
+
+ rParameter.nCurveResolution = static_cast< sal_Int32 >( m_aMF_SplineResolution.GetValue());
+ rParameter.nSplineOrder = static_cast< sal_Int32 >( m_aMF_SplineOrder.GetValue());
+}
+IMPL_LINK( SplinePropertiesDialog, SplineModeRadioHdl, RadioButton*, EMPTYARG )
+{
+ m_aFT_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+ m_aMF_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+
+class SplineResourceGroup : public ChangingResource
+{
+public:
+ SplineResourceGroup( Window* pWindow );
+ virtual ~SplineResourceGroup();
+
+ void showControls( bool bShow );
+ Point getPosition();
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( SplineChangeHdl, void* );
+ DECL_LINK( SplineDetailsDialogHdl, void* );
+ SplinePropertiesDialog& getSplinePropertiesDialog();
+
+private:
+ CheckBox m_aCB_Splines;
+ PushButton m_aPB_DetailsDialog;
+ ::std::auto_ptr< SplinePropertiesDialog > m_pSplinePropertiesDialog;
+};
+SplineResourceGroup::SplineResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_Splines( pWindow, SchResId( CB_SPLINES ) )
+ , m_aPB_DetailsDialog( pWindow, SchResId( PB_SPLINE_DIALOG ) )
+ , m_pSplinePropertiesDialog()
+{
+ m_aCB_Splines.SetToggleHdl( LINK( this, SplineResourceGroup, SplineChangeHdl ) );
+ m_aPB_DetailsDialog.SetClickHdl( LINK( this, SplineResourceGroup, SplineDetailsDialogHdl ) );
+ m_aPB_DetailsDialog.SetQuickHelpText( String( SchResId(STR_DLG_SMOOTH_LINE_PROPERTIES) ) );
+
+ Size aButtonSize( m_aPB_DetailsDialog.GetSizePixel() );
+ Size aMinSize( m_aPB_DetailsDialog.CalcMinimumSize() );
+ sal_Int32 nDistance = 10;
+ if( pWindow )
+ {
+ Size aDistanceSize( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,2), MapMode(MAP_APPFONT) ) );
+ nDistance = 2*aDistanceSize.Width();
+ }
+ aButtonSize.Width() = aMinSize.Width() + nDistance;
+ m_aPB_DetailsDialog.SetSizePixel( aButtonSize );
+}
+SplineResourceGroup::~SplineResourceGroup()
+{
+}
+SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog()
+{
+ if( !m_pSplinePropertiesDialog.get() )
+ m_pSplinePropertiesDialog = ::std::auto_ptr< SplinePropertiesDialog >( new SplinePropertiesDialog( m_aPB_DetailsDialog.GetParent() ) );
+ return *m_pSplinePropertiesDialog;
+}
+void SplineResourceGroup::showControls( bool bShow )
+{
+ m_aCB_Splines.Show(bShow);
+ m_aPB_DetailsDialog.Show(bShow);
+}
+Point SplineResourceGroup::getPosition()
+{
+ return m_aCB_Splines.GetPosPixel();
+}
+long SplineResourceGroup::getHeight()
+{
+ return m_aCB_Splines.GetSizePixel().Height() + m_aPB_DetailsDialog.LogicToPixel( Size(0,2), MapMode(MAP_APPFONT) ).Height();
+}
+void SplineResourceGroup::setPosition( const Point& rPoint )
+{
+ Size aSize( m_aCB_Splines.CalcMinimumSize() );
+ Size aDistanceSize( m_aCB_Splines.LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,1), MapMode(MAP_APPFONT) ) );
+ m_aCB_Splines.SetSizePixel( aSize );
+
+ Point aOld = this->getPosition();
+ long nDiffY = rPoint.Y() - aOld.Y();
+ long nDiffX = rPoint.X() - aOld.X();
+
+ Point aNew( aOld.X()+nDiffX, aOld.Y()+nDiffY );
+ m_aCB_Splines.SetPosPixel( aNew );
+
+ aNew.X() += ( aSize.Width() + aDistanceSize.Width() );
+ aNew.Y() -= 3*aDistanceSize.Height();
+ m_aPB_DetailsDialog.SetPosPixel( aNew );
+}
+
+void SplineResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_Splines.Check( rParameter.eCurveStyle!=CurveStyle_LINES );
+ getSplinePropertiesDialog().fillControls( rParameter );
+}
+void SplineResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ getSplinePropertiesDialog().fillParameter( rParameter, m_aCB_Splines.IsChecked() );
+}
+IMPL_LINK( SplineResourceGroup, SplineChangeHdl, void*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+
+IMPL_LINK( SplineResourceGroup, SplineDetailsDialogHdl, void*, EMPTYARG )
+{
+
+ ChartTypeParameter aOldParameter;
+ getSplinePropertiesDialog().fillParameter( aOldParameter, m_aCB_Splines.IsChecked() );
+
+ BOOL bOldSmoothLines = m_aCB_Splines.IsChecked();
+ m_aCB_Splines.Check();
+ if( RET_OK == getSplinePropertiesDialog().Execute() )
+ {
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ }
+ else
+ {
+ //restore old state:
+ m_aCB_Splines.Check( bOldSmoothLines );
+ getSplinePropertiesDialog().fillControls( aOldParameter );
+ }
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+
+class GeometryResourceGroup : public ChangingResource
+{
+public:
+ GeometryResourceGroup( Window* pWindow );
+ virtual ~GeometryResourceGroup();
+
+ void showControls( bool bShow );
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( GeometryChangeHdl, void* );
+
+private:
+ BarGeometryResources m_aGeometryResources;
+};
+GeometryResourceGroup::GeometryResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aGeometryResources( pWindow )
+{
+ m_aGeometryResources.SetSelectHdl( LINK( this, GeometryResourceGroup, GeometryChangeHdl ) );
+}
+GeometryResourceGroup::~GeometryResourceGroup()
+{
+}
+void GeometryResourceGroup::showControls( bool bShow )
+{
+ m_aGeometryResources.Show(bShow);
+}
+long GeometryResourceGroup::getHeight()
+{
+ return m_aGeometryResources.GetSizePixel().Height();
+}
+void GeometryResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aGeometryResources.SetPosPixel( rPoint );
+}
+
+void GeometryResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ USHORT nGeometry3D = static_cast<USHORT>(rParameter.nGeometry3D);
+ m_aGeometryResources.SelectEntryPos(nGeometry3D);
+ m_aGeometryResources.Enable(rParameter.b3DLook);
+}
+void GeometryResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.nGeometry3D = 1;
+ if( m_aGeometryResources.GetSelectEntryCount() )
+ rParameter.nGeometry3D = m_aGeometryResources.GetSelectEntryPos();
+}
+IMPL_LINK( GeometryResourceGroup, GeometryChangeHdl, void*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+
+ChartTypeTabPage::ChartTypeTabPage( Window* pParent
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext
+ , bool bDoLiveUpdate, bool bHideDescription )
+ : OWizardPage( pParent, SchResId(TP_CHARTTYPE) )
+ , m_aFT_ChooseType( this, SchResId( FT_CHARTTYPE ) )
+ , m_aMainTypeList( this, SchResId( LB_CHARTTYPE ) )
+ , m_aSubTypeList( this, SchResId( CT_CHARTVARIANT ) )
+ , m_pAxisTypeResourceGroup( new AxisTypeResourceGroup(this) )
+ , m_pDim3DLookResourceGroup( new Dim3DLookResourceGroup(this) )
+ , m_pStackingResourceGroup( new StackingResourceGroup(this) )
+ , m_pSplineResourceGroup( new SplineResourceGroup(this) )
+ , m_pGeometryResourceGroup( new GeometryResourceGroup( this ) )
+ , m_pSortByXValuesResourceGroup( new SortByXValuesResourceGroup( this ) )
+ , m_nYTopPos(0)
+ , m_xChartModel( xChartModel )
+ , m_xCC( xContext )
+ , m_aChartTypeDialogControllerList(0)
+ , m_pCurrentMainType(0)
+ , m_nChangingCalls(0)
+ , m_bDoLiveUpdate(bDoLiveUpdate)
+ , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
+{
+ FreeResource();
+
+ if( bHideDescription )
+ {
+ m_aFT_ChooseType.Hide();
+ long nYDiff = m_aMainTypeList.GetPosPixel().Y() - m_aFT_ChooseType.GetPosPixel().Y();
+
+ Point aOldPos( m_aMainTypeList.GetPosPixel() );
+ m_aMainTypeList.SetPosPixel( Point( aOldPos.X(), aOldPos.Y() - nYDiff ) );
+
+ aOldPos = m_aSubTypeList.GetPosPixel();
+ m_aSubTypeList.SetPosPixel( Point( aOldPos.X(), aOldPos.Y() - nYDiff ) );
+
+ aOldPos = m_pAxisTypeResourceGroup->getPosition();
+ m_pAxisTypeResourceGroup->setPosition( Point( aOldPos.X(), aOldPos.Y() - nYDiff ) );
+
+ Size aSize( this->GetSizePixel() );
+ this->SetSizePixel( Size( aSize.Width(), aSize.Height()-nYDiff+3 ) );
+ }
+ else
+ {
+ Font aFont( m_aFT_ChooseType.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_ChooseType.SetControlFont( aFont );
+
+ m_aFT_ChooseType.SetStyle( m_aFT_ChooseType.GetStyle() | WB_NOLABEL );
+ }
+
+ this->SetText( String(SchResId(STR_PAGE_CHARTTYPE)) );
+
+ m_aMainTypeList.SetStyle(m_aMainTypeList.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_FLATVALUESET | WB_3DLOOK );
+ m_aMainTypeList.SetSelectHdl( LINK( this, ChartTypeTabPage, SelectMainTypeHdl ) );
+ m_aSubTypeList.SetSelectHdl( LINK( this, ChartTypeTabPage, SelectSubTypeHdl ) );
+
+ m_aSubTypeList.SetStyle(m_aSubTypeList.GetStyle() |
+ WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK );
+ m_aSubTypeList.SetColCount(4);
+ m_aSubTypeList.SetLineCount(1);
+
+ bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ m_aChartTypeDialogControllerList.push_back(new ColumnChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new BarChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new PieChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new AreaChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new LineChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new XYChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new BubbleChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new NetChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new StockChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new CombiColumnLineChartDialogController() );
+
+ ::std::vector< ChartTypeDialogController* >::const_iterator aIter = m_aChartTypeDialogControllerList.begin();
+ const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ m_aMainTypeList.InsertEntry( (*aIter)->getName(), (*aIter)->getImage( bIsHighContrast ) );
+ (*aIter)->setChangeListener( this );
+ }
+
+ m_nYTopPos = m_pAxisTypeResourceGroup->getPosition().Y();
+
+ m_pAxisTypeResourceGroup->setChangeListener( this );
+ m_pDim3DLookResourceGroup->setChangeListener( this );
+ m_pStackingResourceGroup->setChangeListener( this );
+ m_pSplineResourceGroup->setChangeListener( this );
+ m_pGeometryResourceGroup->setChangeListener( this );
+ m_pSortByXValuesResourceGroup->setChangeListener( this );
+}
+
+ChartTypeTabPage::~ChartTypeTabPage()
+{
+ //delete all dialog controller
+ ::std::vector< ChartTypeDialogController* >::const_iterator aIter = m_aChartTypeDialogControllerList.begin();
+ const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ delete *aIter;
+ }
+ m_aChartTypeDialogControllerList.clear();
+
+ //delete all resource helper
+ delete m_pAxisTypeResourceGroup;
+ delete m_pDim3DLookResourceGroup;
+ delete m_pStackingResourceGroup;
+ delete m_pSplineResourceGroup;
+ delete m_pGeometryResourceGroup;
+ delete m_pSortByXValuesResourceGroup;
+}
+ChartTypeParameter ChartTypeTabPage::getCurrentParamter() const
+{
+ ChartTypeParameter aParameter;
+ aParameter.nSubTypeIndex = static_cast<sal_Int32>( m_aSubTypeList.GetSelectItemId() );
+ m_pAxisTypeResourceGroup->fillParameter( aParameter );
+ m_pDim3DLookResourceGroup->fillParameter( aParameter );
+ m_pStackingResourceGroup->fillParameter( aParameter );
+ m_pSplineResourceGroup->fillParameter( aParameter );
+ m_pGeometryResourceGroup->fillParameter( aParameter );
+ m_pSortByXValuesResourceGroup->fillParameter( aParameter );
+ return aParameter;
+}
+void ChartTypeTabPage::commitToModel( const ChartTypeParameter& rParameter )
+{
+ if( !m_pCurrentMainType )
+ return;
+
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) );
+ m_pCurrentMainType->commitToModel( rParameter, m_xChartModel );
+}
+void ChartTypeTabPage::stateChanged( ChangingResource* /*pResource*/ )
+{
+ if(m_nChangingCalls)
+ return;
+ m_nChangingCalls++;
+
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ if( m_pCurrentMainType )
+ {
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ m_pCurrentMainType->adjustSubTypeAndEnableControls( aParameter );
+ }
+ if( m_bDoLiveUpdate )
+ commitToModel( aParameter );
+
+ //detect the new ThreeDLookScheme
+ aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) );
+ aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
+ //the controls have to be enabled/disabled accordingly
+ this->fillAllControls( aParameter );
+
+ m_nChangingCalls--;
+}
+ChartTypeDialogController* ChartTypeTabPage::getSelectedMainType()
+{
+ ChartTypeDialogController* pTypeController = 0;
+ ::std::vector< ChartTypeDialogController* >::size_type nM = static_cast< ::std::vector< ChartTypeDialogController* >::size_type >(
+ m_aMainTypeList.GetSelectEntryPos() );
+ if( nM<m_aChartTypeDialogControllerList.size() )
+ pTypeController = m_aChartTypeDialogControllerList[nM];
+ return pTypeController;
+}
+IMPL_LINK( ChartTypeTabPage, SelectSubTypeHdl, void *, EMPTYARG )
+{
+ if( m_pCurrentMainType )
+ {
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ this->fillAllControls( aParameter, false );
+ if( m_bDoLiveUpdate )
+ commitToModel( aParameter );
+ }
+ return 0;
+}
+
+IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG )
+{
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+
+ if( m_pCurrentMainType )
+ {
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ m_pCurrentMainType->hideExtraControls();
+ }
+
+ m_pCurrentMainType = this->getSelectedMainType();
+ if( m_pCurrentMainType )
+ {
+ this->showAllControls(*m_pCurrentMainType);
+
+ m_pCurrentMainType->adjustParameterToMainType( aParameter );
+ if( m_bDoLiveUpdate )
+ commitToModel( aParameter );
+ //detect the new ThreeDLookScheme
+ aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) );
+ if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Simple )
+ aParameter.eThreeDLookScheme=ThreeDLookScheme_Simple;
+
+ aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
+ this->fillAllControls( aParameter );
+ uno::Reference< beans::XPropertySet > xTemplateProps( this->getCurrentTemplate(), uno::UNO_QUERY );
+ m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
+ }
+ return 0;
+}
+
+void ChartTypeTabPage::showAllControls( ChartTypeDialogController& rTypeController )
+{
+ m_aSubTypeList.Show();
+
+ long nYPos = m_nYTopPos;
+
+ //------
+ bool bShow = rTypeController.shouldShow_XAxisTypeControl();
+ long nXPos = m_pAxisTypeResourceGroup->getPosition().X();
+ m_pAxisTypeResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pAxisTypeResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pAxisTypeResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_3DLookControl();
+ m_pDim3DLookResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pDim3DLookResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pDim3DLookResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_StackingControl();
+ m_pStackingResourceGroup->showControls( bShow, rTypeController.shouldShow_DeepStackingControl() );
+ if(bShow)
+ {
+ long nStackingXPos = nXPos;
+ if( rTypeController.shouldShow_XAxisTypeControl() )
+ nStackingXPos += this->LogicToPixel( Size(RSC_SP_CHK_TEXTINDENT,0), MapMode(MAP_APPFONT) ).Width();
+ m_pStackingResourceGroup->setPosition( Point( nStackingXPos, nYPos ) );
+ nYPos += m_pStackingResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_SplineControl();
+ m_pSplineResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pSplineResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pSplineResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_GeometryControl();
+ m_pGeometryResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pGeometryResourceGroup->setPosition( Point( nXPos+17, nYPos ) );
+ nYPos += m_pGeometryResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_SortByXValuesResourceGroup();
+ m_pSortByXValuesResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pSortByXValuesResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pSortByXValuesResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ Size aPageSize( this->GetSizePixel() );
+ Size aRemainingSize = Size( aPageSize.Width()-nXPos, aPageSize.Height()-nYPos );
+ rTypeController.showExtraControls( this, Point( nXPos, nYPos ), aRemainingSize );
+}
+
+void ChartTypeTabPage::fillAllControls( const ChartTypeParameter& rParameter, bool bAlsoResetSubTypeList )
+{
+ m_nChangingCalls++;
+ if( m_pCurrentMainType && bAlsoResetSubTypeList )
+ {
+ bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
+ m_pCurrentMainType->fillSubTypeList( m_aSubTypeList, bIsHighContrast, rParameter );
+ }
+ m_aSubTypeList.SelectItem( static_cast<USHORT>( rParameter.nSubTypeIndex) );
+ m_pAxisTypeResourceGroup->fillControls( rParameter );
+ m_pDim3DLookResourceGroup->fillControls( rParameter );
+ m_pStackingResourceGroup->fillControls( rParameter );
+ m_pSplineResourceGroup->fillControls( rParameter );
+ m_pGeometryResourceGroup->fillControls( rParameter );
+ m_pSortByXValuesResourceGroup->fillControls( rParameter );
+ m_nChangingCalls--;
+}
+
+void ChartTypeTabPage::initializePage()
+{
+ if( !m_xChartModel.is() )
+ return;
+ uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< frame::XModel > xModel( m_xChartModel, uno::UNO_QUERY);
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
+ DiagramHelper::tTemplateWithServiceName aTemplate =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager );
+ ::rtl::OUString aServiceName( aTemplate.second );
+
+ bool bFound = false;
+
+ ::std::vector< ChartTypeDialogController* >::iterator aIter = m_aChartTypeDialogControllerList.begin();
+ const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
+ for( USHORT nM=0; aIter != aEnd; aIter++, nM++ )
+ {
+ if( (*aIter)->isSubType(aServiceName) )
+ {
+ bFound = true;
+
+ m_aMainTypeList.SelectEntryPos( nM );
+ this->showAllControls( **aIter );
+ uno::Reference< beans::XPropertySet > xTemplateProps( aTemplate.first, uno::UNO_QUERY );
+ ChartTypeParameter aParameter = (*aIter)->getChartTypeParameterForService( aServiceName, xTemplateProps );
+ m_pCurrentMainType = this->getSelectedMainType();
+
+ //set ThreeDLookScheme
+ aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( xDiagram );
+ if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Simple )
+ aParameter.eThreeDLookScheme=ThreeDLookScheme_Simple;
+
+ aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
+
+ this->fillAllControls( aParameter );
+ if( m_pCurrentMainType )
+ m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
+ break;
+ }
+ }
+
+ if( !bFound )
+ {
+ m_aSubTypeList.Hide();
+ m_pAxisTypeResourceGroup->showControls( false );
+ m_pDim3DLookResourceGroup->showControls( false );
+ m_pStackingResourceGroup->showControls( false, false );
+ m_pSplineResourceGroup->showControls( false );
+ m_pGeometryResourceGroup->showControls( false );
+ m_pSortByXValuesResourceGroup->showControls( false );
+ }
+}
+
+sal_Bool ChartTypeTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ //commit changes to model
+ if( !m_bDoLiveUpdate && m_pCurrentMainType )
+ {
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ commitToModel( aParameter );
+ }
+
+ return sal_True;//return false if this page should not be left
+}
+
+uno::Reference< XChartTypeTemplate > ChartTypeTabPage::getCurrentTemplate() const
+{
+ if( m_pCurrentMainType && m_xChartModel.is() )
+ {
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
+ return m_pCurrentMainType->getCurrentTemplate( aParameter, xTemplateManager );
+ }
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hrc b/chart2/source/controller/dialogs/tp_ChartType.hrc
new file mode 100644
index 000000000000..073c2547f09a
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_ChartType.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define LB_3D_SCHEME 1
+#define LB_CHARTTYPE 2
+#define CT_CHARTVARIANT 3
+
+#define FL_SPLINE_SEPARATOR 2
+#define FL_SPLINE_DIALOGBUTTONS 3
+
+#define FT_CHARTTYPE 1
+#define FT_SPLINE_ORDER 3
+#define FT_SPLINE_RESOLUTION 4
+
+#define CB_X_AXIS_CATEGORIES 1
+#define CB_3D_LOOK 2
+#define CB_STACKED 3
+#define CB_SPLINES 4
+#define CB_XVALUE_SORTING 5
+
+#define PB_SPLINE_DIALOG 1
+
+#define RB_STACK_Y 2
+#define RB_STACK_Y_PERCENT 3
+#define RB_STACK_Z 4
+
+#define RB_SPLINES_CUBIC 5
+#define RB_SPLINES_B 6
+
+#define MF_SPLINE_ORDER 1
+#define MF_SPLINE_RESOLUTION 2
+
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx
new file mode 100644
index 000000000000..878c845eb84c
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_ChartType.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_CHARTTYPE_HXX
+#define _CHART2_TP_CHARTTYPE_HXX
+
+#include <vector>
+
+#include "ChartTypeDialogController.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "TimerTriggeredControllerLock.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <svtools/wizardmachine.hxx>
+#include <svtools/valueset.hxx>
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class ChartTypeResourceGroup;
+class AxisTypeResourceGroup;
+class Dim3DLookResourceGroup;
+class StackingResourceGroup;
+class SplineResourceGroup;
+class GeometryResourceGroup;
+class ChartTypeParameter;
+class SortByXValuesResourceGroup;
+
+class ChartTypeTabPage : public ResourceChangeListener, public svt::OWizardPage, public ChartTypeTemplateProvider
+{
+public:
+ ChartTypeTabPage( Window* pParent
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext
+ , bool bDoLiveUpdate, bool bHideDescription = false );
+ virtual ~ChartTypeTabPage();
+
+ virtual void initializePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate() const;
+
+protected:
+ ChartTypeDialogController* getSelectedMainType();
+ void showAllControls( ChartTypeDialogController& rTypeController );
+ void fillAllControls( const ChartTypeParameter& rParameter, bool bAlsoResetSubTypeList=true );
+ ChartTypeParameter getCurrentParamter() const;
+
+ virtual void stateChanged( ChangingResource* pResource );
+
+ void commitToModel( const ChartTypeParameter& rParameter );
+
+ DECL_LINK( SelectMainTypeHdl, void* );
+ DECL_LINK( SelectSubTypeHdl, void* );
+
+protected:
+ FixedText m_aFT_ChooseType;
+ ListBox m_aMainTypeList;
+ ValueSet m_aSubTypeList;
+
+ AxisTypeResourceGroup* m_pAxisTypeResourceGroup;
+ Dim3DLookResourceGroup* m_pDim3DLookResourceGroup;
+ StackingResourceGroup* m_pStackingResourceGroup;
+ SplineResourceGroup* m_pSplineResourceGroup;
+ GeometryResourceGroup* m_pGeometryResourceGroup;
+ SortByXValuesResourceGroup* m_pSortByXValuesResourceGroup;
+
+ long m_nYTopPos;//top y position of the different ResourceGroups (AxisTypeResourceGroup, etc)
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xCC;
+
+ ::std::vector< ChartTypeDialogController* > m_aChartTypeDialogControllerList;
+ ChartTypeDialogController* m_pCurrentMainType;
+
+ sal_Int32 m_nChangingCalls;
+ bool m_bDoLiveUpdate;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_ChartType.src b/chart2/source/controller/dialogs/tp_ChartType.src
new file mode 100644
index 000000000000..ee8df4cad389
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.src
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_ChartType.src,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_ChartType.hrc"
+#include "SchSlotIds.hxx"
+#include "dlg_CreationWizard.hrc"
+#include "CommonResources.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+
+#define WIDTH_MAINLIST 75
+#define HEIGHT_MAINLIST 122
+#define WIDTH_IMAGELIST 150
+#define HEIGHT_IMAGELIST 50
+#define WIDTH_3D 100
+#define POS_X_MAINLIST 6
+#define POS_X_IMAGELIST (POS_X_MAINLIST+WIDTH_MAINLIST+6)
+#define POS_Y1 8
+#define POS_Y_LIST (POS_Y1+RSC_CD_FIXEDTEXT_HEIGHT+4)
+#define POS_Y_VALUE_X_AXIS (POS_Y_LIST+HEIGHT_IMAGELIST+RSC_SP_CTRL_Y+2)
+#define POS_Y_3D_LOOK (POS_Y_VALUE_X_AXIS+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
+#define POS_Y_STACKING (POS_Y_3D_LOOK+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
+#define POS_Y_SPLINES (POS_Y_STACKING+4*12+12)
+#define POS_Y_XVALUE_SORTING (POS_Y_SPLINES+4+12)
+
+#define POS_X_SPLINES_1 (8)
+#define POS_Y_SPLINES_2 (8)
+#define POS_Y_SPLINES_3 (POS_Y_SPLINES_2+13)
+#define POS_Y_SPLINES_4 (POS_Y_SPLINES_3+13)
+#define POS_Y_SPLINES_5 (POS_Y_SPLINES_4+RSC_CD_FIXEDTEXT_HEIGHT)
+
+#define SPLINES_WIDTH_RADIO 45
+#define SPLINES_WIDTH_METRIC_TEXT 60
+#define POS_X_SPLINE_EXTRAS (POS_X_SPLINES_1+SPLINES_WIDTH_RADIO+RSC_SP_FLGR_SPACE_X+RSC_CD_FIXEDLINE_WIDTH+2*RSC_SP_FLGR_SPACE_X)
+#define WIZ_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-POS_X_MAINLIST-6)
+#define WIDTH_XVALUE_SORTING (WIDTH_IMAGELIST)
+
+#define SPLINE_DIALOG_WIDTH 172
+#define SPLINE_DIALOG_HEIGHT 59
+
+TabPage TP_CHARTTYPE
+{
+ Hide = TRUE ;
+ HelpID = SID_DIAGRAM_TYPE;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ;
+
+ FixedText FT_CHARTTYPE
+ {
+ Pos = MAP_APPFONT ( POS_X_MAINLIST-1 , POS_Y1 ) ;
+ Size = MAP_APPFONT ( WIZ_FIXEDLINE_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ TabStop = FALSE ;
+ Text [ en-US ] = "Choose a chart type";
+ };
+ ListBox LB_CHARTTYPE
+ {
+ HelpId = HID_SCH_CTL_TYPE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_MAINLIST , POS_Y_LIST ) ;
+ Size = MAP_APPFONT ( WIDTH_MAINLIST, HEIGHT_MAINLIST ) ;
+ };
+ Control CT_CHARTVARIANT
+ {
+ HelpId = HID_SCH_CTL_VARIANT ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_LIST ) ;
+ Size = MAP_APPFONT ( WIDTH_IMAGELIST , HEIGHT_IMAGELIST ) ;
+ TabStop = TRUE ;
+ };
+
+ CheckBox CB_X_AXIS_CATEGORIES
+ {
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_VALUE_X_AXIS ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "X axis with Categories" ;
+ };
+ CheckBox CB_3D_LOOK
+ {
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_3D_LOOK ) ;
+ Size = MAP_APPFONT ( WIDTH_3D , 10 ) ;
+ Text [ en-US ] = "~3D Look" ;
+ };
+ ListBox LB_3D_SCHEME
+ {
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+WIDTH_3D+4 , POS_Y_3D_LOOK ) ;
+ Size = MAP_APPFONT ( 60, 12 ) ;
+ };
+
+ CheckBox CB_STACKED
+ {
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_STACKING ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "~Stack series" ;
+ };
+ RadioButton RB_STACK_Y
+ {
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+12 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ //Uebereinander (summiere Y-Werte)
+ //On top (sum Y-values)
+ Text [ en-US ] = "On top";
+ };
+ RadioButton RB_STACK_Y_PERCENT
+ {
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+2*12 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Percent";
+ };
+ RadioButton RB_STACK_Z
+ {
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+3*12 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ //Hintereinander (verteile Datenreihen auf der Z-Achse)
+ //Deep (spread series on Z-Axis)
+ Text [ en-US ] = "Deep";
+ };
+
+ CheckBox CB_SPLINES
+ {
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_SPLINES ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "S~mooth lines" ;
+ };
+
+ PushButton PB_SPLINE_DIALOG
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_SPLINES-6 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ Text [ en-US ] = "Properties..." ;
+ };
+
+ CheckBox CB_XVALUE_SORTING
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_XVALUE_SORTING ) ;
+ Size = MAP_APPFONT ( WIDTH_XVALUE_SORTING , 10 ) ;
+ Text [ en-US ] = "~Sort by X values" ;
+ };
+
+};
+
+ModalDialog DLG_SPLINE_PROPERTIES
+{
+ HelpID = HID_SCH_DLG_SPLINE_PROPERTIES;
+ Size = MAP_APPFONT ( SPLINE_DIALOG_WIDTH , SPLINE_DIALOG_HEIGHT ) ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+ RadioButton RB_SPLINES_CUBIC
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_2 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cubic spline";
+ };
+ RadioButton RB_SPLINES_B
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_3 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "B-Spline";
+ };
+
+ FixedLine FL_SPLINE_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS-RSC_CD_FIXEDLINE_WIDTH-RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_2 ) ;
+ Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH , 2*12 ) ;
+ Vert = TRUE ;
+ };
+
+ FixedText FT_SPLINE_RESOLUTION
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS , POS_Y_SPLINES_2 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_METRIC_TEXT , 10 ) ;
+ Text [ en-US ] = "~Resolution" ;
+ };
+ MetricField MF_SPLINE_RESOLUTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_2-2 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+
+ FixedText FT_SPLINE_ORDER
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS , POS_Y_SPLINES_3 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_METRIC_TEXT , 10 ) ;
+ Text [ en-US ] = "~Data points order" ;
+ };
+ MetricField MF_SPLINE_ORDER
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_3-2 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_SPLINE_DIALOGBUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , POS_Y_SPLINES_4 ) ;
+ Size = MAP_APPFONT ( SPLINE_DIALOG_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ };
+ BUTTONS_HELP_OK_CANCEL_NEXT(POS_X_SPLINES_1,POS_Y_SPLINES_5)
+};
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx
new file mode 100644
index 000000000000..2da9778a4db8
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataLabel.cxx,v $
+ * $Revision: 1.9.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_DataLabel.hxx"
+
+#include "TabPages.hrc"
+#include "ResId.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+DataLabelsTabPage::DataLabelsTabPage(Window* pWindow, const SfxItemSet& rInAttrs) :
+ SfxTabPage(pWindow, SchResId(TP_DATA_DESCR), rInAttrs),
+ m_aDataLabelResources(this, rInAttrs)
+{
+ FreeResource();
+}
+
+DataLabelsTabPage::~DataLabelsTabPage()
+{
+}
+
+SfxTabPage* DataLabelsTabPage::Create(Window* pWindow,
+ const SfxItemSet& rOutAttrs)
+{
+ return new DataLabelsTabPage(pWindow, rOutAttrs);
+}
+
+BOOL DataLabelsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ return m_aDataLabelResources.FillItemSet(rOutAttrs);
+}
+
+void DataLabelsTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ m_aDataLabelResources.Reset(rInAttrs);
+}
+
+void DataLabelsTabPage::SetNumberFormatter( SvNumberFormatter* pFormatter )
+{
+ m_aDataLabelResources.SetNumberFormatter( pFormatter );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx
new file mode 100644
index 000000000000..9e5bd968154d
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataLabel.hxx,v $
+ * $Revision: 1.5.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_DATALABEL_HXX
+#define _CHART2_TP_DATALABEL_HXX
+
+#include "res_DataLabel.hxx"
+#include <sfx2/tabdlg.hxx>
+
+class SvNumberFormatter;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class DataLabelsTabPage : public SfxTabPage
+{
+public:
+ DataLabelsTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~DataLabelsTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+
+ void SetNumberFormatter( SvNumberFormatter* pFormatter );
+
+ virtual void Reset(const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+
+private:
+ DataLabelResources m_aDataLabelResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.src b/chart2/source/controller/dialogs/tp_DataLabel.src
new file mode 100644
index 000000000000..32f5835295f7
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataLabel.src
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataLabel.src,v $
+ * $Revision: 1.4.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_DataLabel.hrc"
+
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+
+TabPage TP_DATA_DESCR
+{
+ Hide = TRUE ;
+ HelpID = HID_SCH_DATA_DESCR ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ RESOURCE_DATALABEL( 6, 8 )
+};
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
new file mode 100644
index 000000000000..ff858c5bfdf5
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -0,0 +1,1079 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataSource.cxx,v $
+ * $Revision: 1.5.44.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_DataSource.hxx"
+#include "tp_DataSource.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "macros.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "RangeSelectionHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "tp_DataSourceControls.hxx"
+#include "ControllerLockGuard.hxx"
+#include "DataSourceHelper.hxx"
+#include <com/sun/star/sheet/XRangeSelection.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+
+// for RET_OK
+#include <vcl/msgbox.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <functional>
+#include <algorithm>
+#include <map>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// --------------------------------------------------------------------------------
+
+namespace
+{
+
+const OUString lcl_aLabelRole( RTL_CONSTASCII_USTRINGPARAM( "label" ));
+
+String lcl_GetRoleLBEntry(
+ const OUString & rRole, const OUString & rRange )
+{
+ String aEntry( rRole );
+ aEntry += '\t';
+ aEntry += String(
+ ::chart::DialogModel::ConvertRoleFromInternalToUI( rRole ));
+ aEntry += '\t';
+ aEntry += String( rRange );
+
+ return aEntry;
+}
+
+void lcl_UpdateCurrentRange(
+ SvTabListBox & rOutListBox,
+ const OUString & rRole, const OUString & rRange )
+{
+ SvLBoxEntry * pEntry = rOutListBox.FirstSelected();
+ if( pEntry )
+ rOutListBox.SetEntryText( lcl_GetRoleLBEntry( rRole, rRange ), pEntry );
+}
+
+bool lcl_UpdateCurrentSeriesName(
+ SvTreeListBox & rOutListBox )
+{
+ bool bResult = false;
+ ::chart::SeriesEntry * pEntry = dynamic_cast< ::chart::SeriesEntry * >( rOutListBox.FirstSelected());
+ if( pEntry &&
+ pEntry->m_xDataSeries.is() &&
+ pEntry->m_xChartType.is())
+ {
+ String aLabel( ::chart::DataSeriesHelper::getDataSeriesLabel(
+ pEntry->m_xDataSeries,
+ pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel()));
+ if( aLabel.Len())
+ {
+ rOutListBox.SetEntryText( pEntry, aLabel );
+ bResult = true;
+ }
+ }
+ return bResult;
+}
+
+OUString lcl_GetSelectedRole( const SvTabListBox & rRoleListBox, bool bUITranslated = false )
+{
+ OUString aResult;
+ SvLBoxEntry * pEntry = rRoleListBox.FirstSelected();
+ if( pEntry )
+ aResult = OUString( rRoleListBox.GetEntryText( pEntry,
+ bUITranslated ? 1 : 0 ));
+ return aResult;
+}
+
+OUString lcl_GetSelectedRolesRange( const SvTabListBox & rRoleListBox )
+{
+ OUString aResult;
+ SvLBoxEntry * pEntry = rRoleListBox.FirstSelected();
+ if( pEntry )
+ aResult = OUString( rRoleListBox.GetEntryText( pEntry, 2 ));
+ return aResult;
+}
+
+OUString lcl_GetSequenceNameForLabel( ::chart::SeriesEntry * pEntry )
+{
+ OUString aResult( RTL_CONSTASCII_USTRINGPARAM("values-y"));
+ if( pEntry &&
+ pEntry->m_xChartType.is())
+ {
+ aResult = pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel();
+ }
+ return aResult;
+}
+
+static long lcl_pRoleListBoxTabs[] =
+ { 3, // Number of Tabs
+ 0, 0, 75
+ };
+
+void lcl_ShowChooserButton(
+ ::chart::RangeSelectionButton & rChooserButton,
+ Edit & rEditField,
+ BOOL bShow )
+{
+ if( rChooserButton.IsVisible() != bShow )
+ {
+ rChooserButton.Show( bShow );
+ sal_Int32 nWidhtDiff = 12 + 4;
+ if( bShow )
+ nWidhtDiff = -nWidhtDiff;
+ Size aSize = rChooserButton.PixelToLogic( rEditField.GetSizePixel(), MAP_APPFONT );
+ aSize.setWidth( aSize.getWidth() + nWidhtDiff );
+ rEditField.SetSizePixel( rChooserButton.LogicToPixel( aSize, MAP_APPFONT ));
+ }
+}
+
+void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
+{
+ if( pDialog )
+ {
+ pDialog->Show( bEnable ? FALSE : TRUE );
+ pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ }
+}
+
+void lcl_addLSequenceToDataSource(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSequence,
+ const Reference< chart2::data::XDataSource > & xSource )
+{
+ Reference< data::XDataSink > xSink( xSource, uno::UNO_QUERY );
+ if( xSink.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences());
+ aData.realloc( aData.getLength() + 1 );
+ aData[ aData.getLength() - 1 ] = xLSequence;
+ xSink->setData( aData );
+ }
+}
+
+Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
+ const Reference< chart2::data::XDataSource > & xDataSource )
+{
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences());
+
+ for( sal_Int32 i=0; i<aSequences.getLength(); ++i )
+ {
+ // no values are set but a label exists
+ if( ! aSequences[i]->getValues().is() &&
+ aSequences[i]->getLabel().is())
+ {
+ xResult.set( aSequences[i] );
+ break;
+ }
+ }
+
+ return xResult;
+}
+
+void lcl_shiftControlY( Control & rControl, long nYOffset )
+{
+ Point aPos( rControl.GetPosPixel());
+ aPos.setY( aPos.getY() + nYOffset );
+ rControl.SetPosPixel( aPos );
+}
+
+void lcl_increaseHeightOfControl( Control & rControl, long nYOffset )
+{
+ Size aSize( rControl.GetSizePixel());
+ aSize.setHeight( aSize.getHeight () + nYOffset );
+ rControl.SetSizePixel( aSize );
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+
+DataSourceTabPage::DataSourceTabPage(
+ Window * pParent,
+ DialogModel & rDialogModel,
+ ChartTypeTemplateProvider* pTemplateProvider,
+ Dialog * pParentDialog,
+ bool bHideDescription /* = false */ ) :
+ ::svt::OWizardPage( pParent, SchResId( TP_DATA_SOURCE )),
+
+ m_aFT_CAPTION ( this, SchResId( FT_CAPTION_FOR_WIZARD )),
+ m_aFT_SERIES ( this, SchResId( FT_SERIES )),
+ m_apLB_SERIES( new SeriesListBox( this, SchResId( LB_SERIES ))),
+ m_aBTN_ADD ( this, SchResId( BTN_ADD )),
+ m_aBTN_REMOVE ( this, SchResId( BTN_REMOVE )),
+ m_aBTN_UP ( this, SchResId( BTN_UP )),
+ m_aBTN_DOWN ( this, SchResId( BTN_DOWN )),
+ m_aFT_ROLE ( this, SchResId( FT_ROLE )),
+ m_aLB_ROLE ( this, SchResId( LB_ROLE )),
+ m_aFT_RANGE ( this, SchResId( FT_RANGE )),
+ m_aEDT_RANGE ( this, SchResId( EDT_RANGE )),
+ m_aIMB_RANGE_MAIN ( this, SchResId( IMB_RANGE_MAIN )),
+ m_aFT_CATEGORIES ( this, SchResId( FT_CATEGORIES )),
+ m_aFT_DATALABELS ( this, SchResId( FT_DATALABELS )),
+ m_aEDT_CATEGORIES ( this, SchResId( EDT_CATEGORIES )),
+ m_aIMB_RANGE_CAT ( this, SchResId( IMB_RANGE_CAT )),
+
+ m_pTemplateProvider( pTemplateProvider ),
+ m_rDialogModel( rDialogModel ),
+
+ m_pCurrentRangeChoosingField( 0 ),
+ m_bIsDirty( false ),
+ m_pParentDialog( pParentDialog ),
+ m_pTabPageNotifiable( dynamic_cast< TabPageNotifiable * >( pParentDialog ))
+{
+ FreeResource();
+
+ if( bHideDescription )
+ {
+ // note: the offset should be a negative value for shifting upwards, the
+ // 4 is for the offset difference between a wizard page and a tab-page
+ long nYOffset = - ( m_aFT_SERIES.GetPosPixel().getY() - m_aFT_CAPTION.GetPosPixel().getY() + 4 );
+ long nUpShift = - 2;
+ long nYResize = - (nYOffset - nUpShift);
+ m_aFT_CAPTION.Hide();
+
+ // shift list boxes and enlarge them by the space saved by hiding the caption
+ lcl_shiftControlY( m_aFT_SERIES, nYOffset );
+ lcl_shiftControlY( *(m_apLB_SERIES.get()), nYOffset );
+ lcl_increaseHeightOfControl( *(m_apLB_SERIES.get()), nYResize );
+
+ lcl_shiftControlY( m_aFT_ROLE, nYOffset );
+ lcl_shiftControlY( m_aLB_ROLE, nYOffset );
+ lcl_increaseHeightOfControl( m_aLB_ROLE, nYResize );
+
+ lcl_shiftControlY( m_aBTN_ADD, nUpShift );
+ lcl_shiftControlY( m_aBTN_REMOVE, nUpShift );
+ lcl_shiftControlY( m_aBTN_UP, nUpShift );
+ lcl_shiftControlY( m_aBTN_DOWN, nUpShift );
+ lcl_shiftControlY( m_aFT_RANGE, nUpShift );
+ lcl_shiftControlY( m_aEDT_RANGE, nUpShift );
+ lcl_shiftControlY( m_aIMB_RANGE_MAIN, nUpShift );
+ lcl_shiftControlY( m_aFT_CATEGORIES, nUpShift );
+ lcl_shiftControlY( m_aFT_DATALABELS, nUpShift );
+ lcl_shiftControlY( m_aEDT_CATEGORIES, nUpShift );
+ lcl_shiftControlY( m_aIMB_RANGE_CAT, nUpShift );
+ }
+ else
+ {
+ // make font of caption bold
+ Font aFont( m_aFT_CAPTION.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_CAPTION.SetControlFont( aFont );
+
+ // no mnemonic
+ m_aFT_CAPTION.SetStyle( m_aFT_CAPTION.GetStyle() | WB_NOLABEL );
+ }
+
+ m_aFixedTextRange = OUString( m_aFT_RANGE.GetText() );
+ this->SetText( String( SchResId( STR_OBJECT_DATASERIES_PLURAL ) ) );
+
+ // set handlers
+ m_apLB_SERIES->SetSelectHdl( LINK( this, DataSourceTabPage, SeriesSelectionChangedHdl ));
+
+ m_aLB_ROLE.SetWindowBits( WB_HSCROLL | WB_CLIPCHILDREN );
+ m_aLB_ROLE.SetSelectionMode( SINGLE_SELECTION );
+ m_aLB_ROLE.SetSelectHdl( LINK( this, DataSourceTabPage, RoleSelectionChangedHdl ));
+
+ m_aEDT_RANGE.SetKeyInputHdl( LINK( this, DataSourceTabPage, MainRangeButtonClickedHdl ));
+ m_aEDT_CATEGORIES.SetKeyInputHdl( LINK( this, DataSourceTabPage, CategoriesRangeButtonClickedHdl ));
+
+ m_aIMB_RANGE_MAIN.SetClickHdl( LINK( this, DataSourceTabPage, MainRangeButtonClickedHdl ));
+ m_aIMB_RANGE_CAT.SetClickHdl( LINK( this, DataSourceTabPage, CategoriesRangeButtonClickedHdl ));
+
+ m_aBTN_ADD.SetClickHdl( LINK( this, DataSourceTabPage, AddButtonClickedHdl ));
+ m_aBTN_REMOVE.SetClickHdl( LINK( this, DataSourceTabPage, RemoveButtonClickedHdl ));
+
+ m_aBTN_UP.SetClickHdl( LINK( this, DataSourceTabPage, UpButtonClickedHdl ));
+ m_aBTN_DOWN.SetClickHdl( LINK( this, DataSourceTabPage, DownButtonClickedHdl ));
+
+ m_aEDT_RANGE.SetModifyHdl( LINK( this, DataSourceTabPage, RangeModifiedHdl ));
+ m_aEDT_CATEGORIES.SetModifyHdl( LINK( this, DataSourceTabPage, RangeModifiedHdl ));
+ m_aEDT_RANGE.SetUpdateDataHdl( LINK( this, DataSourceTabPage, RangeUpdateDataHdl ));
+ m_aEDT_CATEGORIES.SetUpdateDataHdl( LINK( this, DataSourceTabPage, RangeUpdateDataHdl ));
+
+ // #i75179# enable setting the background to a different color
+ m_aEDT_RANGE.SetStyle( m_aEDT_RANGE.GetStyle() | WB_FORCECTRLBACKGROUND );
+ m_aEDT_CATEGORIES.SetStyle( m_aEDT_CATEGORIES.GetStyle() | WB_FORCECTRLBACKGROUND );
+
+ // set symbol font for arrows
+ // note: StarSymbol is substituted to OpenSymbol for OOo
+ Font aSymbolFont( m_aBTN_UP.GetFont());
+ aSymbolFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "StarSymbol" )));
+ m_aBTN_UP.SetControlFont( aSymbolFont );
+ m_aBTN_DOWN.SetControlFont( aSymbolFont );
+
+ // set button text
+ sal_Unicode cBlackUpPointingTriangle( 0x25b2 );
+ sal_Unicode cBlackDownPointingTriangle( 0x25bc );
+ m_aBTN_UP.SetText( String( cBlackUpPointingTriangle ));
+ m_aBTN_DOWN.SetText( String( cBlackDownPointingTriangle ));
+
+ // init controls
+ m_aLB_ROLE.SetTabs( lcl_pRoleListBoxTabs, MAP_APPFONT );
+ m_aLB_ROLE.Show();
+
+ updateControlsFromDialogModel();
+
+ // select first series
+ if( m_apLB_SERIES->First())
+ m_apLB_SERIES->Select( m_apLB_SERIES->First());
+ m_apLB_SERIES->GrabFocus();
+}
+
+DataSourceTabPage::~DataSourceTabPage()
+{}
+
+void DataSourceTabPage::ActivatePage()
+{
+ OWizardPage::ActivatePage();
+ updateControlsFromDialogModel();
+}
+
+void DataSourceTabPage::initializePage()
+{
+}
+
+void DataSourceTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void DataSourceTabPage::commitPage()
+{
+ commitPage(eFinish);
+}
+
+sal_Bool DataSourceTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ updateModelFromControl( 0 /*update all*/ );
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
+bool DataSourceTabPage::isRangeFieldContentValid( Edit & rEdit )
+{
+ OUString aRange( rEdit.GetText());
+ bool bIsValid = ( aRange.getLength() == 0 ) ||
+ m_rDialogModel.getRangeSelectionHelper()->verifyCellRange( aRange );
+
+ if( bIsValid )
+ {
+ rEdit.SetControlForeground();
+ rEdit.SetControlBackground();
+ }
+ else
+ {
+ rEdit.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR );
+ rEdit.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR );
+ }
+
+ return bIsValid;
+}
+
+bool DataSourceTabPage::isValid()
+{
+ bool bRoleRangeValid = true;
+ bool bCategoriesRangeValid = true;
+ bool bHasSelectedEntry = (m_apLB_SERIES->FirstSelected() != 0);
+
+ if( bHasSelectedEntry )
+ bRoleRangeValid = isRangeFieldContentValid( m_aEDT_RANGE );
+ if( m_aEDT_CATEGORIES.IsEnabled() )
+ bCategoriesRangeValid = isRangeFieldContentValid( m_aEDT_CATEGORIES );
+ bool bValid = ( bRoleRangeValid && bCategoriesRangeValid );
+
+ if( m_pTabPageNotifiable )
+ {
+ if( bValid )
+ m_pTabPageNotifiable->setValidPage( this );
+ else
+ m_pTabPageNotifiable->setInvalidPage( this );
+ }
+
+ return bValid;
+}
+
+void DataSourceTabPage::setDirty()
+{
+ m_bIsDirty = true;
+}
+
+void DataSourceTabPage::updateControlsFromDialogModel()
+{
+ // series
+ fillSeriesListBox();
+ SeriesSelectionChangedHdl( 0 );
+
+ // categories
+ m_aEDT_CATEGORIES.SetText( String( m_rDialogModel.getCategoriesRange() ));
+
+ updateControlState();
+}
+
+void DataSourceTabPage::fillSeriesListBox()
+{
+ m_apLB_SERIES->SetUpdateMode( FALSE );
+
+ Reference< XDataSeries > xSelected;
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ if( pEntry )
+ xSelected.set( pEntry->m_xDataSeries );
+
+ bool bHasSelectedEntry = (pEntry != 0);
+ SvLBoxEntry * pSelectedEntry = 0;
+ m_apLB_SERIES->Clear();
+
+ ::std::vector< DialogModel::tSeriesWithChartTypeByName > aSeries(
+ m_rDialogModel.getAllDataSeriesWithLabel() );
+
+ sal_Int32 nUnnamedSeriesIndex = 1;
+ for( ::std::vector< DialogModel::tSeriesWithChartTypeByName >::const_iterator aIt = aSeries.begin();
+ aIt != aSeries.end(); ++aIt )
+ {
+ String aLabel( (*aIt).first );
+ if( !aLabel.Len())
+ {
+ if( nUnnamedSeriesIndex > 1 )
+ {
+ OUString aResString( String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES_WITH_INDEX )));
+
+ // replace index of unnamed series
+ const OUString aReplacementStr( RTL_CONSTASCII_USTRINGPARAM( "%NUMBER" ));
+ sal_Int32 nIndex = aResString.indexOf( aReplacementStr );
+ if( nIndex != -1 )
+ aLabel = String( aResString.replaceAt(
+ nIndex, aReplacementStr.getLength(),
+ String::CreateFromInt32( nUnnamedSeriesIndex )));
+ }
+ if( aLabel.Len() == 0 )
+ aLabel = String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES ));
+
+ ++nUnnamedSeriesIndex;
+ }
+ pEntry = dynamic_cast< SeriesEntry * >(
+ m_apLB_SERIES->InsertEntry( aLabel ));
+ if( pEntry )
+ {
+ pEntry->m_xDataSeries.set( (*aIt).second.first );
+ pEntry->m_xChartType.set( (*aIt).second.second );
+ if( bHasSelectedEntry && ((*aIt).second.first == xSelected))
+ pSelectedEntry = pEntry;
+ }
+ }
+
+ if( bHasSelectedEntry && pSelectedEntry )
+ m_apLB_SERIES->Select( pSelectedEntry );
+
+ m_apLB_SERIES->SetUpdateMode( TRUE );
+}
+
+void DataSourceTabPage::fillRoleListBox()
+{
+ SeriesEntry * pSeriesEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pSeriesEntry != 0);
+
+ SvLBoxEntry * pRoleEntry = m_aLB_ROLE.FirstSelected();
+ ULONG nRoleIndex = SAL_MAX_UINT32;
+ if( pRoleEntry )
+ nRoleIndex = m_aLB_ROLE.GetModel()->GetAbsPos( pRoleEntry );
+
+ if( bHasSelectedEntry )
+ {
+ DialogModel::tRolesWithRanges aRoles(
+ m_rDialogModel.getRolesWithRanges(
+ pSeriesEntry->m_xDataSeries,
+ lcl_GetSequenceNameForLabel( pSeriesEntry ),
+ pSeriesEntry->m_xChartType ));
+
+ // fill role list
+ m_aLB_ROLE.SetUpdateMode( FALSE );
+ m_aLB_ROLE.Clear();
+ m_aLB_ROLE.RemoveSelection();
+
+ for( DialogModel::tRolesWithRanges::const_iterator aIt( aRoles.begin());
+ aIt != aRoles.end(); ++ aIt )
+ {
+ m_aLB_ROLE.InsertEntry( lcl_GetRoleLBEntry( aIt->first, aIt->second ));
+ }
+
+ // series may contain no roles, check listbox size before selecting entries
+ if( m_aLB_ROLE.GetEntryCount() > 0 )
+ {
+ if( nRoleIndex >= m_aLB_ROLE.GetEntryCount())
+ nRoleIndex = 0;
+ m_aLB_ROLE.Select( m_aLB_ROLE.GetEntry( nRoleIndex ));
+ }
+
+ m_aLB_ROLE.SetUpdateMode( TRUE );
+ }
+}
+
+void DataSourceTabPage::updateControlState()
+{
+ SvLBoxEntry * pSeriesEntry = m_apLB_SERIES->FirstSelected();
+ bool bHasSelectedSeries = (pSeriesEntry != 0);
+ bool bHasValidRole = false;
+ bool bHasRangeChooser = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
+
+ if( bHasSelectedSeries )
+ {
+ SvLBoxEntry * pRoleEntry = m_aLB_ROLE.FirstSelected();
+ bHasValidRole = (pRoleEntry != 0);
+ }
+
+ m_aBTN_ADD.Enable( true );
+ m_aBTN_REMOVE.Enable( bHasSelectedSeries );
+
+ m_aBTN_UP.Enable( bHasSelectedSeries && (pSeriesEntry != m_apLB_SERIES->First()));
+ m_aBTN_DOWN.Enable( bHasSelectedSeries && (pSeriesEntry != m_apLB_SERIES->Last()));
+
+ bool bHasCategories = m_rDialogModel.isCategoryDiagram();
+
+ m_aFT_DATALABELS.Show(!bHasCategories);
+ m_aFT_CATEGORIES.Show( bHasCategories);
+ BOOL bShowIB = bHasRangeChooser;
+ lcl_ShowChooserButton( m_aIMB_RANGE_CAT, m_aEDT_CATEGORIES, bShowIB );
+
+ m_aFT_SERIES.Enable();
+ m_apLB_SERIES->Enable();
+
+ m_aFT_ROLE.Enable( bHasSelectedSeries );
+ m_aLB_ROLE.Enable( bHasSelectedSeries );
+
+ m_aFT_RANGE.Enable( bHasValidRole );
+ m_aEDT_RANGE.Enable( bHasValidRole );
+ lcl_ShowChooserButton( m_aIMB_RANGE_MAIN, m_aEDT_RANGE, bShowIB );
+ isValid();
+}
+
+IMPL_LINK( DataSourceTabPage, SeriesSelectionChangedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ if( m_apLB_SERIES->FirstSelected())
+ {
+ fillRoleListBox();
+ RoleSelectionChangedHdl( 0 );
+ }
+ updateControlState();
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RoleSelectionChangedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SvLBoxEntry * pEntry = m_aLB_ROLE.FirstSelected();
+ if( pEntry )
+ {
+ OUString aRange( m_aEDT_RANGE.GetText());
+ OUString aSelectedRoleUI = lcl_GetSelectedRole( m_aLB_ROLE, true );
+ OUString aSelectedRange = lcl_GetSelectedRolesRange( m_aLB_ROLE );
+
+ // replace role in fixed text label
+ const OUString aReplacementStr( RTL_CONSTASCII_USTRINGPARAM( "%VALUETYPE" ));
+ sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
+ if( nIndex != -1 )
+ {
+ m_aFT_RANGE.SetText(
+ String( m_aFixedTextRange.replaceAt(
+ nIndex, aReplacementStr.getLength(), aSelectedRoleUI )));
+ }
+
+ m_aEDT_RANGE.SetText( String( aSelectedRange ));
+ isValid();
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, MainRangeButtonClickedHdl, void *, EMPTYARG )
+{
+ OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
+ m_pCurrentRangeChoosingField = & m_aEDT_RANGE;
+ if( m_aEDT_RANGE.GetText().Len() > 0 &&
+ ! updateModelFromControl( m_pCurrentRangeChoosingField ))
+ return 0;
+
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pEntry != 0);
+
+ OUString aSelectedRolesRange = lcl_GetSelectedRolesRange( m_aLB_ROLE );
+
+ if( bHasSelectedEntry && (m_aLB_ROLE.FirstSelected() != 0))
+ {
+ String aStr( SchResId( STR_DATA_SELECT_RANGE_FOR_SERIES ));
+ OUString aUIStr( aStr );
+
+ // replace role
+ OUString aReplacement( RTL_CONSTASCII_USTRINGPARAM( "%VALUETYPE" ));
+ sal_Int32 nIndex = aUIStr.indexOf( aReplacement );
+ if( nIndex != -1 )
+ {
+ aUIStr = aUIStr.replaceAt( nIndex, aReplacement.getLength(),
+ lcl_GetSelectedRole( m_aLB_ROLE, true ));
+ }
+ // replace series name
+ aReplacement = C2U( "%SERIESNAME" );
+ nIndex = aUIStr.indexOf( aReplacement );
+ if( nIndex != -1 )
+ {
+ aUIStr = aUIStr.replaceAt( nIndex, aReplacement.getLength(),
+ OUString( m_apLB_SERIES->GetEntryText( pEntry )));
+ }
+
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_rDialogModel.getRangeSelectionHelper()->chooseRange( aSelectedRolesRange, aUIStr, *this );
+ }
+ else
+ m_pCurrentRangeChoosingField = 0;
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, CategoriesRangeButtonClickedHdl, void *, EMPTYARG )
+{
+ OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
+ m_pCurrentRangeChoosingField = & m_aEDT_CATEGORIES;
+ if( m_aEDT_CATEGORIES.GetText().Len() > 0 &&
+ ! updateModelFromControl( m_pCurrentRangeChoosingField ))
+ return 0;
+
+ String aStr( SchResId( m_aFT_CATEGORIES.IsVisible() ? STR_DATA_SELECT_RANGE_FOR_CATEGORIES : STR_DATA_SELECT_RANGE_FOR_DATALABELS ));
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_rDialogModel.getRangeSelectionHelper()->chooseRange(
+ m_rDialogModel.getCategoriesRange(), OUString( aStr ), *this );
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, AddButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ Reference< XDataSeries > xSeriesToInsertAfter;
+ Reference< XChartType > xChartTypeForNewSeries;
+ if( m_pTemplateProvider )
+ m_rDialogModel.setTemplate( m_pTemplateProvider->getCurrentTemplate());
+
+ if( pEntry )
+ {
+ xSeriesToInsertAfter.set( pEntry->m_xDataSeries );
+ xChartTypeForNewSeries.set( pEntry->m_xChartType );
+ }
+ else
+ {
+ ::std::vector< Reference< XDataSeriesContainer > > aCntVec(
+ m_rDialogModel.getAllDataSeriesContainers());
+ if( ! aCntVec.empty())
+ xChartTypeForNewSeries.set( aCntVec.front(), uno::UNO_QUERY );
+ }
+ OSL_ENSURE( xChartTypeForNewSeries.is(), "Cannot insert new series" );
+
+ m_rDialogModel.insertSeriesAfter( xSeriesToInsertAfter, xChartTypeForNewSeries );
+ setDirty();
+
+ fillSeriesListBox();
+ // note the box was cleared and refilled, so pEntry is invalid now
+ SvLBoxEntry * pSelEntry = m_apLB_SERIES->FirstSelected();
+ if( pSelEntry )
+ {
+ SvLBoxEntry * pNextEntry = m_apLB_SERIES->Next( pSelEntry );
+ if( pNextEntry )
+ m_apLB_SERIES->Select( pNextEntry );
+ }
+ SeriesSelectionChangedHdl( 0 );
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RemoveButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ if( pEntry )
+ {
+ Reference< XDataSeries > xNewSelSeries;
+ SeriesEntry * pNewSelEntry = dynamic_cast< SeriesEntry * >(
+ m_apLB_SERIES->Next( pEntry ));
+ if( pNewSelEntry )
+ xNewSelSeries.set( pNewSelEntry->m_xDataSeries );
+ else
+ {
+ pNewSelEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->Prev( pEntry ));
+ if( pNewSelEntry )
+ xNewSelSeries.set( pNewSelEntry->m_xDataSeries );
+ }
+
+ m_rDialogModel.deleteSeries( pEntry->m_xDataSeries, pEntry->m_xChartType );
+ setDirty();
+
+ m_apLB_SERIES->RemoveSelection();
+ fillSeriesListBox();
+
+ // select previous or next series
+ //@improve: see methods GetModel()->GetAbsPos()/GetEntry() for absoulte list positions
+ if( xNewSelSeries.is())
+ {
+ pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->First());
+ while( pEntry )
+ {
+ if( pEntry->m_xDataSeries == xNewSelSeries )
+ {
+ m_apLB_SERIES->Select( pEntry );
+ break;
+ }
+ pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->Next( pEntry ));
+ }
+ }
+ SeriesSelectionChangedHdl( 0 );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, UpButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pEntry != 0);
+
+ if( bHasSelectedEntry )
+ {
+ m_rDialogModel.moveSeries( pEntry->m_xDataSeries, DialogModel::MOVE_UP );
+ setDirty();
+ fillSeriesListBox();
+ SeriesSelectionChangedHdl(0);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, DownButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pEntry != 0);
+
+ if( bHasSelectedEntry )
+ {
+ m_rDialogModel.moveSeries( pEntry->m_xDataSeries, DialogModel::MOVE_DOWN );
+ setDirty();
+ fillSeriesListBox();
+ SeriesSelectionChangedHdl(0);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RangeModifiedHdl, Edit*, pEdit )
+{
+ if( isRangeFieldContentValid( *pEdit ))
+ setDirty();
+
+ // enable/disable OK button
+ isValid();
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
+{
+ // note: isValid sets the color of the edit field
+ if( isRangeFieldContentValid( *pEdit ))
+ {
+ setDirty();
+ updateModelFromControl( pEdit );
+ if( pEdit== &m_aEDT_RANGE )
+ {
+ if( ! lcl_UpdateCurrentSeriesName( *m_apLB_SERIES ))
+ fillSeriesListBox();
+ }
+ }
+ // enable/disable OK button
+ isValid();
+
+ return 0;
+}
+
+void DataSourceTabPage::listeningFinished(
+ const ::rtl::OUString & rNewRange )
+{
+ // rNewRange becomes invalid after removing the listener
+ OUString aRange( rNewRange );
+
+ m_rDialogModel.startControllerLockTimer();
+
+ // stop listening
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening();
+
+ // change edit field
+ ToTop();
+ GrabFocus();
+ if( m_pCurrentRangeChoosingField )
+ {
+ m_pCurrentRangeChoosingField->SetText( String( aRange ));
+ m_pCurrentRangeChoosingField->GrabFocus();
+ }
+
+ if( m_pCurrentRangeChoosingField == & m_aEDT_RANGE )
+ {
+ m_aEDT_RANGE.SetText( String( aRange ));
+ setDirty();
+ }
+ else if( m_pCurrentRangeChoosingField == & m_aEDT_CATEGORIES )
+ {
+ m_aEDT_CATEGORIES.SetText( String( aRange ));
+ setDirty();
+ }
+
+ updateModelFromControl( m_pCurrentRangeChoosingField );
+ if( ! lcl_UpdateCurrentSeriesName( *m_apLB_SERIES ))
+ fillSeriesListBox();
+
+ m_pCurrentRangeChoosingField = 0;
+
+ updateControlState();
+ lcl_enableRangeChoosing( false, m_pParentDialog );
+}
+
+void DataSourceTabPage::disposingRangeSelection()
+{
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening( false );
+}
+
+bool DataSourceTabPage::updateModelFromControl( Edit * pField )
+{
+ if( !m_bIsDirty )
+ return true;
+
+ ControllerLockGuard aLockedControllers( m_rDialogModel.getChartModel() );
+
+ // @todo: validity check of field content
+ bool bResult = true;
+ bool bAll = (pField == 0);
+ Reference< data::XDataProvider > xDataProvider( m_rDialogModel.getDataProvider());
+
+ if( bAll || (pField == & m_aEDT_CATEGORIES) )
+ {
+ Reference< data::XLabeledDataSequence > xLabeledSeq( m_rDialogModel.getCategories() );
+ if( xDataProvider.is())
+ {
+ OUString aRange( m_aEDT_CATEGORIES.GetText());
+ if( aRange.getLength())
+ {
+ // create or change categories
+ if( !xLabeledSeq.is())
+ {
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ m_rDialogModel.setCategories( xLabeledSeq );
+ }
+ try
+ {
+ xLabeledSeq->setValues( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ // should work as validation should have happened before
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else if( xLabeledSeq.is())
+ {
+ // clear existing categories
+ xLabeledSeq.set(0);
+ m_rDialogModel.setCategories( xLabeledSeq );
+ }
+ }
+ }
+
+ SeriesEntry * pSeriesEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pSeriesEntry != 0);
+
+ if( bHasSelectedEntry )
+ {
+ if( bAll || (pField == & m_aEDT_RANGE) )
+ {
+ try
+ {
+ OUString aSelectedRole = lcl_GetSelectedRole( m_aLB_ROLE );
+ OUString aRange( m_aEDT_RANGE.GetText());
+ OUString aSequenceRole( aSelectedRole );
+ bool bIsLabel = aSequenceRole.equals( lcl_aLabelRole );
+ OUString aSequenceNameForLabel( lcl_GetSequenceNameForLabel( pSeriesEntry ));
+
+ if( bIsLabel )
+ aSequenceRole = aSequenceNameForLabel;
+
+ Reference< data::XDataSource > xSource( pSeriesEntry->m_xDataSeries, uno::UNO_QUERY_THROW );
+ Reference< data::XLabeledDataSequence > xLabeledSeq(
+ DataSeriesHelper::getDataSequenceByRole( xSource, aSequenceRole ));
+
+ if( xDataProvider.is())
+ {
+ if( bIsLabel )
+ {
+ if( ! xLabeledSeq.is())
+ {
+ // check if there is already an "orphan" label sequence
+ xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
+ if( ! xLabeledSeq.is())
+ {
+ // no corresponding labeled data sequence for label found
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
+ }
+ }
+ if( xLabeledSeq.is())
+ {
+ if( aRange.getLength())
+ {
+ Reference< data::XDataSequence > xNewSeq;
+ try
+ {
+ xNewSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ // should work as validation should have happened before
+ ASSERT_EXCEPTION( ex );
+ }
+ if( xNewSeq.is())
+ {
+ // update range name by the full string provided
+ // by the data provider. E.g. "a1" might become
+ // "$Sheet1.$A$1"
+ aRange = xNewSeq->getSourceRangeRepresentation();
+ Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
+ xProp->setPropertyValue( C2U("Role"), uno::makeAny( lcl_aLabelRole ));
+ xLabeledSeq->setLabel( xNewSeq );
+ }
+ }
+ else
+ {
+ xLabeledSeq->setLabel( Reference< data::XDataSequence >());
+ }
+ }
+ }
+ else
+ {
+ if( aRange.getLength())
+ {
+ Reference< data::XDataSequence > xNewSeq;
+ try
+ {
+ xNewSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ // should work as validation should have happened before
+ ASSERT_EXCEPTION( ex );
+ }
+ if( xNewSeq.is())
+ {
+ // update range name by the full string provided
+ // by the data provider. E.g. "a1:e1" might become
+ // "$Sheet1.$A$1:$E$1"
+ aRange = xNewSeq->getSourceRangeRepresentation();
+
+ Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
+ xProp->setPropertyValue( C2U("Role"), uno::makeAny( aSelectedRole ));
+ if( !xLabeledSeq.is())
+ {
+ if( aSelectedRole.equals( aSequenceNameForLabel ))
+ xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
+ if( ! xLabeledSeq.is())
+ {
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
+ }
+ }
+ xLabeledSeq->setValues( xNewSeq );
+ }
+ }
+ else if( xLabeledSeq.is())
+ {
+ // values cannot be deleted. This would also delete the Role (for labels)
+// xLabeledSeq->setValues( Reference< data::XDataSequence >());
+ }
+ }
+ }
+
+ lcl_UpdateCurrentRange( m_aLB_ROLE, aSelectedRole, aRange );
+ }
+ catch( uno::Exception & ex )
+ {
+ bResult = false;
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ // update View
+ // @todo remove this when automatic view updates from calc, writer and own data sequences are available
+ if( bResult )
+ {
+ try
+ {
+ Reference< util::XModifiable > xModifiable( m_rDialogModel.getChartModel(), uno::UNO_QUERY );
+ if( xModifiable.is() )
+ xModifiable->setModified( sal_True );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hrc b/chart2/source/controller/dialogs/tp_DataSource.hrc
new file mode 100644
index 000000000000..53509379b1c5
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataSource.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FT_CAPTION_FOR_WIZARD 1
+
+#define FT_SERIES 10
+#define LB_SERIES 20
+#define BTN_ADD 30
+#define BTN_REMOVE 40
+
+#define FT_ROLE 50
+#define LB_ROLE 60
+
+#define FT_RANGE 70
+#define EDT_RANGE 80
+#define IMB_RANGE_MAIN 90
+
+#define FT_CATEGORIES 110
+#define FT_DATALABELS 111
+#define EDT_CATEGORIES 120
+#define IMB_RANGE_CAT 130
+
+#define BTN_UP 140
+#define BTN_DOWN 150
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
new file mode 100644
index 000000000000..6c42f1cb98e2
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataSource.hxx,v $
+ * $Revision: 1.4.44.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DATASOURCETABPAGE_HXX
+#define CHART2_DATASOURCETABPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+
+#include "DialogModel.hxx"
+#include "TabPageNotifiable.hxx"
+
+// header for class Edit
+#include <vcl/edit.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+// header for class PushButton, OKButton, CancelButton, HelpButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class FixedText, FixedLine
+#include <vcl/fixed.hxx>
+// header for class SvTabListBox
+#include <svtools/svtabbx.hxx>
+// header for class SvTreeListBox
+#include <svtools/svtreebx.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/sheet/XRangeSelection.hpp>
+
+#include <utility>
+#include <vector>
+#include <memory>
+
+#include "RangeSelectionListener.hxx"
+#include "RangeSelectionButton.hxx"
+#include "RangeEdit.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 {
+ class XChartType;
+}}}}
+
+namespace chart
+{
+
+class ChartTypeTemplateProvider;
+class DialogModel;
+
+class DataSourceTabPage :
+ public ::svt::OWizardPage,
+ public RangeSelectionListenerParent
+{
+public:
+ explicit DataSourceTabPage(
+ Window * pParent,
+ DialogModel & rDialogModel,
+ ChartTypeTemplateProvider* pTemplateProvider,
+ Dialog * pParentDialog,
+ bool bHideDescription = false );
+ virtual ~DataSourceTabPage();
+
+ void commitPage();
+
+protected:
+ // OWizardPage
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
+
+ virtual void initializePage();
+
+ DECL_LINK( SeriesSelectionChangedHdl, void* );
+ DECL_LINK( RoleSelectionChangedHdl, void* );
+ DECL_LINK( MainRangeButtonClickedHdl, void* );
+ DECL_LINK( CategoriesRangeButtonClickedHdl, void* );
+ DECL_LINK( AddButtonClickedHdl, void* );
+ DECL_LINK( RemoveButtonClickedHdl, void* );
+ DECL_LINK( RangeModifiedHdl, Edit* );
+ DECL_LINK( RangeUpdateDataHdl, Edit* );
+ DECL_LINK( UpButtonClickedHdl, void* );
+ DECL_LINK( DownButtonClickedHdl, void* );
+
+ // ____ RangeSelectionListenerParent ____
+ virtual void listeningFinished( const ::rtl::OUString & rNewRange );
+ virtual void disposingRangeSelection();
+
+ void updateControlState();
+
+protected:
+ /** updates the internal data according to the content of the given edit
+ field. If pField is 0, all relevant fields are used
+
+ @return
+ <TRUE/> if the text from the field is a valid format to the internal
+ data was valid
+ */
+ bool updateModelFromControl( Edit * pField = 0 );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener >
+ getSelectionRangeListener();
+
+ /** @return </TRUE>, if the edit field contains a valid range entry. if no
+ XCellRangesAccess can be obtained, </TRUE> is returned.
+ */
+ bool isRangeFieldContentValid( Edit & rEdit );
+
+ /** @return </TRUE>, if the tab-page is in a consistent (commitable) state
+ */
+ bool isValid();
+ void setDirty();
+
+ void updateControlsFromDialogModel();
+
+ void fillSeriesListBox();
+ void fillRoleListBox();
+
+private:
+ FixedText m_aFT_CAPTION;
+ FixedText m_aFT_SERIES;
+ ::std::auto_ptr< SvTreeListBox > m_apLB_SERIES;
+ PushButton m_aBTN_ADD;
+ PushButton m_aBTN_REMOVE;
+ PushButton m_aBTN_UP;
+ PushButton m_aBTN_DOWN;
+
+ FixedText m_aFT_ROLE;
+ SvTabListBox m_aLB_ROLE;
+ FixedText m_aFT_RANGE;
+ RangeEdit m_aEDT_RANGE;
+ RangeSelectionButton m_aIMB_RANGE_MAIN;
+
+ FixedText m_aFT_CATEGORIES;
+ FixedText m_aFT_DATALABELS;//used for xy charts
+ RangeEdit m_aEDT_CATEGORIES;
+ RangeSelectionButton m_aIMB_RANGE_CAT;
+
+ ::rtl::OUString m_aFixedTextRange;
+
+ ChartTypeTemplateProvider * m_pTemplateProvider;
+ DialogModel & m_rDialogModel;
+ Edit * m_pCurrentRangeChoosingField;
+ bool m_bIsDirty;
+ sal_Int32 m_nLastChartTypeGroupIndex;
+
+ Dialog * m_pParentDialog;
+ TabPageNotifiable * m_pTabPageNotifiable;
+};
+
+} // namespace chart
+
+// CHART2_DATASOURCETABPAGE_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/tp_DataSource.src b/chart2/source/controller/dialogs/tp_DataSource.src
new file mode 100644
index 000000000000..4d404b37f8b2
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.src
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataSource.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "tp_DataSource.hrc"
+#include "HelpIds.hrc"
+
+TabPage TP_DATA_SOURCE
+{
+ Hide = TRUE;
+ Size = MAP_APPFONT ( 248, 140 );
+ SVLook = TRUE ;
+
+ // ----------------------------------------
+
+ FixedText FT_CAPTION_FOR_WIZARD
+ {
+ Pos = MAP_APPFONT ( 5 , 8 ) ;
+ Size = MAP_APPFONT ( 238 , 10 ) ;
+ Text [ en-US ] = "Customize data ranges for individual data series" ;
+ };
+
+ FixedText FT_SERIES
+ {
+ Pos = MAP_APPFONT ( 6 , 22 );
+ Size = MAP_APPFONT ( 72 , 8 );
+
+ Text [ en-US ] = "Data ~series";
+ };
+ Control LB_SERIES
+ {
+ HelpID = HID_SCH_SERIES_LIST ;
+ Border = TRUE;
+ TabStop = TRUE;
+ // DropDown = FALSE;
+ Pos = MAP_APPFONT ( 6 , 32 );
+ Size = MAP_APPFONT ( 72 , 69 );
+ };
+
+ FixedText FT_ROLE
+ {
+ Pos = MAP_APPFONT ( 82 , 22 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "~Data ranges";
+ };
+ Control LB_ROLE
+ {
+ HelpID = HID_SCH_DATA_RANGES_LIST ;
+ Border = TRUE;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 82 , 32 );
+ Size = MAP_APPFONT ( 160 , 43 );
+ };
+
+ // ----------------------------------------
+
+ FixedText FT_RANGE
+ {
+ Pos = MAP_APPFONT ( 82 , 79 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "Ran~ge for %VALUETYPE";
+ };
+ Edit EDT_RANGE
+ {
+ Border = TRUE;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 82 , 89 );
+ Size = MAP_APPFONT ( 144 , 12 );
+ };
+ ImageButton IMB_RANGE_MAIN
+ {
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 228 , 88 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+
+ // ----------------------------------------
+
+ FixedText FT_CATEGORIES
+ {
+ Pos = MAP_APPFONT ( 82 , 107 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "~Categories";
+ };
+
+ FixedText FT_DATALABELS
+ {
+ Pos = MAP_APPFONT ( 82 , 107 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "Data ~labels" ;
+ };
+
+ Edit EDT_CATEGORIES
+ {
+ Border = TRUE;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 82 , 117 );
+ Size = MAP_APPFONT ( 144 , 12 );
+ };
+ ImageButton IMB_RANGE_CAT
+ {
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 228 , 116 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+
+ // ----------------------------------------
+
+ PushButton BTN_ADD
+ {
+ TabStop = TRUE;
+ Disable = FALSE;
+ Pos = MAP_APPFONT ( 6 , 105 );
+ Size = MAP_APPFONT ( 54 , 14 );
+
+ Text [ en-US ] = "~Add";
+ };
+ PushButton BTN_REMOVE
+ {
+ TabStop = TRUE;
+ Disable = TRUE;
+ Pos = MAP_APPFONT ( 6 , 121 );
+ Size = MAP_APPFONT ( 54 , 14 );
+
+ Text [ en-US ] = "~Remove";
+ };
+
+ // Note: Text is only a black triangle symbol
+ PushButton BTN_UP
+ {
+ TabStop = TRUE;
+ Disable = TRUE;
+ Pos = MAP_APPFONT ( 64 , 105 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+
+ // Note: Text is only a black triangle symbol
+ PushButton BTN_DOWN
+ {
+ TabStop = TRUE;
+ Disable = TRUE;
+ Pos = MAP_APPFONT ( 64 , 121 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_DataSourceControls.cxx b/chart2/source/controller/dialogs/tp_DataSourceControls.cxx
new file mode 100644
index 000000000000..be123acacd33
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSourceControls.cxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataSourceControls.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_DataSourceControls.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+SeriesEntry::~SeriesEntry()
+{}
+
+SeriesListBox::SeriesListBox( Window* pParent, const ResId & rResId ) :
+ SvTreeListBox( pParent, rResId )
+{}
+
+SeriesListBox::~SeriesListBox()
+{}
+
+SvLBoxEntry* SeriesListBox::CreateEntry() const
+{
+ return new SeriesEntry();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/tp_DataSourceControls.hxx b/chart2/source/controller/dialogs/tp_DataSourceControls.hxx
new file mode 100644
index 000000000000..6e9aaac27b67
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSourceControls.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_DataSourceControls.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_TP_DATASOURCECONTROLS_HXX
+#define CHART2_TP_DATASOURCECONTROLS_HXX
+
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+
+// header for class SvTabListBox
+#include <svtools/svtabbx.hxx>
+// header for class SvTreeListBox
+#include <svtools/svtreebx.hxx>
+
+namespace chart
+{
+
+class SeriesEntry : public ::SvLBoxEntry
+{
+public:
+ virtual ~SeriesEntry();
+
+ /// the corresponding data series
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >
+ m_xDataSeries;
+
+ /// the chart type that contains the series (via XDataSeriesContainer)
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >
+ m_xChartType;
+};
+
+class SeriesListBox : public ::SvTreeListBox
+{
+public:
+ explicit SeriesListBox( Window* pParent, const ResId & rResId );
+ ~SeriesListBox( );
+
+ virtual SvLBoxEntry* CreateEntry() const;
+};
+
+} // namespace chart
+
+// CHART2_TP_DATASOURCECONTROLS_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
new file mode 100644
index 000000000000..4153259e8a9f
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_ErrorBars.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_ErrorBars.hxx"
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "TabPageNotifiable.hxx"
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ErrorBarsTabPage::ErrorBarsTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, SchResId( TP_YERRORBAR ), rInAttrs ),
+ m_aErrorBarResources(
+ this,
+ // the parent is the tab control, of which the parent is the dialog
+ dynamic_cast< Dialog * >( pParent->GetParent() ),
+ rInAttrs, /* bNoneAvailable = */ false )
+{
+ FreeResource();
+}
+
+ErrorBarsTabPage::~ErrorBarsTabPage()
+{
+}
+
+SfxTabPage* ErrorBarsTabPage::Create(
+ Window* pParent, const SfxItemSet& rOutAttrs )
+{
+ return new ErrorBarsTabPage( pParent, rOutAttrs );
+}
+
+BOOL ErrorBarsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ return m_aErrorBarResources.FillItemSet( rOutAttrs );
+}
+
+void ErrorBarsTabPage::Reset( const SfxItemSet& rInAttrs )
+{
+ m_aErrorBarResources.Reset( rInAttrs );
+}
+
+void ErrorBarsTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_aErrorBarResources.FillValueSets();
+}
+
+void ErrorBarsTabPage::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ m_aErrorBarResources.SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
+}
+
+void ErrorBarsTabPage::SetErrorBarType( ErrorBarResources::tErrorBarType eNewType )
+{
+ m_aErrorBarResources.SetErrorBarType( eNewType );
+}
+
+void ErrorBarsTabPage::SetChartDocumentForRangeChoosing(
+ const uno::Reference< chart2::XChartDocument > & xChartDocument )
+{
+ m_aErrorBarResources.SetChartDocumentForRangeChoosing( xChartDocument );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.hxx b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
new file mode 100644
index 000000000000..29f6b2cc10c4
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_ErrorBars.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_ERRORBARS_HXX
+#define _CHART2_TP_ERRORBARS_HXX
+
+#include "res_ErrorBar.hxx"
+
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ErrorBarsTabPage : public SfxTabPage
+{
+public:
+ ErrorBarsTabPage ( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~ErrorBarsTabPage ();
+
+ void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
+ void SetErrorBarType( ErrorBarResources::tErrorBarType eNewType );
+ void SetChartDocumentForRangeChoosing(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ ErrorBarResources m_aErrorBarResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.src b/chart2/source/controller/dialogs/tp_ErrorBars.src
new file mode 100644
index 000000000000..6c3c250957ae
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.src
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_ErrorBars.src,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_ErrorBar.hrc"
+
+TabPage TP_YERRORBAR
+{
+ Hide = TRUE ;
+// HelpID = HID_SCH_STAT ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ RESOURCE_ERRORBARS( 260 - 12, 0 )
+};
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
new file mode 100644
index 000000000000..c2c0ad7e28c4
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_LegendPosition.cxx,v $
+ * $Revision: 1.8.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_LegendPosition.hxx"
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "res_LegendPosition.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include <svx/chrtitem.hxx>
+#include <svx/eeitem.hxx>
+#include <svx/frmdiritem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchLegendPosTabPage::SchLegendPosTabPage(Window* pWindow,
+ const SfxItemSet& rInAttrs)
+ : SfxTabPage( pWindow, SchResId(TP_LEGEND_POS), rInAttrs )
+ , aGrpLegend( this, SchResId(GRP_LEGEND) )
+ , m_apLegendPositionResources( new LegendPositionResources(this) )
+ , m_aFlTextOrient( this, SchResId( FL_LEGEND_TEXTORIENT ) )
+ , m_aFtTextDirection( this, SchResId( FT_LEGEND_TEXTDIR ) )
+ , m_aLbTextDirection( this, SchResId( LB_LEGEND_TEXTDIR ), &m_aFlTextOrient, &m_aFtTextDirection )
+{
+ FreeResource();
+}
+
+SchLegendPosTabPage::~SchLegendPosTabPage()
+{
+}
+
+SfxTabPage* SchLegendPosTabPage::Create(Window* pWindow,
+ const SfxItemSet& rOutAttrs)
+{
+ return new SchLegendPosTabPage(pWindow, rOutAttrs);
+}
+
+BOOL SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apLegendPositionResources->writeToItemSet(rOutAttrs);
+
+ if( m_aLbTextDirection.GetSelectEntryCount() > 0 )
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) );
+
+ return TRUE;
+}
+
+void SchLegendPosTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ m_apLegendPositionResources->initFromItemSet(rInAttrs);
+
+ const SfxPoolItem* pPoolItem = 0;
+ if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
new file mode 100644
index 000000000000..b4dcbea9f168
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_LegendPosition.hxx,v $
+ * $Revision: 1.5.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_LEGENDPOSITION_HXX
+#define _CHART2_TP_LEGENDPOSITION_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+// header for FixedText
+#include <vcl/fixed.hxx>
+//for auto_ptr
+#include <memory>
+#include "TextDirectionListBox.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LegendPositionResources;
+class SchLegendPosTabPage : public SfxTabPage
+{
+private:
+ FixedLine aGrpLegend;
+
+ ::std::auto_ptr< LegendPositionResources > m_apLegendPositionResources;
+
+ FixedLine m_aFlTextOrient;
+ FixedText m_aFtTextDirection;
+ TextDirectionListBox m_aLbTextDirection;
+
+public:
+ SchLegendPosTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SchLegendPosTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.src b/chart2/source/controller/dialogs/tp_LegendPosition.src
new file mode 100644
index 000000000000..ac1323bc5ebc
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.src
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_LegendPosition.src,v $
+ * $Revision: 1.6.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_LegendPosition.hrc"
+
+TabPage TP_LEGEND_POS
+{
+ Hide = TRUE ;
+ HelpID = HID_SCH_LEGEND_POS ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine GRP_LEGEND
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ RESOURCE_LEGENDPOSITION( 12, 14 )
+
+ FixedLine FL_LEGEND_TEXTORIENT
+ {
+ Pos = MAP_APPFONT ( 6 , 14 + RESOURCE_LEGENDPOSITION_HEIGHT + 6 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text orientation" ;
+ };
+ FixedText FT_LEGEND_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 14 + RESOURCE_LEGENDPOSITION_HEIGHT + 19 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Te~xt direction" ;
+ };
+ ListBox LB_LEGEND_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 78 , 14 + RESOURCE_LEGENDPOSITION_HEIGHT + 17 ) ;
+ Size = MAP_APPFONT ( 170 , 100 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_Location.cxx b/chart2/source/controller/dialogs/tp_Location.cxx
new file mode 100644
index 000000000000..cce4cd520b12
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Location.cxx,v $
+ * $Revision: 1.4.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_Location.hxx"
+#include "tp_Location.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "NoWarningThisInCTOR.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+#ifdef LOCATION_PAGE
+
+LocationTabPage::LocationTabPage( svt::OWizardMachine* pParent
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+ : OWizardPage( pParent, SchResId(TP_LOCATION) )
+ , m_aFL_Table( this, SchResId( FL_TABLE ) )
+ , m_aFT_Table( this, SchResId( FT_TABLE ) )
+ , m_aLB_Table( this, SchResId( LB_TABLE ) )
+ , m_xChartModel( xChartModel )
+ , m_xCC( xContext )
+{
+ FreeResource();
+ this->SetText( String( SchResId( STR_PAGE_CHART_LOCATION ) ) );
+}
+
+LocationTabPage::~LocationTabPage()
+{
+}
+
+bool LocationTabPage::canAdvance() const
+{
+ return false;
+}
+#endif
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Location.hrc b/chart2/source/controller/dialogs/tp_Location.hrc
new file mode 100644
index 000000000000..995bcc6f9db7
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Location.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FL_TABLE 1
+#define FT_TABLE 1
+#define LB_TABLE 1
diff --git a/chart2/source/controller/dialogs/tp_Location.hxx b/chart2/source/controller/dialogs/tp_Location.hxx
new file mode 100644
index 000000000000..8b472d2a6c92
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Location.hxx,v $
+ * $Revision: 1.4.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_LOCATION_HXX
+#define _CHART2_TP_LOCATION_HXX
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <svtools/wizardmachine.hxx>
+
+// header for class FixedText, FixedLine
+#include <vcl/fixed.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+#ifdef LOCATION_PAGE
+class LocationTabPage : public svt::OWizardPage
+{
+public:
+ LocationTabPage( svt::OWizardMachine* pParent
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~LocationTabPage();
+
+ virtual bool canAdvance() const;
+
+protected:
+ FixedLine m_aFL_Table;
+ FixedText m_aFT_Table;
+ ListBox m_aLB_Table;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+};
+#endif
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_Location.src b/chart2/source/controller/dialogs/tp_Location.src
new file mode 100644
index 000000000000..586040b11f6e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.src
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Location.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_Location.hrc"
+#include "dlg_CreationWizard.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+#define WIZ_POSX1 6
+#define WIZ_POSY1 6
+#define WIZ_POSX2 (6+4)
+#define WIZ_POSY2 (WIZ_POSY1+RSC_CD_FIXEDTEXT_HEIGHT+4)
+#define TEXT_WIDTH 50
+#define WIZ_POSX3 (WIZ_POSX2+TEXT_WIDTH+6)
+#define WIZ_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-WIZ_POSX1-6)
+#define WIZ_LISTBOX_WIDTH (CHART_WIZARD_PAGEWIDTH-WIZ_POSX2-TEXT_WIDTH-6-6)
+
+
+TabPage TP_LOCATION
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ;
+
+ FixedLine FL_TABLE
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX1 , WIZ_POSY1 ) ;
+ Size = MAP_APPFONT ( WIZ_FIXEDLINE_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+
+ Text [ en-US ] = "Place chart" ;
+ };
+ FixedText FT_TABLE
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX2 , WIZ_POSY2 ) ;
+ Size = MAP_APPFONT ( TEXT_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+
+ Text [ en-US ] = "~Insert in sheet" ;
+ };
+ ListBox LB_TABLE
+ {
+ Border = TRUE ;
+ DropDown = TRUE ;
+ Pos = MAP_APPFONT ( WIZ_POSX3 , WIZ_POSY2 ) ;
+ Size = MAP_APPFONT ( WIZ_LISTBOX_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
new file mode 100644
index 000000000000..d5dcad1eb02d
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_PointGeometry.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_PointGeometry.hxx"
+#include "TabPages.hrc"
+#include "res_BarGeometry.hxx"
+#include "ResId.hxx"
+
+#include "chartview/ChartSfxItemIds.hxx"
+
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+// header for class Svx3DHorizontalSegmentsItem
+#include <svx/svx3ditems.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchLayoutTabPage::SchLayoutTabPage(Window* pWindow,const SfxItemSet& rInAttrs)
+ : SfxTabPage(pWindow, SchResId(TP_LAYOUT), rInAttrs)
+ , m_pGeometryResources(0)
+{
+ Size aPageSize( this->GetSizePixel() );
+ Point aPos( this->LogicToPixel( Point(6,6), MapMode(MAP_APPFONT) ) );
+ m_pGeometryResources = new BarGeometryResources( this );
+ m_pGeometryResources->SetPosPixel( aPos );
+}
+
+SchLayoutTabPage::~SchLayoutTabPage()
+{
+ if( m_pGeometryResources )
+ delete m_pGeometryResources;
+}
+
+SfxTabPage* SchLayoutTabPage::Create(Window* pWindow,
+ const SfxItemSet& rOutAttrs)
+{
+ return new SchLayoutTabPage(pWindow, rOutAttrs);
+}
+
+BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+
+ if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount())
+ {
+ long nShape=CHART_SHAPE3D_SQUARE;
+ long nSegs=32;
+
+ nShape = m_pGeometryResources->GetSelectEntryPos();
+ if(nShape==CHART_SHAPE3D_PYRAMID)
+ nSegs=4;
+
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape));
+ rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs));
+ }
+ return TRUE;
+}
+
+void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(m_pGeometryResources)
+ {
+ m_pGeometryResources->SelectEntryPos(static_cast<USHORT>(nVal));
+ m_pGeometryResources->Show( true );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.hxx b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
new file mode 100644
index 000000000000..2cb30427ba44
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_PointGeometry.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_POINTGEOMETRY_HXX
+#define _CHART2_TP_POINTGEOMETRY_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class BarGeometryResources;
+class SchLayoutTabPage : public SfxTabPage
+{
+public:
+ SchLayoutTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SchLayoutTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+
+private:
+ BarGeometryResources* m_pGeometryResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.src b/chart2/source/controller/dialogs/tp_PointGeometry.src
new file mode 100644
index 000000000000..ae08189b1f7d
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.src
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_PointGeometry.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include "TabPages.hrc"
+
+TabPage TP_LAYOUT
+{
+ Hide = TRUE ;
+// HelpID = HID_LAYOUT ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+};
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
new file mode 100644
index 000000000000..1681962eb5fe
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_PolarOptions.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_chart2.hxx"
+#include "tp_PolarOptions.hxx"
+#include "tp_PolarOptions.hrc"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svtools/controldims.hrc>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pWindow, SchResId(TP_POLAROPTIONS), rInAttrs ),
+ m_aCB_Clockwise( this, SchResId( CB_CLOCKWISE ) ),
+ m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ),
+ m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ),
+ m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ),
+ m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ),
+ m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ),
+ m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) )
+{
+ FreeResource();
+
+ m_aAngleDial.SetLinkedField( &m_aNF_StartingAngle );
+}
+
+PolarOptionsTabPage::~PolarOptionsTabPage()
+{
+}
+
+SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutAttrs )
+{
+ return new PolarOptionsTabPage( pWindow, rOutAttrs );
+}
+
+BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ if( m_aAngleDial.IsVisible() )
+ {
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
+ static_cast< sal_Int32 >(m_aAngleDial.GetRotation()/100)));
+ }
+
+ if( m_aCB_Clockwise.IsVisible() )
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked()));
+
+ if (m_aCB_IncludeHiddenCells.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
+
+ return TRUE;
+}
+
+void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ long nTmp;
+ if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
+
+ m_aAngleDial.SetRotation( nTmp*100 );
+ }
+ else
+ {
+ m_aFL_StartingAngle.Show(FALSE);
+ m_aAngleDial.Show(FALSE);
+ m_aNF_StartingAngle.Show(FALSE);
+ m_aFT_Degrees.Show(FALSE);
+ }
+ if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ m_aCB_Clockwise.Check(bCheck);
+ }
+ else
+ {
+ m_aCB_Clockwise.Show(FALSE);
+ }
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ m_aCB_IncludeHiddenCells.Check(bVal);
+ }
+ else
+ {
+ m_aCB_IncludeHiddenCells.Show(FALSE);
+ m_aFL_PlotOptions.Show(FALSE);
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hrc b/chart2/source/controller/dialogs/tp_PolarOptions.hrc
new file mode 100644
index 000000000000..680c9d126211
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_PolarOptions.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define CB_CLOCKWISE 1
+#define CB_INCLUDE_HIDDEN_CELLS_POLAR 2
+
+#define FL_STARTING_ANGLE 1
+#define FL_PLOT_OPTIONS_POLAR 2
+
+#define CT_ANGLE_DIAL 1
+
+#define NF_STARTING_ANGLE 1
+
+#define FT_ROTATION_DEGREES 1
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
new file mode 100644
index 000000000000..02a5ec5ba25b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_PolarOptions.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_POLAROPTIONS_HXX
+#define _CHART2_TP_POLAROPTIONS_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <svx/dialcontrol.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class PolarOptionsTabPage : public SfxTabPage
+{
+
+public:
+ PolarOptionsTabPage(Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~PolarOptionsTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+
+private:
+ CheckBox m_aCB_Clockwise;
+ FixedLine m_aFL_StartingAngle;
+ svx::DialControl m_aAngleDial;
+ FixedText m_aFT_Degrees;
+ NumericField m_aNF_StartingAngle;
+
+ FixedLine m_aFL_PlotOptions;
+ CheckBox m_aCB_IncludeHiddenCells;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.src b/chart2/source/controller/dialogs/tp_PolarOptions.src
new file mode 100644
index 000000000000..273c5f59dd5d
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.src
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_PolarOptions.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_PolarOptions.hrc"
+#include "HelpIds.hrc"
+
+TabPage TP_POLAROPTIONS
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ CheckBox CB_CLOCKWISE
+ {
+ Pos = MAP_APPFONT ( 12 , 8 );
+ Size = MAP_APPFONT ( 248 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Clockwise direction";
+ };
+ FixedLine FL_STARTING_ANGLE
+ {
+ Pos = MAP_APPFONT ( 6 , 21 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
+ Text [ en-US ] = "Starting angle" ;
+ };
+ Control CT_ANGLE_DIAL
+ {
+ HelpId = HID_SCH_STARTING_ANGLE_DIAL ;
+ Pos = MAP_APPFONT ( 12 , 38 ) ;
+ Size = MAP_APPFONT ( 43 , 43 ) ;
+ };
+ FixedText FT_ROTATION_DEGREES
+ {
+ Pos = MAP_APPFONT ( 93 , 55 ) ;
+ Size = MAP_APPFONT ( 166 , 8 ) ;
+ Text [ en-US ] = "~Degrees" ;
+ };
+ NumericField NF_STARTING_ANGLE
+ {
+ Pos = MAP_APPFONT ( 61 , 53 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 359 ;
+ SpinSize = 5 ;
+ };
+ FixedLine FL_PLOT_OPTIONS_POLAR
+ {
+ Pos = MAP_APPFONT ( 6 , 90 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Plot options";
+ };
+ CheckBox CB_INCLUDE_HIDDEN_CELLS_POLAR
+ {
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Include ~values from hidden cells";
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
new file mode 100644
index 000000000000..8ba4d61a8057
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_RangeChooser.cxx,v $
+ * $Revision: 1.5.44.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_RangeChooser.hxx"
+#include "tp_RangeChooser.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "DataSourceHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "DialogModel.hxx"
+#include "RangeSelectionHelper.hxx"
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/XComponentSupplier.hpp>
+
+namespace
+{
+void lcl_ShowChooserButton(
+ ::chart::RangeSelectionButton & rChooserButton,
+ Edit & rEditField,
+ BOOL bShow )
+{
+ if( rChooserButton.IsVisible() != bShow )
+ {
+ rChooserButton.Show( bShow );
+ sal_Int32 nWidhtDiff = 10 + 2;
+ if( bShow )
+ nWidhtDiff = -nWidhtDiff;
+ Size aSize = rChooserButton.PixelToLogic( rEditField.GetSizePixel(), MAP_APPFONT );
+ aSize.setWidth( aSize.getWidth() + nWidhtDiff );
+ rEditField.SetSizePixel( rChooserButton.LogicToPixel( aSize, MAP_APPFONT ));
+ }
+}
+void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
+{
+ if( pDialog )
+ {
+ pDialog->Show( bEnable ? FALSE : TRUE );
+ pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ }
+}
+void lcl_shiftControlY( Control & rControl, long nYOffset )
+{
+ Point aPos( rControl.GetPosPixel());
+ aPos.setY( aPos.getY() + nYOffset );
+ rControl.SetPosPixel( aPos );
+}
+} // anonymous namespace
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+
+RangeChooserTabPage::RangeChooserTabPage( Window* pParent
+ , DialogModel & rDialogModel
+ , ChartTypeTemplateProvider* pTemplateProvider
+ , Dialog * pParentDialog
+ , bool bHideDescription /* = false */ )
+
+ : OWizardPage( pParent, SchResId(TP_RANGECHOOSER) )
+
+ , m_aFT_Caption( this, SchResId( FT_CAPTION_FOR_WIZARD ) )
+ , m_aFT_Range( this, SchResId( FT_RANGE ) )
+ , m_aED_Range( this, SchResId( ED_RANGE ) )
+ , m_aIB_Range( this, SchResId( IB_RANGE ) )
+ , m_aRB_Rows( this, SchResId( RB_DATAROWS ) )
+ , m_aRB_Columns( this, SchResId( RB_DATACOLS ) )
+ , m_aCB_FirstRowAsLabel( this, SchResId( CB_FIRST_ROW_ASLABELS ) )
+ , m_aCB_FirstColumnAsLabel( this, SchResId( CB_FIRST_COLUMN_ASLABELS ) )
+ , m_nChangingControlCalls(0)
+ , m_bIsDirty(false)
+ , m_xDataProvider( 0 )
+ , m_aLastValidRangeString()
+ , m_xCurrentChartTypeTemplate(0)
+ , m_pTemplateProvider(pTemplateProvider)
+ , m_rDialogModel( rDialogModel )
+ , m_pParentDialog( pParentDialog )
+ , m_pTabPageNotifiable( dynamic_cast< TabPageNotifiable * >( pParentDialog ))
+{
+ FreeResource();
+
+ if( bHideDescription )
+ {
+ // note: the offset should be a negative value for shifting upwards, the
+ // 4 is for the offset difference between a wizard page and a tab-page
+ long nYOffset = - ( m_aFT_Range.GetPosPixel().getY() - m_aFT_Caption.GetPosPixel().getY() + 4 );
+ m_aFT_Caption.Hide();
+
+ // shift all controls by the offset space saved by hiding the caption
+ lcl_shiftControlY( m_aFT_Range, nYOffset );
+ lcl_shiftControlY( m_aED_Range, nYOffset );
+ lcl_shiftControlY( m_aIB_Range, nYOffset );
+ lcl_shiftControlY( m_aRB_Rows, nYOffset );
+ lcl_shiftControlY( m_aRB_Columns, nYOffset );
+ lcl_shiftControlY( m_aCB_FirstRowAsLabel, nYOffset );
+ lcl_shiftControlY( m_aCB_FirstColumnAsLabel, nYOffset );
+ }
+ else
+ {
+ // make font of caption bold
+ Font aFont( m_aFT_Caption.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_Caption.SetControlFont( aFont );
+
+ // no mnemonic
+ m_aFT_Caption.SetStyle( m_aFT_Caption.GetStyle() | WB_NOLABEL );
+ }
+
+ this->SetText( String(SchResId(STR_PAGE_DATA_RANGE)) );
+ m_aIB_Range.SetQuickHelpText( String(SchResId(STR_TIP_SELECT_RANGE)) );
+
+ // set defaults as long as DetectArguments does not work
+ m_aRB_Columns.Check();
+ m_aCB_FirstColumnAsLabel.Check();
+ m_aCB_FirstRowAsLabel.Check();
+
+ // BM: Note, that the range selection is not available, if there is no view.
+ // This happens for charts having their own embedded spreadsheet. If you
+ // force to get the range selection here, this would mean when entering this
+ // page the calc view would be created in this case. So, I enable the
+ // button here, and in the worst case nothing happens when it is pressed.
+ // Not nice, but I see no better solution for the moment.
+ m_aIB_Range.SetClickHdl( LINK( this, RangeChooserTabPage, ChooseRangeHdl ));
+ m_aED_Range.SetKeyInputHdl( LINK( this, RangeChooserTabPage, ChooseRangeHdl ));
+
+ // #i75179# enable setting the background to a different color
+ m_aED_Range.SetStyle( m_aED_Range.GetStyle() | WB_FORCECTRLBACKGROUND );
+
+ m_aED_Range.SetUpdateDataHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ));
+ m_aED_Range.SetModifyHdl( LINK( this, RangeChooserTabPage, ControlEditedHdl ));
+ m_aRB_Rows.SetToggleHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
+ m_aCB_FirstRowAsLabel.SetToggleHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
+ m_aCB_FirstColumnAsLabel.SetToggleHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
+}
+
+RangeChooserTabPage::~RangeChooserTabPage()
+{
+}
+
+void RangeChooserTabPage::ActivatePage()
+{
+ OWizardPage::ActivatePage();
+ initControlsFromModel();
+}
+
+void RangeChooserTabPage::initControlsFromModel()
+{
+ m_nChangingControlCalls++;
+
+ if(m_pTemplateProvider)
+ {
+ m_xCurrentChartTypeTemplate = m_pTemplateProvider->getCurrentTemplate();
+ }
+
+ bool bUseColumns = ! m_aRB_Rows.IsChecked();
+ bool bFirstCellAsLabel = bUseColumns ? m_aCB_FirstRowAsLabel.IsChecked() : m_aCB_FirstColumnAsLabel.IsChecked();
+ bool bHasCategories = bUseColumns ? m_aCB_FirstColumnAsLabel.IsChecked() : m_aCB_FirstRowAsLabel.IsChecked();
+
+ bool bIsValid = m_rDialogModel.allArgumentsForRectRangeDetected();
+ if( bIsValid )
+ m_rDialogModel.detectArguments(
+ m_aLastValidRangeString, bUseColumns, bFirstCellAsLabel, bHasCategories );
+ else
+ m_aLastValidRangeString = String::EmptyString();
+
+ m_aED_Range.SetText( m_aLastValidRangeString );
+
+ m_aRB_Rows.Check( !bUseColumns );
+ m_aRB_Columns.Check( bUseColumns );
+
+ m_aCB_FirstRowAsLabel.Check( m_aRB_Rows.IsChecked()?bHasCategories:bFirstCellAsLabel );
+ m_aCB_FirstColumnAsLabel.Check( m_aRB_Columns.IsChecked()?bHasCategories:bFirstCellAsLabel );
+
+ isValid();
+
+ m_nChangingControlCalls--;
+}
+
+void RangeChooserTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void RangeChooserTabPage::commitPage()
+{
+ commitPage(eFinish);
+}
+
+sal_Bool RangeChooserTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ changeDialogModelAccordingToControls();
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
+void RangeChooserTabPage::changeDialogModelAccordingToControls()
+{
+ if(m_nChangingControlCalls>0)
+ return;
+
+ if( !m_xCurrentChartTypeTemplate.is() )
+ {
+ if(m_pTemplateProvider)
+ m_xCurrentChartTypeTemplate.set( m_pTemplateProvider->getCurrentTemplate());
+ if( !m_xCurrentChartTypeTemplate.is())
+ {
+ OSL_ENSURE( false, "Need a template to change data source" );
+ return;
+ }
+ }
+
+ if( m_bIsDirty )
+ {
+ sal_Bool bFirstCellAsLabel = ( m_aCB_FirstColumnAsLabel.IsChecked() && !m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && !m_aRB_Rows.IsChecked() );
+ sal_Bool bHasCategories = ( m_aCB_FirstColumnAsLabel.IsChecked() && m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && m_aRB_Rows.IsChecked() );
+
+ Sequence< beans::PropertyValue > aArguments(
+ DataSourceHelper::createArguments(
+ m_aRB_Columns.IsChecked(), bFirstCellAsLabel, bHasCategories ) );
+
+ // only if range is valid
+ if( m_aLastValidRangeString.equals( m_aED_Range.GetText()))
+ {
+ m_rDialogModel.setTemplate( m_xCurrentChartTypeTemplate );
+ aArguments.realloc( aArguments.getLength() + 1 );
+ aArguments[aArguments.getLength() - 1] =
+ beans::PropertyValue( C2U("CellRangeRepresentation"), -1,
+ uno::makeAny( m_aLastValidRangeString ),
+ beans::PropertyState_DIRECT_VALUE );
+ m_rDialogModel.setData( aArguments );
+ m_bIsDirty = false;
+ }
+
+ //@todo warn user that the selected range is not valid
+ //@todo better: disable OK-Button if range is invalid
+ }
+}
+
+bool RangeChooserTabPage::isValid()
+{
+ ::rtl::OUString aRange( m_aED_Range.GetText());
+ sal_Bool bFirstCellAsLabel = ( m_aCB_FirstColumnAsLabel.IsChecked() && !m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && !m_aRB_Rows.IsChecked() );
+ sal_Bool bHasCategories = ( m_aCB_FirstColumnAsLabel.IsChecked() && m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && m_aRB_Rows.IsChecked() );
+ bool bIsValid = ( aRange.getLength() == 0 ) ||
+ m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), m_aRB_Columns.IsChecked(), bFirstCellAsLabel, bHasCategories ));
+
+ if( bIsValid )
+ {
+ m_aED_Range.SetControlForeground();
+ m_aED_Range.SetControlBackground();
+ if( m_pTabPageNotifiable )
+ m_pTabPageNotifiable->setValidPage( this );
+ m_aLastValidRangeString = aRange;
+ }
+ else
+ {
+ m_aED_Range.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR );
+ m_aED_Range.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR );
+ if( m_pTabPageNotifiable )
+ m_pTabPageNotifiable->setInvalidPage( this );
+ }
+
+ // enable/disable controls
+ // #i79531# if the range is valid but an action of one of these buttons
+ // would render it invalid, the button should be disabled
+ if( bIsValid )
+ {
+ bool bDataInColumns = m_aRB_Columns.IsChecked();
+ bool bIsSwappedRangeValid = m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), ! bDataInColumns, bHasCategories, bFirstCellAsLabel ));
+ m_aRB_Rows.Enable( bIsSwappedRangeValid );
+ m_aRB_Columns.Enable( bIsSwappedRangeValid );
+
+ m_aCB_FirstRowAsLabel.Enable(
+ m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), m_aRB_Columns.IsChecked(),
+ bDataInColumns ? ! bFirstCellAsLabel : bFirstCellAsLabel,
+ bDataInColumns ? bHasCategories : ! bHasCategories )));
+ m_aCB_FirstColumnAsLabel.Enable(
+ m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), m_aRB_Columns.IsChecked(),
+ bDataInColumns ? bFirstCellAsLabel : ! bFirstCellAsLabel,
+ bDataInColumns ? ! bHasCategories : bHasCategories )));
+ }
+ else
+ {
+ m_aRB_Rows.Enable( bIsValid );
+ m_aRB_Columns.Enable( bIsValid );
+ m_aCB_FirstRowAsLabel.Enable( bIsValid );
+ m_aCB_FirstColumnAsLabel.Enable( bIsValid );
+}
+ BOOL bShowIB = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
+ lcl_ShowChooserButton( m_aIB_Range, m_aED_Range, bShowIB );
+
+ return bIsValid;
+}
+
+IMPL_LINK( RangeChooserTabPage, ControlEditedHdl, void*, EMPTYARG )
+{
+ setDirty();
+ isValid();
+ return 0;
+}
+
+IMPL_LINK( RangeChooserTabPage, ControlChangedHdl, void*, EMPTYARG )
+{
+ setDirty();
+ if( isValid())
+ changeDialogModelAccordingToControls();
+ return 0;
+}
+
+IMPL_LINK( RangeChooserTabPage, ChooseRangeHdl, void *, EMPTYARG )
+{
+ rtl::OUString aRange = m_aED_Range.GetText();
+ // using assignment for broken gcc 3.3
+ rtl::OUString aTitle = ::rtl::OUString( String( SchResId( STR_PAGE_DATA_RANGE ) ));
+
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_rDialogModel.getRangeSelectionHelper()->chooseRange( aRange, aTitle, *this );
+
+ return 0;
+}
+
+
+void RangeChooserTabPage::listeningFinished( const ::rtl::OUString & rNewRange )
+{
+ //user has selected a new range
+
+ rtl::OUString aRange( rNewRange );
+
+ m_rDialogModel.startControllerLockTimer();
+
+ // stop listening
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening();
+
+ //update dialog state
+ ToTop();
+ GrabFocus();
+ m_aED_Range.SetText( String( aRange ) );
+ m_aED_Range.GrabFocus();
+
+ setDirty();
+ if( isValid())
+ changeDialogModelAccordingToControls();
+
+ lcl_enableRangeChoosing( false, m_pParentDialog );
+}
+void RangeChooserTabPage::disposingRangeSelection()
+{
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening( false );
+}
+
+void RangeChooserTabPage::setDirty()
+{
+ if( m_nChangingControlCalls == 0 )
+ m_bIsDirty = true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hrc b/chart2/source/controller/dialogs/tp_RangeChooser.hrc
new file mode 100644
index 000000000000..7e39e7041013
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_RangeChooser.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FT_CAPTION_FOR_WIZARD 1
+#define FT_RANGE 2
+
+#define RB_DATAROWS 1
+#define RB_DATACOLS 2
+
+#define ED_RANGE 1
+#define IB_RANGE 1
+
+#define CB_FIRST_ROW_ASLABELS 1
+#define CB_FIRST_COLUMN_ASLABELS 2
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
new file mode 100644
index 000000000000..bb508da8d9a1
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_RangeChooser.hxx,v $
+ * $Revision: 1.5.44.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_RANGECHOOSER_HXX
+#define _CHART2_TP_RANGECHOOSER_HXX
+
+#include "RangeSelectionListener.hxx"
+#include "RangeSelectionButton.hxx"
+#include "TabPageNotifiable.hxx"
+#include "RangeEdit.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <svtools/wizardmachine.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <com/sun/star/sheet/XRangeSelection.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class ChartTypeTemplateProvider;
+class DialogModel;
+
+class RangeChooserTabPage : public svt::OWizardPage, public RangeSelectionListenerParent
+{
+public:
+
+ RangeChooserTabPage( Window* pParent
+ , DialogModel & rDialogModel
+ , ChartTypeTemplateProvider* pTemplateProvider
+ , Dialog * pParentDialog
+ , bool bHideDescription = false );
+virtual ~RangeChooserTabPage();
+
+ //RangeSelectionListenerParent
+ virtual void listeningFinished( const ::rtl::OUString & rNewRange );
+ virtual void disposingRangeSelection();
+
+ void commitPage();
+
+protected: //methods
+
+ //OWizardPage
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
+
+ void initControlsFromModel();
+ void changeDialogModelAccordingToControls();
+ bool isValid();
+ void setDirty();
+
+ DECL_LINK( ChooseRangeHdl, void* );
+ DECL_LINK( ControlChangedHdl, void* );
+ DECL_LINK( ControlEditedHdl, void* );
+
+protected: //member
+
+ FixedText m_aFT_Caption;
+ FixedText m_aFT_Range;
+ RangeEdit m_aED_Range;
+ RangeSelectionButton m_aIB_Range;
+
+ RadioButton m_aRB_Rows;
+ RadioButton m_aRB_Columns;
+
+ CheckBox m_aCB_FirstRowAsLabel;
+ CheckBox m_aCB_FirstColumnAsLabel;
+
+ sal_Int32 m_nChangingControlCalls;
+ bool m_bIsDirty;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
+
+ rtl::OUString m_aLastValidRangeString;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > m_xCurrentChartTypeTemplate;
+ ChartTypeTemplateProvider* m_pTemplateProvider;
+
+ DialogModel & m_rDialogModel;
+ Dialog * m_pParentDialog;
+ TabPageNotifiable * m_pTabPageNotifiable;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.src b/chart2/source/controller/dialogs/tp_RangeChooser.src
new file mode 100644
index 000000000000..7c88184f4559
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.src
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_RangeChooser.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_RangeChooser.hrc"
+#include "SchSlotIds.hxx"
+#include "dlg_CreationWizard.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+
+TabPage TP_RANGECHOOSER
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 248, 140 ) ;
+
+ FixedText FT_CAPTION_FOR_WIZARD
+ {
+ Pos = MAP_APPFONT ( 5 , 8 ) ;
+ Size = MAP_APPFONT ( 238 , 10 ) ;
+ Text [ en-US ] = "Choose a data range" ;
+ };
+ FixedText FT_RANGE
+ {
+ Pos = MAP_APPFONT ( 6 , 22 ) ;
+ Size = MAP_APPFONT ( 236 , 8 ) ;
+ Text [ en-US ] = "~Data range" ;
+ };
+ Edit ED_RANGE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 220 , 12 ) ;
+ };
+ ImageButton IB_RANGE
+ {
+ Pos = MAP_APPFONT ( 228 , 31 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = FALSE ;
+ };
+ RadioButton RB_DATAROWS
+ {
+ Pos = MAP_APPFONT ( 6 , 52 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Data series in ~rows" ;
+ };
+ RadioButton RB_DATACOLS
+ {
+ Pos = MAP_APPFONT ( 6 , 66 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Data series in ~columns" ;
+ };
+ CheckBox CB_FIRST_ROW_ASLABELS
+ {
+ Pos = MAP_APPFONT ( 6 , 84 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~First row as label" ;
+ };
+ CheckBox CB_FIRST_COLUMN_ASLABELS
+ {
+ Pos = MAP_APPFONT ( 6 , 98 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "F~irst column as label" ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
new file mode 100644
index 000000000000..dc2c1f156bcb
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Scale.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_Scale.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "Strings.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "AxisHelper.hxx"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <rtl/math.hxx>
+// header for class SvxDoubleItem
+#include <svx/chrtitem.hxx>
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+
+// header for class WarningBox
+#include <vcl/msgbox.hxx>
+
+// header for class SvNumberformat
+#ifndef _ZFORMAT_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zformat.hxx>
+#endif
+
+#include <svtools/controldims.hrc>
+
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+
+void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos )
+{
+ Point aPos( rEdit.GetPosPixel() );
+ long nShift = nNewXPos - aPos.X();
+ aPos.X() = nNewXPos;
+ rEdit.SetPosPixel(aPos);
+
+ aPos = rAuto.GetPosPixel();
+ aPos.X() += nShift;
+ rAuto.SetPosPixel(aPos);
+}
+
+void lcl_placeControlsAtY( Control& rTop, Control& rBottom, long nNewYPos )
+{
+ Point aPos( rTop.GetPosPixel() );
+ long nShift = nNewYPos - aPos.Y();
+ aPos.Y() = nNewYPos;
+ rTop.SetPosPixel(aPos);
+
+ aPos = rBottom.GetPosPixel();
+ aPos.Y() += nShift;
+ rBottom.SetPosPixel(aPos);
+}
+
+}
+
+ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
+ SfxTabPage(pWindow, SchResId(TP_SCALE), rInAttrs),
+
+ aFlScale(this, SchResId(FL_SCALE)),
+ aTxtMin (this, SchResId (TXT_MIN)),
+ aFmtFldMin(this, SchResId(EDT_MIN)),
+ aCbxAutoMin(this, SchResId(CBX_AUTO_MIN)),
+ aTxtMax(this, SchResId (TXT_MAX)),
+ aFmtFldMax(this, SchResId(EDT_MAX)),
+ aCbxAutoMax(this, SchResId(CBX_AUTO_MAX)),
+ aTxtMain (this, SchResId (TXT_STEP_MAIN)),
+ aFmtFldStepMain(this, SchResId(EDT_STEP_MAIN)),
+ aCbxAutoStepMain(this, SchResId(CBX_AUTO_STEP_MAIN)),
+ aTxtHelp (this, SchResId (TXT_STEP_HELP)),
+ aMtStepHelp (this, SchResId (MT_STEPHELP)),
+ aCbxAutoStepHelp(this, SchResId(CBX_AUTO_STEP_HELP)),
+
+ aTxtOrigin (this, SchResId (TXT_ORIGIN)),
+ aFmtFldOrigin(this, SchResId(EDT_ORIGIN)),
+ aCbxAutoOrigin(this, SchResId(CBX_AUTO_ORIGIN)),
+
+ aCbxLogarithm(this, SchResId(CBX_LOGARITHM)),
+ aCbxReverse(this, SchResId(CBX_REVERSE)),
+
+ fMin(0.0),
+ fMax(0.0),
+ fStepMain(0.0),
+ nStepHelp(0),
+ fOrigin(0.0),
+ nAxisType(chart2::AxisType::REALNUMBER),
+ pNumFormatter(NULL),
+ m_bShowAxisOrigin(false)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ aCbxAutoMin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoMax.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoStepHelp.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+}
+
+void ScaleTabPage::StateChanged( StateChangedType nType )
+{
+ TabPage::StateChanged( nType );
+
+ if( nType == STATE_CHANGE_INITSHOW )
+ AdjustControlPositions();
+}
+
+void ScaleTabPage::AdjustControlPositions()
+{
+ //optimize position of the controls
+ long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() );
+ nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth+=1;
+
+ long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width();
+ long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance;
+
+ //ensure that the auto checkboxes are wide enough and have correct size for calculation
+ aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() );
+ aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() );
+ aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() );
+ aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() );
+ aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() );
+
+ //ensure new pos is ok
+ long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X();
+ long nDialogWidth = GetSizePixel().Width();
+
+ long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls;
+ if(nLeftSpace>=0)
+ {
+ Size aSize( aTxtMin.GetSizePixel() );
+ aSize.Width() = nLabelWidth;
+ aTxtMin.SetSizePixel(aSize);
+ aTxtMax.SetSizePixel(aSize);
+ aTxtMain.SetSizePixel(aSize);
+ aTxtHelp.SetSizePixel(aSize);
+ aTxtOrigin.SetSizePixel(aSize);
+
+ lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos );
+ lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos );
+ lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos );
+ lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos );
+ lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos );
+ }
+}
+
+void ScaleTabPage::EnableControls()
+{
+ bool bEnableForValueOrPercentAxis = chart2::AxisType::REALNUMBER == nAxisType || chart2::AxisType::PERCENT == nAxisType;
+ aFlScale.Enable( bEnableForValueOrPercentAxis );
+ aTxtMin.Enable( bEnableForValueOrPercentAxis );
+ aFmtFldMin.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoMin.Enable( bEnableForValueOrPercentAxis );
+ aTxtMax.Enable( bEnableForValueOrPercentAxis );
+ aFmtFldMax.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoMax.Enable( bEnableForValueOrPercentAxis );
+ aTxtMain.Enable( bEnableForValueOrPercentAxis );
+ aFmtFldStepMain.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoStepMain.Enable( bEnableForValueOrPercentAxis );
+ aTxtHelp.Enable( bEnableForValueOrPercentAxis );
+ aMtStepHelp.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoStepHelp.Enable( bEnableForValueOrPercentAxis );
+ aCbxLogarithm.Enable( bEnableForValueOrPercentAxis );
+
+ aTxtOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis );
+ aFmtFldOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis );
+ aCbxAutoOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis );
+
+ long nNewYPos = aTxtOrigin.GetPosPixel().Y();
+ if( m_bShowAxisOrigin )
+ nNewYPos += ( aTxtOrigin.GetPosPixel().Y() - aTxtHelp.GetPosPixel().Y() );
+ lcl_placeControlsAtY( aCbxLogarithm, aCbxReverse, nNewYPos );
+}
+
+
+
+IMPL_LINK( ScaleTabPage, EnableValueHdl, CheckBox *, pCbx )
+{
+ if (pCbx == &aCbxAutoMin)
+ {
+ aFmtFldMin.Enable(!aCbxAutoMin.IsChecked());
+ }
+ else if (pCbx == &aCbxAutoMax)
+ {
+ aFmtFldMax.Enable(!aCbxAutoMax.IsChecked());
+ }
+ else if (pCbx == &aCbxAutoStepMain)
+ {
+ aFmtFldStepMain.Enable(!aCbxAutoStepMain.IsChecked());
+ }
+ else if (pCbx == &aCbxAutoStepHelp)
+ {
+ aMtStepHelp.Show ();
+ aMtStepHelp.Enable( ! aCbxAutoStepHelp.IsChecked() );
+ }
+ else if (pCbx == &aCbxAutoOrigin)
+ {
+ aFmtFldOrigin.Enable(!aCbxAutoOrigin.IsChecked());
+ }
+ return 0;
+}
+
+SfxTabPage* ScaleTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
+{
+ return new ScaleTabPage(pWindow, rOutAttrs);
+}
+
+BOOL ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ DBG_ASSERT( pNumFormatter, "No NumberFormatter available" );
+
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,aCbxAutoMin.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,aCbxAutoMax.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,aCbxAutoStepHelp.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,aCbxAutoOrigin.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM ,aCbxLogarithm.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_REVERSE ,aCbxReverse.IsChecked()));
+ rOutAttrs.Put(SvxDoubleItem(fMax , SCHATTR_AXIS_MAX));
+ rOutAttrs.Put(SvxDoubleItem(fMin , SCHATTR_AXIS_MIN));
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_STEP_HELP, nStepHelp));
+ rOutAttrs.Put(SvxDoubleItem(fOrigin , SCHATTR_AXIS_ORIGIN));
+
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,aCbxAutoStepMain.IsChecked()));
+ rOutAttrs.Put(SvxDoubleItem(fStepMain,SCHATTR_AXIS_STEP_MAIN));
+
+ return TRUE;
+}
+
+void ScaleTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ DBG_ASSERT( pNumFormatter, "No NumberFormatter available" );
+ if(!pNumFormatter)
+ return;
+
+ const SfxPoolItem *pPoolItem = NULL;
+ nAxisType=chart2::AxisType::REALNUMBER;
+ if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue();
+ EnableControls();
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,TRUE,&pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoMin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldMin.SetValue( fMin );
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoMax.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fMax = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldMax.SetValue( fMax );
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoStepMain.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fStepMain = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldStepMain.SetValue( fStepMain );
+ }
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoStepHelp.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxLogarithm.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxReverse.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nStepHelp = ((const SfxInt32Item*)pPoolItem)->GetValue();
+ aMtStepHelp.SetValue( nStepHelp );
+ }
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoOrigin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fOrigin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldOrigin.SetValue( fOrigin );
+ }
+
+ EnableValueHdl(&aCbxAutoMin);
+ EnableValueHdl(&aCbxAutoMax);
+ EnableValueHdl(&aCbxAutoStepMain);
+ EnableValueHdl(&aCbxAutoStepHelp);
+ EnableValueHdl(&aCbxAutoOrigin);
+}
+
+int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
+{
+ if( !pNumFormatter )
+ {
+ DBG_ERROR( "No NumberFormatter available" );
+ return LEAVE_PAGE;
+ }
+
+ sal_uInt32 nIndex = pNumFormatter->GetStandardIndex(LANGUAGE_SYSTEM);
+ const SfxPoolItem *pPoolItem = NULL;
+ if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ nIndex = static_cast< sal_uInt32 >( static_cast< const SfxInt32Item* >(pPoolItem)->GetValue());
+ else
+ {
+ OSL_ENSURE( false, "Using Standard Language" );
+ }
+
+ Edit* pEdit = NULL;
+ USHORT nErrStrId = 0;
+ double fDummy;
+
+ fMax = aFmtFldMax.GetValue();
+ fMin = aFmtFldMin.GetValue();
+ fOrigin = aFmtFldOrigin.GetValue();
+ fStepMain = aFmtFldStepMain.GetValue();
+ nStepHelp = static_cast< sal_Int32 >( aMtStepHelp.GetValue());
+
+ //do some reasonable automatic correction of user input if necessary
+ if (!aCbxAutoMax.IsChecked() && !aCbxAutoMin.IsChecked() &&
+ fMin >= fMax)
+ {
+ pEdit = &aFmtFldMin;
+ nErrStrId = STR_MIN_GREATER_MAX;
+ }
+ // check for entries in invalid ranges
+ if ( aCbxLogarithm.IsChecked() &&
+ ( ( !aCbxAutoMin.IsChecked() && fMin <= 0.0 )
+ || ( !aCbxAutoMax.IsChecked() && fMax <= 0.0 ) ) )
+ {
+ pEdit = &aFmtFldMin;
+ nErrStrId = STR_BAD_LOGARITHM;
+ }
+ if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0)
+ {
+ pEdit = &aFmtFldStepMain;
+ nErrStrId = STR_STEP_GT_ZERO;
+ }
+
+ //check wich entries need user action
+
+ // check for entries that cannot be parsed for the current number format
+ if ( aFmtFldMin.IsModified()
+ && !aCbxAutoMin.IsChecked()
+ && !pNumFormatter->IsNumberFormat(aFmtFldMin.GetText(), nIndex, fDummy))
+ {
+ pEdit = &aFmtFldMin;
+ nErrStrId = STR_INVALID_NUMBER;
+ }
+ else if (aFmtFldMax.IsModified() && !aCbxAutoMax.IsChecked() &&
+ !pNumFormatter->IsNumberFormat(aFmtFldMax.GetText(),
+ nIndex, fDummy))
+ {
+ pEdit = &aFmtFldMax;
+ nErrStrId = STR_INVALID_NUMBER;
+ }
+ else if (aFmtFldStepMain.IsModified() && !aCbxAutoStepMain.IsChecked() &&
+ !pNumFormatter->IsNumberFormat(aFmtFldStepMain.GetText(),
+ nIndex, fDummy))
+ {
+ pEdit = &aFmtFldStepMain;
+ nErrStrId = STR_STEP_GT_ZERO;
+ }
+ else if (aFmtFldOrigin.IsModified() && !aCbxAutoOrigin.IsChecked() &&
+ !pNumFormatter->IsNumberFormat(aFmtFldOrigin.GetText(),
+ nIndex, fDummy))
+ {
+ pEdit = &aFmtFldOrigin;
+ nErrStrId = STR_INVALID_NUMBER;
+ }
+ else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0.0)
+ {
+ pEdit = &aFmtFldStepMain;
+ nErrStrId = STR_STEP_GT_ZERO;
+ }
+
+ if( ShowWarning( nErrStrId, pEdit ) )
+ return KEEP_PAGE;
+
+ if( pItemSet )
+ FillItemSet( *pItemSet );
+
+ return LEAVE_PAGE;
+}
+
+void ScaleTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
+{
+ pNumFormatter = pFormatter;
+ aFmtFldMax.SetFormatter( pNumFormatter );
+ aFmtFldMin.SetFormatter( pNumFormatter );
+ aFmtFldStepMain.SetFormatter( pNumFormatter );
+ aFmtFldOrigin.SetFormatter( pNumFormatter );
+
+ // #101318#, #i6278# allow more decimal places than the output format. As
+ // the numbers shown in the edit fields are used for input, it makes more
+ // sense to display the values in the input format rather than the output
+ // format.
+ aFmtFldMax.UseInputStringForFormatting();
+ aFmtFldMin.UseInputStringForFormatting();
+ aFmtFldStepMain.UseInputStringForFormatting();
+ aFmtFldOrigin.UseInputStringForFormatting();
+
+ SetNumFormat();
+}
+
+void ScaleTabPage::SetNumFormat()
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue();
+
+ aFmtFldMax.SetFormatKey( nFmt );
+ aFmtFldMin.SetFormatKey( nFmt );
+ aFmtFldOrigin.SetFormatKey( nFmt );
+
+ if( pNumFormatter )
+ {
+ short eType = pNumFormatter->GetType( nFmt );
+ if( eType == NUMBERFORMAT_DATE )
+ {
+ // for intervals use standard format for dates (so you can enter a number of days)
+ const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
+ if( pFormat )
+ nFmt = pNumFormatter->GetStandardIndex( pFormat->GetLanguage());
+ else
+ nFmt = pNumFormatter->GetStandardIndex();
+ }
+ else if( eType == NUMBERFORMAT_DATETIME )
+ {
+ // for intervals use time format for date times
+ const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
+ if( pFormat )
+ nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME, pFormat->GetLanguage() );
+ else
+ nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME );
+ }
+ }
+
+ aFmtFldStepMain.SetFormatKey( nFmt );
+ }
+}
+
+void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
+{
+ m_bShowAxisOrigin = bShowOrigin;
+ if( !AxisHelper::isAxisPositioningEnabled() )
+ m_bShowAxisOrigin = true;
+}
+
+bool ScaleTabPage::ShowWarning( USHORT nResIdMessage, Edit * pControl /* = NULL */ )
+{
+ if( nResIdMessage == 0 )
+ return false;
+
+ WarningBox( this, WinBits( WB_OK ), String( SchResId( nResIdMessage ))).Execute();
+ if( pControl )
+ {
+ pControl->GrabFocus();
+ pControl->SetSelection( Selection( 0, SELECTION_MAX ));
+ }
+ return true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx
new file mode 100644
index 000000000000..2b0684854c48
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Scale.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Scale.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_SCALES_HXX
+#define _CHART2_TP_SCALES_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+// header for class FormattedField
+#include <svtools/fmtfield.hxx>
+// header for FixedText
+#include <vcl/fixed.hxx>
+// header for CheckBox
+#include <vcl/button.hxx>
+// header for MetricField
+#include <vcl/field.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ScaleTabPage : public SfxTabPage
+{
+public:
+ ScaleTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+ using TabPage::DeactivatePage;
+ virtual int DeactivatePage( SfxItemSet* pItemSet = NULL );
+
+ void SetNumFormatter( SvNumberFormatter* pFormatter );
+ void SetNumFormat();
+
+ void ShowAxisOrigin( bool bShowOrigin );
+
+ virtual void StateChanged( StateChangedType nType );
+
+private:
+ FixedLine aFlScale;
+
+ FixedText aTxtMin;
+ FormattedField aFmtFldMin;
+ CheckBox aCbxAutoMin;
+
+ FixedText aTxtMax;
+ FormattedField aFmtFldMax;
+ CheckBox aCbxAutoMax;
+
+ FixedText aTxtMain;
+ FormattedField aFmtFldStepMain;
+ CheckBox aCbxAutoStepMain;
+
+ FixedText aTxtHelp;
+ MetricField aMtStepHelp;
+ CheckBox aCbxAutoStepHelp;
+
+ FixedText aTxtOrigin;
+ FormattedField aFmtFldOrigin;
+ CheckBox aCbxAutoOrigin;
+
+ CheckBox aCbxLogarithm;
+ CheckBox aCbxReverse;
+
+ double fMin;
+ double fMax;
+ double fStepMain;
+ sal_Int32 nStepHelp;
+ double fOrigin;
+ int nAxisType;
+ SvNumberFormatter* pNumFormatter;
+
+ bool m_bShowAxisOrigin;
+
+ void AdjustControlPositions();
+ void EnableControls();
+
+ DECL_LINK( EnableValueHdl, CheckBox* );
+
+ /** shows a warning window due to an invalid input.
+
+ @param nResIdMessage
+ The resource identifier that represents the localized warning text.
+ If this is 0, no warning is shown and false is returned.
+
+ @param pControl
+ If non-NULL, contains a pointer to the control in which the
+ errornous value was in. This method gives this control the focus
+ and selects its content.
+
+ @return false, if nResIdMessage was 0, true otherwise
+ */
+ bool ShowWarning( USHORT nResIdMessage, Edit * pControl = NULL );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_Scale.src b/chart2/source/controller/dialogs/tp_Scale.src
new file mode 100644
index 000000000000..258c92b56aaa
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Scale.src
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Scale.src,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+#define YLine1 3
+#define Y1 (YLine1+13)
+#define Y2 (Y1+16)
+#define Y3 (Y2+16)
+#define Y4 (Y3+16)
+#define Y5 (Y4+16)
+#define Y6 (Y5+17)
+#define Y7 (Y6+15)
+
+#define LABELWIDTH 88
+#define AUTOCHECKWIDTH 88
+#define EDITWIDTH 50
+#define X1 6
+#define X2 11
+#define X3 (X2+LABELWIDTH+4)
+#define X4 (X3+EDITWIDTH+5)
+
+TabPage TP_SCALE
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ FixedLine FL_SCALE
+ {
+ Pos = MAP_APPFONT ( X1 , YLine1 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Scale" ;
+ };
+ FixedText TXT_MIN
+ {
+ Pos = MAP_APPFONT ( X2 , Y1 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Minimum:" ;
+ };
+ SpinField EDT_MIN
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_MIN
+ {
+ Pos = MAP_APPFONT ( X4 , Y1-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+
+ FixedText TXT_MAX
+ {
+ Pos = MAP_APPFONT ( X2 , Y2 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Ma~ximum:" ;
+ };
+ SpinField EDT_MAX
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y2-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_MAX
+ {
+ Pos = MAP_APPFONT ( X4 , Y2-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~utomatic" ;
+ };
+ FixedText TXT_STEP_MAIN
+ {
+ Pos = MAP_APPFONT ( X2 , Y3 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Ma~jor interval:" ;
+ };
+ SpinField EDT_STEP_MAIN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y3-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_STEP_MAIN
+ {
+ Pos = MAP_APPFONT ( X4 , Y3-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Au~tomatic" ;
+ };
+ FixedText TXT_STEP_HELP
+ {
+ Pos = MAP_APPFONT ( X2 , Y4 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Minor interval ~count:" ;
+ };
+ MetricField MT_STEPHELP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y4-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ CheckBox CBX_AUTO_STEP_HELP
+ {
+ Pos = MAP_APPFONT ( X4 , Y4-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Aut~omatic" ;
+ };
+
+ FixedText TXT_ORIGIN
+ {
+ Pos = MAP_APPFONT ( X2 , Y5 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Reference ~value:" ;
+ };
+ SpinField EDT_ORIGIN
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y5-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_ORIGIN
+ {
+ Pos = MAP_APPFONT ( X4 , Y5-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Automat~ic" ;
+ };
+
+ CheckBox CBX_LOGARITHM
+ {
+ Pos = MAP_APPFONT ( X2 , Y6 ) ;
+ Size = MAP_APPFONT ( 244 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Logarithmic scale" ;
+ };
+
+ CheckBox CBX_REVERSE
+ {
+ Pos = MAP_APPFONT ( X2 , Y7 ) ;
+ Size = MAP_APPFONT ( 244 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Reverse direction" ;
+ };
+
+};
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
new file mode 100644
index 000000000000..a5247e47ad1e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_SeriesToAxis.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_SeriesToAxis.hxx"
+#include "tp_SeriesToAxis.hrc"
+
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+//SfxIntegerListItem
+#include <svl/ilstitem.hxx>
+#include <svtools/controldims.hrc>
+
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchOptionTabPage::SchOptionTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
+ SfxTabPage(pWindow, SchResId(TP_OPTIONS), rInAttrs),
+ aGrpAxis(this, SchResId(GRP_OPT_AXIS)),
+ aRbtAxis1(this,SchResId(RBT_OPT_AXIS_1)),
+ aRbtAxis2(this,SchResId(RBT_OPT_AXIS_2)),
+
+ aGrpBar(this, SchResId(GB_BAR)),
+ aFTGap(this,SchResId(FT_GAP)),
+ aMTGap(this,SchResId(MT_GAP)),
+ aFTOverlap(this,SchResId(FT_OVERLAP)),
+ aMTOverlap(this,SchResId(MT_OVERLAP)),
+ aCBConnect(this,SchResId(CB_CONNECTOR)),
+ aCBAxisSideBySide(this,SchResId(CB_BARS_SIDE_BY_SIDE)),
+ m_aFL_PlotOptions(this,SchResId(FL_PLOT_OPTIONS)),
+ m_aFT_MissingValues(this,SchResId(FT_MISSING_VALUES)),
+ m_aRB_DontPaint(this,SchResId(RB_DONT_PAINT)),
+ m_aRB_AssumeZero(this,SchResId(RB_ASSUME_ZERO)),
+ m_aRB_ContinueLine(this,SchResId(RB_CONTINUE_LINE)),
+ m_aCBIncludeHiddenCells(this,SchResId(CB_INCLUDE_HIDDEN_CELLS)),
+ m_bProvidesSecondaryYAxis(true),
+ m_bProvidesOverlapAndGapWidth(false)
+{
+ FreeResource();
+
+ aRbtAxis1.SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
+ aRbtAxis2.SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
+}
+
+SchOptionTabPage::~SchOptionTabPage()
+{
+}
+
+IMPL_LINK( SchOptionTabPage, EnableHdl, RadioButton *, EMPTYARG )
+{
+ if( m_nAllSeriesAxisIndex == 0 )
+ aCBAxisSideBySide.Enable( aRbtAxis2.IsChecked());
+ else if( m_nAllSeriesAxisIndex == 1 )
+ aCBAxisSideBySide.Enable( aRbtAxis1.IsChecked());
+
+ return 0;
+}
+
+SfxTabPage* SchOptionTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
+{
+ return new SchOptionTabPage(pWindow, rOutAttrs);
+}
+
+BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ if(aRbtAxis2.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y));
+ else
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));
+
+ if(aMTGap.IsVisible())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_BAR_GAPWIDTH,static_cast< sal_Int32 >( aMTGap.GetValue())));
+
+ if(aMTOverlap.IsVisible())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_BAR_OVERLAP,static_cast< sal_Int32 >( aMTOverlap.GetValue())));
+
+ if(aCBConnect.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_BAR_CONNECT,aCBConnect.IsChecked()));
+
+ // model property is "group bars per axis", UI feature is the other way
+ // round: "show bars side by side"
+ if(aCBAxisSideBySide.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, ! aCBAxisSideBySide.IsChecked()));
+
+ if(m_aRB_DontPaint.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP));
+ else if(m_aRB_AssumeZero.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::USE_ZERO));
+ else if(m_aRB_ContinueLine.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::CONTINUE));
+
+ if (m_aCBIncludeHiddenCells.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCBIncludeHiddenCells.IsChecked()));
+
+ return TRUE;
+}
+
+void SchOptionTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ aRbtAxis1.Check(TRUE);
+ aRbtAxis2.Check(FALSE);
+ if (rInAttrs.GetItemState(SCHATTR_AXIS,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(nVal==CHART_AXIS_SECONDARY_Y)
+ {
+ aRbtAxis2.Check(TRUE);
+ aRbtAxis1.Check(FALSE);
+ }
+ }
+
+ long nTmp;
+ if (rInAttrs.GetItemState(SCHATTR_BAR_GAPWIDTH, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
+ aMTGap.SetValue(nTmp);
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_BAR_OVERLAP, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
+ aMTOverlap.SetValue(nTmp);
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_BAR_CONNECT, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCBConnect.Check(bCheck);
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ m_nAllSeriesAxisIndex = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ aCBAxisSideBySide.Disable();
+ }
+ if (rInAttrs.GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ // model property is "group bars per axis", UI feature is the other way
+ // round: "show bars side by side"
+ BOOL bCheck = ! static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCBAxisSideBySide.Check( bCheck );
+ }
+ else
+ {
+ aCBAxisSideBySide.Show(FALSE);
+ }
+
+
+ //missing value treatment
+ {
+ ::com::sun::star::uno::Sequence < sal_Int32 > aMissingValueTreatments;
+ if( rInAttrs.GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ aMissingValueTreatments =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
+
+ if ( aMissingValueTreatments.getLength()>1 && rInAttrs.GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ m_aRB_DontPaint.Enable(FALSE);
+ m_aRB_AssumeZero.Enable(FALSE);
+ m_aRB_ContinueLine.Enable(FALSE);
+
+ for( sal_Int32 nN =0; nN<aMissingValueTreatments.getLength(); nN++ )
+ {
+ sal_Int32 nVal = aMissingValueTreatments[nN];
+ if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ m_aRB_DontPaint.Enable(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO)
+ m_aRB_AssumeZero.Enable(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE)
+ m_aRB_ContinueLine.Enable(TRUE);
+ }
+
+ long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ m_aRB_DontPaint.Check(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO)
+ m_aRB_AssumeZero.Check(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE)
+ m_aRB_ContinueLine.Check(TRUE);
+ }
+ else
+ {
+ m_aFT_MissingValues.Show(FALSE);
+ m_aRB_DontPaint.Show(FALSE);
+ m_aRB_AssumeZero.Show(FALSE);
+ m_aRB_ContinueLine.Show(FALSE);
+ }
+ }
+
+ // Include hidden cells
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ m_aCBIncludeHiddenCells.Check(bVal);
+ }
+ else
+ {
+ m_aCBIncludeHiddenCells.Show(FALSE);
+ if(!m_aFT_MissingValues.IsVisible())
+ m_aFL_PlotOptions.Show(FALSE);
+ }
+
+ AdaptControlPositionsAndVisibility();
+}
+
+void SchOptionTabPage::Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlapAndGapWidth, bool bProvidesBarConnectors )
+{
+ m_bProvidesSecondaryYAxis = bProvidesSecondaryYAxis;
+ m_bProvidesOverlapAndGapWidth = bProvidesOverlapAndGapWidth;
+ m_bProvidesBarConnectors = bProvidesBarConnectors;
+
+ AdaptControlPositionsAndVisibility();
+}
+
+void lcl_offsetControl(Control& rCtrl, long nXOffset, long nYOffset )
+{
+ Point aPos = rCtrl.GetPosPixel();
+ rCtrl.SetPosPixel( Point(aPos.getX() + nXOffset, aPos.getY() + nYOffset) );
+}
+
+void lcl_optimzeRadioButtonSize( RadioButton& rCtrl )
+{
+ rCtrl.SetSizePixel( rCtrl.CalcMinimumSize() );
+}
+
+void SchOptionTabPage::AdaptControlPositionsAndVisibility()
+{
+ aRbtAxis1.Show(m_bProvidesSecondaryYAxis);
+ aRbtAxis2.Show(m_bProvidesSecondaryYAxis);
+ aGrpAxis.Show(m_bProvidesSecondaryYAxis);
+
+ aMTGap.Show(m_bProvidesOverlapAndGapWidth);
+ aFTGap.Show(m_bProvidesOverlapAndGapWidth);
+
+ aMTOverlap.Show(m_bProvidesOverlapAndGapWidth);
+ aFTOverlap.Show(m_bProvidesOverlapAndGapWidth);
+
+ aCBConnect.Show(m_bProvidesBarConnectors);
+
+ if( !aMTGap.IsVisible() && !aMTOverlap.IsVisible() )
+ {
+ aGrpBar.Show(FALSE);
+ Point aPos;
+ if( !aRbtAxis1.IsVisible() && !aRbtAxis2.IsVisible() )
+ aPos = aGrpAxis.GetPosPixel();
+ else
+ aPos = aGrpBar.GetPosPixel();
+
+ long nYOffset = aPos.getY() - m_aFL_PlotOptions.GetPosPixel().getY();
+ lcl_offsetControl(m_aFL_PlotOptions, 0, nYOffset);
+ lcl_offsetControl(m_aFT_MissingValues, 0, nYOffset);
+ lcl_offsetControl(m_aRB_DontPaint, 0, nYOffset);
+ lcl_offsetControl(m_aRB_AssumeZero, 0, nYOffset);
+ lcl_offsetControl(m_aRB_ContinueLine, 0, nYOffset);
+ lcl_offsetControl(m_aCBIncludeHiddenCells, 0, nYOffset);
+ }
+
+ m_aFT_MissingValues.SetSizePixel( m_aFT_MissingValues.CalcMinimumSize() );
+ lcl_optimzeRadioButtonSize( m_aRB_DontPaint );
+ lcl_optimzeRadioButtonSize( m_aRB_AssumeZero );
+ lcl_optimzeRadioButtonSize( m_aRB_ContinueLine );
+
+ Size aControlDistance( m_aFT_MissingValues.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nXOffset = m_aFT_MissingValues.GetPosPixel().getX() + m_aFT_MissingValues.GetSizePixel().getWidth() + aControlDistance.getWidth() - m_aRB_DontPaint.GetPosPixel().getX();
+ lcl_offsetControl(m_aRB_DontPaint, nXOffset, 0);
+ lcl_offsetControl(m_aRB_AssumeZero, nXOffset, 0);
+ lcl_offsetControl(m_aRB_ContinueLine, nXOffset, 0);
+
+ if( !m_aFT_MissingValues.IsVisible() )
+ {
+ //for example for stock charts
+ m_aCBIncludeHiddenCells.SetPosPixel( m_aFT_MissingValues.GetPosPixel() );
+ }
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc b/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
new file mode 100644
index 000000000000..2a39c313ca3c
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define GRP_OPT_AXIS 1
+#define RBT_OPT_AXIS_1 2
+#define RBT_OPT_AXIS_2 3
+#define MT_GAP 4
+#define MT_OVERLAP 5
+#define FT_GAP 6
+#define FT_OVERLAP 7
+#define GB_BAR 8
+#define CB_CONNECTOR 9
+#define CB_BARS_SIDE_BY_SIDE 10
+#define FL_PLOT_OPTIONS 11
+#define FT_MISSING_VALUES 12
+#define RB_DONT_PAINT 13
+#define RB_ASSUME_ZERO 14
+#define RB_CONTINUE_LINE 15
+#define CB_INCLUDE_HIDDEN_CELLS 16
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
new file mode 100644
index 000000000000..10fcae66c1e3
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_SeriesToAxis.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_SERIESTOAXIS_HXX
+#define _CHART2_TP_SERIESTOAXIS_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+// header for FixedText
+#include <vcl/fixed.hxx>
+// header for CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for MetricField
+#include <vcl/field.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class SchOptionTabPage : public SfxTabPage
+{
+public:
+ SchOptionTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SchOptionTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+
+ void Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlapAndGapWidth, bool bProvidesBarConnectors );
+
+private: //methods
+ void AdaptControlPositionsAndVisibility();
+
+private: //member
+ FixedLine aGrpAxis;
+ RadioButton aRbtAxis1;
+ RadioButton aRbtAxis2;
+
+ FixedLine aGrpBar;
+ FixedText aFTGap;
+ MetricField aMTGap;
+ FixedText aFTOverlap;
+ MetricField aMTOverlap;
+ CheckBox aCBConnect;
+ CheckBox aCBAxisSideBySide;
+
+ FixedLine m_aFL_PlotOptions;
+ FixedText m_aFT_MissingValues;
+ RadioButton m_aRB_DontPaint;
+ RadioButton m_aRB_AssumeZero;
+ RadioButton m_aRB_ContinueLine;
+
+ CheckBox m_aCBIncludeHiddenCells;
+
+ DECL_LINK(EnableHdl, RadioButton * );
+
+ sal_Int32 m_nAllSeriesAxisIndex;
+
+ bool m_bProvidesSecondaryYAxis;
+ bool m_bProvidesOverlapAndGapWidth;
+ bool m_bProvidesBarConnectors;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.src b/chart2/source/controller/dialogs/tp_SeriesToAxis.src
new file mode 100644
index 000000000000..0686e45f25b3
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.src
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_SeriesToAxis.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_SeriesToAxis.hrc"
+
+TabPage TP_OPTIONS
+{
+ Hide = TRUE ;
+// HelpID = HID_LAYOUT ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine 1
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Align data series to";
+ };
+ RadioButton RBT_OPT_AXIS_1
+ {
+ Pos = MAP_APPFONT ( 12 , 20 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Primary Y axis";
+ };
+ RadioButton RBT_OPT_AXIS_2
+ {
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Secondary Y axis";
+ };
+
+ FixedLine GB_BAR
+ {
+ Pos = MAP_APPFONT ( 6 , 50 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Settings";
+ };
+ FixedText FT_OVERLAP
+ {
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 47 , 8 ) ;
+ Text [ en-US ] = "~Overlap";
+ };
+
+ MetricField MT_OVERLAP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 63 , 78 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -100 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ DecimalDigits = 0 ;
+ };
+
+ FixedText FT_GAP
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 47 , 8 ) ;
+ Text [ en-US ] = "~Spacing";
+ };
+
+ MetricField MT_GAP
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 63 , 62 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 600 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ DecimalDigits = 0 ;
+ };
+
+ CheckBox CB_CONNECTOR
+ {
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Connection lines";
+ };
+
+ CheckBox CB_BARS_SIDE_BY_SIDE
+ {
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Show ~bars side by side";
+ };
+
+ FixedLine FL_PLOT_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 113 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Plot options";
+ };
+
+ FixedText FT_MISSING_VALUES
+ {
+ Pos = MAP_APPFONT ( 12 , 127 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Plot missing values";
+ };
+
+ RadioButton RB_DONT_PAINT
+ {
+ Pos = MAP_APPFONT ( 82 , 127 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Leave gap";
+ };
+
+ RadioButton RB_ASSUME_ZERO
+ {
+ Pos = MAP_APPFONT ( 82 , 141 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Assume zero";
+ };
+
+ RadioButton RB_CONTINUE_LINE
+ {
+ Pos = MAP_APPFONT ( 82 , 155 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Continue line";
+ };
+
+ CheckBox CB_INCLUDE_HIDDEN_CELLS
+ {
+ Pos = MAP_APPFONT ( 12 , 172 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Include ~values from hidden cells";
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
new file mode 100644
index 000000000000..d04f43c7031b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_TitleRotation.cxx,v $
+ * $Revision: 1.11.72.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_TitleRotation.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "HelpIds.hrc"
+#include <svx/eeitem.hxx>
+#include <svx/frmdiritem.hxx>
+
+// header for class SfxInt32Item
+#include <svl/intitem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow,
+ const SfxItemSet& rInAttrs, bool bWithRotation) :
+ SfxTabPage(pWindow, SchResId(TP_ALIGNMENT), rInAttrs),
+ aFlAlign ( this, SchResId( FL_ALIGN ) ),
+ aCtrlDial ( this, SchResId( CTR_DIAL ) ),
+ aFtRotate ( this, SchResId( FT_DEGREES ) ),
+ aNfRotate ( this, SchResId( NF_ORIENT ) ),
+ aCbStacked ( this, SchResId( BTN_TXTSTACKED ) ),
+ aOrientHlp ( aCtrlDial, aNfRotate, aCbStacked ),
+ aFtTextDirection( this, SchResId( FT_TEXTDIR ) ),
+ aLbTextDirection( this, SchResId( LB_TEXTDIR ), &aFtTextDirection )
+{
+ FreeResource();
+
+ aCbStacked.EnableTriState( FALSE );
+ aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
+
+ if( !bWithRotation )
+ {
+ aOrientHlp.Hide();
+ Point aMove( 0, aCtrlDial.GetPosPixel().Y() - aFtTextDirection.GetPosPixel().Y() );
+ aFtTextDirection.SetPosPixel( aFtTextDirection.GetPosPixel() + aMove );
+ aLbTextDirection.SetPosPixel( aLbTextDirection.GetPosPixel() + aMove );
+
+ aLbTextDirection.SetHelpId( HID_SCH_TEXTDIRECTION_EQUATION );
+ }
+}
+
+SchAlignmentTabPage::~SchAlignmentTabPage()
+{
+}
+
+SfxTabPage* SchAlignmentTabPage::Create(Window* pParent,
+ const SfxItemSet& rInAttrs)
+{
+ return new SchAlignmentTabPage(pParent, rInAttrs);
+}
+
+SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent,
+ const SfxItemSet& rInAttrs)
+{
+ return new SchAlignmentTabPage(pParent, rInAttrs, false);
+}
+
+BOOL SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ //Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES
+ bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
+
+ sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+
+ SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() );
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) );
+
+ return TRUE;
+}
+
+void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem* pItem = GetItem( rInAttrs, SCHATTR_TEXT_DEGREES );
+
+ sal_Int32 nDegrees = pItem ? ((const SfxInt32Item*)pItem)->GetValue() : 0;
+ aCtrlDial.SetRotation( nDegrees );
+
+ pItem = GetItem( rInAttrs, SCHATTR_TEXT_STACKED );
+ bool bStacked = pItem && ((const SfxBoolItem*)pItem)->GetValue();
+ aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK );
+
+
+ if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pItem) == SFX_ITEM_SET)
+ aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
new file mode 100644
index 000000000000..fb208196480f
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_TitleRotation.hxx,v $
+ * $Revision: 1.9.72.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_TITLEROTATION_HXX
+#define _CHART2_TP_TITLEROTATION_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+#include <svx/dialcontrol.hxx>
+#include <svx/wrapfield.hxx>
+#include <svx/orienthelper.hxx>
+#include <vcl/fixed.hxx>
+#include "TextDirectionListBox.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class SchAlignmentTabPage : public SfxTabPage
+{
+private:
+ FixedLine aFlAlign;
+ svx::DialControl aCtrlDial;
+ FixedText aFtRotate;
+ svx::WrapField aNfRotate;
+ TriStateBox aCbStacked;
+ svx::OrientationHelper aOrientHlp;
+ FixedText aFtTextDirection;
+ TextDirectionListBox aLbTextDirection;
+
+public:
+ SchAlignmentTabPage(Window* pParent, const SfxItemSet& rInAttrs, bool bWithRotation = true);
+ virtual ~SchAlignmentTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ static SfxTabPage* CreateWithoutRotation(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.src b/chart2/source/controller/dialogs/tp_TitleRotation.src
new file mode 100644
index 000000000000..8d516c13fb0a
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.src
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_TitleRotation.src,v $
+ * $Revision: 1.10.72.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+TabPage TP_ALIGNMENT
+{
+ Hide = TRUE ;
+ HelpID = HID_SCH_ALIGNMENT ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Control CTR_DIAL
+ {
+ HelpId = HID_SCH_ALIGNMENT_CTR_DIAL ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 43 , 43 ) ;
+ Text = "ABCD" ;
+ };
+ TriStateBox BTN_TXTSTACKED
+ {
+ HelpId = HID_SCH_ALIGNMENT_STACKED ;
+ Pos = MAP_APPFONT ( 139 , 14 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ve~rtically stacked";
+ };
+ FixedText FT_DEGREES
+ {
+ Pos = MAP_APPFONT ( 93 , 32 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ Text [ en-US ] = "~Degrees" ;
+ };
+ NumericField NF_ORIENT
+ {
+ HelpId = HID_SCH_ALIGNMENT_DEGREES ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 61 , 30 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ SpinSize = 5 ;
+ Minimum = 0 ;
+ Maximum = 359 ;
+ };
+ FixedLine FL_ALIGN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text orientation" ;
+ };
+ FixedText FT_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Te~xt direction" ;
+ };
+ ListBox LB_TEXTDIR
+ {
+ HelpId = HID_SCH_TEXTDIRECTION_TITLE ;
+ Pos = MAP_APPFONT ( 78 , 63 ) ;
+ Size = MAP_APPFONT ( 170 , 100 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_Trendline.cxx b/chart2/source/controller/dialogs/tp_Trendline.cxx
new file mode 100644
index 000000000000..a4f9056208c2
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Trendline.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Trendline.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_Trendline.hxx"
+#include "ResId.hxx"
+#include "TabPages.hrc"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+TrendlineTabPage::TrendlineTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, SchResId( TP_TRENDLINE ), rInAttrs ),
+ m_aTrendlineResources( this, rInAttrs, false )
+{
+ FreeResource();
+}
+
+TrendlineTabPage::~TrendlineTabPage()
+{
+}
+
+SfxTabPage* TrendlineTabPage::Create(
+ Window* pParent, const SfxItemSet& rOutAttrs )
+{
+ return new TrendlineTabPage( pParent, rOutAttrs );
+}
+
+BOOL TrendlineTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ return m_aTrendlineResources.FillItemSet( rOutAttrs );
+}
+
+void TrendlineTabPage::Reset( const SfxItemSet& rInAttrs )
+{
+ m_aTrendlineResources.Reset( rInAttrs );
+}
+
+void TrendlineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_aTrendlineResources.FillValueSets();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Trendline.hxx b/chart2/source/controller/dialogs/tp_Trendline.hxx
new file mode 100644
index 000000000000..3c2be000e293
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Trendline.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Trendline.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_TRENDLINE_HXX
+#define _CHART2_TP_TRENDLINE_HXX
+
+#include "res_Trendline.hxx"
+
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TrendlineTabPage : public SfxTabPage
+{
+public:
+ TrendlineTabPage ( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~TrendlineTabPage ();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ TrendlineResources m_aTrendlineResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_Trendline.src b/chart2/source/controller/dialogs/tp_Trendline.src
new file mode 100644
index 000000000000..2e7e8ec78c05
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Trendline.src
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Trendline.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_Trendline.hrc"
+
+TabPage TP_TRENDLINE
+{
+ Hide = TRUE ;
+// HelpID = HID_SCH_STAT ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ RESOURCE_TRENDLINE( 260 - 12, 0 )
+};
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
new file mode 100644
index 000000000000..67957ae94a16
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Wizard_TitlesAndObjects.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_Wizard_TitlesAndObjects.hxx"
+#include "tp_Wizard_TitlesAndObjects.hrc"
+#include "Strings.hrc"
+#include "res_Titles.hxx"
+#include "res_LegendPosition.hxx"
+#include "ResId.hxx"
+#include "HelpIds.hrc"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "LegendHelper.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "ControllerLockGuard.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+
+TitlesAndObjectsTabPage::TitlesAndObjectsTabPage( svt::OWizardMachine* pParent
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+ : OWizardPage( pParent, SchResId(TP_WIZARD_TITLEANDOBJECTS) )
+ , m_aFT_TitleDescription( this, SchResId( FT_TITLEDESCRIPTION ) )
+ , m_aFL_Vertical( this, SchResId( FL_VERTICAL ) )
+ , m_apTitleResources( new TitleResources(this,false) )
+ , m_apLegendPositionResources( new LegendPositionResources(this,xContext) )
+ , m_aFL_Grids( this, SchResId( FL_GRIDS ) )
+ , m_aCB_Grid_X( this, SchResId( CB_X_SECONDARY ) )
+ , m_aCB_Grid_Y( this, SchResId( CB_Y_SECONDARY ) )
+ , m_aCB_Grid_Z( this, SchResId( CB_Z_SECONDARY ) )
+ , m_xChartModel( xChartModel )
+ , m_xCC( xContext )
+ , m_bCommitToModel( true )
+ , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
+{
+ FreeResource();
+
+ this->SetText( String( SchResId( STR_PAGE_CHART_ELEMENTS ) ) );
+
+ Font aFont( m_aFT_TitleDescription.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_TitleDescription.SetControlFont( aFont );
+
+ m_aCB_Grid_X.SetHelpId( HID_SCH_CB_XGRID );
+ m_aCB_Grid_Y.SetHelpId( HID_SCH_CB_YGRID );
+ m_aCB_Grid_Z.SetHelpId( HID_SCH_CB_ZGRID );
+
+ m_apTitleResources->SetUpdateDataHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+ m_apLegendPositionResources->SetChangeHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+
+ m_aCB_Grid_X.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+ m_aCB_Grid_Y.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+ m_aCB_Grid_Z.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+}
+
+TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage()
+{
+}
+
+void TitlesAndObjectsTabPage::initializePage()
+{
+ m_bCommitToModel = false;
+
+ //init titles
+ {
+ TitleDialogData aTitleInput;
+ aTitleInput.readFromModel( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
+ m_apTitleResources->writeToResources( aTitleInput );
+ }
+
+ //init legend
+ {
+ m_apLegendPositionResources->writeToResources( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
+ }
+
+ //init grid checkboxes
+ {
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_xChartModel );
+ uno::Sequence< sal_Bool > aPossibilityList;
+ uno::Sequence< sal_Bool > aExistenceList;
+ AxisHelper::getAxisOrGridPossibilities( aPossibilityList, xDiagram, sal_False );
+ AxisHelper::getAxisOrGridExcistence( aExistenceList, xDiagram, sal_False );
+ m_aCB_Grid_X.Enable( aPossibilityList[0] );
+ m_aCB_Grid_Y.Enable( aPossibilityList[1] );
+ m_aCB_Grid_Z.Enable( aPossibilityList[2] );
+ m_aCB_Grid_X.Check( aExistenceList[0] );
+ m_aCB_Grid_Y.Check( aExistenceList[1] );
+ m_aCB_Grid_Z.Check( aExistenceList[2] );
+ }
+
+ m_bCommitToModel = true;
+}
+
+sal_Bool TitlesAndObjectsTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ if( m_apTitleResources->IsModified() ) //titles may have changed in the meanwhile
+ commitToModel();
+ return sal_True;//return false if this page should not be left
+}
+
+void TitlesAndObjectsTabPage::commitToModel()
+{
+ bool bChanged = false;
+
+ m_aTimerTriggeredControllerLock.startTimer();
+ uno::Reference< frame::XModel > xModel( m_xChartModel, uno::UNO_QUERY);
+
+ ControllerLockGuard aLockedControllers( xModel );
+
+ //commit title changes to model
+ {
+ TitleDialogData aTitleOutput;
+ m_apTitleResources->readFromResources( aTitleOutput );
+ bChanged = bChanged || aTitleOutput.writeDifferenceToModel( xModel, m_xCC );
+ m_apTitleResources->ClearModifyFlag();
+ }
+
+ //commit legend changes to model
+ {
+ bChanged = true;
+ m_apLegendPositionResources->writeToModel( xModel );
+ }
+
+ //commit grid changes to model
+ {
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ uno::Sequence< sal_Bool > aOldExistenceList;
+ AxisHelper::getAxisOrGridExcistence( aOldExistenceList, xDiagram, sal_False );
+ uno::Sequence< sal_Bool > aNewExistenceList(aOldExistenceList);
+ aNewExistenceList[0]=m_aCB_Grid_X.IsChecked();
+ aNewExistenceList[1]=m_aCB_Grid_Y.IsChecked();
+ aNewExistenceList[2]=m_aCB_Grid_Z.IsChecked();
+ AxisHelper::changeVisibilityOfGrids( xDiagram
+ , aOldExistenceList, aNewExistenceList, m_xCC );
+ }
+}
+
+IMPL_LINK( TitlesAndObjectsTabPage, ChangeHdl, void *, EMPTYARG )
+{
+ if( m_bCommitToModel )
+ commitToModel();
+ return 0;
+}
+
+bool TitlesAndObjectsTabPage::canAdvance() const
+{
+ return false;
+}
+
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc
new file mode 100644
index 000000000000..96721982bfc5
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Wizard_TitlesAndObjects.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+/*
+#define ED_MAINTITLE 1
+#define ED_SUBTITLE 2
+#define ED_X_AXIS 3
+#define ED_Y_AXIS 4
+#define ED_Z_AXIS 5
+#define FT_MAINTITLE 1
+#define FT_SUBTITLE 2
+#define FT_TITLE_X_AXIS 3
+#define FT_TITLE_Y_AXIS 4
+#define FT_TITLE_Z_AXIS 5
+*/
+
+#define FT_TITLEDESCRIPTION 30
+
+#define FL_VERTICAL 3
+#define FL_GRIDS 4
+
+#define CB_X_SECONDARY 4
+#define CB_Y_SECONDARY 5
+#define CB_Z_SECONDARY 6
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
new file mode 100644
index 000000000000..517fe301039c
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Wizard_TitlesAndObjects.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_WIZARD_TITLESANDOBJECTS_HXX
+#define _CHART2_TP_WIZARD_TITLESANDOBJECTS_HXX
+
+#include "TimerTriggeredControllerLock.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <svtools/wizardmachine.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+//for auto_ptr
+#include <memory>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class TitleResources;
+class LegendPositionResources;
+class TitlesAndObjectsTabPage : public svt::OWizardPage
+{
+public:
+ TitlesAndObjectsTabPage( svt::OWizardMachine* pParent
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~TitlesAndObjectsTabPage();
+
+ virtual void initializePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+ virtual bool canAdvance() const;
+
+protected:
+ void commitToModel();
+ DECL_LINK( ChangeHdl, void* );
+
+protected:
+ FixedText m_aFT_TitleDescription;
+ FixedLine m_aFL_Vertical;
+
+ ::std::auto_ptr< TitleResources > m_apTitleResources;
+ ::std::auto_ptr< LegendPositionResources > m_apLegendPositionResources;
+
+ FixedLine m_aFL_Grids;
+ CheckBox m_aCB_Grid_X;
+ CheckBox m_aCB_Grid_Y;
+ CheckBox m_aCB_Grid_Z;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+
+ bool m_bCommitToModel;
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src
new file mode 100644
index 000000000000..c8f9a5e49030
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tp_Wizard_TitlesAndObjects.src,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "SchSlotIds.hxx"
+#include "tp_Wizard_TitlesAndObjects.hrc"
+#include "res_Titlesx.hrc"
+#include "res_SecondaryAxisCheckBoxes.hrc"
+#include "dlg_CreationWizard.hrc"
+#include "res_LegendPosition.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+#define WIZ_TITLES_WIDTH 130
+
+#define WIZ_POSX1 6
+#define WIZ_POSX1_A (WIZ_POSX1)
+#define WIZ_POSX_VERTICAL (WIZ_POSX1+WIZ_TITLES_WIDTH+6)
+#define WIZ_POSX2 (WIZ_POSX_VERTICAL+RSC_CD_FIXEDLINE_WIDTH+2)
+#define WIZ_POSX2_A (WIZ_POSX2)
+#define WIZ_POSX2_B (WIZ_POSX2_A+9)
+
+#define WIZ_SECOND_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-10-(WIZ_POSX2))
+#define WIZ_COMPLETE_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-10-(WIZ_POSX1))
+#define WIZ_VERTICAL_FIXEDLINE_HEIGHT ( 88 )
+
+#define WIZ_POSY1 8
+#define WIZ_POSY1_A (WIZ_POSY1 + RSC_CD_FIXEDTEXT_HEIGHT +5)
+#define WIZ_POSY1_B (WIZ_POSY1_A+ RSC_CD_FIXEDTEXT_HEIGHT +7)
+
+#define WIZ_POSY2 110
+#define WIZ_POSY_GRID (WIZ_POSY2+RSC_CD_FIXEDTEXT_HEIGHT+6)
+
+TabPage TP_WIZARD_TITLEANDOBJECTS
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ;
+
+ FixedText FT_TITLEDESCRIPTION
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX1 , WIZ_POSY1 ) ;
+ Size = MAP_APPFONT ( WIZ_COMPLETE_FIXEDLINE_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Choose titles, legend, and grid settings";
+ };
+ FixedLine FL_VERTICAL
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX_VERTICAL , WIZ_POSY1+3+RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH, WIZ_VERTICAL_FIXEDLINE_HEIGHT ) ;
+ Vert = TRUE ;
+ };
+
+ TITLES(WIZ_POSX1_A,WIZ_POSY1_A,WIZ_TITLES_WIDTH,0,0)
+ RESOURCE_LEGENDDISPLAY( WIZ_POSX2_A, WIZ_POSY1_A )
+ RESOURCE_LEGENDPOSITION( WIZ_POSX2_B, WIZ_POSY1_B )
+
+
+ FixedLine FL_GRIDS
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX1 , WIZ_POSY2 ) ;
+ Size = MAP_APPFONT ( WIZ_COMPLETE_FIXEDLINE_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Display grids";
+ };
+
+ SECONDARYAXISCHECKBOXES( WIZ_POSX1_A, WIZ_POSY_GRID, 43, 0 )
+};