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