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 #ifndef _TEXTCONV_HXX 24 #define _TEXTCONV_HXX 25 26 #include <editeng/splwrap.hxx> 27 #include <editeng/svxacorr.hxx> 28 #include <com/sun/star/uno/Reference.h> 29 #include <com/sun/star/uno/Sequence.hxx> 30 #include <editeng/hangulhanja.hxx> 31 32 class EditView; 33 class ImpEditEngine; 34 class ContentNode; 35 36 class TextConvWrapper : public editeng::HangulHanjaConversion 37 { 38 rtl::OUString aConvText; // convertible text part found last time 39 LanguageType nConvTextLang; // language of aConvText 40 sal_uInt16 nLastPos; // starting position of the last found text portion (word) 41 sal_uInt16 nUnitOffset; // offset of current unit in the current text portion (word) 42 43 ESelection aConvSel; // selection to be converted if 44 // 'HasRange' is true, other conversion 45 // starts from the cursor position 46 47 EditView * pEditView; 48 Window * pWin; 49 50 sal_Bool bStartChk; 51 sal_Bool bStartDone; 52 sal_Bool bEndDone; 53 sal_Bool bAllowChange; // storage for _bAllowImplicitChangesForNotConvertibleText 54 // paramters value of function GetNextPortion. 55 // used to transport the value to where it is needed. 56 57 58 // from SvxSpellWrapper copied and modified 59 sal_Bool ConvNext_impl(); // former SpellNext 60 sal_Bool FindConvText_impl(); // former FindSpellError 61 sal_Bool ConvMore_impl(); // former SpellMore 62 63 // from EditSpellWrapper copied and modified 64 void ConvStart_impl( SvxSpellArea eSpell ); // former SpellStart 65 void ConvEnd_impl(); // former SpellEnd 66 sal_Bool ConvContinue_impl(); // former SpellContinue 67 68 void SelectNewUnit_impl( const sal_Int32 nUnitStart, 69 const sal_Int32 nUnitEnd ); 70 71 void ChangeText( const String &rNewText, 72 const ::rtl::OUString& rOrigText, 73 const ::com::sun::star::uno::Sequence< sal_Int32 > *pOffsets, 74 ESelection *pESelection ); 75 void ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes ); 76 77 // Forbidden and not implemented. 78 TextConvWrapper (const TextConvWrapper &); 79 TextConvWrapper & operator= (const TextConvWrapper &); 80 81 protected: 82 virtual void GetNextPortion( ::rtl::OUString& /* [out] */ rNextPortion, 83 LanguageType& /* [out] */ rLangOfPortion, 84 sal_Bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText ); 85 virtual void HandleNewUnit( const sal_Int32 nUnitStart, 86 const sal_Int32 nUnitEnd ); 87 virtual void ReplaceUnit( 88 const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd, 89 const ::rtl::OUString& rOrigText, 90 const ::rtl::OUString& rReplaceWith, 91 const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets, 92 ReplacementAction eAction, 93 LanguageType *pNewUnitLanguage ); 94 95 virtual sal_Bool HasRubySupport() const; 96 97 void SetLanguageAndFont( const ESelection &rESel, 98 LanguageType nLang, sal_uInt16 nLangWhichId, 99 const Font *pFont, sal_uInt16 nFontWhichId ); 100 101 102 public: 103 TextConvWrapper( Window* pWindow, 104 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, 105 const ::com::sun::star::lang::Locale& rSourceLocale, 106 const ::com::sun::star::lang::Locale& rTargetLocale, 107 const Font* pTargetFont, 108 sal_Int32 nOptions, 109 sal_Bool bIsInteractive, 110 sal_Bool bIsStart, EditView* pView ); 111 112 virtual ~TextConvWrapper(); 113 114 void Convert(); 115 }; 116 117 #endif 118 119