1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
25 #define _ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
26 
27 #include <sal/types.h>
28 #include <svx/msdffdef.hxx>
29 
30 struct SvxMSDffVertPair
31 {
32 	sal_Int32	nValA;
33 	sal_Int32	nValB;
34 };
35 struct SvxMSDffCalculationData
36 {
37 	sal_uInt16	nFlags;
38 	sal_Int32	nVal[ 3 ];
39 };
40 struct SvxMSDffTextRectangles
41 {
42 	SvxMSDffVertPair	nPairA;
43 	SvxMSDffVertPair	nPairB;
44 };
45 
46 #define MSDFF_HANDLE_FLAGS_MIRRORED_X					0x0001
47 #define MSDFF_HANDLE_FLAGS_MIRRORED_Y					0x0002
48 #define MSDFF_HANDLE_FLAGS_SWITCHED						0x0004
49 #define MSDFF_HANDLE_FLAGS_POLAR						0x0008
50 #define MSDFF_HANDLE_FLAGS_MAP							0x0010
51 #define MSDFF_HANDLE_FLAGS_RANGE						0x0020
52 #define MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL		0x0080
53 #define MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL		0x0100
54 #define MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL		0x0200
55 #define MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL		0x0400
56 #define MSDFF_HANDLE_FLAGS_CENTER_X_IS_SPECIAL			0x0800
57 #define MSDFF_HANDLE_FLAGS_CENTER_Y_IS_SPECIAL			0x1000
58 #define MSDFF_HANDLE_FLAGS_RADIUS_RANGE					0x2000
59 
60 struct SvxMSDffHandle
61 {
62 	sal_uInt32	nFlags;
63 	sal_Int32	nPositionX, nPositionY, nCenterX, nCenterY, nRangeXMin, nRangeXMax, nRangeYMin, nRangeYMax;
64 };
65 struct mso_CustomShape
66 {
67 	SvxMSDffVertPair*						pVertices;
68 	sal_uInt32								nVertices;
69 	sal_uInt16*								pElements;
70 	sal_uInt32								nElements;
71 	SvxMSDffCalculationData*				pCalculation;
72 	sal_uInt32								nCalculation;
73 	sal_Int32*								pDefData;
74 	SvxMSDffTextRectangles*					pTextRect;
75 	sal_uInt32								nTextRect;
76 	sal_Int32								nCoordWidth;
77 	sal_Int32								nCoordHeight;
78 	sal_Int32								nXRef;
79 	sal_Int32								nYRef;
80 	SvxMSDffVertPair*						pGluePoints;
81 	sal_uInt32								nGluePoints;
82 	SvxMSDffHandle*							pHandles;
83 	sal_uInt32								nHandles;
84 };
85 
86 // 0x80000000 is used as magic constant all over the customshape code where
87 // it is squeezed into signed int32 type that cannot preserve this value. Good
88 // compilers notice the problem and have every right to complain or error-out.
89 // Using the magic constant already casted down consolidates the problem and is
90 // the least invasive way to fix it until the code gets its well deserved makeover.
91 #define Mx80000000 static_cast<sal_Int32>(0x80000000)
92 #define MSO_I | Mx80000000
93 
94 sal_Bool			SortFilledObjectsToBackByDefault( MSO_SPT eSpType );
95 SVX_DLLPUBLIC sal_Bool			IsCustomShapeFilledByDefault( MSO_SPT eSpType );
96 SVX_DLLPUBLIC sal_Int16			GetCustomShapeConnectionTypeDefault( MSO_SPT eSpType );
97 
98 // #i28269#
99 SVX_DLLPUBLIC sal_Bool			IsCustomShapeStrokedByDefault( MSO_SPT eSpType );
100 
101 SVX_DLLPUBLIC const mso_CustomShape*	GetCustomShapeContent( MSO_SPT eSpType );
102 
103 #endif
104