summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2011-09-09 15:02:34 +0200
committerKohei Yoshida <kohei.yoshida@suse.com>2011-09-20 12:14:13 -0400
commit3e5edf6ca9d3bc56549602bda2adc855dd57f658 (patch)
tree51e8993e730ff7f17721c4b8c126fc92ab92bb34 /chart2
parent53abf4dc1c065fba3ec9e691cacd55aceaf19fc7 (diff)
Add missing chart data point ODF1.2 standard symbols
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx2
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx323
2 files changed, 324 insertions, 1 deletions
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
index 5707a0aa8f21..97d3156dadf2 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -151,7 +151,7 @@ sal_Int32 lcl_getSymbolType( const ::com::sun::star::chart2::Symbol& rSymbol )
nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
break;
case chart2::SymbolStyle_STANDARD:
- nSymbol = rSymbol.StandardSymbol%8;
+ nSymbol = rSymbol.StandardSymbol%15;
break;
case chart2::SymbolStyle_POLYGON://new feature
nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index e152c47b3a7c..dc06ebac0dbe 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -1263,6 +1263,13 @@ enum SymbolType { SYMBOL_SQUARE=0
, SYMBOL_ARROW_LEFT
, SYMBOL_BOWTIE
, SYMBOL_SANDGLASS
+ , SYMBOL_CIRCLE
+ , SYMBOL_STAR
+ , SYMBOL_X
+ , SYMBOL_PLUS
+ , SYMBOL_ASTERISK
+ , SYMBOL_HORIZONTAL_BAR
+ , SYMBOL_VERTICAL_BAR
, SYMBOL_COUNT
};
@@ -1286,6 +1293,9 @@ drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D&
const double fWidthH = rSize.DirectionX/2.0; //fWidthH stands for Half Width
const double fHeightH = rSize.DirectionY/2.0; //fHeightH stands for Half Height
+ double fMaxSize = fHeightH > fWidthH ? fHeightH : fWidthH; //assumes non negative
+ const sal_Int32 nQuarterCount = 35; // points inside a quadrant, used in case circle
+
sal_Int32 nPointCount = 4; //all arrow symbols only need 4 points
switch( eSymbolType )
{
@@ -1293,8 +1303,25 @@ drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D&
case SYMBOL_DIAMOND:
case SYMBOL_BOWTIE:
case SYMBOL_SANDGLASS:
+ case SYMBOL_HORIZONTAL_BAR:
+ case SYMBOL_VERTICAL_BAR:
nPointCount = 5;
break;
+ case SYMBOL_X:
+ nPointCount = 13;
+ break;
+ case SYMBOL_PLUS:
+ nPointCount = 13;
+ break;
+ case SYMBOL_STAR:
+ nPointCount = 9;
+ break;
+ case SYMBOL_ASTERISK:
+ nPointCount = 19;
+ break;
+ case SYMBOL_CIRCLE:
+ nPointCount = 5 + 4 * nQuarterCount;
+ break;
default:
break;
}
@@ -1323,6 +1350,24 @@ drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D&
switch(eSymbolType)
{
+ case SYMBOL_SQUARE:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+ }
case SYMBOL_ARROW_UP:
{
*pInnerSequenceX++ = fX-fWidthH;
@@ -1438,6 +1483,284 @@ drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D&
*pInnerSequenceY++ = fY;
break;
}
+ case SYMBOL_HORIZONTAL_BAR:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-0.2*fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-0.2*fHeightH;
+
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+0.2*fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+0.2*fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-0.2*fHeightH;
+ break;
+ }
+ case SYMBOL_VERTICAL_BAR:
+ {
+ *pInnerSequenceX++ = fX-0.2*fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX+0.2*fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+
+ *pInnerSequenceX++ = fX+0.2*fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX-0.2*fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX-0.2*fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ break;
+ }
+ case SYMBOL_CIRCLE:
+ {
+ double fOmega = 1.5707963267948966192 / (nQuarterCount + 1.0);
+ // one point in the middle of each edge to get full size bounding rectangle
+ *pInnerSequenceX++ = fX + fWidthH;
+ *pInnerSequenceY++ = fY;
+ // 0 to PI/2
+ for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
+ {
+ *pInnerSequenceX++ = fX + fWidthH * cos( i * fOmega );
+ *pInnerSequenceY++ = fY - fHeightH * sin( i * fOmega );
+ }
+ // PI/2 to PI
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY - fHeightH;
+ for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
+ {
+ *pInnerSequenceX++ = fX - fWidthH * sin( i * fOmega);
+ *pInnerSequenceY++ = fY - fHeightH * cos( i * fOmega);
+ }
+ // PI to 3/2*PI
+ *pInnerSequenceX++ = fX - fWidthH;
+ *pInnerSequenceY++ = fY;
+ for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
+ {
+ *pInnerSequenceX++ = fX - fWidthH * cos( i * fOmega);
+ *pInnerSequenceY++ = fY + fHeightH * sin( i * fOmega);
+ }
+ // 3/2*PI to 2*PI
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY + fHeightH;
+ for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
+ {
+ *pInnerSequenceX++ = fX + fWidthH * sin(i * fOmega);
+ *pInnerSequenceY++ = fY + fHeightH * cos(i * fOmega);
+ }
+ // close polygon
+ *pInnerSequenceX++ = fX + fWidthH;
+ *pInnerSequenceY++ = fY;
+ break;
+ }
+ case SYMBOL_STAR:
+ {
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX+0.2*fWidthH;
+ *pInnerSequenceY++ = fY-0.2*fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX+0.2*fWidthH;
+ *pInnerSequenceY++ = fY+0.2*fHeightH;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX-0.2*fWidthH;
+ *pInnerSequenceY++ = fY+0.2*fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX-0.2*fWidthH;
+ *pInnerSequenceY++ = fY-0.2*fHeightH;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+ }
+ case SYMBOL_X:
+ {
+ const double fScaleX = fWidthH / 128.0;
+ const double fScaleY = fHeightH / 128.0;
+ const double fSmall = sqrt(200.0);
+ const double fLarge = 128.0 - fSmall;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY - fScaleY * fSmall;
+
+ *pInnerSequenceX++ = fX - fScaleX * fLarge;
+ *pInnerSequenceY++ = fY - fHeightH;
+
+ *pInnerSequenceX++ = fX - fWidthH;
+ *pInnerSequenceY++ = fY - fScaleY * fLarge;
+
+ *pInnerSequenceX++ = fX - fScaleX * fSmall;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX - fWidthH;
+ *pInnerSequenceY++ = fY + fScaleY * fLarge;
+
+ *pInnerSequenceX++ = fX - fScaleX * fLarge;
+ *pInnerSequenceY++ = fY + fHeightH;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY + fScaleY * fSmall;
+
+ *pInnerSequenceX++ = fX + fScaleX * fLarge;
+ *pInnerSequenceY++ = fY + fHeightH;
+
+ *pInnerSequenceX++ = fX + fWidthH;
+ *pInnerSequenceY++ = fY + fScaleY * fLarge;
+
+ *pInnerSequenceX++ = fX + fScaleX * fSmall;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX + fWidthH;
+ *pInnerSequenceY++ = fY - fScaleY * fLarge;
+
+ *pInnerSequenceX++ = fX + fScaleX * fLarge;
+ *pInnerSequenceY++ = fY - fHeightH;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY - fScaleY * fSmall;
+ break;
+
+ }
+ case SYMBOL_PLUS:
+ {
+ const double fScaleX = fWidthH / 128.0;
+ const double fScaleY = fHeightH / 128.0;
+ const double fHalf = 10.0; //half line width on 256 size square
+ const double fdX = fScaleX * fHalf;
+ const double fdY = fScaleY * fHalf;
+
+ *pInnerSequenceX++ = fX-fdX;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fdX;
+ *pInnerSequenceY++ = fY-fdY;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fdY;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fdY;
+
+ *pInnerSequenceX++ = fX-fdX;
+ *pInnerSequenceY++ = fY+fdY;
+
+ *pInnerSequenceX++ = fX-fdX;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fdX;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fdX;
+ *pInnerSequenceY++ = fY+fdY;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fdY;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fdY;
+
+ *pInnerSequenceX++ = fX+fdX;
+ *pInnerSequenceY++ = fY-fdY;
+
+ *pInnerSequenceX++ = fX+fdY;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fdX;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+
+ }
+ case SYMBOL_ASTERISK:
+ {
+ const double fHalf = 10.0; // half line width on 256 size square
+ const double fTwoY = fHalf * sqrt(3.0);
+ const double fFourY = (128.0 - 2.0 * fHalf ) / sqrt(3.0);
+ const double fThreeX = 128.0 - fHalf;
+ const double fThreeY = fHalf * sqrt(3.0) + fFourY;
+ const double fFiveX = 2.0 * fHalf;
+
+ const double fScaleX = fWidthH / 128.0;
+ const double fScaleY = fHeightH / 128.0;
+
+ //1
+ *pInnerSequenceX++ = fX-fScaleX * fHalf;
+ *pInnerSequenceY++ = fY-fHeightH;
+ //2
+ *pInnerSequenceX++ = fX-fScaleX * fHalf;
+ *pInnerSequenceY++ = fY-fScaleY * fTwoY;
+ //3
+ *pInnerSequenceX++ = fX-fScaleX * fThreeX;
+ *pInnerSequenceY++ = fY-fScaleY * fThreeY;
+ //4
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fScaleY * fFourY;
+ //5
+ *pInnerSequenceX++ = fX-fScaleX * fFiveX;
+ *pInnerSequenceY++ = fY;
+ //6 as 4
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fScaleY * fFourY;
+ //7 as 3
+ *pInnerSequenceX++ = fX-fScaleX * fThreeX;
+ *pInnerSequenceY++ = fY+fScaleY * fThreeY;
+ //8 as 2
+ *pInnerSequenceX++ = fX-fScaleX * fHalf;
+ *pInnerSequenceY++ = fY+fScaleY * fTwoY;
+ //9 as 1
+ *pInnerSequenceX++ = fX-fScaleX * fHalf;
+ *pInnerSequenceY++ = fY+fHeightH;
+ //10 as 1
+ *pInnerSequenceX++ = fX+fScaleX * fHalf;
+ *pInnerSequenceY++ = fY+fHeightH;
+ //11 as 2
+ *pInnerSequenceX++ = fX+fScaleX * fHalf;
+ *pInnerSequenceY++ = fY+fScaleY * fTwoY;
+ //12 as 3
+ *pInnerSequenceX++ = fX+fScaleX * fThreeX;
+ *pInnerSequenceY++ = fY+fScaleY * fThreeY;
+ //13 as 4
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fScaleY * fFourY;
+ //14 as 5
+ *pInnerSequenceX++ = fX+fScaleX * fFiveX;
+ *pInnerSequenceY++ = fY;
+ //15 as 4
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fScaleY * fFourY;
+ //16 as 3
+ *pInnerSequenceX++ = fX+fScaleX * fThreeX;
+ *pInnerSequenceY++ = fY-fScaleY * fThreeY;
+ //17 as 2
+ *pInnerSequenceX++ = fX+fScaleX * fHalf;
+ *pInnerSequenceY++ = fY-fScaleY * fTwoY;
+ // 18 as 1
+ *pInnerSequenceX++ = fX+fScaleX * fHalf;
+ *pInnerSequenceY++ = fY-fHeightH;
+ // 19 = 1, closing
+ *pInnerSequenceX++ = fX-fScaleX * fHalf;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+ }
default: //case SYMBOL_SQUARE:
{
*pInnerSequenceX++ = fX-fWidthH;