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

Generated by: LCOV version 1.10