xref: /AOO41X/main/soldep/inc/soldep/objwin.hxx (revision 53a9af0a251b18e3c3b23eacf3a4922b098ea5c4)
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_OBJWIN_HXX
25 #define _FMRWRK_OBJWIN_HXX
26 
27 #ifndef _SV_WINDOW_HXX
28 #include <vcl/window.hxx>
29 #endif
30 #include <vcl/menu.hxx>
31 #include <vcl/timer.hxx>
32 #include <soldep/listmacr.hxx>
33 #include <tools/stream.hxx>
34 
35 #include <soldep/connctr.hxx>
36 
37 #define OBJWIN_EDIT_TEXT        1
38 #define OBJWIN_ADD_CONNECTOR    2
39 #define OBJWIN_REMOVE_WIN       3
40 #define OBJWIN_VIEW_CONTENT     4
41 
42 #define MARKMODE_DEFAULT        0
43 #define MARKMODE_DEPENDING      1
44 #define MARKMODE_NEEDED         2
45 #define MARKMODE_ACTIVATED      4
46 #define MARKMODE_SELECTED       8
47 
48 class Depper;
49 class Connector;
50 class ObjectWin;
51 
52 class ObjectWin : public Window
53 {
54     Point       maMouseOffset;
55     Point       maCalcPos;
56     ByteString      msBodyText;
57     ByteString      msTipText;
58     sal_uIntPtr     mnObjectId;
59     PopupMenu*  mpPopup;
60     sal_uInt16      mnPopupStaticItems;
61     Wallpaper   maObjWallpaper;
62     ConnectorList   mConnections;
63     sal_uIntPtr     mnMarkMode;
64     sal_uIntPtr         mnViewMask;
65     sal_Bool        mbVisible;
66     sal_Bool        mbMenuExecute;
67     static sal_Bool msbHideMode;
68     static sal_uIntPtr msnGlobalViewMask;   //will be set by SolDep
69 
70 public:
71     sal_Bool        mbVisited;
72 //  double x, y;
73 
74     sal_uInt16 mnRootDist;
75     sal_uInt16 mnHeadDist;
76     sal_Bool mbFixed;
77     //Depper*       mpDepperDontuseme;
78     Timer   aTipTimer;
79 
80                     ObjectWin( Window* pParent, WinBits nWinStyle );
81                     ~ObjectWin();
82         void            SetHideMode(sal_Bool bHide);
83         sal_Bool            ToggleHideMode();
IsHideMode()84         sal_Bool            IsHideMode() { return msbHideMode; };
IsNullObject()85         sal_Bool            IsNullObject() { return (msBodyText == "null"); };
SetGlobalViewMask(sal_uIntPtr gvm)86         void            SetGlobalViewMask(sal_uIntPtr gvm) { msnGlobalViewMask = gvm; };
87         void            SetBodyText( const ByteString& rNewText );
88         ByteString&         GetBodyText();
89         sal_uIntPtr           GetIdByName( const ByteString& rText );
90         void            SetTipText( const ByteString& rNewText );
91         ByteString&         GetTipText();
92         Point           GetFixPoint( const Point& rRefPoint, sal_Bool bUseRealPos = sal_True );
93 
SetCalcPosPixel(const Point & rNewPos)94         void            SetCalcPosPixel( const Point& rNewPos ){ maCalcPos = rNewPos; };
GetCalcPosPixel() const95         Point           GetCalcPosPixel() const { return maCalcPos; }
96 
97         void            AddConnector( Connector* pNewCon );
98         void            RemoveConnector( Connector* pOldCon );
99         Connector*      GetConnector( sal_uIntPtr nIndex );
100         Connector*      GetConnector( sal_uIntPtr nStartId, sal_uIntPtr nEndId );
101         virtual void    SetMarkMode( sal_uIntPtr nMarkMode = 0 );
102         virtual void    UnsetMarkMode( sal_uIntPtr nMarkMode );
GetMarkMode()103         sal_uIntPtr         GetMarkMode(){ return mnMarkMode; };
GetActualWallpaper()104         Wallpaper       GetActualWallpaper() { return maObjWallpaper;};
SetActualWallpaper(const Wallpaper & aWp)105         void            SetActualWallpaper(const Wallpaper& aWp) { maObjWallpaper = aWp;};
106         void            MarkNeeded( sal_Bool bReset = sal_False );
107         void            MarkDepending( sal_Bool bReset = sal_False );
108         void            Paint( const Rectangle& rRecct );
109         void            MouseButtonDown( const MouseEvent& rMEvt );
110         void            MouseButtonUp( const MouseEvent& rMEvt );
111         void            MouseMove( const MouseEvent& rMEvt );
112 //      void            DoubleClick();
113         sal_uInt16          Save( SvFileStream& rOutFile );
114         sal_uInt16          Load( SvFileStream& rInFile );
115         void            SetId( sal_uIntPtr nId );
116         sal_uIntPtr         GetId();
117         void            UpdateConnectors();
118         void            SetAllConnectorsUnvisible();
119         virtual void    Command( const CommandEvent& rEvent);
120 
121         void SetViewMask( sal_uIntPtr nMask );
GetViewMask()122         sal_uIntPtr GetViewMask() { return mnViewMask; }
123         using Window::IsVisible;
IsVisible()124         sal_Bool IsVisible() { return mbVisible; }
125 
126         DECL_LINK( PopupSelected, PopupMenu * );
127         DECL_LINK( PopupDeactivated, PopupMenu * );
128         DECL_LINK( TipHdl, void * );
129 
130         //virtual void GetFocus();
131         virtual void LoseFocus();
132 
133         sal_Bool            ConnectionExistsInAnyDirection( ObjectWin *pWin );
134         void    DrawOutput( OutputDevice* pDevice, const Point& rOffset  );
135         sal_Bool    IsTop();
136 };
137 
138 DECL_DEST_LIST( TmpObjWinList, ObjWinList, ObjectWin* )
139 
140 //Extend ObjWinList
141 class ObjectList : public ObjWinList
142 {
143 private:
144     ObjectWin* pSelectedObjectWin;
145 protected:
146     sal_Bool       mbHideMode;
147 public:
148                ObjectList();
~ObjectList()149                ~ObjectList() {};
150     void       ResetSelectedObject();
151     ObjectWin* GetPtrByName( const ByteString& rText );
152     ObjectList* FindTopLevelModules();
153 };
154 
155 #endif
156 
157