bump product version to 5.0.4.1
[LibreOffice.git] / include / sfx2 / frame.hxx
blobd9c3620ee1eb564f1df4b32f471d50178eb906f1
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>
32 #include <vcl/vclptr.hxx>
34 namespace com
36 namespace sun
38 namespace star
40 namespace awt
42 class XWindow;
44 namespace frame
46 class XFrame;
47 class XFrameLoader;
48 class XController;
49 class XDispatchProviderInterceptor;
51 namespace beans
53 struct PropertyValue;
59 #include <comphelper/namedvaluecollection.hxx>
60 #include <rtl/ustring.hxx>
61 #include <svl/poolitem.hxx>
62 #include <tools/ref.hxx>
63 #include <vector>
65 class SvBorder;
66 class SfxWorkWindow;
67 namespace vcl { 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 SystemWindow;
80 class SfxFrameArr_Impl;
82 typedef ::std::vector<OUString> TargetList;
84 #define SFXFRAME_HASTITLE 0x0001
87 // SfxFrame is a management class for windows and their content.
88 // A SfxApplication represent a hierarchy of SfxFrames, with which the actual
89 // content in the derived classes is defined. The base class SfxFrame
90 // implements two aspects of frames: naming and control of its lifespan.
91 // Inside a frame hierarchy the parent frame always controls the lifespan of
92 // its child frames, even though they usually are not even produced by the
93 // parent. By calling DoCloser() on any frame in the hierarchy,
94 // a part of the "framework" can be removed, where frames unsubscribe
95 // from their parent frames.
98 class SFX2_DLLPUBLIC SfxFrame : public SvCompatWeakBase<SfxFrame>
100 friend class SfxFrameIterator;
101 friend class SfxFrameWindow_Impl;
103 private:
104 SfxFrame* pParentFrame;
105 SfxFrameArr_Impl* pChildArr;
106 SfxFrame_Impl* pImp;
107 VclPtr<vcl::Window> pWindow;
109 protected:
110 bool Close();
111 virtual ~SfxFrame();
113 SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* );
115 SfxFrame( ); // not implemented
116 SAL_DLLPRIVATE SfxFrame( vcl::Window& i_rContainerWindow, bool bHidden );
118 public:
119 TYPEINFO();
121 static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
122 static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
123 CreateBlankFrame();
124 static SfxFrame* Create( SfxObjectShell& rDoc, vcl::Window& rWindow, sal_uInt16 nViewId, bool bHidden );
126 vcl::Window& GetWindow() const { return *pWindow;}
127 void CancelTransfers( bool bCancelLoadEnv = true );
128 bool DoClose();
129 sal_uInt16 GetChildFrameCount() const;
130 SfxFrame* GetChildFrame( sal_uInt16 nPos ) const;
131 SfxFrame* GetParentFrame() const
132 { return pParentFrame; }
134 void SetPresentationMode( bool bSet );
135 SystemWindow* GetSystemWindow() const;
137 static SfxFrame* GetFirst();
138 static SfxFrame* GetNext( SfxFrame& );
140 static const SfxPoolItem*
141 OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame );
143 SfxObjectShell* GetCurrentDocument() const;
144 SfxViewFrame* GetCurrentViewFrame() const;
145 SfxFrame& GetTopFrame() const;
146 bool IsParent( SfxFrame* ) const;
148 sal_uInt32 GetFrameType() const;
149 static void GetDefaultTargetList( TargetList& );
150 void GetTargetList( TargetList& ) const;
151 SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf );
152 void UpdateDescriptor( SfxObjectShell *pDoc );
153 void Resize();
154 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
155 GetComponent() const;
156 void ReleaseComponent();
157 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
158 GetFrameInterface() const;
159 void Appear();
160 void AppearWithUpdate();
161 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
162 GetController() const;
164 bool IsInPlace() const;
166 SAL_DLLPRIVATE bool DoClose_Impl();
167 SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
168 SAL_DLLPRIVATE void ReleasingComponent_Impl( bool bSet );
169 SAL_DLLPRIVATE void GetViewData_Impl();
170 SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 );
171 SAL_DLLPRIVATE bool PrepareClose_Impl( bool bUI );
172 SAL_DLLPRIVATE bool DocIsModified_Impl();
173 SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
174 SAL_DLLPRIVATE bool IsClosing_Impl() const;
175 SAL_DLLPRIVATE void SetIsClosing_Impl();
177 // Methods for accessing the current set
178 SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
180 SAL_DLLPRIVATE void Lock_Impl( bool bLock );
181 SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const;
182 SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const;
184 SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame );
185 SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame );
186 SAL_DLLPRIVATE void SetOwnsBindings_Impl( bool bSet );
187 SAL_DLLPRIVATE bool OwnsBindings_Impl() const;
188 SAL_DLLPRIVATE void InvalidateUnoControllers_Impl();
189 SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* );
190 SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* );
191 SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
192 SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& );
193 SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const;
194 SAL_DLLPRIVATE void CreateWorkWindow_Impl();
195 SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
196 SAL_DLLPRIVATE void SetInPlace_Impl( bool );
198 SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc );
199 SAL_DLLPRIVATE void LockResize_Impl( bool bLock );
200 SAL_DLLPRIVATE void SetMenuBarOn_Impl( bool bOn );
201 SAL_DLLPRIVATE bool IsMenuBarOn_Impl() const;
202 SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const;
203 SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const;
204 private:
205 SAL_DLLPRIVATE void Construct_Impl();
208 typedef SvCompatWeakRef<SfxFrame> SfxFrameWeakRef;
210 class SfxFrameIterator
212 const SfxFrame* pFrame;
213 bool bRecursive;
215 SfxFrame* NextSibling_Impl( SfxFrame& rPrev );
217 public:
218 SfxFrameIterator( const SfxFrame& rFrame, bool bRecursive=true );
219 SfxFrame* FirstFrame();
220 SfxFrame* NextFrame( SfxFrame& rPrev );
225 class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
227 SfxFrame* pFrame;
228 SfxFrameWeakRef wFrame;
229 SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; }
231 public:
232 TYPEINFO_OVERRIDE();
234 SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
235 SfxFrameItem( SfxFrame *p=0 );
236 SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
238 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
239 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
241 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
242 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
244 bool FrameKilled() const { return &wFrame != pFrame; }
246 SfxFrame* GetFrame() const
247 { return wFrame; }
250 class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem
252 ::com::sun::star::uno::Any aValue;
253 public:
254 TYPEINFO_OVERRIDE();
255 SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny );
256 ::com::sun::star::uno::Any GetValue() const
257 { return aValue; }
258 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
259 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
260 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
261 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
264 class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem
266 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
267 m_xFrame;
269 public:
270 TYPEINFO_OVERRIDE();
271 SfxUnoFrameItem();
272 SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
273 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
274 GetFrame() const
275 { return m_xFrame; }
276 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
277 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
278 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
279 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
282 typedef SfxUsrAnyItem SfxUnoAnyItem;
284 #endif
286 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */