1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _HHCWRP_HXX 24cdf0e10cSrcweir #define _HHCWRP_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <editeng/hangulhanja.hxx> 27cdf0e10cSrcweir #include <pam.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir class SwView; 30cdf0e10cSrcweir class Window; 31cdf0e10cSrcweir class SwWrtShell; 32cdf0e10cSrcweir struct SwConversionArgs; 33cdf0e10cSrcweir 34cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 35cdf0e10cSrcweir 36cdf0e10cSrcweir class SwHHCWrapper : public editeng::HangulHanjaConversion 37cdf0e10cSrcweir { 38cdf0e10cSrcweir SwView * pView; 39cdf0e10cSrcweir Window* pWin; 40cdf0e10cSrcweir SwWrtShell &rWrtShell; 41cdf0e10cSrcweir 42cdf0e10cSrcweir SwConversionArgs *pConvArgs; // object for arguments (and results) needed 43cdf0e10cSrcweir // to find of next convertible text portion 44cdf0e10cSrcweir 45cdf0e10cSrcweir xub_StrLen nLastPos; // starting position of the last found text part 46cdf0e10cSrcweir // (needs to be sth that gets not moved like 47cdf0e10cSrcweir // SwPaM or SwPosition by replace operations!) 48cdf0e10cSrcweir sal_Int32 nUnitOffset; 49cdf0e10cSrcweir 50cdf0e10cSrcweir sal_uInt16 nPageCount; // page count for progress bar 51cdf0e10cSrcweir sal_uInt16 nPageStart; // first checked page 52cdf0e10cSrcweir 53cdf0e10cSrcweir sal_Bool bIsDrawObj; 54cdf0e10cSrcweir sal_Bool bIsStart; 55cdf0e10cSrcweir sal_Bool bIsOtherCntnt; 56cdf0e10cSrcweir sal_Bool bStartChk; 57cdf0e10cSrcweir sal_Bool bIsSelection; // true if only the selected text should be converted 58cdf0e10cSrcweir sal_Bool bInfoBox; // true if message should be displayed at the end 59cdf0e10cSrcweir sal_Bool bIsConvSpecial; // true if special regions: header, footer, ... should be converted 60cdf0e10cSrcweir sal_Bool bStartDone; 61cdf0e10cSrcweir sal_Bool bEndDone; 62cdf0e10cSrcweir // sal_Bool bLastRet; 63cdf0e10cSrcweir 64cdf0e10cSrcweir // from SvxSpellWrapper copied and modified 65cdf0e10cSrcweir sal_Bool ConvNext_impl(); // former SpellNext 66cdf0e10cSrcweir sal_Bool FindConvText_impl(); // former FindSpellError 67cdf0e10cSrcweir 68cdf0e10cSrcweir // from SwSpellWrapper copied and modified 69cdf0e10cSrcweir sal_Bool HasOtherCnt_impl(); 70cdf0e10cSrcweir void ConvStart_impl( SwConversionArgs *pConvArgs, SvxSpellArea eSpell ); // former SpellStart 71cdf0e10cSrcweir void ConvEnd_impl( SwConversionArgs *pConvArgs ); // former SpellEnd 72cdf0e10cSrcweir sal_Bool ConvContinue_impl( SwConversionArgs *pConvArgs ); // former SpellContinue 73cdf0e10cSrcweir 74cdf0e10cSrcweir void SelectNewUnit_impl( const sal_Int32 nUnitStart, 75cdf0e10cSrcweir const sal_Int32 nUnitEnd ); 76cdf0e10cSrcweir void ChangeText( const String &rNewText, 77cdf0e10cSrcweir const ::rtl::OUString& rOrigText, 78cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int32 > *pOffsets, 79cdf0e10cSrcweir SwPaM *pCrsr ); 80cdf0e10cSrcweir void ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes ); 81cdf0e10cSrcweir IsDrawObj()82cdf0e10cSrcweir inline sal_Bool IsDrawObj() { return bIsDrawObj; } SetDrawObj(sal_Bool bNew)83cdf0e10cSrcweir inline void SetDrawObj( sal_Bool bNew ) { bIsDrawObj = bNew; } 84cdf0e10cSrcweir 85cdf0e10cSrcweir protected: 86cdf0e10cSrcweir virtual void GetNextPortion( ::rtl::OUString& rNextPortion, 87cdf0e10cSrcweir LanguageType& rLangOfPortion, 88cdf0e10cSrcweir sal_Bool bAllowImplicitChangesForNotConvertibleText ); 89cdf0e10cSrcweir virtual void HandleNewUnit( const sal_Int32 nUnitStart, 90cdf0e10cSrcweir const sal_Int32 nUnitEnd ); 91cdf0e10cSrcweir virtual void ReplaceUnit( 92cdf0e10cSrcweir const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd, 93cdf0e10cSrcweir const ::rtl::OUString& rOrigText, 94cdf0e10cSrcweir const ::rtl::OUString& rReplaceWith, 95cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets, 96cdf0e10cSrcweir ReplacementAction eAction, 97cdf0e10cSrcweir LanguageType *pNewUnitLanguage ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual sal_Bool HasRubySupport() const; 100cdf0e10cSrcweir 101cdf0e10cSrcweir public: 102cdf0e10cSrcweir SwHHCWrapper( 103cdf0e10cSrcweir SwView* pView, 104cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, 105cdf0e10cSrcweir LanguageType nSourceLanguage, LanguageType nTargetLanguage, 106cdf0e10cSrcweir const Font *pTargetFont, 107cdf0e10cSrcweir sal_Int32 nConvOptions, sal_Bool bIsInteractive, 108cdf0e10cSrcweir sal_Bool bStart, sal_Bool bOther, sal_Bool bSelection ); 109cdf0e10cSrcweir 110cdf0e10cSrcweir virtual ~SwHHCWrapper(); 111cdf0e10cSrcweir 112cdf0e10cSrcweir void Convert(); 113cdf0e10cSrcweir }; 114cdf0e10cSrcweir 115cdf0e10cSrcweir 116cdf0e10cSrcweir #endif 117cdf0e10cSrcweir 118