1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_UNOEDPRX_HXX
21 #define _SVX_UNOEDPRX_HXX
24 #include <svl/brdcst.hxx>
25 #include <editeng/unoedsrc.hxx>
27 #include <editeng/editdata.hxx>
28 #include "editeng/editengdllapi.h"
30 class SvxAccessibleTextAdapter
: public SvxTextForwarder
33 SvxAccessibleTextAdapter();
34 virtual ~SvxAccessibleTextAdapter();
36 virtual sal_Int32
GetParagraphCount() const;
37 virtual sal_uInt16
GetTextLen( sal_Int32 nParagraph
) const;
38 virtual String
GetText( const ESelection
& rSel
) const;
39 virtual SfxItemSet
GetAttribs( const ESelection
& rSel
, sal_Bool bOnlyHardAttrib
= 0 ) const;
40 virtual SfxItemSet
GetParaAttribs( sal_Int32 nPara
) const;
41 virtual void SetParaAttribs( sal_Int32 nPara
, const SfxItemSet
& rSet
);
42 virtual void RemoveAttribs( const ESelection
& rSelection
, sal_Bool bRemoveParaAttribs
, sal_uInt16 nWhich
);
43 virtual void GetPortions( sal_Int32 nPara
, std::vector
<sal_uInt16
>& rList
) const;
45 virtual sal_uInt16
CalcEditEngineIndex( sal_Int32 nPara
, sal_Int32 nLogicalIndex
);
47 virtual sal_uInt16
GetItemState( const ESelection
& rSel
, sal_uInt16 nWhich
) const;
48 virtual sal_uInt16
GetItemState( sal_Int32 nPara
, sal_uInt16 nWhich
) const;
50 virtual void QuickInsertText( const String
& rText
, const ESelection
& rSel
);
51 virtual void QuickInsertField( const SvxFieldItem
& rFld
, const ESelection
& rSel
);
52 virtual void QuickSetAttribs( const SfxItemSet
& rSet
, const ESelection
& rSel
);
53 virtual void QuickInsertLineBreak( const ESelection
& rSel
);
55 virtual SfxItemPool
* GetPool() const;
57 virtual OUString
CalcFieldValue( const SvxFieldItem
& rField
, sal_Int32 nPara
, sal_uInt16 nPos
, Color
*& rpTxtColor
, Color
*& rpFldColor
);
58 virtual void FieldClicked( const SvxFieldItem
& rField
, sal_Int32 nPara
, xub_StrLen nPos
);
60 virtual sal_Bool
IsValid() const;
62 virtual LanguageType
GetLanguage( sal_Int32
, sal_uInt16
) const;
63 virtual sal_uInt16
GetFieldCount( sal_Int32 nPara
) const;
64 virtual EFieldInfo
GetFieldInfo( sal_Int32 nPara
, sal_uInt16 nField
) const;
65 virtual EBulletInfo
GetBulletInfo( sal_Int32 nPara
) const;
66 virtual Rectangle
GetCharBounds( sal_Int32 nPara
, sal_uInt16 nIndex
) const;
67 virtual Rectangle
GetParaBounds( sal_Int32 nPara
) const;
68 virtual MapMode
GetMapMode() const;
69 virtual OutputDevice
* GetRefDevice() const;
70 virtual sal_Bool
GetIndexAtPoint( const Point
&, sal_Int32
& nPara
, sal_uInt16
& nIndex
) const;
71 virtual sal_Bool
GetWordIndices( sal_Int32 nPara
, sal_uInt16 nIndex
, sal_uInt16
& nStart
, sal_uInt16
& nEnd
) const;
72 virtual sal_Bool
GetAttributeRun( sal_uInt16
& nStartIndex
, sal_uInt16
& nEndIndex
, sal_Int32 nPara
, sal_uInt16 nIndex
) const;
73 virtual sal_uInt16
GetLineCount( sal_Int32 nPara
) const;
74 virtual sal_uInt16
GetLineLen( sal_Int32 nPara
, sal_uInt16 nLine
) const;
75 virtual void GetLineBoundaries( /*out*/sal_uInt16
&rStart
, /*out*/sal_uInt16
&rEnd
, sal_Int32 nParagraph
, sal_uInt16 nLine
) const;
76 virtual sal_uInt16
GetLineNumberAtIndex( sal_Int32 nPara
, sal_uInt16 nIndex
) const;
78 virtual sal_Bool
Delete( const ESelection
& );
79 virtual sal_Bool
InsertText( const String
&, const ESelection
& );
80 virtual sal_Bool
QuickFormatDoc( sal_Bool bFull
=sal_False
);
81 virtual sal_Int16
GetDepth( sal_Int32 nPara
) const;
82 virtual sal_Bool
SetDepth( sal_Int32 nPara
, sal_Int16 nNewDepth
);
84 virtual const SfxItemSet
* GetEmptyItemSetPtr();
86 // implementation functions for XParagraphAppend and XTextPortionAppend
87 // (not needed for accessibility, only for new import API)
88 virtual void AppendParagraph();
89 virtual xub_StrLen
AppendTextPortion( sal_Int32 nPara
, const String
&rText
, const SfxItemSet
&rSet
);
92 virtual void CopyText(const SvxTextForwarder
& rSource
);
94 void SetForwarder( SvxTextForwarder
& );
95 sal_Bool
HaveImageBullet( sal_Int32 nPara
) const;
96 sal_Bool
HaveTextBullet( sal_Int32 nPara
) const;
98 /** Query whether all text in given selection is editable
100 @return sal_True if every character in the given selection can
101 be changed, and sal_False if e.g. a field or a bullet is
104 sal_Bool
IsEditable( const ESelection
& rSelection
);
107 SvxTextForwarder
* mrTextForwarder
;
110 class SvxAccessibleTextEditViewAdapter
: public SvxEditViewForwarder
114 SvxAccessibleTextEditViewAdapter();
115 virtual ~SvxAccessibleTextEditViewAdapter();
117 // SvxViewForwarder interface
118 virtual sal_Bool
IsValid() const;
119 virtual Rectangle
GetVisArea() const;
120 virtual Point
LogicToPixel( const Point
& rPoint
, const MapMode
& rMapMode
) const;
121 virtual Point
PixelToLogic( const Point
& rPoint
, const MapMode
& rMapMode
) const;
123 // SvxEditViewForwarder interface
124 virtual sal_Bool
GetSelection( ESelection
& rSelection
) const;
125 virtual sal_Bool
SetSelection( const ESelection
& rSelection
);
126 virtual sal_Bool
Copy();
127 virtual sal_Bool
Cut();
128 virtual sal_Bool
Paste();
130 void SetForwarder( SvxEditViewForwarder
&, SvxAccessibleTextAdapter
& );
133 SvxEditViewForwarder
* mrViewForwarder
;
134 SvxAccessibleTextAdapter
* mrTextForwarder
;
137 class EDITENG_DLLPUBLIC SvxEditSourceAdapter
: public SvxEditSource
140 SvxEditSourceAdapter();
141 ~SvxEditSourceAdapter();
143 virtual SvxEditSource
* Clone() const;
144 virtual SvxTextForwarder
* GetTextForwarder();
145 SvxAccessibleTextAdapter
* GetTextForwarderAdapter(); // covariant return types don't work on MSVC
146 virtual SvxViewForwarder
* GetViewForwarder();
147 virtual SvxEditViewForwarder
* GetEditViewForwarder( sal_Bool bCreate
= sal_False
);
148 SvxAccessibleTextEditViewAdapter
* GetEditViewForwarderAdapter( sal_Bool bCreate
= sal_False
); // covariant return types don't work on MSVC
149 virtual void UpdateData();
150 virtual SfxBroadcaster
& GetBroadcaster() const;
152 SAL_WNODEPRECATED_DECLARATIONS_PUSH
153 void SetEditSource( ::std::auto_ptr
< SvxEditSource
> pAdaptee
);
154 SAL_WNODEPRECATED_DECLARATIONS_POP
155 sal_Bool
IsValid() const;
158 // declared, but not defined
159 SvxEditSourceAdapter( const SvxEditSourceAdapter
& );
160 SvxEditSourceAdapter
& operator= ( const SvxEditSourceAdapter
& );
162 SAL_WNODEPRECATED_DECLARATIONS_PUSH
163 ::std::auto_ptr
< SvxEditSource
> mpAdaptee
;
164 SAL_WNODEPRECATED_DECLARATIONS_POP
166 SvxAccessibleTextAdapter maTextAdapter
;
167 SvxAccessibleTextEditViewAdapter maEditViewAdapter
;
169 mutable SfxBroadcaster maDummyBroadcaster
;
171 sal_Bool mbEditSourceValid
;
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */