xref: /aoo41x/main/sfx2/inc/sfx2/frame.hxx (revision 353d8f4d)
1*353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*353d8f4dSAndrew Rist  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*353d8f4dSAndrew Rist  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19*353d8f4dSAndrew Rist  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir #ifndef _SFXFRAME_HXX
24cdf0e10cSrcweir #define _SFXFRAME_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef TF_NEWDESKTOP
27cdf0e10cSrcweir #define TF_NEWDESKTOP 1
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "sal/config.h"
31cdf0e10cSrcweir #include "sfx2/dllapi.h"
32cdf0e10cSrcweir #include "sal/types.h"
33cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
34cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
35cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace com
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     namespace sun
40cdf0e10cSrcweir     {
41cdf0e10cSrcweir         namespace star
42cdf0e10cSrcweir         {
43cdf0e10cSrcweir             namespace awt
44cdf0e10cSrcweir             {
45cdf0e10cSrcweir                 class XWindow;
46cdf0e10cSrcweir             }
47cdf0e10cSrcweir             namespace frame
48cdf0e10cSrcweir             {
49cdf0e10cSrcweir                 class XFrame;
50cdf0e10cSrcweir                 class XFrameLoader;
51cdf0e10cSrcweir                 class XController;
52cdf0e10cSrcweir                 class XDispatchProviderInterceptor;
53cdf0e10cSrcweir             }
54cdf0e10cSrcweir             namespace beans
55cdf0e10cSrcweir             {
56cdf0e10cSrcweir                 struct PropertyValue;
57cdf0e10cSrcweir             }
58cdf0e10cSrcweir         }
59cdf0e10cSrcweir     }
60cdf0e10cSrcweir }
61cdf0e10cSrcweir #include <tools/link.hxx>
62cdf0e10cSrcweir #include <tools/ref.hxx>
63cdf0e10cSrcweir #include <tools/string.hxx>
64cdf0e10cSrcweir #include <svl/brdcst.hxx>
65cdf0e10cSrcweir #include <tools/list.hxx>
66cdf0e10cSrcweir #include <svl/poolitem.hxx>
67cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx>
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class SvBorder;
70cdf0e10cSrcweir class SfxWorkWindow;
71cdf0e10cSrcweir class Window;
72cdf0e10cSrcweir class SfxFrame;
73cdf0e10cSrcweir class SfxFrame_Impl;
74cdf0e10cSrcweir class SfxObjectShell;
75cdf0e10cSrcweir class SfxObjectFactory;
76cdf0e10cSrcweir class SfxViewFrame;
77cdf0e10cSrcweir class SfxFrameDescriptor;
78cdf0e10cSrcweir class SfxFrameSetDescriptor;
79cdf0e10cSrcweir class SfxMedium;
80cdf0e10cSrcweir class SfxFrameHistory_Impl;
81cdf0e10cSrcweir class SfxDispatcher;
82cdf0e10cSrcweir class SfxMedium;
83cdf0e10cSrcweir class Rectangle;
84cdf0e10cSrcweir class SfxRequest;
85cdf0e10cSrcweir class SfxUnoControllerItem;
86cdf0e10cSrcweir class SvCompatWeakHdl;
87cdf0e10cSrcweir class SystemWindow;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir typedef SfxFrame* SfxFramePtr;
90cdf0e10cSrcweir class SfxFrameArr_Impl;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir DECLARE_LIST( TargetList, String* )
93cdf0e10cSrcweir 
94cdf0e10cSrcweir #define SFXFRAME_HASTITLE     0x0001
95cdf0e10cSrcweir 
96cdf0e10cSrcweir //==========================================================================
97cdf0e10cSrcweir // Ein SfxFrame ist eine Verwaltungsklasse f"ur Fenster und deren Inhalte.
98cdf0e10cSrcweir // Eine SfxApplication pr"asentiert sich als Hierarchie von SfxFrames, wobei
99cdf0e10cSrcweir // die konkreten Inhalte in den abgeleiteten Klassen festgelegt werden.
100cdf0e10cSrcweir // Die Basisklasse SfxFrame implementiert 2 Aspekte der Frames: Benennung und
101cdf0e10cSrcweir // Kontrolle der Lebensdauer.
102cdf0e10cSrcweir // Innerhalb einer Frames-Hierarchie kontrolliert immer der ParentFrame die
103cdf0e10cSrcweir // Lebensdauer seiner ChildFrames, auch wenn sie in der Regel gar nicht von
104cdf0e10cSrcweir // ihm selbst erzeugt wurden. Durch Aufruf vonn DoClose() an irgendeinem
105cdf0e10cSrcweir // Frame in der Hierarchie kann ein Teil des "Frameworks" entfernt werden,
106cdf0e10cSrcweir // wobei sich Frames an ihren ParentFrames selbst abmelden.
107cdf0e10cSrcweir //==========================================================================
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class SfxFrameArr_Impl;
110cdf0e10cSrcweir struct SfxFramePickEntry_Impl;
111cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxFrame
112cdf0e10cSrcweir {
113cdf0e10cSrcweir 	friend class SfxFrameIterator;
114cdf0e10cSrcweir     friend class SfxFrameWindow_Impl;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir private:
117cdf0e10cSrcweir 	SfxFrame*			pParentFrame;
118cdf0e10cSrcweir 	SfxFrameArr_Impl*	pChildArr;
119cdf0e10cSrcweir 	SfxFrame_Impl*		pImp;
120cdf0e10cSrcweir     Window*             pWindow;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir protected:
123cdf0e10cSrcweir     sal_Bool            Close();
124cdf0e10cSrcweir     virtual             ~SfxFrame();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 						SfxFrame( );    // not implemented
129cdf0e10cSrcweir     SAL_DLLPRIVATE      SfxFrame( Window& i_rContainerWindow, bool bHidden );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir public:
132cdf0e10cSrcweir 						TYPEINFO();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     static SfxFrame*    Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
135cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
136cdf0e10cSrcweir                         CreateBlankFrame();
137cdf0e10cSrcweir     static SfxFrame*    Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nViewId, bool bHidden );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	SvCompatWeakHdl*    GetHdl();
140cdf0e10cSrcweir 	Window&             GetWindow() const;
141cdf0e10cSrcweir 	void                CancelTransfers( sal_Bool bCancelLoadEnv = sal_True );
142cdf0e10cSrcweir     sal_Bool            DoClose();
143cdf0e10cSrcweir     sal_uInt16          GetChildFrameCount() const;
144cdf0e10cSrcweir 	SfxFrame*			GetChildFrame( sal_uInt16 nPos ) const;
GetParentFrame() const145cdf0e10cSrcweir 	SfxFrame*	  		GetParentFrame() const
146cdf0e10cSrcweir 						{ return pParentFrame; }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     void                SetPresentationMode( sal_Bool bSet );
149cdf0e10cSrcweir     SystemWindow*       GetSystemWindow() const;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     static SfxFrame*    GetFirst();
152cdf0e10cSrcweir     static SfxFrame*    GetNext( SfxFrame& );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     static const SfxPoolItem*
155cdf0e10cSrcweir                         OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     SfxBroadcaster&     GetBroadcaster() const;
158cdf0e10cSrcweir 	SfxObjectShell*		GetCurrentDocument() const;
159cdf0e10cSrcweir 	SfxViewFrame*		GetCurrentViewFrame() const;
160cdf0e10cSrcweir 	SfxFrame&			GetTopFrame() const;
161cdf0e10cSrcweir     sal_Bool            IsParent( SfxFrame* ) const;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     sal_uInt32          GetFrameType() const;
164cdf0e10cSrcweir 	void				GetTargetList( TargetList& ) const;
165cdf0e10cSrcweir 	SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf );
166cdf0e10cSrcweir     sal_Bool            IsTop() const;
167cdf0e10cSrcweir 	void				UpdateDescriptor( SfxObjectShell *pDoc );
168cdf0e10cSrcweir 	void				Resize();
169cdf0e10cSrcweir     sal_Bool            HasComponent() const;
170cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
171cdf0e10cSrcweir                             GetComponent() const;
172cdf0e10cSrcweir 	void				ReleaseComponent();
173cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
174cdf0e10cSrcweir                             GetFrameInterface() const;
175cdf0e10cSrcweir 	void 				Appear();
176cdf0e10cSrcweir 	void 				AppearWithUpdate();
177cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
178cdf0e10cSrcweir                             GetController() const;
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     sal_Bool            IsInPlace() const;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
183cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool DoClose_Impl();
184cdf0e10cSrcweir     SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
185cdf0e10cSrcweir 	SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet );
186cdf0e10cSrcweir 	SAL_DLLPRIVATE void GetViewData_Impl();
187cdf0e10cSrcweir 	SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 );
188cdf0e10cSrcweir     SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False );
189cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool DocIsModified_Impl();
190cdf0e10cSrcweir 	SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
191cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const;
192cdf0e10cSrcweir 	SAL_DLLPRIVATE void SetIsClosing_Impl();
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 						// Methoden f"ur den Zugriff auf das aktuelle Set
195cdf0e10cSrcweir 	SAL_DLLPRIVATE void SetDescriptor( SfxFrameDescriptor* );
196cdf0e10cSrcweir 	SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 	SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock );
199cdf0e10cSrcweir 	SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const;
200cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const;
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 	SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame );
203cdf0e10cSrcweir 	SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame );
204cdf0e10cSrcweir 	SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet );
205cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const;
206cdf0e10cSrcweir 	SAL_DLLPRIVATE void InvalidateUnoControllers_Impl();
207cdf0e10cSrcweir 	SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* );
208cdf0e10cSrcweir 	SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* );
209cdf0e10cSrcweir 	SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
210cdf0e10cSrcweir 	SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& );
211cdf0e10cSrcweir 	SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const;
212cdf0e10cSrcweir 	SAL_DLLPRIVATE void CreateWorkWindow_Impl();
213cdf0e10cSrcweir     SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* pWorkwin );
214cdf0e10cSrcweir 	SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
215cdf0e10cSrcweir     SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc );
218cdf0e10cSrcweir     SAL_DLLPRIVATE void LockResize_Impl( sal_Bool bLock );
219cdf0e10cSrcweir     SAL_DLLPRIVATE void SetMenuBarOn_Impl( sal_Bool bOn );
220cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool IsMenuBarOn_Impl() const;
221cdf0e10cSrcweir     SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const;
222cdf0e10cSrcweir     SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const;
223cdf0e10cSrcweir     SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const;
224cdf0e10cSrcweir //#endif
225cdf0e10cSrcweir private:
226cdf0e10cSrcweir     SAL_DLLPRIVATE void Construct_Impl();
227cdf0e10cSrcweir };
228cdf0e10cSrcweir 
229cdf0e10cSrcweir SV_DECL_COMPAT_WEAK( SfxFrame )
230cdf0e10cSrcweir 
231cdf0e10cSrcweir class SfxFrameIterator
232cdf0e10cSrcweir {
233cdf0e10cSrcweir 	const SfxFrame*			pFrame;
234cdf0e10cSrcweir     sal_Bool                bRecursive;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
237cdf0e10cSrcweir 	SfxFrame*				NextSibling_Impl( SfxFrame& rPrev );
238cdf0e10cSrcweir //#endif
239cdf0e10cSrcweir 
240cdf0e10cSrcweir public:
241cdf0e10cSrcweir 							SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecursive=sal_True );
242cdf0e10cSrcweir 	SfxFrame*				FirstFrame();
243cdf0e10cSrcweir 	SfxFrame*				NextFrame( SfxFrame& rPrev );
244cdf0e10cSrcweir };
245cdf0e10cSrcweir 
246cdf0e10cSrcweir //--------------------------------------------------------------------
247cdf0e10cSrcweir 
248cdf0e10cSrcweir class SfxFrameItem_Impl;
249cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
250cdf0e10cSrcweir {
251cdf0e10cSrcweir 	SfxFrame*               pFrame;
252cdf0e10cSrcweir 	SfxFrameWeak  		    wFrame;
SetFramePtr_Impl(SfxFrame *)253cdf0e10cSrcweir 	SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir public:
256cdf0e10cSrcweir 							TYPEINFO();
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 							SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
259cdf0e10cSrcweir 							SfxFrameItem( SfxFrame *p=0 );
260cdf0e10cSrcweir 							SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	virtual int 			operator==( const SfxPoolItem& ) const;
263cdf0e10cSrcweir 	virtual String			GetValueText() const;
264cdf0e10cSrcweir 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	virtual	sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
267cdf0e10cSrcweir 	virtual	sal_Bool		PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
268cdf0e10cSrcweir 
FrameKilled() const269cdf0e10cSrcweir     sal_Bool                FrameKilled() const { return &wFrame != pFrame; }
270cdf0e10cSrcweir 
GetFrame() const271cdf0e10cSrcweir 	SfxFrame*				GetFrame() const
272cdf0e10cSrcweir 							{ return wFrame; }
273cdf0e10cSrcweir };
274cdf0e10cSrcweir 
275cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem
276cdf0e10cSrcweir {
277cdf0e10cSrcweir     ::com::sun::star::uno::Any  aValue;
278cdf0e10cSrcweir public:
279cdf0e10cSrcweir                                 TYPEINFO();
280cdf0e10cSrcweir                                 SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny );
GetValue() const281cdf0e10cSrcweir     ::com::sun::star::uno::Any  GetValue() const
282cdf0e10cSrcweir                                 { return aValue; }
283cdf0e10cSrcweir     virtual int                 operator==( const SfxPoolItem& ) const;
284cdf0e10cSrcweir     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const;
285cdf0e10cSrcweir     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
286cdf0e10cSrcweir     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
287cdf0e10cSrcweir };
288cdf0e10cSrcweir 
289cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem
290cdf0e10cSrcweir {
291cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
292cdf0e10cSrcweir                                 m_xFrame;
293cdf0e10cSrcweir 
294cdf0e10cSrcweir public:
295cdf0e10cSrcweir                                 TYPEINFO();
296cdf0e10cSrcweir                                 SfxUnoFrameItem();
297cdf0e10cSrcweir                                 SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
298cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
GetFrame() const299cdf0e10cSrcweir                                 GetFrame() const
300cdf0e10cSrcweir                                 { return m_xFrame; }
301cdf0e10cSrcweir     virtual int                 operator==( const SfxPoolItem& ) const;
302cdf0e10cSrcweir     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const;
303cdf0e10cSrcweir     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
304cdf0e10cSrcweir     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
305cdf0e10cSrcweir };
306cdf0e10cSrcweir 
307cdf0e10cSrcweir typedef SfxUsrAnyItem SfxUnoAnyItem;
308cdf0e10cSrcweir 
309cdf0e10cSrcweir #endif
310