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

Generated by: LCOV version 1.10