1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: textconv.hxx,v $
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 ************************************************************************/
33 #include <svx/splwrap.hxx>
34 #include <svx/svxacorr.hxx>
35 #include <com/sun/star/uno/Reference.h>
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <svx/hangulhanja.hxx>
43 class TextConvWrapper
: public svx::HangulHanjaConversion
45 rtl::OUString aConvText
; // convertible text part found last time
46 LanguageType nConvTextLang
; // language of aConvText
47 USHORT nLastPos
; // starting position of the last found text portion (word)
48 USHORT nUnitOffset
; // offset of current unit in the current text portion (word)
50 ESelection aConvSel
; // selection to be converted if
51 // 'HasRange' is true, other conversion
52 // starts from the cursor position
60 sal_Bool bAllowChange
; // storage for _bAllowImplicitChangesForNotConvertibleText
61 // paramters value of function GetNextPortion.
62 // used to transport the value to where it is needed.
65 // from SvxSpellWrapper copied and modified
66 sal_Bool
ConvNext_impl(); // former SpellNext
67 sal_Bool
FindConvText_impl(); // former FindSpellError
68 sal_Bool
ConvMore_impl(); // former SpellMore
70 // from EditSpellWrapper copied and modified
71 void ConvStart_impl( SvxSpellArea eSpell
); // former SpellStart
72 void ConvEnd_impl(); // former SpellEnd
73 sal_Bool
ConvContinue_impl(); // former SpellContinue
75 void SelectNewUnit_impl( const sal_Int32 nUnitStart
,
76 const sal_Int32 nUnitEnd
);
78 void ChangeText( const String
&rNewText
,
79 const ::rtl::OUString
& rOrigText
,
80 const ::com::sun::star::uno::Sequence
< sal_Int32
> *pOffsets
,
81 ESelection
*pESelection
);
82 void ChangeText_impl( const String
&rNewText
, sal_Bool bKeepAttributes
);
84 // Forbidden and not implemented.
85 TextConvWrapper (const TextConvWrapper
&);
86 TextConvWrapper
& operator= (const TextConvWrapper
&);
89 virtual void GetNextPortion( ::rtl::OUString
& /* [out] */ rNextPortion
,
90 LanguageType
& /* [out] */ rLangOfPortion
,
91 sal_Bool
/* [in] */ _bAllowImplicitChangesForNotConvertibleText
);
92 virtual void HandleNewUnit( const sal_Int32 nUnitStart
,
93 const sal_Int32 nUnitEnd
);
94 virtual void ReplaceUnit(
95 const sal_Int32 nUnitStart
, const sal_Int32 nUnitEnd
,
96 const ::rtl::OUString
& rOrigText
,
97 const ::rtl::OUString
& rReplaceWith
,
98 const ::com::sun::star::uno::Sequence
< sal_Int32
> &rOffsets
,
99 ReplacementAction eAction
,
100 LanguageType
*pNewUnitLanguage
);
102 virtual sal_Bool
HasRubySupport() const;
104 void SetLanguageAndFont( const ESelection
&rESel
,
105 LanguageType nLang
, USHORT nLangWhichId
,
106 const Font
*pFont
, USHORT nFontWhichId
);
110 TextConvWrapper( Window
* pWindow
,
111 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& rxMSF
,
112 const ::com::sun::star::lang::Locale
& rSourceLocale
,
113 const ::com::sun::star::lang::Locale
& rTargetLocale
,
114 const Font
* pTargetFont
,
116 sal_Bool bIsInteractive
,
117 BOOL bIsStart
, EditView
* pView
);
119 virtual ~TextConvWrapper();