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