Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_so3 / client.hxx
blob616f1a05407ba69906d3a2ac502ab64b2be0eb21
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: client.hxx,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 #ifndef _CLIENT_HXX
32 #define _CLIENT_HXX
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"
41 #endif
43 /*************************************************************************
44 *************************************************************************/
45 class Window;
46 class OutputDevice;
47 class ImpClientSite;
48 class ImpAdviseSink;
49 class ImpOleObject;
50 struct IOleClientSite;
51 struct IAdviseSink;
53 class INetURLObject;
55 namespace binfilter {
57 class SvEmbeddedObject;
58 class SvEmbeddedClient;
60 #ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
61 #define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
62 SO2_DECL_REF(SvEmbeddedObject)
63 #endif
65 class SO3_DLLPUBLIC SvClientData
67 friend class SvEmbeddedClient;
68 private:
69 SvEmbeddedClient * pClient;
70 Rectangle aObjRect; // Groesse des Objektes in logischen
71 // Koordinaten
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
77 protected:
78 SO3_DLLPRIVATE void SetEditWin( Window * pWin ) { pEditWin = pWin; }
79 public:
80 TYPEINFO();
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
112 private:
113 Size aMaxSize; //maximale Groesse des Gebietes
114 Size aMinSize; //minimale Groesse des Gebietes
115 Size aStepSize;//Schrittweite der Veraenderung
116 public:
117 SvAreaConstrain() {};
118 SvAreaConstrain( const Size & rMax,
119 const Size & rMin, const Size & rStep )
120 : aMaxSize( rMax )
121 , aMinSize( rMin )
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;
141 private:
142 SvClientData * pData; // Wird auch in SvInPlaceClient modifiziert
143 SvEmbeddedClient * pParent;
144 USHORT nAspect;
145 BOOL bAutoForce:1,
146 bDeleteData:1,
147 bCanPlugIn;
149 SO3_DLLPRIVATE void SetStandardAdvises( SvEmbeddedObject * );
150 protected:
151 SvEditObjectProtocol aProt;
152 ~SvEmbeddedClient();
154 SO3_DLLPRIVATE void SetViewData( SvClientData * pD )
156 pData = 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 )
163 { bCanPlugIn = 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 );
172 public:
173 Rectangle aDoVerbRectPixel;// Hack um Ole2 zu bezwingen
175 SvEmbeddedClient();
176 SO2_DECL_STANDARD_CLASS_DLL(SvEmbeddedClient,SOAPP)
178 SvClientData * GetClientData();
180 void SetParent( SvEmbeddedClient * pPar )
181 { pParent = 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(); }
189 // Befehle
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; }
197 BOOL CanPlugIn();
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)
208 #endif
209 SO2_IMPL_REF(SvEmbeddedClient)
213 #endif // _CLIENT_HXX