LCOV - code coverage report
Current view: top level - sc/source/ui/inc - AccessibleCsvControl.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 5 0.0 %
Date: 2014-11-03 Functions: 0 5 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 INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLECSVCONTROL_HXX
      21             : #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLECSVCONTROL_HXX
      22             : 
      23             : #include <com/sun/star/accessibility/XAccessibleText.hpp>
      24             : #include <com/sun/star/accessibility/XAccessibleTable.hpp>
      25             : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
      26             : #include <tools/gen.hxx>
      27             : #include <rtl/ustrbuf.hxx>
      28             : #include <cppuhelper/implbase1.hxx>
      29             : #include <cppuhelper/implbase2.hxx>
      30             : #include <editeng/AccessibleStaticTextBase.hxx>
      31             : #include <comphelper/uno3.hxx>
      32             : #include "AccessibleContextBase.hxx"
      33             : 
      34             : class ScCsvControl;
      35             : namespace utl { class AccessibleStateSetHelper; }
      36             : 
      37             : /** Accessible base class used for CSV controls. */
      38             : class ScAccessibleCsvControl : public ScAccessibleContextBase
      39             : {
      40             : protected:
      41             :     typedef ::com::sun::star::uno::Reference<
      42             :         ::com::sun::star::accessibility::XAccessible > XAccessibleRef;
      43             :     typedef ::com::sun::star::uno::Reference<
      44             :         ::com::sun::star::accessibility::XAccessibleRelationSet > XAccessibleRelationSetRef;
      45             :     typedef ::com::sun::star::uno::Reference<
      46             :         ::com::sun::star::accessibility::XAccessibleStateSet > XAccessibleStateSetRef;
      47             : 
      48             :     typedef ::com::sun::star::awt::Point        AwtPoint;
      49             :     typedef ::com::sun::star::awt::Size         AwtSize;
      50             :     typedef ::com::sun::star::awt::Rectangle    AwtRectangle;
      51             : 
      52             : private:
      53             :     ScCsvControl*               mpControl;          /// Pointer to the VCL control.
      54             : 
      55             : public:
      56             :     explicit                    ScAccessibleCsvControl(
      57             :                                     const XAccessibleRef& rxParent,
      58             :                                     ScCsvControl& rControl,
      59             :                                     sal_uInt16 nRole );
      60             :     virtual                     ~ScAccessibleCsvControl();
      61             : 
      62             :     using ScAccessibleContextBase::disposing;
      63             :     virtual void SAL_CALL       disposing() SAL_OVERRIDE;
      64             : 
      65             :     /** Returns true, if the control is visible. */
      66             :     virtual bool SAL_CALL isVisible() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      67             : 
      68             :     // XAccessibleComponent ---------------------------------------------------
      69             : 
      70             :     /** Returns the child at the specified point (cell returns NULL). */
      71             :     virtual XAccessibleRef SAL_CALL getAccessibleAtPoint( const AwtPoint& rPoint )
      72             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      73             : 
      74             :     /** Sets the focus to this control. */
      75             :     virtual void SAL_CALL grabFocus() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      76             : 
      77             :     // events -----------------------------------------------------------------
      78             : public:
      79             :     /** Sends a GetFocus or LoseFocus event to all listeners. */
      80             :     virtual void SendFocusEvent( bool bFocused );
      81             :     /** Sends a caret changed event to all listeners. */
      82             :     virtual void SendCaretEvent();
      83             :     /** Sends a visible area changed event to all listeners. */
      84             :     virtual void SendVisibleEvent();
      85             :     /** Sends a selection changed event to all listeners. */
      86             :     virtual void SendSelectionEvent();
      87             :     /** Sends a table model changed event for changed cell contents to all listeners. */
      88             :     virtual void SendTableUpdateEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn, bool bAllRows );
      89             :     /** Sends a table model changed event for an inserted column to all listeners. */
      90             :     virtual void SendInsertColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn );
      91             :     /** Sends a table model changed event for a removed column to all listeners. */
      92             :     virtual void SendRemoveColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn );
      93             : 
      94             :     // helpers ----------------------------------------------------------------
      95             : protected:
      96             :     /** Returns this object's current bounding box relative to the desktop. */
      97             :     virtual Rectangle GetBoundingBoxOnScreen() const throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      98             :     /** Returns this object's current bounding box relative to the parent object. */
      99             :     virtual Rectangle GetBoundingBox() const throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     100             : 
     101             :     /** Returns whether the object is alive. Must be called with locked mutex. */
     102           0 :     inline bool implIsAlive() const { return !rBHelper.bDisposed && !rBHelper.bInDispose && mpControl; }
     103             :     /** Throws an exception, if the object is disposed/disposing or any pointer
     104             :         is missing. Should be used with locked mutex! */
     105             :     void ensureAlive() const throw( ::com::sun::star::lang::DisposedException );
     106             : 
     107             :     /** Returns the VCL control. Assumes a living object. */
     108             :     ScCsvControl& implGetControl() const;
     109             : 
     110             :     /** Returns the first child of rxParentObj, which has the role nRole. */
     111             :     XAccessibleRef implGetChildByRole( const XAccessibleRef& rxParentObj, sal_uInt16 nRole )
     112             :         throw( ::com::sun::star::uno::RuntimeException );
     113             :     /** Creates a StateSetHelper and fills it with DEFUNC, OPAQUE, ENABLED, SHOWING and VISIBLE. */
     114             :     ::utl::AccessibleStateSetHelper* implCreateStateSet();
     115             : 
     116             :     /** Disposes the object. This is a helper called from destructors only. */
     117             :     void implDispose();
     118             : 
     119             :     /** Converts the control-relative position to an absolute screen position. */
     120             :     Point implGetAbsPos( const Point& rPos ) const;
     121             : };
     122             : 
     123             : class ScCsvRuler;
     124             : 
     125             : typedef ::cppu::ImplHelper1<
     126             :         ::com::sun::star::accessibility::XAccessibleText >
     127             :     ScAccessibleCsvRulerImpl;
     128             : 
     129             : /** Accessible class representing the CSV ruler control. */
     130             : class ScAccessibleCsvRuler : public ScAccessibleCsvControl, public ScAccessibleCsvRulerImpl
     131             : {
     132             : protected:
     133             :     typedef ::com::sun::star::uno::Sequence<
     134             :         ::com::sun::star::beans::PropertyValue > PropertyValueSeq;
     135             : 
     136             : private:
     137             :     OUStringBuffer       maBuffer;   /// Contains the text representation of the ruler.
     138             : 
     139             : public:
     140             :     explicit                    ScAccessibleCsvRuler( ScCsvRuler& rRuler );
     141             :     virtual                     ~ScAccessibleCsvRuler();
     142             : 
     143             :     // XAccessibleComponent -----------------------------------------------------
     144             : 
     145             :     virtual sal_Int32 SAL_CALL getForeground(  )
     146             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     147             : 
     148             :     virtual sal_Int32 SAL_CALL getBackground(  )
     149             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     150             : 
     151             :     // XAccessibleContext -----------------------------------------------------
     152             : 
     153             :     /** Returns the child count (the ruler does not have children). */
     154             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
     155             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     156             : 
     157             :     /** Throws an exception (the ruler does not have children). */
     158             :     virtual XAccessibleRef SAL_CALL getAccessibleChild( sal_Int32 nIndex )
     159             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     160             : 
     161             :     /** Returns the relation to the grid control. */
     162             :     virtual XAccessibleRelationSetRef SAL_CALL getAccessibleRelationSet()
     163             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     164             : 
     165             :     /** Returns the current set of states. */
     166             :     virtual XAccessibleStateSetRef SAL_CALL getAccessibleStateSet()
     167             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     168             : 
     169             :     // XAccessibleText --------------------------------------------------------
     170             : 
     171             :     /** Return the position of the caret. */
     172             :     virtual sal_Int32 SAL_CALL getCaretPosition() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     173             : 
     174             :     /** Sets the position of the caret. */
     175             :     virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex )
     176             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     177             : 
     178             :     /** Returns the specified character. */
     179             :     virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex )
     180             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     181             : 
     182             :     /** Returns the attributes of the specified character. */
     183             :     virtual PropertyValueSeq SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes )
     184             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     185             : 
     186             :     /** Returns the screen coordinates of the specified character. */
     187             :     virtual AwtRectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex )
     188             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     189             : 
     190             :     /** Returns the count of characters. */
     191             :     virtual sal_Int32 SAL_CALL getCharacterCount() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     192             : 
     193             :     /** Returns the character index at the specified coordinate (object's coordinate system). */
     194             :     virtual sal_Int32 SAL_CALL getIndexAtPoint( const AwtPoint& rPoint )
     195             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     196             : 
     197             :     /** Returns the selected text (ruler returns empty string). */
     198             :     virtual OUString SAL_CALL getSelectedText() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     199             : 
     200             :     /** Returns the start index of the selection (ruler returns -1). */
     201             :     virtual sal_Int32 SAL_CALL getSelectionStart() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     202             : 
     203             :     /** Returns the end index of the selection (ruler returns -1). */
     204             :     virtual sal_Int32 SAL_CALL getSelectionEnd() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     205             : 
     206             :     /** Selects a part of the text (ruler does nothing). */
     207             :     virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
     208             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     209             : 
     210             :     /** Returns the entire text. */
     211             :     virtual OUString SAL_CALL getText() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     212             : 
     213             :     /** Returns the specified range [Start,End) of the text. */
     214             :     virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
     215             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     216             : 
     217             :     /** Returns the specified text portion. */
     218             :     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     219             :     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     220             :     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     221             : 
     222             :     /** Copies the specified text range into the clipboard (ruler does nothing). */
     223             :     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
     224             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     225             : 
     226             :     // XInterface -------------------------------------------------------------
     227             : 
     228             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
     229             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     230             : 
     231             :     virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     232             : 
     233             :     virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     234             : 
     235             :     // XServiceInfo -----------------------------------------------------------
     236             : 
     237             :     /** Returns an identifier for the implementation of this object. */
     238             :     virtual OUString SAL_CALL getImplementationName()
     239             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     240             : 
     241             :     // XTypeProvider ----------------------------------------------------------
     242             : 
     243             :     /** Returns a sequence with all supported interface types. */
     244             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
     245             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     246             : 
     247             :     /** Returns an implementation ID. */
     248             :     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
     249             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     250             : 
     251             :     // events -----------------------------------------------------------------
     252             : public:
     253             :     /** Sends a caret changed event to all listeners. */
     254             :     virtual void SendCaretEvent() SAL_OVERRIDE;
     255             : 
     256             :     // helpers ----------------------------------------------------------------
     257             : private:
     258             :     /** Returns this object's name. */
     259             :     virtual OUString SAL_CALL createAccessibleName()
     260             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     261             :     /** Returns this object's description. */
     262             :     virtual OUString SAL_CALL createAccessibleDescription()
     263             :         throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
     264             : 
     265             :     /** Throws an exception, if the specified character position is invalid (outside 0..len-1). */
     266             :     void ensureValidIndex( sal_Int32 nIndex ) const
     267             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException );
     268             :     /** Throws an exception, if the specified character position is invalid (outside 0..len). */
     269             :     void ensureValidIndexWithEnd( sal_Int32 nIndex ) const
     270             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException );
     271             :     /** Throws an exception, if the specified character range [Start,End) is invalid.
     272             :         @descr  If Start>End, swaps Start and End before checking. */
     273             :     void ensureValidRange( sal_Int32& rnStartIndex, sal_Int32& rnEndIndex ) const
     274             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException );
     275             : 
     276             :     /** Returns the VCL ruler control. Assumes a living object. */
     277             :     ScCsvRuler& implGetRuler() const;
     278             : 
     279             :     /** Builds the entire string buffer. */
     280             :     void constructStringBuffer() throw( ::com::sun::star::uno::RuntimeException );
     281             :     /** Returns the character count of the text. */
     282             :     sal_Int32 implGetTextLength() const;
     283             : 
     284             :     /** Returns true, if the character at the specified index has a split. */
     285             :     bool implHasSplit( sal_Int32 nApiPos );
     286             : 
     287             :     /** Returns the first character index with equal formatting as at nApiPos. */
     288             :     sal_Int32 implGetFirstEqualFormatted( sal_Int32 nApiPos );
     289             :     /** Returns the last character index with equal formatting as at nApiPos. */
     290             :     sal_Int32 implGetLastEqualFormatted( sal_Int32 nApiPos );
     291             : };
     292             : 
     293             : class ScCsvGrid;
     294             : 
     295             : typedef ::cppu::ImplHelper2<
     296             :         ::com::sun::star::accessibility::XAccessibleTable,
     297             :         ::com::sun::star::accessibility::XAccessibleSelection >
     298             :     ScAccessibleCsvGridImpl;
     299             : 
     300             : /** Accessible class representing the CSV grid control. */
     301             : class ScAccessibleCsvGrid : public ScAccessibleCsvControl, public ScAccessibleCsvGridImpl
     302             : {
     303             : protected:
     304             :     typedef ::com::sun::star::uno::Reference<
     305             :         ::com::sun::star::accessibility::XAccessibleTable > XAccessibleTableRef;
     306             : 
     307             : public:
     308             :     explicit                    ScAccessibleCsvGrid( ScCsvGrid& rGrid );
     309             :     virtual                     ~ScAccessibleCsvGrid();
     310             : 
     311             :     // XAccessibleComponent ---------------------------------------------------
     312             : 
     313             :     /** Returns the cell at the specified point. */
     314             :     virtual XAccessibleRef SAL_CALL getAccessibleAtPoint( const AwtPoint& rPoint )
     315             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     316             : 
     317             :     virtual sal_Int32 SAL_CALL getForeground(  )
     318             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     319             : 
     320             :     virtual sal_Int32 SAL_CALL getBackground(  )
     321             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     322             : 
     323             :     // XAccessibleContext -----------------------------------------------------
     324             : 
     325             :     /** Returns the child count (count of cells in the table). */
     326             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
     327             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     328             : 
     329             :     /** Returns the specified child cell. */
     330             :     virtual XAccessibleRef SAL_CALL getAccessibleChild( sal_Int32 nIndex )
     331             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     332             : 
     333             :     /** Returns the relation to the ruler control. */
     334             :     virtual XAccessibleRelationSetRef SAL_CALL getAccessibleRelationSet()
     335             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     336             : 
     337             :     /** Returns the current set of states. */
     338             :     virtual XAccessibleStateSetRef SAL_CALL getAccessibleStateSet()
     339             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     340             : 
     341             :     // XAccessibleTable -------------------------------------------------------
     342             : 
     343             :     /** Returns the number of rows in the table. */
     344             :     virtual sal_Int32 SAL_CALL getAccessibleRowCount()
     345             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     346             : 
     347             :     /** Returns the number of columns in the table. */
     348             :     virtual sal_Int32 SAL_CALL getAccessibleColumnCount()
     349             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     350             : 
     351             :     /** Returns the description of the specified row in the table. */
     352             :     virtual OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow )
     353             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     354             : 
     355             :     /** Returns the description text of the specified column in the table. */
     356             :     virtual OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn )
     357             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     358             : 
     359             :     /** Returns the number of rows occupied at a specified row and column.
     360             :         @descr  Returns always 1 (Merged cells not supported). */
     361             :     virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
     362             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     363             : 
     364             :     /** Returns the number of rows occupied at a specified row and column.
     365             :         @descr  Returns always 1 (Merged cells not supported). */
     366             :     virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
     367             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     368             : 
     369             :     /** Returns the row headers as an AccessibleTable. */
     370             :     virtual XAccessibleTableRef SAL_CALL getAccessibleRowHeaders()
     371             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     372             : 
     373             :     /** Returns the column headers as an AccessibleTable. */
     374             :     virtual XAccessibleTableRef SAL_CALL getAccessibleColumnHeaders()
     375             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     376             : 
     377             :     /** Returns the selected rows as a sequence. */
     378             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows()
     379             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     380             : 
     381             :     /** Returns the selected columns as a sequence. */
     382             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns()
     383             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     384             : 
     385             :     /** Returns true, if the specified row is selected. */
     386             :     virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
     387             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     388             : 
     389             :     /** Returns true, if the specified column is selected. */
     390             :     virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
     391             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     392             : 
     393             :     /** Returns the accessible cell object at the specified position. */
     394             :     virtual XAccessibleRef SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
     395             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     396             : 
     397             :     /** Returns the caption object of the table. */
     398             :     virtual XAccessibleRef SAL_CALL getAccessibleCaption()
     399             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     400             : 
     401             :     /** Returns the summary description object of the table. */
     402             :     virtual XAccessibleRef SAL_CALL getAccessibleSummary()
     403             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     404             : 
     405             :     /** Returns true, if the cell at a specified position is selected. */
     406             :     virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
     407             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     408             : 
     409             :     /** Returns the child index of the cell at the specified position. */
     410             :     virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
     411             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     412             : 
     413             :     /** Returns the row index of the specified child. */
     414             :     virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
     415             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     416             : 
     417             :     /** Returns the column index of the specified child. */
     418             :     virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
     419             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     420             : 
     421             :     // XAccessibleSelection ---------------------------------------------------
     422             : 
     423             :     /** Selects the specified child (selects the entire column or the entire table). */
     424             :     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex )
     425             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     426             : 
     427             :     /** Returns true, if the specified child is selected. */
     428             :     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex )
     429             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     430             : 
     431             :     /** Deselects all cells. */
     432             :     virtual void SAL_CALL clearAccessibleSelection()
     433             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     434             : 
     435             :     /** Selects all cells. */
     436             :     virtual void SAL_CALL selectAllAccessibleChildren()
     437             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     438             : 
     439             :     /** Returns the count of selected children. */
     440             :     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount()
     441             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     442             : 
     443             :     /** Returns the child with the specified index in all selected children. */
     444             :     virtual XAccessibleRef SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
     445             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     446             : 
     447             :     /** Deselects the child with the specified index in all selected children. */
     448             :     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
     449             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     450             : 
     451             :     // XInterface -------------------------------------------------------------
     452             : 
     453             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
     454             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     455             : 
     456             :     virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     457             : 
     458             :     virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     459             : 
     460             :     // XServiceInfo -----------------------------------------------------------
     461             : 
     462             :     /** Returns an identifier for the implementation of this object. */
     463             :     virtual OUString SAL_CALL getImplementationName()
     464             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     465             : 
     466             :     // XTypeProvider ----------------------------------------------------------
     467             : 
     468             :     /** Returns a sequence with all supported interface types. */
     469             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
     470             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     471             : 
     472             :     /** Returns an implementation ID. */
     473             :     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
     474             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     475             : 
     476             :     // events -----------------------------------------------------------------
     477             : public:
     478             :     /** Sends a GetFocus or LoseFocus event to all listeners. */
     479             :     virtual void SendFocusEvent( bool bFocused ) SAL_OVERRIDE;
     480             :     /** Sends a table model changed event for changed cell contents to all listeners. */
     481             :     virtual void SendTableUpdateEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn, bool bAllRows ) SAL_OVERRIDE;
     482             :     /** Sends a table model changed event for an inserted column to all listeners. */
     483             :     virtual void SendInsertColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn ) SAL_OVERRIDE;
     484             :     /** Sends a table model changed event for a removed column to all listeners. */
     485             :     virtual void SendRemoveColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn ) SAL_OVERRIDE;
     486             : 
     487             :     // helpers ----------------------------------------------------------------
     488             : private:
     489             :     /** Returns this object's name. */
     490             :     virtual OUString SAL_CALL createAccessibleName()
     491             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     492             :     /** Returns this object's description. */
     493             :     virtual OUString SAL_CALL createAccessibleDescription()
     494             :         throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
     495             : 
     496             :     /** Throws an exception, if nIndex is not a valid child index. */
     497             :     void ensureValidIndex( sal_Int32 nIndex ) const
     498             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException );
     499             :     /** Throws an exception, if the specified position is invalid. */
     500             :     void ensureValidPosition( sal_Int32 nRow, sal_Int32 nColumn ) const
     501             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException );
     502             : 
     503             :     /** Returns the VCL grid control. Assumes a living object. */
     504             :     ScCsvGrid& implGetGrid() const;
     505             : 
     506             :     /** Returns true, if the specified column (including header) is selected. */
     507             :     bool implIsColumnSelected( sal_Int32 nColumn ) const;
     508             :     /** Selects the specified column (including header). */
     509             :     void implSelectColumn( sal_Int32 nColumn, bool bSelect );
     510             : 
     511             :     /** Returns the count of visible rows in the table (including header). */
     512             :     sal_Int32 implGetRowCount() const;
     513             :     /** Returns the total column count in the table (including header). */
     514             :     sal_Int32 implGetColumnCount() const;
     515             :     /** Returns the count of selected columns in the table. */
     516             :     sal_Int32 implGetSelColumnCount() const;
     517             :     /** Returns the total cell count in the table (including header). */
     518           0 :     inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); }
     519             : 
     520             :     /** Returns the row index from cell index (including header). */
     521           0 :     inline sal_Int32 implGetRow( sal_Int32 nIndex ) const { return nIndex / implGetColumnCount(); }
     522             :     /** Returns the column index from cell index (including header). */
     523           0 :     inline sal_Int32 implGetColumn( sal_Int32 nIndex ) const { return nIndex % implGetColumnCount(); }
     524             :     /** Returns the absolute column index of the nSelColumn-th selected column. */
     525             :     sal_Int32 implGetSelColumn( sal_Int32 nSelColumn ) const;
     526             :     /** Returns the child index from cell position (including header). */
     527           0 :     inline sal_Int32 implGetIndex( sal_Int32 nRow, sal_Int32 nColumn ) const { return nRow * implGetColumnCount() + nColumn; }
     528             : 
     529             :     /** Returns the contents of the specified cell (including header). Indexes must be valid. */
     530             :     OUString implGetCellText( sal_Int32 nRow, sal_Int32 nColumn ) const;
     531             :     /** Creates a new accessible object of the specified cell. Indexes must be valid. */
     532             :     ScAccessibleCsvControl* implCreateCellObj( sal_Int32 nRow, sal_Int32 nColumn ) const;
     533             : };
     534             : 
     535             : /** Accessible class representing a cell of the CSV grid control. */
     536             : class ScAccessibleCsvCell : public ScAccessibleCsvControl, public accessibility::AccessibleStaticTextBase
     537             : {
     538             : protected:
     539             :     typedef ::com::sun::star::uno::Sequence<
     540             :         ::com::sun::star::beans::PropertyValue >    PropertyValueSeq;
     541             :     typedef ::std::unique_ptr< SvxEditSource >      SvxEditSourcePtr;
     542             : 
     543             : private:
     544             :     OUString                    maCellText; /// The text contents of this cell.
     545             :     sal_Int32                   mnLine;     /// The grid line index (core index).
     546             :     sal_uInt32                  mnColumn;   /// The grid column index (core index).
     547             :     sal_Int32                   mnIndex;    /// The index of the cell in the table.
     548             : 
     549             : public:
     550             :     explicit                    ScAccessibleCsvCell(
     551             :                                     ScCsvGrid& rGrid,
     552             :                                     const OUString& rCellText,
     553             :                                     sal_Int32 nRow, sal_Int32 nColumn );
     554             :     virtual                     ~ScAccessibleCsvCell();
     555             : 
     556             :     using ScAccessibleCsvControl::disposing;
     557             :     virtual void SAL_CALL       disposing() SAL_OVERRIDE;
     558             : 
     559             :     // XAccessibleComponent ---------------------------------------------------
     560             : 
     561             :     /** Sets the focus to the column of this cell. */
     562             :     virtual void SAL_CALL grabFocus() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     563             : 
     564             :     virtual sal_Int32 SAL_CALL getForeground(  )
     565             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     566             : 
     567             :     virtual sal_Int32 SAL_CALL getBackground(  )
     568             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     569             : 
     570             :     // XAccessibleContext -----------------------------------------------------
     571             : 
     572             :     /** Returns the child count. */
     573             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
     574             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     575             : 
     576             :     /** Returns the specified child. */
     577             :     virtual XAccessibleRef SAL_CALL getAccessibleChild( sal_Int32 nIndex )
     578             :         throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     579             : 
     580             :     /** Returns the index of this cell in the table. */
     581             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
     582             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     583             : 
     584             :     /** Returns the relation to the ruler control. */
     585             :     virtual XAccessibleRelationSetRef SAL_CALL getAccessibleRelationSet()
     586             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     587             : 
     588             :     /** Returns the current set of states. */
     589             :     virtual XAccessibleStateSetRef SAL_CALL getAccessibleStateSet()
     590             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     591             : 
     592             :     // XInterface -------------------------------------------------------------
     593             : 
     594             :     DECLARE_XINTERFACE()
     595             : 
     596             :     // XTypeProvider ----------------------------------------------------------
     597             : 
     598             :     DECLARE_XTYPEPROVIDER()
     599             : 
     600             :     // XServiceInfo -----------------------------------------------------------
     601             : 
     602             :     /** Returns an identifier for the implementation of this object. */
     603             :     virtual OUString SAL_CALL getImplementationName()
     604             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     605             : 
     606             :     // helpers ----------------------------------------------------------------
     607             : protected:
     608             :     /** Returns this object's current bounding box relative to the desktop. */
     609             :     virtual Rectangle GetBoundingBoxOnScreen() const throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     610             :     /** Returns this object's current bounding box relative to the parent object. */
     611             :     virtual Rectangle GetBoundingBox() const throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     612             : 
     613             : private:
     614             :     /** Returns this object's name. */
     615             :     virtual OUString SAL_CALL createAccessibleName()
     616             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     617             :     /** Returns this object's description. */
     618             :     virtual OUString SAL_CALL createAccessibleDescription()
     619             :         throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
     620             : 
     621             :     /** Returns the VCL grid control. Assumes a living object. */
     622             :     ScCsvGrid& implGetGrid() const;
     623             :     /** Returns the pixel position of the cell (rel. to parent), regardless of visibility. */
     624             :     Point implGetRealPos() const;
     625             :     /** Returns the width of the character count */
     626             :     sal_uInt32 implCalcPixelWidth(sal_uInt32 nChars) const;
     627             :     /** Returns the pixel size of the cell, regardless of visibility. */
     628             :     Size implGetRealSize() const;
     629             :     /** Returns the bounding box of the cell relative in the table. */
     630             :     Rectangle implGetBoundingBox() const;
     631             : 
     632             :     /** Creates the edit source the text helper needs. */
     633             :     ::std::unique_ptr< SvxEditSource > implCreateEditSource();
     634             : };
     635             : 
     636             : #endif
     637             : 
     638             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10