Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : : #ifndef _SFXFRAME_HXX
20 : : #define _SFXFRAME_HXX
21 : :
22 : : #ifndef TF_NEWDESKTOP
23 : : #define TF_NEWDESKTOP 1
24 : : #endif
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/uno/Any.hxx>
31 : : #include <com/sun/star/uno/Sequence.hxx>
32 : :
33 : : namespace com
34 : : {
35 : : namespace sun
36 : : {
37 : : namespace star
38 : : {
39 : : namespace awt
40 : : {
41 : : class XWindow;
42 : : }
43 : : namespace frame
44 : : {
45 : : class XFrame;
46 : : class XFrameLoader;
47 : : class XController;
48 : : class XDispatchProviderInterceptor;
49 : : }
50 : : namespace beans
51 : : {
52 : : struct PropertyValue;
53 : : }
54 : : }
55 : : }
56 : : }
57 : : #include <tools/ref.hxx>
58 : : #include <tools/string.hxx>
59 : : #include <svl/brdcst.hxx>
60 : : #include <svl/poolitem.hxx>
61 : : #include <comphelper/namedvaluecollection.hxx>
62 : : #include <vector>
63 : :
64 : : class SvBorder;
65 : : class SfxWorkWindow;
66 : : class Window;
67 : : class SfxFrame;
68 : : class SfxFrame_Impl;
69 : : class SfxObjectShell;
70 : : class SfxObjectFactory;
71 : : class SfxViewFrame;
72 : : class SfxFrameDescriptor;
73 : : class SfxFrameSetDescriptor;
74 : : class SfxMedium;
75 : : class SfxDispatcher;
76 : : class SfxMedium;
77 : : class Rectangle;
78 : : class SfxRequest;
79 : : class SfxUnoControllerItem;
80 : : class SvCompatWeakHdl;
81 : : class SystemWindow;
82 : :
83 : : class SfxFrame;
84 : : typedef ::std::vector<SfxFrame*> SfxFrameArr_Impl;
85 : :
86 : : typedef ::std::vector< String* > TargetList;
87 : :
88 : : #define SFXFRAME_HASTITLE 0x0001
89 : :
90 : : //==========================================================================
91 : : // SfxFrame is a management class for windows and their content.
92 : : // A SfxApplication represent a hierarchy of SfxFrames, with which the actual
93 : : // content in the derived classes is defined. The base class SfxFrame
94 : : // implements two aspects of frames: naming and control of its lifespan.
95 : : // Inside a frame hierarchy the parent frame always controls the lifespan of
96 : : // its child frames, even though they usually are not even produced by the
97 : : // parent. By calling DoCloser() on any frame in the hierarchy,
98 : : // a part of the "framework" can be removed, where frames unsubscribe
99 : : // from their parent frames.
100 : : //==========================================================================
101 : :
102 : : class SFX2_DLLPUBLIC SfxFrame
103 : : {
104 : : friend class SfxFrameIterator;
105 : : friend class SfxFrameWindow_Impl;
106 : :
107 : : private:
108 : : SfxFrame* pParentFrame;
109 : : SfxFrameArr_Impl* pChildArr;
110 : : SfxFrame_Impl* pImp;
111 : : Window* pWindow;
112 : :
113 : : protected:
114 : : sal_Bool Close();
115 : : virtual ~SfxFrame();
116 : :
117 : : SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* );
118 : :
119 : : SfxFrame( ); // not implemented
120 : : SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden );
121 : :
122 : : public:
123 : : TYPEINFO();
124 : :
125 : : static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
126 : : static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
127 : : CreateBlankFrame();
128 : : static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nViewId, bool bHidden );
129 : :
130 : : SvCompatWeakHdl* GetHdl();
131 : : Window& GetWindow() const;
132 : : void CancelTransfers( sal_Bool bCancelLoadEnv = sal_True );
133 : : sal_Bool DoClose();
134 : : sal_uInt16 GetChildFrameCount() const;
135 : : SfxFrame* GetChildFrame( sal_uInt16 nPos ) const;
136 : 2636 : SfxFrame* GetParentFrame() const
137 : 2636 : { return pParentFrame; }
138 : :
139 : : void SetPresentationMode( sal_Bool bSet );
140 : : SystemWindow* GetSystemWindow() const;
141 : :
142 : : static SfxFrame* GetFirst();
143 : : static SfxFrame* GetNext( SfxFrame& );
144 : :
145 : : static const SfxPoolItem*
146 : : OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame );
147 : :
148 : : SfxObjectShell* GetCurrentDocument() const;
149 : : SfxViewFrame* GetCurrentViewFrame() const;
150 : : SfxFrame& GetTopFrame() const;
151 : : sal_Bool IsParent( SfxFrame* ) const;
152 : :
153 : : sal_uInt32 GetFrameType() const;
154 : : void GetTargetList( TargetList& ) const;
155 : : SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf );
156 : : void UpdateDescriptor( SfxObjectShell *pDoc );
157 : : void Resize();
158 : : sal_Bool HasComponent() const;
159 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
160 : : GetComponent() const;
161 : : void ReleaseComponent();
162 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
163 : : GetFrameInterface() const;
164 : : void Appear();
165 : : void AppearWithUpdate();
166 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
167 : : GetController() const;
168 : :
169 : : sal_Bool IsInPlace() const;
170 : :
171 : : SAL_DLLPRIVATE sal_Bool DoClose_Impl();
172 : : SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
173 : : SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet );
174 : : SAL_DLLPRIVATE void GetViewData_Impl();
175 : : SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 );
176 : : SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False );
177 : : SAL_DLLPRIVATE sal_Bool DocIsModified_Impl();
178 : : SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
179 : : SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const;
180 : : SAL_DLLPRIVATE void SetIsClosing_Impl();
181 : :
182 : : // Methods for accessing the current set
183 : : SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
184 : :
185 : : SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock );
186 : : SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const;
187 : : SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const;
188 : :
189 : : SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame );
190 : : SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame );
191 : : SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet );
192 : : SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const;
193 : : SAL_DLLPRIVATE void InvalidateUnoControllers_Impl();
194 : : SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* );
195 : : SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* );
196 : : SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
197 : : SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& );
198 : : SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const;
199 : : SAL_DLLPRIVATE void CreateWorkWindow_Impl();
200 : : SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
201 : : SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool );
202 : :
203 : : SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc );
204 : : SAL_DLLPRIVATE void LockResize_Impl( sal_Bool bLock );
205 : : SAL_DLLPRIVATE void SetMenuBarOn_Impl( sal_Bool bOn );
206 : : SAL_DLLPRIVATE sal_Bool IsMenuBarOn_Impl() const;
207 : : SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const;
208 : : SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const;
209 : : private:
210 : : SAL_DLLPRIVATE void Construct_Impl();
211 : : };
212 : :
213 [ # # ]: 0 : SV_DECL_COMPAT_WEAK( SfxFrame )
214 : :
215 : : class SfxFrameIterator
216 : : {
217 : : const SfxFrame* pFrame;
218 : : sal_Bool bRecursive;
219 : :
220 : : SfxFrame* NextSibling_Impl( SfxFrame& rPrev );
221 : :
222 : : public:
223 : : SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecursive=sal_True );
224 : : SfxFrame* FirstFrame();
225 : : SfxFrame* NextFrame( SfxFrame& rPrev );
226 : : };
227 : :
228 : : //--------------------------------------------------------------------
229 : :
230 [ # # ][ # # ]: 0 : class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
231 : : {
232 : : SfxFrame* pFrame;
233 : : SfxFrameWeak wFrame;
234 : : SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; }
235 : :
236 : : public:
237 : : TYPEINFO();
238 : :
239 : : SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
240 : : SfxFrameItem( SfxFrame *p=0 );
241 : : SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
242 : :
243 : : virtual int operator==( const SfxPoolItem& ) const;
244 : : virtual String GetValueText() const;
245 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
246 : :
247 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
248 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
249 : :
250 : : sal_Bool FrameKilled() const { return &wFrame != pFrame; }
251 : :
252 : 0 : SfxFrame* GetFrame() const
253 : 0 : { return wFrame; }
254 : : };
255 : :
256 [ # # ]: 0 : class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem
257 : : {
258 : : ::com::sun::star::uno::Any aValue;
259 : : public:
260 : : TYPEINFO();
261 : : SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny );
262 : 83 : ::com::sun::star::uno::Any GetValue() const
263 : 83 : { return aValue; }
264 : : virtual int operator==( const SfxPoolItem& ) const;
265 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
266 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
267 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
268 : : };
269 : :
270 : : class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem
271 : : {
272 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
273 : : m_xFrame;
274 : :
275 : : public:
276 : : TYPEINFO();
277 : : SfxUnoFrameItem();
278 : : SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
279 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
280 : 0 : GetFrame() const
281 : 0 : { return m_xFrame; }
282 : : virtual int operator==( const SfxPoolItem& ) const;
283 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
284 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
285 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
286 : : };
287 : :
288 : : typedef SfxUsrAnyItem SfxUnoAnyItem;
289 : :
290 : : #endif
291 : :
292 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|