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 INCLUDED_SFX2_FRAME_HXX
20 : #define INCLUDED_SFX2_FRAME_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 :
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>
64 :
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;
81 :
82 : class SfxFrame;
83 : typedef ::std::vector<SfxFrame*> SfxFrameArr_Impl;
84 :
85 : typedef ::std::vector<OUString> TargetList;
86 :
87 : #define SFXFRAME_HASTITLE 0x0001
88 :
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 :
100 :
101 : class SFX2_DLLPUBLIC SfxFrame
102 : {
103 : friend class SfxFrameIterator;
104 : friend class SfxFrameWindow_Impl;
105 :
106 : private:
107 : SfxFrame* pParentFrame;
108 : SfxFrameArr_Impl* pChildArr;
109 : SfxFrame_Impl* pImp;
110 : Window* pWindow;
111 :
112 : protected:
113 : bool Close();
114 : virtual ~SfxFrame();
115 :
116 : SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* );
117 :
118 : SfxFrame( ); // not implemented
119 : SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden );
120 :
121 : public:
122 : TYPEINFO();
123 :
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 );
128 :
129 : SvCompatWeakHdl* GetHdl();
130 : Window& GetWindow() const;
131 : void CancelTransfers( bool bCancelLoadEnv = true );
132 : bool DoClose();
133 : sal_uInt16 GetChildFrameCount() const;
134 : SfxFrame* GetChildFrame( sal_uInt16 nPos ) const;
135 0 : SfxFrame* GetParentFrame() const
136 0 : { return pParentFrame; }
137 :
138 : void SetPresentationMode( bool bSet );
139 : SystemWindow* GetSystemWindow() const;
140 :
141 : static SfxFrame* GetFirst();
142 : static SfxFrame* GetNext( SfxFrame& );
143 :
144 : static const SfxPoolItem*
145 : OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame );
146 :
147 : SfxObjectShell* GetCurrentDocument() const;
148 : SfxViewFrame* GetCurrentViewFrame() const;
149 : SfxFrame& GetTopFrame() const;
150 : bool IsParent( SfxFrame* ) const;
151 :
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 : 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;
167 :
168 : bool IsInPlace() const;
169 :
170 : SAL_DLLPRIVATE 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( bool bSet );
173 : SAL_DLLPRIVATE void GetViewData_Impl();
174 : SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 );
175 : SAL_DLLPRIVATE bool PrepareClose_Impl( bool bUI );
176 : SAL_DLLPRIVATE bool DocIsModified_Impl();
177 : SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
178 : SAL_DLLPRIVATE bool IsClosing_Impl() const;
179 : SAL_DLLPRIVATE void SetIsClosing_Impl();
180 :
181 : // Methods for accessing the current set
182 : SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
183 :
184 : SAL_DLLPRIVATE void Lock_Impl( bool bLock );
185 : SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const;
186 : SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const;
187 :
188 : SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame );
189 : SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame );
190 : SAL_DLLPRIVATE void SetOwnsBindings_Impl( bool bSet );
191 : SAL_DLLPRIVATE 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( bool );
201 :
202 : SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc );
203 : SAL_DLLPRIVATE void LockResize_Impl( bool bLock );
204 : SAL_DLLPRIVATE void SetMenuBarOn_Impl( bool bOn );
205 : SAL_DLLPRIVATE 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();
210 : };
211 :
212 0 : SV_DECL_COMPAT_WEAK( SfxFrame )
213 :
214 : class SfxFrameIterator
215 : {
216 : const SfxFrame* pFrame;
217 : bool bRecursive;
218 :
219 : SfxFrame* NextSibling_Impl( SfxFrame& rPrev );
220 :
221 : public:
222 : SfxFrameIterator( const SfxFrame& rFrame, bool bRecursive=true );
223 : SfxFrame* FirstFrame();
224 : SfxFrame* NextFrame( SfxFrame& rPrev );
225 : };
226 :
227 :
228 :
229 0 : class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
230 : {
231 : SfxFrame* pFrame;
232 : SfxFrameWeak wFrame;
233 0 : SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; }
234 :
235 : public:
236 : TYPEINFO_OVERRIDE();
237 :
238 : SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
239 : SfxFrameItem( SfxFrame *p=0 );
240 : SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
241 :
242 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
243 : virtual OUString GetValueText() const;
244 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
245 :
246 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
247 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
248 :
249 : bool FrameKilled() const { return &wFrame != pFrame; }
250 :
251 0 : SfxFrame* GetFrame() const
252 0 : { return wFrame; }
253 : };
254 :
255 0 : class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem
256 : {
257 : ::com::sun::star::uno::Any aValue;
258 : public:
259 : TYPEINFO_OVERRIDE();
260 : SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny );
261 0 : ::com::sun::star::uno::Any GetValue() const
262 0 : { return aValue; }
263 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
264 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
265 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
266 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
267 : };
268 :
269 0 : class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem
270 : {
271 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
272 : m_xFrame;
273 :
274 : public:
275 : TYPEINFO_OVERRIDE();
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 0 : GetFrame() const
280 0 : { return m_xFrame; }
281 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
282 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
283 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
284 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
285 : };
286 :
287 : typedef SfxUsrAnyItem SfxUnoAnyItem;
288 :
289 : #endif
290 :
291 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|