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