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 : #include <pam.hxx>
24 :
25 : class SwView;
26 : class Window;
27 : class SwWrtShell;
28 : struct SwConversionArgs;
29 :
30 : //////////////////////////////////////////////////////////////////////
31 :
32 : class SwHHCWrapper : public editeng::HangulHanjaConversion
33 : {
34 : SwView * pView;
35 : Window* pWin;
36 : SwWrtShell &rWrtShell;
37 :
38 : SwConversionArgs *pConvArgs; /**< object for arguments (and results) needed
39 : to find of next convertible text portion */
40 :
41 : xub_StrLen 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 nUnitOffset;
45 :
46 : sal_uInt16 nPageCount; ///< page count for progress bar
47 : sal_uInt16 nPageStart; ///< first checked page
48 :
49 : sal_Bool bIsDrawObj;
50 : sal_Bool bIsStart;
51 : sal_Bool bIsOtherCntnt;
52 : sal_Bool bStartChk;
53 : sal_Bool bIsSelection; ///< true if only the selected text should be converted
54 : sal_Bool bInfoBox; ///< true if message should be displayed at the end
55 : sal_Bool bIsConvSpecial; ///< true if special regions: header, footer, ... should be converted
56 : sal_Bool bStartDone;
57 : sal_Bool bEndDone;
58 :
59 : /// from SvxSpellWrapper copied and modified
60 : sal_Bool ConvNext_impl(); ///< former SpellNext
61 : sal_Bool FindConvText_impl(); ///< former FindSpellError
62 :
63 : /// from SwSpellWrapper copied and modified
64 : sal_Bool HasOtherCnt_impl();
65 : void ConvStart_impl( SwConversionArgs *pConvArgs, SvxSpellArea eSpell ); ///< former SpellStart
66 : void ConvEnd_impl( SwConversionArgs *pConvArgs ); ///< former SpellEnd
67 : sal_Bool ConvContinue_impl( SwConversionArgs *pConvArgs ); ///< former SpellContinue
68 :
69 : void SelectNewUnit_impl( const sal_Int32 nUnitStart,
70 : const sal_Int32 nUnitEnd );
71 : void ChangeText( const String &rNewText,
72 : const ::rtl::OUString& rOrigText,
73 : const ::com::sun::star::uno::Sequence< sal_Int32 > *pOffsets,
74 : SwPaM *pCrsr );
75 : void ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes );
76 :
77 0 : inline sal_Bool IsDrawObj() { return bIsDrawObj; }
78 0 : inline void SetDrawObj( sal_Bool bNew ) { bIsDrawObj = bNew; }
79 :
80 : protected:
81 : virtual void GetNextPortion( ::rtl::OUString& rNextPortion,
82 : LanguageType& rLangOfPortion,
83 : sal_Bool bAllowImplicitChangesForNotConvertibleText );
84 : virtual void HandleNewUnit( const sal_Int32 nUnitStart,
85 : const sal_Int32 nUnitEnd );
86 : virtual void ReplaceUnit(
87 : const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
88 : const ::rtl::OUString& rOrigText,
89 : const ::rtl::OUString& rReplaceWith,
90 : const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets,
91 : ReplacementAction eAction,
92 : LanguageType *pNewUnitLanguage );
93 :
94 : virtual sal_Bool HasRubySupport() const;
95 :
96 : public:
97 : SwHHCWrapper(
98 : SwView* pView,
99 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
100 : LanguageType nSourceLanguage, LanguageType nTargetLanguage,
101 : const Font *pTargetFont,
102 : sal_Int32 nConvOptions, sal_Bool bIsInteractive,
103 : sal_Bool bStart, sal_Bool bOther, sal_Bool bSelection );
104 :
105 : virtual ~SwHHCWrapper();
106 :
107 : void Convert();
108 : };
109 :
110 :
111 : #endif
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|