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 .
19 #ifndef INCLUDED_SFX2_FRAME_HXX
20 #define INCLUDED_SFX2_FRAME_HXX
22 #include <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <sfx2/shell.hxx>
25 #include <sal/types.h>
26 #include <com/sun/star/uno/Reference.h>
27 #include <com/sun/star/uno/Any.hxx>
28 #include <vcl/vclptr.hxx>
29 #include <rtl/ustring.hxx>
30 #include <svl/poolitem.hxx>
31 #include <tools/ref.hxx>
36 namespace com::sun::star::frame
44 namespace vcl
{ class Window
; }
48 class SfxFrameDescriptor
;
49 namespace tools
{ class Rectangle
; }
52 typedef ::std::vector
<OUString
> TargetList
;
55 // SfxFrame is a management class for windows and their content.
56 // A SfxApplication represent a hierarchy of SfxFrames, with which the actual
57 // content in the derived classes is defined. The base class SfxFrame
58 // implements two aspects of frames: naming and control of its lifespan.
59 // Inside a frame hierarchy the parent frame always controls the lifespan of
60 // its child frames, even though they usually are not even produced by the
61 // parent. By calling DoCloser() on any frame in the hierarchy,
62 // a part of the "framework" can be removed, where frames unsubscribe
63 // from their parent frames.
66 class SFX2_DLLPUBLIC SfxFrame final
: public SvCompatWeakBase
<SfxFrame
>
68 friend class SfxFrameIterator
;
69 friend class SfxFrameWindow_Impl
;
72 std::unique_ptr
< SfxFrame_Impl
> m_pImpl
;
73 VclPtr
<vcl::Window
> m_pWindow
;
77 SAL_DLLPRIVATE
SfxFrame( vcl::Window
& i_rContainerWindow
);
80 static SfxFrame
* Create( const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
81 static css::uno::Reference
< css::frame::XFrame
>
83 static SfxFrame
* CreateHidden( SfxObjectShell
const & rDoc
, vcl::Window
& rWindow
, SfxInterfaceId nViewId
);
85 vcl::Window
& GetWindow() const { return *m_pWindow
;}
86 void CancelTransfers();
89 void SetPresentationMode( bool bSet
);
90 SystemWindow
* GetSystemWindow() const;
92 SAL_WARN_UNUSED_RESULT
static SfxFrame
* GetFirst();
93 SAL_WARN_UNUSED_RESULT
static SfxFrame
* GetNext( SfxFrame
& );
95 SAL_WARN_UNUSED_RESULT SfxObjectShell
* GetCurrentDocument() const;
96 SAL_WARN_UNUSED_RESULT SfxViewFrame
* GetCurrentViewFrame() const;
98 bool GetHasTitle() const;
99 static void GetDefaultTargetList( TargetList
& );
100 void UpdateDescriptor( SfxObjectShell
const *pDoc
);
102 const css::uno::Reference
< css::frame::XFrame
>&
103 GetFrameInterface() const;
105 void AppearWithUpdate();
106 css::uno::Reference
< css::frame::XController
>
107 GetController() const;
109 bool IsInPlace() const;
111 SAL_DLLPRIVATE
void DoClose_Impl();
112 SAL_DLLPRIVATE
void SetFrameInterface_Impl( const css::uno::Reference
< css::frame::XFrame
>& rFrame
);
113 SAL_DLLPRIVATE
void ReleasingComponent_Impl();
114 SAL_DLLPRIVATE
void GetViewData_Impl();
115 SAL_DLLPRIVATE
void SetHasTitle( bool );
116 SAL_DLLPRIVATE
bool PrepareClose_Impl( bool bUI
);
117 SAL_DLLPRIVATE
bool DocIsModified_Impl();
118 SAL_DLLPRIVATE
void SetCurrentViewFrame_Impl( SfxViewFrame
* );
119 bool IsClosing_Impl() const;
120 SAL_DLLPRIVATE
void SetIsClosing_Impl();
122 // Methods for accessing the current set
123 SAL_DLLPRIVATE SfxFrameDescriptor
* GetDescriptor() const;
125 SAL_DLLPRIVATE
bool IsAutoLoadLocked_Impl() const;
127 SAL_DLLPRIVATE
static void InsertTopFrame_Impl( SfxFrame
* pFrame
);
128 SAL_DLLPRIVATE
static void RemoveTopFrame_Impl( SfxFrame
* pFrame
);
129 SAL_DLLPRIVATE
void SetOwnsBindings_Impl( bool bSet
);
130 SAL_DLLPRIVATE
bool OwnsBindings_Impl() const;
131 SAL_DLLPRIVATE SfxWorkWindow
* GetWorkWindow_Impl() const;
132 SAL_DLLPRIVATE
void SetToolSpaceBorderPixel_Impl( const SvBorder
& );
133 SAL_DLLPRIVATE
tools::Rectangle
GetTopOuterRectPixel_Impl() const;
134 SAL_DLLPRIVATE
void CreateWorkWindow_Impl();
135 SAL_DLLPRIVATE
void GrabFocusOnComponent_Impl();
137 SAL_DLLPRIVATE
void PrepareForDoc_Impl( const SfxObjectShell
& i_rDoc
);
138 SAL_DLLPRIVATE
void LockResize_Impl( bool bLock
);
139 SAL_DLLPRIVATE
void SetMenuBarOn_Impl( bool bOn
);
140 SAL_DLLPRIVATE
bool IsMenuBarOn_Impl() const;
141 SAL_DLLPRIVATE SystemWindow
* GetTopWindow_Impl() const;
142 SAL_DLLPRIVATE
bool IsMarkedHidden_Impl() const;
144 SAL_DLLPRIVATE
void Construct_Impl();
147 typedef SvCompatWeakRef
<SfxFrame
> SfxFrameWeakRef
;
149 class SFX2_DLLPUBLIC SfxFrameItem final
: public SfxPoolItem
152 SfxFrameWeakRef wFrame
;
156 SfxFrameItem( sal_uInt16 nWhich
, SfxViewFrame
const *p
);
157 SfxFrameItem( SfxFrame
*p
);
158 SfxFrameItem( sal_uInt16 nWhich
, SfxFrame
*p
);
160 virtual bool operator==( const SfxPoolItem
& ) const override
;
161 virtual SfxFrameItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
163 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
164 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
166 SfxFrame
* GetFrame() const { return wFrame
; }
169 class SFX2_DLLPUBLIC SfxUnoAnyItem final
: public SfxPoolItem
171 css::uno::Any aValue
;
173 static SfxPoolItem
* CreateDefault();
174 SfxUnoAnyItem( sal_uInt16 nWhich
, const css::uno::Any
& rAny
);
175 const css::uno::Any
& GetValue() const
177 virtual bool operator==( const SfxPoolItem
& ) const override
;
178 virtual SfxUnoAnyItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
179 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
180 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
183 class SFX2_DLLPUBLIC SfxUnoFrameItem final
: public SfxPoolItem
185 css::uno::Reference
< css::frame::XFrame
>
189 static SfxPoolItem
* CreateDefault();
191 SfxUnoFrameItem( sal_uInt16 nWhich
, css::uno::Reference
< css::frame::XFrame
> i_xFrame
);
192 const css::uno::Reference
< css::frame::XFrame
>&
195 virtual bool operator==( const SfxPoolItem
& ) const override
;
196 virtual SfxUnoFrameItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
197 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
198 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */