LCOV - code coverage report
Current view: top level - libreoffice/sfx2/inc/sfx2 - viewfrm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 25 36.0 %
Date: 2012-12-17 Functions: 6 19 31.6 %
Legend: Lines: hit not hit

          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 _SFXVIEWFRM_HXX
      20             : #define _SFXVIEWFRM_HXX
      21             : 
      22             : #include "sal/config.h"
      23             : #include "sfx2/dllapi.h"
      24             : #include "sal/types.h"
      25             : #include <svl/lstner.hxx>
      26             : #include <sfx2/module.hxx>
      27             : #include <sfx2/frame.hxx>
      28             : #include <sfx2/shell.hxx>
      29             : #include <sfx2/sfxsids.hrc>
      30             : #include <svl/poolitem.hxx>
      31             : #include <vcl/button.hxx>
      32             : #include <com/sun/star/frame/status/Verb.hpp>
      33             : #include <com/sun/star/frame/XModel.hpp>
      34             : #include <com/sun/star/frame/XController2.hpp>
      35             : 
      36             : #include <tools/svborder.hxx>
      37             : 
      38             : class SvBorder;
      39             : class SfxDispatcher;
      40             : class SfxObjectShell;
      41             : class SfxBindings;
      42             : class SfxProgress;
      43             : class SvData;
      44             : class SfxViewShell;
      45             : class SystemWindow;
      46             : class Fraction;
      47             : class Point;
      48             : class Size;
      49             : class SfxChildWindow;
      50             : 
      51             : namespace sfx2
      52             : {
      53             : class SvLinkSource;
      54             : }
      55             : namespace svtools
      56             : {
      57             :     class AsynchronLink;
      58             : }
      59             : 
      60             : #ifndef SFX_DECL_OBJECTSHELL_DEFINED
      61             : #define SFX_DECL_OBJECTSHELL_DEFINED
      62           0 : SV_DECL_REF(SfxObjectShell)
      63             : #endif
      64             : 
      65             : //========================================================================
      66             : DBG_NAMEEX(SfxViewFrame)
      67             : class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener
      68             : {
      69             :     struct SfxViewFrame_Impl*   pImp;
      70             : 
      71             :     SfxObjectShellRef           xObjSh;
      72             :     SfxDispatcher*              pDispatcher;
      73             :     SfxBindings*                pBindings;
      74             :     sal_uInt16                      nAdjustPosPixelLock;
      75             : 
      76             : private:
      77             : #ifndef _SFX_HXX
      78             :     SAL_DLLPRIVATE void Construct_Impl( SfxObjectShell *pObjSh=NULL );
      79             : #endif
      80             : 
      81             : protected:
      82             :     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
      83             : 
      84             : #ifndef _SFX_HXX
      85             :     SAL_DLLPRIVATE void KillDispatcher_Impl();
      86             : #endif
      87             : 
      88             :     virtual                 ~SfxViewFrame();
      89             : 
      90             : public:
      91             :                             SfxViewFrame( SfxFrame& rFrame, SfxObjectShell *pDoc = NULL );
      92             : 
      93             :                             TYPEINFO();
      94          72 :                             SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM)
      95             : 
      96             :     static void             SetViewFrame( SfxViewFrame* );
      97             : 
      98             :     static SfxViewFrame*    LoadHiddenDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId );
      99             :     static SfxViewFrame*    LoadDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId );
     100             :     static SfxViewFrame*    LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const sal_uInt16 i_nViewId = 0 );
     101             :     static SfxViewFrame*    LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrameItem, const sal_uInt16 i_nViewId = 0 );
     102             :     static SfxViewFrame*    DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const sal_uInt16 i_nViewId = 0 );
     103             : 
     104             :     static SfxViewFrame*    Current();
     105             :     static SfxViewFrame*    GetFirst( const SfxObjectShell* pDoc = 0, sal_Bool bOnlyVisible = sal_True );
     106             :     static SfxViewFrame*    GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = 0, sal_Bool bOnlyVisible = sal_True );
     107             : 
     108             :     static SfxViewFrame*    Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController, const SfxObjectShell* i_pDoc = NULL );
     109             : 
     110             :             void            DoActivate(sal_Bool bMDI, SfxViewFrame *pOld=NULL);
     111             :             void            DoDeactivate(sal_Bool bMDI, SfxViewFrame *pOld=NULL);
     112             : 
     113             :     SfxViewFrame*           GetParentViewFrame() const;
     114             : 
     115             :     using SfxShell::GetDispatcher;
     116        6806 :         SfxDispatcher*          GetDispatcher() { return pDispatcher; }
     117       35182 :     SfxBindings&            GetBindings() { return *pBindings; }
     118             :     const SfxBindings&      GetBindings() const  { return *pBindings; }
     119             :     Window&                 GetWindow() const;
     120             :     virtual void            SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
     121             : 
     122             :     SfxProgress*            GetProgress() const;
     123             : 
     124        2396 :     SfxObjectShell*         GetObjectShell() const
     125        2396 :                             { return xObjSh; }
     126             : 
     127           0 :     void                    LockAdjustPosSizePixel()
     128           0 :                             { nAdjustPosPixelLock++; }
     129           0 :     void                    UnlockAdjustPosSizePixel()
     130           0 :                             { nAdjustPosPixelLock--; }
     131             :     void                    DoAdjustPosSizePixel( SfxViewShell * pSh,
     132             :                                         const Point &rPos, const Size &rSize );
     133             :     void                    Show();
     134             :     sal_Bool                    IsVisible() const;
     135             :     void                    ToTop();
     136             :     void                    Enable( sal_Bool bEnable );
     137             :     virtual sal_Bool            Close();
     138             :     virtual void            Activate( sal_Bool bUI );
     139             :     virtual void            Deactivate( sal_Bool bUI );
     140             : 
     141             :     // DDE-Interface
     142             :     virtual long            DdeExecute( const String& rCmd );
     143             :     virtual long            DdeGetData( const String& rItem,
     144             :                                         const String& rMimeType,
     145             :                                         ::com::sun::star::uno::Any & rValue );
     146             :     virtual long            DdeSetData( const String& rItem,
     147             :                                         const String& rMimeType,
     148             :                                 const ::com::sun::star::uno::Any & rValue );
     149             :     virtual ::sfx2::SvLinkSource*   DdeCreateLinkSource( const String& rItem );
     150             : 
     151             :     void                    UpdateTitle();
     152             : 
     153             :     static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL );
     154             : 
     155             :     // interne Handler
     156             :     SAL_DLLPRIVATE virtual sal_Bool SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder );
     157             :     SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const;
     158             :     SAL_DLLPRIVATE virtual void InvalidateBorderImpl( const SfxViewShell *pSh );
     159             : 
     160             :     virtual SfxObjectShell* GetObjectShell();
     161             :     sal_uInt16                  GetCurViewId() const;
     162             :     SfxFrame&               GetFrame() const;
     163             :     SfxViewFrame*           GetTopViewFrame() const;
     164             : 
     165             :     sal_Bool                    DoClose();
     166         614 :     sal_uIntPtr                 GetFrameType() const
     167         614 :                             { return GetFrame().GetFrameType(); }
     168        1324 :     SfxFrame&               GetTopFrame() const
     169        1324 :                             { return GetFrame().GetTopFrame(); }
     170           0 :     void                    GetTargetList( TargetList& rList ) const
     171           0 :                             { GetFrame().GetTargetList( rList ); }
     172             :     void                    CancelTransfers()
     173             :                             { GetFrame().CancelTransfers(); }
     174             : 
     175             :     void                    SetModalMode( sal_Bool );
     176             :     sal_Bool                    IsInModalMode() const;
     177             :     void                    Resize(sal_Bool bForce=sal_False);
     178             : 
     179             :     void                        SetChildWindow(sal_uInt16 nId, sal_Bool bVisible, sal_Bool bSetFocus=sal_True);
     180             :     void                        ToggleChildWindow(sal_uInt16);
     181             :     sal_Bool                        HasChildWindow(sal_uInt16);
     182             :     sal_Bool                        KnowsChildWindow(sal_uInt16);
     183             :     void                        ShowChildWindow(sal_uInt16,sal_Bool bVisible=sal_True);
     184             :     SfxChildWindow*             GetChildWindow(sal_uInt16);
     185             :     void                        ChildWindowExecute(SfxRequest&);
     186             :     void                        ChildWindowState(SfxItemSet&);
     187             : 
     188             :     /** Append a new InfoBar (see https://wiki.documentfoundation.org/Design/Whiteboards/Infobar).
     189             : 
     190             :         The buttons will be added from Right to Left at the right of the info bar. The parent, size
     191             :         and position of each button will be changed: only the width will remain unchanged.
     192             :       */
     193             :     void                    AppendInfoBar( const rtl::OUString& sId, const rtl::OUString& sMessage, std::vector< PushButton* > aButtons );
     194             :     void                    RemoveInfoBar( const rtl::OUString& sId );
     195             : 
     196             :     SAL_DLLPRIVATE void SetDowning_Impl();
     197             :     SAL_DLLPRIVATE void GetDocNumber_Impl();
     198             :     SAL_DLLPRIVATE sal_Bool IsDowning_Impl() const;
     199             :     SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh );
     200             :     SAL_DLLPRIVATE void ReleaseObjectShell_Impl();
     201             : 
     202             :     SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet );
     203             :     SAL_DLLPRIVATE void ExecReload_Impl( SfxRequest &rReq );
     204             :     SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet );
     205             :     SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq );
     206             :     SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet );
     207             :     SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq );
     208             :     SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet );
     209             :     SAL_DLLPRIVATE SfxViewFrame* GetParentViewFrame_Impl() const;
     210             :     SAL_DLLPRIVATE void ForceOuterResize_Impl(sal_Bool bOn=sal_True);
     211             :     SAL_DLLPRIVATE sal_Bool IsResizeInToOut_Impl() const;
     212             :     SAL_DLLPRIVATE sal_Bool IsAdjustPosSizePixelLocked_Impl() const
     213             :                             { return nAdjustPosPixelLock != 0; }
     214             :     SAL_DLLPRIVATE void UpdateDocument_Impl();
     215             : 
     216             :     SAL_DLLPRIVATE void LockObjectShell_Impl(sal_Bool bLock=sal_True);
     217             : 
     218             :     SAL_DLLPRIVATE void MakeActive_Impl( sal_Bool bActivate );
     219             :     SAL_DLLPRIVATE void SetQuietMode_Impl( sal_Bool );
     220             :     SAL_DLLPRIVATE const Size& GetMargin_Impl() const;
     221             :     SAL_DLLPRIVATE void SetActiveChildFrame_Impl( SfxViewFrame* );
     222             :     SAL_DLLPRIVATE SfxViewFrame* GetActiveChildFrame_Impl() const;
     223             :     SAL_DLLPRIVATE String GetActualPresentationURL_Impl() const;
     224             :     SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
     225             :     SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
     226             :     SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( sal_uInt16 nId );
     227             :     SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const ::rtl::OUString& sMacro);
     228             : 
     229             :     SAL_DLLPRIVATE void Exec_Impl(SfxRequest &);
     230             :     SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
     231             :     SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
     232             : 
     233             :     SAL_DLLPRIVATE void SetCurViewId_Impl( const sal_uInt16 i_nID );
     234             :     SAL_DLLPRIVATE void ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL );
     235             : 
     236             : private:
     237             :     SAL_DLLPRIVATE sal_Bool SwitchToViewShell_Impl( sal_uInt16 nNo, sal_Bool bIsIndex = sal_False );
     238             :     SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
     239             :     SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId );
     240             : 
     241             :     /** loads the given existing document into the given frame
     242             : 
     243             :         This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
     244             : 
     245             :         @param i_rDoc
     246             :             the document to load
     247             :         @param i_rFrame
     248             :             the frame to load the document into
     249             :         @param i_rLoadArgs
     250             :             the arguments to pass to the component loader. If this sequence is empty, then the current arguments of the
     251             :             model will be obtained, and passed to the loader. This ensures that any arguments in the model will be preserved,
     252             :             instead of being reset.
     253             :         @param i_nViewId
     254             :             the ID of the view to create
     255             :         @throws Exception
     256             :             if something goes wrong. The caller is responsible for handling this.
     257             :     */
     258             :     SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl(
     259             :                             const SfxObjectShell& i_rDoc,
     260             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
     261             :                             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs,
     262             :                             const sal_uInt16 i_nViewId,
     263             :                             const bool i_bHidden
     264             :                         );
     265             : 
     266             :     /** loads the given existing document into the given frame
     267             : 
     268             :         This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
     269             : 
     270             :         If no frame is given, a blank top level frame is created.
     271             : 
     272             :         If anything fails during the process, as much as possible is cleaned up.
     273             : 
     274             :         @param i_rDoc
     275             :             the document to load
     276             :         @param i_rFrame
     277             :             the frame to load the document into. Might be <NULL/>, in which case a new frame is created.
     278             :         @param i_nViewId
     279             :             the ID of the view to create
     280             :     */
     281             :     SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow(
     282             :                             const SfxObjectShell& i_rDoc,
     283             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
     284             :                             const sal_uInt16 i_nViewId,
     285             :                             const bool i_bHidden
     286             :                         );
     287             : };
     288             : 
     289             : //--------------------------------------------------------------------
     290             : 
     291           0 : class SFX2_DLLPUBLIC SfxViewFrameItem: public SfxPoolItem
     292             : {
     293             :     SfxViewFrame*           pFrame;
     294             : 
     295             : public:
     296             :                             TYPEINFO();
     297           0 :                             SfxViewFrameItem( SfxViewFrame *pViewFrame ):
     298             :                                 SfxPoolItem( 0 ),
     299           0 :                                 pFrame( pViewFrame)
     300           0 :                             {}
     301           0 :                             SfxViewFrameItem( sal_uInt16 nWhichId, SfxViewFrame *pViewFrame ):
     302             :                                 SfxPoolItem( nWhichId ),
     303           0 :                                 pFrame( pViewFrame)
     304           0 :                             {}
     305             : 
     306             :     virtual int             operator==( const SfxPoolItem& ) const;
     307             :     virtual String          GetValueText() const;
     308             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     309             : 
     310           0 :     SfxViewFrame*           GetFrame() const
     311           0 :                             { return pFrame; }
     312             : };
     313             : 
     314             : class SfxVerbListItem : public SfxPoolItem
     315             : {
     316             :     com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > aVerbs;
     317             : 
     318             : public:
     319             :                             TYPEINFO();
     320             :                             SfxVerbListItem( sal_uInt16 nWhichId = SID_OBJECT ) :
     321             :                                 SfxPoolItem( nWhichId )
     322             :                             {}
     323             : 
     324             :                             SfxVerbListItem( sal_uInt16 nWhichId, const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& );
     325             : 
     326             :     virtual int             operator==( const SfxPoolItem& ) const;
     327             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     328             : 
     329             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
     330             :     const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbList() const { return aVerbs; }
     331             : };
     332             : 
     333             : #endif
     334             : 
     335             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10