xref: /aoo42x/main/svx/source/table/tablehandles.hxx (revision 3334a7e6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_TABLEHANDLES_HXX
25 #define _SVX_TABLEHANDLES_HXX
26 
27 #include <svx/sdr/overlay/overlayobject.hxx>
28 
29 #include <svx/svdhdl.hxx>
30 
31 // --------------------------------------------------------------------
32 
33 namespace sdr { namespace table {
34 
35 enum TableEdgeState { Empty, Invisible, Visible };
36 
37 struct TableEdge
38 {
39 	sal_Int32 mnStart;
40 	sal_Int32 mnEnd;
41 	TableEdgeState meState;
42 
43 	TableEdge() : mnStart(0), mnEnd(0), meState(Empty) {}
44 };
45 
46 typedef std::vector< TableEdge > TableEdgeVector;
47 
48 class TableEdgeHdl : public SdrHdl
49 {
50 public:
51 	TableEdgeHdl( const Point& rPnt, bool bHorizontal, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nEdges );
52 
53 	sal_Int32 GetValidDragOffset( const SdrDragStat& rDrag ) const;
54 
55 	virtual Pointer GetPointer() const;
56 
57 	void SetEdge( sal_Int32 nEdge, sal_Int32 nStart, sal_Int32 nEnd, TableEdgeState nState );
58 
59 	bool IsHorizontalEdge() const { return mbHorizontal; }
60 
61     basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
62 	void getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const;
63 
64 protected:
65 	// create marker for this kind
66 	virtual void CreateB2dIAObject();
67 
68 private:
69 	bool mbHorizontal;
70 	sal_Int32 mnMin, mnMax;
71 	TableEdgeVector maEdges;
72 };
73 
74 class TableBorderHdl : public SdrHdl
75 {
76 public:
77 	TableBorderHdl( const Rectangle& rRect );
78 
79 	virtual Pointer GetPointer() const;
80 
81 protected:
82 	// create marker for this kind
83 	virtual void CreateB2dIAObject();
84 
85 private:
86 	Rectangle maRectangle;
87 };
88 
89 } // end of namespace table
90 } // end of namespace sdr
91 
92 #endif
93