bump product version to 4.2.0.1
[LibreOffice.git] / include / sfx2 / frame.hxx
blob73d10565422d38b8bacd12eb1722db1856404481
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SFX2_FRAME_HXX
20 #define INCLUDED_SFX2_FRAME_HXX
22 #ifndef TF_NEWDESKTOP
23 #define TF_NEWDESKTOP 1
24 #endif
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/uno/Any.hxx>
31 #include <com/sun/star/uno/Sequence.hxx>
33 namespace com
35 namespace sun
37 namespace star
39 namespace awt
41 class XWindow;
43 namespace frame
45 class XFrame;
46 class XFrameLoader;
47 class XController;
48 class XDispatchProviderInterceptor;
50 namespace beans
52 struct PropertyValue;
58 #include <comphelper/namedvaluecollection.hxx>
59 #include <rtl/ustring.hxx>
60 #include <svl/brdcst.hxx>
61 #include <svl/poolitem.hxx>
62 #include <tools/ref.hxx>
63 #include <vector>
65 class SvBorder;
66 class SfxWorkWindow;
67 class Window;
68 class SfxFrame;
69 class SfxFrame_Impl;
70 class SfxObjectShell;
71 class SfxObjectFactory;
72 class SfxViewFrame;
73 class SfxFrameDescriptor;
74 class SfxFrameSetDescriptor;
75 class SfxDispatcher;
76 class Rectangle;
77 class SfxRequest;
78 class SfxUnoControllerItem;
79 class SvCompatWeakHdl;
80 class SystemWindow;
82 class SfxFrame;
83 typedef ::std::vector<SfxFrame*> SfxFrameArr_Impl;
85 typedef ::std::vector<OUString> TargetList;
87 #define SFXFRAME_HASTITLE 0x0001
89 //==========================================================================
90 // SfxFrame is a management class for windows and their content.
91 // A SfxApplication represent a hierarchy of SfxFrames, with which the actual
92 // content in the derived classes is defined. The base class SfxFrame
93 // implements two aspects of frames: naming and control of its lifespan.
94 // Inside a frame hierarchy the parent frame always controls the lifespan of
95 // its child frames, even though they usually are not even produced by the
96 // parent. By calling DoCloser() on any frame in the hierarchy,
97 // a part of the "framework" can be removed, where frames unsubscribe
98 // from their parent frames.
99 //==========================================================================
101 class SFX2_DLLPUBLIC SfxFrame
103 friend class SfxFrameIterator;
104 friend class SfxFrameWindow_Impl;
106 private:
107 SfxFrame* pParentFrame;
108 SfxFrameArr_Impl* pChildArr;
109 SfxFrame_Impl* pImp;
110 Window* pWindow;
112 protected:
113 sal_Bool Close();
114 virtual ~SfxFrame();
116 SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* );
118 SfxFrame( ); // not implemented
119 SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden );
121 public:
122 TYPEINFO();
124 static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
125 static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
126 CreateBlankFrame();
127 static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nViewId, bool bHidden );
129 SvCompatWeakHdl* GetHdl();
130 Window& GetWindow() const;
131 void CancelTransfers( sal_Bool bCancelLoadEnv = sal_True );
132 sal_Bool DoClose();
133 sal_uInt16 GetChildFrameCount() const;
134 SfxFrame* GetChildFrame( sal_uInt16 nPos ) const;
135 SfxFrame* GetParentFrame() const
136 { return pParentFrame; }
138 void SetPresentationMode( sal_Bool bSet );
139 SystemWindow* GetSystemWindow() const;
141 static SfxFrame* GetFirst();
142 static SfxFrame* GetNext( SfxFrame& );
144 static const SfxPoolItem*
145 OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame );
147 SfxObjectShell* GetCurrentDocument() const;
148 SfxViewFrame* GetCurrentViewFrame() const;
149 SfxFrame& GetTopFrame() const;
150 sal_Bool IsParent( SfxFrame* ) const;
152 sal_uInt32 GetFrameType() const;
153 void GetTargetList( TargetList& ) const;
154 SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf );
155 void UpdateDescriptor( SfxObjectShell *pDoc );
156 void Resize();
157 sal_Bool HasComponent() const;
158 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
159 GetComponent() const;
160 void ReleaseComponent();
161 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
162 GetFrameInterface() const;
163 void Appear();
164 void AppearWithUpdate();
165 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
166 GetController() const;
168 sal_Bool IsInPlace() const;
170 SAL_DLLPRIVATE sal_Bool DoClose_Impl();
171 SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
172 SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet );
173 SAL_DLLPRIVATE void GetViewData_Impl();
174 SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 );
175 SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False );
176 SAL_DLLPRIVATE sal_Bool DocIsModified_Impl();
177 SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
178 SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const;
179 SAL_DLLPRIVATE void SetIsClosing_Impl();
181 // Methods for accessing the current set
182 SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
184 SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock );
185 SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const;
186 SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const;
188 SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame );
189 SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame );
190 SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet );
191 SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const;
192 SAL_DLLPRIVATE void InvalidateUnoControllers_Impl();
193 SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* );
194 SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* );
195 SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
196 SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& );
197 SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const;
198 SAL_DLLPRIVATE void CreateWorkWindow_Impl();
199 SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
200 SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool );
202 SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc );
203 SAL_DLLPRIVATE void LockResize_Impl( sal_Bool bLock );
204 SAL_DLLPRIVATE void SetMenuBarOn_Impl( sal_Bool bOn );
205 SAL_DLLPRIVATE sal_Bool IsMenuBarOn_Impl() const;
206 SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const;
207 SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const;
208 private:
209 SAL_DLLPRIVATE void Construct_Impl();
212 SV_DECL_COMPAT_WEAK( SfxFrame )
214 class SfxFrameIterator
216 const SfxFrame* pFrame;
217 sal_Bool bRecursive;
219 SfxFrame* NextSibling_Impl( SfxFrame& rPrev );
221 public:
222 SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecursive=sal_True );
223 SfxFrame* FirstFrame();
224 SfxFrame* NextFrame( SfxFrame& rPrev );
227 //--------------------------------------------------------------------
229 class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
231 SfxFrame* pFrame;
232 SfxFrameWeak wFrame;
233 SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; }
235 public:
236 TYPEINFO();
238 SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
239 SfxFrameItem( SfxFrame *p=0 );
240 SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
242 virtual int operator==( const SfxPoolItem& ) const;
243 virtual OUString GetValueText() const;
244 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
246 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
247 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
249 sal_Bool FrameKilled() const { return &wFrame != pFrame; }
251 SfxFrame* GetFrame() const
252 { return wFrame; }
255 class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem
257 ::com::sun::star::uno::Any aValue;
258 public:
259 TYPEINFO();
260 SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny );
261 ::com::sun::star::uno::Any GetValue() const
262 { return aValue; }
263 virtual int operator==( const SfxPoolItem& ) const;
264 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
265 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
266 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
269 class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem
271 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
272 m_xFrame;
274 public:
275 TYPEINFO();
276 SfxUnoFrameItem();
277 SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
278 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
279 GetFrame() const
280 { return m_xFrame; }
281 virtual int operator==( const SfxPoolItem& ) const;
282 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
283 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
284 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
287 typedef SfxUsrAnyItem SfxUnoAnyItem;
289 #endif
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */