merge the formfield patch from ooo-build
[ooovba.git] / svx / source / inc / unoedprx.hxx
blob8edb9c773d6e7482db537ce98bd900e601282ca0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoedprx.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_UNOEDPRX_HXX
32 #define _SVX_UNOEDPRX_HXX
34 #include <memory>
35 #include <svtools/brdcst.hxx>
36 #include <svx/unoedsrc.hxx>
38 #include <svx/editdata.hxx>
41 class SvxAccessibleTextAdapter : public SvxTextForwarder
43 public:
44 SvxAccessibleTextAdapter();
45 virtual ~SvxAccessibleTextAdapter();
47 virtual USHORT GetParagraphCount() const;
48 virtual USHORT GetTextLen( USHORT nParagraph ) const;
49 virtual String GetText( const ESelection& rSel ) const;
50 virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = 0 ) const;
51 virtual SfxItemSet GetParaAttribs( USHORT nPara ) const;
52 virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet );
53 virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
54 virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const;
56 virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const;
57 virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const;
59 virtual void QuickInsertText( const String& rText, const ESelection& rSel );
60 virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
61 virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
62 virtual void QuickInsertLineBreak( const ESelection& rSel );
64 virtual SfxItemPool* GetPool() const;
66 virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor );
67 virtual BOOL IsValid() const;
69 virtual LanguageType GetLanguage( USHORT, USHORT ) const;
70 virtual USHORT GetFieldCount( USHORT nPara ) const;
71 virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const;
72 virtual EBulletInfo GetBulletInfo( USHORT nPara ) const;
73 virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const;
74 virtual Rectangle GetParaBounds( USHORT nPara ) const;
75 virtual MapMode GetMapMode() const;
76 virtual OutputDevice* GetRefDevice() const;
77 virtual sal_Bool GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const;
78 virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const;
79 virtual sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const;
80 virtual USHORT GetLineCount( USHORT nPara ) const;
81 virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const;
82 virtual void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const;
83 virtual USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const;
85 virtual sal_Bool Delete( const ESelection& );
86 virtual sal_Bool InsertText( const String&, const ESelection& );
87 virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE );
88 virtual sal_Int16 GetDepth( USHORT nPara ) const;
89 virtual sal_Bool SetDepth( USHORT nPara, sal_Int16 nNewDepth );
91 virtual const SfxItemSet* GetEmptyItemSetPtr();
93 // implementation functions for XParagraphAppend and XTextPortionAppend
94 // (not needed for accessibility, only for new import API)
95 virtual void AppendParagraph();
96 virtual xub_StrLen AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet &rSet );
98 //XTextCopy
99 virtual void CopyText(const SvxTextForwarder& rSource);
101 void SetForwarder( SvxTextForwarder& );
102 sal_Bool HaveImageBullet( USHORT nPara ) const;
103 sal_Bool HaveTextBullet( USHORT nPara ) const;
105 /** Query whether all text in given selection is editable
107 @return sal_True if every character in the given selection can
108 be changed, and sal_False if e.g. a field or a bullet is
109 contained therein.
111 sal_Bool IsEditable( const ESelection& rSelection );
113 private:
114 SvxTextForwarder* mrTextForwarder;
117 class SvxAccessibleTextEditViewAdapter : public SvxEditViewForwarder
119 public:
121 SvxAccessibleTextEditViewAdapter();
122 virtual ~SvxAccessibleTextEditViewAdapter();
124 // SvxViewForwarder interface
125 virtual BOOL IsValid() const;
126 virtual Rectangle GetVisArea() const;
127 virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
128 virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
130 // SvxEditViewForwarder interface
131 virtual sal_Bool GetSelection( ESelection& rSelection ) const;
132 virtual sal_Bool SetSelection( const ESelection& rSelection );
133 virtual sal_Bool Copy();
134 virtual sal_Bool Cut();
135 virtual sal_Bool Paste();
137 void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& );
139 private:
140 SvxEditViewForwarder* mrViewForwarder;
141 SvxAccessibleTextAdapter* mrTextForwarder;
144 class SvxEditSourceAdapter : public SvxEditSource
146 public:
147 SvxEditSourceAdapter();
148 ~SvxEditSourceAdapter();
150 virtual SvxEditSource* Clone() const;
151 virtual SvxTextForwarder* GetTextForwarder();
152 SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC
153 virtual SvxViewForwarder* GetViewForwarder();
154 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
155 SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( sal_Bool bCreate = sal_False ); // covariant return types don't work on MSVC
156 virtual void UpdateData();
157 virtual SfxBroadcaster& GetBroadcaster() const;
159 void SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee );
160 sal_Bool IsValid() const;
162 private:
163 // declared, but not defined
164 SvxEditSourceAdapter( const SvxEditSourceAdapter& );
165 SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& );
167 ::std::auto_ptr< SvxEditSource > mpAdaptee;
169 SvxAccessibleTextAdapter maTextAdapter;
170 SvxAccessibleTextEditViewAdapter maEditViewAdapter;
172 mutable SfxBroadcaster maDummyBroadcaster;
174 sal_Bool mbEditSourceValid;
177 #endif