LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/inc - unotxvw.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-12-27 Functions: 2 2 100.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 SW_UNOTXVW_HXX
      20             : #define SW_UNOTXVW_HXX
      21             : #include <sfx2/sfxbasecontroller.hxx>
      22             : #include <cppuhelper/interfacecontainer.hxx>
      23             : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      24             : #include <com/sun/star/text/XTextViewCursor.hpp>
      25             : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      26             : #include <com/sun/star/text/XRubySelection.hpp>
      27             : #include <com/sun/star/view/XFormLayerAccess.hpp>
      28             : #include <com/sun/star/view/XScreenCursor.hpp>
      29             : #include <com/sun/star/view/XViewSettingsSupplier.hpp>
      30             : #include <com/sun/star/view/XSelectionSupplier.hpp>
      31             : #include <com/sun/star/view/XLineCursor.hpp>
      32             : #include <com/sun/star/view/XViewCursor.hpp>
      33             : #include <com/sun/star/text/XPageCursor.hpp>
      34             : #include <com/sun/star/beans/XPropertySet.hpp>
      35             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      36             : #include <com/sun/star/beans/XPropertyState.hpp>
      37             : #include <com/sun/star/lang/XServiceInfo.hpp>
      38             : #include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
      39             : #include <cppuhelper/implbase8.hxx> // helper for implementations
      40             : #include <svl/itemprop.hxx>
      41             : #include "calbck.hxx"
      42             : #include "TextCursorHelper.hxx"
      43             : #include <comphelper/uno3.hxx>
      44             : 
      45             : #include <sfx2/objsh.hxx>
      46             : 
      47             : class SdrObject;
      48             : class SwView;
      49             : 
      50             : class SwXTextView :
      51             :     public ::com::sun::star::view::XSelectionSupplier,
      52             :     public ::com::sun::star::lang::XServiceInfo,
      53             :     public ::com::sun::star::view::XFormLayerAccess,
      54             :     public ::com::sun::star::text::XTextViewCursorSupplier,
      55             :     public ::com::sun::star::text::XRubySelection,
      56             :     public ::com::sun::star::view::XViewSettingsSupplier,
      57             :     public ::com::sun::star::beans::XPropertySet,
      58             :     public ::com::sun::star::datatransfer::XTransferableSupplier,
      59             :     public SfxBaseController
      60             : {
      61             :     ::cppu::OInterfaceContainerHelper m_SelChangedListeners;
      62             : 
      63             :     SwView*                     m_pView;
      64             :     const SfxItemPropertySet*   m_pPropSet;   // property map for SwXTextView properties
      65             :                                         // (not related to pxViewSettings!)
      66             : 
      67             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *         pxViewSettings;
      68             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextViewCursor > *   pxTextViewCursor;
      69             : 
      70             : 
      71             :     SdrObject* GetControl(
      72             :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & Model,
      73             :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xToFill  );
      74             : 
      75             : protected:
      76             :     virtual ~SwXTextView();
      77             : public:
      78             :     SwXTextView(SwView* pSwView);
      79             : 
      80             : 
      81             :     virtual     ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
      82             :     virtual void SAL_CALL acquire(  ) throw();
      83             :     virtual void SAL_CALL release(  ) throw();
      84             : 
      85             :     //XTypeProvider
      86             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
      87             :     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
      88             : 
      89             :     //XSelectionSupplier
      90             :     virtual ::com::sun::star::uno::Any SAL_CALL getSelection(void) throw( ::com::sun::star::uno::RuntimeException );
      91             :     virtual sal_Bool SAL_CALL select(const ::com::sun::star::uno::Any& aInterface) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
      92             :     virtual void SAL_CALL addSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > & xListener) throw( ::com::sun::star::uno::RuntimeException );
      93             :     virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > & xListener) throw( ::com::sun::star::uno::RuntimeException );
      94             : 
      95             :     // XFormLayerAccess
      96             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& Form ) throw (::com::sun::star::uno::RuntimeException);
      97             :     virtual ::sal_Bool SAL_CALL isFormDesignMode(  ) throw (::com::sun::star::uno::RuntimeException);
      98             :     virtual void SAL_CALL setFormDesignMode( ::sal_Bool DesignMode ) throw (::com::sun::star::uno::RuntimeException);
      99             : 
     100             :     // XControlAccess
     101             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >  SAL_CALL getControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & Model) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException );
     102             : 
     103             :     //XTextViewCursorSupplier
     104             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextViewCursor >  SAL_CALL getViewCursor(void) throw( ::com::sun::star::uno::RuntimeException );
     105             : 
     106             :     //XViewSettings
     107             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >  SAL_CALL getViewSettings(void) throw( ::com::sun::star::uno::RuntimeException );
     108             : 
     109             :     //XRubySelection
     110             :     virtual ::com::sun::star::uno::Sequence<
     111             :             ::com::sun::star::uno::Sequence<
     112             :             ::com::sun::star::beans::PropertyValue > > SAL_CALL getRubyList( sal_Bool bAutomatic )
     113             :                 throw(::com::sun::star::uno::RuntimeException);
     114             : 
     115             :     virtual void SAL_CALL setRubyList(
     116             :         const ::com::sun::star::uno::Sequence<
     117             :         ::com::sun::star::uno::Sequence<
     118             :         ::com::sun::star::beans::PropertyValue > >& RubyList, sal_Bool bAutomatic )
     119             :             throw(::com::sun::star::uno::RuntimeException);
     120             : 
     121             :     //XPropertySet
     122             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);
     123             :     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     124             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     125             :     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     126             :     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     127             :     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     128             :     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     129             : 
     130             :     //XServiceInfo
     131             :     virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
     132             :     virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
     133             :     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
     134             : 
     135             :     //XTransferableSupplier
     136             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable(  ) throw (::com::sun::star::uno::RuntimeException);
     137             :     virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException);
     138             : 
     139             :     void                    NotifySelChanged();
     140             :     void                    NotifyDBChanged();
     141             : 
     142          52 :     SwView*                 GetView() {return m_pView;}
     143             :     void                    Invalidate();
     144             : 
     145             :     // temporary document used for PDF export of selections/multi-selections
     146             :     SfxObjectShellLock      BuildTmpSelectionDoc();
     147             : };
     148             : 
     149             : typedef cppu::WeakImplHelper8<
     150             :                             ::com::sun::star::text::XTextViewCursor,
     151             :                             ::com::sun::star::lang::XServiceInfo,
     152             :                             ::com::sun::star::text::XPageCursor,
     153             :                             ::com::sun::star::view::XScreenCursor,
     154             :                             ::com::sun::star::view::XViewCursor,
     155             :                             ::com::sun::star::view::XLineCursor,
     156             :                             ::com::sun::star::beans::XPropertySet,
     157             :                             ::com::sun::star::beans::XPropertyState
     158             :                             > SwXTextViewCursor_Base;
     159             : 
     160             : class SwXTextViewCursor : public SwXTextViewCursor_Base,
     161             : public SwClient,
     162             : public OTextCursorHelper
     163             : {
     164             :     SwView*                         m_pView;
     165             :     const SfxItemPropertySet*       m_pPropSet;
     166             : protected:
     167             :     sal_Bool    IsTextSelection( sal_Bool bAllowTables = sal_True ) const;
     168             :     virtual     ~SwXTextViewCursor();
     169             : public:
     170             :     SwXTextViewCursor(SwView* pVw);
     171             : 
     172             :     DECLARE_XINTERFACE()
     173             : 
     174             :     //XTextViewCursor
     175             :     virtual sal_Bool SAL_CALL isVisible(void) throw( ::com::sun::star::uno::RuntimeException );
     176             :     virtual void SAL_CALL setVisible(sal_Bool bVisible) throw( ::com::sun::star::uno::RuntimeException );
     177             :     virtual ::com::sun::star::awt::Point SAL_CALL getPosition(void) throw( ::com::sun::star::uno::RuntimeException );
     178             : 
     179             :     //XTextCursor - neu
     180             :     virtual void SAL_CALL collapseToStart(  ) throw(::com::sun::star::uno::RuntimeException);
     181             :     virtual void SAL_CALL collapseToEnd(  ) throw(::com::sun::star::uno::RuntimeException);
     182             :     virtual sal_Bool SAL_CALL isCollapsed(  ) throw(::com::sun::star::uno::RuntimeException);
     183             :     virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
     184             :     virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
     185             :     virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
     186             :     virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
     187             :     virtual void SAL_CALL gotoRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
     188             : 
     189             :     //XPageCursor
     190             :     virtual sal_Bool SAL_CALL jumpToFirstPage(void) throw( ::com::sun::star::uno::RuntimeException );
     191             :     virtual sal_Bool SAL_CALL jumpToLastPage(void) throw( ::com::sun::star::uno::RuntimeException );
     192             :     virtual sal_Bool SAL_CALL jumpToPage(sal_Int16 nPage) throw( ::com::sun::star::uno::RuntimeException );
     193             :     virtual sal_Bool SAL_CALL jumpToNextPage(void) throw( ::com::sun::star::uno::RuntimeException );
     194             :     virtual sal_Bool SAL_CALL jumpToPreviousPage(void) throw( ::com::sun::star::uno::RuntimeException );
     195             :     virtual sal_Bool SAL_CALL jumpToEndOfPage(void) throw( ::com::sun::star::uno::RuntimeException );
     196             :     virtual sal_Bool SAL_CALL jumpToStartOfPage(void) throw( ::com::sun::star::uno::RuntimeException );
     197             :     virtual sal_Int16 SAL_CALL getPage(void) throw( ::com::sun::star::uno::RuntimeException );
     198             : 
     199             :     //XTextRange
     200             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >  SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException );
     201             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL  getStart(void) throw( ::com::sun::star::uno::RuntimeException );
     202             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL   getEnd(void) throw( ::com::sun::star::uno::RuntimeException );
     203             :     virtual rtl::OUString SAL_CALL  getString(void) throw( ::com::sun::star::uno::RuntimeException );
     204             :     virtual void SAL_CALL  setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
     205             : 
     206             :     //XScreenCursor
     207             :     virtual sal_Bool SAL_CALL screenDown(void) throw( ::com::sun::star::uno::RuntimeException );
     208             :     virtual sal_Bool SAL_CALL screenUp(void) throw( ::com::sun::star::uno::RuntimeException );
     209             : 
     210             :     //XViewCursor
     211             :     virtual sal_Bool SAL_CALL goDown(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
     212             :     virtual sal_Bool SAL_CALL goUp(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
     213             : //    virtual sal_Bool goLeft(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
     214             : //    virtual sal_Bool goRight(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
     215             : 
     216             :     //XLineCursor
     217             :     virtual sal_Bool SAL_CALL isAtStartOfLine(void) throw( ::com::sun::star::uno::RuntimeException );
     218             :     virtual sal_Bool SAL_CALL isAtEndOfLine(void) throw( ::com::sun::star::uno::RuntimeException );
     219             :     virtual void SAL_CALL gotoEndOfLine(sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
     220             :     virtual void SAL_CALL gotoStartOfLine(sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
     221             : 
     222             :     //XPropertySet
     223             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
     224             :     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     225             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     226             :     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     227             :     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     228             :     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     229             :     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     230             : 
     231             :     //XPropertyState
     232             :     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     233             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     234             :     virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     235             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     236             : 
     237             :     //XServiceInfo
     238             :     virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
     239             :     virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
     240             :     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
     241             : 
     242             :     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
     243             : 
     244             :     //XUnoTunnel
     245             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
     246             : 
     247           2 :     void    Invalidate(){m_pView = 0;}
     248             : 
     249             :     // ITextCursorHelper
     250             :     virtual const SwPaM*        GetPaM() const;
     251             :     virtual SwPaM*              GetPaM();
     252             :     virtual const SwDoc*        GetDoc() const;
     253             :     virtual SwDoc*              GetDoc();
     254             : };
     255             : 
     256             : #endif
     257             : 
     258             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10