LCOV - code coverage report
Current view: top level - include/editeng - unoedprx.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 1 1 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             : 
      20             : #ifndef INCLUDED_EDITENG_UNOEDPRX_HXX
      21             : #define INCLUDED_EDITENG_UNOEDPRX_HXX
      22             : 
      23             : #include <memory>
      24             : #include <svl/SfxBroadcaster.hxx>
      25             : #include <editeng/unoedsrc.hxx>
      26             : 
      27             : #include <editeng/editdata.hxx>
      28             : #include <editeng/editengdllapi.h>
      29             : 
      30             : class SvxAccessibleTextAdapter : public SvxTextForwarder
      31             : {
      32             : public:
      33             :     SvxAccessibleTextAdapter();
      34             :     virtual ~SvxAccessibleTextAdapter();
      35             : 
      36             :     virtual sal_Int32       GetParagraphCount() const SAL_OVERRIDE;
      37             :     virtual sal_Int32       GetTextLen( sal_Int32 nParagraph ) const SAL_OVERRIDE;
      38             :     virtual OUString        GetText( const ESelection& rSel ) const SAL_OVERRIDE;
      39             :     virtual SfxItemSet      GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All ) const SAL_OVERRIDE;
      40             :     virtual SfxItemSet      GetParaAttribs( sal_Int32 nPara ) const SAL_OVERRIDE;
      41             :     virtual void            SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) SAL_OVERRIDE;
      42             :     virtual void            RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) SAL_OVERRIDE;
      43             :     virtual void            GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const SAL_OVERRIDE;
      44             : 
      45             :     virtual sal_uInt16      CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex );
      46             : 
      47             :     virtual SfxItemState    GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE;
      48             :     virtual SfxItemState    GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE;
      49             : 
      50             :     virtual void            QuickInsertText( const OUString& rText, const ESelection& rSel ) SAL_OVERRIDE;
      51             :     virtual void            QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) SAL_OVERRIDE;
      52             :     virtual void            QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) SAL_OVERRIDE;
      53             :     virtual void            QuickInsertLineBreak( const ESelection& rSel ) SAL_OVERRIDE;
      54             : 
      55             :     virtual SfxItemPool*    GetPool() const SAL_OVERRIDE;
      56             : 
      57             :     virtual OUString        CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor ) SAL_OVERRIDE;
      58             :     virtual void            FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) SAL_OVERRIDE;
      59             : 
      60             :     virtual bool            IsValid() const SAL_OVERRIDE;
      61             : 
      62             :     virtual LanguageType    GetLanguage( sal_Int32, sal_Int32 ) const SAL_OVERRIDE;
      63             :     virtual sal_Int32       GetFieldCount( sal_Int32 nPara ) const SAL_OVERRIDE;
      64             :     virtual EFieldInfo      GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const SAL_OVERRIDE;
      65             :     virtual EBulletInfo     GetBulletInfo( sal_Int32 nPara ) const SAL_OVERRIDE;
      66             :     virtual Rectangle       GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const SAL_OVERRIDE;
      67             :     virtual Rectangle       GetParaBounds( sal_Int32 nPara ) const SAL_OVERRIDE;
      68             :     virtual MapMode         GetMapMode() const SAL_OVERRIDE;
      69             :     virtual OutputDevice*   GetRefDevice() const SAL_OVERRIDE;
      70             :     virtual bool            GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const SAL_OVERRIDE;
      71             :     virtual bool            GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const SAL_OVERRIDE;
      72             :     virtual bool            GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const SAL_OVERRIDE;
      73             :     virtual sal_Int32       GetLineCount( sal_Int32 nPara ) const SAL_OVERRIDE;
      74             :     virtual sal_Int32       GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const SAL_OVERRIDE;
      75             :     virtual void            SetUpdateModeForAcc( bool bUp) SAL_OVERRIDE;
      76             :     virtual bool            GetUpdateModeForAcc() const SAL_OVERRIDE;
      77             :     virtual void            GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const SAL_OVERRIDE;
      78             :     virtual sal_Int32       GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const SAL_OVERRIDE;
      79             : 
      80             :     virtual bool            Delete( const ESelection& ) SAL_OVERRIDE;
      81             :     virtual bool            InsertText( const OUString&, const ESelection& ) SAL_OVERRIDE;
      82             :     virtual bool            QuickFormatDoc( bool bFull = false ) SAL_OVERRIDE;
      83             :     virtual sal_Int16       GetDepth( sal_Int32 nPara ) const SAL_OVERRIDE;
      84             :     virtual bool            SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) SAL_OVERRIDE;
      85             : 
      86             :     virtual const SfxItemSet*   GetEmptyItemSetPtr() SAL_OVERRIDE;
      87             : 
      88             :     // implementation functions for XParagraphAppend and XTextPortionAppend
      89             :     // (not needed for accessibility, only for new import API)
      90             :     virtual void        AppendParagraph() SAL_OVERRIDE;
      91             :     virtual sal_Int32   AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) SAL_OVERRIDE;
      92             : 
      93             :     //XTextCopy
      94             :     virtual void        CopyText(const SvxTextForwarder& rSource) SAL_OVERRIDE;
      95             : 
      96             :     void                SetForwarder( SvxTextForwarder& );
      97             :     bool                HaveImageBullet( sal_Int32 nPara ) const;
      98             :     bool                HaveTextBullet( sal_Int32 nPara ) const;
      99             : 
     100             :     /** Query whether all text in given selection is editable
     101             : 
     102             :         @return sal_True if every character in the given selection can
     103             :         be changed, and sal_False if e.g. a field or a bullet is
     104             :         contained therein.
     105             :      */
     106             :     bool                IsEditable( const ESelection& rSelection );
     107             : 
     108             : private:
     109             :     SvxTextForwarder* mpTextForwarder;
     110             : };
     111             : 
     112             : class SvxAccessibleTextEditViewAdapter : public SvxEditViewForwarder
     113             : {
     114             : public:
     115             : 
     116             :                         SvxAccessibleTextEditViewAdapter();
     117             :     virtual             ~SvxAccessibleTextEditViewAdapter();
     118             : 
     119             :     // SvxViewForwarder interface
     120             :     virtual bool        IsValid() const SAL_OVERRIDE;
     121             :     virtual Rectangle   GetVisArea() const SAL_OVERRIDE;
     122             :     virtual Point       LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const SAL_OVERRIDE;
     123             :     virtual Point       PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const SAL_OVERRIDE;
     124             : 
     125             :     // SvxEditViewForwarder interface
     126             :     virtual bool        GetSelection( ESelection& rSelection ) const SAL_OVERRIDE;
     127             :     virtual bool        SetSelection( const ESelection& rSelection ) SAL_OVERRIDE;
     128             :     virtual bool        Copy() SAL_OVERRIDE;
     129             :     virtual bool        Cut() SAL_OVERRIDE;
     130             :     virtual bool        Paste() SAL_OVERRIDE;
     131             : 
     132             :     void                SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& );
     133             : 
     134             : private:
     135             :     SvxEditViewForwarder*       mpViewForwarder;
     136             :     SvxAccessibleTextAdapter*   mpTextForwarder;
     137             : };
     138             : 
     139             : class EDITENG_DLLPUBLIC SvxEditSourceAdapter : public SvxEditSource
     140             : {
     141             : public:
     142             :     SvxEditSourceAdapter();
     143             :     virtual ~SvxEditSourceAdapter();
     144             : 
     145             :     virtual SvxEditSource*                      Clone() const SAL_OVERRIDE;
     146             :     virtual SvxTextForwarder*                   GetTextForwarder() SAL_OVERRIDE;
     147             :     SvxAccessibleTextAdapter*                   GetTextForwarderAdapter(); // covariant return types don't work on MSVC
     148             :     virtual SvxViewForwarder*                   GetViewForwarder() SAL_OVERRIDE;
     149             :     virtual SvxEditViewForwarder*               GetEditViewForwarder( bool bCreate = false ) SAL_OVERRIDE;
     150             :     SvxAccessibleTextEditViewAdapter*           GetEditViewForwarderAdapter( bool bCreate = false ); // covariant return types don't work on MSVC
     151             :     virtual void                                UpdateData() SAL_OVERRIDE;
     152             :     virtual SfxBroadcaster&                     GetBroadcaster() const SAL_OVERRIDE;
     153             : 
     154             :     void        SetEditSource( ::std::unique_ptr< SvxEditSource > && pAdaptee );
     155             : 
     156         786 :     bool        IsValid() const { return mbEditSourceValid;}
     157             : 
     158             : private:
     159             :     // declared, but not defined
     160             :     SvxEditSourceAdapter( const SvxEditSourceAdapter& );
     161             :     SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& );
     162             : 
     163             :     ::std::unique_ptr< SvxEditSource >    mpAdaptee;
     164             : 
     165             :     SvxAccessibleTextAdapter            maTextAdapter;
     166             :     SvxAccessibleTextEditViewAdapter    maEditViewAdapter;
     167             : 
     168             :     mutable SfxBroadcaster              maDummyBroadcaster;
     169             : 
     170             :     bool                                mbEditSourceValid;
     171             : };
     172             : 
     173             : #endif
     174             : 
     175             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10