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 10*d9e04f7dSAndrew Rist * 11*d9e04f7dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d9e04f7dSAndrew Rist * 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. 19*d9e04f7dSAndrew Rist * 20*d9e04f7dSAndrew Rist *************************************************************/ 21*d9e04f7dSAndrew Rist 22*d9e04f7dSAndrew Rist 23cdf0e10cSrcweir //TBD: ToolBox handling prjview/back 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <osl/file.hxx> 26cdf0e10cSrcweir #include <rtl/ustring.hxx> 27cdf0e10cSrcweir #include <tools/debug.hxx> 28cdf0e10cSrcweir #include <soldep/sstring.hxx> 29cdf0e10cSrcweir #include <svtools/filedlg.hxx> 30cdf0e10cSrcweir #include <tools/iparser.hxx> 31cdf0e10cSrcweir #include <tools/geninfo.hxx> 32cdf0e10cSrcweir #include <vcl/gdimtf.hxx> 33cdf0e10cSrcweir #include <vcl/bitmap.hxx> 34cdf0e10cSrcweir #include <soldep/appdef.hxx> 35cdf0e10cSrcweir #include "time.h" 36cdf0e10cSrcweir #include <soldep/depper.hxx> 37cdf0e10cSrcweir #include <soldep/soldep.hxx> 38cdf0e10cSrcweir #include <soldep/soldlg.hxx> 39cdf0e10cSrcweir #include "dtsodcmp.hrc" 40cdf0e10cSrcweir 41cdf0e10cSrcweir IMPLEMENT_HASHTABLE_OWNER( SolIdMapper, ByteString, sal_uIntPtr* ); 42cdf0e10cSrcweir //IMPLEMENT_HASHTABLE_OWNER( PrjIdMapper, ByteString, sal_uIntPtr* ); 43cdf0e10cSrcweir #define EVENT_RESIZE 0x00000001 44cdf0e10cSrcweir #define MIN(a,b) (a)<(b)?(a):(b) 45cdf0e10cSrcweir #define MAX(a,b) (a)>(b)?(a):(b) 46cdf0e10cSrcweir 47cdf0e10cSrcweir 48cdf0e10cSrcweir //ByteString sDelimiterLine("#=========================================================================="); 49cdf0e10cSrcweir 50cdf0e10cSrcweir 51cdf0e10cSrcweir // 52cdf0e10cSrcweir // class SolDep 53cdf0e10cSrcweir // 54cdf0e10cSrcweir 55cdf0e10cSrcweir /*****************************************************************************/ 56cdf0e10cSrcweir SolDep::SolDep( Window* pBaseWindow ) 57cdf0e10cSrcweir /*****************************************************************************/ 58cdf0e10cSrcweir : Depper( pBaseWindow ), 59cdf0e10cSrcweir mbBServer(sal_False), 60cdf0e10cSrcweir mpTravellerList( NULL ), 61cdf0e10cSrcweir mbIsHide( sal_False ) 62cdf0e10cSrcweir { 63cdf0e10cSrcweir mnSolWinCount = 0; 64cdf0e10cSrcweir mnSolLastId = 0; 65cdf0e10cSrcweir // mpPrjIdMapper = new SolIdMapper( 63997 ); 66cdf0e10cSrcweir maTaskBarFrame.EnableAlwaysOnTop(); 67cdf0e10cSrcweir maTaskBarFrame.Show(); 68cdf0e10cSrcweir maToolBox.SetPosSizePixel( Point( 0,0 ), Size( 1100,35 )); 69cdf0e10cSrcweir maToolBox.SetSelectHdl( LINK ( this, SolDep, ToolSelect )); 70cdf0e10cSrcweir maToolBox.Show(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir mpBaseWin->AddChildEventListener( LINK( this, SolDep, ChildWindowEventListener )); 73cdf0e10cSrcweir 74cdf0e10cSrcweir // Kontext-Menue (geh�rt zu soldep.cxx) 75cdf0e10cSrcweir InitContextMenueMainWnd(); 76cdf0e10cSrcweir InitContextMenuePrjViewWnd( mpBasePrjWin ); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir /*****************************************************************************/ 80cdf0e10cSrcweir SolDep::~SolDep() 81cdf0e10cSrcweir /*****************************************************************************/ 82cdf0e10cSrcweir { 83cdf0e10cSrcweir mpBaseWin->RemoveChildEventListener( LINK( this, SolDep, ChildWindowEventListener ) ); 84cdf0e10cSrcweir delete mpSolIdMapper; 85cdf0e10cSrcweir delete mpStarWriter; 86cdf0e10cSrcweir delete mpStandLst; 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir /*****************************************************************************/ 90cdf0e10cSrcweir void SolDep::Init() 91cdf0e10cSrcweir /*****************************************************************************/ 92cdf0e10cSrcweir { 93cdf0e10cSrcweir InformationParser aParser; 94cdf0e10cSrcweir String sStandLst( GetDefStandList(), RTL_TEXTENCODING_ASCII_US ); 95cdf0e10cSrcweir mpStandLst = aParser.Execute( sStandLst ); 96cdf0e10cSrcweir ByteString aUpdater( getenv("UPDATER") ); 97cdf0e10cSrcweir if ( mpStandLst && (aUpdater == "YES") ) { 98cdf0e10cSrcweir if ( GetVersion() ) 99cdf0e10cSrcweir ReadSource( sal_True ); 100cdf0e10cSrcweir } else 101cdf0e10cSrcweir { 102cdf0e10cSrcweir ReadSource(); // if stand.lst isn't available 103cdf0e10cSrcweir } 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir /*****************************************************************************/ 107cdf0e10cSrcweir void SolDep::Init( ByteString &rVersion, GenericInformationList *pVersionList ) 108cdf0e10cSrcweir /*****************************************************************************/ 109cdf0e10cSrcweir { 110cdf0e10cSrcweir // Interface for bs 111cdf0e10cSrcweir mbBServer=sal_True; 112cdf0e10cSrcweir if ( pVersionList ) 113cdf0e10cSrcweir mpStandLst = new GenericInformationList( *pVersionList ); 114cdf0e10cSrcweir else { 115cdf0e10cSrcweir InformationParser aParser; 116cdf0e10cSrcweir String sStandLst( GetDefStandList(), RTL_TEXTENCODING_ASCII_US ); 117cdf0e10cSrcweir mpStandLst = aParser.Execute( sStandLst ); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir if ( mpStandLst ) { 120cdf0e10cSrcweir msVersionMajor = ByteString( rVersion ); 121cdf0e10cSrcweir ReadSource(sal_True); //call from build server set UPDATER to TRUE 122cdf0e10cSrcweir } 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir /*****************************************************************************/ 126cdf0e10cSrcweir IMPL_LINK( SolDep, ChildWindowEventListener, VclSimpleEvent*, pEvent ) 127cdf0e10cSrcweir /*****************************************************************************/ 128cdf0e10cSrcweir { 129cdf0e10cSrcweir if ( pEvent && pEvent->ISA( VclWindowEvent ) ) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir ProcessChildWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) ); 132cdf0e10cSrcweir } 133cdf0e10cSrcweir return 0; 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir 137cdf0e10cSrcweir /*****************************************************************************/ 138cdf0e10cSrcweir void SolDep::ProcessChildWindowEvent( const VclWindowEvent& _rVclWindowEvent ) 139cdf0e10cSrcweir /*****************************************************************************/ 140cdf0e10cSrcweir { 141cdf0e10cSrcweir Window* pChildWin = _rVclWindowEvent.GetWindow(); 142cdf0e10cSrcweir // Window* pParentWin = pChildWin->GetParent(); 143cdf0e10cSrcweir //Resize(); 144cdf0e10cSrcweir if ( isAlive() ) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir sal_uIntPtr id = _rVclWindowEvent.GetId(); 147cdf0e10cSrcweir switch ( id ) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir case VCLEVENT_USER_MOUSEBUTTON_DOWN: 150cdf0e10cSrcweir { 151cdf0e10cSrcweir ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); 152cdf0e10cSrcweir if( pObjWin ) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir // handle mouse click on ObjectWin object 155cdf0e10cSrcweir ObjectWin* pWin = (ObjectWin*) pChildWin; 156cdf0e10cSrcweir //GetObjectList()->ResetSelectedObject(); 157cdf0e10cSrcweir if (IsHideMode()) // simple mouse click left 158cdf0e10cSrcweir { 159cdf0e10cSrcweir pWin->CaptureMouse(); 160cdf0e10cSrcweir pWin->SetMarkMode( MARKMODE_SELECTED ); 161cdf0e10cSrcweir pWin->MarkNeeded(); 162cdf0e10cSrcweir pWin->MarkDepending(); 163cdf0e10cSrcweir pWin->Invalidate(); 164cdf0e10cSrcweir } else 165cdf0e10cSrcweir { 166cdf0e10cSrcweir pWin->LoseFocus(); 167cdf0e10cSrcweir pWin->SetMarkMode( MARKMODE_SELECTED ); 168cdf0e10cSrcweir pWin->UnsetMarkMode( MARKMODE_ACTIVATED ); 169cdf0e10cSrcweir pWin->MarkNeeded( sal_True ); 170cdf0e10cSrcweir pWin->MarkDepending( sal_True ); 171cdf0e10cSrcweir } 172cdf0e10cSrcweir 173cdf0e10cSrcweir } 174cdf0e10cSrcweir } 175cdf0e10cSrcweir break; 176cdf0e10cSrcweir case VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT: 177cdf0e10cSrcweir { 178cdf0e10cSrcweir ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); 179cdf0e10cSrcweir if( pObjWin ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir ObjectWin* pWin = (ObjectWin*) pChildWin; 182cdf0e10cSrcweir MarkObjects( pWin ); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir } 185cdf0e10cSrcweir break; 186cdf0e10cSrcweir case VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK: 187cdf0e10cSrcweir { 188cdf0e10cSrcweir ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); 189cdf0e10cSrcweir if( pObjWin ) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir if (IsHideMode()) ToggleHideDependency(); 192cdf0e10cSrcweir ByteString text = ((ObjectWin*) pChildWin)->GetBodyText(); 193cdf0e10cSrcweir ViewContent(text); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir } 196cdf0e10cSrcweir break; 197cdf0e10cSrcweir case VCLEVENT_USER_MOUSEBUTTON_UP_SHFT: 198cdf0e10cSrcweir { 199cdf0e10cSrcweir ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); 200cdf0e10cSrcweir if( pObjWin ) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir ObjectWin* pWin = (ObjectWin*) pChildWin; 203cdf0e10cSrcweir GetDepWin()->NewConnector( pWin ); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir } 206cdf0e10cSrcweir break; 207cdf0e10cSrcweir case VCLEVENT_USER_MOUSEBUTTON_UP: 208cdf0e10cSrcweir { 209cdf0e10cSrcweir ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); 210cdf0e10cSrcweir if( pObjWin ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir ObjectWin* pWin = (ObjectWin*) pChildWin; 213cdf0e10cSrcweir pWin->ReleaseMouse(); 214cdf0e10cSrcweir pWin->SetMarkMode(MARKMODE_SELECTED); 215cdf0e10cSrcweir GetDepWin()->Invalidate(); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir } 218cdf0e10cSrcweir break; 219cdf0e10cSrcweir } // switch 220cdf0e10cSrcweir } // if isAlive 221cdf0e10cSrcweir //fprintf(stdout,"BLA::Resize: %d\n",pChildWin); 222cdf0e10cSrcweir } 223cdf0e10cSrcweir 224cdf0e10cSrcweir /*****************************************************************************/ 225cdf0e10cSrcweir IMPL_LINK( SolDep, ToolSelect, SoldepToolBox* , pBox) 226cdf0e10cSrcweir /*****************************************************************************/ 227cdf0e10cSrcweir { 228cdf0e10cSrcweir sal_uInt16 nItemId = pBox->GetCurItemId(); 229cdf0e10cSrcweir switch ( nItemId ) 230cdf0e10cSrcweir { 231cdf0e10cSrcweir case TID_SOLDEP_FIND: 232cdf0e10cSrcweir FindProject(); 233cdf0e10cSrcweir break; 234cdf0e10cSrcweir case TID_SOLDEP_CREATEMETA : 235cdf0e10cSrcweir { 236cdf0e10cSrcweir VirtualDevice aVDev; 237cdf0e10cSrcweir aVDev.SetMapMode( MAP_100TH_MM ); 238cdf0e10cSrcweir GDIMetaFile aMtf; 239cdf0e10cSrcweir aVDev.EnableOutput( sal_False ); 240cdf0e10cSrcweir aMtf.Record( &aVDev ); 241cdf0e10cSrcweir 242cdf0e10cSrcweir aVDev.SetLineColor( Color( COL_BLACK ) ); 243cdf0e10cSrcweir aVDev.SetTextAlign( ALIGN_TOP ); 244cdf0e10cSrcweir 245cdf0e10cSrcweir Size aSize( GetDepWin()->GetOutputSizePixel() ); 246cdf0e10cSrcweir long nXMin = aSize.Width(); 247cdf0e10cSrcweir long nXMax = 0; 248cdf0e10cSrcweir long nYMax = 0; 249cdf0e10cSrcweir long nYMin = aSize.Height(); 250cdf0e10cSrcweir 251cdf0e10cSrcweir for ( sal_uInt16 i=0; i<mpObjectList->Count(); i++ ) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir Point aPoint = mpObjectList->GetObject(i)->GetPosPixel(); 254cdf0e10cSrcweir Size aSize = mpObjectList->GetObject(i)->GetSizePixel(); 255cdf0e10cSrcweir nXMin = MIN( aPoint.X(), nXMin ); 256cdf0e10cSrcweir nXMax = MAX( aPoint.X() + aSize.Width(), nXMax ); 257cdf0e10cSrcweir nYMin = MIN( aPoint.Y(), nYMin ); 258cdf0e10cSrcweir nYMax = MAX( aPoint.Y() + aSize.Height(), nYMax ); 259cdf0e10cSrcweir } 260cdf0e10cSrcweir 261cdf0e10cSrcweir Point aOffset( nXMin, nYMin ); 262cdf0e10cSrcweir aOffset = aVDev.PixelToLogic( aOffset ); 263cdf0e10cSrcweir 264cdf0e10cSrcweir GetDepWin()->DrawOutput( &aVDev, aOffset ); 265cdf0e10cSrcweir for ( sal_uInt16 i=0; i<mpObjectList->Count(); i++ ) 266cdf0e10cSrcweir if ( mpObjectList->GetObject(i)->IsVisible() ) 267cdf0e10cSrcweir mpObjectList->GetObject(i)->DrawOutput( &aVDev, aOffset ); 268cdf0e10cSrcweir 269cdf0e10cSrcweir aMtf.Stop(); 270cdf0e10cSrcweir aMtf.WindStart(); 271cdf0e10cSrcweir aMtf.SetPrefMapMode( aVDev.GetMapMode() ); 272cdf0e10cSrcweir Size aDevSize( nXMax-nXMin + 10, nYMax-nYMin + 10); 273cdf0e10cSrcweir aDevSize = aVDev.PixelToLogic( aDevSize ); 274cdf0e10cSrcweir aMtf.SetPrefSize( aDevSize ); 275cdf0e10cSrcweir SvFileStream aStream( String::CreateFromAscii("d:\\out.svm"), STREAM_STD_READWRITE ); 276cdf0e10cSrcweir aMtf.Write( aStream ); 277cdf0e10cSrcweir break; 278cdf0e10cSrcweir } 279cdf0e10cSrcweir case TID_SOLDEP_HIDE_INDEPENDEND: 280cdf0e10cSrcweir { 281cdf0e10cSrcweir ToggleHideDependency(); 282cdf0e10cSrcweir for ( sal_uInt16 i=0; i<mpObjectList->Count(); i++ ) 283cdf0e10cSrcweir mpObjectList->GetObject(i)->SetViewMask(!mbIsHide); 284cdf0e10cSrcweir 285cdf0e10cSrcweir maToolBox.CheckItem(TID_SOLDEP_HIDE_INDEPENDEND, IsHideMode()); 286cdf0e10cSrcweir GetDepWin()->Invalidate(); //repaint Main-View 287cdf0e10cSrcweir } 288cdf0e10cSrcweir break; 289cdf0e10cSrcweir case TID_SOLDEP_SELECT_WORKSPACE: 290cdf0e10cSrcweir if (mpStandLst) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir if (GetVersion()) // Version dialog box 293cdf0e10cSrcweir { 294cdf0e10cSrcweir delete mpSolIdMapper; 295cdf0e10cSrcweir delete mpStarWriter; 296cdf0e10cSrcweir mpObjectList->ClearAndDelete(); 297cdf0e10cSrcweir ReadSource(sal_True); 298cdf0e10cSrcweir } 299cdf0e10cSrcweir } 300cdf0e10cSrcweir break; 301cdf0e10cSrcweir case TID_SOLDEP_BACK: 302cdf0e10cSrcweir maToolBox.HideItem(TID_SOLDEP_BACK); 303cdf0e10cSrcweir maToolBox.ShowItem(TID_SOLDEP_SELECT_WORKSPACE); //disabled for prj view (doubleclick ObjWin) 304cdf0e10cSrcweir maToolBox.ShowItem(TID_SOLDEP_HIDE_INDEPENDEND); //disabled for prj view (doubleclick ObjWin) 305cdf0e10cSrcweir maToolBox.ShowItem(TID_SOLDEP_FIND); //disabled for prj view (doubleclick ObjWin) 306cdf0e10cSrcweir maToolBox.Resize(); 307cdf0e10cSrcweir TogglePrjViewStatus(); 308cdf0e10cSrcweir break; 309cdf0e10cSrcweir } 310cdf0e10cSrcweir return 0; 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir /*****************************************************************************/ 314cdf0e10cSrcweir void SolDep::ToggleHideDependency() 315cdf0e10cSrcweir /*****************************************************************************/ 316cdf0e10cSrcweir { 317cdf0e10cSrcweir mbIsHide = !mbIsHide; 318cdf0e10cSrcweir maToolBox.CheckItem(TID_SOLDEP_HIDE_INDEPENDEND, IsHideMode()); 319cdf0e10cSrcweir ObjectWin* pWin = GetObjectList()->GetObject( 0 ); 320cdf0e10cSrcweir pWin->ToggleHideMode(); 321cdf0e10cSrcweir }; 322cdf0e10cSrcweir 323cdf0e10cSrcweir /*****************************************************************************/ 324cdf0e10cSrcweir sal_Bool SolDep::GetVersion() 325cdf0e10cSrcweir /*****************************************************************************/ 326cdf0e10cSrcweir { 327cdf0e10cSrcweir SolSelectVersionDlg aVersionDlg( GetDepWin(), mpStandLst ); 328cdf0e10cSrcweir if ( aVersionDlg.Execute() == RET_OK ) { 329cdf0e10cSrcweir msVersionMajor = aVersionDlg.GetVersionMajor(); 330cdf0e10cSrcweir msVersionMinor = aVersionDlg.GetVersionMinor(); 331cdf0e10cSrcweir return sal_True; 332cdf0e10cSrcweir } 333cdf0e10cSrcweir return sal_False; 334cdf0e10cSrcweir } 335cdf0e10cSrcweir 336cdf0e10cSrcweir void SolDep::InitContextMenueMainWnd() 337cdf0e10cSrcweir { 338cdf0e10cSrcweir InitContextMenuePrjViewWnd( mpBaseWin ); 339cdf0e10cSrcweir return; // Disable not actually supported items 340cdf0e10cSrcweir 341cdf0e10cSrcweir mpBaseWin->mpPopup->InsertItem( DEPPOPUP_AUTOARRANGE, String::CreateFromAscii("Autoarrange")) ; 342cdf0e10cSrcweir mpBaseWin->mpPopup->InsertSeparator(); 343cdf0e10cSrcweir mpBaseWin->mpPopup->InsertItem( DEPPOPUP_READ_SOURCE, String::CreateFromAscii("Revert all changes") ); 344cdf0e10cSrcweir mpBaseWin->mpPopup->InsertSeparator(); 345cdf0e10cSrcweir mpBaseWin->mpPopup->InsertItem( DEPPOPUP_OPEN_SOURCE, String::CreateFromAscii("Open") ); 346cdf0e10cSrcweir mpBaseWin->mpPopup->InsertItem( DEPPOPUP_WRITE_SOURCE, String::CreateFromAscii("Save") ); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir 349cdf0e10cSrcweir void SolDep::InitContextMenuePrjViewWnd(DepWin* pBaseWin ) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir // temp. disabled pBaseWin->mpPopup->InsertItem( DEPPOPUP_NEW, String::CreateFromAscii("New object") ); 352cdf0e10cSrcweir pBaseWin->mpPopup->InsertItem( DEPPOPUP_ZOOMIN, String::CreateFromAscii("Zoom in") ); 353cdf0e10cSrcweir pBaseWin->mpPopup->InsertItem( DEPPOPUP_ZOOMOUT, String::CreateFromAscii("Zoom out") ); 354cdf0e10cSrcweir pBaseWin->mpPopup->InsertSeparator(); 355cdf0e10cSrcweir // temp disabled pBaseWin->mpPopup->InsertItem( DEPPOPUP_CLEAR, String::CreateFromAscii("Clear") ); 356cdf0e10cSrcweir pBaseWin->mpPopup->InsertItem( DEPPOPUP_SHOW_TOOLBOX, String::CreateFromAscii("Show Toolbox") ); 357cdf0e10cSrcweir } 358cdf0e10cSrcweir 359cdf0e10cSrcweir /*****************************************************************************/ 360cdf0e10cSrcweir ObjectWin *SolDep::RemoveObject( sal_uInt16 nId, sal_Bool bDelete ) 361cdf0e10cSrcweir /*****************************************************************************/ 362cdf0e10cSrcweir { 363cdf0e10cSrcweir Prj* pPrj; 364cdf0e10cSrcweir 365cdf0e10cSrcweir //hshtable auf stand halten 366cdf0e10cSrcweir ObjectWin* pWin = RemoveObjectFromList( mpObjectList, mnSolWinCount, nId, sal_False ); 367cdf0e10cSrcweir if ( pWin ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir ByteString aBodyText( pWin->GetBodyText() ); 370cdf0e10cSrcweir if( (pPrj = mpStarWriter->GetPrj( aBodyText )) ) 371cdf0e10cSrcweir { 372cdf0e10cSrcweir mpStarWriter->Remove( pPrj ); 373cdf0e10cSrcweir //cleanup ist teuer... 374cdf0e10cSrcweir mpStarWriter->CleanUp(); 375cdf0e10cSrcweir delete pPrj; 376cdf0e10cSrcweir } 377cdf0e10cSrcweir else 378cdf0e10cSrcweir DBG_ASSERT( sal_False, "project not found - write" ); 379cdf0e10cSrcweir 380cdf0e10cSrcweir mpSolIdMapper->Delete( aBodyText ); 381cdf0e10cSrcweir if ( bDelete ) 382cdf0e10cSrcweir delete pWin; 383cdf0e10cSrcweir return pWin; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir else 386cdf0e10cSrcweir return NULL; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir /*****************************************************************************/ 390cdf0e10cSrcweir sal_uIntPtr SolDep::AddObject( ByteString& rBodyText, sal_Bool bInteract ) 391cdf0e10cSrcweir /*****************************************************************************/ 392cdf0e10cSrcweir { 393cdf0e10cSrcweir sal_uIntPtr nObjectId; 394cdf0e10cSrcweir if ( bInteract ) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir nObjectId = HandleNewPrjDialog( rBodyText ); 397cdf0e10cSrcweir } 398cdf0e10cSrcweir else 399cdf0e10cSrcweir { 400cdf0e10cSrcweir //hashtable auf stand halten 401cdf0e10cSrcweir MyHashObject* pHObject; 402cdf0e10cSrcweir nObjectId = AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, rBodyText, sal_False ); 403cdf0e10cSrcweir pHObject = new MyHashObject( nObjectId, ObjIdToPtr(mpObjectList, nObjectId )); 404cdf0e10cSrcweir mpSolIdMapper->Insert( rBodyText, pHObject ); 405cdf0e10cSrcweir } 406cdf0e10cSrcweir return nObjectId; 407cdf0e10cSrcweir } 408cdf0e10cSrcweir 409cdf0e10cSrcweir /*****************************************************************************/ 410cdf0e10cSrcweir sal_uIntPtr SolDep::AddPrjObject( ByteString& rBodyText, sal_Bool bInteract ) 411cdf0e10cSrcweir /*****************************************************************************/ 412cdf0e10cSrcweir { 413cdf0e10cSrcweir sal_uIntPtr nObjectId; 414cdf0e10cSrcweir if ( bInteract ) 415cdf0e10cSrcweir { 416cdf0e10cSrcweir nObjectId = HandleNewDirectoryDialog( rBodyText ); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir else 419cdf0e10cSrcweir { 420cdf0e10cSrcweir //hshtable auf stand halten 421cdf0e10cSrcweir MyHashObject* pHObject; 422cdf0e10cSrcweir nObjectId = AddObjectToList( mpBasePrjWin, mpObjectPrjList, mnPrjLastId, mnPrjWinCount, rBodyText ); 423cdf0e10cSrcweir pHObject = new MyHashObject( nObjectId, ObjIdToPtr( mpObjectPrjList, nObjectId )); 424cdf0e10cSrcweir mpPrjIdMapper->Insert( rBodyText, pHObject ); // mpPrjIdMapper 425cdf0e10cSrcweir } 426cdf0e10cSrcweir return nObjectId; 427cdf0e10cSrcweir } 428cdf0e10cSrcweir 429cdf0e10cSrcweir /*****************************************************************************/ 430cdf0e10cSrcweir sal_uInt16 SolDep::AddConnector( ObjectWin* pStartWin, ObjectWin* pEndWin ) 431cdf0e10cSrcweir /*****************************************************************************/ 432cdf0e10cSrcweir { 433cdf0e10cSrcweir // DBG_ASSERT( FALSE , "not yet" ); 434cdf0e10cSrcweir ByteString sEndName = pEndWin->GetBodyText(); 435cdf0e10cSrcweir ByteString sStartName = pStartWin->GetBodyText(); 436cdf0e10cSrcweir 437cdf0e10cSrcweir Prj* pPrj = mpStarWriter->GetPrj( sEndName ); 438cdf0e10cSrcweir if ( pPrj ) 439cdf0e10cSrcweir { 440cdf0e10cSrcweir pPrj->AddDependencies( sStartName ); 441cdf0e10cSrcweir return AddConnectorToObjects( pStartWin, pEndWin ); 442cdf0e10cSrcweir } 443cdf0e10cSrcweir else 444cdf0e10cSrcweir { 445cdf0e10cSrcweir DBG_ASSERT( sal_False , "non existing Project" ); 446cdf0e10cSrcweir return 1; 447cdf0e10cSrcweir } 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir /*****************************************************************************/ 451cdf0e10cSrcweir sal_uInt16 SolDep::RemoveConnector( ObjectWin* pStartWin, ObjectWin* pEndWin ) 452cdf0e10cSrcweir /*****************************************************************************/ 453cdf0e10cSrcweir { 454cdf0e10cSrcweir SByteStringList* pPrjDeps = NULL; 455cdf0e10cSrcweir ByteString sEndName = pEndWin->GetBodyText(); 456cdf0e10cSrcweir ByteString sStartName = pStartWin->GetBodyText(); 457cdf0e10cSrcweir 458cdf0e10cSrcweir Prj* pPrj = mpStarWriter->GetPrj( sEndName ); 459cdf0e10cSrcweir pPrjDeps = pPrj->GetDependencies( sal_False ); 460cdf0e10cSrcweir if ( pPrjDeps ) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir ByteString* pString; 463cdf0e10cSrcweir sal_uIntPtr nPrjDepsCount = pPrjDeps->Count(); 464cdf0e10cSrcweir for ( sal_uIntPtr j = nPrjDepsCount; j > 0; j-- ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir pString = pPrjDeps->GetObject( j - 1 ); 467cdf0e10cSrcweir if ( pString->GetToken( 0, '.') == sStartName ) 468cdf0e10cSrcweir pPrjDeps->Remove( pString ); 469cdf0e10cSrcweir } 470cdf0e10cSrcweir } 471cdf0e10cSrcweir 472cdf0e10cSrcweir return RemoveConnectorFromObjects( pStartWin, pEndWin ); 473cdf0e10cSrcweir } 474cdf0e10cSrcweir 475cdf0e10cSrcweir /*****************************************************************************/ 476cdf0e10cSrcweir void SolDep::RemoveAllObjects( ObjectList* pObjLst ) 477cdf0e10cSrcweir /*****************************************************************************/ 478cdf0e10cSrcweir { 479cdf0e10cSrcweir 480cdf0e10cSrcweir Depper::RemoveAllObjects( pObjLst ); 481cdf0e10cSrcweir 482cdf0e10cSrcweir if ( mpSolIdMapper ) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir delete mpSolIdMapper; 485cdf0e10cSrcweir mpSolIdMapper = NULL; 486cdf0e10cSrcweir } 487cdf0e10cSrcweir if ( mpStarWriter ) 488cdf0e10cSrcweir { 489cdf0e10cSrcweir delete mpStarWriter; 490cdf0e10cSrcweir mpStarWriter = NULL; 491cdf0e10cSrcweir } 492cdf0e10cSrcweir } 493cdf0e10cSrcweir 494cdf0e10cSrcweir /*****************************************************************************/ 495cdf0e10cSrcweir sal_uIntPtr SolDep::GetStart(SolIdMapper* pIdMapper, ObjectList* pObjList) 496cdf0e10cSrcweir /*****************************************************************************/ 497cdf0e10cSrcweir { 498cdf0e10cSrcweir // DBG_ASSERT( FALSE , "soldep" ); 499cdf0e10cSrcweir MyHashObject* pHObject = pIdMapper->Find( "null" );//null_project 500cdf0e10cSrcweir 501cdf0e10cSrcweir if ( !pHObject ) { 502cdf0e10cSrcweir ByteString sNullPrj = "null";//null_project 503cdf0e10cSrcweir sal_uIntPtr nObjectId = AddObject( sNullPrj, sal_False ); 504cdf0e10cSrcweir ObjIdToPtr( pObjList, nObjectId )->SetViewMask( 1 ); 505cdf0e10cSrcweir return nObjectId; 506cdf0e10cSrcweir } 507cdf0e10cSrcweir 508cdf0e10cSrcweir return pHObject->GetId(); 509cdf0e10cSrcweir } 510cdf0e10cSrcweir 511cdf0e10cSrcweir /*****************************************************************************/ 512cdf0e10cSrcweir sal_uIntPtr SolDep::GetStartPrj(SolIdMapper* , ObjectList* ) 513cdf0e10cSrcweir /*****************************************************************************/ 514cdf0e10cSrcweir { 515cdf0e10cSrcweir // DBG_ASSERT( FALSE , "prjdep" ); 516cdf0e10cSrcweir MyHashObject* pHObject = mpPrjIdMapper->Find( ByteString( "null" ) ); //null_dir 517cdf0e10cSrcweir if ( !pHObject ) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir ByteString bsNull("null"); 520cdf0e10cSrcweir sal_uIntPtr nObjectId = AddPrjObject( bsNull, sal_False); //null_dir 521cdf0e10cSrcweir return nObjectId; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir else 524cdf0e10cSrcweir return pHObject->GetId(); 525cdf0e10cSrcweir } 526cdf0e10cSrcweir 527cdf0e10cSrcweir /*****************************************************************************/ 528cdf0e10cSrcweir sal_uInt16 SolDep::OpenSource() 529cdf0e10cSrcweir /*****************************************************************************/ 530cdf0e10cSrcweir { 531cdf0e10cSrcweir if ( mpStandLst ) { 532cdf0e10cSrcweir if ( GetVersion()) 533cdf0e10cSrcweir return ReadSource(); 534cdf0e10cSrcweir } 535cdf0e10cSrcweir return 0; 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir /*****************************************************************************/ 539cdf0e10cSrcweir sal_uInt16 SolDep::ReadSource(sal_Bool bUpdater) 540cdf0e10cSrcweir /*****************************************************************************/ 541cdf0e10cSrcweir { 542cdf0e10cSrcweir mpBaseWin->EnablePaint( sal_False ); 543cdf0e10cSrcweir mpBaseWin->Hide(); 544cdf0e10cSrcweir sal_uIntPtr nObjectId, nHashedId; 545cdf0e10cSrcweir sal_uIntPtr i; 546cdf0e10cSrcweir MyHashObject* pHObject; 547cdf0e10cSrcweir ByteString* pStr; 548cdf0e10cSrcweir ObjectWin *pStartWin, *pEndWin; 549cdf0e10cSrcweir 550cdf0e10cSrcweir mpSolIdMapper = new SolIdMapper( 63997 ); 551cdf0e10cSrcweir if (mpStandLst && bUpdater) 552cdf0e10cSrcweir { 553cdf0e10cSrcweir mpStarWriter = new StarWriter( mpStandLst, msVersionMajor, msVersionMinor, sal_True ); 554cdf0e10cSrcweir } else 555cdf0e10cSrcweir { 556cdf0e10cSrcweir SolarFileList* pSolarFileList; 557cdf0e10cSrcweir pSolarFileList = GetPrjListFromDir(); 558cdf0e10cSrcweir mpStarWriter = new StarWriter( pSolarFileList, sal_True ); 559cdf0e10cSrcweir } 560cdf0e10cSrcweir ByteString sTitle( SOLDEPL_NAME ); 561cdf0e10cSrcweir if ( mpStarWriter->GetMode() == STAR_MODE_SINGLE_PARSE ) { 562cdf0e10cSrcweir sTitle += ByteString( " - mode: single file [" ); 563cdf0e10cSrcweir sTitle += (ByteString) mpStarWriter->GetName(); 564cdf0e10cSrcweir sTitle += ByteString( "]" ); 565cdf0e10cSrcweir } 566cdf0e10cSrcweir else if ( mpStarWriter->GetMode() == STAR_MODE_MULTIPLE_PARSE ) { 567cdf0e10cSrcweir sTitle += ByteString( " - mode: multiple files [" ); 568cdf0e10cSrcweir sTitle += ByteString( "]" ); 569cdf0e10cSrcweir } 570cdf0e10cSrcweir SetTitle( String( sTitle, RTL_TEXTENCODING_UTF8) ); 571cdf0e10cSrcweir 572cdf0e10cSrcweir sal_uIntPtr nCount = mpStarWriter->Count(); 573cdf0e10cSrcweir for ( i=0; i<nCount; i++ ) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir Prj *pPrj = mpStarWriter->GetObject(i); 576cdf0e10cSrcweir ByteString sPrjName = pPrj->GetProjectName(); 577cdf0e10cSrcweir nObjectId = AddObject( sPrjName, sal_False ); 578cdf0e10cSrcweir ObjIdToPtr( mpObjectList, nObjectId )->SetViewMask( 1 ); 579cdf0e10cSrcweir } 580cdf0e10cSrcweir for ( i=0; i<nCount; i++ ) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir Prj *pPrj = mpStarWriter->GetObject(i); 583cdf0e10cSrcweir SByteStringList *pLst = pPrj->GetDependencies( sal_False ); 584cdf0e10cSrcweir if ( pLst ) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir sal_uIntPtr nDepCount = pLst->Count(); 587cdf0e10cSrcweir for ( sal_uIntPtr m=0; m<nDepCount; m++) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir pStr = pLst->GetObject(m); 590cdf0e10cSrcweir pHObject = mpSolIdMapper->Find( *pStr ); 591cdf0e10cSrcweir /*if ( !pHObject ) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir // create new prj 594cdf0e10cSrcweir Prj *pNewPrj = new Prj( *pStr ); 595cdf0e10cSrcweir ByteString sPrjName = pNewPrj->GetProjectName(); 596cdf0e10cSrcweir nObjectId = AddObject( sPrjName, sal_False ); 597cdf0e10cSrcweir pHObject = mpSolIdMapper->Find( *pStr ); 598cdf0e10cSrcweir ObjIdToPtr( mpObjectList, nObjectId )->SetViewMask( 2 ); 599cdf0e10cSrcweir }*/ 600cdf0e10cSrcweir 601cdf0e10cSrcweir if ( pHObject ) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir nHashedId = pHObject->GetId(); 604cdf0e10cSrcweir ByteString sF_Os2 = pPrj->GetProjectName(); 605cdf0e10cSrcweir pStr = &sF_Os2; 606cdf0e10cSrcweir pHObject = mpSolIdMapper->Find( *pStr ); 607cdf0e10cSrcweir nObjectId = pHObject->GetId(); 608cdf0e10cSrcweir pStartWin = ObjIdToPtr( mpObjectList, nHashedId ); 609cdf0e10cSrcweir pEndWin = ObjIdToPtr( mpObjectList, nObjectId ); 610cdf0e10cSrcweir AddConnectorToObjects( pStartWin, pEndWin ); 611cdf0e10cSrcweir } 612cdf0e10cSrcweir } 613cdf0e10cSrcweir } 614cdf0e10cSrcweir } 615cdf0e10cSrcweir if (!IsPrjView()) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir AutoArrange( mpSolIdMapper, mpObjectList, GetStart(mpSolIdMapper,mpObjectList), 0, GetStart(mpSolIdMapper,mpObjectList) ); 618cdf0e10cSrcweir GetDepWin()->EnablePaint( sal_True ); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir return 0; 621cdf0e10cSrcweir } 622cdf0e10cSrcweir 623cdf0e10cSrcweir SolarFileList* SolDep::GetPrjListFromDir() 624cdf0e10cSrcweir { 625cdf0e10cSrcweir SolarFileList* pSolarFileList = new SolarFileList(); 626cdf0e10cSrcweir String sPrjDir( String::CreateFromAscii( "prj" )); 627cdf0e10cSrcweir String sBuildLst( String::CreateFromAscii( "build.lst" )); 628cdf0e10cSrcweir DirEntry aCurrent( getenv( SOURCEROOT ) ); 629cdf0e10cSrcweir 630cdf0e10cSrcweir aCurrent.ToAbs(); 631cdf0e10cSrcweir Dir aDir( aCurrent, FSYS_KIND_DIR ); 632cdf0e10cSrcweir 633cdf0e10cSrcweir sal_uInt16 nEntries = aDir.Count(); 634cdf0e10cSrcweir if( nEntries ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir UniStringList aSortDirList; 637cdf0e10cSrcweir for ( sal_uInt16 n = 0; n < nEntries; n++ ) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir DirEntry& rEntry = aDir[n]; 640cdf0e10cSrcweir UniString aName( rEntry.GetName() ); 641cdf0e10cSrcweir if( aName.Len() && ( aName.GetChar(0) != '.' ) && rEntry.Exists() ) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir rEntry += DirEntry( sPrjDir ); 644cdf0e10cSrcweir rEntry += DirEntry( sBuildLst ); 645cdf0e10cSrcweir if (rEntry.Exists()) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir pSolarFileList->Insert( new String( rEntry.GetFull() ), LIST_APPEND ); 648cdf0e10cSrcweir ByteString aName_dbg(rEntry.GetFull(),RTL_TEXTENCODING_UTF8); 649cdf0e10cSrcweir fprintf(stdout, "bla:%s\n", aName_dbg.GetBuffer()); 650cdf0e10cSrcweir } 651cdf0e10cSrcweir } 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir if ( !pSolarFileList->Count() ) 655cdf0e10cSrcweir { 656cdf0e10cSrcweir //is empty!! TBD 657cdf0e10cSrcweir delete pSolarFileList; 658cdf0e10cSrcweir return NULL; 659cdf0e10cSrcweir } 660cdf0e10cSrcweir return pSolarFileList; 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir /*****************************************************************************/ 664cdf0e10cSrcweir sal_uInt16 SolDep::WriteSource() 665cdf0e10cSrcweir /*****************************************************************************/ 666cdf0e10cSrcweir { 667cdf0e10cSrcweir /* zur Sicherheit deaktiviert 668cdf0e10cSrcweir sal_uInt16 nMode = mpStarWriter->GetMode(); 669cdf0e10cSrcweir if ( nMode == STAR_MODE_SINGLE_PARSE ) { 670cdf0e10cSrcweir ByteString sFileName = mpStarWriter->GetName(); 671cdf0e10cSrcweir if ( sFileName.Len()) { 672cdf0e10cSrcweir mpStarWriter->Write( String( sFileName, RTL_TEXTENCODING_UTF8) ); 673cdf0e10cSrcweir mpStarWriter->RemoveProject( ByteString( "null")); //null_project 674cdf0e10cSrcweir } 675cdf0e10cSrcweir } 676cdf0e10cSrcweir else if ( nMode == STAR_MODE_MULTIPLE_PARSE ) { 677cdf0e10cSrcweir // *OBO* 678cdf0e10cSrcweir //String sRoot = mpStarWriter->GetSourceRoot(); 679cdf0e10cSrcweir //nicht mehr unterst�tzt mpStarWriter->GetSourceRoot() 680cdf0e10cSrcweir ByteString sFileName = mpStarWriter->GetName(); 681cdf0e10cSrcweir DirEntry aEntry( sFileName ); 682cdf0e10cSrcweir aEntry.ToAbs(); 683cdf0e10cSrcweir aEntry = aEntry.GetPath().GetPath().GetPath(); 684cdf0e10cSrcweir String sRoot = aEntry.GetFull(); 685cdf0e10cSrcweir 686cdf0e10cSrcweir if ( sRoot.Len()) { 687cdf0e10cSrcweir mpStarWriter->RemoveProject( ByteString( "null")); //null_project 688cdf0e10cSrcweir mpStarWriter->WriteMultiple( sRoot ); 689cdf0e10cSrcweir } 690cdf0e10cSrcweir } 691cdf0e10cSrcweir */ 692cdf0e10cSrcweir return 1; 693cdf0e10cSrcweir } 694cdf0e10cSrcweir 695cdf0e10cSrcweir sal_uInt16 SolDep::Load( const ByteString& rFileName ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir // moved from depper class 698cdf0e10cSrcweir DBG_ASSERT( sal_False , "you are dead!" ); 699cdf0e10cSrcweir SvFileStream aInFile( String( rFileName, RTL_TEXTENCODING_UTF8 ), STREAM_READ ); 700cdf0e10cSrcweir depper_head dh; 701cdf0e10cSrcweir sal_uIntPtr i; 702cdf0e10cSrcweir sal_uIntPtr nLoadOffs = mnSolLastId; //or Prj?? 703cdf0e10cSrcweir ObjectWin* pNewWin; 704cdf0e10cSrcweir aInFile.Read( &dh, sizeof( dh )); 705cdf0e10cSrcweir 706cdf0e10cSrcweir sal_uIntPtr nObjCount = dh.nObjectCount; 707cdf0e10cSrcweir sal_uIntPtr nCnctrCount = dh.nCnctrCount; 708cdf0e10cSrcweir 709cdf0e10cSrcweir for ( i=0; i < nObjCount ; i++ ) 710cdf0e10cSrcweir { 711cdf0e10cSrcweir ObjectWin* pWin = new ObjectWin( mpBaseWin, WB_BORDER ); 712cdf0e10cSrcweir pWin->Load( aInFile ); 713cdf0e10cSrcweir pNewWin = ObjIdToPtr( mpObjectList, AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, pWin->GetBodyText(), sal_False )); 714cdf0e10cSrcweir pNewWin->SetId( nLoadOffs + pWin->GetId()); 715cdf0e10cSrcweir pNewWin->SetPosPixel( pWin->GetPosPixel()); 716cdf0e10cSrcweir pNewWin->SetSizePixel( pWin->GetSizePixel()); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir sal_uIntPtr nStartId; 720cdf0e10cSrcweir sal_uIntPtr nEndId; 721cdf0e10cSrcweir // ueber addconnector fuehren! 722cdf0e10cSrcweir for ( i=0; i < nCnctrCount ; i++ ) 723cdf0e10cSrcweir { 724cdf0e10cSrcweir Connector* pCon = new Connector( mpBaseWin, WB_NOBORDER ); 725cdf0e10cSrcweir pCon->Load( aInFile ); 726cdf0e10cSrcweir 727cdf0e10cSrcweir nStartId = nLoadOffs + pCon->GetStartId(); 728cdf0e10cSrcweir nEndId = nLoadOffs + pCon->GetEndId(); 729cdf0e10cSrcweir 730cdf0e10cSrcweir ObjectWin* pStartWin = ObjIdToPtr( mpObjectList, nStartId ); 731cdf0e10cSrcweir ObjectWin* pEndWin = ObjIdToPtr( mpObjectList, nEndId ); 732cdf0e10cSrcweir 733cdf0e10cSrcweir pCon->Initialize( pStartWin, pEndWin ); 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir 737cdf0e10cSrcweir return 0; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir /*****************************************************************************/ 741cdf0e10cSrcweir sal_Bool SolDep::ViewContent( ByteString& rObjectName ) 742cdf0e10cSrcweir /*****************************************************************************/ 743cdf0e10cSrcweir { 744cdf0e10cSrcweir mpFocusWin = NULL; 745cdf0e10cSrcweir SetPrjViewStatus(sal_True); 746cdf0e10cSrcweir 747cdf0e10cSrcweir for ( sal_uIntPtr i = 0; i < mpObjectList->Count() && !mpFocusWin; i++ ) 748cdf0e10cSrcweir if ( mpObjectList->GetObject( i )->HasFocus()) 749cdf0e10cSrcweir mpFocusWin = mpObjectList->GetObject( i ); 750cdf0e10cSrcweir //HideObjectsAndConnections( mpObjectList ); 751cdf0e10cSrcweir mpProcessWin->Resize(); 752cdf0e10cSrcweir GetDepWin()->Show(); 753cdf0e10cSrcweir return InitPrj( rObjectName ); 754cdf0e10cSrcweir } 755cdf0e10cSrcweir 756cdf0e10cSrcweir /*****************************************************************************/ 757cdf0e10cSrcweir sal_Bool SolDep::InitPrj( ByteString& rListName ) 758cdf0e10cSrcweir /*****************************************************************************/ 759cdf0e10cSrcweir { 760cdf0e10cSrcweir sal_uIntPtr nObjectId, nHashedId; 761cdf0e10cSrcweir sal_uIntPtr i, j; 762cdf0e10cSrcweir MyHashObject* pHObject; 763cdf0e10cSrcweir ByteString *pDepName; 764cdf0e10cSrcweir ByteString *pFlagName; 765cdf0e10cSrcweir Prj* pPrj; 766cdf0e10cSrcweir ObjectWin *pStartWin, *pEndWin; 767cdf0e10cSrcweir maToolBox.HideItem(TID_SOLDEP_SELECT_WORKSPACE); 768cdf0e10cSrcweir maToolBox.HideItem(TID_SOLDEP_HIDE_INDEPENDEND); 769cdf0e10cSrcweir maToolBox.HideItem(TID_SOLDEP_FIND); 770cdf0e10cSrcweir maToolBox.ShowItem(TID_SOLDEP_BACK); 771cdf0e10cSrcweir maToolBox.Invalidate(); 772cdf0e10cSrcweir 773cdf0e10cSrcweir //clean up 774cdf0e10cSrcweir mpObjectPrjList->ClearAndDelete(); 775cdf0e10cSrcweir GetDepWin()->ClearConnectorList(); 776cdf0e10cSrcweir if (mpPrjIdMapper) delete mpPrjIdMapper; 777cdf0e10cSrcweir mpPrjIdMapper = new SolIdMapper( 63997 ); //generate clean mapper 778cdf0e10cSrcweir mnPrjWinCount = 0; 779cdf0e10cSrcweir mnPrjLastId = 0; 780cdf0e10cSrcweir 781cdf0e10cSrcweir sal_uIntPtr nCount = mpStarWriter->Count(); 782cdf0e10cSrcweir GetDepWin()->EnablePaint( sal_False ); 783cdf0e10cSrcweir Point aPnt = GetGraphWin()->GetPosPixel(); 784cdf0e10cSrcweir Size aSize = GetGraphWin()->GetSizePixel(); 785cdf0e10cSrcweir 786cdf0e10cSrcweir GetGraphWin()->SetPosSizePixel( aPnt, aSize ); // Hier wird das Window gesetzt 787cdf0e10cSrcweir 788cdf0e10cSrcweir sal_Bool bReturn = sal_False; 789cdf0e10cSrcweir 790cdf0e10cSrcweir for ( i=0; i<nCount; i++ ) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir // pPrj->GetProjectName() returns the name of 793cdf0e10cSrcweir // the project e.g. svtools 794cdf0e10cSrcweir pPrj = mpStarWriter->GetObject(i); 795cdf0e10cSrcweir ByteString sPrjName = pPrj->GetProjectName(); 796cdf0e10cSrcweir if ( sPrjName == rListName ) 797cdf0e10cSrcweir { 798cdf0e10cSrcweir bReturn = sal_True; 799cdf0e10cSrcweir 800cdf0e10cSrcweir mpPrj = mpStarWriter->GetObject(i); 801cdf0e10cSrcweir sal_uIntPtr nDirCount = mpPrj->Count(); 802cdf0e10cSrcweir for ( j=0; j<nDirCount; j++ ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir CommandData *pData = mpPrj->GetObject(j); 805cdf0e10cSrcweir fprintf( stdout, "\tProjectDir : %s\n", 806cdf0e10cSrcweir pData->GetLogFile().GetBuffer()); 807cdf0e10cSrcweir // pData->GetLogFile() contains internal project IDs 808cdf0e10cSrcweir // e.g. st_mkout etc. 809cdf0e10cSrcweir if ( pData->GetLogFile() != "" ) 810cdf0e10cSrcweir { 811cdf0e10cSrcweir ByteString sItem = pData->GetLogFile(); 812cdf0e10cSrcweir nObjectId = AddPrjObject( sItem, sal_False); 813cdf0e10cSrcweir // there may be faster ways...... 814cdf0e10cSrcweir ObjectWin *pWin = ObjIdToPtr( mpObjectPrjList, nObjectId ); 815cdf0e10cSrcweir pWin->SetViewMask( 0x0001 ); 816cdf0e10cSrcweir // pData->GetPath() contains internal project directories 817cdf0e10cSrcweir // e.g. svtools/inc etc. 818cdf0e10cSrcweir ByteString sPath = pData->GetPath(); 819cdf0e10cSrcweir pWin->SetTipText( sPath ); 820cdf0e10cSrcweir } 821cdf0e10cSrcweir } 822cdf0e10cSrcweir 823cdf0e10cSrcweir // set connectors for dependencies here 824cdf0e10cSrcweir for ( j=0; j<nDirCount; j++ ) 825cdf0e10cSrcweir { 826cdf0e10cSrcweir CommandData *pData = mpPrj->GetObject(j); 827cdf0e10cSrcweir SByteStringList *pDeps = pData->GetDependencies(); 828cdf0e10cSrcweir if ( pDeps ) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir ByteString sFlagName = pData->GetLogFile(); 831cdf0e10cSrcweir pFlagName = &sFlagName; 832cdf0e10cSrcweir //pHObject = mpPrjIdMapper->Find( (*pFlagName).GetToken( 0, '.'));//mpSolIdMapper see ReadSource() 833cdf0e10cSrcweir pHObject = mpPrjIdMapper->Find( sFlagName.GetToken( 0, '.')); 834cdf0e10cSrcweir if (pHObject) 835cdf0e10cSrcweir { 836cdf0e10cSrcweir 837cdf0e10cSrcweir nObjectId = pHObject->GetId(); 838cdf0e10cSrcweir 839cdf0e10cSrcweir sal_uIntPtr nDepCount = pDeps->Count(); 840cdf0e10cSrcweir for ( sal_uIntPtr k=0; k<nDepCount; k++ ) 841cdf0e10cSrcweir { 842cdf0e10cSrcweir pDepName = pDeps->GetObject(k); 843cdf0e10cSrcweir pHObject = mpPrjIdMapper->Find( (*pDepName).GetToken( 0, '.')); 844cdf0e10cSrcweir if (pHObject ) 845cdf0e10cSrcweir { 846cdf0e10cSrcweir nHashedId = pHObject->GetId(); 847cdf0e10cSrcweir pStartWin = ObjIdToPtr( mpObjectPrjList, nHashedId ); 848cdf0e10cSrcweir pEndWin = ObjIdToPtr( mpObjectPrjList, nObjectId ); 849cdf0e10cSrcweir 850cdf0e10cSrcweir AddConnectorToObjects( pStartWin, pEndWin ); 851cdf0e10cSrcweir } 852cdf0e10cSrcweir else 853cdf0e10cSrcweir { 854cdf0e10cSrcweir String sMessage; 855cdf0e10cSrcweir sMessage += String::CreateFromAscii("can't find "); 856cdf0e10cSrcweir sMessage += String( *pDepName, RTL_TEXTENCODING_UTF8 ); 857cdf0e10cSrcweir sMessage += String::CreateFromAscii(".\ndependency ignored"); 858cdf0e10cSrcweir WarningBox aBox( GetDepWin(), WB_OK, sMessage); 859cdf0e10cSrcweir aBox.Execute(); 860cdf0e10cSrcweir } 861cdf0e10cSrcweir } 862cdf0e10cSrcweir } 863cdf0e10cSrcweir } 864cdf0e10cSrcweir 865cdf0e10cSrcweir } 866cdf0e10cSrcweir 867cdf0e10cSrcweir break; 868cdf0e10cSrcweir } 869cdf0e10cSrcweir } 870cdf0e10cSrcweir ByteString sNullDir = "null"; 871cdf0e10cSrcweir nObjectId = AddPrjObject( sNullDir, sal_False); 872cdf0e10cSrcweir ObjectWin *pWin = ObjIdToPtr( mpObjectPrjList, nObjectId ); 873cdf0e10cSrcweir pWin->SetViewMask( 0x0001 ); 874cdf0e10cSrcweir mpGraphPrjWin->EnablePaint( sal_True ); 875cdf0e10cSrcweir //debug 876cdf0e10cSrcweir // int test_l = GetStartPrj(mpPrjIdMapper, mpObjectPrjList); 877cdf0e10cSrcweir // ObjectWin *pTestWin = ObjIdToPtr( mpObjectPrjList, test_l ); 878cdf0e10cSrcweir AutoArrange( mpPrjIdMapper, mpObjectPrjList, GetStartPrj(mpPrjIdMapper, mpObjectPrjList), 0, GetStartPrj(mpPrjIdMapper, mpObjectPrjList) ); 879cdf0e10cSrcweir mpGraphWin->Hide(); 880cdf0e10cSrcweir mpGraphPrjWin->Show(); 881cdf0e10cSrcweir mpGraphPrjWin->Invalidate(); 882cdf0e10cSrcweir 883cdf0e10cSrcweir return bReturn; 884cdf0e10cSrcweir } 885cdf0e10cSrcweir 886cdf0e10cSrcweir /*****************************************************************************/ 887cdf0e10cSrcweir sal_uInt16 SolDep::CloseWindow() 888cdf0e10cSrcweir /*****************************************************************************/ 889cdf0e10cSrcweir { 890cdf0e10cSrcweir 891cdf0e10cSrcweir ((SystemWindow*)mpProcessWin)->Close(); 892cdf0e10cSrcweir return 0; 893cdf0e10cSrcweir } 894cdf0e10cSrcweir 895cdf0e10cSrcweir /*****************************************************************************/ 896cdf0e10cSrcweir void SolDep::ShowHelp() 897cdf0e10cSrcweir /*****************************************************************************/ 898cdf0e10cSrcweir { 899cdf0e10cSrcweir SvFileStream aHelpFile( String::CreateFromAscii( "g:\\soldep.hlp" ), STREAM_READ ); 900cdf0e10cSrcweir String aHelpText; 901cdf0e10cSrcweir ByteString aGetStr; 902cdf0e10cSrcweir 903cdf0e10cSrcweir if ( aHelpFile.IsOpen() ) 904cdf0e10cSrcweir { 905cdf0e10cSrcweir while ( aHelpFile.ReadLine( aGetStr ) ) 906cdf0e10cSrcweir { 907cdf0e10cSrcweir aHelpText += String (aGetStr, RTL_TEXTENCODING_UTF8); 908cdf0e10cSrcweir aHelpText += String::CreateFromAscii("\n"); 909cdf0e10cSrcweir } 910cdf0e10cSrcweir } 911cdf0e10cSrcweir else 912cdf0e10cSrcweir aHelpText = String::CreateFromAscii("No Helpfile found."); 913cdf0e10cSrcweir 914cdf0e10cSrcweir SolHelpDlg aHelpDlg( mpBaseWin, DtSodResId( RID_SD_DIALOG_HELP )); 915cdf0e10cSrcweir aHelpDlg.maMLEHelp.SetText( aHelpText ); 916cdf0e10cSrcweir aHelpDlg.maMLEHelp.SetReadOnly(); 917cdf0e10cSrcweir aHelpDlg.maMLEHelp.EnableFocusSelectionHide( sal_True ); 918cdf0e10cSrcweir aHelpDlg.Execute(); 919cdf0e10cSrcweir } 920cdf0e10cSrcweir 921cdf0e10cSrcweir /*****************************************************************************/ 922cdf0e10cSrcweir sal_Bool SolDep::FindProject() 923cdf0e10cSrcweir /*****************************************************************************/ 924cdf0e10cSrcweir { 925cdf0e10cSrcweir SolFindProjectDlg aFindProjectDlg( GetDepWin(), GetObjectList() ); 926cdf0e10cSrcweir ObjectWin* pObjectWin = NULL; 927cdf0e10cSrcweir mpObjectList->ResetSelectedObject(); 928cdf0e10cSrcweir if (IsHideMode()) 929cdf0e10cSrcweir { 930cdf0e10cSrcweir GetDepWin()->Invalidate(); 931cdf0e10cSrcweir } 932cdf0e10cSrcweir 933cdf0e10cSrcweir mpFocusWin=NULL; 934cdf0e10cSrcweir 935cdf0e10cSrcweir if ( aFindProjectDlg.Execute() == RET_OK ) { 936cdf0e10cSrcweir msProject = aFindProjectDlg.GetProject(); 937cdf0e10cSrcweir //now we have a project string 938cdf0e10cSrcweir 939cdf0e10cSrcweir pObjectWin = mpObjectList->GetPtrByName( msProject ); 940cdf0e10cSrcweir if (pObjectWin) 941cdf0e10cSrcweir { 942cdf0e10cSrcweir mpObjectList->ResetSelectedObject(); 943cdf0e10cSrcweir MarkObjects( pObjectWin ); 944cdf0e10cSrcweir } 945cdf0e10cSrcweir else 946cdf0e10cSrcweir { 947cdf0e10cSrcweir mpObjectList->ResetSelectedObject(); 948cdf0e10cSrcweir for ( sal_uInt16 i=0; i<mpObjectList->Count(); i++ ) 949cdf0e10cSrcweir { 950cdf0e10cSrcweir ObjectWin* pObjectWin = mpObjectList->GetObject( i ); 951cdf0e10cSrcweir if ( !pObjectWin->IsTop() ) 952cdf0e10cSrcweir pObjectWin->SetViewMask(sal_False); 953cdf0e10cSrcweir } 954cdf0e10cSrcweir } 955cdf0e10cSrcweir } 956cdf0e10cSrcweir return sal_False; 957cdf0e10cSrcweir } 958cdf0e10cSrcweir 959cdf0e10cSrcweir sal_Bool SolDep::MarkObjects( ObjectWin* pObjectWin ) 960cdf0e10cSrcweir { 961cdf0e10cSrcweir if (pObjectWin) 962cdf0e10cSrcweir { 963cdf0e10cSrcweir if (!(pObjectWin->IsNullObject())) 964cdf0e10cSrcweir { 965cdf0e10cSrcweir pObjectWin->SetMarkMode( MARKMODE_SELECTED ); 966cdf0e10cSrcweir pObjectWin->MarkNeeded(); 967cdf0e10cSrcweir pObjectWin->MarkDepending(); 968cdf0e10cSrcweir if (IsHideMode()) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir GetDepWin()->Invalidate(); 971cdf0e10cSrcweir } 972cdf0e10cSrcweir } else 973cdf0e10cSrcweir { 974cdf0e10cSrcweir fprintf(stdout,"null\n"); 975cdf0e10cSrcweir } 976cdf0e10cSrcweir } 977cdf0e10cSrcweir return sal_True; 978cdf0e10cSrcweir } 979cdf0e10cSrcweir 980cdf0e10cSrcweir void SolDep::Resize() 981cdf0e10cSrcweir { 982cdf0e10cSrcweir //funzt! mu� aber von der applikation aufgerufen werden. 983cdf0e10cSrcweir Point aOutPos = Point( 0, 0 ); 984cdf0e10cSrcweir Size aOutSize = mpProcessWin->GetOutputSizePixel(); 985cdf0e10cSrcweir // calculate output size 986cdf0e10cSrcweir sal_uIntPtr nTaskHeight = maToolBox.CalcWindowSizePixel().Height(); 987cdf0e10cSrcweir sal_uIntPtr nTaskWidth = maToolBox.CalcWindowSizePixel().Width(); 988cdf0e10cSrcweir Size aSize( aOutSize.Width(), nTaskHeight ); 989cdf0e10cSrcweir 990cdf0e10cSrcweir // sal_uIntPtr nMenuHeight = 0; 991cdf0e10cSrcweir Point aGraphWinPos = Point(0,0); 992cdf0e10cSrcweir Size aGraphWinSize = Size(0,0); 993cdf0e10cSrcweir 994cdf0e10cSrcweir //wei� nicht wie: nMenuHeight = aMenuBar.GetWindow()->GetSizePixel().Height(); //H�he des Menues 995cdf0e10cSrcweir 996cdf0e10cSrcweir //aInRect = pTBManager->Resize( Rectangle( aOutPos, aOutSize ); 997cdf0e10cSrcweir // Set Docking-Rectangle for ToolBar 998cdf0e10cSrcweir Rectangle aInRect; 999cdf0e10cSrcweir 1000cdf0e10cSrcweir if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_TOP )) 1001cdf0e10cSrcweir { 1002cdf0e10cSrcweir // waagerechte Toolbar oben 1003cdf0e10cSrcweir maToolBox.SetPosSizePixel( aOutPos, Size( aOutSize.Width(), maToolBox.CalcWindowSizePixel().Height())); 1004cdf0e10cSrcweir if( maToolBox.IsVisible()) 1005cdf0e10cSrcweir { 1006cdf0e10cSrcweir Point aOutPosTmp; 1007cdf0e10cSrcweir Size aOutSizeTmp; 1008cdf0e10cSrcweir aOutPosTmp = Point( aOutPos.X(), aOutPos.Y() + maToolBox.CalcWindowSizePixel().Height()); 1009cdf0e10cSrcweir aOutSizeTmp = Size( aOutSize.Width(), aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height()); 1010cdf0e10cSrcweir aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); 1011cdf0e10cSrcweir aGraphWinPos = Point( 0, nTaskHeight ); 1012cdf0e10cSrcweir aGraphWinSize = Size( aOutSize.Width(), aOutSize.Height() - nTaskHeight); 1013cdf0e10cSrcweir } 1014cdf0e10cSrcweir } 1015cdf0e10cSrcweir if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_BOTTOM )) 1016cdf0e10cSrcweir { 1017cdf0e10cSrcweir // waagerechte Toolbar unten 1018cdf0e10cSrcweir Point aTbPos = Point( aOutPos.X(), aOutPos.Y() + aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height()); 1019cdf0e10cSrcweir Size aTbSize = Size( aOutSize.Width(), maToolBox.CalcWindowSizePixel().Height()); 1020cdf0e10cSrcweir maToolBox.SetPosSizePixel( aTbPos, aTbSize ); 1021cdf0e10cSrcweir if( maToolBox.IsVisible()) 1022cdf0e10cSrcweir { 1023cdf0e10cSrcweir Point aOutPosTmp; 1024cdf0e10cSrcweir Size aOutSizeTmp; 1025cdf0e10cSrcweir aOutPosTmp = Point( aOutPos.X(), aOutPos.Y() + maToolBox.CalcWindowSizePixel().Height()); 1026cdf0e10cSrcweir aOutSizeTmp = Size( aOutSize.Width(), aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height()); 1027cdf0e10cSrcweir aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); 1028cdf0e10cSrcweir aGraphWinPos = Point( 0, 0 ); 1029cdf0e10cSrcweir aGraphWinSize = Size( aOutSize.Width(), aOutSize.Height() - nTaskHeight); 1030cdf0e10cSrcweir } 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_LEFT )) 1033cdf0e10cSrcweir { 1034cdf0e10cSrcweir // senkrechte ToolBar links 1035cdf0e10cSrcweir maToolBox.SetPosSizePixel( aOutPos, Size( maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height())); 1036cdf0e10cSrcweir if( maToolBox.IsVisible()) 1037cdf0e10cSrcweir { 1038cdf0e10cSrcweir Point aOutPosTmp; 1039cdf0e10cSrcweir Size aOutSizeTmp; 1040cdf0e10cSrcweir aOutPosTmp = Point( aOutPos.X() + maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y()); 1041cdf0e10cSrcweir aOutSizeTmp = Size( aOutSize.Width()- maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height()); 1042cdf0e10cSrcweir aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); 1043cdf0e10cSrcweir aGraphWinPos = Point( nTaskWidth, 0 ); 1044cdf0e10cSrcweir aGraphWinSize = Size( aOutSize.Width() - nTaskWidth, aOutSize.Height()); 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir } 1047cdf0e10cSrcweir if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_RIGHT )) 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir // senkrechte ToolBar rechts 1050cdf0e10cSrcweir Point aTbPos = Point( aOutPos.X() + aOutSize.Width() - maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y()); 1051cdf0e10cSrcweir Size aTbSize= Size( maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height()); 1052cdf0e10cSrcweir maToolBox.SetPosSizePixel( aTbPos, aTbSize); 1053cdf0e10cSrcweir if( maToolBox.IsVisible()) 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir Point aOutPosTmp; 1056cdf0e10cSrcweir Size aOutSizeTmp; 1057cdf0e10cSrcweir aOutPosTmp = Point( aOutPos.X() + maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y()); 1058cdf0e10cSrcweir aOutSizeTmp = Size( aOutSize.Width()- maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height()); 1059cdf0e10cSrcweir aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); 1060cdf0e10cSrcweir aGraphWinPos = Point( 0, 0 ); 1061cdf0e10cSrcweir aGraphWinSize = Size( aOutSize.Width() - nTaskWidth, aOutSize.Height()); 1062cdf0e10cSrcweir } 1063cdf0e10cSrcweir } 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir Rectangle rout = Rectangle( Point( 0,0 ), aOutSize ); //OutputToScreenPixel( aOutPos ) 1066cdf0e10cSrcweir Rectangle rin = Rectangle( Point( 0,0 ),//OutputToScreenPixel( Point( aOutPos.X() - 20, aInRect.Top()) 1067cdf0e10cSrcweir Size( aOutSize.Width(), aOutSize.Height())); 1068cdf0e10cSrcweir /* 1069cdf0e10cSrcweir Rectangle rout = mpProcessWin->OutputToScreenPixel( aOutPos ); 1070cdf0e10cSrcweir Rectangle rin = Rectangle( Point( 0,0 ),//OutputToScreenPixel( Point( aOutPos.X() - 20, aInRect.Top()) 1071cdf0e10cSrcweir Size( aOutSize.Width(), aOutSize.Height())); 1072cdf0e10cSrcweir */ 1073cdf0e10cSrcweir maToolBox.SetDockingRects( rout, rin ); 1074cdf0e10cSrcweir 1075cdf0e10cSrcweir sal_Bool bFloating = maToolBox.IsFloatingMode(); 1076cdf0e10cSrcweir 1077cdf0e10cSrcweir if ( bFloating ) 1078cdf0e10cSrcweir { 1079cdf0e10cSrcweir GetGraphWin()->SetPosSizePixel(Point(0,0),aOutSize); 1080cdf0e10cSrcweir //if (IsPrjView() && (mpPrjDep)) mpPrjDep->Resize(); 1081cdf0e10cSrcweir if (maToolBox.IsVisible()) maToolBox.Show(); 1082cdf0e10cSrcweir } else 1083cdf0e10cSrcweir { 1084cdf0e10cSrcweir GetGraphWin()->SetPosSizePixel( aGraphWinPos, aGraphWinSize ); 1085cdf0e10cSrcweir } 1086cdf0e10cSrcweir if (maToolBox.IsVisible()) maToolBox.Show(); 1087cdf0e10cSrcweir } 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir sal_uInt16 SolDep::AddConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin ) 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir // DBG_ASSERT( FALSE , "not yet" ); 1092cdf0e10cSrcweir ByteString sEndName = pEndWin->GetBodyText(); 1093cdf0e10cSrcweir ByteString sStartName = pStartWin->GetBodyText(); 1094cdf0e10cSrcweir if ( sStartName != ByteString("null")) 1095cdf0e10cSrcweir { 1096cdf0e10cSrcweir CommandData* pEndData = mpPrj->GetDirectoryData( sEndName ); 1097cdf0e10cSrcweir SByteStringList* pDeps = pEndData->GetDependencies(); 1098cdf0e10cSrcweir if ( pDeps ) 1099cdf0e10cSrcweir pDeps->PutString( &sStartName ); 1100cdf0e10cSrcweir else 1101cdf0e10cSrcweir { 1102cdf0e10cSrcweir pDeps = new SByteStringList(); 1103cdf0e10cSrcweir pEndData->SetDependencies( pDeps ); 1104cdf0e10cSrcweir pDeps->PutString( &sStartName ); 1105cdf0e10cSrcweir pEndData->GetDependencies(); 1106cdf0e10cSrcweir } 1107cdf0e10cSrcweir } 1108cdf0e10cSrcweir return AddConnectorToObjects( pStartWin, pEndWin ); 1109cdf0e10cSrcweir } 1110cdf0e10cSrcweir 1111cdf0e10cSrcweir sal_uInt16 SolDep::RemoveConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin ) 1112cdf0e10cSrcweir { 1113cdf0e10cSrcweir ByteString sEndName = pEndWin->GetBodyText(); 1114cdf0e10cSrcweir ByteString sStartName = pStartWin->GetBodyText(); 1115cdf0e10cSrcweir CommandData* pEndData = mpPrj->GetDirectoryData( sEndName ); 1116cdf0e10cSrcweir SByteStringList* pDeps = pEndData->GetDependencies(); 1117cdf0e10cSrcweir if ( pDeps ) 1118cdf0e10cSrcweir { 1119cdf0e10cSrcweir ByteString* pString; 1120cdf0e10cSrcweir sal_uIntPtr nDepsCount = pDeps->Count(); 1121cdf0e10cSrcweir for ( sal_uIntPtr j = nDepsCount; j > 0; j-- ) 1122cdf0e10cSrcweir { 1123cdf0e10cSrcweir pString = pDeps->GetObject( j - 1 ); 1124cdf0e10cSrcweir if ( pString->GetToken( 0, '.') == sStartName ) 1125cdf0e10cSrcweir pDeps->Remove( pString ); 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir } 1128cdf0e10cSrcweir return RemoveConnectorFromObjects( pStartWin, pEndWin ); 1129cdf0e10cSrcweir } 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir sal_uInt16 SolDep::AutoArrange( SolIdMapper* pIdMapper, ObjectList* pObjLst, sal_uIntPtr nTopId, sal_uIntPtr nBottmId, sal_uIntPtr aObjID ) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir AutoArrangeDlgStart(); 1134cdf0e10cSrcweir OptimizePos(pIdMapper, pObjLst, nTopId, nBottmId, aObjID ); 1135cdf0e10cSrcweir AutoArrangeDlgStop(); 1136cdf0e10cSrcweir return 0; 1137cdf0e10cSrcweir } 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir Point SolDep::CalcPos( sal_uInt16 nSet, sal_uInt16 nIndex ) 1140cdf0e10cSrcweir { 1141cdf0e10cSrcweir int nRowIndex = nIndex / DEPPER_MAX_WIDTH; 1142cdf0e10cSrcweir sal_uIntPtr nPosX = mnXOffset + nRowIndex % 3 * GetDefSize().Width() / 3 + ( nIndex - ( DEPPER_MAX_WIDTH * nRowIndex )) * (GetDefSize().Width() + OBJWIN_X_SPACING ); 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir sal_uIntPtr nPosY = ( nSet + mnLevelOffset + nRowIndex ) * ( GetDefSize().Height() + OBJWIN_Y_SPACING ) + OBJWIN_Y_SPACING; 1145cdf0e10cSrcweir Point aPos( nPosX, nPosY ); 1146cdf0e10cSrcweir return aPos; 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir sal_uIntPtr SolDep::CalcXOffset( sal_uIntPtr nObjectsToFit ) 1150cdf0e10cSrcweir { 1151cdf0e10cSrcweir long nDynXOffs; 1152cdf0e10cSrcweir long nXMiddle; 1153cdf0e10cSrcweir sal_uIntPtr nTrigger; 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir nXMiddle = GetDepWin()->PixelToLogic( GetDepWin()->GetSizePixel()).Width() / 2; 1156cdf0e10cSrcweir if ( nObjectsToFit > DEPPER_MAX_WIDTH ) 1157cdf0e10cSrcweir nObjectsToFit = DEPPER_MAX_WIDTH - 1 + DEPPER_MAX_WIDTH % 2; 1158cdf0e10cSrcweir nTrigger = ( nObjectsToFit - 1 ) / 2; 1159cdf0e10cSrcweir nDynXOffs = ( GetDefSize().Width() + OBJWIN_X_SPACING ) * nTrigger; 1160cdf0e10cSrcweir sal_uIntPtr nXOffs = nXMiddle - nDynXOffs; 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir if ( sal_uIntPtr(nXMiddle - nDynXOffs) < mnMinDynXOffs ) 1163cdf0e10cSrcweir mnMinDynXOffs = nXMiddle - nDynXOffs; 1164cdf0e10cSrcweir 1165cdf0e10cSrcweir return nXOffs; 1166cdf0e10cSrcweir 1167cdf0e10cSrcweir } 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir double SolDep::CalcDistSum( ObjWinList* pObjList, DistType eDistType ) 1170cdf0e10cSrcweir { 1171cdf0e10cSrcweir ObjectWin* pWin; 1172cdf0e10cSrcweir Connector* pCon; 1173cdf0e10cSrcweir sal_uIntPtr nObjCount = pObjList->Count(); 1174cdf0e10cSrcweir double dRetVal = 0; 1175cdf0e10cSrcweir double dWinVal; 1176cdf0e10cSrcweir sal_uInt16 i, j; 1177cdf0e10cSrcweir sal_Bool bIsStart; 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir for ( i = 0; i < nObjCount; i++ ) 1180cdf0e10cSrcweir { 1181cdf0e10cSrcweir pWin = pObjList->GetObject( i ); 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir if ( pWin && pWin->IsVisible()) 1184cdf0e10cSrcweir { 1185cdf0e10cSrcweir j = 0; 1186cdf0e10cSrcweir dWinVal = 0; 1187cdf0e10cSrcweir while ( (pCon = pWin->GetConnector( j )) ) 1188cdf0e10cSrcweir { 1189cdf0e10cSrcweir if ( pCon->IsVisible()) { 1190cdf0e10cSrcweir bIsStart = pCon->IsStart( pWin ); 1191cdf0e10cSrcweir if ( eDistType != BOTH ) 1192cdf0e10cSrcweir if ( eDistType == TOPDOWN ) 1193cdf0e10cSrcweir { 1194cdf0e10cSrcweir if ( bIsStart ) 1195cdf0e10cSrcweir { 1196cdf0e10cSrcweir pCon->UpdatePosition( pWin, sal_False ); 1197cdf0e10cSrcweir dWinVal += pCon->GetLen() * pWin->mnHeadDist; 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir else 1201cdf0e10cSrcweir { 1202cdf0e10cSrcweir if ( !bIsStart ) 1203cdf0e10cSrcweir { 1204cdf0e10cSrcweir pCon->UpdatePosition( pWin, sal_False ); 1205cdf0e10cSrcweir dWinVal += pCon->GetLen() * pWin->mnRootDist; 1206cdf0e10cSrcweir } 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir } 1209cdf0e10cSrcweir else 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir pCon->UpdatePosition( pWin, sal_False ); 1212cdf0e10cSrcweir if ( !bIsStart ) 1213cdf0e10cSrcweir dWinVal += pCon->GetLen() * ( pWin->mnHeadDist + 1 ); 1214cdf0e10cSrcweir else 1215cdf0e10cSrcweir dWinVal += pCon->GetLen() * pWin->mnRootDist; 1216cdf0e10cSrcweir } 1217cdf0e10cSrcweir } 1218cdf0e10cSrcweir j++; 1219cdf0e10cSrcweir } 1220cdf0e10cSrcweir // if ( j != 0 ) 1221cdf0e10cSrcweir // dWinVal /= j; 1222cdf0e10cSrcweir dRetVal += dWinVal; 1223cdf0e10cSrcweir } 1224cdf0e10cSrcweir } 1225cdf0e10cSrcweir 1226cdf0e10cSrcweir return dRetVal; 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir sal_uInt16 SolDep::Impl_Traveller( ObjectWin* pWin, sal_uInt16 nDepth ) 1230cdf0e10cSrcweir { 1231cdf0e10cSrcweir sal_uInt16 i = 0; 1232cdf0e10cSrcweir ObjectWin* pNewWin; 1233cdf0e10cSrcweir Connector* pCon; 1234cdf0e10cSrcweir 1235cdf0e10cSrcweir nDepth++; 1236cdf0e10cSrcweir 1237cdf0e10cSrcweir sal_uInt16 nMaxDepth = nDepth; 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir pWin->mbVisited = sal_True; 1240cdf0e10cSrcweir pWin->mnRootDist = Max ( nDepth, pWin-> mnRootDist ); 1241cdf0e10cSrcweir if ( nDepth > DEPPER_MAX_DEPTH ) 1242cdf0e10cSrcweir { 1243cdf0e10cSrcweir DBG_ASSERT( nDepth != DEPPER_MAX_DEPTH + 1, "Ringabh�ngigkeit!" ); 1244cdf0e10cSrcweir nDepth++; 1245cdf0e10cSrcweir return DEP_ENDLES_RECURSION_FOUND; 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir while ( (pCon = pWin->GetConnector( i )) ) 1249cdf0e10cSrcweir { 1250cdf0e10cSrcweir if ( pCon->IsStart( pWin )&& pCon->IsVisible() ) //removed: don't show null_project 1251cdf0e10cSrcweir { 1252cdf0e10cSrcweir pNewWin = pCon->GetOtherWin( pWin ); 1253cdf0e10cSrcweir nMaxDepth = Max( Impl_Traveller( pNewWin, nDepth ), nMaxDepth ); 1254cdf0e10cSrcweir if( nMaxDepth == DEP_ENDLES_RECURSION_FOUND ) 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir mpTravellerList->Insert( pWin, LIST_APPEND ); 1257cdf0e10cSrcweir return DEP_ENDLES_RECURSION_FOUND; 1258cdf0e10cSrcweir } 1259cdf0e10cSrcweir } 1260cdf0e10cSrcweir i++; 1261cdf0e10cSrcweir } 1262cdf0e10cSrcweir pWin->mnHeadDist = MAX( pWin->mnHeadDist, nMaxDepth - nDepth ); 1263cdf0e10cSrcweir return nMaxDepth; 1264cdf0e10cSrcweir } 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir 1267cdf0e10cSrcweir double SolDep::Impl_PermuteMin( ObjWinList& rObjList, Point* pPosArray, ObjWinList& rResultList, double dMinDist, sal_uIntPtr nStart, sal_uIntPtr nSize, DistType eDistType ) 1268cdf0e10cSrcweir { 1269cdf0e10cSrcweir 1270cdf0e10cSrcweir sal_uIntPtr i, j, l; 1271cdf0e10cSrcweir sal_uIntPtr nEnd = nStart + nSize; 1272cdf0e10cSrcweir ObjectWin* pSwapWin; 1273cdf0e10cSrcweir sal_uIntPtr nLevelObjCount = rObjList.Count(); 1274cdf0e10cSrcweir 1275cdf0e10cSrcweir //dont use full recusion for more than 6 objects 1276cdf0e10cSrcweir if ( nLevelObjCount > 6 ) 1277cdf0e10cSrcweir { 1278cdf0e10cSrcweir srand(( unsigned ) time( NULL )); 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir sal_uIntPtr nIdx1, nIdx2; 1281cdf0e10cSrcweir for ( i = 0; i < 101; i++ ) 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir UpdateSubProgrssBar(i); 1284cdf0e10cSrcweir for ( j = 0; j < 100; j++ ) 1285cdf0e10cSrcweir { 1286cdf0e10cSrcweir nIdx1 = (sal_uIntPtr) ( double( rand() ) / RAND_MAX * nLevelObjCount ); 1287cdf0e10cSrcweir while ( rObjList.GetObject( nIdx1 ) == NULL ) 1288cdf0e10cSrcweir nIdx1 = (sal_uIntPtr) ( double( rand() ) / RAND_MAX * nLevelObjCount ); 1289cdf0e10cSrcweir nIdx2 = (sal_uIntPtr) ( double( rand() ) / RAND_MAX * nLevelObjCount ); 1290cdf0e10cSrcweir while ( nIdx1 == nIdx2 || nIdx2 == nLevelObjCount ) 1291cdf0e10cSrcweir nIdx2 = (sal_uIntPtr) ( double( rand() ) / RAND_MAX * nLevelObjCount ); 1292cdf0e10cSrcweir 1293cdf0e10cSrcweir pSwapWin = rObjList.GetObject( nIdx1 ); 1294cdf0e10cSrcweir if ( pSwapWin ) 1295cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( pPosArray[ nIdx2 ] ); 1296cdf0e10cSrcweir pSwapWin = rObjList.Replace( pSwapWin, nIdx2 ); 1297cdf0e10cSrcweir if ( pSwapWin ) 1298cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( pPosArray[ nIdx1 ] ); 1299cdf0e10cSrcweir rObjList.Replace( pSwapWin, nIdx1 ); 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir double dCurDist = CalcDistSum( &rObjList, eDistType ); 1302cdf0e10cSrcweir 1303cdf0e10cSrcweir if ( dCurDist < dMinDist ) 1304cdf0e10cSrcweir { 1305cdf0e10cSrcweir dMinDist = dCurDist; 1306cdf0e10cSrcweir rResultList.Clear(); 1307cdf0e10cSrcweir for ( l = 0; l < nLevelObjCount; l++ ) 1308cdf0e10cSrcweir { 1309cdf0e10cSrcweir pSwapWin = rObjList.GetObject( l ); 1310cdf0e10cSrcweir rResultList.Insert( pSwapWin, LIST_APPEND); 1311cdf0e10cSrcweir } 1312cdf0e10cSrcweir } 1313cdf0e10cSrcweir // if ( dCurDist > dMinDist * 1.5 ) 1314cdf0e10cSrcweir if ( dCurDist > dMinDist * 15 ) 1315cdf0e10cSrcweir { 1316cdf0e10cSrcweir pSwapWin = rObjList.GetObject( nIdx1 ); 1317cdf0e10cSrcweir if ( pSwapWin ) 1318cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( pPosArray[ nIdx2 ] ); 1319cdf0e10cSrcweir pSwapWin = rObjList.Replace( pSwapWin, nIdx2 ); 1320cdf0e10cSrcweir if ( pSwapWin ) 1321cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( pPosArray[ nIdx1 ] ); 1322cdf0e10cSrcweir rObjList.Replace( pSwapWin, nIdx1 ); 1323cdf0e10cSrcweir } 1324cdf0e10cSrcweir } 1325cdf0e10cSrcweir } 1326cdf0e10cSrcweir } 1327cdf0e10cSrcweir else 1328cdf0e10cSrcweir { 1329cdf0e10cSrcweir for ( i = nStart ; i < nEnd; i++) 1330cdf0e10cSrcweir { 1331cdf0e10cSrcweir if ( nSize > 1 ) 1332cdf0e10cSrcweir { 1333cdf0e10cSrcweir pSwapWin = rObjList.GetObject( i ); 1334cdf0e10cSrcweir pSwapWin = rObjList.Replace( pSwapWin, nStart ); 1335cdf0e10cSrcweir rObjList.Replace( pSwapWin, i ); 1336cdf0e10cSrcweir double dPermuteDist = Impl_PermuteMin( rObjList, pPosArray, rResultList, dMinDist, nStart + 1, nSize - 1, eDistType ); 1337cdf0e10cSrcweir dMinDist = MIN( dMinDist, dPermuteDist); 1338cdf0e10cSrcweir pSwapWin = rObjList.GetObject( i ); 1339cdf0e10cSrcweir pSwapWin = rObjList.Replace( pSwapWin, nStart ); 1340cdf0e10cSrcweir rObjList.Replace( pSwapWin, i ); 1341cdf0e10cSrcweir 1342cdf0e10cSrcweir } 1343cdf0e10cSrcweir else 1344cdf0e10cSrcweir { 1345cdf0e10cSrcweir for ( l = 0; l < nLevelObjCount; l++ ) 1346cdf0e10cSrcweir { 1347cdf0e10cSrcweir pSwapWin = rObjList.GetObject( l ); 1348cdf0e10cSrcweir if ( pSwapWin ) 1349cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( pPosArray[ l ] ); 1350cdf0e10cSrcweir } 1351cdf0e10cSrcweir 1352cdf0e10cSrcweir double dCurDist = CalcDistSum( &rObjList, eDistType ); 1353cdf0e10cSrcweir 1354cdf0e10cSrcweir if ( dCurDist < dMinDist ) 1355cdf0e10cSrcweir { 1356cdf0e10cSrcweir dMinDist = dCurDist; 1357cdf0e10cSrcweir rResultList.Clear(); 1358cdf0e10cSrcweir for ( l = 0; l < nLevelObjCount; l++ ) 1359cdf0e10cSrcweir { 1360cdf0e10cSrcweir pSwapWin = rObjList.GetObject( l ); 1361cdf0e10cSrcweir rResultList.Insert( pSwapWin, LIST_APPEND); 1362cdf0e10cSrcweir } 1363cdf0e10cSrcweir } 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir } 1366cdf0e10cSrcweir } 1367cdf0e10cSrcweir } 1368cdf0e10cSrcweir 1369cdf0e10cSrcweir return dMinDist; 1370cdf0e10cSrcweir } 1371cdf0e10cSrcweir 1372cdf0e10cSrcweir 1373cdf0e10cSrcweir sal_uInt16 SolDep::OptimizePos(SolIdMapper* pIdMapper, ObjectList* pObjLst, sal_uIntPtr nTopId, sal_uIntPtr nBottmId, sal_uIntPtr aObjID ) 1374cdf0e10cSrcweir { 1375cdf0e10cSrcweir ObjWinList aWorkList; 1376cdf0e10cSrcweir ObjectWin* pWin; 1377cdf0e10cSrcweir Connector* pCon; 1378cdf0e10cSrcweir sal_uInt16 nRootDist = (sal_uInt16) -1; 1379cdf0e10cSrcweir sal_uInt16 i, j, k, l, nRetVal; 1380cdf0e10cSrcweir sal_uInt16 LevelUse[ DEPPER_MAX_DEPTH ]; 1381cdf0e10cSrcweir sal_uInt16 LevelSecUse[ DEPPER_MAX_DEPTH ]; 1382cdf0e10cSrcweir ObjWinList* LevelList[ DEPPER_MAX_DEPTH ]; 1383cdf0e10cSrcweir ObjWinList* LevelSecList[ DEPPER_MAX_DEPTH ]; 1384cdf0e10cSrcweir Point aPosArray[ DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH ]; 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir mnMinDynXOffs = 0xffff; 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir for ( i = 0; i < DEPPER_MAX_DEPTH; i++ ) 1389cdf0e10cSrcweir { 1390cdf0e10cSrcweir LevelUse[ i ] = 0; 1391cdf0e10cSrcweir LevelList[ i ] = NULL; 1392cdf0e10cSrcweir LevelSecUse[ i ] = 0; 1393cdf0e10cSrcweir LevelSecList[ i ] = NULL; 1394cdf0e10cSrcweir } 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir GetDepWin()->EnablePaint( sal_False ); 1397cdf0e10cSrcweir 1398cdf0e10cSrcweir sal_uIntPtr nObjCount = pObjLst->Count(); 1399cdf0e10cSrcweir for ( i = 0; i < nObjCount; i++ ) 1400cdf0e10cSrcweir { 1401cdf0e10cSrcweir pWin = pObjLst->GetObject( i ); 1402cdf0e10cSrcweir if ( pWin->IsVisible()) { 1403cdf0e10cSrcweir pWin->mbVisited = sal_False; 1404cdf0e10cSrcweir pWin->mnHeadDist = 0; 1405cdf0e10cSrcweir pWin->mnRootDist = 0; 1406cdf0e10cSrcweir 1407cdf0e10cSrcweir // find initial objects which need to be connected with 1408cdf0e10cSrcweir // root object 1409cdf0e10cSrcweir j = 0; 1410cdf0e10cSrcweir sal_uInt16 nStartCount = 0; 1411cdf0e10cSrcweir sal_uInt16 nEndCount = 0; 1412cdf0e10cSrcweir while ( (pCon = pWin->GetConnector( j )) ) 1413cdf0e10cSrcweir { 1414cdf0e10cSrcweir if ( pCon->IsVisible()) { //null_project 1415cdf0e10cSrcweir if( pCon->IsStart( pWin )) 1416cdf0e10cSrcweir nStartCount++; 1417cdf0e10cSrcweir else 1418cdf0e10cSrcweir { 1419cdf0e10cSrcweir nEndCount = 1; 1420cdf0e10cSrcweir break; 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir } 1423cdf0e10cSrcweir j++; 1424cdf0e10cSrcweir } 1425cdf0e10cSrcweir 1426cdf0e10cSrcweir if ( nStartCount > 0 && nEndCount == 0 ) 1427cdf0e10cSrcweir if ( nTopId != pWin->GetId()) 1428cdf0e10cSrcweir AddConnectorToObjects( pObjLst, nTopId, pWin->GetId()); 1429cdf0e10cSrcweir 1430cdf0e10cSrcweir } 1431cdf0e10cSrcweir } 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir pWin = ObjIdToPtr( pObjLst, nTopId ); 1434cdf0e10cSrcweir 1435cdf0e10cSrcweir if ( mpTravellerList ) 1436cdf0e10cSrcweir { 1437cdf0e10cSrcweir mpTravellerList->Clear(); 1438cdf0e10cSrcweir delete mpTravellerList; 1439cdf0e10cSrcweir } 1440cdf0e10cSrcweir mpTravellerList = new ObjWinList(); 1441cdf0e10cSrcweir // set root and top distance 1442cdf0e10cSrcweir nRetVal = Impl_Traveller( pWin, nRootDist ); 1443cdf0e10cSrcweir 1444cdf0e10cSrcweir DBG_ASSERT( nRetVal < DEPPER_MAX_DEPTH , "zu tief" ); 1445cdf0e10cSrcweir if ( nRetVal == DEP_ENDLES_RECURSION_FOUND ) 1446cdf0e10cSrcweir { 1447cdf0e10cSrcweir WriteToErrorFile(); 1448cdf0e10cSrcweir return nRetVal; 1449cdf0e10cSrcweir } 1450cdf0e10cSrcweir 1451cdf0e10cSrcweir sal_uIntPtr nUnvisited = 0; 1452cdf0e10cSrcweir sal_uIntPtr nUnvisYOffs = 0; 1453cdf0e10cSrcweir 1454cdf0e10cSrcweir // seperate mainstream, secondary and unconnected 1455cdf0e10cSrcweir for ( i = 0; i < nObjCount; i++ ) 1456cdf0e10cSrcweir { 1457cdf0e10cSrcweir pWin = pObjLst->GetObject( i ); 1458cdf0e10cSrcweir if ( pWin->IsVisible()) { 1459cdf0e10cSrcweir if (( pWin->mnHeadDist + pWin->mnRootDist ) == nRetVal ) 1460cdf0e10cSrcweir { 1461cdf0e10cSrcweir if ( !LevelList[ pWin->mnHeadDist ] ) 1462cdf0e10cSrcweir LevelList[ pWin->mnHeadDist ] = new ObjWinList; 1463cdf0e10cSrcweir LevelList[ pWin->mnHeadDist ]->Insert( pWin ); 1464cdf0e10cSrcweir LevelUse[ pWin->mnHeadDist ]++; 1465cdf0e10cSrcweir } 1466cdf0e10cSrcweir else 1467cdf0e10cSrcweir if ( pWin->mbVisited ) 1468cdf0e10cSrcweir { 1469cdf0e10cSrcweir if ( !LevelSecList[ nRetVal - pWin->mnRootDist ] ) 1470cdf0e10cSrcweir LevelSecList[ nRetVal - pWin->mnRootDist ] = new ObjWinList; 1471cdf0e10cSrcweir LevelSecList[ nRetVal - pWin->mnRootDist ]->Insert( pWin ); 1472cdf0e10cSrcweir LevelSecUse[ nRetVal - pWin->mnRootDist ]++; 1473cdf0e10cSrcweir } 1474cdf0e10cSrcweir else 1475cdf0e10cSrcweir { 1476cdf0e10cSrcweir // need to be arranged more intelligent... 1477cdf0e10cSrcweir Point aPos( 5, nUnvisYOffs ); 1478cdf0e10cSrcweir pWin->SetCalcPosPixel( aPos ); 1479cdf0e10cSrcweir 1480cdf0e10cSrcweir Point aTmpPos = pWin->GetCalcPosPixel(); 1481cdf0e10cSrcweir pWin->SetPosPixel( mpBaseWin->LogicToPixel( aTmpPos )); 1482cdf0e10cSrcweir 1483cdf0e10cSrcweir nUnvisYOffs += pWin->PixelToLogic( pWin->GetSizePixel()).Height(); 1484cdf0e10cSrcweir nUnvisited++; 1485cdf0e10cSrcweir } 1486cdf0e10cSrcweir } 1487cdf0e10cSrcweir } 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir mnLevelOffset = 0; 1490cdf0e10cSrcweir 1491cdf0e10cSrcweir sal_uInt16 nScaleVal; 1492cdf0e10cSrcweir 1493cdf0e10cSrcweir if ( nRetVal == 0 ) 1494cdf0e10cSrcweir nScaleVal = 1; 1495cdf0e10cSrcweir else 1496cdf0e10cSrcweir nScaleVal = nRetVal; 1497cdf0e10cSrcweir 1498cdf0e10cSrcweir i = 0; 1499cdf0e10cSrcweir 1500cdf0e10cSrcweir sal_uInt16 nStep = 0; 1501cdf0e10cSrcweir 1502cdf0e10cSrcweir while ( LevelList[ i ] ) 1503cdf0e10cSrcweir { 1504cdf0e10cSrcweir UpdateMainProgressBar(i, nScaleVal, nStep); 1505cdf0e10cSrcweir DBG_ASSERT( LevelUse[ i ] == LevelList[ i ]->Count() , "level index im a..." ); 1506cdf0e10cSrcweir ObjectWin* pSwapWin; 1507cdf0e10cSrcweir sal_uIntPtr nLevelObjCount = LevelList[ i ]->Count(); 1508cdf0e10cSrcweir 1509cdf0e10cSrcweir if ( nLevelObjCount % 2 == 0 ) 1510cdf0e10cSrcweir { 1511cdf0e10cSrcweir LevelList[ i ]->Insert( NULL, LIST_APPEND ); 1512cdf0e10cSrcweir nLevelObjCount++; 1513cdf0e10cSrcweir // LevelUse bleibt orginal... 1514cdf0e10cSrcweir // LevelUse[ i ]++; 1515cdf0e10cSrcweir } 1516cdf0e10cSrcweir 1517cdf0e10cSrcweir // catch too big lists 1518cdf0e10cSrcweir DBG_ASSERT( nLevelObjCount < DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH , "graph zu breit! dat geiht nich gut. breaking" ); 1519cdf0e10cSrcweir if ( nLevelObjCount >= DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH ) 1520cdf0e10cSrcweir { 1521cdf0e10cSrcweir WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph zu breit! dat geiht nich gut. breaking")); 1522cdf0e10cSrcweir aWBox.Execute(); 1523cdf0e10cSrcweir break; 1524cdf0e10cSrcweir } 1525cdf0e10cSrcweir mnXOffset = CalcXOffset( nLevelObjCount ); 1526cdf0e10cSrcweir aWorkList.Clear(); 1527cdf0e10cSrcweir 1528cdf0e10cSrcweir // initial positioning for mainstream 1529cdf0e10cSrcweir for ( j = 0; j < nLevelObjCount; j++ ) 1530cdf0e10cSrcweir { 1531cdf0e10cSrcweir pSwapWin = LevelList[ i ]->GetObject( j ); 1532cdf0e10cSrcweir aWorkList.Insert( pSwapWin, LIST_APPEND); 1533cdf0e10cSrcweir Point aPos = CalcPos( i, j ); 1534cdf0e10cSrcweir aPosArray[ j ] = aPos; 1535cdf0e10cSrcweir if ( pSwapWin ) 1536cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1537cdf0e10cSrcweir } 1538cdf0e10cSrcweir 1539cdf0e10cSrcweir double dMinDist = CalcDistSum( LevelList[ i ] ); 1540cdf0e10cSrcweir 1541cdf0e10cSrcweir // optimize mainstream order and return best matching list in "aWorkList" 1542cdf0e10cSrcweir dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelObjCount )); 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir // set optimized positions - may still be wrong from later tries 1545cdf0e10cSrcweir for ( j = 0; j < nLevelObjCount; j++ ) 1546cdf0e10cSrcweir { 1547cdf0e10cSrcweir pSwapWin = aWorkList.GetObject( j ); 1548cdf0e10cSrcweir if ( pSwapWin ) 1549cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1550cdf0e10cSrcweir } 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir if ( LevelSecList[ i ] != NULL ) 1553cdf0e10cSrcweir { 1554cdf0e10cSrcweir sal_uIntPtr nLevelSecObjCount = LevelSecList[ i ]->Count(); 1555cdf0e10cSrcweir // expand list for better positioning 1556cdf0e10cSrcweir while ( nLevelSecObjCount + LevelUse[ i ] < DEPPER_MAX_WIDTH - 1 ) 1557cdf0e10cSrcweir { 1558cdf0e10cSrcweir LevelSecList[ i ]->Insert( NULL, LIST_APPEND ); 1559cdf0e10cSrcweir nLevelSecObjCount++; 1560cdf0e10cSrcweir } 1561cdf0e10cSrcweir if ( ( nLevelSecObjCount + LevelUse[ i ])% 2 == 0 ) 1562cdf0e10cSrcweir { 1563cdf0e10cSrcweir LevelSecList[ i ]->Insert( NULL, LIST_APPEND ); 1564cdf0e10cSrcweir nLevelSecObjCount++; 1565cdf0e10cSrcweir } 1566cdf0e10cSrcweir 1567cdf0e10cSrcweir DBG_ASSERT( nLevelSecObjCount < DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH , "graph zu breit! dat geiht nich gut. breaking" ); 1568cdf0e10cSrcweir if ( nLevelObjCount >= DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH ) 1569cdf0e10cSrcweir { 1570cdf0e10cSrcweir WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph zu breit! dat geiht nich gut. breaking")); 1571cdf0e10cSrcweir aWBox.Execute(); 1572cdf0e10cSrcweir break; 1573cdf0e10cSrcweir } 1574cdf0e10cSrcweir mnXOffset = CalcXOffset( LevelUse[ i ] + nLevelSecObjCount ); 1575cdf0e10cSrcweir aWorkList.Clear(); 1576cdf0e10cSrcweir 1577cdf0e10cSrcweir l = 0; 1578cdf0e10cSrcweir sal_Bool bUsedPos; 1579cdf0e10cSrcweir 1580cdf0e10cSrcweir // find free positions for secondary objects 1581cdf0e10cSrcweir for ( j = 0; j < ( LevelUse[ i ] + nLevelSecObjCount ) ; j++ ) 1582cdf0e10cSrcweir { 1583cdf0e10cSrcweir Point aPos = CalcPos( i, j ); 1584cdf0e10cSrcweir bUsedPos = sal_False; 1585cdf0e10cSrcweir // is already occupied? 1586cdf0e10cSrcweir for ( k = 0; k < nLevelObjCount; k++ ) 1587cdf0e10cSrcweir { 1588cdf0e10cSrcweir if ( LevelList[ i ]->GetObject( k ) ) 1589cdf0e10cSrcweir if ( aPos == LevelList[ i ]->GetObject( k )->GetCalcPosPixel() ) 1590cdf0e10cSrcweir bUsedPos = sal_True; 1591cdf0e10cSrcweir } 1592cdf0e10cSrcweir // if its free, add to pool 1593cdf0e10cSrcweir if ( !bUsedPos ) 1594cdf0e10cSrcweir { 1595cdf0e10cSrcweir aPosArray[ l ] = aPos; 1596cdf0e10cSrcweir l++; 1597cdf0e10cSrcweir } 1598cdf0e10cSrcweir } 1599cdf0e10cSrcweir 1600cdf0e10cSrcweir // initial positioning for secodaries 1601cdf0e10cSrcweir for ( j = 0 ; j < nLevelSecObjCount ; j++ ) 1602cdf0e10cSrcweir { 1603cdf0e10cSrcweir pSwapWin = LevelSecList[ i ]->GetObject( j ); 1604cdf0e10cSrcweir aWorkList.Insert( pSwapWin, LIST_APPEND); 1605cdf0e10cSrcweir if ( pSwapWin ) 1606cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1607cdf0e10cSrcweir } 1608cdf0e10cSrcweir dMinDist = CalcDistSum( LevelSecList[ i ] ); 1609cdf0e10cSrcweir 1610cdf0e10cSrcweir dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelSecList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelSecObjCount )); 1611cdf0e10cSrcweir 1612cdf0e10cSrcweir // set optimized positions - may still be wrong from later tries 1613cdf0e10cSrcweir for ( j = 0; j < nLevelSecObjCount; j++ ) 1614cdf0e10cSrcweir { 1615cdf0e10cSrcweir pSwapWin = aWorkList.GetObject( j ); 1616cdf0e10cSrcweir if ( pSwapWin ) 1617cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1618cdf0e10cSrcweir } 1619cdf0e10cSrcweir if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH ) 1620cdf0e10cSrcweir mnLevelOffset++; 1621cdf0e10cSrcweir } 1622cdf0e10cSrcweir if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH ) 1623cdf0e10cSrcweir mnLevelOffset+= ( LevelUse[ i ] + LevelSecUse[ i ] ) / DEPPER_MAX_WIDTH ; 1624cdf0e10cSrcweir i++; 1625cdf0e10cSrcweir } 1626cdf0e10cSrcweir 1627cdf0e10cSrcweir mnMinDynXOffs = 0xffff; 1628cdf0e10cSrcweir 1629cdf0e10cSrcweir // and back again... 1630cdf0e10cSrcweir // get better results form already preoptimized upper and lower rows 1631cdf0e10cSrcweir 1632cdf0e10cSrcweir do 1633cdf0e10cSrcweir { 1634cdf0e10cSrcweir i--; 1635cdf0e10cSrcweir UpdateMainProgressBar(i, nScaleVal, nStep, sal_True); // sal_True ~ counting down 1636cdf0e10cSrcweir if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH ) 1637cdf0e10cSrcweir mnLevelOffset-= ( LevelUse[ i ] + LevelSecUse[ i ] ) / DEPPER_MAX_WIDTH ; 1638cdf0e10cSrcweir ObjectWin* pSwapWin; 1639cdf0e10cSrcweir sal_uIntPtr nLevelObjCount = LevelList[ i ]->Count(); 1640cdf0e10cSrcweir mnXOffset = CalcXOffset( nLevelObjCount ); 1641cdf0e10cSrcweir aWorkList.Clear(); 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir for ( j = 0; j < nLevelObjCount; j++ ) 1644cdf0e10cSrcweir { 1645cdf0e10cSrcweir pSwapWin = LevelList[ i ]->GetObject( j ); 1646cdf0e10cSrcweir aWorkList.Insert( pSwapWin, LIST_APPEND); 1647cdf0e10cSrcweir Point aPos = CalcPos( i, j ); 1648cdf0e10cSrcweir aPosArray[ j ] = aPos; 1649cdf0e10cSrcweir //no need to do this stuff....... ????? 1650cdf0e10cSrcweir if ( pSwapWin ) 1651cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1652cdf0e10cSrcweir } 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir double dMinDist = CalcDistSum( LevelList[ i ], BOTH ); 1655cdf0e10cSrcweir 1656cdf0e10cSrcweir dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelObjCount, BOTH )); 1657cdf0e10cSrcweir // wrong position for remaping - keep old positions for comparing 1658cdf0e10cSrcweir for ( j = 0; j < nLevelObjCount; j++ ) 1659cdf0e10cSrcweir { 1660cdf0e10cSrcweir pSwapWin = aWorkList.GetObject( j ); 1661cdf0e10cSrcweir if ( pSwapWin ) 1662cdf0e10cSrcweir // pSwapWin->SetCalcPosPixel( mpBaseWin->LogicToPixel( aPosArray[ j ] )); 1663cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1664cdf0e10cSrcweir } 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir if ( LevelSecList[ i ] != NULL ) 1667cdf0e10cSrcweir { 1668cdf0e10cSrcweir sal_uIntPtr nLevelSecObjCount = LevelSecList[ i ]->Count(); 1669cdf0e10cSrcweir mnXOffset = CalcXOffset( LevelUse[ i ] + nLevelSecObjCount ); 1670cdf0e10cSrcweir aWorkList.Clear(); 1671cdf0e10cSrcweir 1672cdf0e10cSrcweir l = 0; 1673cdf0e10cSrcweir sal_Bool bUsedPos; 1674cdf0e10cSrcweir 1675cdf0e10cSrcweir for ( j = 0; j < ( LevelUse[ i ] + nLevelSecObjCount ) ; j++ ) 1676cdf0e10cSrcweir { 1677cdf0e10cSrcweir Point aPos = CalcPos( i, j ); 1678cdf0e10cSrcweir bUsedPos = sal_False; 1679cdf0e10cSrcweir // could be faster 1680cdf0e10cSrcweir for ( k = 0; k < nLevelObjCount; k++ ) 1681cdf0e10cSrcweir { 1682cdf0e10cSrcweir if ( LevelList[ i ]->GetObject( k ) ) 1683cdf0e10cSrcweir if ( aPos == LevelList[ i ]->GetObject( k )->GetCalcPosPixel() ) 1684cdf0e10cSrcweir bUsedPos = sal_True; 1685cdf0e10cSrcweir } 1686cdf0e10cSrcweir if ( !bUsedPos ) 1687cdf0e10cSrcweir { 1688cdf0e10cSrcweir aPosArray[ l ] = aPos; 1689cdf0e10cSrcweir l++; 1690cdf0e10cSrcweir } 1691cdf0e10cSrcweir } 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir for ( j = 0 ; j < nLevelSecObjCount ; j++ ) 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir pSwapWin = LevelSecList[ i ]->GetObject( j ); 1696cdf0e10cSrcweir aWorkList.Insert( pSwapWin, LIST_APPEND); 1697cdf0e10cSrcweir if ( pSwapWin ) 1698cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1699cdf0e10cSrcweir } 1700cdf0e10cSrcweir dMinDist = CalcDistSum( LevelSecList[ i ], BOTH ); 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelSecList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelSecObjCount, BOTH )); 1703cdf0e10cSrcweir // wrong position for remaping - keep old positions for comparing 1704cdf0e10cSrcweir for ( j = 0; j < nLevelSecObjCount; j++ ) 1705cdf0e10cSrcweir { 1706cdf0e10cSrcweir pSwapWin = aWorkList.GetObject( j ); 1707cdf0e10cSrcweir if ( pSwapWin ) 1708cdf0e10cSrcweir pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); 1709cdf0e10cSrcweir } 1710cdf0e10cSrcweir } 1711cdf0e10cSrcweir // i--; 1712cdf0e10cSrcweir } while ( i != 0 ); 1713cdf0e10cSrcweir SetMainProgressBar( 100 ); 1714cdf0e10cSrcweir 1715cdf0e10cSrcweir sal_uIntPtr nNewXSize = ( DEPPER_MAX_WIDTH + 1 ) * ( OBJWIN_X_SPACING + GetDefSize().Width() ); 1716cdf0e10cSrcweir 1717cdf0e10cSrcweir // sal_uIntPtr aObjID = GetStart(pIdMapper, pObjLst) //hier mu� man switchen GetStart/GetPrjStart oder so 1718cdf0e10cSrcweir 1719cdf0e10cSrcweir ObjectWin* pObjWin = ObjIdToPtr( pObjLst, aObjID); 1720cdf0e10cSrcweir 1721cdf0e10cSrcweir sal_uIntPtr nNewYSize = pObjWin->GetCalcPosPixel().Y() + GetDefSize().Height() + 2 * OBJWIN_Y_SPACING; 1722cdf0e10cSrcweir if (( nUnvisYOffs + GetDefSize().Height()) > nNewYSize ) 1723cdf0e10cSrcweir nNewYSize = nUnvisYOffs + GetDefSize().Height(); 1724cdf0e10cSrcweir 1725cdf0e10cSrcweir MapMode aMapMode = GetDepWin()->GetMapMode(); 1726cdf0e10cSrcweir Size aTmpSize( (sal_uIntPtr) (double(nNewXSize) * double( aMapMode.GetScaleX())), (sal_uIntPtr) (double( nNewYSize) * double( aMapMode.GetScaleY()))); 1727cdf0e10cSrcweir 1728cdf0e10cSrcweir Size aNowSize( GetGraphWin()->GetSizePixel()); 1729cdf0e10cSrcweir 1730cdf0e10cSrcweir if ( GetDepWin()->LogicToPixel( aNowSize ).Width() > aTmpSize.Width() ) 1731cdf0e10cSrcweir aTmpSize.Width() = GetDepWin()->LogicToPixel( aNowSize ).Width() ; 1732cdf0e10cSrcweir 1733cdf0e10cSrcweir if ( GetDepWin()->LogicToPixel( aNowSize ).Height() > aTmpSize.Height() ) 1734cdf0e10cSrcweir aTmpSize.Height() = GetDepWin()->LogicToPixel( aNowSize ).Height() ; 1735cdf0e10cSrcweir 1736cdf0e10cSrcweir // if ( nZoomed <= 0 ) 1737cdf0e10cSrcweir // { 1738cdf0e10cSrcweir // mpBaseWin->SetSizePixel( aTmpSize ); 1739cdf0e10cSrcweir // mpGraphWin->SetTotalSize( aTmpSize ); 1740cdf0e10cSrcweir // mpGraphWin->EndScroll( 0, 0 ); 1741cdf0e10cSrcweir // } 1742cdf0e10cSrcweir 1743cdf0e10cSrcweir // now remap all objects 1744cdf0e10cSrcweir sal_uIntPtr nAllObjCount = pObjLst->Count(); 1745cdf0e10cSrcweir Point aTmpPos; 1746cdf0e10cSrcweir for ( j = 0; j < nAllObjCount; j++ ) 1747cdf0e10cSrcweir { 1748cdf0e10cSrcweir pWin = pObjLst->GetObject( j ); 1749cdf0e10cSrcweir if ( pWin->IsVisible()) { 1750cdf0e10cSrcweir aTmpPos = pWin->GetCalcPosPixel(); 1751cdf0e10cSrcweir if ( pWin->mbVisited ) 1752cdf0e10cSrcweir { 1753cdf0e10cSrcweir // reserve space for unconnected 1754cdf0e10cSrcweir aTmpPos.X() -= mnMinDynXOffs; 1755cdf0e10cSrcweir aTmpPos.X() += GetDefSize().Width() + OBJWIN_X_SPACING; 1756cdf0e10cSrcweir // center window 1757cdf0e10cSrcweir aTmpPos.X() += GetDefSize().Width() / 2; 1758cdf0e10cSrcweir aTmpPos.X() -= pWin->PixelToLogic( pWin->GetSizePixel()).Width() / 2 ; 1759cdf0e10cSrcweir } 1760cdf0e10cSrcweir pWin->SetPosPixel( GetDepWin()->LogicToPixel( aTmpPos )); 1761cdf0e10cSrcweir } 1762cdf0e10cSrcweir } 1763cdf0e10cSrcweir aWorkList.Clear(); 1764cdf0e10cSrcweir GetDepWin()->EnablePaint( sal_True ); 1765cdf0e10cSrcweir GetDepWin()->Invalidate(); 1766cdf0e10cSrcweir //LevelListen loeschen H�? Welche Levellisten? 1767cdf0e10cSrcweir 1768cdf0e10cSrcweir //Update all Connectors 1769cdf0e10cSrcweir // --> To be done: Don't call twice Object1-Connector-Object2 1770cdf0e10cSrcweir ObjectWin* pObject1; 1771cdf0e10cSrcweir for ( i = 0 ; i < nObjCount ; i++) 1772cdf0e10cSrcweir { 1773cdf0e10cSrcweir pObject1 = pObjLst->GetObject( i ); 1774cdf0e10cSrcweir if ( pObject1->IsVisible()) 1775cdf0e10cSrcweir pObject1->UpdateConnectors(); 1776cdf0e10cSrcweir }; 1777cdf0e10cSrcweir return 0; 1778cdf0e10cSrcweir } 1779cdf0e10cSrcweir 1780cdf0e10cSrcweir void SolDep::WriteToErrorFile() 1781cdf0e10cSrcweir { 1782cdf0e10cSrcweir //Needs some improvement 1783cdf0e10cSrcweir ObjectWin* pWin; 1784cdf0e10cSrcweir WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph too deep! dat geiht nich gut.\nlook at depper.err in your Tmp-directory\nfor list of objects")); 1785cdf0e10cSrcweir aWBox.Execute(); 1786cdf0e10cSrcweir char *tmpdir = getenv("TMP"); 1787cdf0e10cSrcweir char *errfilebasename = "depper.err"; 1788cdf0e10cSrcweir char *ErrFileName = (char*) malloc( strlen( tmpdir ) + strlen( errfilebasename) + 3 ); 1789cdf0e10cSrcweir *ErrFileName = '\0'; 1790cdf0e10cSrcweir strcat( ErrFileName, tmpdir ); 1791cdf0e10cSrcweir strcat( ErrFileName, "\\" ); 1792cdf0e10cSrcweir strcat( ErrFileName, errfilebasename ); 1793cdf0e10cSrcweir FILE* pErrFile = fopen( "depper.err", "w+" ); 1794cdf0e10cSrcweir if ( pErrFile ) 1795cdf0e10cSrcweir { 1796cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < mpTravellerList->Count(); i++ ) 1797cdf0e10cSrcweir { 1798cdf0e10cSrcweir pWin = mpTravellerList->GetObject( i ); 1799cdf0e10cSrcweir fprintf( pErrFile, " %s -> \n", (pWin->GetBodyText()).GetBuffer()); 1800cdf0e10cSrcweir } 1801cdf0e10cSrcweir fclose( pErrFile ); 1802cdf0e10cSrcweir } 1803cdf0e10cSrcweir } 1804