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