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