1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __GLOBFUNC_HXX
#define __GLOBFUNC_HXX
#include <bf_svtools/bf_solar.h>
#include <bf_svx/label3d.hxx>
#include "schgroup.hxx"
#include "objid.hxx"
#include "datapoin.hxx"
#include "datarow.hxx"
#include "objadj.hxx"
#include <bf_svx/chrtitem.hxx>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/uno/Reference.h>
#include <vector>
namespace binfilter {
//Item-Debugging
#ifdef DBG_UTIL
class ChartModel;
extern void Dbg_DebugItems(SfxItemSet& rSet,ChartModel* pModel);
#define DBG_ITEMS(a,b) Dbg_DebugItems(a,b)
#else
#define DBG_ITEMS(a,b)
#endif
//hunderstel Grad (centi-degrees)in Rad
#define CDEG2RAD(fAngle) ( (double)(fAngle)*F_PI/18000.0 )
void AxisAttrOld2New(SfxItemSet &rDestSet,BOOL bClear,long nId);
Size GetRotatedTextSize(const Size& rSize,const long nDegrees);
long GetTextRotation(SfxItemSet &rAttr);
long GetTextRotation(SfxItemSet &rAttr,SvxChartTextOrient eOrient);
SdrObject *SetObjectAttr (SdrObject *pObj,
UINT16 nID,
BOOL bProtect,
BOOL bResize,
SfxItemSet *pAttr);
SdrObjList *CreateGroup (SdrObjList &rObjList,
UINT16 nID,
ULONG nIndex = CONTAINER_APPEND);
SchObjGroup *CreateSimpleGroup (UINT16 nID,
BOOL bProtect,
BOOL bResize);
void CubicSpline (XPolygon &pKnownPoints,
int n,
int splineSize,
XPolygon &pSplines);
void TVector (int n,
int k,
double *t);
double TLeft (double x,
int i,
int k,
double *t);
double TRight (double x,
int i,
int k,
double *t);
void BVector (double x,
int n,
int k,
double *b,
double *t);
void BSPoint (int n,
Point &p1,
Point &p2,
XPolygon &pKnownPoints,
double *b);
void approxMesh (int splineSize,
XPolygon &pSplines,
XPolygon &pKnownPoints,
int n,
int k);
double SizeBounds (double,
double,
BOOL);
void IncValue(double& rValue,
double fInc,
BOOL bLogarithm);
void DecValue(double& rValue,
double fInc,
BOOL bLogarithm);
Color RGBColor(ColorData nColorName);
String StackString(const String& aString);
void AdjustRect (Rectangle &rRect,
ChartAdjust eAdjust);
Size AdjustRotatedRect (const Rectangle &rRect,
ChartAdjust eAdjust,
const Rectangle &rOldRect);
void SetAdjust(ChartAdjust &eAdjust,
SvxChartTextOrient eOrient);
void SetTextPos(SdrTextObj &rTextObj,
const Point &rPos,SfxItemSet* pAttr);
void AdjustTextSize(SdrTextObj &rTextObj,
const Size &rTextSize);
Size GetOutputSize(SdrTextObj& rTextObj);
/** Creates an SchObjGroup containing SdrPathObjects, which are created from the
XPolygons given in the vector rPolygons. The items in rItems are applied to
all of the created objects.
Note: The ChartModel is needed for the CTOR of SchObjGroup.
*/
SdrObject * CreateErrorGroup(
ChartModel * pModel,
const ::std::vector< XPolygon > & rPolygons,
const SfxItemSet & rItems );
void CreateChartGroup( SchObjGroup* &, SdrObjList* & );
/** Intersect two SfxItemSets in the following way: Modify rDestSet such that
after this function completes there are only items left that are contained
in both sets and have equal content (using the != operator of SfxPoolItem)
Items that are set in either of the itemsets but are not equal are
invalidated. This is useful for dialogs. For a template-like usage, you
can remove the invalid items by calling ClearInvalidItems() at the result.
Note: The Intersect method of SfxItemSet works differently for equal and
non-equal which-ranges. If the ranges are equal it does something
like this method, otherwise it just removes items which are not
contained in the which range of the other item set.
@param rSourceSet is the item set which will be iterated over
@param rDestSet is the item set which is modified such that the condition
described above is maintained.
*/
void IntersectSets( const SfxItemSet & rSource, SfxItemSet & rDest );
Point SetPointOfRectangle (const Rectangle& rRect, ChartAdjust eAdjust);
void ItemsToFont(const SfxItemSet& rSet,Font& rFont);
BOOL ChIsPointInsideRectangle( const Point& rPoint, const Rectangle& rRect );
namespace sch {
/** @descr Extract an item for a given which id from one of two item
sets. If the the second item set rOverride is valid and
defines the requested item then return that item, else extract
the item from the base set. This has the same effect as merging
the override item set into the base set but with the advantage
that no item set has to be copied or even modified.
@param nWhich Specifies the requested item.
@param rBaseSet The item set from which the item is taken if
it the override item set is not valid or does not contain it.
@param rOverrideSet The item set first search for the requested
item.
@param bOverrideIsValid If TRUE then rOverrideSet is search for the
requested item prior to rBaseSet. If it is FALSE then
rOverrideSet is ignored.
*/
inline const SfxPoolItem * GetItem (USHORT nWhich,
const SfxItemSet & rBaseSet,
const SfxItemSet & rOverrideSet,
BOOL bOverrideIsValid)
{
const SfxPoolItem * pItem;
if ( bOverrideIsValid
&& rOverrideSet.GetItemState (
nWhich, TRUE, &pItem) == SFX_ITEM_SET)
return pItem;
else
return rBaseSet.GetItem (nWhich);
}
}
} //namespace binfilter
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|