xref: /aoo41x/main/svx/source/table/tablehandles.hxx (revision cdf0e10c)
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 _SVX_TABLEHANDLES_HXX
29 #define _SVX_TABLEHANDLES_HXX
30 
31 #include <svx/sdr/overlay/overlayobject.hxx>
32 
33 #include <svx/svdhdl.hxx>
34 
35 // --------------------------------------------------------------------
36 
37 namespace sdr { namespace table {
38 
39 enum TableEdgeState { Empty, Invisible, Visible };
40 
41 struct TableEdge
42 {
43 	sal_Int32 mnStart;
44 	sal_Int32 mnEnd;
45 	TableEdgeState meState;
46 
47 	TableEdge() : mnStart(0), mnEnd(0), meState(Empty) {}
48 };
49 
50 typedef std::vector< TableEdge > TableEdgeVector;
51 
52 class TableEdgeHdl : public SdrHdl
53 {
54 public:
55 	TableEdgeHdl( const Point& rPnt, bool bHorizontal, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nEdges );
56 
57 	sal_Int32 GetValidDragOffset( const SdrDragStat& rDrag ) const;
58 
59 	virtual Pointer GetPointer() const;
60 
61 	void SetEdge( sal_Int32 nEdge, sal_Int32 nStart, sal_Int32 nEnd, TableEdgeState nState );
62 
63 	bool IsHorizontalEdge() const { return mbHorizontal; }
64 
65     basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
66 	void getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const;
67 
68 protected:
69 	// create marker for this kind
70 	virtual void CreateB2dIAObject();
71 
72 private:
73 	bool mbHorizontal;
74 	sal_Int32 mnMin, mnMax;
75 	TableEdgeVector maEdges;
76 };
77 
78 class TableBorderHdl : public SdrHdl
79 {
80 public:
81 	TableBorderHdl( const Rectangle& rRect );
82 
83 	virtual Pointer GetPointer() const;
84 
85 protected:
86 	// create marker for this kind
87 	virtual void CreateB2dIAObject();
88 
89 private:
90 	Rectangle maRectangle;
91 };
92 
93 } // end of namespace table
94 } // end of namespace sdr
95 
96 #endif
97