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 #include <tools/debug.hxx>
30 #include <soldep/depwin.hxx>
31 #include <soldep/depper.hxx>
32 #include <soldep/connctr.hxx>
33 #include <soldep/objwin.hxx>
37 DepWin::DepWin( Window
* pParent
, WinBits nWinStyle
) :
38 Window( pParent
, nWinStyle
),
39 mbStartNewCon( FALSE
),
40 maNewConStart( 0, 0 ),
42 // mpSelectedProject( NULL ) unbekannt
45 if ( !pParent
->IsChildNotify() )
46 pParent
->EnableChildNotify( TRUE
);
47 // if ( !pParent->IsAllResizeEnabled())
48 // pParent->EnableAllResize( TRUE );
49 SetUpdateMode( TRUE
);
50 SetPosSizePixel( Point(0,0), Size( 2000, 2000 )); //Size of the scrollable Window
51 mpPopup
= new PopupMenu();
57 while( ConList
.Count() > 0 )
59 delete ConList
.GetObject( 0 );
65 void DepWin::AddConnector( Connector
* pNewCon
)
67 ConList
.Insert( pNewCon
);
70 void DepWin::RemoveConnector( Connector
* pOldCon
)
72 ConList
.Remove( pOldCon
);
75 void DepWin::NewConnector( ObjectWin
* pWin
)
81 maNewConStart
= pWin
->GetFixPoint(Point(0,0));
85 Invalidate( Rectangle( maNewConStart
, maNewConEnd
));
86 if ( pWin
!= mpNewConWin
)
88 // Connector* pConctr;
89 // pConctr = new Connector( this, WB_NOBORDER );
90 // pConctr->Initialize( mpNewConWin, pWin );
92 // AddConnector has been moved to soldep
93 // mpDepperDontuseme->AddConnector( mpNewConWin, pWin );
96 mbStartNewCon
= FALSE
;
101 void DepWin::Paint( const Rectangle
& rRect
)
104 ULONG nListCount
= ConList
.Count();
106 for ( i
=0 ; i
< nListCount
; i
++ )
108 ConList
.GetObject( i
)->Paint( aEmptyRect
);
112 DrawLine( maNewConStart
, maNewConEnd
);
116 void DepWin::DrawOutput( OutputDevice
* pDevice
, const Point
& rOffset
)
119 ULONG nListCount
= ConList
.Count();
121 for ( i
=0 ; i
< nListCount
; i
++ )
123 ConList
.GetObject( i
)->DrawOutput( pDevice
, rOffset
);
127 pDevice
->DrawLine( maNewConStart
, maNewConEnd
);
131 void DepWin::MouseButtonUp( const MouseEvent
& rMEvt
)
133 if ( rMEvt
.IsRight() )
135 mpPopup
->Execute( this, rMEvt
.GetPosPixel());
139 void DepWin::MouseMove( const MouseEvent
& rMEvt
)
143 Invalidate( Rectangle( maNewConStart
, maNewConEnd
));
144 maNewConEnd
= PixelToLogic(rMEvt
.GetPosPixel());
145 maNewConStart
= mpNewConWin
->GetFixPoint( maNewConEnd
);
150 ConnectorList
* DepWin::GetConnectorList()
155 void DepWin::SetPopupHdl( void* pHdl
)
157 mpPopup
->SetSelectHdl( LINK( pHdl
, Depper
, PopupSelected
));
160 void DepWin::Command( const CommandEvent
& rEvent
)
162 //mpDepperDontuseme->GetGraphWin()->Command( rEvent );
163 GetParent()->Command( rEvent
);