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 #ifndef INCLUDED_SW_INC_HHCWRP_HXX 20 #define INCLUDED_SW_INC_HHCWRP_HXX 21 22 #include <editeng/hangulhanja.hxx> 23 #include <editeng/svxenum.hxx> 24 #include <vcl/vclptr.hxx> 25 #include <vcl/window.hxx> 26 #include "swdllapi.h" 27 28 class SwView; 29 class SwWrtShell; 30 struct SwConversionArgs; 31 class SwPaM; 32 33 class SW_DLLPUBLIC SwHHCWrapper : public editeng::HangulHanjaConversion 34 { 35 SwView * m_pView; 36 VclPtr<vcl::Window> m_pWin; 37 SwWrtShell &m_rWrtShell; 38 39 std::unique_ptr<SwConversionArgs> m_pConvArgs; /**< object for arguments (and results) needed 40 to find of next convertible text portion */ 41 42 sal_Int32 m_nLastPos; /**< starting position of the last found text part 43 (needs to be sth that gets not moved like 44 SwPaM or SwPosition by replace operations!) */ 45 sal_Int32 m_nUnitOffset; 46 47 sal_uInt16 m_nPageCount; ///< page count for progress bar 48 sal_uInt16 m_nPageStart; ///< first checked page 49 50 bool m_bIsDrawObj; 51 bool m_bIsOtherContent; 52 bool m_bStartChk; 53 bool m_bIsSelection; ///< true if only the selected text should be converted 54 bool m_bStartDone; 55 bool m_bEndDone; 56 57 /// from SvxSpellWrapper copied and modified 58 bool ConvNext_impl(); ///< former SpellNext 59 void FindConvText_impl(); ///< former FindSpellError 60 61 void ConvStart_impl( SwConversionArgs *pConvArgs, SvxSpellArea eSpell ); ///< former SpellStart 62 void ConvEnd_impl( SwConversionArgs const *pConvArgs ); ///< former SpellEnd 63 bool ConvContinue_impl( SwConversionArgs *pConvArgs ); ///< former SpellContinue 64 65 void SelectNewUnit_impl( const sal_Int32 nUnitStart, 66 const sal_Int32 nUnitEnd ); 67 void ChangeText( const OUString &rNewText, 68 const OUString& rOrigText, 69 const css::uno::Sequence< sal_Int32 > *pOffsets, 70 SwPaM *pCursor ); 71 void ChangeText_impl( const OUString &rNewText, bool bKeepAttributes ); 72 73 protected: 74 virtual void GetNextPortion( OUString& rNextPortion, 75 LanguageType& rLangOfPortion, 76 bool bAllowImplicitChangesForNotConvertibleText ) override; 77 virtual void HandleNewUnit( const sal_Int32 nUnitStart, 78 const sal_Int32 nUnitEnd ) override; 79 virtual void ReplaceUnit( 80 const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd, 81 const OUString& rOrigText, 82 const OUString& rReplaceWith, 83 const css::uno::Sequence< sal_Int32 > &rOffsets, 84 ReplacementAction eAction, 85 LanguageType *pNewUnitLanguage ) override; 86 87 virtual bool HasRubySupport() const override; 88 89 public: 90 SwHHCWrapper( 91 SwView* pView, 92 const css::uno::Reference< css::uno::XComponentContext >& rxContext, 93 LanguageType nSourceLanguage, LanguageType nTargetLanguage, 94 const vcl::Font *pTargetFont, 95 sal_Int32 nConvOptions, bool bIsInteractive, 96 bool bStart, bool bOther, bool bSelection ); 97 98 virtual ~SwHHCWrapper() override; 99 100 void Convert(); 101 }; 102 103 #endif 104 105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 106