1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ipenv.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <bf_so3/client.hxx>
35 #ifndef _TOOLS_VCLRSC_HXX
36 #include <vcl/mapunit.hxx>
39 #ifndef INCLUDED_SO3DLLAPI_H
40 #include "bf_so3/so3dllapi.h"
43 /*************************************************************************
44 *************************************************************************/
52 struct IOleInPlaceFrame
;
53 struct IOleInPlaceUIWindow
;
57 class SvInPlaceClient
;
58 class SvInPlaceObject
;
59 class SvContainerEnvironment
;
60 class SvInPlaceClipWindow
;
61 class SvInPlaceWindow
;
62 class SvContainerEnvironmentList
;
63 //=========================================================================
64 class SO3_DLLPUBLIC SvAppFrame
: public SvObject
66 friend class ImpInPlaceFrame
;
67 friend class SvContainerEnvironment
;
68 friend class SvInPlaceClient
;
70 IOleInPlaceFrame
* pObjI
;
71 SvContainerEnvironment
* pEnv
;
73 SO3_DLLPRIVATE
~SvAppFrame();
76 IOleInPlaceFrame
* GetInPlaceFrame() const;
78 SV_DECL_IMPL_REF(SvAppFrame
)
80 //=========================================================================
81 class SO3_DLLPUBLIC SvDocFrame
: public SvObject
83 friend class ImpInPlaceUIWindow
;
84 friend class SvContainerEnvironment
;
85 friend class SvInPlaceClient
;
87 IOleInPlaceUIWindow
* pObjI
;
88 SvContainerEnvironment
* pEnv
;
90 SO3_DLLPRIVATE
~SvDocFrame();
93 IOleInPlaceUIWindow
* GetOleInPlaceUIWindow() const;
95 SV_DECL_IMPL_REF(SvDocFrame
)
97 //=========================================================================
99 typedef struct tagOIFI OLEINPLACEFRAMEINFO
;
101 class SO3_DLLPUBLIC SvContainerEnvironment
: public SvClientData
103 friend class ImpInPlaceSite
;
104 friend class ImpInPlaceFrame
;
105 friend class ImpInPlaceUIWindow
;
106 friend class SvInPlaceEnvironment
;
107 friend class SvInPlaceClient
;
108 friend class SvInPlaceObject
;
111 SvInPlaceEnvironment
* pIPEnv
; // IP-Env des Objektes
112 SvInPlaceClient
* pObj
; // kann auch NULL sein
113 SvContainerEnvironment
* pParent
;// fuer IP in IP
114 SvContainerEnvironmentList
* pChildList
; // fuer IP in IP
115 WorkWindow
* pTopWin
;// Application window
116 WorkWindow
* pDocWin
;// doc window != pTopWin
117 SvAppFrameRef xAppFrame
;
118 SvDocFrameRef xDocFrame
;
119 OLEINPLACEFRAMEINFO
* pOleInfo
;
121 // Variablen fuer die Menubearbeitung
122 long hOleMenuDesc
; // ist ein HOLEMENU
123 USHORT nCount1
, nCount2
, nCount3
;
125 USHORT nMenuUseCount
; //Menu in Benutzung
126 Accelerator
* pAccel
; // Cont Accelerator
127 Rectangle aClipAreaPixel
;
129 // Variablen fuer Toolgroessen
130 SvBorder aTopBorder
; // In Pixel
131 SvBorder aDocBorder
; // In Pixel
132 BOOL bDfltUIAction
:1,
138 SO3_DLLPRIVATE
void SetIPEnv( SvInPlaceEnvironment
* pEnv
)
140 SO3_DLLPRIVATE
void ResetIPEnv()
142 SO3_DLLPRIVATE
void MakeWinContext_Impl();
143 //void DeleteWindows_Impl();
145 virtual void ShowUIByChildDeactivate();
147 SO3_DLLPRIVATE
virtual MenuBar
* QueryMenu( USHORT
*, USHORT
*, USHORT
* );
148 SO3_DLLPRIVATE
virtual void SetInPlaceMenu( MenuBar
* pIPMenu
, BOOL bSet
);
149 SO3_DLLPRIVATE
virtual void MenuReleased();
150 SO3_DLLPRIVATE
virtual void UIToolsShown( BOOL bShow
);
151 SO3_DLLPRIVATE
void RemoveDocWin() { pDocWin
= NULL
; }
152 SO3_DLLPRIVATE
void RemoveEditWin() { SetEditWin( NULL
); }
153 SO3_DLLPRIVATE BOOL
IsDefaultUIAction() const
154 { return bDfltUIAction
; }
155 SO3_DLLPRIVATE
const SvBorder
& GetTopBorder() const
156 { return aTopBorder
; }
160 SvContainerEnvironment( SvInPlaceClient
*,
161 WorkWindow
* pTopWin
= NULL
,
162 WorkWindow
* pDocWin
= NULL
,
163 Window
* pObjWin
= NULL
);
164 virtual ~SvContainerEnvironment();
166 IOleInPlaceFrame
* GetInPlaceFrame() const;
167 IOleInPlaceUIWindow
* GetOleInPlaceUIWindow() const;
168 OLEINPLACEFRAMEINFO
* GetOleInfo_Impl();
170 SvContainerEnvironment
* GetParent() const { return pParent
; }
171 SvContainerEnvironment
* GetChild( ULONG n
) const;
173 void ResetChilds2IPActive();
174 BOOL
IsChild( SvContainerEnvironment
* pEnv
) const;
175 SvInPlaceEnvironment
* GetIPEnv() const { return pIPEnv
; }
178 SvInPlaceClient
* GetIPClient() const { return pObj
; }
179 void SetDefaultUIAction( BOOL bOn
)
180 { bDfltUIAction
= bOn
; }
182 WorkWindow
* GetTopWin() const;
183 WorkWindow
* GetDocWin() const;
184 virtual Window
* GetEditWin() const;
187 virtual void Scroll( const Size
& rSize
);
190 // Accelerator Verwaltung
191 virtual BOOL
DispatchAccel( const KeyCode
& );
192 virtual Accelerator
* GetAccel();
194 // Groesse fuer Object-Window
195 virtual void SetSizeScale( const Fraction
& rScaleWidth
,
196 const Fraction
& rScaleHeight
);
197 void OutDevScaleChanged();
198 const Rectangle
& GetClipAreaPixel() const
199 { return aClipAreaPixel
; }
200 virtual BOOL
SetObjArea( const Rectangle
& );
201 virtual Rectangle
GetObjArea() const;
202 // Der Return ist in logischen Koordinaten des Objektes
203 Rectangle
PixelObjVisAreaToLogic( const Rectangle
& rObjRect
) const;
204 virtual void RequestObjAreaPixel( const Rectangle
& rObjRect
);
206 // Groessen und Positionsverhandlungen fuer Tools
207 void SetTopToolFramePixel( const SvBorder
& rBorder
);
208 Rectangle
GetTopOuterRectPixel() const;
210 void SetDocToolFramePixel( const SvBorder
& rBorder
);
211 Rectangle
GetDocOuterRectPixel() const;
213 // Das rInnerRect bezieht sich auf rOuterRect
214 virtual BOOL
RequestTopToolSpacePixel( const SvBorder
& );
215 virtual BOOL
RequestDocToolSpacePixel( const SvBorder
& );
216 virtual BOOL
SetTopToolSpacePixel( const SvBorder
& );
217 virtual BOOL
SetDocToolSpacePixel( const SvBorder
& );
219 virtual BOOL
SetStatusText( const String
& rText
);
220 virtual void ShowDocument( const INetURLObject
&,
223 DECLARE_LIST(SvContainerEnvironmentList
,SvContainerEnvironment
*)
225 /*************************************************************************/
226 class SO3_DLLPUBLIC SvInPlaceEnvironment
228 friend class SvInPlaceObject
;
229 friend class ImpInPlaceObject
;
230 friend class SvInPlaceClient
;
231 friend class SvContainerEnvironment
;
232 friend class ImpOleInPlaceActiveObject
;
233 friend class ImplSvEditObjectProtocol
;
236 USHORT nChangeRectsLockCount
;
243 MenuBar
* pClientMenu
;
246 SvInPlaceClipWindow
* pClipWin
;
247 SvInPlaceWindow
* pBorderWin
;
249 Rectangle aOldClipAreaPixel
;
250 Rectangle aOldObjAreaPixel
;
252 SvContainerEnvironment
*pContEnv
;
253 SvInPlaceObject
* pObj
;
255 SO3_DLLPRIVATE
void MergeMenus();
256 SO3_DLLPRIVATE
void ReleaseClientMenu();
258 SO3_DLLPRIVATE
virtual void TopWinResize();
259 SO3_DLLPRIVATE
virtual void DocWinResize();
261 SO3_DLLPRIVATE
virtual MenuBar
* QueryMenu( USHORT
* pCount0
, USHORT
* pCount1
,
263 SO3_DLLPRIVATE
virtual void ShowIPObj( BOOL bShow
);
264 SO3_DLLPRIVATE
virtual void ShowUITools( BOOL bShow
);
266 SO3_DLLPRIVATE
virtual void RectsChangedPixel( const Rectangle
& rObjRect
,
267 const Rectangle
& rClip
);
269 SO3_DLLPRIVATE
virtual BOOL
DispatchAccel( const KeyCode
& );
271 SO3_DLLPRIVATE
void DeleteObjMenu();
273 SO3_DLLPRIVATE
void MakeWindows();
274 SO3_DLLPRIVATE
void DeleteWindows();
275 SO3_DLLPRIVATE
void SetClipWin( SvInPlaceClipWindow
* pWin
)
277 SO3_DLLPRIVATE
void SetBorderWin( SvInPlaceWindow
* pWin
)
278 { pBorderWin
= pWin
; }
281 SvInPlaceEnvironment( SvContainerEnvironment
*, SvInPlaceObject
* );
282 virtual ~SvInPlaceEnvironment();
284 SvInPlaceObject
* GetIPObj() const { return pObj
; }
285 void DoTopWinResize();
286 void DoDocWinResize();
287 void DoShowIPObj( BOOL bShow
);
288 void DoShowUITools( BOOL bShow
);
289 BOOL
IsShowUITools() const { return bShowUITools
; }
291 const Rectangle
& GetOldObjAreaPixel() const
292 { return aOldObjAreaPixel
; }
293 virtual void QueryObjAreaPixel( Rectangle
& rRect
) const;
295 SvInPlaceClipWindow
* GetClipWin() const { return pClipWin
; }
296 SvInPlaceWindow
* GetBorderWin() const { return pBorderWin
; }
297 void SetEditWin( Window
* pWin
)
299 Window
* GetEditWin();
300 SvContainerEnvironment
* GetContainerEnv() const { return pContEnv
; }
302 void DoRectsChanged( BOOL bIfEqual
= FALSE
);
303 USHORT
GetRectsChangedLockCount() const
305 return nChangeRectsLockCount
;
307 void LockRectsChanged();
308 void UnlockRectsChanged();
311 //=========================================================================
312 //============== SvPlugInEnvironment ======================================
313 //=========================================================================
314 // since there is no more plugin manager from inet library
315 // we need PluginMode and PluginJavaRequester here
321 PLUGIN_BACKGROUND
= 3
324 struct PlugJavaRequester
326 virtual void * GetJavaPeer( Window
* pPlugWin
) = 0;
329 class SvPlugInObject
;
330 class SvPlugInEnvironment_Impl
;
331 class SO3_DLLPUBLIC SvPlugInEnvironment
: public SvInPlaceEnvironment
336 friend class SvPlugInObject
;
340 DECL_STATIC_LINK( SvPlugInEnvironment
, MenuSelectHdl
, Menu
* );
342 SvPlugInObject
* pObj
;
343 SvPlugInEnvironment_Impl
* pImpl
;
346 SO3_DLLPRIVATE
virtual void DocWinResize();
347 SO3_DLLPRIVATE
virtual void RectsChangedPixel( const Rectangle
& rObjRect
,
348 const Rectangle
& rClip
);
350 SvPlugInEnvironment( SvContainerEnvironment
*, SvPlugInObject
* );
351 ~SvPlugInEnvironment();
353 BOOL
IsStarPlug() const { return bIsStarPlugIn
; }
355 virtual BOOL
MIMETypeDetected( const String
& rMIME
);
356 virtual void * GetJavaPeer( Window
* pPlugWin
);