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 : #include <vcl/vclptr.hxx>
33 :
34 : namespace com
35 : {
36 : namespace sun
37 : {
38 : namespace star
39 : {
40 : namespace awt
41 : {
42 : class XWindow;
43 : }
44 : namespace frame
45 : {
46 : class XFrame;
47 : class XFrameLoader;
48 : class XController;
49 : class XDispatchProviderInterceptor;
50 : }
51 : namespace beans
52 : {
53 : struct PropertyValue;
54 : }
55 : }
56 : }
57 : }
58 :
59 : #include <comphelper/namedvaluecollection.hxx>
60 : #include <rtl/ustring.hxx>
61 : #include <svl/poolitem.hxx>
62 : #include <tools/ref.hxx>
63 : #include <vector>
64 :
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;
81 :
82 : typedef ::std::vector<OUString> TargetList;
83 :
84 : #define SFXFRAME_HASTITLE 0x0001
85 :
86 :
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.
96 :
97 :
98 : class SFX2_DLLPUBLIC SfxFrame : public SvCompatWeakBase<SfxFrame>
99 : {
100 : friend class SfxFrameIterator;
101 : friend class SfxFrameWindow_Impl;
102 :
103 : private:
104 : SfxFrame* pParentFrame;
105 : SfxFrameArr_Impl* pChildArr;
106 : SfxFrame_Impl* pImp;
107 : VclPtr<vcl::Window> pWindow;
108 :
109 : protected:
110 : bool Close();
111 : virtual ~SfxFrame();
112 :
113 : SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* );
114 :
115 : SfxFrame( ); // not implemented
116 : SAL_DLLPRIVATE SfxFrame( vcl::Window& i_rContainerWindow, bool bHidden );
117 :
118 : public:
119 : TYPEINFO();
120 :
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 );
125 :
126 104498 : 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 58304 : SfxFrame* GetParentFrame() const
132 58304 : { return pParentFrame; }
133 :
134 : void SetPresentationMode( bool bSet );
135 : SystemWindow* GetSystemWindow() const;
136 :
137 : static SfxFrame* GetFirst();
138 : static SfxFrame* GetNext( SfxFrame& );
139 :
140 : static const SfxPoolItem*
141 : OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame );
142 :
143 : SfxObjectShell* GetCurrentDocument() const;
144 : SfxViewFrame* GetCurrentViewFrame() const;
145 : SfxFrame& GetTopFrame() const;
146 : bool IsParent( SfxFrame* ) const;
147 :
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;
163 :
164 : bool IsInPlace() const;
165 :
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();
176 :
177 : // Methods for accessing the current set
178 : SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
179 :
180 : SAL_DLLPRIVATE void Lock_Impl( bool bLock );
181 : SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const;
182 : SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const;
183 :
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 );
197 :
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();
206 : };
207 :
208 : typedef SvCompatWeakRef<SfxFrame> SfxFrameWeakRef;
209 :
210 : class SfxFrameIterator
211 : {
212 : const SfxFrame* pFrame;
213 : bool bRecursive;
214 :
215 : SfxFrame* NextSibling_Impl( SfxFrame& rPrev );
216 :
217 : public:
218 : SfxFrameIterator( const SfxFrame& rFrame, bool bRecursive=true );
219 : SfxFrame* FirstFrame();
220 : SfxFrame* NextFrame( SfxFrame& rPrev );
221 : };
222 :
223 :
224 :
225 0 : class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
226 : {
227 : SfxFrame* pFrame;
228 : SfxFrameWeakRef wFrame;
229 0 : SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; }
230 :
231 : public:
232 : TYPEINFO_OVERRIDE();
233 :
234 : SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
235 : SfxFrameItem( SfxFrame *p=0 );
236 : SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
237 :
238 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
239 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
240 :
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;
243 :
244 : bool FrameKilled() const { return &wFrame != pFrame; }
245 :
246 0 : SfxFrame* GetFrame() const
247 0 : { return wFrame; }
248 : };
249 :
250 100061 : class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem
251 : {
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 68423 : ::com::sun::star::uno::Any GetValue() const
257 68423 : { 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;
262 : };
263 :
264 302 : class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem
265 : {
266 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
267 : m_xFrame;
268 :
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 0 : GetFrame() const
275 0 : { 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;
280 : };
281 :
282 : typedef SfxUsrAnyItem SfxUnoAnyItem;
283 :
284 : #endif
285 :
286 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|