LCOV - code coverage report
Current view: top level - sc/source/ui/inc - AccessibleText.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 10 27 37.0 %
Date: 2015-06-13 12:38:46 Functions: 9 28 32.1 %
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_SC_SOURCE_UI_INC_ACCESSIBLETEXT_HXX
      21             : #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLETEXT_HXX
      22             : 
      23             : #include "textuno.hxx"
      24             : #include "global.hxx"
      25             : #include "viewdata.hxx"
      26             : #include <editeng/svxenum.hxx>
      27             : #include <svl/SfxBroadcaster.hxx>
      28             : 
      29             : #include <memory>
      30             : 
      31             : class ScDocShell;
      32             : class ScViewForwarder;
      33             : class ScEditObjectViewForwarder;
      34             : class ScPreviewViewForwarder;
      35             : class ScEditViewForwarder;
      36             : class ScPreviewShell;
      37             : class EditTextObject;
      38             : class ScCsvViewForwarder;
      39             : class ScAccessibleCell;
      40             : 
      41             : class ScAccessibleTextData : public SfxListener
      42             : {
      43             : public:
      44          32 :                         ScAccessibleTextData() {}
      45          24 :     virtual             ~ScAccessibleTextData() {}
      46             : 
      47             :     virtual ScAccessibleTextData* Clone() const = 0;
      48             : 
      49           0 :     virtual void        Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ ) SAL_OVERRIDE {}
      50             : 
      51             :     virtual SvxTextForwarder* GetTextForwarder() = 0;
      52             :     virtual SvxViewForwarder* GetViewForwarder() = 0;
      53             :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) = 0;
      54          54 :     SfxBroadcaster& GetBroadcaster() const { return maBroadcaster; }
      55             : 
      56             :     virtual void                UpdateData() = 0;
      57             :     virtual void                SetDoUpdate(bool bValue) = 0;
      58             :     virtual bool            IsDirty() const = 0;
      59             :     DECL_LINK( NotifyHdl, EENotify* );
      60             : 
      61             : private:
      62             :     mutable SfxBroadcaster maBroadcaster;
      63             : 
      64             : };
      65             : 
      66             : class ScAccessibleCellBaseTextData : public ScAccessibleTextData,
      67             :                                      public ScCellTextData
      68             : {
      69             : public:
      70          22 :                         ScAccessibleCellBaseTextData(ScDocShell* pDocShellP,
      71             :                             const ScAddress& rP)
      72          22 :                             : ScCellTextData(pDocShellP, rP) {}
      73          14 :     virtual             ~ScAccessibleCellBaseTextData() {}
      74          31 :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE { ScCellTextData::Notify(rBC, rHint); }
      75             : 
      76           0 :     virtual void                UpdateData() SAL_OVERRIDE { ScCellTextData::UpdateData(); }
      77           0 :     virtual void                SetDoUpdate(bool bValue) SAL_OVERRIDE { ScCellTextData::SetDoUpdate(bValue); }
      78           0 :     virtual bool                IsDirty() const SAL_OVERRIDE { return ScCellTextData::IsDirty(); }
      79             : };
      80             : 
      81             : //  ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
      82             : 
      83             : class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData
      84             : {
      85             : public:
      86             :                         ScAccessibleCellTextData(ScTabViewShell* pViewShell,
      87             :                             const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell);
      88             :     virtual             ~ScAccessibleCellTextData();
      89             : 
      90             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
      91             : 
      92             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
      93             : 
      94             :     virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
      95             :     virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
      96             :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
      97             : 
      98             : protected:
      99             :     virtual void            GetCellText(const ScAddress& rCellPos, OUString& rText) SAL_OVERRIDE;
     100             : private:
     101             :     ScViewForwarder* mpViewForwarder;
     102             :     ScEditViewForwarder* mpEditViewForwarder;
     103             :     ScTabViewShell* mpViewShell;
     104             :     ScSplitPos meSplitPos;
     105             :     ScAccessibleCell* mpAccessibleCell;
     106             : 
     107             :     using ScAccessibleCellBaseTextData::GetDocShell;
     108             :     static ScDocShell* GetDocShell(ScTabViewShell* pViewShell);
     109             : };
     110             : 
     111             : class ScAccessibleEditObjectTextData : public ScAccessibleTextData
     112             : {
     113             : public:
     114             :     // Add a para to indicate whether the object is cloned
     115             :     ScAccessibleEditObjectTextData(EditView* pEditView, vcl::Window* pWin, bool isClone = false);
     116             :     virtual             ~ScAccessibleEditObjectTextData();
     117             : 
     118             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
     119             : 
     120             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     121             : 
     122             :     virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
     123             :     virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
     124             :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
     125             : 
     126           0 :     virtual void                UpdateData() SAL_OVERRIDE {  }
     127           0 :     virtual void                SetDoUpdate(bool /* bValue */) SAL_OVERRIDE {  }
     128           0 :     virtual bool                IsDirty() const SAL_OVERRIDE { return false; }
     129             : 
     130             :     DECL_LINK( NotifyHdl, EENotify* );
     131             : protected:
     132             :     ScEditObjectViewForwarder* mpViewForwarder;
     133             :     ScEditViewForwarder*       mpEditViewForwarder;
     134             :     EditView*                  mpEditView;
     135             :     EditEngine*                mpEditEngine;
     136             :     SvxEditEngineForwarder*    mpForwarder;
     137             :     VclPtr<vcl::Window>        mpWindow;
     138             :     bool                       mbIsCloned;
     139             : };
     140             : 
     141             : class ScAccessibleEditLineTextData : public ScAccessibleEditObjectTextData
     142             : {
     143             : public:
     144             :                         ScAccessibleEditLineTextData(EditView* pEditView, vcl::Window* pWin);
     145             :     virtual             ~ScAccessibleEditLineTextData();
     146             : 
     147             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
     148             : 
     149             :     virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
     150             :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
     151             : 
     152             :     void Dispose();
     153             :     void TextChanged();
     154             :     void StartEdit();
     155             :     void EndEdit();
     156             : private:
     157             :     void ResetEditMode();
     158             : 
     159             :     bool mbEditEngineCreated;
     160             : };
     161             : 
     162             : class ScAccessiblePreviewCellTextData : public ScAccessibleCellBaseTextData
     163             : {
     164             : public:
     165             :                         ScAccessiblePreviewCellTextData(ScPreviewShell* pViewShell,
     166             :                             const ScAddress& rP);
     167             :     virtual             ~ScAccessiblePreviewCellTextData();
     168             : 
     169             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
     170             : 
     171             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     172             : 
     173             :     virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
     174             :     virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
     175          18 :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
     176             : 
     177             : private:
     178             :     ScPreviewViewForwarder* mpViewForwarder;
     179             :     ScPreviewShell* mpViewShell;
     180             : 
     181             :     using ScAccessibleCellBaseTextData::GetDocShell;
     182             :     static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
     183             : };
     184             : 
     185             : class ScAccessiblePreviewHeaderCellTextData : public ScAccessibleCellBaseTextData
     186             : {
     187             : public:
     188             :                         ScAccessiblePreviewHeaderCellTextData(ScPreviewShell* pViewShell,
     189             :                             const OUString& rText, const ScAddress& rP, bool bColHeader, bool bRowHeader);
     190             :     virtual             ~ScAccessiblePreviewHeaderCellTextData();
     191             : 
     192             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
     193             : 
     194             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     195             : 
     196             :     virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
     197             :     virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
     198          12 :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
     199             : 
     200             : private:
     201             :     ScPreviewViewForwarder* mpViewForwarder;
     202             :     ScPreviewShell* mpViewShell;
     203             :     OUString        maText;
     204             :     bool            mbColHeader;
     205             :     bool            mbRowHeader;
     206             : 
     207             :     using ScAccessibleCellBaseTextData::GetDocShell;
     208             :     static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
     209             : };
     210             : 
     211             : class ScAccessibleHeaderTextData : public ScAccessibleTextData
     212             : {
     213             : public:
     214             :                         ScAccessibleHeaderTextData(ScPreviewShell* pViewShell,
     215             :                             const EditTextObject* pEditObj, bool bHeader, SvxAdjust eAdjust);
     216             :     virtual             ~ScAccessibleHeaderTextData();
     217             : 
     218             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
     219             : 
     220             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     221             : 
     222             :     virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
     223             :     virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
     224          30 :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
     225             : 
     226           0 :     virtual void                UpdateData() SAL_OVERRIDE {  }
     227           0 :     virtual void                SetDoUpdate(bool /* bValue */) SAL_OVERRIDE {  }
     228           0 :     virtual bool                IsDirty() const SAL_OVERRIDE { return false; }
     229             : private:
     230             :     ScPreviewViewForwarder* mpViewForwarder;
     231             :     ScPreviewShell*         mpViewShell;
     232             :     ScEditEngineDefaulter*  mpEditEngine;
     233             :     SvxEditEngineForwarder* mpForwarder;
     234             :     ScDocShell*             mpDocSh;
     235             :     const EditTextObject*   mpEditObj;
     236             :     bool                    mbHeader;
     237             :     bool                    mbDataValid;
     238             :     SvxAdjust               meAdjust;
     239             : };
     240             : 
     241             : class ScAccessibleNoteTextData : public ScAccessibleTextData
     242             : {
     243             : public:
     244             :                         ScAccessibleNoteTextData(ScPreviewShell* pViewShell,
     245             :                             const OUString& sText, const ScAddress& aCellPos, bool bMarkNote);
     246             :     virtual             ~ScAccessibleNoteTextData();
     247             : 
     248             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
     249             : 
     250             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     251             : 
     252             :     virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
     253             :     virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
     254           0 :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
     255             : 
     256           0 :     virtual void                UpdateData() SAL_OVERRIDE {  }
     257           0 :     virtual void                SetDoUpdate(bool /* bValue */) SAL_OVERRIDE {  }
     258           0 :     virtual bool            IsDirty() const SAL_OVERRIDE { return false; }
     259             : private:
     260             :     ScPreviewViewForwarder* mpViewForwarder;
     261             :     ScPreviewShell*         mpViewShell;
     262             :     ScEditEngineDefaulter*  mpEditEngine;
     263             :     SvxEditEngineForwarder* mpForwarder;
     264             :     ScDocShell*             mpDocSh;
     265             :     OUString                msText;
     266             :     ScAddress               maCellPos;
     267             :     bool                    mbMarkNote;
     268             :     bool                    mbDataValid;
     269             : };
     270             : 
     271             : class ScAccessibleCsvTextData : public ScAccessibleTextData
     272             : {
     273             : private:
     274             :     typedef ::std::unique_ptr< SvxTextForwarder > TextForwarderPtr;
     275             :     typedef ::std::unique_ptr< ScCsvViewForwarder > ViewForwarderPtr;
     276             : 
     277             :     VclPtr<vcl::Window>         mpWindow;
     278             :     EditEngine*                 mpEditEngine;
     279             :     TextForwarderPtr            mpTextForwarder;
     280             :     ViewForwarderPtr            mpViewForwarder;
     281             :     OUString                    maCellText;
     282             :     Rectangle                   maBoundBox;
     283             :     Size                        maCellSize;
     284             : 
     285             : public:
     286             :     explicit                    ScAccessibleCsvTextData(
     287             :                                     vcl::Window* pWindow,
     288             :                                     EditEngine* pEditEngine,
     289             :                                     const OUString& rCellText,
     290             :                                     const Rectangle& rBoundBox,
     291             :                                     const Size& rCellSize );
     292             :     virtual                     ~ScAccessibleCsvTextData();
     293             : 
     294             :     virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
     295             : 
     296             :     virtual void                Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     297             : 
     298             :     virtual SvxTextForwarder*   GetTextForwarder() SAL_OVERRIDE;
     299             :     virtual SvxViewForwarder*   GetViewForwarder() SAL_OVERRIDE;
     300             :     virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
     301             : 
     302           0 :     virtual void                UpdateData() SAL_OVERRIDE {}
     303           0 :     virtual void                SetDoUpdate( bool /* bValue */ ) SAL_OVERRIDE {}
     304           0 :     virtual bool                IsDirty() const SAL_OVERRIDE { return false; }
     305             : };
     306             : 
     307             : #endif
     308             : 
     309             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11