LCOV - code coverage report
Current view: top level - sc/source/ui/inc - AccessibleSpreadsheet.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 9 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : 
      21             : #ifndef _SC_ACCESSIBLESPREADSHEET_HXX
      22             : #define _SC_ACCESSIBLESPREADSHEET_HXX
      23             : 
      24             : #include <sal/config.h>
      25             : 
      26             : #include <rtl/ref.hxx>
      27             : 
      28             : #include "AccessibleTableBase.hxx"
      29             : #include "viewdata.hxx"
      30             : 
      31             : #include <vector>
      32             : 
      33             : #include "rangelst.hxx"
      34             : #include <map>
      35             : 
      36           0 : class ScMyAddress : public ScAddress
      37             : {
      38             : public:
      39             :     ScMyAddress() : ScAddress() {}
      40           0 :     ScMyAddress(SCCOL nColP, SCROW nRowP, SCTAB nTabP) : ScAddress(nColP, nRowP, nTabP) {}
      41           0 :     ScMyAddress(const ScAddress& rAddress) : ScAddress(rAddress) {}
      42             : 
      43           0 :     bool operator< ( const ScMyAddress& rAddress ) const
      44             :     {
      45           0 :         if( Row() != rAddress.Row() )
      46           0 :             return (Row() < rAddress.Row());
      47             :         else
      48           0 :             return (Col() < rAddress.Col());
      49             :     }
      50             : };
      51             : 
      52             : class ScTabViewShell;
      53             : class ScAccessibleDocument;
      54             : class ScAccessibleCell;
      55             : class ScRangeList;
      56             : 
      57             : /** @descr
      58             :         This base class provides an implementation of the
      59             :         <code>AccessibleTable</code> service.
      60             : */
      61             : class ScAccessibleSpreadsheet
      62             :     :   public  ScAccessibleTableBase
      63             : {
      64             : public:
      65             :     //=====  internal  ========================================================
      66             :     ScAccessibleSpreadsheet(
      67             :         ScAccessibleDocument* pAccDoc,
      68             :         ScTabViewShell* pViewShell,
      69             :         SCTAB   nTab,
      70             :         ScSplitPos eSplitPos);
      71             : protected:
      72             :     ScAccessibleSpreadsheet(
      73             :         ScAccessibleSpreadsheet& rParent,
      74             :         const ScRange& rRange );
      75             : 
      76             :     virtual ~ScAccessibleSpreadsheet();
      77             : 
      78             :     void ConstructScAccessibleSpreadsheet(
      79             :         ScAccessibleDocument* pAccDoc,
      80             :         ScTabViewShell* pViewShell,
      81             :         SCTAB nTab,
      82             :         ScSplitPos eSplitPos);
      83             : 
      84             :     using ScAccessibleTableBase::IsDefunc;
      85             : 
      86             : public:
      87             :     using ScAccessibleTableBase::disposing;
      88             : 
      89             :      virtual void SAL_CALL disposing() SAL_OVERRIDE;
      90             : 
      91             :     void CompleteSelectionChanged(bool bNewState);
      92             : 
      93             :     virtual void LostFocus();
      94             :     virtual void GotFocus();
      95             : 
      96             :     void BoundingBoxChanged();
      97             :     void VisAreaChanged();
      98             : 
      99             : private:
     100             :     ///=====  SfxListener  =====================================================
     101             :     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     102             : 
     103             :     ///=====  XAccessibleTable  ================================================
     104             : 
     105             :     /// Returns the row headers as an AccessibleTable.
     106             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
     107             :                 getAccessibleRowHeaders(  )
     108             :                     throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             : 
     110             :     /// Returns the column headers as an AccessibleTable.
     111             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
     112             :                 getAccessibleColumnHeaders(  )
     113             :                     throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             : 
     115             :     /// Returns the selected rows in a table.
     116             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
     117             :                 getSelectedAccessibleRows(  )
     118             :                     throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             :     /// Returns the selected columns in a table.
     121             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
     122             :                 getSelectedAccessibleColumns(  )
     123             :                     throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             : 
     125             :     /// Returns a boolean value indicating whether the specified row is selected.
     126             :     virtual sal_Bool SAL_CALL
     127             :                 isAccessibleRowSelected( sal_Int32 nRow )
     128             :                     throw (::com::sun::star::uno::RuntimeException,
     129             :                     ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     130             : 
     131             :     /// Returns a boolean value indicating whether the specified column is selected.
     132             :     virtual sal_Bool SAL_CALL
     133             :                 isAccessibleColumnSelected( sal_Int32 nColumn )
     134             :                     throw (::com::sun::star::uno::RuntimeException,
     135             :                     ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     136             : 
     137             :     /// Returns the Accessible at a specified row and column in the table.
     138             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
     139             :                 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
     140             :                     throw (::com::sun::star::uno::RuntimeException,
     141             :                             ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     142             : 
     143             :     rtl::Reference<ScAccessibleCell> GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn);
     144             : 
     145             :     /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
     146             :     virtual sal_Bool SAL_CALL
     147             :                 isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
     148             :                     throw (::com::sun::star::uno::RuntimeException,
     149             :                     ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     150             : 
     151             :     ///=====  XAccessibleComponent  ============================================
     152             : 
     153             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     154             :         SAL_CALL getAccessibleAtPoint(
     155             :         const ::com::sun::star::awt::Point& rPoint )
     156             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             : 
     158             :     virtual void SAL_CALL grabFocus(  )
     159             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             : 
     161             :     virtual sal_Int32 SAL_CALL getForeground(  )
     162             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     163             : 
     164             :     virtual sal_Int32 SAL_CALL getBackground(  )
     165             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     166             : 
     167             :     ///=====  XAccessibleContext  ==============================================
     168             : 
     169             :     /// Return NULL to indicate that an empty relation set.
     170             :     virtual ::com::sun::star::uno::Reference<
     171             :             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
     172             :         getAccessibleRelationSet(void)
     173             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             : 
     175             :     /// Return the set of current states.
     176             :     virtual ::com::sun::star::uno::Reference<
     177             :             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
     178             :         getAccessibleStateSet(void)
     179             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             : 
     181             :     ///=====  XAccessibleSelection  ===========================================
     182             : 
     183             :     virtual void SAL_CALL
     184             :         selectAccessibleChild( sal_Int32 nChildIndex )
     185             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     186             :                ::com::sun::star::uno::RuntimeException,
     187             :                std::exception) SAL_OVERRIDE;
     188             : 
     189             :     virtual void SAL_CALL
     190             :         clearAccessibleSelection(  )
     191             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             : 
     193             :     virtual void SAL_CALL
     194             :         selectAllAccessibleChildren(  )
     195             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     196             : 
     197             :     virtual sal_Int32 SAL_CALL
     198             :         getSelectedAccessibleChildCount(  )
     199             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     200             : 
     201             :     virtual ::com::sun::star::uno::Reference<
     202             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
     203             :         getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
     204             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     205             :         ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     206             : 
     207             :     virtual void SAL_CALL
     208             :         deselectAccessibleChild( sal_Int32 nChildIndex )
     209             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     210             :                ::com::sun::star::uno::RuntimeException,
     211             :                std::exception) SAL_OVERRIDE;
     212             : 
     213             :     ///=====  XServiceInfo  ====================================================
     214             : 
     215             :     /** Returns an identifier for the implementation of this object.
     216             :     */
     217             :     virtual OUString SAL_CALL
     218             :         getImplementationName(void)
     219             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     220             : 
     221             :     /** Returns a list of all supported services.
     222             :     */
     223             :     virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
     224             :         getSupportedServiceNames(void)
     225             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     226             : 
     227             :     ///=====  XTypeProvider  ===================================================
     228             : 
     229             :     /** Returns a implementation id.
     230             :     */
     231             :     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
     232             :         getImplementationId(void)
     233             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     234             : 
     235             :     ///=====  XAccessibleEventBroadcaster  =====================================
     236             : 
     237             :     /** Add listener that is informed of future changes of name,
     238             :           description and so on events.
     239             :     */
     240             :     virtual void SAL_CALL
     241             :         addAccessibleEventListener(
     242             :             const ::com::sun::star::uno::Reference<
     243             :                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
     244             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     245             :     //=====  XAccessibleTableSelection  ============================================
     246             :     virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
     247             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException,
     248             :                std::exception) SAL_OVERRIDE;
     249             :     virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
     250             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException,
     251             :                std::exception) SAL_OVERRIDE;
     252             :     virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
     253             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException,
     254             :                std::exception) SAL_OVERRIDE;
     255             :     virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
     256             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException,
     257             :                std::exception) SAL_OVERRIDE;
     258             : 
     259             : protected:
     260             :     /// Return the object's current bounding box relative to the desktop.
     261             :     virtual Rectangle GetBoundingBoxOnScreen(void) const
     262             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     263             : 
     264             :     /// Return the object's current bounding box relative to the parent object.
     265             :     virtual Rectangle GetBoundingBox(void) const
     266             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     267             : private:
     268             :     ScTabViewShell* mpViewShell;
     269             :     ScRangeList*    mpMarkedRanges;
     270             :     std::vector<ScMyAddress>* mpSortedMarkedCells;
     271             :     ScAccessibleDocument* mpAccDoc;
     272             :     rtl::Reference<ScAccessibleCell> mpAccCell;
     273             :     Rectangle       maVisCells;
     274             :     ScSplitPos      meSplitPos;
     275             :     ScAddress       maActiveCell;
     276             :     SCTAB           mnTab;
     277             :     bool            mbIsSpreadsheet;
     278             :     bool            mbHasSelection;
     279             :     bool            mbDelIns;
     280             :     bool            mbIsFocusSend;
     281             : 
     282             :     bool IsDefunc(
     283             :         const com::sun::star::uno::Reference<
     284             :         ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
     285             :     bool IsEditable(
     286             :         const com::sun::star::uno::Reference<
     287             :         ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
     288             :     bool IsFocused();
     289             :     bool IsCompleteSheetSelected();
     290             : 
     291             :     void SelectCell(sal_Int32 nRow, sal_Int32 nCol, bool bDeselect);
     292             :     void CreateSortedMarkedCells();
     293             :     void AddMarkedRange(const ScRange& rRange);
     294             : 
     295             :     ScDocument* GetDocument(ScTabViewShell* pViewShell);
     296             :     Rectangle   GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
     297             :     Rectangle   GetVisCells(const Rectangle& rVisArea);
     298             :     typedef std::vector<ScMyAddress> VEC_MYADDR;
     299             : 
     300             :     typedef std::map<ScMyAddress,com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > >
     301             :         MAP_ADDR_XACC;
     302             :     MAP_ADDR_XACC m_mapSelectionSend;
     303             :     void RemoveSelection(ScMarkData &refScMarkData);
     304             :     bool IsSameMarkCell();
     305             :     void CommitFocusCell(const ScAddress &aNewCell);
     306             : public:
     307             :     void FireFirstCellFocus();
     308             : private:
     309             :     bool          m_bFormulaMode;
     310             :     bool          m_bFormulaLastMode;
     311             :     ScAddress     m_aFormulaActiveCell;
     312             :     MAP_ADDR_XACC m_mapFormulaSelectionSend;
     313             :     VEC_MYADDR    m_vecFormulaLastMyAddr;
     314             :     rtl::Reference<ScAccessibleCell> m_pAccFormulaCell;
     315             :     sal_uInt16    m_nMinX;
     316             :     sal_uInt16    m_nMaxX;
     317             :     sal_Int32     m_nMinY;
     318             :     sal_Int32     m_nMaxY;
     319             : 
     320           0 :     sal_Int32 GetRowAll() const { return m_nMaxY - m_nMinY + 1 ; }
     321           0 :     sal_uInt16  GetColAll() const { return m_nMaxX - m_nMinX + 1; }
     322             :     void NotifyRefMode();
     323             :     void RemoveFormulaSelection(bool bRemoveAll = false);
     324             :     bool CheckChildIndex(sal_Int32) const;
     325             :     ScAddress GetChildIndexAddress(sal_Int32) const;
     326             :     sal_Int32 GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn );
     327             :     bool GetFormulaCurrentFocusCell(ScAddress &addr);
     328             : public:
     329             :     ScRange       m_aLastWithInMarkRange;
     330             :     OUString      m_strCurCellValue;
     331             :     ScRangeList   m_LastMarkedRanges;
     332             :     typedef std::vector<ScRange*> VEC_RANGE;
     333             :     VEC_RANGE     m_vecTempRange;
     334             :     typedef std::pair<sal_uInt16,sal_uInt16> PAIR_COL;
     335             :     typedef std::vector<PAIR_COL> VEC_COL;
     336             :     VEC_COL       m_vecTempCol;
     337             :     OUString      m_strOldTabName;
     338             : 
     339             :     ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > GetActiveCell();
     340             :     bool IsScAddrFormulaSel (const ScAddress &addr) const;
     341             :     bool IsFormulaMode();
     342             :     ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex);
     343             :     bool CalcScRangeDifferenceMax(ScRange *pSrc,ScRange *pDest,int nMax,VEC_MYADDR &vecRet,int &nSize);
     344             :     bool CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,VEC_MYADDR &vecRet);
     345             : };
     346             : 
     347             : #endif
     348             : 
     349             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10