xref: /aoo41x/main/soldep/inc/soldep/connctr.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 
29 #ifndef _FMRWRK_CONNCTR_HXX
30 #define _FMRWRK_CONNCTR_HXX
31 
32 
33 #include <vcl/window.hxx>
34 #include <soldep/listmacr.hxx>
35 #include <tools/stream.hxx>
36 
37 class DepWin;
38 class ObjectWin;
39 
40 static Rectangle aEmptyRect( Point( 0, 0), Point( 0, 0));
41 
42 class Connector
43 {
44 	ObjectWin *mpStartWin, *mpEndWin;
45 	sal_uIntPtr mnStartId, mnEndId;
46 	Point mStart, mEnd, mCenter;
47 	DepWin* mpParent;
48 
49 	sal_Bool bVisible;
50     sal_Bool mbHideIndependend;
51 	static sal_Bool msbHideMode;
52 
53 
54 public:
55 	double len;
56 	Connector( DepWin* pParent, WinBits nWinStyle );
57 	~Connector();
58 
59 	void 	Initialize( ObjectWin* pStartWin, ObjectWin* pEndWin, sal_Bool bVis = sal_False );
60 	Point 	GetMiddle();
61 	void	Paint( const Rectangle& rRect );
62 	void	UpdatePosition( ObjectWin* pWin, sal_Bool bPaint = sal_True );
63 	sal_uInt16	Save( SvFileStream& rOutFile );
64 	sal_uInt16	Load( SvFileStream& rInFile );
65 	sal_uIntPtr	GetStartId(){ return mnStartId; };
66 	sal_uIntPtr	GetEndId(){ return mnEndId; };
67 	ObjectWin*	GetStartWin(){ return mpStartWin; };
68 	ObjectWin*	GetEndWin(){ return mpEndWin; };
69 	ObjectWin*	GetOtherWin( ObjectWin* pWin );
70 	sal_uIntPtr	GetOtherId( sal_uIntPtr nId );
71 	sal_uIntPtr	GetLen();
72 	sal_Bool 	IsStart( ObjectWin* pWin );
73     void    SetHideIndependend( sal_Bool bHide) { mbHideIndependend = bHide; };
74 
75 	sal_Bool 	IsVisible() { return bVisible; }
76     void    SetVisibility( sal_Bool visible ) { bVisible = visible; }
77 	void	UpdateVisibility();
78 	void	SetHideMode(sal_Bool bHide) { msbHideMode = bHide; };
79     void    DrawOutput( OutputDevice* pDevice, const Point& rOffset  );
80 };
81 
82 DECLARE_LIST( ConnectorList, Connector* )
83 
84 #endif
85