xref: /trunk/main/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX
25 #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX
26 
27 #include <accessibility/standard/vclxaccessibletextcomponent.hxx>
28 #include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
29 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
30 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
31 #endif
32 
33 #ifndef _CPPUHELPER_IMPLBASE2_HXX
34 #include <cppuhelper/implbase2.hxx>
35 #endif
36 
37 
38 //  ----------------------------------------------------
39 //  class VCLXAccessibleEdit
40 //  ----------------------------------------------------
41 
42 typedef ::cppu::ImplHelper2<
43     ::com::sun::star::accessibility::XAccessibleAction,
44     ::com::sun::star::accessibility::XAccessibleEditableText > VCLXAccessibleEdit_BASE;
45 
46 class VCLXAccessibleEdit : public VCLXAccessibleTextComponent,
47                            public VCLXAccessibleEdit_BASE
48 {
49     friend class VCLXAccessibleBox;
50 
51 private:
52     sal_Int32   m_nSelectionStart;
53     sal_Int32   m_nCaretPosition;
54 
55 protected:
56     virtual ~VCLXAccessibleEdit();
57 
58     virtual void                ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
59     virtual void                FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
60 
61     // OCommonAccessibleText
62     virtual ::rtl::OUString     implGetText();
63     virtual void                implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
64 
65 public:
66     VCLXAccessibleEdit( VCLXWindow* pVCLXindow );
67 
68     // XInterface
69     DECLARE_XINTERFACE()
70 
71     // XTypeProvider
72     DECLARE_XTYPEPROVIDER()
73 
74     // XServiceInfo
75     virtual ::rtl::OUString SAL_CALL getImplementationName();
76     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
77 
78     // XAccessibleContext
79     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  );
80     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i );
81     virtual sal_Int16 SAL_CALL getAccessibleRole(  );
82 
83     // XAccessibleAction
84     virtual sal_Int32 SAL_CALL getAccessibleActionCount( );
85     virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex );
86     virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex );
87     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex );
88 
89     // XAccessibleText
90     virtual sal_Int32 SAL_CALL getCaretPosition(  );
91     virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex );
92     virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex );
93     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes );
94     virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex );
95     virtual sal_Int32 SAL_CALL getCharacterCount(  );
96     virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint );
97     virtual ::rtl::OUString SAL_CALL getSelectedText(  );
98     virtual sal_Int32 SAL_CALL getSelectionStart(  );
99     virtual sal_Int32 SAL_CALL getSelectionEnd(  );
100     virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
101     virtual ::rtl::OUString SAL_CALL getText(  );
102     virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
103     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType );
104     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType );
105     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType );
106     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
107 
108     // XAccessibleEditableText
109     virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
110     virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex );
111     virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
112     virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex );
113     virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement );
114     virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet );
115     virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText );
116 };
117 
118 #endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX
119