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

Generated by: LCOV version 1.10