LCOV - code coverage report
Current view: top level - include/sfx2 - viewsh.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 12 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
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_VIEWSH_HXX
      20             : #define INCLUDED_SFX2_VIEWSH_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : #include <sfx2/dllapi.h>
      24             : #include <sal/types.h>
      25             : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      26             : #include <com/sun/star/frame/XController.hpp>
      27             : #include <com/sun/star/view/XRenderable.hpp>
      28             : #include <com/sun/star/uno/Reference.h>
      29             : #include <svl/lstner.hxx>
      30             : #include <com/sun/star/ui/XContextMenuInterceptor.hpp>
      31             : #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
      32             : #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
      33             : #include <cppuhelper/interfacecontainer.hxx>
      34             : #include <sfx2/shell.hxx>
      35             : #include <tools/gen.hxx>
      36             : #include <tools/errcode.hxx>
      37             : #include <vcl/jobset.hxx>
      38             : #include <vector>
      39             : 
      40             : class SfxBaseController;
      41             : class Size;
      42             : class Fraction;
      43             : class Window;
      44             : class KeyEvent;
      45             : class WorkWindow;
      46             : class SvBorder;
      47             : class SdrView;
      48             : class SfxFrame;
      49             : class SfxMedium;
      50             : class SfxModule;
      51             : class SfxViewFrame;
      52             : class SfxItemPool;
      53             : class SfxTabPage;
      54             : class SfxFrameSetDescriptor;
      55             : class Printer;
      56             : class SfxPrinter;
      57             : class SfxProgress;
      58             : class SfxFrameItem;
      59             : class Dialog;
      60             : class Menu;
      61             : class NotifyEvent;
      62             : 
      63             : #define SFX_PRINTER_PRINTER               1  // without JOB SETUP => Temporary
      64             : #define SFX_PRINTER_JOBSETUP         2
      65             : #define SFX_PRINTER_OPTIONS          4
      66             : #define SFX_PRINTER_CHG_ORIENTATION  8
      67             : #define SFX_PRINTER_CHG_SIZE        16
      68             : #define SFX_PRINTER_ALL             31
      69             : 
      70             : #define SFX_PRINTER_CHG_ORIENTATION_FLAG  3
      71             : #define SFX_PRINTER_CHG_SIZE_FLAG         4
      72             : 
      73             : #define SFX_PRINTERROR_NONE          0
      74             : #define SFX_PRINTERROR_BUSY          1
      75             : 
      76             : // "Verified" using www.apple.com and Netscape 3.01
      77             : #define DEFAULT_MARGIN_WIDTH 8
      78             : #define DEFAULT_MARGIN_HEIGHT 12
      79             : 
      80             : 
      81             : 
      82             : //  @[SfxViewShell-Flags]
      83             : 
      84             : #define SFX_VIEW_HAS_PRINTOPTIONS  0x0010 /* Options-Button and Options-
      85             :                                              Dialog in PrintDialog */
      86             : #define SFX_VIEW_CAN_PRINT         0x0020 /* Printing enabled without having
      87             :                                              to create a Printer */
      88             : #define SFX_VIEW_NO_SHOW           0x0040 /* Window of the ViewShell shall
      89             :                                              not be showed automatically */
      90             : #define SFX_VIEW_NO_NEWWINDOW      0x0100 /* Allow N View */
      91             : 
      92             : /*  [Description]
      93             : 
      94             :     The SfxViewShell flags control the behavior of SfxViewShell for the
      95             :     duration of its lifetime. They are defined in the constructor of
      96             :     <SfxViewShell>.
      97             : */
      98             : 
      99             : 
     100             : 
     101             : #define SFX_DECL_VIEWFACTORY(Class) \
     102             : private: \
     103             :     static SfxViewFactory *pFactory; \
     104             : public: \
     105             :     static SfxViewShell  *CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView); \
     106             :     static void           RegisterFactory( sal_uInt16 nPrio = USHRT_MAX ); \
     107             :     static SfxViewFactory&Factory() { return *pFactory; } \
     108             :     static void           InitFactory()
     109             : 
     110             : #define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \
     111             :     SfxViewFactory* Class::pFactory; \
     112             :     SfxViewShell* Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \
     113             :     { return new Class(pFrame, pOldView); } \
     114             :     void Class::RegisterFactory( sal_uInt16 nPrio ) \
     115             :     { \
     116             :         pFactory = new SfxViewFactory(&CreateInstance,nPrio,AsciiViewName);\
     117             :         InitFactory(); \
     118             :     } \
     119             :     void Class::InitFactory()
     120             : 
     121             : #define SFX_VIEW_REGISTRATION(DocClass) \
     122             :             DocClass::Factory().RegisterViewFactory( Factory() )
     123             : 
     124             : class SfxInPlaceClient;
     125             : typedef ::std::vector< SfxInPlaceClient* > SfxInPlaceClientList;
     126             : 
     127             : 
     128             : class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener
     129             : {
     130             : #ifdef INCLUDED_SFX2_VIEWSH_HXX
     131             : friend class SfxViewFrame;
     132             : friend class SfxBaseController;
     133             : friend class SfxPrinterController;
     134             : #endif
     135             : 
     136             :     struct SfxViewShell_Impl*   pImp;
     137             :     SfxInPlaceClientList*       pIPClientList;
     138             :     SfxViewFrame*               pFrame;
     139             :     SfxShell*                   pSubShell;
     140             :     Window*                     pWindow;
     141             :     bool                        bNoNewWindow;
     142             : 
     143             : protected:
     144             :     virtual void                Activate(bool IsMDIActivate) SAL_OVERRIDE;
     145             :     virtual void                Deactivate(bool IsMDIActivate) SAL_OVERRIDE;
     146             : 
     147             :     virtual void                InnerResizePixel( const Point &rOfs, const Size &rSize );
     148             :     virtual void                OuterResizePixel( const Point &rOfs, const Size &rSize );
     149             :     virtual void                SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
     150             : 
     151             :     virtual void                Move();
     152             : 
     153             :     virtual void                Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     154             : 
     155             : public:
     156             :     // Iteration
     157             :     static SfxViewShell*        GetFirst( const TypeId* pType = 0, bool bOnlyVisible = true );
     158             :     static SfxViewShell*        GetNext( const SfxViewShell& rPrev,
     159             :                                          const TypeId* pType = 0, bool bOnlyVisible = true );
     160             :     static SfxViewShell*        Current();
     161             : 
     162             :     static SfxViewShell*        Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController );
     163             : 
     164             :     // Initialize Constructors/Destructors
     165             :                                 TYPEINFO_OVERRIDE();
     166           0 :                                 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWSH)
     167             : 
     168             :                                 SfxViewShell( SfxViewFrame *pFrame, sal_uInt16 nFlags = 0 );
     169             :     virtual                     ~SfxViewShell();
     170             : 
     171             :     SfxInPlaceClient*           GetIPClient() const;
     172             :     SfxInPlaceClient*           GetUIActiveClient() const;
     173             :     SfxInPlaceClient*           FindIPClient( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&  xObj, Window *pObjParentWin ) const;
     174             : 
     175             :     virtual ErrCode             DoVerb(long nVerb);
     176             : 
     177             :     virtual void                OutplaceActivated( bool bActive, SfxInPlaceClient* pClient );
     178             :     virtual void                InplaceActivating( SfxInPlaceClient* pClient );
     179             :     virtual void                InplaceDeactivated( SfxInPlaceClient* pClient );
     180             :     virtual void                UIActivating( SfxInPlaceClient* pClient );
     181             :     virtual void                UIDeactivated( SfxInPlaceClient* pClient );
     182             : 
     183             :     void                        JumpToMark( const OUString& rMark );
     184             :     void                        VisAreaChanged(const Rectangle& rRect);
     185             : 
     186             :     // Misc
     187             :     virtual bool                PrepareClose( bool bUI = true );
     188             :     virtual OUString            GetSelectionText( bool bCompleteWords = false );
     189             :     virtual bool                HasSelection( bool bText = true ) const;
     190             :     virtual SdrView*            GetDrawView() const;
     191             : 
     192           0 :     SfxShell*                   GetSubShell() const { return pSubShell; }
     193             :     void                        AddSubShell( SfxShell& rShell );
     194             :     void                        RemoveSubShell( SfxShell *pShell=NULL );
     195             :     SfxShell*                   GetSubShell( sal_uInt16 );
     196             : 
     197             :     // Focus, KeyInput, Cursor
     198             :     void                        GotFocus() const;
     199             :     inline void                 LostFocus() const;
     200             :     virtual void                ShowCursor( bool bOn = true );
     201             :     virtual bool                KeyInput( const KeyEvent &rKeyEvent );
     202             :     bool                        Escape();
     203             : 
     204             :     // Viewing Interface
     205           0 :     Window*                     GetWindow() const { return pWindow; }
     206             :     void                        SetWindow( Window *pViewPort );
     207             :     virtual void                AdjustPosSizePixel( const Point &rOfs, const Size &rSize );
     208             :     const SvBorder&             GetBorderPixel() const;
     209             :     void                        SetBorderPixel( const SvBorder &rBorder );
     210             :     void                        InvalidateBorder();
     211             :     inline SfxViewFrame*        GetViewFrame() const;
     212             : 
     213             :     // Printing Interface
     214             :     virtual SfxPrinter*         GetPrinter( bool bCreate = false );
     215             :     virtual sal_uInt16          SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
     216             :     virtual bool                HasPrintOptionsPage() const;
     217             :     virtual SfxTabPage*         CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
     218             :     virtual JobSetup            GetJobSetup() const;
     219             :     Printer*                    GetActivePrinter() const;
     220             : 
     221             :     // Working set
     222             :     virtual void                WriteUserData( OUString&, bool bBrowse = false );
     223             :     virtual void                ReadUserData( const OUString&, bool bBrowse = false );
     224             :     virtual void                WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, bool bBrowse = false );
     225             :     virtual void                ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, bool bBrowse = false );
     226             :     virtual void                QueryObjAreaPixel( Rectangle& rRect ) const;
     227             : 
     228             :     virtual SfxObjectShell*     GetObjectShell() SAL_OVERRIDE;
     229             :     /** retrieves the document which shall be considered the "current document" when the frame is active
     230             : 
     231             :         The default implementation simply returns the XModel of the associated SfxObjectShell. You will rarely
     232             :         need to overwrite this behavior.
     233             :     */
     234             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
     235             :                                 GetCurrentDocument() const;
     236             :     /** forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocument
     237             :     */
     238             :     void                        SetCurrentDocument() const;
     239             : 
     240             :     /** get an XRenderable instance that can render this document
     241             :     */
     242             :     virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable();
     243             : 
     244             : 
     245             :     virtual void                MarginChanged();
     246             :     const Size&                 GetMargin() const;
     247             :     void                        SetMargin( const Size& );
     248             :     void                        DisconnectAllClients();
     249             :     virtual SfxFrame*           GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium );
     250           0 :     bool                        NewWindowAllowed() const            { return !bNoNewWindow; }
     251           0 :     void                        SetNewWindowAllowed( bool bSet )    { bNoNewWindow = !bSet; }
     252             : 
     253             :     void                        SetController( SfxBaseController* pController );
     254             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
     255             :                                 GetController();
     256             : 
     257             :     bool                        TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent );
     258             : 
     259             :     void                        ExecPrint( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, bool, bool );
     260             : 
     261             :     void                        AddRemoveClipboardListener( const com::sun::star::uno::Reference < com::sun::star::datatransfer::clipboard::XClipboardListener>&, bool );
     262             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardNotifier > GetClipboardNotifier();
     263             : 
     264             :     SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const;
     265             :     SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor );
     266             :     SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor );
     267             :     SAL_DLLPRIVATE bool GlobalKeyInput_Impl( const KeyEvent &rKeyEvent );
     268             : 
     269           0 :     SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient )
     270           0 :                                 { GetIPClientList_Impl(true)->push_back(pIPClient); }
     271             :     SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient );
     272             :     SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const;
     273             :     SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP );
     274             :     SAL_DLLPRIVATE void DiscardClients_Impl();
     275             : 
     276             :     SAL_DLLPRIVATE SfxPrinter* SetPrinter_Impl( SfxPrinter *pNewPrinter );
     277             :     SAL_DLLPRIVATE bool IsShowView_Impl() const;
     278             : 
     279             :     SAL_DLLPRIVATE bool HandleNotifyEvent_Impl( NotifyEvent& rEvent );
     280             :     SAL_DLLPRIVATE bool HasKeyListeners_Impl();
     281             :     SAL_DLLPRIVATE bool HasMouseClickListeners_Impl();
     282             : 
     283             :     SAL_DLLPRIVATE SfxBaseController*   GetBaseController_Impl() const;
     284             : 
     285             :     // Shell Interface
     286             :     SAL_DLLPRIVATE void ExecPrint_Impl(SfxRequest &);
     287             :     SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &);
     288             :     SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
     289             :     SAL_DLLPRIVATE SfxFrameSetDescriptor* GetFrameSet_Impl() const;
     290             :     SAL_DLLPRIVATE void SetFrameSet_Impl(SfxFrameSetDescriptor*);
     291             :     SAL_DLLPRIVATE void CheckIPClient_Impl( SfxInPlaceClient*, const Rectangle& );
     292             :     SAL_DLLPRIVATE void PushSubShells_Impl( bool bPush=true );
     293           0 :     SAL_DLLPRIVATE void PopSubShells_Impl() { PushSubShells_Impl( false ); }
     294             :     SAL_DLLPRIVATE void TakeOwnership_Impl();
     295             :     SAL_DLLPRIVATE void TakeFrameOwnership_Impl();
     296             :     SAL_DLLPRIVATE bool ExecKey_Impl(const KeyEvent& aKey);
     297             : };
     298             : 
     299             : 
     300             : 
     301           0 : inline void SfxViewShell::LostFocus() const
     302             : 
     303             : /*  [Description]
     304             : 
     305             :     This method has to be  called by the application developer, if the edit
     306             :     window has lost the focus. The SFx has for example the ability to turn off
     307             :     the accelerator, so that the cursor keys, the Delete button, etc. work in
     308             :     certain Floating-Windows, even though they are redefined by the
     309             :     Accelerator.
     310             : 
     311             :     [Note]
     312             : 
     313             :     <StarView> unfortunatly does not provide the possibility to define
     314             :     such events 'from the side'.
     315             : */
     316             : 
     317             : {
     318           0 : }
     319             : 
     320             : 
     321             : 
     322           0 : inline SfxViewFrame* SfxViewShell::GetViewFrame() const
     323             : 
     324             : /*  [Description]
     325             : 
     326             :     This method returns a pointer to the <SfxViewFrame> Instance in which
     327             :     this SfxViewShell is displayed. This is the instance that was passed
     328             :     on in the constructor. It is guaranteed that the returned pointer
     329             :     points on the valid SfxViewFrame instance.
     330             : 
     331             :     [Cross-reference]
     332             : 
     333             :     <SfxShell::GetFrame()const>
     334             : */
     335             : 
     336             : {
     337           0 :     return pFrame;
     338             : }
     339             : 
     340             : #endif // INCLUDED_SFX2_VIEWSH_HXX
     341             : 
     342             : 
     343             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10