merge the formfield patch from ooo-build
[ooovba.git] / soldep / source / depwin.cxx
blob30a64d49995c8ce2bfc515bb6c74019297ca52e9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: depwin.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <tools/debug.hxx>
33 #include <soldep/depwin.hxx>
34 #include <soldep/depper.hxx>
35 #include <soldep/connctr.hxx>
36 #include <soldep/objwin.hxx>
38 Bitmap* pWinCopy;
40 DepWin::DepWin( Window* pParent, WinBits nWinStyle ) :
41 Window( pParent, nWinStyle ),
42 mbStartNewCon( FALSE ),
43 maNewConStart( 0, 0 ),
44 maNewConEnd( 0, 0 )
45 // mpSelectedProject( NULL ) unbekannt
46 // mpCapturer( NULL )
48 if ( !pParent->IsChildNotify() )
49 pParent->EnableChildNotify( TRUE );
50 // if ( !pParent->IsAllResizeEnabled())
51 // pParent->EnableAllResize( TRUE );
52 SetUpdateMode( TRUE );
53 SetPosSizePixel( Point(0,0), Size( 2000, 2000 )); //Size of the scrollable Window
54 mpPopup = new PopupMenu();
57 DepWin::~DepWin()
59 Hide();
60 while( ConList.Count() > 0 )
62 delete ConList.GetObject( 0 );
64 // if ( mpPopup )
65 /// delete mpPopup;
68 void DepWin::AddConnector( Connector* pNewCon )
70 ConList.Insert( pNewCon );
73 void DepWin::RemoveConnector( Connector* pOldCon )
75 ConList.Remove( pOldCon );
78 void DepWin::NewConnector( ObjectWin* pWin )
80 if ( !mbStartNewCon )
82 mpNewConWin = pWin;
83 mbStartNewCon = TRUE;
84 maNewConStart = pWin->GetFixPoint(Point(0,0));
86 else
88 Invalidate( Rectangle( maNewConStart, maNewConEnd ));
89 if ( pWin != mpNewConWin )
91 // Connector* pConctr;
92 // pConctr = new Connector( this, WB_NOBORDER );
93 // pConctr->Initialize( mpNewConWin, pWin );
95 // AddConnector has been moved to soldep
96 // mpDepperDontuseme->AddConnector( mpNewConWin, pWin );
98 mpNewConWin = 0L;
99 mbStartNewCon = FALSE;
104 void DepWin::Paint( const Rectangle& rRect )
106 ULONG i = 0;
107 ULONG nListCount = ConList.Count();
109 for ( i=0 ; i < nListCount ; i++ )
111 ConList.GetObject( i )->Paint( aEmptyRect );
113 if ( mbStartNewCon )
115 DrawLine( maNewConStart, maNewConEnd );
119 void DepWin::DrawOutput( OutputDevice* pDevice, const Point& rOffset )
121 ULONG i = 0;
122 ULONG nListCount = ConList.Count();
124 for ( i=0 ; i < nListCount ; i++ )
126 ConList.GetObject( i )->DrawOutput( pDevice, rOffset );
128 if ( mbStartNewCon )
130 pDevice->DrawLine( maNewConStart, maNewConEnd );
134 void DepWin::MouseButtonUp( const MouseEvent& rMEvt )
136 if ( rMEvt.IsRight() )
138 mpPopup->Execute( this, rMEvt.GetPosPixel());
142 void DepWin::MouseMove( const MouseEvent& rMEvt )
144 if ( mbStartNewCon )
146 Invalidate( Rectangle( maNewConStart, maNewConEnd ));
147 maNewConEnd = PixelToLogic(rMEvt.GetPosPixel());
148 maNewConStart = mpNewConWin->GetFixPoint( maNewConEnd );
153 ConnectorList* DepWin::GetConnectorList()
155 return &ConList;
158 void DepWin::SetPopupHdl( void* pHdl )
160 mpPopup->SetSelectHdl( LINK( pHdl, Depper, PopupSelected ));
163 void DepWin::Command( const CommandEvent& rEvent)
165 //mpDepperDontuseme->GetGraphWin()->Command( rEvent );
166 GetParent()->Command( rEvent );