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: client.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/protocol.hxx>
35 #include <bf_so3/iface.hxx>
36 #include <tools/gen.hxx>
37 #include <tools/fract.hxx>
39 #ifndef INCLUDED_SO3DLLAPI_H
40 #include "bf_so3/so3dllapi.h"
43 /*************************************************************************
44 *************************************************************************/
50 struct IOleClientSite
;
57 class SvEmbeddedObject
;
58 class SvEmbeddedClient
;
60 #ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
61 #define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
62 SO2_DECL_REF(SvEmbeddedObject
)
65 class SO3_DLLPUBLIC SvClientData
67 friend class SvEmbeddedClient
;
69 SvEmbeddedClient
* pClient
;
70 Rectangle aObjRect
; // Groesse des Objektes in logischen
72 Fraction aScaleWidth
;// extra Skalierung fuer die Breite
73 Fraction aScaleHeight
;// extra Skalierung fuer die Hoehe
74 Window
* pEditWin
; // Ausgabefenster
75 BOOL bInvalidate
;// nur wenn Window Initial uebergeben wird
78 SO3_DLLPRIVATE
void SetEditWin( Window
* pWin
) { pEditWin
= pWin
; }
81 SvClientData( SvEmbeddedClient
*, Window
* pWin
= NULL
);
82 virtual ~SvClientData();
83 SvEmbeddedClient
* GetClient() const { return pClient
; }
85 void SetInvalidate( BOOL b
) { bInvalidate
= b
; }
86 BOOL
IsInvalidate() const { return bInvalidate
; }
88 virtual void Invalidate();
89 virtual Window
* GetEditWin() const;
91 virtual void SetSizeScale( const Fraction
& rScaleWidth
,
92 const Fraction
& rScaleHeight
);
93 const Fraction
& GetScaleWidth() const { return aScaleWidth
; }
94 const Fraction
& GetScaleHeight() const { return aScaleHeight
; }
96 virtual BOOL
SetObjArea( const Rectangle
& );
97 virtual Rectangle
GetObjArea() const;
98 Rectangle
PixelObjAreaToLogic( const Rectangle
& rRectPixel
) const;
99 Rectangle
LogicObjAreaToPixel( const Rectangle
& rRect
) const;
100 void SetObjAreaPixel( const Rectangle
& rRect
)
102 SetObjArea( PixelObjAreaToLogic( rRect
) );
104 Rectangle
GetObjAreaPixel() const
106 return LogicObjAreaToPixel( GetObjArea() );
110 class SO3_DLLPUBLIC SvAreaConstrain
113 Size aMaxSize
; //maximale Groesse des Gebietes
114 Size aMinSize
; //minimale Groesse des Gebietes
115 Size aStepSize
;//Schrittweite der Veraenderung
117 SvAreaConstrain() {};
118 SvAreaConstrain( const Size
& rMax
,
119 const Size
& rMin
, const Size
& rStep
)
122 , aStepSize( rStep
) {};
124 void SetMaxSize( const Size
& r
) { aMaxSize
= r
; }
125 void SetMinSize( const Size
& r
) { aMinSize
= r
; }
126 void SetStepSize( const Size
& r
) { aStepSize
= r
; }
127 const Size
& GetMaxSize() const { return aMaxSize
; }
128 const Size
& GetMinSize() const { return aMinSize
; }
129 const Size
& GetStepSize() const { return aStepSize
; }
132 class SO3_DLLPUBLIC SvEmbeddedClient
: public SvObject
134 friend class ImpClientSite
;
135 friend class ImpAdviseSink
;
136 friend class SvEmbeddedObject
;
137 friend class SvInPlaceClient
;
138 friend class SvEditObjectProtocol
;
139 friend class ImplSvEditObjectProtocol
;
142 SvClientData
* pData
; // Wird auch in SvInPlaceClient modifiziert
143 SvEmbeddedClient
* pParent
;
149 SO3_DLLPRIVATE
void SetStandardAdvises( SvEmbeddedObject
* );
151 SvEditObjectProtocol aProt
;
154 SO3_DLLPRIVATE
void SetViewData( SvClientData
* pD
)
158 SO3_DLLPRIVATE BOOL
HasViewData() const { return pData
!= NULL
; }
159 virtual void MakeViewData();
160 virtual void FreeViewData( SvClientData
* );
162 SO3_DLLPRIVATE
void SetCanPlugIn( BOOL b
)
165 // Benachrichtigungen
166 virtual void Connected( BOOL bConnect
);
167 virtual void Closed();
168 virtual void Opened( BOOL bOpen
);
169 virtual void Embedded( BOOL bEmbedding
);
170 virtual void PlugIn( BOOL bPlugIn
);
171 virtual void ViewChanged( USHORT nAspect
);
173 Rectangle aDoVerbRectPixel
;// Hack um Ole2 zu bezwingen
176 SO2_DECL_STANDARD_CLASS_DLL(SvEmbeddedClient
,SOAPP
)
178 SvClientData
* GetClientData();
180 void SetParent( SvEmbeddedClient
* pPar
)
182 SvEmbeddedClient
* GetParent() const { return pParent
; }
184 SvEmbeddedObject
* GetEmbedObj() const
185 { return aProt
.GetObj(); }
186 void DoDisconnect() { aProt
.Reset(); }
187 BOOL
IsEmbed() const { return aProt
.IsEmbed(); }
190 virtual BOOL
SaveObject(); // Objekt speichern
191 virtual SvEmbeddedObjectRef
GetContainer();
192 virtual void MakeVisible();
194 const SvEditObjectProtocol
& GetProtocol() const { return aProt
; }
195 SvEditObjectProtocol
& GetProtocol() { return aProt
; }
198 BOOL
IsAutoForceMoniker() const { return bAutoForce
; }
199 void SetAutoForceMoniker( BOOL bSet
)
200 { bAutoForce
= bSet
; }
201 virtual ErrCode
GetContURL( INetURLObject
& );
203 USHORT
GetAspect() const { return nAspect
; }
205 #ifndef SO2_DECL_SVEMBEDDEDCLIENT_DEFINED
206 #define SO2_DECL_SVEMBEDDEDCLIENT_DEFINED
207 SO2_DECL_REF(SvEmbeddedClient
)
209 SO2_IMPL_REF(SvEmbeddedClient
)
213 #endif // _CLIENT_HXX