1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SFXFRAME_HXX 24 #define _SFXFRAME_HXX 25 26 #ifndef TF_NEWDESKTOP 27 #define TF_NEWDESKTOP 1 28 #endif 29 30 #include "sal/config.h" 31 #include "sfx2/dllapi.h" 32 #include "sal/types.h" 33 #include <com/sun/star/uno/Reference.h> 34 #include <com/sun/star/uno/Any.hxx> 35 #include <com/sun/star/uno/Sequence.hxx> 36 37 namespace com 38 { 39 namespace sun 40 { 41 namespace star 42 { 43 namespace awt 44 { 45 class XWindow; 46 } 47 namespace frame 48 { 49 class XFrame; 50 class XFrameLoader; 51 class XController; 52 class XDispatchProviderInterceptor; 53 } 54 namespace beans 55 { 56 struct PropertyValue; 57 } 58 } 59 } 60 } 61 #include <tools/link.hxx> 62 #include <tools/ref.hxx> 63 #include <tools/string.hxx> 64 #include <svl/brdcst.hxx> 65 #include <tools/list.hxx> 66 #include <svl/poolitem.hxx> 67 #include <comphelper/namedvaluecollection.hxx> 68 69 class SvBorder; 70 class SfxWorkWindow; 71 class Window; 72 class SfxFrame; 73 class SfxFrame_Impl; 74 class SfxObjectShell; 75 class SfxObjectFactory; 76 class SfxViewFrame; 77 class SfxFrameDescriptor; 78 class SfxFrameSetDescriptor; 79 class SfxMedium; 80 class SfxFrameHistory_Impl; 81 class SfxDispatcher; 82 class SfxMedium; 83 class Rectangle; 84 class SfxRequest; 85 class SfxUnoControllerItem; 86 class SvCompatWeakHdl; 87 class SystemWindow; 88 89 typedef SfxFrame* SfxFramePtr; 90 class SfxFrameArr_Impl; 91 92 DECLARE_LIST( TargetList, String* ) 93 94 #define SFXFRAME_HASTITLE 0x0001 95 96 //========================================================================== 97 // Ein SfxFrame ist eine Verwaltungsklasse f"ur Fenster und deren Inhalte. 98 // Eine SfxApplication pr"asentiert sich als Hierarchie von SfxFrames, wobei 99 // die konkreten Inhalte in den abgeleiteten Klassen festgelegt werden. 100 // Die Basisklasse SfxFrame implementiert 2 Aspekte der Frames: Benennung und 101 // Kontrolle der Lebensdauer. 102 // Innerhalb einer Frames-Hierarchie kontrolliert immer der ParentFrame die 103 // Lebensdauer seiner ChildFrames, auch wenn sie in der Regel gar nicht von 104 // ihm selbst erzeugt wurden. Durch Aufruf vonn DoClose() an irgendeinem 105 // Frame in der Hierarchie kann ein Teil des "Frameworks" entfernt werden, 106 // wobei sich Frames an ihren ParentFrames selbst abmelden. 107 //========================================================================== 108 109 class SfxFrameArr_Impl; 110 struct SfxFramePickEntry_Impl; 111 class SFX2_DLLPUBLIC SfxFrame 112 { 113 friend class SfxFrameIterator; 114 friend class SfxFrameWindow_Impl; 115 116 private: 117 SfxFrame* pParentFrame; 118 SfxFrameArr_Impl* pChildArr; 119 SfxFrame_Impl* pImp; 120 Window* pWindow; 121 122 protected: 123 sal_Bool Close(); 124 virtual ~SfxFrame(); 125 126 SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* ); 127 128 SfxFrame( ); // not implemented 129 SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden ); 130 131 public: 132 TYPEINFO(); 133 134 static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); 135 static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 136 CreateBlankFrame(); 137 static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nViewId, bool bHidden ); 138 139 SvCompatWeakHdl* GetHdl(); 140 Window& GetWindow() const; 141 void CancelTransfers( sal_Bool bCancelLoadEnv = sal_True ); 142 sal_Bool DoClose(); 143 sal_uInt16 GetChildFrameCount() const; 144 SfxFrame* GetChildFrame( sal_uInt16 nPos ) const; GetParentFrame() const145 SfxFrame* GetParentFrame() const 146 { return pParentFrame; } 147 148 void SetPresentationMode( sal_Bool bSet ); 149 SystemWindow* GetSystemWindow() const; 150 151 static SfxFrame* GetFirst(); 152 static SfxFrame* GetNext( SfxFrame& ); 153 154 static const SfxPoolItem* 155 OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame ); 156 157 SfxBroadcaster& GetBroadcaster() const; 158 SfxObjectShell* GetCurrentDocument() const; 159 SfxViewFrame* GetCurrentViewFrame() const; 160 SfxFrame& GetTopFrame() const; 161 sal_Bool IsParent( SfxFrame* ) const; 162 163 sal_uInt32 GetFrameType() const; 164 void GetTargetList( TargetList& ) const; 165 SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf ); 166 sal_Bool IsTop() const; 167 void UpdateDescriptor( SfxObjectShell *pDoc ); 168 void Resize(); 169 sal_Bool HasComponent() const; 170 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > 171 GetComponent() const; 172 void ReleaseComponent(); 173 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 174 GetFrameInterface() const; 175 void Appear(); 176 void AppearWithUpdate(); 177 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > 178 GetController() const; 179 180 sal_Bool IsInPlace() const; 181 182 //#if 0 // _SOLAR__PRIVATE 183 SAL_DLLPRIVATE sal_Bool DoClose_Impl(); 184 SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); 185 SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet ); 186 SAL_DLLPRIVATE void GetViewData_Impl(); 187 SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 ); 188 SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False ); 189 SAL_DLLPRIVATE sal_Bool DocIsModified_Impl(); 190 SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* ); 191 SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const; 192 SAL_DLLPRIVATE void SetIsClosing_Impl(); 193 194 // Methoden f"ur den Zugriff auf das aktuelle Set 195 SAL_DLLPRIVATE void SetDescriptor( SfxFrameDescriptor* ); 196 SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const; 197 198 SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock ); 199 SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const; 200 SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const; 201 202 SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame ); 203 SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame ); 204 SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet ); 205 SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const; 206 SAL_DLLPRIVATE void InvalidateUnoControllers_Impl(); 207 SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* ); 208 SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* ); 209 SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const; 210 SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& ); 211 SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const; 212 SAL_DLLPRIVATE void CreateWorkWindow_Impl(); 213 SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* pWorkwin ); 214 SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); 215 SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); 216 217 SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc ); 218 SAL_DLLPRIVATE void LockResize_Impl( sal_Bool bLock ); 219 SAL_DLLPRIVATE void SetMenuBarOn_Impl( sal_Bool bOn ); 220 SAL_DLLPRIVATE sal_Bool IsMenuBarOn_Impl() const; 221 SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; 222 SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; 223 SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const; 224 //#endif 225 private: 226 SAL_DLLPRIVATE void Construct_Impl(); 227 }; 228 229 SV_DECL_COMPAT_WEAK( SfxFrame ) 230 231 class SfxFrameIterator 232 { 233 const SfxFrame* pFrame; 234 sal_Bool bRecursive; 235 236 //#if 0 // _SOLAR__PRIVATE 237 SfxFrame* NextSibling_Impl( SfxFrame& rPrev ); 238 //#endif 239 240 public: 241 SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecursive=sal_True ); 242 SfxFrame* FirstFrame(); 243 SfxFrame* NextFrame( SfxFrame& rPrev ); 244 }; 245 246 //-------------------------------------------------------------------- 247 248 class SfxFrameItem_Impl; 249 class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem 250 { 251 SfxFrame* pFrame; 252 SfxFrameWeak wFrame; SetFramePtr_Impl(SfxFrame *)253 SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; } 254 255 public: 256 TYPEINFO(); 257 258 SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p ); 259 SfxFrameItem( SfxFrame *p=0 ); 260 SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p ); 261 262 virtual int operator==( const SfxPoolItem& ) const; 263 virtual String GetValueText() const; 264 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 265 266 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 267 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 268 FrameKilled() const269 sal_Bool FrameKilled() const { return &wFrame != pFrame; } 270 GetFrame() const271 SfxFrame* GetFrame() const 272 { return wFrame; } 273 }; 274 275 class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem 276 { 277 ::com::sun::star::uno::Any aValue; 278 public: 279 TYPEINFO(); 280 SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny ); GetValue() const281 ::com::sun::star::uno::Any GetValue() const 282 { return aValue; } 283 virtual int operator==( const SfxPoolItem& ) const; 284 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 285 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 286 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 287 }; 288 289 class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem 290 { 291 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 292 m_xFrame; 293 294 public: 295 TYPEINFO(); 296 SfxUnoFrameItem(); 297 SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); 298 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& GetFrame() const299 GetFrame() const 300 { return m_xFrame; } 301 virtual int operator==( const SfxPoolItem& ) const; 302 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 303 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 304 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 305 }; 306 307 typedef SfxUsrAnyItem SfxUnoAnyItem; 308 309 #endif 310