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