xref: /trunk/main/sw/inc/hhcwrp.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _HHCWRP_HXX
28 #define _HHCWRP_HXX
29 
30 #include <editeng/hangulhanja.hxx>
31 #include <pam.hxx>
32 
33 class SwView;
34 class Window;
35 class SwWrtShell;
36 struct SwConversionArgs;
37 
38 //////////////////////////////////////////////////////////////////////
39 
40 class SwHHCWrapper : public editeng::HangulHanjaConversion
41 {
42     SwView *    pView;
43     Window*     pWin;
44     SwWrtShell &rWrtShell;
45 
46     SwConversionArgs *pConvArgs;    // object for arguments (and results) needed
47                                     // to find of next convertible text portion
48 
49     xub_StrLen      nLastPos;   // starting position of the last found text part
50                                 // (needs to be sth that gets not moved like
51                                 // SwPaM or SwPosition by replace operations!)
52     sal_Int32       nUnitOffset;
53 
54     sal_uInt16      nPageCount;     // page count for progress bar
55     sal_uInt16      nPageStart;     // first checked page
56 
57     sal_Bool    bIsDrawObj;
58     sal_Bool    bIsStart;
59     sal_Bool    bIsOtherCntnt;
60     sal_Bool    bStartChk;
61     sal_Bool    bIsSelection;   // true if only the selected text should be converted
62     sal_Bool    bInfoBox;       // true if message should be displayed at the end
63     sal_Bool    bIsConvSpecial; // true if special regions: header, footer, ... should be converted
64     sal_Bool    bStartDone;
65     sal_Bool    bEndDone;
66 //    sal_Bool    bLastRet;
67 
68     // from SvxSpellWrapper copied and modified
69     sal_Bool    ConvNext_impl();        // former SpellNext
70     sal_Bool    FindConvText_impl();    // former FindSpellError
71 
72     // from SwSpellWrapper copied and modified
73     sal_Bool    HasOtherCnt_impl();
74     void        ConvStart_impl( SwConversionArgs *pConvArgs, SvxSpellArea eSpell );   // former SpellStart
75     void        ConvEnd_impl( SwConversionArgs *pConvArgs );                          // former SpellEnd
76     sal_Bool    ConvContinue_impl( SwConversionArgs *pConvArgs );                     // former SpellContinue
77 
78     void        SelectNewUnit_impl( const sal_Int32 nUnitStart,
79                                     const sal_Int32 nUnitEnd );
80     void        ChangeText( const String &rNewText,
81                             const ::rtl::OUString& rOrigText,
82                             const ::com::sun::star::uno::Sequence< sal_Int32 > *pOffsets,
83                             SwPaM *pCrsr );
84     void        ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes );
85 
86     inline sal_Bool IsDrawObj()             { return bIsDrawObj; }
87     inline void SetDrawObj( sal_Bool bNew ) { bIsDrawObj = bNew; }
88 
89 protected:
90     virtual void    GetNextPortion( ::rtl::OUString& rNextPortion,
91                             LanguageType& rLangOfPortion,
92                             sal_Bool bAllowImplicitChangesForNotConvertibleText );
93     virtual void    HandleNewUnit( const sal_Int32 nUnitStart,
94                                    const sal_Int32 nUnitEnd );
95     virtual void    ReplaceUnit(
96                         const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
97                         const ::rtl::OUString& rOrigText,
98                         const ::rtl::OUString& rReplaceWith,
99                         const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets,
100                         ReplacementAction eAction,
101                         LanguageType *pNewUnitLanguage );
102 
103     virtual sal_Bool    HasRubySupport() const;
104 
105 public:
106     SwHHCWrapper(
107         SwView* pView,
108         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF,
109         LanguageType nSourceLanguage, LanguageType nTargetLanguage,
110         const Font *pTargetFont,
111         sal_Int32 nConvOptions, sal_Bool bIsInteractive,
112         sal_Bool bStart, sal_Bool bOther, sal_Bool bSelection );
113 
114     virtual ~SwHHCWrapper();
115 
116     void    Convert();
117 };
118 
119 
120 #endif
121 
122