merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / inc / RelativePositionHelper.hxx
blob1dd0617236ad6655e31506830c6cb55baab8c40b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _CHART2_RELATIVEPOSITIONHELPER_HXX
29 #define _CHART2_RELATIVEPOSITIONHELPER_HXX
31 #include <com/sun/star/chart2/RelativePosition.hpp>
32 #include <com/sun/star/chart2/RelativeSize.hpp>
33 #include <com/sun/star/drawing/Alignment.hpp>
34 #include <com/sun/star/awt/Point.hpp>
35 #include <com/sun/star/awt/Size.hpp>
36 #include "charttoolsdllapi.hxx"
38 //.............................................................................
39 namespace chart
41 //.............................................................................
43 //-----------------------------------------------------------------------------
44 /**
47 class OOO_DLLPUBLIC_CHARTTOOLS RelativePositionHelper
49 public:
50 /** returns the upper left corner of an object that has size aObjectSize and
51 where the point indicated by aAnchor has coordinates indicated by aPoint
52 ( e.g. if aAnchor equals BOTTOM_LEFT, aPoint describes the
53 coordinates of the bottom left corner of an object with size aObjectSize )
55 static ::com::sun::star::awt::Point
56 getUpperLeftCornerOfAnchoredObject(
57 ::com::sun::star::awt::Point aPoint,
58 ::com::sun::star::awt::Size aObjectSize,
59 ::com::sun::star::drawing::Alignment aAnchor );
61 /** returns the center of an object that has size aObjectSize and
62 where the point indicated by aAnchor has coordinates indicated by aPoint
63 ( e.g. if aAnchor equals BOTTOM_LEFT, aPoint describes the
64 coordinates of the bottom left corner of an object with size aObjectSize )
66 static ::com::sun::star::awt::Point
67 getCenterOfAnchoredObject(
68 ::com::sun::star::awt::Point aPoint,
69 ::com::sun::star::awt::Size aUnrotatedObjectSize,
70 ::com::sun::star::drawing::Alignment aAnchor,
71 double fAnglePi );
73 /** Returns a relative position that is the same point after the anchor has
74 been changed to the given one. The passed object size is taken into
75 account for shifting the position.
77 SAL_DLLPRIVATE static ::com::sun::star::chart2::RelativePosition
78 getReanchoredPosition(
79 const ::com::sun::star::chart2::RelativePosition & rPosition,
80 const ::com::sun::star::chart2::RelativeSize & rObjectSize,
81 ::com::sun::star::drawing::Alignment aNewAnchor );
83 /** grows a relative size about the given amount and shifts the given
84 position such that the resize is relative to the former rectangle's
85 center.
87 @param bCheck If </TRUE>, the resize is only done, if after
88 transformation, the position and size are within the bounds [0,1].
90 @return </TRUE>, if changes were applied.
92 <p>That means, if the position's alignment is center, the position will
93 not change at all.</p>
95 static bool centerGrow(
96 ::com::sun::star::chart2::RelativePosition & rInOutPosition,
97 ::com::sun::star::chart2::RelativeSize & rInOutSize,
98 double fAmountX, double fAmountY,
99 bool bCheck = true );
101 /** shifts a relative position about the given amount
103 @param bCheck If </TRUE>, the shift is only done, if after
104 transformation, the object represented by the position
105 rInOutPosition and its size rObjectSize the position and size are
106 within the bounds [0,1].
108 @return </TRUE>, if changes were applied.
110 static bool moveObject(
111 ::com::sun::star::chart2::RelativePosition & rInOutPosition,
112 const ::com::sun::star::chart2::RelativeSize & rObjectSize,
113 double fAmountX, double fAmountY,
114 bool bCheck = true );
117 //.............................................................................
118 } //namespace chart
119 //.............................................................................
120 #endif