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

Generated by: LCOV version 1.10