File indexing completed on 2024-05-12 16:33:33

0001 /* This file is part of the KDE project
0002 
0003    Copyright 2017 Dag Andersen <danders@get2net.dk>
0004    Copyright 2007 Inge Wallin <inge@lysator.liu.se>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Library General Public
0008    License as published by the Free Software Foundation; either
0009    version 2 of the License, or (at your option) any later version.
0010 
0011    This library is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014    Library General Public License for more details.
0015 
0016    You should have received a copy of the GNU Library General Public License
0017    along with this library; see the file COPYING.LIB.  If not, write to
0018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020 */
0021 
0022 
0023 #ifndef KCHART_GLOBAL_H
0024 #define KCHART_GLOBAL_H
0025 
0026 #include <QLatin1String>
0027 #include <QDebug>
0028 
0029 #include <KoTextShapeData.h>
0030 typedef KoTextShapeData TextLabelData;
0031 
0032 namespace KoChart
0033 {
0034 
0035 // Chart types for OpenDocument
0036 enum ChartType {
0037     BarChartType,
0038     LineChartType,
0039     AreaChartType,
0040     CircleChartType,        // Pie in KChart
0041     RingChartType,
0042     ScatterChartType,
0043     RadarChartType,         // Polar in KChart
0044     FilledRadarChartType,   // Polar in KChart
0045     StockChartType,
0046     BubbleChartType,
0047     SurfaceChartType,
0048     GanttChartType,
0049     LastChartType               // Not an actual type, just a place holder
0050 };
0051 const int NUM_CHARTTYPES = int (LastChartType);
0052 
0053 bool isPolar(ChartType type);
0054 bool isCartesian(ChartType type);
0055 
0056 
0057 // Chart subtypes, applicable to Bar, Line, Area, and Radar
0058 enum ChartSubtype {
0059     NoChartSubtype,             // for charts with no subtypes
0060     NormalChartSubtype,         // For bar, line, area and radar charts
0061     StackedChartSubtype,
0062     PercentChartSubtype,
0063     HighLowCloseChartSubtype,               // For stock charts
0064     OpenHighLowCloseChartSubtype,
0065     CandlestickChartSubtype
0066 };
0067 
0068 ChartSubtype defaultChartSubtype(ChartType type);
0069 int numDimensions(ChartType type, ChartSubtype subtype = NoChartSubtype);
0070 
0071 QLatin1String chartTypeIconName(ChartType type, ChartSubtype subtype);
0072 #define ICON1(charttype) QIcon::fromTheme(chartTypeIconName(charttype, NoChartSubtype))
0073 #define ICON2(charttype, chartsubtype) QIcon::fromTheme(chartTypeIconName(charttype, chartsubtype))
0074 
0075 
0076 enum AxisDimension {
0077     XAxisDimension,
0078     YAxisDimension,
0079     ZAxisDimension
0080 };
0081 
0082 struct ChartTypeOptions
0083 {
0084     ChartSubtype subtype;
0085 };
0086 
0087 enum Position {
0088     StartPosition,
0089     TopPosition,
0090     EndPosition,
0091     BottomPosition,
0092     TopStartPosition,
0093     TopEndPosition,
0094     BottomStartPosition,
0095     BottomEndPosition,
0096     CenterPosition,
0097 
0098     FloatingPosition
0099 };
0100 
0101 enum LegendExpansion {
0102     HighLegendExpansion,
0103     WideLegendExpansion,
0104     BalancedLegendExpansion,
0105     CustomLegendExpansion
0106 };
0107 
0108 enum ErrorCategory {
0109     NoErrorCategory,
0110     VarianceErrorCategory,
0111     StandardDeviationErrorCategory,
0112     StandardErrorErrorCategory,
0113     PercentageErrorCategory,
0114     ErrorMarginErrorCategory,
0115     ConstantErrorCategory
0116 };
0117 
0118 enum ItemType {
0119     GenericItemType = 0,
0120     TitleLabelType = 1,
0121     SubTitleLabelType = 3,
0122     FooterLabelType = 5,
0123     PlotAreaType = 10,
0124     LegendType = 11,
0125     XAxisTitleType = 20,
0126     YAxisTitleType = 21,
0127     SecondaryXAxisTitleType = 22,
0128     SecondaryYAxisTitleType = 23
0129 };
0130 
0131 enum OdfSymbolType {
0132     NoSymbol,
0133     AutomaticSymbol,
0134     NamedSymbol,
0135     ImageSymbol
0136 };
0137 
0138 // From odf spec:
0139 // The values of the chart:symbol-name attribute are:
0140 // square, diamond, arrow-down, arrow-up, arrow-right, arrow-left, bow-tie, hourglass, circle, star, x, plus, asterisk, horizontal-bar or vertical-bar
0141 enum OdfMarkerStyle {
0142     MarkerSquare         = 0,
0143     MarkerDiamond        = 1,
0144     MarkerArrowDown      = 2,
0145     MarkerArrowUp        = 3,
0146     MarkerArrowRight     = 4,
0147     MarkerArrowLeft      = 5,
0148     MarkerBowTie         = 6,
0149     MarkerHourGlass      = 7,
0150     MarkerCircle         = 8,
0151     MarkerStar           = 9,
0152     MarkerX              = 10,
0153     MarkerCross          = 11,
0154     MarkerAsterisk       = 12,
0155     MarkerHorizontalBar  = 13,
0156     MarkerVerticalBar    = 14,
0157     // NOTE: These are not odf
0158     MarkerRing           = 15,
0159     MarkerFastCross      = 16,
0160     Marker1Pixel         = 17,
0161     Marker4Pixels        = 18
0162 };
0163 
0164 } // Namespace KoChart
0165 
0166 QDebug operator<<(QDebug dbg, KoChart::Position p);
0167 QDebug operator<<(QDebug dbg, KoChart::ChartType ct);
0168 QDebug operator<<(QDebug dbg, KoChart::ChartSubtype st);
0169 
0170 #endif