/src/libreoffice/include/sfx2/frame.hxx
Line | Count | Source |
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 | | #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> |
32 | | #include <memory> |
33 | | #include <vector> |
34 | | |
35 | | |
36 | | namespace com::sun::star::frame |
37 | | { |
38 | | class XFrame; |
39 | | class XController; |
40 | | } |
41 | | |
42 | | class SvBorder; |
43 | | class SfxWorkWindow; |
44 | | namespace vcl { class Window; } |
45 | | class SfxFrame_Impl; |
46 | | class SfxObjectShell; |
47 | | class SfxViewFrame; |
48 | | class SfxFrameDescriptor; |
49 | | namespace tools { class Rectangle; } |
50 | | class SystemWindow; |
51 | | |
52 | | typedef ::std::vector<OUString> TargetList; |
53 | | |
54 | | |
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. |
64 | | |
65 | | |
66 | | class SFX2_DLLPUBLIC SfxFrame final : public SvCompatWeakBase<SfxFrame> |
67 | | { |
68 | | friend class SfxFrameIterator; |
69 | | friend class SfxFrameWindow_Impl; |
70 | | |
71 | | private: |
72 | | std::unique_ptr< SfxFrame_Impl > m_pImpl; |
73 | | VclPtr<vcl::Window> m_pWindow; |
74 | | |
75 | | ~SfxFrame(); |
76 | | |
77 | | SAL_DLLPRIVATE SfxFrame( vcl::Window& i_rContainerWindow ); |
78 | | |
79 | | public: |
80 | | static SfxFrame* Create( const css::uno::Reference< css::frame::XFrame >& xFrame ); |
81 | | static css::uno::Reference< css::frame::XFrame > |
82 | | CreateBlankFrame(); |
83 | | static SfxFrame* CreateHidden( SfxObjectShell const & rDoc, vcl::Window& rWindow, SfxInterfaceId nViewId ); |
84 | | |
85 | 48.9k | vcl::Window& GetWindow() const { return *m_pWindow;} |
86 | | void CancelTransfers(); |
87 | | bool DoClose(); |
88 | | |
89 | | void SetPresentationMode( bool bSet ); |
90 | | SystemWindow* GetSystemWindow() const; |
91 | | |
92 | | SAL_WARN_UNUSED_RESULT static SfxFrame* GetFirst(); |
93 | | SAL_WARN_UNUSED_RESULT static SfxFrame* GetNext( SfxFrame& ); |
94 | | |
95 | | SAL_WARN_UNUSED_RESULT SfxObjectShell* GetCurrentDocument() const; |
96 | | SAL_WARN_UNUSED_RESULT SfxViewFrame* GetCurrentViewFrame() const; |
97 | | |
98 | | bool GetHasTitle() const; |
99 | | static void GetDefaultTargetList( TargetList& ); |
100 | | void UpdateDescriptor( SfxObjectShell const *pDoc ); |
101 | | void Resize(); |
102 | | const css::uno::Reference< css::frame::XFrame >& |
103 | | GetFrameInterface() const; |
104 | | void Appear(); |
105 | | void AppearWithUpdate(); |
106 | | css::uno::Reference< css::frame::XController > |
107 | | GetController() const; |
108 | | |
109 | | bool IsInPlace() const; |
110 | | |
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(); |
121 | | |
122 | | // Methods for accessing the current set |
123 | | SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const; |
124 | | |
125 | | SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const; |
126 | | |
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(); |
136 | | |
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; |
143 | | private: |
144 | | SAL_DLLPRIVATE void Construct_Impl(); |
145 | | }; |
146 | | |
147 | | typedef SvCompatWeakRef<SfxFrame> SfxFrameWeakRef; |
148 | | |
149 | | class SFX2_DLLPUBLIC SfxFrameItem final : public SfxPoolItem |
150 | | { |
151 | | SfxFrame* pFrame; |
152 | | SfxFrameWeakRef wFrame; |
153 | | |
154 | | public: |
155 | | DECLARE_ITEM_TYPE_FUNCTION(SfxFrameItem) |
156 | | SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame const *p ); |
157 | | SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p ); |
158 | | |
159 | | virtual bool operator==( const SfxPoolItem& ) const override; |
160 | | virtual SfxFrameItem* Clone( SfxItemPool *pPool = nullptr ) const override; |
161 | | |
162 | | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
163 | | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
164 | | |
165 | 0 | SfxFrame* GetFrame() const { return wFrame; } |
166 | | }; |
167 | | |
168 | | class SFX2_DLLPUBLIC SfxUnoAnyItem final : public SfxPoolItem |
169 | | { |
170 | | css::uno::Any aValue; |
171 | | public: |
172 | | static SfxPoolItem* CreateDefault(); |
173 | | DECLARE_ITEM_TYPE_FUNCTION(SfxUnoAnyItem) |
174 | | SfxUnoAnyItem( sal_uInt16 nWhich, const css::uno::Any& rAny ); |
175 | | const css::uno::Any& GetValue() const |
176 | 32.5k | { return aValue; } |
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; |
181 | | }; |
182 | | |
183 | | class SFX2_DLLPUBLIC SfxUnoFrameItem final : public SfxPoolItem |
184 | | { |
185 | | css::uno::Reference< css::frame::XFrame > |
186 | | m_xFrame; |
187 | | |
188 | | public: |
189 | | static SfxPoolItem* CreateDefault(); |
190 | | DECLARE_ITEM_TYPE_FUNCTION(SfxUnoFrameItem) |
191 | | SfxUnoFrameItem(); |
192 | | SfxUnoFrameItem( sal_uInt16 nWhich, css::uno::Reference< css::frame::XFrame > i_xFrame ); |
193 | | const css::uno::Reference< css::frame::XFrame >& |
194 | | GetFrame() const |
195 | 0 | { return m_xFrame; } |
196 | | virtual bool operator==( const SfxPoolItem& ) const override; |
197 | | virtual SfxUnoFrameItem* Clone( SfxItemPool *pPool = nullptr ) const override; |
198 | | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
199 | | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
200 | | }; |
201 | | |
202 | | #endif |
203 | | |
204 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |