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 _SVX_UNOTEXT_HXX
21 : #define _SVX_UNOTEXT_HXX
22 :
23 : #include <com/sun/star/container/XNameContainer.hpp>
24 : #include <com/sun/star/text/XTextRange.hpp>
25 : #include <com/sun/star/text/XText.hpp>
26 : #include <com/sun/star/container/XEnumerationAccess.hpp>
27 : #include <com/sun/star/text/XTextRangeMover.hpp>
28 : #include <com/sun/star/text/XTextCursor.hpp>
29 : #include <com/sun/star/lang/XTypeProvider.hpp>
30 : #include <com/sun/star/lang/XServiceInfo.hpp>
31 : #include <com/sun/star/beans/PropertyAttribute.hpp>
32 : #include <com/sun/star/beans/XPropertySet.hpp>
33 : #include <com/sun/star/beans/XPropertyState.hpp>
34 : #include <com/sun/star/beans/XMultiPropertySet.hpp>
35 : #include <com/sun/star/text/XTextRangeCompare.hpp>
36 : #include <com/sun/star/beans/XMultiPropertyStates.hpp>
37 : #include <com/sun/star/text/XTextAppend.hpp>
38 : #include <com/sun/star/text/XTextCopy.hpp>
39 : #include <com/sun/star/text/XTextField.hpp>
40 : #include <com/sun/star/container/XIndexReplace.hpp>
41 : #include <com/sun/star/awt/FontSlant.hpp>
42 : #include <com/sun/star/awt/FontDescriptor.hpp>
43 : #include <com/sun/star/style/LineSpacing.hpp>
44 : #include <com/sun/star/style/TabStop.hpp>
45 : #include <com/sun/star/lang/XUnoTunnel.hpp>
46 : #include <cppuhelper/interfacecontainer.h>
47 : #include <cppuhelper/weak.hxx>
48 : #include <cppuhelper/weakagg.hxx>
49 : #include <osl/diagnose.hxx>
50 : #include <osl/mutex.hxx>
51 : #include <comphelper/servicehelper.hxx>
52 : #include <tools/link.hxx>
53 : #include <svl/itemprop.hxx>
54 : #include <svl/itemset.hxx>
55 : #include <svl/itempool.hxx>
56 : #include <svl/solar.hrc>
57 : #include <editeng/editdata.hxx>
58 : #include <editeng/unoedsrc.hxx>
59 : #include <editeng/eeitem.hxx>
60 : #include <editeng/editengdllapi.h>
61 : #include <editeng/memberids.hrc>
62 :
63 : class SvxItemPropertySet;
64 :
65 : #ifndef SEQTYPE
66 : #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
67 : #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
68 : #else
69 : #define SEQTYPE(x) &(x)
70 : #endif
71 : #endif
72 :
73 : #define WID_FONTDESC OWN_ATTR_VALUE_START
74 : #define WID_NUMLEVEL OWN_ATTR_VALUE_START+1
75 : #define WID_PORTIONTYPE OWN_ATTR_VALUE_START+2
76 : #define WID_NUMBERINGSTARTVALUE OWN_ATTR_VALUE_START+3
77 : #define WID_PARAISNUMBERINGRESTART OWN_ATTR_VALUE_START+4
78 :
79 : #define SVX_UNOEDIT_NUMBERING_PROPERTIE \
80 : {MAP_CHAR_LEN(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace>*)0), 0, 0 }, \
81 : {MAP_CHAR_LEN(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,&::getBooleanCppuType(), 0, 0 }
82 :
83 : #define SVX_UNOEDIT_OUTLINER_PROPERTIES \
84 : SVX_UNOEDIT_NUMBERING_PROPERTIE, \
85 : {MAP_CHAR_LEN(UNO_NAME_NUMBERING_LEVEL), WID_NUMLEVEL, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
86 : {MAP_CHAR_LEN("NumberingStartValue"), WID_NUMBERINGSTARTVALUE, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
87 : {MAP_CHAR_LEN("ParaIsNumberingRestart"), WID_PARAISNUMBERINGRESTART, &::getBooleanCppuType(), 0, 0 }
88 :
89 : #define SVX_UNOEDIT_CHAR_PROPERTIES \
90 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), EE_CHAR_FONTHEIGHT, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
91 : { MAP_CHAR_LEN("CharScaleWidth"), EE_CHAR_FONTWIDTH, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
92 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
93 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME),EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
94 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
95 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
96 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
97 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), EE_CHAR_ITALIC, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
98 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), EE_CHAR_WEIGHT, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
99 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE), EE_CHAR_LANGUAGE, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
100 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), EE_CHAR_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0 }, \
101 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int16*)0), 0, MID_ESC }, \
102 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
103 : { MAP_CHAR_LEN("CharUnderlineColor"), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
104 : { MAP_CHAR_LEN("CharUnderlineHasColor"), EE_CHAR_UNDERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
105 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_OVERLINE), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
106 : { MAP_CHAR_LEN("CharOverlineColor"), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
107 : { MAP_CHAR_LEN("CharOverlineHasColor"), EE_CHAR_OVERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
108 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_CROSSEDOUT), EE_CHAR_STRIKEOUT, &::getBooleanCppuType(), 0, MID_CROSSED_OUT }, \
109 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), EE_CHAR_STRIKEOUT, &::getCppuType((const sal_Int16*)0), 0, MID_CROSS_OUT}, \
110 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_SHADOWED), EE_CHAR_SHADOW, &::getBooleanCppuType(), 0, 0 }, \
111 : { MAP_CHAR_LEN("CharContoured"), EE_CHAR_OUTLINE, &::getBooleanCppuType(), 0, 0 }, \
112 : { MAP_CHAR_LEN("CharEscapementHeight"), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int8*)0), 0, MID_ESC_HEIGHT },\
113 : { MAP_CHAR_LEN("CharAutoKerning"), EE_CHAR_PAIRKERNING,&::getBooleanCppuType(), 0, 0 } , \
114 : { MAP_CHAR_LEN("CharKerning"), EE_CHAR_KERNING, &::getCppuType((const sal_Int16*)0) , 0, 0 }, \
115 : { MAP_CHAR_LEN("CharWordMode"), EE_CHAR_WLM, &::getBooleanCppuType(), 0, 0 }, \
116 : { MAP_CHAR_LEN("CharEmphasis"), EE_CHAR_EMPHASISMARK,&::getCppuType((const sal_Int16*)0), 0, MID_EMPHASIS},\
117 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN), EE_CHAR_FONTHEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
118 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
119 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
120 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
121 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
122 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
123 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_ASIAN), EE_CHAR_ITALIC_CJK, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
124 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN), EE_CHAR_WEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
125 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_ASIAN), EE_CHAR_LANGUAGE_CJK, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
126 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX), EE_CHAR_FONTHEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
127 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
128 : {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX),EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
129 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
130 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
131 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
132 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX), EE_CHAR_ITALIC_CTL, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
133 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX), EE_CHAR_WEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
134 : { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX), EE_CHAR_LANGUAGE_CTL, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
135 : { MAP_CHAR_LEN("CharRelief" ), EE_CHAR_RELIEF, &::getCppuType((const sal_Int16*)0), 0, MID_RELIEF }
136 :
137 : #define SVX_UNOEDIT_FONT_PROPERTIES \
138 : {MAP_CHAR_LEN(UNO_NAME_EDIT_FONT_DESCRIPTOR), WID_FONTDESC, &::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0), 0, MID_FONT_FAMILY_NAME }
139 :
140 : #define SVX_UNOEDIT_PARA_PROPERTIES \
141 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_PARA_ADJUST }, \
142 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_BMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_LO_MARGIN|SFX_METRIC_ITEM }, \
143 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HYPHEN), EE_PARA_HYPHENATE, &::getBooleanCppuType(), 0, 0 }, \
144 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LASTLINEADJ), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_LAST_LINE_ADJUST }, \
145 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_TXT_LMARGIN|SFX_METRIC_ITEM }, \
146 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LINESPACING), EE_PARA_SBL, &::getCppuType((const ::com::sun::star::style::LineSpacing*)0), 0, 0 }, \
147 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_RMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN|SFX_METRIC_ITEM }, \
148 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TAPSTOPS), EE_PARA_TABS, SEQTYPE(::getCppuType((const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >*)0)), 0, 0 }, \
149 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_UP_MARGIN|SFX_METRIC_ITEM },\
150 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_FIRST_LINE_INDENT|SFX_METRIC_ITEM}, \
151 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION),EE_PARA_HANGINGPUNCTUATION, &::getBooleanCppuType(), 0 ,0 }, \
152 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE), EE_PARA_ASIANCJKSPACING, &::getBooleanCppuType(), 0 ,0 }, \
153 : {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES), EE_PARA_FORBIDDENRULES, &::getBooleanCppuType(), 0 ,0 },\
154 : {MAP_CHAR_LEN("WritingMode"), EE_PARA_WRITINGDIR, &::getCppuType((const sal_Int16*)0), 0, 0 }
155 :
156 : class SvxEditSource;
157 : class SvxTextForwarder;
158 : class SvxFieldItem;
159 : class SvxTextEditSource;
160 : class SvxFieldData;
161 : struct ESelection;
162 :
163 : EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
164 : EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
165 :
166 : // ====================================================================
167 : // This class implements a SvxEditSource and SvxTextForwarder and does
168 : // nothing otherwise
169 : // ====================================================================
170 :
171 0 : class SvxDummyTextSource : public SvxEditSource, public SvxTextForwarder
172 : {
173 : public:
174 :
175 : // SvxEditSource
176 : virtual ~SvxDummyTextSource();
177 : virtual SvxEditSource* Clone() const;
178 : virtual SvxTextForwarder* GetTextForwarder();
179 : virtual void UpdateData();
180 :
181 : // SvxTextForwarder
182 : virtual sal_Int32 GetParagraphCount() const;
183 : virtual sal_uInt16 GetTextLen( sal_Int32 nParagraph ) const;
184 : virtual String GetText( const ESelection& rSel ) const;
185 : virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
186 : virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const;
187 : virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet );
188 : virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
189 : virtual void GetPortions( sal_Int32 nPara, std::vector<sal_uInt16>& rList ) const;
190 :
191 : sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
192 : sal_uInt16 GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const;
193 :
194 : virtual SfxItemPool* GetPool() const;
195 :
196 : virtual void QuickInsertText( const String& rText, const ESelection& rSel );
197 : virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
198 : virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
199 : virtual void QuickInsertLineBreak( const ESelection& rSel );
200 :
201 : virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
202 : virtual void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, xub_StrLen nPos );
203 :
204 : virtual sal_Bool IsValid() const;
205 :
206 : virtual void SetNotifyHdl( const Link& );
207 : virtual LanguageType GetLanguage( sal_Int32, sal_uInt16 ) const;
208 : virtual sal_uInt16 GetFieldCount( sal_Int32 nPara ) const;
209 : virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const;
210 : virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const;
211 : virtual Rectangle GetCharBounds( sal_Int32 nPara, sal_uInt16 nIndex ) const;
212 : virtual Rectangle GetParaBounds( sal_Int32 nPara ) const;
213 : virtual MapMode GetMapMode() const;
214 : virtual OutputDevice* GetRefDevice() const;
215 : virtual sal_Bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_uInt16& nIndex ) const;
216 : virtual sal_Bool GetWordIndices( sal_Int32 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
217 : virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex ) const;
218 : virtual sal_uInt16 GetLineCount( sal_Int32 nPara ) const;
219 : virtual sal_uInt16 GetLineLen( sal_Int32 nPara, sal_uInt16 nLine ) const;
220 : virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 nParagraph, sal_uInt16 nLine ) const;
221 : virtual sal_uInt16 GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nIndex ) const;
222 : virtual sal_Bool Delete( const ESelection& );
223 : virtual sal_Bool InsertText( const String&, const ESelection& );
224 : virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
225 : virtual sal_Int16 GetDepth( sal_Int32 nPara ) const;
226 : virtual sal_Bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth );
227 :
228 : virtual const SfxItemSet* GetEmptyItemSetPtr();
229 :
230 : // implementation functions for XParagraphAppend and XTextPortionAppend
231 : virtual void AppendParagraph();
232 : virtual xub_StrLen AppendTextPortion( sal_Int32 nPara, const String &rText, const SfxItemSet &rSet );
233 : //XTextCopy
234 : virtual void CopyText(const SvxTextForwarder& rSource);
235 : };
236 :
237 : namespace accessibility
238 : {
239 : class AccessibleEditableTextPara;
240 : }
241 :
242 : // ====================================================================
243 : class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTextRange,
244 : public ::com::sun::star::beans::XPropertySet,
245 : public ::com::sun::star::beans::XMultiPropertySet,
246 : public ::com::sun::star::beans::XMultiPropertyStates,
247 : public ::com::sun::star::beans::XPropertyState,
248 : public ::com::sun::star::lang::XServiceInfo,
249 : public ::com::sun::star::text::XTextRangeCompare,
250 : public ::com::sun::star::lang::XUnoTunnel,
251 : private osl::DebugBase<SvxUnoTextRangeBase>
252 :
253 : {
254 : friend class SvxUnoTextRangeEnumeration;
255 : friend class ::accessibility::AccessibleEditableTextPara;
256 :
257 : protected:
258 : SvxEditSource* mpEditSource;
259 : ESelection maSelection;
260 : const SvxItemPropertySet* mpPropSet;
261 :
262 : virtual void SAL_CALL _setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
263 : virtual ::com::sun::star::uno::Any SAL_CALL _getPropertyValue( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
264 :
265 : virtual void SAL_CALL _setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Int32 nPara = -1 ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
266 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL _getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara = -1 ) throw (::com::sun::star::uno::RuntimeException);
267 :
268 : virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
269 : virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
270 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL _getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
271 : // returns true if property found or false if unknown property
272 : virtual sal_Bool _getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::beans::PropertyState& rState);
273 :
274 : virtual void SAL_CALL _setPropertyToDefault( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
275 : virtual void _setPropertyToDefault( SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara ) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
276 : void SetEditSource( SvxEditSource* _pEditSource ) throw();
277 :
278 : virtual void getPropertyValue( const SfxItemPropertySimpleEntry* pMap, com::sun::star::uno::Any& rAny, const SfxItemSet& rSet ) throw(::com::sun::star::beans::UnknownPropertyException );
279 : virtual void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const com::sun::star::uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException );
280 :
281 : public:
282 : SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw();
283 : SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw();
284 : SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw();
285 : virtual ~SvxUnoTextRangeBase() throw();
286 :
287 : // Internal
288 24127 : const ESelection& GetSelection() const throw() { CheckSelection( ((SvxUnoTextRangeBase*)this)->maSelection, mpEditSource->GetTextForwarder() ); return maSelection; };
289 : void SetSelection( const ESelection& rSelection ) throw();
290 :
291 : virtual void CollapseToStart(void) throw();
292 : virtual void CollapseToEnd(void) throw();
293 : virtual sal_Bool IsCollapsed(void) throw();
294 : virtual sal_Bool GoLeft(sal_Int16 nCount, sal_Bool Expand) throw();
295 : virtual sal_Bool GoRight(sal_Int16 nCount, sal_Bool Expand) throw();
296 : virtual void GotoStart(sal_Bool Expand) throw();
297 : virtual void GotoEnd(sal_Bool Expand) throw();
298 :
299 : //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); }
300 4046 : const SvxItemPropertySet* getPropertySet() const throw() { return mpPropSet; }
301 59658 : SvxEditSource* GetEditSource() const throw() { return mpEditSource; }
302 :
303 : static sal_Bool SetPropertyValueHelper( const SfxItemSet& rOldSet, const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL );
304 : static sal_Bool GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::uno::Any& aAny, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL ) throw( ::com::sun::star::uno::RuntimeException );
305 :
306 : void attachField( const SvxFieldData* pData ) throw();
307 :
308 : UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase )
309 :
310 : // ::com::sun::star::text::XTextRange
311 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
312 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
313 : virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
314 : virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
315 :
316 : // ::com::sun::star::beans::XPropertySet
317 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
318 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
319 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
320 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
321 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
322 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
323 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
324 :
325 : // XMultiPropertySet
326 : virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
327 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
328 : virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
329 : virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
330 : virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
331 :
332 : // ::com::sun::star::beans::XPropertyState
333 : virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
334 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
335 : virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
336 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
337 :
338 : // ::com::sun::star::beans::XMultiPropertyStates
339 : //virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
340 : virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
341 : virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
342 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
343 :
344 : // XTextRangeCompare
345 : virtual ::sal_Int16 SAL_CALL compareRegionStarts( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
346 : virtual ::sal_Int16 SAL_CALL compareRegionEnds( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
347 :
348 : // ::com::sun::star::lang::XServiceInfo
349 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
350 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
351 : static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
352 : };
353 :
354 : // ====================================================================
355 :
356 : class SvxUnoTextBase;
357 : class EDITENG_DLLPUBLIC SvxUnoTextRange : public SvxUnoTextRangeBase,
358 : public ::com::sun::star::lang::XTypeProvider,
359 : public ::cppu::OWeakAggObject
360 : {
361 : friend class SvxUnoTextRangeEnumeration;
362 : private:
363 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
364 : sal_Bool mbPortion;
365 :
366 : public:
367 : SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw();
368 : virtual ~SvxUnoTextRange() throw();
369 :
370 : // ::com::sun::star::uno::XInterface
371 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
372 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
373 : virtual void SAL_CALL acquire() throw();
374 : virtual void SAL_CALL release() throw();
375 :
376 : // ::com::sun::star::text::XTextRange
377 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
378 :
379 : // ::com::sun::star::lang::XServiceInfo
380 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
381 :
382 : // ::com::sun::star::lang::XTypeProvider
383 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
384 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
385 : };
386 :
387 : class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase,
388 : public ::com::sun::star::text::XTextAppend,
389 : public ::com::sun::star::text::XTextCopy,
390 : public ::com::sun::star::container::XEnumerationAccess,
391 : public ::com::sun::star::text::XTextRangeMover,
392 : public ::com::sun::star::lang::XTypeProvider
393 : {
394 : protected:
395 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
396 :
397 : public:
398 : SvxUnoTextBase( ) throw();
399 : SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw();
400 : SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
401 : SvxUnoTextBase( const SvxUnoTextBase& rText ) throw();
402 : virtual ~SvxUnoTextBase() throw();
403 :
404 : UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase )
405 :
406 : ESelection InsertField( const SvxFieldItem& rField ) throw();
407 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getStaticTypes() throw();
408 :
409 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel );
410 :
411 : // ::com::sun::star::uno::XInterface
412 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
413 :
414 : // ::com::sun::star::text::XSimpleText
415 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor( ) throw(::com::sun::star::uno::RuntimeException);
416 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw(::com::sun::star::uno::RuntimeException);
417 : virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw(::com::sun::star::uno::RuntimeException);
418 : virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
419 :
420 : // ::com::sun::star::text::XText
421 : virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
422 : virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
423 : virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
424 : virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
425 :
426 : // ::com::sun::star::text::XTextRange
427 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
428 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
429 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
430 :
431 : // ::com::sun::star::container::XEnumerationAccess
432 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
433 :
434 : // ::com::sun::star::container::XElementAccess
435 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
436 : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
437 :
438 : // ::com::sun::star::text::XTextRangeMover
439 : virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nParagraphs ) throw(::com::sun::star::uno::RuntimeException);
440 :
441 : // com::sun::star::text::XParagraphAppend (new import API)
442 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
443 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraphInsert( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xInsertPosition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
444 :
445 : // com::sun::star::text::XTextPortionAppend (new import API)
446 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
447 :
448 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL insertTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const com::sun::star::uno::Reference< com::sun::star::text::XTextRange>& rTextRange ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
449 :
450 : // com::sun::star::text::XTextCopy
451 : virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException);
452 :
453 : // ::com::sun::star::lang::XServiceInfo
454 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
455 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
456 : static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
457 :
458 : // ::com::sun::star::lang::XTypeProvider
459 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
460 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
461 : };
462 :
463 : // ====================================================================
464 : class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase,
465 : public ::cppu::OWeakAggObject
466 : {
467 : public:
468 : SvxUnoText( ) throw();
469 : SvxUnoText( const SvxItemPropertySet* _pSet ) throw();
470 : SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
471 : SvxUnoText( const SvxUnoText& rText ) throw();
472 : virtual ~SvxUnoText() throw();
473 :
474 : // Internal
475 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
476 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
477 :
478 : // ::com::sun::star::uno::XInterface
479 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
480 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
481 : virtual void SAL_CALL acquire() throw();
482 : virtual void SAL_CALL release() throw();
483 :
484 : // ::com::sun::star::lang::XTypeProvider
485 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
486 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
487 : };
488 :
489 : // ====================================================================
490 :
491 : class SvxUnoTextContentEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
492 : {
493 : private:
494 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
495 : SvxEditSource* mpEditSource;
496 : sal_Int32 mnNextParagraph;
497 : const SvxUnoTextBase& mrText;
498 :
499 : public:
500 : SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw();
501 : virtual ~SvxUnoTextContentEnumeration() throw();
502 :
503 : // ::com::sun::star::container::XEnumeration
504 : virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
505 : virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
506 : };
507 :
508 : // ====================================================================
509 : #include <com/sun/star/text/XTextContent.hpp>
510 :
511 : class SvxUnoTextContent : public SvxUnoTextRangeBase,
512 : public ::com::sun::star::text::XTextContent,
513 : public ::com::sun::star::container::XEnumerationAccess,
514 : public ::com::sun::star::lang::XTypeProvider,
515 : public ::cppu::OWeakAggObject
516 : {
517 : friend class SvxUnoTextContentEnumeration;
518 : private:
519 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
520 : sal_Int32 mnParagraph;
521 : const SvxUnoTextBase& mrParentText;
522 :
523 : // for xComponent
524 : ::osl::Mutex maDisposeContainerMutex;
525 : ::cppu::OInterfaceContainerHelper maDisposeListeners;
526 : bool mbDisposing;
527 :
528 : protected:
529 : using SvxUnoTextRangeBase::setPropertyValue;
530 : using SvxUnoTextRangeBase::getPropertyValue;
531 :
532 : public:
533 : SvxUnoTextContent( const SvxUnoTextBase& rText, sal_Int32 nPara ) throw();
534 : SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw();
535 : virtual ~SvxUnoTextContent() throw();
536 :
537 : // ::com::sun::star::uno::XInterface
538 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
539 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
540 : virtual void SAL_CALL acquire() throw();
541 : virtual void SAL_CALL release() throw();
542 :
543 : // ::com::sun::star::text::XTextRange
544 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
545 :
546 : // ::com::sun::star::text::XTextContent -> ::com::sun::star::lang::XComponent
547 : virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
548 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
549 :
550 : // ::com::sun::star::lang::XComponent
551 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
552 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
553 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
554 :
555 : // ::com::sun::star::container::XEnumerationAccess
556 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
557 :
558 : // ::com::sun::star::container::XElementAccess
559 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
560 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
561 :
562 : // ::com::sun::star::beans::XPropertySet
563 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
564 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
565 :
566 : // XMultiPropertySet
567 : virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
568 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
569 :
570 : // ::com::sun::star::beans::XPropertyState
571 : virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
572 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
573 : virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
574 :
575 : // ::com::sun::star::lang::XServiceInfo
576 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
577 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
578 :
579 : // ::com::sun::star::lang::XTypeProvider
580 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
581 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
582 : };
583 :
584 : // ====================================================================
585 :
586 : class SvxUnoTextRangeEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
587 : {
588 : private:
589 : SvxEditSource* mpEditSource;
590 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
591 : const SvxUnoTextBase& mrParentText;
592 : sal_Int32 mnParagraph;
593 : std::vector<sal_uInt16>* mpPortions;
594 : sal_uInt16 mnNextPortion;
595 :
596 : public:
597 : SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_Int32 nPara ) throw();
598 : virtual ~SvxUnoTextRangeEnumeration() throw();
599 :
600 : // ::com::sun::star::container::XEnumeration
601 : virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
602 : virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
603 : };
604 :
605 : // ====================================================================
606 :
607 : class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase,
608 : public ::com::sun::star::text::XTextCursor,
609 : public ::com::sun::star::lang::XTypeProvider,
610 : public ::cppu::OWeakAggObject
611 : {
612 : private:
613 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
614 :
615 : public:
616 : SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw();
617 : SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw();
618 : virtual ~SvxUnoTextCursor() throw();
619 :
620 : // ::com::sun::star::uno::XInterface
621 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
622 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
623 : virtual void SAL_CALL acquire() throw();
624 : virtual void SAL_CALL release() throw();
625 :
626 : // ::com::sun::star::text::XTextRange
627 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
628 : virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
629 : virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
630 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
631 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
632 :
633 : // ::com::sun::star::text::XTextCursor -> ::com::sun::star::text::XTextRange
634 : virtual void SAL_CALL collapseToStart( ) throw(::com::sun::star::uno::RuntimeException);
635 : virtual void SAL_CALL collapseToEnd( ) throw(::com::sun::star::uno::RuntimeException);
636 : virtual sal_Bool SAL_CALL isCollapsed( ) throw(::com::sun::star::uno::RuntimeException);
637 : virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
638 : virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
639 : virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
640 : virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
641 : virtual void SAL_CALL gotoRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
642 :
643 : // ::com::sun::star::lang::XServiceInfo
644 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
645 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
646 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
647 :
648 : // ::com::sun::star::lang::XTypeProvider
649 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
650 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
651 :
652 : };
653 :
654 : EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet();
655 : EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap();
656 : EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet();
657 : EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap();
658 :
659 : #endif
660 :
661 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|