1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: globfunc.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef __GLOBFUNC_HXX
33 #define __GLOBFUNC_HXX
35 #ifndef _E3D_LABEL3D_HXX //autogen
36 #include <bf_svx/label3d.hxx>
39 #include "schgroup.hxx"
41 #include "datapoin.hxx"
42 #include "datarow.hxx"
44 #ifndef _SVX_CHRTITEM_HXX //autogen
45 #include <bf_svx/chrtitem.hxx>
48 #ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_
49 #include <com/sun/star/drawing/XShape.hpp>
51 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
52 #include <com/sun/star/uno/Reference.h>
61 extern void Dbg_DebugItems(SfxItemSet
& rSet
,ChartModel
* pModel
,long num
= 32);
62 #define DBG_ITEMS(a,b) Dbg_DebugItems(a,b)
63 #define DBG_ITEMSX(a,b,c) Dbg_DebugItems(a,b,c)
65 #define DBG_ITEMS(a,b)
66 #define DBG_ITEMSX(a,b,c)
69 //hunderstel Grad (centi-degrees)in Rad
70 #define CDEG2RAD(fAngle) ( (double)(fAngle)*F_PI/18000.0 )
72 void AxisAttrOld2New(SfxItemSet
&rDestSet
,BOOL bClear
,long nId
);
73 void AxisAttrNew2Old(SfxItemSet
&rDestSet
,long nId
,BOOL bClear
);
75 Size
GetRotatedTextSize(const Size
& rSize
,const long nDegrees
);
76 long GetTextRotation(SfxItemSet
&rAttr
);
77 long GetTextRotation(SfxItemSet
&rAttr
,SvxChartTextOrient eOrient
);
79 SdrObject
*SetObjectAttr (SdrObject
*pObj
,
85 SdrObjList
*CreateGroup (SdrObjList
&rObjList
,
87 ULONG nIndex
= CONTAINER_APPEND
);
89 SchObjGroup
*CreateSimpleGroup (UINT16 nID
,
94 void CubicSpline (XPolygon
&pKnownPoints
,
103 double TLeft (double x
,
108 double TRight (double x
,
113 void BVector (double x
,
122 XPolygon
&pKnownPoints
,
125 void approxMesh (int splineSize
,
127 XPolygon
&pKnownPoints
,
131 double SizeBounds (double,
135 void IncValue(double& rValue
,
139 void DecValue(double& rValue
,
144 Color
RGBColor(ColorData nColorName
);
146 String
StackString(const String
& aString
);
150 void AdjustRect (Rectangle
&rRect
,
151 ChartAdjust eAdjust
);
153 Size
AdjustRotatedRect (const Rectangle
&rRect
,
155 const Rectangle
&rOldRect
);
157 void SetAdjust(ChartAdjust
&eAdjust
,
158 SvxChartTextOrient eOrient
);
160 void SetTextPos(SdrTextObj
&rTextObj
,
161 const Point
&rPos
,SfxItemSet
* pAttr
);
163 void AdjustTextSize(SdrTextObj
&rTextObj
,
164 const Size
&rTextSize
);
166 Size
GetOutputSize(SdrTextObj
& rTextObj
);
168 /** Creates an SchObjGroup containing SdrPathObjects, which are created from the
169 XPolygons given in the vector rPolygons. The items in rItems are applied to
170 all of the created objects.
172 Note: The ChartModel is needed for the CTOR of SchObjGroup.
174 SdrObject
* CreateErrorGroup(
176 const ::std::vector
< XPolygon
> & rPolygons
,
177 const SfxItemSet
& rItems
);
181 void CreateChartGroup( SchObjGroup
* &, SdrObjList
* & );
186 /** Intersect two SfxItemSets in the following way: Modify rDestSet such that
187 after this function completes there are only items left that are contained
188 in both sets and have equal content (using the != operator of SfxPoolItem)
190 Items that are set in either of the itemsets but are not equal are
191 invalidated. This is useful for dialogs. For a template-like usage, you
192 can remove the invalid items by calling ClearInvalidItems() at the result.
194 Note: The Intersect method of SfxItemSet works differently for equal and
195 non-equal which-ranges. If the ranges are equal it does something
196 like this method, otherwise it just removes items which are not
197 contained in the which range of the other item set.
199 @param rSourceSet is the item set which will be iterated over
200 @param rDestSet is the item set which is modified such that the condition
201 described above is maintained.
203 void IntersectSets( const SfxItemSet
& rSource
, SfxItemSet
& rDest
);
205 Point
SetPointOfRectangle (const Rectangle
& rRect
, ChartAdjust eAdjust
);
207 void ItemsToFont(const SfxItemSet
& rSet
,Font
& rFont
);
209 BOOL
ChIsPointInsideRectangle( const Point
& rPoint
, const Rectangle
& rRect
);
213 /** @descr Extract an item for a given which id from one of two item
214 sets. If the the second item set rOverride is valid and
215 defines the requested item then return that item, else extract
216 the item from the base set. This has the same effect as merging
217 the override item set into the base set but with the advantage
218 that no item set has to be copied or even modified.
219 @param nWhich Specifies the requested item.
220 @param rBaseSet The item set from which the item is taken if
221 it the override item set is not valid or does not contain it.
222 @param rOverrideSet The item set first search for the requested
224 @param bOverrideIsValid If TRUE then rOverrideSet is search for the
225 requested item prior to rBaseSet. If it is FALSE then
226 rOverrideSet is ignored.
228 inline const SfxPoolItem
* GetItem (USHORT nWhich
,
229 const SfxItemSet
& rBaseSet
,
230 const SfxItemSet
& rOverrideSet
,
231 BOOL bOverrideIsValid
)
233 const SfxPoolItem
* pItem
;
235 if ( bOverrideIsValid
236 && rOverrideSet
.GetItemState (
237 nWhich
, TRUE
, &pItem
) == SFX_ITEM_SET
)
240 return rBaseSet
.GetItem (nWhich
);
244 } //namespace binfilter