LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/sfx2 - viewfrm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 25 56.0 %
Date: 2013-07-09 Functions: 10 19 52.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       11830 : 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         133 :                             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       43872 :         SfxDispatcher*          GetDispatcher() { return pDispatcher; }
     117      307823 :     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        5507 :     SfxObjectShell*         GetObjectShell() const
     125        5507 :                             { return xObjSh; }
     126             : 
     127           8 :     void                    LockAdjustPosSizePixel()
     128           8 :                             { nAdjustPosPixelLock++; }
     129           8 :     void                    UnlockAdjustPosSizePixel()
     130           8 :                             { 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 OUString& rCmd );
     143             :     virtual long            DdeGetData( const OUString& rItem,
     144             :                                         const OUString& rMimeType,
     145             :                                         ::com::sun::star::uno::Any & rValue );
     146             :     virtual long            DdeSetData( const OUString& rItem,
     147             :                                         const OUString& rMimeType,
     148             :                                         const ::com::sun::star::uno::Any & rValue );
     149             :     virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem );
     150             : 
     151             :     void                    UpdateTitle();
     152             : 
     153             :     static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL );
     154             : 
     155             :     /// is the new sidebar enabled for the app as a whole ?
     156             :     static bool IsSidebarEnabled();
     157             : 
     158             :     // interne Handler
     159             :     SAL_DLLPRIVATE virtual sal_Bool SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder );
     160             :     SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const;
     161             :     SAL_DLLPRIVATE virtual void InvalidateBorderImpl( const SfxViewShell *pSh );
     162             : 
     163             :     virtual SfxObjectShell* GetObjectShell();
     164             :     sal_uInt16                  GetCurViewId() const;
     165             :     SfxFrame&               GetFrame() const;
     166             :     SfxViewFrame*           GetTopViewFrame() const;
     167             : 
     168             :     sal_Bool                    DoClose();
     169        2157 :     sal_uIntPtr                 GetFrameType() const
     170        2157 :                             { return GetFrame().GetFrameType(); }
     171        2770 :     SfxFrame&               GetTopFrame() const
     172        2770 :                             { return GetFrame().GetTopFrame(); }
     173           0 :     void                    GetTargetList( TargetList& rList ) const
     174           0 :                             { GetFrame().GetTargetList( rList ); }
     175             :     void                    CancelTransfers()
     176             :                             { GetFrame().CancelTransfers(); }
     177             : 
     178             :     void                    SetModalMode( sal_Bool );
     179             :     sal_Bool                    IsInModalMode() const;
     180             :     void                    Resize(sal_Bool bForce=sal_False);
     181             : 
     182             :     void                        SetChildWindow(sal_uInt16 nId, sal_Bool bVisible, sal_Bool bSetFocus=sal_True);
     183             :     void                        ToggleChildWindow(sal_uInt16);
     184             :     sal_Bool                        HasChildWindow(sal_uInt16);
     185             :     sal_Bool                        KnowsChildWindow(sal_uInt16);
     186             :     void                        ShowChildWindow(sal_uInt16,sal_Bool bVisible=sal_True);
     187             :     SfxChildWindow*             GetChildWindow(sal_uInt16);
     188             :     void                        ChildWindowExecute(SfxRequest&);
     189             :     void                        ChildWindowState(SfxItemSet&);
     190             : 
     191             :     /** Append a new InfoBar (see https://wiki.documentfoundation.org/Design/Whiteboards/Infobar).
     192             : 
     193             :         The buttons will be added from Right to Left at the right of the info bar. The parent, size
     194             :         and position of each button will be changed: only the width will remain unchanged.
     195             :       */
     196             :     void                    AppendInfoBar( const OUString& sId, const OUString& sMessage, std::vector< PushButton* > aButtons );
     197             :     void                    RemoveInfoBar( const OUString& sId );
     198             : 
     199             :     SAL_DLLPRIVATE void SetDowning_Impl();
     200             :     SAL_DLLPRIVATE void GetDocNumber_Impl();
     201             :     SAL_DLLPRIVATE sal_Bool IsDowning_Impl() const;
     202             :     SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh );
     203             :     SAL_DLLPRIVATE void ReleaseObjectShell_Impl();
     204             : 
     205             :     SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet );
     206             :     SAL_DLLPRIVATE void ExecReload_Impl( SfxRequest &rReq );
     207             :     SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet );
     208             :     SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq );
     209             :     SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet );
     210             :     SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq );
     211             :     SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet );
     212             :     SAL_DLLPRIVATE SfxViewFrame* GetParentViewFrame_Impl() const;
     213             :     SAL_DLLPRIVATE void ForceOuterResize_Impl(sal_Bool bOn=sal_True);
     214             :     SAL_DLLPRIVATE sal_Bool IsResizeInToOut_Impl() const;
     215             :     SAL_DLLPRIVATE sal_Bool IsAdjustPosSizePixelLocked_Impl() const
     216             :                             { return nAdjustPosPixelLock != 0; }
     217             :     SAL_DLLPRIVATE void UpdateDocument_Impl();
     218             : 
     219             :     SAL_DLLPRIVATE void LockObjectShell_Impl(sal_Bool bLock=sal_True);
     220             : 
     221             :     SAL_DLLPRIVATE void MakeActive_Impl( sal_Bool bActivate );
     222             :     SAL_DLLPRIVATE void SetQuietMode_Impl( sal_Bool );
     223             :     SAL_DLLPRIVATE const Size& GetMargin_Impl() const;
     224             :     SAL_DLLPRIVATE void SetActiveChildFrame_Impl( SfxViewFrame* );
     225             :     SAL_DLLPRIVATE SfxViewFrame* GetActiveChildFrame_Impl() const;
     226             :     SAL_DLLPRIVATE String GetActualPresentationURL_Impl() const;
     227             :     SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
     228             :     SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
     229             :     SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( sal_uInt16 nId );
     230             :     SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const OUString& sMacro);
     231             : 
     232             :     SAL_DLLPRIVATE void Exec_Impl(SfxRequest &);
     233             :     SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
     234             :     SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
     235             : 
     236             :     SAL_DLLPRIVATE void SetCurViewId_Impl( const sal_uInt16 i_nID );
     237             :     SAL_DLLPRIVATE void ActivateToolPanel_Impl( const OUString& i_rPanelURL );
     238             : 
     239             : private:
     240             :     SAL_DLLPRIVATE sal_Bool SwitchToViewShell_Impl( sal_uInt16 nNo, sal_Bool bIsIndex = sal_False );
     241             :     SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
     242             :     SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId );
     243             : 
     244             :     /** loads the given existing document into the given frame
     245             : 
     246             :         This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
     247             : 
     248             :         @param i_rDoc
     249             :             the document to load
     250             :         @param i_rFrame
     251             :             the frame to load the document into
     252             :         @param i_rLoadArgs
     253             :             the arguments to pass to the component loader. If this sequence is empty, then the current arguments of the
     254             :             model will be obtained, and passed to the loader. This ensures that any arguments in the model will be preserved,
     255             :             instead of being reset.
     256             :         @param i_nViewId
     257             :             the ID of the view to create
     258             :         @throws Exception
     259             :             if something goes wrong. The caller is responsible for handling this.
     260             :     */
     261             :     SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl(
     262             :                             const SfxObjectShell& i_rDoc,
     263             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
     264             :                             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs,
     265             :                             const sal_uInt16 i_nViewId,
     266             :                             const bool i_bHidden
     267             :                         );
     268             : 
     269             :     /** loads the given existing document into the given frame
     270             : 
     271             :         This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
     272             : 
     273             :         If no frame is given, a blank top level frame is created.
     274             : 
     275             :         If anything fails during the process, as much as possible is cleaned up.
     276             : 
     277             :         @param i_rDoc
     278             :             the document to load
     279             :         @param i_rFrame
     280             :             the frame to load the document into. Might be <NULL/>, in which case a new frame is created.
     281             :         @param i_nViewId
     282             :             the ID of the view to create
     283             :     */
     284             :     SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow(
     285             :                             const SfxObjectShell& i_rDoc,
     286             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
     287             :                             const sal_uInt16 i_nViewId,
     288             :                             const bool i_bHidden
     289             :                         );
     290             : };
     291             : 
     292             : //--------------------------------------------------------------------
     293             : 
     294           0 : class SFX2_DLLPUBLIC SfxViewFrameItem: public SfxPoolItem
     295             : {
     296             :     SfxViewFrame*           pFrame;
     297             : 
     298             : public:
     299             :                             TYPEINFO();
     300           0 :                             SfxViewFrameItem( SfxViewFrame *pViewFrame ):
     301             :                                 SfxPoolItem( 0 ),
     302           0 :                                 pFrame( pViewFrame)
     303           0 :                             {}
     304           0 :                             SfxViewFrameItem( sal_uInt16 nWhichId, SfxViewFrame *pViewFrame ):
     305             :                                 SfxPoolItem( nWhichId ),
     306           0 :                                 pFrame( pViewFrame)
     307           0 :                             {}
     308             : 
     309             :     virtual int             operator==( const SfxPoolItem& ) const;
     310             :     virtual OUString        GetValueText() const;
     311             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     312             : 
     313           0 :     SfxViewFrame*           GetFrame() const
     314           0 :                             { return pFrame; }
     315             : };
     316             : 
     317             : class SfxVerbListItem : public SfxPoolItem
     318             : {
     319             :     com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > aVerbs;
     320             : 
     321             : public:
     322             :                             TYPEINFO();
     323             :                             SfxVerbListItem( sal_uInt16 nWhichId = SID_OBJECT ) :
     324             :                                 SfxPoolItem( nWhichId )
     325             :                             {}
     326             : 
     327             :                             SfxVerbListItem( sal_uInt16 nWhichId, const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& );
     328             : 
     329             :     virtual int             operator==( const SfxPoolItem& ) const;
     330             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     331             : 
     332             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
     333             :     const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbList() const { return aVerbs; }
     334             : };
     335             : 
     336             : #endif
     337             : 
     338             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10