LCOV - code coverage report
Current view: top level - sfx2/inc/sfx2 - viewfrm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 13 25 52.0 %
Date: 2012-08-25 Functions: 8 19 42.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2 0.0 %

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

Generated by: LCOV version 1.10