xref: /aoo4110/main/sfx2/inc/sfx2/ipclient.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 #ifndef _SFX_IPCLIENT_HXX
24 #define _SFX_IPCLIENT_HXX
25 
26 #include "sal/config.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 #include <com/sun/star/uno/Reference.h>
30 #include <com/sun/star/embed/Aspects.hpp>
31 #include <com/sun/star/embed/XEmbeddedObject.hpp>
32 
33 #include <tools/ref.hxx>
34 #include <tools/gen.hxx>
35 
36 #include <sfx2/objsh.hxx>
37 
38 class SfxInPlaceClient_Impl;
39 class SfxViewShell;
40 class SfxObjectShell;
41 class Window;
42 class Fraction;
43 
44 //=========================================================================
45 
46 class SFX2_DLLPUBLIC SfxInPlaceClient
47 {
48 friend class SfxInPlaceClient_Impl;
49 
50 	SfxInPlaceClient_Impl*	m_pImp;
51 	SfxViewShell*			m_pViewSh;
52     Window*                 m_pEditWin;
53 
54     // called after the requested new object area was negotiated
55     SAL_DLLPRIVATE virtual void ObjectAreaChanged();
56 
57     // an active object was resized by the user and now asks for the new space
58     SAL_DLLPRIVATE virtual void RequestNewObjectArea( Rectangle& );
59 
60     // notify the client that an active object has changed its VisualAreaSize
61     SAL_DLLPRIVATE virtual void ViewChanged();
62 
63     // an object wants to become visible
64     SAL_DLLPRIVATE virtual void MakeVisible();
65 
66 public:
67                         SfxInPlaceClient( SfxViewShell* pViewShell, Window* pDraw, sal_Int64 nAspect = com::sun::star::embed::Aspects::MSOLE_CONTENT );
68 	virtual 			~SfxInPlaceClient();
69 
GetViewShell() const70 	SfxViewShell*		GetViewShell() const { return m_pViewSh; }
GetEditWin() const71     Window*             GetEditWin() const { return m_pEditWin; }
72     com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject() const;
73     void                SetObject( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rObject );
74     void                SetObjectState( sal_Int32 );
75     Size                GetObjectVisAreaSize() const;
76     sal_Bool            IsObjectUIActive() const;
77     sal_Bool            IsObjectInPlaceActive() const;
78     sal_Bool            IsObjectActive() const;
79     void                DeactivateObject();
80     sal_Bool                SetObjArea( const Rectangle & );
81     Rectangle           GetObjArea() const;
82     Rectangle           GetScaledObjArea() const;
83     void                SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight );
84     sal_Bool            SetObjAreaAndScale( const Rectangle&, const Fraction&, const Fraction& );
85     const Fraction&     GetScaleWidth() const;
86     const Fraction&     GetScaleHeight() const;
87     void                Invalidate();
88     static Window*      GetActiveWindow( SfxObjectShell* pDoc, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObject );
89     static SfxInPlaceClient* GetClient( SfxObjectShell* pDoc, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObject );
90     sal_Int64           GetAspect() const;
91 	sal_Int64			GetObjectMiscStatus() const;
92     ErrCode             DoVerb( long nVerb );
93     void                VisAreaChanged();
94     void                ResetObject();
95     sal_Bool                IsUIActive();
96 
97     // used in Writer
98     // Rectangle           PixelObjVisAreaToLogic( const Rectangle & rObjRect ) const;
99     // Rectangle           LogicObjAreaToPixel( const Rectangle & rRect ) const;
100     virtual void        FormatChanged(); // object format was changed (used for StarMath formulas aligning)
101 };
102 
103 #endif
104 
105