1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #ifndef _SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
29 #define _SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
30 
31 #include <svx/sdr/overlay/overlayobject.hxx>
32 #include <tools/gen.hxx>
33 #include "svx/svxdllapi.h"
34 
35 //////////////////////////////////////////////////////////////////////////////
36 
37 #define	DEFAULT_VALUE_FOR_HITTEST_PIXEL			(2L)
38 
39 //////////////////////////////////////////////////////////////////////////////
40 
41 namespace sdr
42 {
43 	namespace overlay
44 	{
45 		class SVX_DLLPUBLIC OverlayObjectList
46 		{
47 		protected:
48 			// the vector of OverlayObjects
49 			OverlayObjectVector						maVector;
50 
51 			// default value for HiTestPixel
52 			sal_uInt32 getDefaultValueForHitTestPixel() const { return 4L; }
53 
54 		public:
55 			OverlayObjectList() {}
56 			~OverlayObjectList();
57 
58 			// clear list, this includes deletion of all contained objects
59 			void clear();
60 
61 			// append/remove objects
62 			void append(OverlayObject& rOverlayObject) { maVector.push_back(&rOverlayObject); }
63 			void remove(OverlayObject& rOverlayObject);
64 
65 			// access to objects
66 			sal_uInt32 count() const { return maVector.size(); }
67 			OverlayObject& getOverlayObject(sal_uInt32 nIndex) const { return *(maVector[nIndex]); }
68 
69 			// Hittest with logical coordinates
70 			bool isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance = 0.0) const;
71 
72 			// Hittest with pixel coordinates and pixel tolerance
73 			bool isHitPixel(const Point& rDiscretePosition, sal_uInt32 fDiscreteTolerance = DEFAULT_VALUE_FOR_HITTEST_PIXEL) const;
74 
75 			// calculate BaseRange of all included OverlayObjects and return
76 			basegfx::B2DRange getBaseRange() const;
77 		};
78 	} // end of namespace overlay
79 } // end of namespace sdr
80 
81 //////////////////////////////////////////////////////////////////////////////
82 
83 #endif //_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
84 
85 // eof
86