xref: /AOO41X/main/soldep/source/objwin.cxx (revision d9e04f7d457e8d4292f3a8dc854ee7656a676fbb)
1*d9e04f7dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*d9e04f7dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*d9e04f7dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*d9e04f7dSAndrew Rist  * distributed with this work for additional information
6*d9e04f7dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*d9e04f7dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*d9e04f7dSAndrew Rist  * "License"); you may not use this file except in compliance
9*d9e04f7dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*d9e04f7dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*d9e04f7dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*d9e04f7dSAndrew Rist  * software distributed under the License is distributed on an
15*d9e04f7dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d9e04f7dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*d9e04f7dSAndrew Rist  * specific language governing permissions and limitations
18*d9e04f7dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*d9e04f7dSAndrew Rist  *************************************************************/
21*d9e04f7dSAndrew Rist 
22*d9e04f7dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <tools/list.hxx>
25cdf0e10cSrcweir #include <tools/debug.hxx>
26cdf0e10cSrcweir #include <vcl/svapp.hxx>
27cdf0e10cSrcweir #include <vcl/help.hxx>
28cdf0e10cSrcweir #include <vcl/wall.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <soldep/objwin.hxx>
31cdf0e10cSrcweir #include <soldep/depwin.hxx>
32cdf0e10cSrcweir //#include "depapp.hxx"
33cdf0e10cSrcweir #include <soldep/depper.hxx>
34cdf0e10cSrcweir //#include "prjdep.hxx"
35cdf0e10cSrcweir #include <soldep/connctr.hxx>
36cdf0e10cSrcweir #include <stdio.h>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir static Color aDefaultColor = 0L;
39cdf0e10cSrcweir static Wallpaper* pDefaultWallpaper = 0L;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir // Initialize static class member
42cdf0e10cSrcweir sal_Bool ObjectWin::msbHideMode = sal_False;
43cdf0e10cSrcweir sal_uIntPtr ObjectWin::msnGlobalViewMask = 0;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
46cdf0e10cSrcweir sal_uInt32 aColorMap[] = {
47cdf0e10cSrcweir     RGB_COLORDATA( 0xFF, 0xFF, 0x80 ),             //MARKMODE_DEFAULT    0
48cdf0e10cSrcweir 	COL_GREEN,              //MARKMODE_DEPENDING  1
49cdf0e10cSrcweir 	COL_RED,                //MARKMODE_NEEDED     2
50cdf0e10cSrcweir 	COL_MAGENTA,            //1+2
51cdf0e10cSrcweir     COL_GRAY,               //MARKMODE_ACTIVATED  4
52cdf0e10cSrcweir 	COL_LIGHTGREEN,         //1+4
53cdf0e10cSrcweir 	COL_LIGHTRED,           //2+4
54cdf0e10cSrcweir 	COL_LIGHTMAGENTA,       //1+2+4
55cdf0e10cSrcweir 	COL_BLUE,               //MARKMODE_SELECTED   8
56cdf0e10cSrcweir 	COL_LIGHTGRAY,          //1+8
57cdf0e10cSrcweir 	COL_CYAN,               //2+8
58cdf0e10cSrcweir 	COL_LIGHTCYAN,          //1+2+8
59cdf0e10cSrcweir 	COL_LIGHTBLUE,          //4+8
60cdf0e10cSrcweir 	COL_BROWN,              //1+4+8
61cdf0e10cSrcweir 	COL_BLACK,              //2+4+8
62cdf0e10cSrcweir 	COL_BLUE                //1+2+4+8
63cdf0e10cSrcweir };
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir //
67cdf0e10cSrcweir // class ObjectWin
68cdf0e10cSrcweir //
69cdf0e10cSrcweir 
70cdf0e10cSrcweir /*****************************************************************************/
ObjectWin(Window * pParent,WinBits nWinStyle)71cdf0e10cSrcweir ObjectWin::ObjectWin( Window* pParent, WinBits nWinStyle )
72cdf0e10cSrcweir /*****************************************************************************/
73cdf0e10cSrcweir 				: Window( pParent, nWinStyle ),
74cdf0e10cSrcweir 				msBodyText( "" ),
75cdf0e10cSrcweir 				msTipText( "" ),
76cdf0e10cSrcweir 				mnObjectId( 0 ),
77cdf0e10cSrcweir 				mnMarkMode( 0 ),
78cdf0e10cSrcweir 				mnViewMask( 0 ),
79cdf0e10cSrcweir 				mbVisible( sal_False ),
80cdf0e10cSrcweir 				mbMenuExecute( sal_False ),
81cdf0e10cSrcweir 				mbVisited( sal_False ),
82cdf0e10cSrcweir 				mnRootDist( 0 ),
83cdf0e10cSrcweir 				mnHeadDist( 0 ),
84cdf0e10cSrcweir 				mbFixed( sal_False )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir     SetBackground( Wallpaper( aColorMap[0] ));
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	aTipTimer.SetTimeout( 500 );
89cdf0e10cSrcweir 	aTipTimer.SetTimeoutHdl(
90cdf0e10cSrcweir 	LINK( this, ObjectWin, TipHdl ));
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     SetFont( Font( GetFont() ) );
93cdf0e10cSrcweir     Font aFont( GetFont() );
94cdf0e10cSrcweir 	Size aSize = aFont.GetSize();
95cdf0e10cSrcweir 	aFont.SetSize( aSize );
96cdf0e10cSrcweir 	SetFont( aFont );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     EnableClipSiblings();
99cdf0e10cSrcweir 	SetZOrder( NULL, WINDOW_ZORDER_FIRST );
100cdf0e10cSrcweir 	mpPopup = new PopupMenu();
101cdf0e10cSrcweir 	mpPopup->InsertItem( OBJWIN_EDIT_TEXT, String::CreateFromAscii( "Details" ));
102cdf0e10cSrcweir 	mpPopup->InsertItem( OBJWIN_ADD_CONNECTOR, String::CreateFromAscii( "New connection" ));
103cdf0e10cSrcweir 	mpPopup->InsertItem( OBJWIN_REMOVE_WIN, String::CreateFromAscii( "Remove object" ));
104cdf0e10cSrcweir 	mpPopup->InsertItem( OBJWIN_VIEW_CONTENT, String::CreateFromAscii( "View content" ));
105cdf0e10cSrcweir //	mpPopup->InsertSeparator();
106cdf0e10cSrcweir 	mpPopup->SetSelectHdl( LINK( this, ObjectWin, PopupSelected ));
107cdf0e10cSrcweir 	mpPopup->SetDeactivateHdl( LINK( this, ObjectWin, PopupDeactivated ));
108cdf0e10cSrcweir 	mnPopupStaticItems = mpPopup->GetItemCount();
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     if ( ! pDefaultWallpaper )
111cdf0e10cSrcweir 	{
112cdf0e10cSrcweir 		pDefaultWallpaper = new Wallpaper( GetBackground() );
113cdf0e10cSrcweir 		aDefaultColor = GetTextColor();
114cdf0e10cSrcweir     }
115cdf0e10cSrcweir 	Hide();
116cdf0e10cSrcweir }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir /*****************************************************************************/
~ObjectWin()119cdf0e10cSrcweir ObjectWin::~ObjectWin()
120cdf0e10cSrcweir /*****************************************************************************/
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	while ( mConnections.Count() > 0 )
123cdf0e10cSrcweir 	{
124cdf0e10cSrcweir 		delete mConnections.GetObject( 0 );
125cdf0e10cSrcweir 	}
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
SetHideMode(sal_Bool bHide)128cdf0e10cSrcweir void ObjectWin::SetHideMode(sal_Bool bHide)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir 	msbHideMode = bHide;
131cdf0e10cSrcweir 	mConnections.GetObject(0)->SetHideMode(msbHideMode);
132cdf0e10cSrcweir }
133cdf0e10cSrcweir 
ToggleHideMode()134cdf0e10cSrcweir sal_Bool ObjectWin::ToggleHideMode()
135cdf0e10cSrcweir {
136cdf0e10cSrcweir 	msbHideMode = !msbHideMode;
137cdf0e10cSrcweir 	mConnections.GetObject(0)->SetHideMode(msbHideMode);
138cdf0e10cSrcweir 	return msbHideMode;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir /*****************************************************************************/
SetViewMask(sal_uIntPtr nMask)142cdf0e10cSrcweir void ObjectWin::SetViewMask( sal_uIntPtr nMask )
143cdf0e10cSrcweir /*****************************************************************************/
144cdf0e10cSrcweir {
145cdf0e10cSrcweir 	mnViewMask = nMask;
146cdf0e10cSrcweir     // Compares
147cdf0e10cSrcweir 	if ( mnViewMask & msnGlobalViewMask) {
148cdf0e10cSrcweir 		mbVisible = sal_True;
149cdf0e10cSrcweir 		Show();
150cdf0e10cSrcweir 	}
151cdf0e10cSrcweir 	else {
152cdf0e10cSrcweir 		Hide();
153cdf0e10cSrcweir 		mbVisible = sal_False;
154cdf0e10cSrcweir 	}
155cdf0e10cSrcweir 	for ( sal_uIntPtr i = 0; i < mConnections.Count(); i++ )
156cdf0e10cSrcweir 		mConnections.GetObject( i )->UpdateVisibility();
157cdf0e10cSrcweir }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir /*****************************************************************************/
SetBodyText(const ByteString & rNewString)160cdf0e10cSrcweir void ObjectWin::SetBodyText( const ByteString& rNewString )
161cdf0e10cSrcweir /*****************************************************************************/
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	msBodyText = rNewString;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir /*****************************************************************************/
GetBodyText()167cdf0e10cSrcweir ByteString& ObjectWin::GetBodyText()
168cdf0e10cSrcweir /*****************************************************************************/
169cdf0e10cSrcweir {
170cdf0e10cSrcweir 	return msBodyText;
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir /*****************************************************************************/
SetTipText(const ByteString & rNewString)174cdf0e10cSrcweir void ObjectWin::SetTipText( const ByteString& rNewString )
175cdf0e10cSrcweir /*****************************************************************************/
176cdf0e10cSrcweir {
177cdf0e10cSrcweir 	msTipText = rNewString;
178cdf0e10cSrcweir }
179cdf0e10cSrcweir 
180cdf0e10cSrcweir /*****************************************************************************/
GetTipText()181cdf0e10cSrcweir ByteString& ObjectWin::GetTipText()
182cdf0e10cSrcweir /*****************************************************************************/
183cdf0e10cSrcweir {
184cdf0e10cSrcweir 	return msTipText;
185cdf0e10cSrcweir }
186cdf0e10cSrcweir 
187cdf0e10cSrcweir /*****************************************************************************/
GetFixPoint(const Point & rRefPoint,sal_Bool bUseRealPos)188cdf0e10cSrcweir Point ObjectWin::GetFixPoint( const Point& rRefPoint, sal_Bool bUseRealPos )
189cdf0e10cSrcweir /*****************************************************************************/
190cdf0e10cSrcweir {
191cdf0e10cSrcweir 	Point aLocalPoint;
192cdf0e10cSrcweir 	if ( bUseRealPos )
193cdf0e10cSrcweir 		aLocalPoint = GetPosPixel();
194cdf0e10cSrcweir 	else
195cdf0e10cSrcweir 		aLocalPoint = GetCalcPosPixel();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	Size aLocalSize = GetSizePixel();
198cdf0e10cSrcweir 	Point aRetPoint;
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 	sal_uInt16 nRefX = aLocalPoint.X() + aLocalSize.Width() / 2 ;
201cdf0e10cSrcweir 	sal_uInt16 nRefY = aLocalPoint.Y() + aLocalSize.Height() / 2 ;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 	// always false...
204cdf0e10cSrcweir 	//if ( nRefX < 0 ) nRefX = 0;
205cdf0e10cSrcweir 	//if ( nRefY < 0 ) nRefY = 0;
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	if ( rRefPoint.X() > nRefX )
208cdf0e10cSrcweir 	{
209cdf0e10cSrcweir 		if ( rRefPoint.Y() > nRefY )
210cdf0e10cSrcweir 		{
211cdf0e10cSrcweir 			if 	( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
212cdf0e10cSrcweir 			{
213cdf0e10cSrcweir 				aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width();
214cdf0e10cSrcweir 				aRetPoint.Y() = nRefY;
215cdf0e10cSrcweir 			}
216cdf0e10cSrcweir 			else
217cdf0e10cSrcweir 			{
218cdf0e10cSrcweir 				aRetPoint.X() = nRefX;
219cdf0e10cSrcweir 				aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height();
220cdf0e10cSrcweir 			}
221cdf0e10cSrcweir 		}
222cdf0e10cSrcweir 		else
223cdf0e10cSrcweir 		{
224cdf0e10cSrcweir 			if 	( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
225cdf0e10cSrcweir 			{
226cdf0e10cSrcweir 				aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width();
227cdf0e10cSrcweir 				aRetPoint.Y() = nRefY;
228cdf0e10cSrcweir 			}
229cdf0e10cSrcweir 			else
230cdf0e10cSrcweir 			{
231cdf0e10cSrcweir 				aRetPoint.X() = nRefX;
232cdf0e10cSrcweir 				aRetPoint.Y() = aLocalPoint.Y();
233cdf0e10cSrcweir 			}
234cdf0e10cSrcweir 		}
235cdf0e10cSrcweir 	}
236cdf0e10cSrcweir 	else
237cdf0e10cSrcweir 	{
238cdf0e10cSrcweir 		if ( rRefPoint.Y() > nRefY )
239cdf0e10cSrcweir 		{
240cdf0e10cSrcweir 			if 	( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
241cdf0e10cSrcweir 			{
242cdf0e10cSrcweir 				aRetPoint.X() = aLocalPoint.X();
243cdf0e10cSrcweir 				aRetPoint.Y() = nRefY;
244cdf0e10cSrcweir 			}
245cdf0e10cSrcweir 			else
246cdf0e10cSrcweir 			{
247cdf0e10cSrcweir 				aRetPoint.X() = nRefX;
248cdf0e10cSrcweir 				aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height();
249cdf0e10cSrcweir 			}
250cdf0e10cSrcweir 		}
251cdf0e10cSrcweir 		else
252cdf0e10cSrcweir 		{
253cdf0e10cSrcweir 			if 	( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
254cdf0e10cSrcweir 			{
255cdf0e10cSrcweir 				aRetPoint.X() = aLocalPoint.X();
256cdf0e10cSrcweir 				aRetPoint.Y() = nRefY;
257cdf0e10cSrcweir 			}
258cdf0e10cSrcweir 			else
259cdf0e10cSrcweir 			{
260cdf0e10cSrcweir 				aRetPoint.X() = nRefX;
261cdf0e10cSrcweir 				aRetPoint.Y() = aLocalPoint.Y();
262cdf0e10cSrcweir 			}
263cdf0e10cSrcweir 		}
264cdf0e10cSrcweir 	}
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	return PixelToLogic(aRetPoint);
267cdf0e10cSrcweir 
268cdf0e10cSrcweir }
269cdf0e10cSrcweir 
270cdf0e10cSrcweir /*****************************************************************************/
AddConnector(Connector * pNewCon)271cdf0e10cSrcweir void ObjectWin::AddConnector( Connector* pNewCon )
272cdf0e10cSrcweir /*****************************************************************************/
273cdf0e10cSrcweir {
274cdf0e10cSrcweir 	mConnections.Insert( pNewCon );
275cdf0e10cSrcweir }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir /*****************************************************************************/
ConnectionExistsInAnyDirection(ObjectWin * pWin)278cdf0e10cSrcweir sal_Bool ObjectWin::ConnectionExistsInAnyDirection( ObjectWin *pWin )
279cdf0e10cSrcweir /*****************************************************************************/
280cdf0e10cSrcweir {
281cdf0e10cSrcweir 	for ( sal_uIntPtr i = 0; i < mConnections.Count(); i++ )
282cdf0e10cSrcweir 		if ( mConnections.GetObject( i )->GetOtherWin( this ) == pWin )
283cdf0e10cSrcweir 			return sal_True;
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	return sal_False;
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir /*****************************************************************************/
RemoveConnector(Connector * pOldCon)289cdf0e10cSrcweir void ObjectWin::RemoveConnector( Connector* pOldCon )
290cdf0e10cSrcweir /*****************************************************************************/
291cdf0e10cSrcweir {
292cdf0e10cSrcweir 	mConnections.Remove( pOldCon );
293cdf0e10cSrcweir }
294cdf0e10cSrcweir 
295cdf0e10cSrcweir /*****************************************************************************/
GetConnector(sal_uIntPtr nIndex)296cdf0e10cSrcweir Connector* ObjectWin::GetConnector( sal_uIntPtr nIndex )
297cdf0e10cSrcweir /*****************************************************************************/
298cdf0e10cSrcweir {
299cdf0e10cSrcweir 	sal_uIntPtr nConCount = mConnections.Count();
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	if ( nIndex < nConCount )
302cdf0e10cSrcweir 		return mConnections.GetObject( nIndex );
303cdf0e10cSrcweir 	return NULL;
304cdf0e10cSrcweir }
305cdf0e10cSrcweir 
306cdf0e10cSrcweir /*****************************************************************************/
GetConnector(sal_uIntPtr nStartId,sal_uIntPtr nEndId)307cdf0e10cSrcweir Connector* ObjectWin::GetConnector( sal_uIntPtr nStartId, sal_uIntPtr nEndId )
308cdf0e10cSrcweir /*****************************************************************************/
309cdf0e10cSrcweir {
310cdf0e10cSrcweir 	if ( mnObjectId != nStartId )
311cdf0e10cSrcweir 		return NULL;
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	sal_uInt16 i;
314cdf0e10cSrcweir 	Connector* pCon;
315cdf0e10cSrcweir 	sal_uIntPtr nConCount = mConnections.Count();
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 	for ( i = 0; i < nConCount; i++ )
318cdf0e10cSrcweir 	{
319cdf0e10cSrcweir 		pCon = mConnections.GetObject( i );
320cdf0e10cSrcweir 		if ( pCon->GetOtherWin( this )->GetId() == nEndId )
321cdf0e10cSrcweir 			return pCon;
322cdf0e10cSrcweir 	}
323cdf0e10cSrcweir 	return NULL;
324cdf0e10cSrcweir }
325cdf0e10cSrcweir 
SetAllConnectorsUnvisible()326cdf0e10cSrcweir void ObjectWin::SetAllConnectorsUnvisible()
327cdf0e10cSrcweir {
328cdf0e10cSrcweir     Connector* pCon;
329cdf0e10cSrcweir     sal_uIntPtr nConCount = mConnections.Count();
330cdf0e10cSrcweir     for ( sal_uIntPtr i = 0; i < nConCount; i++ )
331cdf0e10cSrcweir 	{
332cdf0e10cSrcweir         pCon = mConnections.GetObject( i );
333cdf0e10cSrcweir         if (pCon) pCon->SetVisibility( sal_False );
334cdf0e10cSrcweir     }
335cdf0e10cSrcweir }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir /*****************************************************************************/
SetMarkMode(sal_uIntPtr nMarkMode)338cdf0e10cSrcweir void ObjectWin::SetMarkMode( sal_uIntPtr nMarkMode )
339cdf0e10cSrcweir /*****************************************************************************/
340cdf0e10cSrcweir {
341cdf0e10cSrcweir 	//Wallpaper aWallpaper;
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 	if ( nMarkMode == MARKMODE_DEFAULT )
344cdf0e10cSrcweir 	{
345cdf0e10cSrcweir 		if ( pDefaultWallpaper )
346cdf0e10cSrcweir 		{
347cdf0e10cSrcweir 			maObjWallpaper = GetBackground();
348cdf0e10cSrcweir 			maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() );
349cdf0e10cSrcweir 			SetBackground( maObjWallpaper );
350cdf0e10cSrcweir 			SetTextColor( aDefaultColor );
351cdf0e10cSrcweir 		}
352cdf0e10cSrcweir 	}
353cdf0e10cSrcweir 	else
354cdf0e10cSrcweir 	{
355cdf0e10cSrcweir 		mnMarkMode |= nMarkMode;
356cdf0e10cSrcweir 		maObjWallpaper = GetBackground();
357cdf0e10cSrcweir 		maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] );
358cdf0e10cSrcweir 		SetBackground( maObjWallpaper );
359cdf0e10cSrcweir 		SetTextColor( COL_WHITE );
360cdf0e10cSrcweir 	}
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 	Invalidate();
363cdf0e10cSrcweir }
364cdf0e10cSrcweir 
365cdf0e10cSrcweir /*****************************************************************************/
UnsetMarkMode(sal_uIntPtr nMarkMode)366cdf0e10cSrcweir void ObjectWin::UnsetMarkMode( sal_uIntPtr nMarkMode )
367cdf0e10cSrcweir /*****************************************************************************/
368cdf0e10cSrcweir {
369cdf0e10cSrcweir 	//Wallpaper aWallpaper;
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 	sal_uIntPtr nOldMode = mnMarkMode;
372cdf0e10cSrcweir 	mnMarkMode &= ( !nMarkMode );
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 	if ( nOldMode != mnMarkMode ) {
375cdf0e10cSrcweir 		if ( mnMarkMode == MARKMODE_DEFAULT )
376cdf0e10cSrcweir 		{
377cdf0e10cSrcweir 			if ( pDefaultWallpaper )
378cdf0e10cSrcweir 			{
379cdf0e10cSrcweir 				maObjWallpaper = GetBackground();
380cdf0e10cSrcweir 				maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() );
381cdf0e10cSrcweir 				SetBackground( maObjWallpaper );
382cdf0e10cSrcweir 				SetTextColor( aDefaultColor );
383cdf0e10cSrcweir 			}
384cdf0e10cSrcweir 		}
385cdf0e10cSrcweir 		else
386cdf0e10cSrcweir 		{
387cdf0e10cSrcweir 			maObjWallpaper = GetBackground();
388cdf0e10cSrcweir 			maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] ); //mnMarkMode
389cdf0e10cSrcweir 			SetBackground( maObjWallpaper );
390cdf0e10cSrcweir 			SetTextColor( COL_WHITE );
391cdf0e10cSrcweir 		}
392cdf0e10cSrcweir 		Invalidate();
393cdf0e10cSrcweir 	}
394cdf0e10cSrcweir }
395cdf0e10cSrcweir 
396cdf0e10cSrcweir /*****************************************************************************/
MarkNeeded(sal_Bool bReset)397cdf0e10cSrcweir void ObjectWin::MarkNeeded( sal_Bool bReset )
398cdf0e10cSrcweir /*****************************************************************************/
399cdf0e10cSrcweir {
400cdf0e10cSrcweir 	Connector* pCon;
401cdf0e10cSrcweir 	ObjectWin* pWin;
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 	sal_uIntPtr nConCount = mConnections.Count();
404cdf0e10cSrcweir 	sal_uIntPtr i;
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 	for ( i = 0; i < nConCount; i++ )
407cdf0e10cSrcweir 	{
408cdf0e10cSrcweir 		pCon = mConnections.GetObject( i );
409cdf0e10cSrcweir 		if ( pCon && !pCon->IsStart( this))
410cdf0e10cSrcweir 		{
411cdf0e10cSrcweir 			pWin = pCon->GetOtherWin( this );
412cdf0e10cSrcweir 			if ( pWin )
413cdf0e10cSrcweir 			{
414cdf0e10cSrcweir 				if ( bReset )
415cdf0e10cSrcweir 					pWin->UnsetMarkMode( MARKMODE_NEEDED );
416cdf0e10cSrcweir 				else
417cdf0e10cSrcweir 					pWin->SetMarkMode( MARKMODE_NEEDED );
418cdf0e10cSrcweir 				pWin->MarkNeeded( bReset );                    // recursive call
419cdf0e10cSrcweir 			}
420cdf0e10cSrcweir 		}
421cdf0e10cSrcweir 	}
422cdf0e10cSrcweir }
423cdf0e10cSrcweir 
424cdf0e10cSrcweir /*****************************************************************************/
MarkDepending(sal_Bool bReset)425cdf0e10cSrcweir void ObjectWin::MarkDepending( sal_Bool bReset )
426cdf0e10cSrcweir /*****************************************************************************/
427cdf0e10cSrcweir {
428cdf0e10cSrcweir 	//if ( !bReset )
429cdf0e10cSrcweir 	//	return;
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 	Connector* pCon;
432cdf0e10cSrcweir 	ObjectWin* pWin;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir 	sal_uIntPtr nConCount = mConnections.Count();
435cdf0e10cSrcweir 	sal_uIntPtr i;
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 	for ( i = 0; i < nConCount; i++ )
438cdf0e10cSrcweir 	{
439cdf0e10cSrcweir 		pCon = mConnections.GetObject( i );
440cdf0e10cSrcweir 		if ( pCon && pCon->IsStart( this) )
441cdf0e10cSrcweir 		{
442cdf0e10cSrcweir 			pWin = pCon->GetOtherWin( this );
443cdf0e10cSrcweir 			if ( pWin )
444cdf0e10cSrcweir 			{
445cdf0e10cSrcweir 				if ( bReset )
446cdf0e10cSrcweir 					pWin->UnsetMarkMode( MARKMODE_DEPENDING );
447cdf0e10cSrcweir 				else
448cdf0e10cSrcweir 					pWin->SetMarkMode( MARKMODE_DEPENDING );
449cdf0e10cSrcweir 				pWin->MarkDepending( bReset );                  // recursive call
450cdf0e10cSrcweir 			}
451cdf0e10cSrcweir 		}
452cdf0e10cSrcweir 	}
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir /*****************************************************************************/
Paint(const Rectangle & rRect)456cdf0e10cSrcweir void ObjectWin::Paint( const Rectangle& rRect )
457cdf0e10cSrcweir /*****************************************************************************/
458cdf0e10cSrcweir {
459cdf0e10cSrcweir     Size  aWinSize  = PixelToLogic( GetOutputSizePixel() );
460cdf0e10cSrcweir     Size  aTextSize;
461cdf0e10cSrcweir     ByteString sbt = msBodyText;                         //debug
462cdf0e10cSrcweir     //sbt += " ";                                         //debug
463cdf0e10cSrcweir     //sbt += ByteString::CreateFromInt32(mnMarkMode);     //debug
464cdf0e10cSrcweir 	aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 ));
465cdf0e10cSrcweir 	aTextSize.Height() = GetTextHeight();
466cdf0e10cSrcweir     Point aPos( aWinSize.Width() / 2  - aTextSize.Width() / 2,
467cdf0e10cSrcweir                 aWinSize.Height() / 2 - aTextSize.Height() / 2 );
468cdf0e10cSrcweir 
469cdf0e10cSrcweir     //DrawText( aPos , String( sBodyText, RTL_TEXTENCODING_UTF8 ));
470cdf0e10cSrcweir     if (msBodyText =="null") //don't paint this "window"
471cdf0e10cSrcweir     {
472cdf0e10cSrcweir         Hide();
473cdf0e10cSrcweir         Invalidate();
474cdf0e10cSrcweir     } else
475cdf0e10cSrcweir         DrawText( aPos , String( sbt, RTL_TEXTENCODING_UTF8 )); //debug
476cdf0e10cSrcweir }
477cdf0e10cSrcweir 
DrawOutput(OutputDevice * pDevice,const Point & rOffset)478cdf0e10cSrcweir void ObjectWin::DrawOutput( OutputDevice* pDevice, const Point& rOffset )
479cdf0e10cSrcweir /*****************************************************************************/
480cdf0e10cSrcweir {
481cdf0e10cSrcweir     Size aWinSize  = PixelToLogic( GetSizePixel() );
482cdf0e10cSrcweir     Size aTextSize;
483cdf0e10cSrcweir     ByteString sbt = msBodyText;
484cdf0e10cSrcweir 	aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 ));
485cdf0e10cSrcweir 	aTextSize.Height() = GetTextHeight();
486cdf0e10cSrcweir 	Point aPos = GetPosPixel();
487cdf0e10cSrcweir     Point aTextPos( aWinSize.Width() / 2  - aTextSize.Width() / 2,
488cdf0e10cSrcweir                 aWinSize.Height() / 2 - aTextSize.Height() / 2 );
489cdf0e10cSrcweir 	aTextPos += aPos;
490cdf0e10cSrcweir 	aPos = pDevice->PixelToLogic( aPos ) - rOffset;
491cdf0e10cSrcweir 	aTextPos = pDevice->PixelToLogic( aTextPos ) - rOffset;
492cdf0e10cSrcweir     if ( msBodyText !="null" )
493cdf0e10cSrcweir 	{
494cdf0e10cSrcweir 		pDevice->SetFillColor( GetBackground().GetColor() );
495cdf0e10cSrcweir 		pDevice->DrawRect( Rectangle( aPos, pDevice->PixelToLogic( GetSizePixel() ) ) );
496cdf0e10cSrcweir 	    Font aFont( GetFont() );
497cdf0e10cSrcweir 		Size aSize = aFont.GetSize();
498cdf0e10cSrcweir 		aSize = pDevice->PixelToLogic( aSize );
499cdf0e10cSrcweir 		aFont.SetSize( aSize );
500cdf0e10cSrcweir 		pDevice->SetFont( aFont );
501cdf0e10cSrcweir 		pDevice->SetTextColor( GetTextColor() );
502cdf0e10cSrcweir         pDevice->DrawText( aTextPos, String( sbt, RTL_TEXTENCODING_UTF8 ) );
503cdf0e10cSrcweir 	}
504cdf0e10cSrcweir }
505cdf0e10cSrcweir 
506cdf0e10cSrcweir /*****************************************************************************/
MouseButtonDown(const MouseEvent & rMEvt)507cdf0e10cSrcweir void ObjectWin::MouseButtonDown( const MouseEvent& rMEvt )
508cdf0e10cSrcweir /*****************************************************************************/
509cdf0e10cSrcweir {
510cdf0e10cSrcweir 	//Notify Soldep to clear ObjectList
511cdf0e10cSrcweir 	SetZOrder( NULL, WINDOW_ZORDER_FIRST );
512cdf0e10cSrcweir 	GrabFocus();
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 	// workaround fuer vcl-bug
515cdf0e10cSrcweir //	GetWindow( WINDOW_REALPARENT)->Invalidate();
516cdf0e10cSrcweir //    MyApp *pApp = (MyApp*)GetpApp();
517cdf0e10cSrcweir //    SolDep *pSoldep = pApp->GetSolDep();
518cdf0e10cSrcweir 
519cdf0e10cSrcweir 	maMouseOffset = rMEvt.GetPosPixel();
520cdf0e10cSrcweir 	if ( rMEvt.IsLeft() )
521cdf0e10cSrcweir 	{
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 		if ( rMEvt.IsMod2() )               // alt + mouse click left
524cdf0e10cSrcweir 		{
525cdf0e10cSrcweir             CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT, this );
526cdf0e10cSrcweir 		}
527cdf0e10cSrcweir 		else {
528cdf0e10cSrcweir             CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN, this );
529cdf0e10cSrcweir 		}
530cdf0e10cSrcweir 		if( rMEvt.GetClicks() == 2 )
531cdf0e10cSrcweir             CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK, this );
532cdf0e10cSrcweir 		else if ( !rMEvt.IsShift() && !((DepWin*)GetParent())->IsStartNewCon())
533cdf0e10cSrcweir         {
534cdf0e10cSrcweir             //((DepWin*)GetParent())->SaveSelectedObjWin(&this);
535cdf0e10cSrcweir 			CaptureMouse();
536cdf0e10cSrcweir         }
537cdf0e10cSrcweir 	}
538cdf0e10cSrcweir }
539cdf0e10cSrcweir 
540cdf0e10cSrcweir /*****************************************************************************/
MouseButtonUp(const MouseEvent & rMEvt)541cdf0e10cSrcweir void ObjectWin::MouseButtonUp( const MouseEvent& rMEvt )
542cdf0e10cSrcweir /*****************************************************************************/
543cdf0e10cSrcweir {
544cdf0e10cSrcweir 	fprintf(stdout,"ObjectWin::MouseButtonUp\n");
545cdf0e10cSrcweir 	if ( rMEvt.IsLeft() )
546cdf0e10cSrcweir 	{
547cdf0e10cSrcweir 		if ( rMEvt.IsShift() || ((DepWin*)GetParent())->IsStartNewCon())
548cdf0e10cSrcweir             CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP_SHFT, this );
549cdf0e10cSrcweir //			((DepWin*)GetParent())->NewConnector( this );
550cdf0e10cSrcweir 		else
551cdf0e10cSrcweir 		{
552cdf0e10cSrcweir             CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP, this );
553cdf0e10cSrcweir             if ( IsMouseCaptured() ) ReleaseMouse();
554cdf0e10cSrcweir 		}
555cdf0e10cSrcweir 	}
556cdf0e10cSrcweir 	else if ( rMEvt.IsRight() )
557cdf0e10cSrcweir 	{
558cdf0e10cSrcweir 		sal_uInt16 i;
559cdf0e10cSrcweir 
560cdf0e10cSrcweir 		while ( mnPopupStaticItems < mpPopup->GetItemCount() )
561cdf0e10cSrcweir 		{
562cdf0e10cSrcweir 			mpPopup->RemoveItem( mnPopupStaticItems );
563cdf0e10cSrcweir 		}
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 		if ( mConnections.Count()) {
566cdf0e10cSrcweir 			mpPopup->InsertSeparator();
567cdf0e10cSrcweir 
568cdf0e10cSrcweir 			for( i = 0; i < mConnections.Count() ; i++ )
569cdf0e10cSrcweir 			{
570cdf0e10cSrcweir 				mpPopup->InsertItem( mnPopupStaticItems + i + 1, String( ((mConnections.GetObject( i ))->GetOtherWin( this ))->GetBodyText(), RTL_TEXTENCODING_UTF8 ));
571cdf0e10cSrcweir 			}
572cdf0e10cSrcweir 		}
573cdf0e10cSrcweir 		mbMenuExecute = sal_True;
574cdf0e10cSrcweir 		mpPopup->Execute( GetParent(), rMEvt.GetPosPixel() + GetPosPixel());
575cdf0e10cSrcweir 	}
576cdf0e10cSrcweir }
577cdf0e10cSrcweir 
578cdf0e10cSrcweir /*****************************************************************************/
MouseMove(const MouseEvent & rMEvt)579cdf0e10cSrcweir void ObjectWin::MouseMove( const MouseEvent& rMEvt )
580cdf0e10cSrcweir /*****************************************************************************/
581cdf0e10cSrcweir {
582cdf0e10cSrcweir 	if ( IsMouseCaptured() )
583cdf0e10cSrcweir 	{
584cdf0e10cSrcweir 		sal_uInt16 i;
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 		Point aNewWinPos( GetPosPixel() + rMEvt.GetPosPixel() - maMouseOffset );
587cdf0e10cSrcweir 
588cdf0e10cSrcweir 		aNewWinPos.X() = Max( 0L, aNewWinPos.X());
589cdf0e10cSrcweir 		aNewWinPos.Y() = Max( 0L, aNewWinPos.Y());
590cdf0e10cSrcweir 		SetPosPixel( aNewWinPos );
591cdf0e10cSrcweir         //int t = mConnections.Count();
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 		for ( i=0; i < mConnections.Count();i++)
594cdf0e10cSrcweir 		{
595cdf0e10cSrcweir 			mConnections.GetObject( i )->UpdatePosition( this );
596cdf0e10cSrcweir 		}
597cdf0e10cSrcweir 	}
598cdf0e10cSrcweir 	else // !IsMouseCaptured()
599cdf0e10cSrcweir 	{
600cdf0e10cSrcweir 		if ( rMEvt.IsLeaveWindow() )
601cdf0e10cSrcweir 			aTipTimer.Stop();
602cdf0e10cSrcweir 		else
603cdf0e10cSrcweir 			aTipTimer.Start();
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 		MouseEvent aNewMEvt( rMEvt.GetPosPixel() + GetPosPixel());
606cdf0e10cSrcweir 
607cdf0e10cSrcweir 		GetParent()->MouseMove( aNewMEvt ); //call to DepWin::MouseMove
608cdf0e10cSrcweir 	}
609cdf0e10cSrcweir }
610cdf0e10cSrcweir 
611cdf0e10cSrcweir /*****************************************************************************/
Save(SvFileStream & rOutFile)612cdf0e10cSrcweir sal_uInt16 ObjectWin::Save( SvFileStream& rOutFile )
613cdf0e10cSrcweir /*****************************************************************************/
614cdf0e10cSrcweir {
615cdf0e10cSrcweir 	return 0;
616cdf0e10cSrcweir }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir /*****************************************************************************/
Load(SvFileStream & rInFile)619cdf0e10cSrcweir sal_uInt16 ObjectWin::Load( SvFileStream& rInFile )
620cdf0e10cSrcweir /*****************************************************************************/
621cdf0e10cSrcweir {
622cdf0e10cSrcweir 	return 0;
623cdf0e10cSrcweir }
624cdf0e10cSrcweir 
625cdf0e10cSrcweir /*****************************************************************************/
SetId(sal_uIntPtr nId)626cdf0e10cSrcweir void ObjectWin::SetId( sal_uIntPtr nId )
627cdf0e10cSrcweir /*****************************************************************************/
628cdf0e10cSrcweir {
629cdf0e10cSrcweir 	mnObjectId = nId;
630cdf0e10cSrcweir }
631cdf0e10cSrcweir 
632cdf0e10cSrcweir /*****************************************************************************/
GetId()633cdf0e10cSrcweir sal_uIntPtr ObjectWin::GetId()
634cdf0e10cSrcweir /*****************************************************************************/
635cdf0e10cSrcweir {
636cdf0e10cSrcweir 	return mnObjectId;
637cdf0e10cSrcweir }
638cdf0e10cSrcweir 
639cdf0e10cSrcweir /*****************************************************************************/
UpdateConnectors()640cdf0e10cSrcweir void ObjectWin::UpdateConnectors()
641cdf0e10cSrcweir /*****************************************************************************/
642cdf0e10cSrcweir {
643cdf0e10cSrcweir 	sal_uInt16 i;
644cdf0e10cSrcweir 
645cdf0e10cSrcweir 	for ( i = 0; i < mConnections.Count(); i++ )
646cdf0e10cSrcweir 	{
647cdf0e10cSrcweir 		mConnections.GetObject( i )->UpdatePosition( this );
648cdf0e10cSrcweir 	}
649cdf0e10cSrcweir }
650cdf0e10cSrcweir 
IMPL_LINK(ObjectWin,PopupSelected,PopupMenu *,mpPopup_l)651cdf0e10cSrcweir IMPL_LINK( ObjectWin, PopupSelected, PopupMenu*, mpPopup_l )
652cdf0e10cSrcweir {
653cdf0e10cSrcweir 	sal_uInt16 nItemId = mpPopup_l->GetCurItemId();
654cdf0e10cSrcweir 
655cdf0e10cSrcweir 	switch( nItemId )
656cdf0e10cSrcweir 	{
657cdf0e10cSrcweir 		case OBJWIN_EDIT_TEXT :
658cdf0e10cSrcweir 			DBG_ASSERT( sal_False,"edit");
659cdf0e10cSrcweir 				break;
660cdf0e10cSrcweir 		case OBJWIN_REMOVE_WIN :
661cdf0e10cSrcweir //			DBG_ASSERT( FALSE,"remove");
662cdf0e10cSrcweir //			DBG_ASSERT( mpDepperDontuseme,"remove");
663cdf0e10cSrcweir 			//mpDepperDontuseme->RemoveObject(mpDepperDontuseme->mpObjectList, ( sal_uInt16 ) GetId());
664cdf0e10cSrcweir 				break;
665cdf0e10cSrcweir 		case OBJWIN_ADD_CONNECTOR :
666cdf0e10cSrcweir //			DBG_ASSERT( FALSE,"add con");
667cdf0e10cSrcweir 			((DepWin*)GetParent())->NewConnector( this );
668cdf0e10cSrcweir 				break;
669cdf0e10cSrcweir 		case OBJWIN_VIEW_CONTENT :
670cdf0e10cSrcweir //			DBG_ASSERT( FALSE,"view cnt");
671cdf0e10cSrcweir //			mpDepperDontuseme->ViewContent( msBodyText );
672cdf0e10cSrcweir //			TBD: CallEventListener
673cdf0e10cSrcweir 				break;
674cdf0e10cSrcweir 		default :
675cdf0e10cSrcweir //			DBG_ASSERT( sal_False, String (nItemId) );
676cdf0e10cSrcweir 			Connector* pCon = mConnections.GetObject( nItemId - mnPopupStaticItems - 1);
677cdf0e10cSrcweir 			pCon = 0;
678cdf0e10cSrcweir //			delete pCon;
679cdf0e10cSrcweir //			mpDepperDontuseme->RemoveConnector( pCon->GetStartId(), pCon->GetEndId());
680cdf0e10cSrcweir //			TBD: CallEventListener
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 				break;
683cdf0e10cSrcweir 	}
684cdf0e10cSrcweir 	return 0;
685cdf0e10cSrcweir }
686cdf0e10cSrcweir 
687cdf0e10cSrcweir /*****************************************************************************/
IMPL_LINK(ObjectWin,TipHdl,void *,EMTY_ARG)688cdf0e10cSrcweir IMPL_LINK( ObjectWin, TipHdl, void *, EMTY_ARG )
689cdf0e10cSrcweir /*****************************************************************************/
690cdf0e10cSrcweir {
691cdf0e10cSrcweir 	aTipTimer.Stop();
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 	if ( msTipText.Len()) {
694cdf0e10cSrcweir 		Point aPos( GetpApp()->GetAppWindow()->GetPointerPosPixel());
695cdf0e10cSrcweir 		Help::ShowBalloon( GetpApp()->GetAppWindow(),
696cdf0e10cSrcweir 			Point( aPos.X(), aPos.Y()),
697cdf0e10cSrcweir 			String( msTipText, RTL_TEXTENCODING_UTF8 ));
698cdf0e10cSrcweir 	}
699cdf0e10cSrcweir 	return 0;
700cdf0e10cSrcweir }
701cdf0e10cSrcweir 
702cdf0e10cSrcweir /*****************************************************************************/
703cdf0e10cSrcweir //void ObjectWin::GetFocus()
704cdf0e10cSrcweir /*****************************************************************************/
705cdf0e10cSrcweir //{
706cdf0e10cSrcweir 	//SetMarkMode( MARKMODE_SELECTED );
707cdf0e10cSrcweir //}
708cdf0e10cSrcweir 
709cdf0e10cSrcweir /*****************************************************************************/
LoseFocus()710cdf0e10cSrcweir void ObjectWin::LoseFocus()
711cdf0e10cSrcweir /*****************************************************************************/
712cdf0e10cSrcweir {
713cdf0e10cSrcweir 	if ( !mbMenuExecute && !msbHideMode ) {
714cdf0e10cSrcweir 		UnsetMarkMode( MARKMODE_SELECTED );
715cdf0e10cSrcweir 		UnsetMarkMode( MARKMODE_ACTIVATED );
716cdf0e10cSrcweir 		MarkNeeded( sal_True );
717cdf0e10cSrcweir 		MarkDepending( sal_True );
718cdf0e10cSrcweir 	}
719cdf0e10cSrcweir 	else
720cdf0e10cSrcweir 		mbMenuExecute = sal_False;
721cdf0e10cSrcweir }
722cdf0e10cSrcweir 
723cdf0e10cSrcweir /*****************************************************************************/
IMPL_LINK(ObjectWin,PopupDeactivated,PopupMenu *,mpPopup_l)724cdf0e10cSrcweir IMPL_LINK( ObjectWin, PopupDeactivated, PopupMenu*, mpPopup_l )
725cdf0e10cSrcweir /*****************************************************************************/
726cdf0e10cSrcweir {
727cdf0e10cSrcweir 	mbMenuExecute = sal_False;
728cdf0e10cSrcweir 
729cdf0e10cSrcweir 	if ( !HasFocus()) {
730cdf0e10cSrcweir 		UnsetMarkMode( MARKMODE_SELECTED );
731cdf0e10cSrcweir 		UnsetMarkMode( MARKMODE_ACTIVATED );
732cdf0e10cSrcweir 	   	MarkNeeded( sal_True );
733cdf0e10cSrcweir 		MarkDepending( sal_True );
734cdf0e10cSrcweir 	}
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 	return 0;
737cdf0e10cSrcweir }
738cdf0e10cSrcweir 
739cdf0e10cSrcweir /*****************************************************************************/
Command(const CommandEvent & rEvent)740cdf0e10cSrcweir void ObjectWin::Command( const CommandEvent& rEvent)
741cdf0e10cSrcweir /*****************************************************************************/
742cdf0e10cSrcweir {
743cdf0e10cSrcweir 	fprintf(stdout, "ObjectWin::Command");
744cdf0e10cSrcweir //	mpDepperDontuseme->GetGraphWin()->Command( rEvent );
745cdf0e10cSrcweir //			TBD: CallEventListener
746cdf0e10cSrcweir 
747cdf0e10cSrcweir }
748cdf0e10cSrcweir 
749cdf0e10cSrcweir /*****************************************************************************/
750cdf0e10cSrcweir /*****************************************************************************/
751cdf0e10cSrcweir 
ObjectList()752cdf0e10cSrcweir ObjectList::ObjectList() : ObjWinList()
753cdf0e10cSrcweir {
754cdf0e10cSrcweir }
755cdf0e10cSrcweir 
756cdf0e10cSrcweir /*****************************************************************************/
ResetSelectedObject()757cdf0e10cSrcweir void ObjectList::ResetSelectedObject()
758cdf0e10cSrcweir /*****************************************************************************/
759cdf0e10cSrcweir {
760cdf0e10cSrcweir //    return;
761cdf0e10cSrcweir 
762cdf0e10cSrcweir     sal_uIntPtr nCount_l = Count();
763cdf0e10cSrcweir     ObjectWin* pObjectWin = NULL;
764cdf0e10cSrcweir     for (sal_uIntPtr i=0; i < nCount_l; i++ )
765cdf0e10cSrcweir     {
766cdf0e10cSrcweir         pObjectWin = GetObject( i );
767cdf0e10cSrcweir         pObjectWin->UnsetMarkMode( MARKMODE_SELECTED );
768cdf0e10cSrcweir         pObjectWin->UnsetMarkMode( MARKMODE_NEEDED );
769cdf0e10cSrcweir         pObjectWin->UnsetMarkMode( MARKMODE_DEPENDING );
770cdf0e10cSrcweir         pObjectWin->SetActualWallpaper(*pDefaultWallpaper);
771cdf0e10cSrcweir         pObjectWin->SetAllConnectorsUnvisible();
772cdf0e10cSrcweir     }
773cdf0e10cSrcweir     return;
774cdf0e10cSrcweir }
775cdf0e10cSrcweir 
776cdf0e10cSrcweir /*****************************************************************************/
GetPtrByName(const ByteString & rText)777cdf0e10cSrcweir ObjectWin* ObjectList::GetPtrByName( const ByteString& rText )
778cdf0e10cSrcweir /*****************************************************************************/
779cdf0e10cSrcweir {
780cdf0e10cSrcweir     sal_uIntPtr i = 0;
781cdf0e10cSrcweir     sal_uIntPtr nCount_l = Count();
782cdf0e10cSrcweir     ObjectWin* pObjectWin = NULL;
783cdf0e10cSrcweir     while ( i < nCount_l )
784cdf0e10cSrcweir     {
785cdf0e10cSrcweir        pObjectWin = GetObject( i );
786cdf0e10cSrcweir        ByteString sPrj = pObjectWin->GetBodyText();
787cdf0e10cSrcweir        if (sPrj == rText) return pObjectWin;
788cdf0e10cSrcweir        i++;
789cdf0e10cSrcweir     }
790cdf0e10cSrcweir     return 0;
791cdf0e10cSrcweir }
792cdf0e10cSrcweir 
FindTopLevelModules()793cdf0e10cSrcweir ObjectList* ObjectList::FindTopLevelModules()
794cdf0e10cSrcweir {
795cdf0e10cSrcweir 	ObjectList* pList = new ObjectList;
796cdf0e10cSrcweir     for ( sal_uInt16 i=0; i<Count(); i++ )
797cdf0e10cSrcweir 	{
798cdf0e10cSrcweir        ObjectWin* pObjectWin = GetObject( i );
799cdf0e10cSrcweir 	   if ( pObjectWin->IsTop() )
800cdf0e10cSrcweir 		   pList->Insert( pObjectWin );
801cdf0e10cSrcweir 	}
802cdf0e10cSrcweir 
803cdf0e10cSrcweir 	return pList;
804cdf0e10cSrcweir }
805cdf0e10cSrcweir 
IsTop()806cdf0e10cSrcweir sal_Bool ObjectWin::IsTop()
807cdf0e10cSrcweir {
808cdf0e10cSrcweir 	sal_uIntPtr nConCount = mConnections.Count();
809cdf0e10cSrcweir 	for ( sal_uIntPtr i = 0; i < nConCount; i++ )
810cdf0e10cSrcweir 	{
811cdf0e10cSrcweir 		Connector* pCon = mConnections.GetObject( i );
812cdf0e10cSrcweir 		if ( pCon && pCon->IsStart( this) )
813cdf0e10cSrcweir 			return sal_False;
814cdf0e10cSrcweir 	}
815cdf0e10cSrcweir 
816cdf0e10cSrcweir 	return sal_True;
817cdf0e10cSrcweir }
818