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

Generated by: LCOV version 1.11