xref: /aoo4110/main/soldep/inc/soldep/depper.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _FMRWRK_DEPPER_HXX
25 #define _FMRWRK_DEPPER_HXX
26 
27 #include <vcl/window.hxx>
28 #include <vcl/wrkwin.hxx>
29 #include <tools/resmgr.hxx>
30 #include <soldep/objwin.hxx>
31 #include <soldep/depwin.hxx>
32 #include <soldep/graphwin.hxx>
33 #include <soldep/tbox.hxx>
34 #include <soldep/soldlg.hrc>
35 #include <soldep/hashtbl.hxx>
36 #include <soldep/hashobj.hxx>
37 #include <soldep/soldlg.hxx>
38 #include <soldep/prj.hxx>
39 #include <soldep/sdtresid.hxx>
40 
41 DECLARE_HASHTABLE_OWNER(SolIdMapper,ByteString,MyHashObject*)
42 
43 // just for conversion - convert char* to String
44 class ProgressBar;
45 class FixedText;
46 
47 #define SOLDEPL_NAME "StarDepend V1.0"
48 
49 #define DEPPER_ID	4711
50 
51 //User Events
52 #define VCLEVENT_USER_MOUSEBUTTON_DOWN      5000
53 #define VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT  5001
54 #define VCLEVENT_USER_MOUSEBUTTON_DOWN_CTRL 5002
55 #define VCLEVENT_USER_MOUSEBUTTON_UP        5003
56 #define VCLEVENT_USER_MOUSEBUTTON_UP_ALT    5004
57 #define VCLEVENT_USER_MOUSEBUTTON_UP_CTRL   5005
58 #define VCLEVENT_USER_MOUSEBUTTON_UP_SHFT   5006
59 #define VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK 5007
60 #define VCLEVENT_USER_TBOX_RESIZE           5008
61 #define VCLEVENT_USER_TBOX_RESIZE_APP       5009
62 #define VCLEVENT_USER_TBOX_FIND             5010
63 #define VCLEVENT_USER_TBOX_HIDE_INDEPENDEND 5011
64 #define VCLEVENT_USER_TBOX_SELECT_WORKSPACE 5012
65 #define VCLEVENT_USER_TBOX_BACK             5013
66 
67 #define		OBJWIN_X_SPACING		50
68 #define		OBJWIN_Y_SPACING		12
69 #define		DEPPER_MAX_DEPTH		100
70 #define		DEPPER_MAX_WIDTH		12
71 #define		DEPPER_MAX_LEVEL_WIDTH		10 * DEPPER_MAX_WIDTH
72 
73 
74 #define DEP_OK						0
75 #define DEP_OBJECT_NOT_FOUND		1
76 #define DEP_STARTID_NOT_FOUND		2
77 #define DEP_ENDID_NOT_FOUND			3
78 #define DEP_CONNECTOR_NOT_FOUND		4
79 #define DEP_ENDLES_RECURSION_FOUND	DEPPER_MAX_DEPTH + 1
80 
81 #define	DEPPOPUP_NEW								1
82 #define	DEPPOPUP_AUTOARRANGE		                2
83 #define	DEPPOPUP_LOAD				                3
84 #define	DEPPOPUP_SAVE				                4
85 #define	DEPPOPUP_WRITE_SOURCE		                5
86 #define	DEPPOPUP_READ_SOURCE		                6
87 #define	DEPPOPUP_OPEN_SOURCE		                7
88 #define	DEPPOPUP_ZOOMIN				                8
89 #define	DEPPOPUP_ZOOMOUT			                9
90 #define	DEPPOPUP_CLEAR				                10
91 #define	DEPPOPUP_CLOSE				                11
92 #define	DEPPOPUP_HELP				                12
93 #define DEPPOPUP_SHOW_TOOLBOX                       13
94 #define	DEPPOPUP_TEST				                0xff
95 
96 struct depper_head
97 {
98 	sal_uIntPtr nID;
99 	sal_uIntPtr nObjectCount;
100 	sal_uIntPtr nCnctrCount;
101 
102 };
103 
104 enum DistType
105 {
106 	BOTTOMUP = 0,
107 	TOPDOWN = 1,
108 	BOTH = 2
109 };
110 
111 
112 class Depper : public SolDevDll, public Window
113 {
114     sal_Bool    mbIsPrjView;
115 	sal_uIntPtr	mnMinDynXOffs;
116 	Point	maDefPos;
117 	Size	maDefSize;
118 
119 	long	nZoomed;
120 
121 	sal_uIntPtr	mnViewMask;
122 
123 	ProgressBar*	pSubBar;
124 	ProgressBar*	pMainBar;
125 	FixedText* 		pSubText;
126 	FixedText*		pMainText;
127     SolAutoarrangeDlg maArrangeDlg;
128 
129 
130 protected:
131     Prj*            mpPrj;
132     SolIdMapper*	mpSolIdMapper;
133     SolIdMapper*	mpPrjIdMapper;
134 	StarWriter*     mpStarWriter;
135     StarWriter*     mpPrjStarWriter;        //for inside prj-view
136     sal_uIntPtr   	    mnSolWinCount;
137 	sal_uIntPtr	        mnSolLastId;
138     sal_uIntPtr   	    mnPrjWinCount;
139 	sal_uIntPtr	        mnPrjLastId;
140     ObjectList*         mpObjectList;           //Extended ObjWinList class
141     ObjectList*         mpObjectPrjList;        //for module internal dependencies
142 	DepWin*				mpBaseWin;
143     DepWin*             mpBasePrjWin;           //for inside prj-view
144 	GraphWin*			mpGraphWin;
145 	GraphWin*			mpGraphPrjWin;          //for inside prj-view
146     Window*				mpProcessWin;
147     Window*             mpParentProcessWin;
148 	ObjectWin*			ObjIdToPtr( ObjectList* pObjLst, sal_uIntPtr nId );
149     SoldepToolBox       maToolBox;
150     FloatingWindow      maTaskBarFrame; // For ToolBox
151 
152     sal_uIntPtr       AddObjectToList(DepWin* pParentWin, ObjectList* pObjLst, sal_uIntPtr &LastID, sal_uIntPtr &WinCount, ByteString& rBodyText, sal_Bool bInteract=sal_True );
153     sal_uIntPtr       AddObjectToList( DepWin* pParentWin, ObjectList* pObjLst, sal_uIntPtr &LastID, sal_uIntPtr &WinCount, ByteString& rBodyText, Point& rPos, Size& rSize );
154     ObjectWin*  RemoveObjectFromList( ObjectList* pObjLst, sal_uIntPtr &WinCount, sal_uInt16 nId, sal_Bool bDelete );
155 	sal_uInt16		AddConnectorToObjects( ObjectList* pObjLst, sal_uIntPtr nStartId, sal_uIntPtr nEndId );
156 	sal_uInt16		RemoveConnectorFromObjects( ObjectList* pObjLst, sal_uIntPtr nStartId, sal_uIntPtr nEndId );
157     sal_uInt16		AddConnectorToObjects( ObjectWin* pStartWin, ObjectWin* pEndWin );
158 	sal_uInt16		RemoveConnectorFromObjects( ObjectWin* pStartWin, ObjectWin* pEndWin );
159 
160 public:
161 	Depper( Window* pBaseWindow );
162 	~Depper();
163     sal_Bool                TogglePrjViewStatus();
SetPrjViewStatus(sal_Bool state)164     void                SetPrjViewStatus(sal_Bool state) { mbIsPrjView = state; }
IsPrjView()165     sal_Bool                IsPrjView() { return mbIsPrjView; }
GetGraphWin()166     GraphWin*			GetGraphWin() { return (!mbIsPrjView) ? mpGraphWin : mpGraphPrjWin; }   //scrollbar window
GetDepWin()167     DepWin*             GetDepWin() { return (!mbIsPrjView) ? mpBaseWin : mpBasePrjWin; }		//content of scrollbar window
GetMainProgressBar()168     ProgressBar*        GetMainProgressBar() { return pMainBar; }
169     void                SetMainProgressBar( sal_uInt16 i);
170     void                UpdateMainProgressBar(sal_uInt16 i, sal_uInt16 nScaleVal, sal_uInt16 &nStep, sal_Bool bCountingDown = sal_False);
171     void                UpdateSubProgrssBar(sal_uIntPtr i);
SetTitle(const String & rTitle)172 	void				SetTitle( const String &rTitle ) { mpProcessWin->SetText( rTitle ); }
173 	virtual void		RemoveAllObjects( ObjectList* ObjLst );
174 	sal_uInt16				Save( const ByteString& rFileName );
175 //	sal_uInt16				Load( const ByteString& rFileName );
176 	virtual	sal_uInt16		WriteSource();
177 	virtual	sal_uInt16		ReadSource( sal_Bool bUpdater );
178 	virtual sal_uInt16 		OpenSource();
SetDefPos(Point & rPos)179 	void				SetDefPos( Point& rPos ) { maDefPos = rPos; };
GetDefPos()180 	Point&				GetDefPos() { return maDefPos; };
SetDefSize(Size & rSize)181 	void				SetDefSize( Size& rSize ) { maDefSize = rSize; };
GetDefSize()182 	Size&				GetDefSize() { return maDefSize; };
183     virtual sal_uInt16		AutoArrangeDlgStart();
184     virtual sal_uInt16		AutoArrangeDlgStop();
185 	virtual sal_uInt16		Zoom( MapMode& rMapMode );
ViewContent(ByteString &)186 	virtual sal_Bool		ViewContent( ByteString& ) { return sal_False; };
CloseWindow()187 	virtual sal_uInt16		CloseWindow() { return 0; };
ShowHelp()188 	virtual void		ShowHelp(){};
GetObjectList()189 	ObjectList*			GetObjectList() { return (!mbIsPrjView) ? mpObjectList : mpObjectPrjList; }
190     sal_uIntPtr               HandleNewPrjDialog( ByteString &rBodyText );
191     sal_uIntPtr               HandleNewDirectoryDialog( ByteString &rBodyText );
192     void                HideObjectsAndConnections( ObjectList* pObjLst );
193     void                ShowObjectsAndConnections( ObjectList* pObjLst );
194     //virtual void        MouseButtonDown( const MouseEvent& rMEvt );
195 //#ifdef DEBUG
test()196 	virtual	void		test(){};
197 	DECL_LINK( PopupSelected, PopupMenu* );
198 //#endif
199 
200 	//void SetViewMask( sal_uIntPtr nMask );
GetViewMask()201 	sal_uIntPtr GetViewMask() { return mnViewMask; }
202 };
203 
204 #endif
205