LCOV - code coverage report
Current view: top level - include/sfx2 - shell.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 10 11 90.9 %
Date: 2015-06-13 12:38:46 Functions: 5 6 83.3 %
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 INCLUDED_SFX2_SHELL_HXX
      20             : #define INCLUDED_SFX2_SHELL_HXX
      21             : 
      22             : #include <com/sun/star/embed/VerbDescriptor.hpp>
      23             : #include <rtl/ustring.hxx>
      24             : #include <sal/config.h>
      25             : #include <sal/types.h>
      26             : #include <sfx2/dllapi.h>
      27             : #include <sfx2/sfxuno.hxx>
      28             : #include <svl/SfxBroadcaster.hxx>
      29             : #include <tools/rtti.hxx>
      30             : 
      31             : class ResMgr;
      32             : namespace vcl { class Window; }
      33             : class ToolBox;
      34             : class SfxItemPool;
      35             : class SfxPoolItem;
      36             : class SfxRequest;
      37             : class SfxItemSet;
      38             : struct SfxFormalArgument;
      39             : class StatusBar;
      40             : class SfxInterface;
      41             : class SfxViewShell;
      42             : class SfxObjectShell;
      43             : class SfxSlotPool;
      44             : class SvGlobalName;
      45             : 
      46             : class SfxShellObject;
      47             : class SfxShell;
      48             : struct SfxShell_Impl;
      49             : class SfxShellObject;
      50             : class SfxDispatcher;
      51             : class SfxViewFrame;
      52             : class SfxSlot;
      53             : class SfxRepeatTarget;
      54             : class SbxVariable;
      55             : class SbxBase;
      56             : class SfxBindings;
      57             : 
      58             : namespace svl
      59             : {
      60             :     class IUndoManager;
      61             : }
      62             : 
      63             : /**
      64             :     Id for <SfxInterface>s, gives a quasi-static access to the interface
      65             :     through an array to <SfxApplication>.
      66             : */
      67             : enum SfxInterfaceId
      68             : {
      69             :     SFX_INTERFACE_NONE,
      70             :     SFX_INTERFACE_SFXAPP,
      71             :     SFX_INTERFACE_SFXDOCSH,
      72             :     SFX_INTERFACE_SFXIPFRM,
      73             :     SFX_INTERFACE_SFXVIEWSH,
      74             :     SFX_INTERFACE_SFXVIEWFRM,
      75             :     SFX_INTERFACE_SFXPLUGINFRM,
      76             :     SFX_INTERFACE_SFXPLUGINOBJ,
      77             :     SFX_INTERFACE_SFXPLUGINVIEWSH,
      78             :     SFX_INTERFACE_SFXFRAMESETOBJ,
      79             :     SFX_INTERFACE_SFXFRAMESETVIEWSH,
      80             :     SFX_INTERFACE_SFXINTERNALFRM,
      81             :     SFX_INTERFACE_SFXCOMPONENTDOCSH,
      82             :     SFX_INTERFACE_SFXGENERICOBJ,
      83             :     SFX_INTERFACE_SFXGENERICVIEWSH,
      84             :     SFX_INTERFACE_SFXEXPLOBJ,
      85             :     SFX_INTERFACE_SFXEXPLVIEWSH,
      86             :     SFX_INTERFACE_SFXPLUGINVIEWSHDYNAMIC,
      87             :     SFX_INTERFACE_SFXEXTERNALVIEWFRM,
      88             :     SFX_INTERFACE_SFXMODULE,
      89             :     SFX_INTERFACE_SFXFRAMESETVIEW,
      90             :     SFX_INTERFACE_SFXFRAMESETSOURCEVIEW,
      91             :     SFX_INTERFACE_SFXHELP_DOCSH,
      92             :     SFX_INTERFACE_SFXHELP_VIEWSH,
      93             :     SFX_INTERFACE_SFXTASK,
      94             :     SFX_INTERFACE_OFA_START         =  100,
      95             :     SFX_INTERFACE_OFA_END           =  100,
      96             :     SFX_INTERFACE_SC_START          =  150,
      97             :     SFX_INTERFACE_SC_END            =  199,
      98             :     SFX_INTERFACE_SD_START          =  200,
      99             :     SFX_INTERFACE_SD_END            =  249,
     100             :     SFX_INTERFACE_SW_START          =  250,
     101             :     SFX_INTERFACE_SW_END            =  299,
     102             :     SFX_INTERFACE_SIM_START         =  300,
     103             :     SFX_INTERFACE_SIM_END           =  319,
     104             :     SFX_INTERFACE_SCH_START         =  320,
     105             :     SFX_INTERFACE_SCH_END           =  339,
     106             :     SFX_INTERFACE_SMA_START         =  340,
     107             :     SFX_INTERFACE_SMA_END           =  359,
     108             :     SFX_INTERFACE_SBA_START         =  360,
     109             :     SFX_INTERFACE_SBA_END           =  399,
     110             :     SFX_INTERFACE_IDE_START         =  400,
     111             :     SFX_INTERFACE_IDE_END           =  409,
     112             :     //-if one is still needed
     113             :     SFX_INTERFACE_APP               =  SFX_INTERFACE_SW_START,
     114             :     SFX_INTERFACE_LIB               =  450
     115             : };
     116             : 
     117             : //TODO/CLEANUP: replace by UNO constant
     118             : #define SVVERB_SHOW -1
     119             : 
     120             : typedef void (*SfxExecFunc)(SfxShell *, SfxRequest &rReq);
     121             : typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet);
     122             : 
     123             : /**
     124             :     The class SfxShell is the base class for all classes, which provide
     125             :     the functionality of the form <Slot>s.
     126             : 
     127             :     Each instance has a reference to an interface description, which is
     128             :     obtainable through <SfxShell::GetInterface()const>. This interface
     129             :     provides the connection to specific methods and contains some other
     130             :     descriptive data for controllers like menus and toolboxes, but also
     131             :     for the various APIs. The main part of the interface description is in
     132             :     the form of a <Type-Library>, which is generated from an IDL-file by
     133             :     the <SVIDL-Compiler>. For each SfxShell Subclass-File there is one
     134             :     such IDL-file to write.
     135             : */
     136             : class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster
     137             : {
     138             :     friend class SfxObjectItem;
     139             : 
     140             :     SfxShell_Impl*              pImp;
     141             :     SfxItemPool*                pPool;
     142             :     ::svl::IUndoManager*        pUndoMgr;
     143             : 
     144             : private:
     145             :                                 SfxShell( const SfxShell & ) SAL_DELETED_FUNCTION;
     146             :     SfxShell&                                   operator = ( const SfxShell & ) SAL_DELETED_FUNCTION;
     147             : 
     148             : protected:
     149             :     /**
     150             :         The constructor of the SfxShell class initializes only simple types,
     151             :         the corresponding SbxObject is only created on-demand. Therefore,
     152             :         the application of a SfxShell instance is very cheap.
     153             :         */
     154             :     SfxShell();
     155             : 
     156             :     /**
     157             :         The constructor of the SfxShell class initializes only simple types,
     158             :         the corresponding SbxObject is only created on-demand. Therefore,
     159             :         the application of a SfxShell instance is very cheap.
     160             :         */
     161             :     SfxShell( SfxViewShell *pViewSh );
     162             : 
     163             :     void SetViewShell_Impl( SfxViewShell* pView );
     164             :     SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId );
     165             :     SAL_DLLPRIVATE SfxShellObject* GetShellObj_Impl() const;
     166             :     SAL_DLLPRIVATE void SetShellObj_Impl( SfxShellObject* pObj );
     167             :     static void HandleOpenXmlFilterSettings(SfxRequest &);
     168             : 
     169             : public:
     170             :     TYPEINFO_OVERRIDE();
     171             : 
     172             :     /**
     173             :         The connection to a possible corresponding SbxObject is dissolved.
     174             :         The SbxObject may continoue to exist, but can not any longer perform
     175             :         any functions and can not provide any properties.
     176             :         */
     177             :     virtual                     ~SfxShell();
     178             : 
     179             :     /**
     180             :         With this virtual method, which is automatically overridden by each subclass
     181             :         with its own slots through the macro <SFX_DECL_INTERFACE>, one can access
     182             :         each of the <SfxInterface> instance beloning to the subclass.
     183             : 
     184             :         The class SfxShell itself has no own SfxInterface (no slots), therefore a
     185             :         NULL-pointer is returned.
     186             :         */
     187             :     virtual SfxInterface*       GetInterface() const;
     188        2181 :     static SfxInterface*        GetStaticInterface() { return 0; }
     189             : 
     190             :     /**
     191             :         Sets the name of the Shell object. With this name, the SfxShell instance
     192             :         of BASIC can be expressed.
     193             :         */
     194             :     void                        SetName( const OUString &rName );
     195             : 
     196             :     /**
     197             :         Returns the name of the Shell object. With this name, the SfxShell instance
     198             :         of BASIC can be expressed.
     199             :         */
     200             :     const OUString&             GetName() const;
     201             : 
     202             :     /**
     203             :         Returns the SfxViewShell in which they are located in the subshells.
     204             :         Otherwise, and if not specified by the App developer, this method
     205             :         returns NULL.
     206             :         */
     207             :     SfxViewShell*               GetViewShell() const;
     208             : 
     209         956 :     void                        CallExec( SfxExecFunc pFunc, SfxRequest &rReq )
     210         956 :                                 { (*pFunc)(this, rReq); }
     211      120833 :     void                        CallState( SfxStateFunc pFunc, SfxItemSet &rSet )
     212      120833 :                                 { (*pFunc)(this, rSet); }
     213             : 
     214             :     static void                 EmptyExecStub(SfxShell *pShell, SfxRequest &);
     215             :     static void                 EmptyStateStub(SfxShell *pShell, SfxItemSet &);
     216             : 
     217             :     /**
     218             :         This method returns the status of the slot with the specified slot ID
     219             :         on the specified interface.
     220             : 
     221             :         If the slot is disabled or in this SfxShell (and their parent shells) are
     222             :         not known, a Null-pointer is returned.
     223             : 
     224             :         If the slot does not have a Status, a SfxVoidItem is returned.
     225             : 
     226             :         The status is set directly in this Set when pStateSet != 0 , so that
     227             :         overridden Slots of the <SfxShell> Subclasses and also in the Status
     228             :         method of the base implementation can be called.
     229             : 
     230             :         [Example]
     231             : 
     232             :         In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be
     233             :         intercepted. Under certain circumstances a query should appear before
     234             :         you print, and the request will be aborted if necessary.
     235             : 
     236             :         Also in the IDL of this subclass of the above slot is entered. The status
     237             :         method will contain in outline:
     238             : 
     239             :         void SubViewShell::PrintState( SfxItemSet &rState )
     240             :         {
     241             :         if ( rState.GetItemState( SID_PRINTDOCDIRECT ) != SfxItemState::UNKNOWN )
     242             :         GetSlotState( SID_PRINTDOCDIRECT, SfxViewShell::GetInterface(),
     243             :         &rState );
     244             :         ...
     245             :         }
     246             : 
     247             :         [Cross-reference]
     248             : 
     249             :         <SfxShell::ExecuteSlot(SfxRequest&)>
     250             :         */
     251             :     const SfxPoolItem*          GetSlotState( sal_uInt16 nSlotId, const SfxInterface *pIF = 0, SfxItemSet *pStateSet = 0 );
     252             : 
     253             :     /**
     254             :         This method allows you to forward a <SfxRequest> to the specified
     255             :         base <SfxShell>.
     256             : 
     257             :         [Example]
     258             : 
     259             :         In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be
     260             :         intercepted. Under certain circumstances a query should appear before
     261             :         you print, and the request will be aborted if necessary.
     262             : 
     263             :         Also in the IDL of this subclass of the above slot is entered. The status
     264             :         method will contain in outline:
     265             : 
     266             :         void SubViewShell::Exec( SfxRequest &rReq )
     267             :         {
     268             :         if ( rReq.GetSlot() == SID_PRINTDOCDIRECT )
     269             :         {
     270             :         'dialog'
     271             :         if ( 'condition' )
     272             :         ExecuteSlot( rReq, SfxViewShell::GetInterface() );
     273             :         }
     274             :         }
     275             : 
     276             :         It usually takes no rReq.Done() to be called as that is already completed
     277             :         in implementation of the SfxViewShell, for instance it has been canceled.
     278             : 
     279             :         [Cross-reference]
     280             : 
     281             :         <SfxShell::GetSlotState(sal_uInt16,const SfxInterface*,SfxItemSet*)>
     282             :         */
     283             :     const SfxPoolItem*          ExecuteSlot( SfxRequest &rReq, const SfxInterface *pIF = 0 );
     284             : 
     285             :     /**
     286             :         Asynchronous ExecuteSlot for the RELOAD
     287             :         */
     288             :     const SfxPoolItem*          ExecuteSlot( SfxRequest &rReq, bool bAsync );
     289             :     sal_uIntPtr                       ExecuteSlot( sal_uInt16 nSlot, sal_uInt16 nMemberId, SbxVariable& rRet, SbxBase* pArgs = 0 );
     290             : 
     291             :     inline SfxItemPool&         GetPool() const;
     292             :     inline void                 SetPool( SfxItemPool *pNewPool ) ;
     293             : 
     294             :     /**
     295             :         Each Subclass of SfxShell can hava a <SfxUndoManager>. This can be set in
     296             :         the derived class with <SfxShell:SetUndoManager()>.
     297             : 
     298             :         The class SfxShell itself does not have a SfxUndoManager, a NULL-pointer
     299             :         is therefore returned.
     300             :         */
     301             :     virtual ::svl::IUndoManager* GetUndoManager();
     302             : 
     303             :     /**
     304             :         Sets a <SfxUndoManager> for this <SfxShell> Instance. For the undo
     305             :         is only the undo-manager used for SfxShell at the top of the stack of each
     306             :         <SfxDispatcher>.
     307             : 
     308             :         On the given <SfxUndoManager> is automatically the current
     309             :         Max-Undo-Action-Count setting set form the options.
     310             : 
     311             :         'pNewUndoMgr' must exist until the Destuctor of SfxShell instance is called
     312             :         or until the next 'SetUndoManager()'.
     313             :         */
     314             :     void                        SetUndoManager( ::svl::IUndoManager *pNewUndoMgr );
     315             : 
     316             :     /**
     317             :         Returns a pointer to the <SfxRepeatTarget> instance that is used in
     318             :         SID_REPEAT as repeat target when it is addressed from the <SfxUndoManager>
     319             :         supplied by this SfxShell. The return value can be NULL.
     320             : 
     321             :         [Note]
     322             : 
     323             :         A derivation of <SfxShell> or one of its subclasses of <SfxRepeatTarget>
     324             :         is not recommended, as compiler errors are provoked.
     325             :         (due to Call-to-Pointer-to-Member-Function to the subclass).
     326             :         */
     327             :     SfxRepeatTarget*            GetRepeatTarget() const;
     328             : 
     329             :     /**
     330             :         Sets the <SfxRepeatTarget> instance that is used in SID_REPEAT as
     331             :         RepeatTarget, when the current supplied by this <SfxUndoManager> is
     332             :         addressed. By 'pTarget==0' the SID_REPEAT is disabled for this SfxShell.
     333             :         The instance '*pTarget' must live as long as it is registered.
     334             : 
     335             :         [Note]
     336             : 
     337             :         A derivation of <SfxShell> or one of its subclasses of <SfxRepeatTarget>
     338             :         is not recommended, as compiler errors are provoked.
     339             :         (due to Call-to-Pointer-to-Member-Function to the subclass).
     340             :         */
     341             :     void                        SetRepeatTarget( SfxRepeatTarget *pTarget );
     342             : 
     343             :     /**
     344             :         With this method can the slots of the subclasses be invalidated through the
     345             :         slot Id or alternatively through the Which ID. Slot IDs, which are
     346             :         inherited by the subclass are also invalidert.
     347             : 
     348             :         [Cross-reference]
     349             : 
     350             :         <SfxBindings::Invalidate(sal_uInt16)>
     351             :         <SfxBindings::InvalidateAll(sal_Bool)>
     352             :         */
     353             :     virtual void                Invalidate(sal_uInt16 nId = 0);
     354             : 
     355           0 :     virtual bool                IsDesignMode() const { return false; };
     356             : 
     357             :     bool                        IsActive() const;
     358             : 
     359             :     /**
     360             :         Virtual method that is called when enabling the SfxShell instance,
     361             :         in order to give the Subclasses the opportunity to respond to the
     362             :         to the enabling.
     363             : 
     364             :         [Cross-reference]
     365             : 
     366             :         StarView SystemWindow::Activate(bool)
     367             :         */
     368             :     virtual void                Activate(bool bMDI);
     369             : 
     370             :     /**
     371             :         Virtual method that is called when disabling the SfxShell instance,
     372             :         to give the Subclasses the opportunity to respond to the disabling.
     373             : 
     374             :         [Cross-reference]
     375             : 
     376             :         StarView SystemWindow::Dectivate(bool)
     377             :         */
     378             :     virtual void                Deactivate(bool bMDI);
     379             : 
     380             :     /**
     381             :         This method returns a pointer to the <SfxDispatcher>, when the SfxShell
     382             :         is currently <UI-active> or a NULL-pointer if it is not UI-active.
     383             : 
     384             :         The returned pointer is only valid in the immediate context of the method
     385             :         call.
     386             :         */
     387             :     SfxDispatcher*              GetDispatcher() const;
     388             : 
     389             :     /**
     390             :         This method returns a pointer to the <SfxViewFrame> to which this SfxShell
     391             :         instance is associated or in which they currently is <UI-active>.
     392             :         A NULL pointer is returned if this SfxShell instance is not UI-active at
     393             :         the moment and also no SfxViewFrame is permanently assigned.
     394             : 
     395             :         The returned pointer is only valid in the immediate context of the method
     396             :         call.
     397             : 
     398             :         [Note]
     399             : 
     400             :         Only instances of a subclass of SfxApplication and SfxObjectShell
     401             :         should here provide a NULL-pointer. Otherwise, there is an error in the
     402             :         application program (wrong constructor was called from SfxShell).
     403             : 
     404             :         [Cross-reference]
     405             : 
     406             :         <SfxViewShell::GetViewFrame()const>
     407             :         */
     408             :     SfxViewFrame*               GetFrame() const;
     409             : 
     410             :     virtual bool                HasUIFeature( sal_uInt32 nFeature );
     411             :     void                        UIFeatureChanged();
     412             : 
     413             :     // Items
     414             :     /**
     415             :         With this method any objects of <SfxPoolItemu> subclasses can be accessed.
     416             :         This exchange method is needed if, for example special <SfxToolBoxControl>
     417             :         subclasses need access to certain data such as the <SfxObjectShell>.
     418             : 
     419             :         The returned instance belongs to the particular SfxShell and may be
     420             :         used only in the immediate context of the method call.
     421             : 
     422             :         [Cross-reference]
     423             : 
     424             :         <SfxShell::PutItem(const SfxPoolItem&)>
     425             :         <SfxShell::RemoveItem(sal_uInt16)>
     426             :         */
     427             :     const SfxPoolItem*          GetItem( sal_uInt16 nSlotId ) const;
     428             : 
     429             :     /**
     430             :         With this method, any objects of subclasses of <SfxPoolItem> can be made
     431             :         available. This exchange technology is needed if, for example, special
     432             :         <SfxToolBoxControl> Subclasses need access to certain data such as the
     433             :         <SfxObjectShell>
     434             : 
     435             :         If a SfxPoolItem exists with the same slot ID, it is deleted automatically.
     436             : 
     437             :         [Cross-reference]
     438             : 
     439             :         <SfxShell::RemoveItem(sal_uInt16)>
     440             :         <SfxShell::GetItem(sal_uInt16)>
     441             :         */
     442             :     void                        PutItem( const SfxPoolItem& rItem );
     443             : 
     444             :     // TODO/CLEANUP: still needed?!
     445             :     void SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& aVerbs);
     446             :     const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbs() const;
     447             :     void                        VerbExec (SfxRequest&);
     448             :     static void                 VerbState (SfxItemSet&);
     449             :     SAL_DLLPRIVATE const SfxSlot* GetVerbSlot_Impl(sal_uInt16 nId) const;
     450             : 
     451             :     void                        SetHelpId(sal_uIntPtr nId);
     452             :     sal_uIntPtr                     GetHelpId() const;
     453             :     virtual SfxObjectShell*     GetObjectShell();
     454             :     void                        SetDisableFlags( sal_uIntPtr nFlags );
     455             :     sal_uIntPtr                     GetDisableFlags() const;
     456             : 
     457             :     virtual SfxItemSet*         CreateItemSet( sal_uInt16 nId );
     458             :     virtual void                ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
     459             : 
     460             :     /** Set the name of the sidebar context that is broadcast on calls
     461             :         to Activation().
     462             :     */
     463             :     void SetContextName (const ::rtl::OUString& rsContextName);
     464             : 
     465             :     /** Broadcast a sidebar context change.
     466             :         This method is typically called from Activate() or
     467             :         Deactivate().
     468             :         @param bIsActivated
     469             :             When <TRUE/> then broadcast the context name that was
     470             :             defined with an earlier call to SetContextName().
     471             :             When <FALSE/> then broadcast the 'default' context.
     472             :     */
     473             :     void BroadcastContextForActivation (const bool bIsActivated);
     474             : 
     475             :     /** Enabled or disable the context broadcaster.  Returns the old state.
     476             :     */
     477             :     bool SetContextBroadcasterEnabled (const bool bIsEnabled);
     478             : 
     479             :     /**
     480             : 
     481             :         This method determines by calling the status function whether 'rSlot'
     482             :         can be executed currently.
     483             :         */
     484             :     SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
     485             : 
     486             :     /**
     487             : 
     488             :         This method controls the activation of SfxShell instance. First, by calling
     489             :         the virtual method <SfxShell::Activate(sal_Bool)> which gives the subclass the
     490             :         opportunity to respond to the event.
     491             : 
     492             :         When bMDI == TRUE, the associated SbxObject is being 'armed', so that
     493             :         unqualified methods of the object (without the name of the object)
     494             :         from BASIC are found.
     495             :         */
     496             :     SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI);
     497             : 
     498             :     /**
     499             : 
     500             :         This method controls the deactivation of the SfxShell instance. When
     501             :         bMDI == TRUE the SbxObject is first set to a status that only qualified
     502             :         BASIC methods can be called.
     503             : 
     504             :         Then the subclass gets the opportunity in every case to respond to the
     505             :         event by calling the virtual method <SfxShell::Deactivate(sal_Bool)>.
     506             :         */
     507             :     SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, bool bMDI);
     508             : };
     509             : 
     510             : /**
     511             :     Each Subclass of SfxShell must reference a pool. This is partly set by
     512             :     SFx's own set of subclasses (eg <SfxViewShell>). In particular however
     513             :     this must be set directly from one derived SfxShell class and ny
     514             :     derivatives of SfxObjectShell.
     515             : 
     516             :     The SfxShell class itself does not have any SfxItemPool, therfore a
     517             :     null-pointer is returned.
     518             : */
     519      287863 : SfxItemPool& SfxShell::GetPool() const
     520             : {
     521             :     assert(pPool && "no pool");
     522      287863 :     return *pPool;
     523             : }
     524             : 
     525             : /**
     526             :     With this method, the subclasses register their special <SfxItemPool>
     527             :     in the SfxShell. Each SfxShell instance must have access to a SfxItemPool.
     528             :     Usually this is the SfxItemPool of the SfxDocumentShell. The SfxShell
     529             :     subclass does not take ownership of the orphaned pool. Before it is
     530             :     deleted it has to be deregisted with SetPool(0).
     531             : */
     532       28192 : inline void SfxShell::SetPool
     533             : (
     534             :     SfxItemPool*        pNewPool        // Pointer to the new Pool or null
     535             : )
     536             : {
     537       28192 :     pPool = pNewPool;
     538       28192 : }
     539             : 
     540             : #define SFX_DECL_INTERFACE(nId)                                             \
     541             :             static SfxInterface*                pInterface;                 \
     542             :             static SfxInterface*                GetStaticInterface();       \
     543             :             static SfxInterfaceId               GetInterfaceId() {return SfxInterfaceId(nId);} \
     544             :             static void                         RegisterInterface(SfxModule* pMod=NULL); \
     545             :             virtual SfxInterface*       GetInterface() const SAL_OVERRIDE;
     546             : 
     547             : #define SFX_TMPL_INTERFACE(Class,SuperClass,Abstract)                       \
     548             :                                                                             \
     549             :     SfxInterface* Class::pInterface = 0;                                    \
     550             :     SfxInterface* Class::GetStaticInterface()                               \
     551             :     {                                                                       \
     552             :         if ( !pInterface )                                                  \
     553             :         {                                                                   \
     554             :             pInterface =                                                    \
     555             :                 new SfxInterface(                                           \
     556             :             #Class, Abstract, GetInterfaceId(),                             \
     557             :             SuperClass::GetStaticInterface(),                               \
     558             :             a##Class##Slots_Impl[0],                                        \
     559             :             (sal_uInt16) (sizeof(a##Class##Slots_Impl) / sizeof(SfxSlot) ) );   \
     560             :             InitInterface_Impl();                                           \
     561             :         }                                                                   \
     562             :         return pInterface;                                                  \
     563             :     }                                                                       \
     564             :                                                                             \
     565             :     SfxInterface* Class::GetInterface() const                               \
     566             :     {                                                                       \
     567             :         return GetStaticInterface();                                        \
     568             :     }                                                                       \
     569             :                                                                             \
     570             :     void Class::RegisterInterface(SfxModule* pMod)                          \
     571             :     {                                                                       \
     572             :         GetStaticInterface()->Register(pMod);                               \
     573             :     }
     574             : 
     575             : #define SFX_IMPL_INTERFACE(Class,SuperClass)                                \
     576             : SFX_TMPL_INTERFACE(Class,SuperClass,false)                                  \
     577             : 
     578             : #define SFX_IMPL_SUPERCLASS_INTERFACE(Class,SuperClass)                     \
     579             : SFX_TMPL_INTERFACE(Class,SuperClass,true)                                   \
     580             : 
     581             : #define SFX_POSITION_MASK               0x000F
     582             : #define SFX_VISIBILITY_MASK             0xFFF0
     583             : #define SFX_VISIBILITY_UNVISIBLE        0x0000  // Never visible
     584             : #define SFX_VISIBILITY_VIEWER           0x0040
     585             : #define SFX_VISIBILITY_READONLYDOC      0x0400
     586             : #define SFX_VISIBILITY_DESKTOP          0x0800
     587             : #define SFX_VISIBILITY_STANDARD         0x1000
     588             : #define SFX_VISIBILITY_FULLSCREEN       0x2000
     589             : #define SFX_VISIBILITY_CLIENT           0x4000
     590             : #define SFX_VISIBILITY_SERVER           0x8000
     591             : 
     592             : #endif
     593             : 
     594             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11