1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #define TF_NEWDESKTOP 1
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>
48 class XDispatchProviderInterceptor
;
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>
70 class SfxObjectFactory
;
72 class SfxFrameDescriptor
;
73 class SfxFrameSetDescriptor
;
77 class SfxUnoControllerItem
;
78 class SvCompatWeakHdl
;
82 typedef ::std::vector
<SfxFrame
*> SfxFrameArr_Impl
;
84 typedef ::std::vector
< String
* > TargetList
;
86 #define SFXFRAME_HASTITLE 0x0001
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 //==========================================================================
100 class SFX2_DLLPUBLIC SfxFrame
102 friend class SfxFrameIterator
;
103 friend class SfxFrameWindow_Impl
;
106 SfxFrame
* pParentFrame
;
107 SfxFrameArr_Impl
* pChildArr
;
115 SAL_DLLPRIVATE
void RemoveChildFrame_Impl( SfxFrame
* );
117 SfxFrame( ); // not implemented
118 SAL_DLLPRIVATE
SfxFrame( Window
& i_rContainerWindow
, bool bHidden
);
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
>
126 static SfxFrame
* Create( SfxObjectShell
& rDoc
, Window
& rWindow
, sal_uInt16 nViewId
, bool bHidden
);
128 SvCompatWeakHdl
* GetHdl();
129 Window
& GetWindow() const;
130 void CancelTransfers( sal_Bool bCancelLoadEnv
= sal_True
);
132 sal_uInt16
GetChildFrameCount() const;
133 SfxFrame
* GetChildFrame( sal_uInt16 nPos
) const;
134 SfxFrame
* GetParentFrame() const
135 { return pParentFrame
; }
137 void SetPresentationMode( sal_Bool bSet
);
138 SystemWindow
* GetSystemWindow() const;
140 static SfxFrame
* GetFirst();
141 static SfxFrame
* GetNext( SfxFrame
& );
143 static const SfxPoolItem
*
144 OpenDocumentSynchron( SfxItemSet
& aSet
, const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& i_rTargetFrame
);
146 SfxObjectShell
* GetCurrentDocument() const;
147 SfxViewFrame
* GetCurrentViewFrame() const;
148 SfxFrame
& GetTopFrame() const;
149 sal_Bool
IsParent( SfxFrame
* ) const;
151 sal_uInt32
GetFrameType() const;
152 void GetTargetList( TargetList
& ) const;
153 SAL_DLLPRIVATE SfxFrame
* GetContainingDocFrame_Impl( SfxFrame
* pSelf
);
154 void UpdateDescriptor( SfxObjectShell
*pDoc
);
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;
163 void AppearWithUpdate();
164 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController
>
165 GetController() const;
167 sal_Bool
IsInPlace() const;
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();
180 // Methods for accessing the current set
181 SAL_DLLPRIVATE SfxFrameDescriptor
* GetDescriptor() const;
183 SAL_DLLPRIVATE
void Lock_Impl( sal_Bool bLock
);
184 SAL_DLLPRIVATE SfxDispatcher
* GetDispatcher_Impl() const;
185 SAL_DLLPRIVATE sal_Bool
IsAutoLoadLocked_Impl() const;
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
);
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;
208 SAL_DLLPRIVATE
void Construct_Impl();
211 SV_DECL_COMPAT_WEAK( SfxFrame
)
213 class SfxFrameIterator
215 const SfxFrame
* pFrame
;
218 SfxFrame
* NextSibling_Impl( SfxFrame
& rPrev
);
221 SfxFrameIterator( const SfxFrame
& rFrame
, sal_Bool bRecursive
=sal_True
);
222 SfxFrame
* FirstFrame();
223 SfxFrame
* NextFrame( SfxFrame
& rPrev
);
226 //--------------------------------------------------------------------
228 class SFX2_DLLPUBLIC SfxFrameItem
: public SfxPoolItem
232 SAL_DLLPRIVATE
void SetFramePtr_Impl( SfxFrame
* /*pFrameP*/ ) { pFrame
= wFrame
; }
237 SfxFrameItem( sal_uInt16 nWhich
, SfxViewFrame
*p
);
238 SfxFrameItem( SfxFrame
*p
=0 );
239 SfxFrameItem( sal_uInt16 nWhich
, SfxFrame
*p
);
241 virtual int operator==( const SfxPoolItem
& ) const;
242 virtual String
GetValueText() const;
243 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
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 );
248 sal_Bool
FrameKilled() const { return &wFrame
!= pFrame
; }
250 SfxFrame
* GetFrame() const
254 class SFX2_DLLPUBLIC SfxUsrAnyItem
: public SfxPoolItem
256 ::com::sun::star::uno::Any aValue
;
259 SfxUsrAnyItem( sal_uInt16 nWhich
, const ::com::sun::star::uno::Any
& rAny
);
260 ::com::sun::star::uno::Any
GetValue() const
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 );
268 class SFX2_DLLPUBLIC SfxUnoFrameItem
: public SfxPoolItem
270 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>
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
>&
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 );
286 typedef SfxUsrAnyItem SfxUnoAnyItem
;
290 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */