xref: /trunk/main/editeng/source/editeng/textconv.hxx (revision 07a3d7f1)
14c5491eaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
34c5491eaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
44c5491eaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
54c5491eaSAndrew Rist  * distributed with this work for additional information
64c5491eaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
74c5491eaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
84c5491eaSAndrew Rist  * "License"); you may not use this file except in compliance
94c5491eaSAndrew Rist  * with the License.  You may obtain a copy of the License at
104c5491eaSAndrew Rist  *
114c5491eaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
124c5491eaSAndrew Rist  *
134c5491eaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
144c5491eaSAndrew Rist  * software distributed under the License is distributed on an
154c5491eaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
164c5491eaSAndrew Rist  * KIND, either express or implied.  See the License for the
174c5491eaSAndrew Rist  * specific language governing permissions and limitations
184c5491eaSAndrew Rist  * under the License.
194c5491eaSAndrew Rist  *
204c5491eaSAndrew Rist  *************************************************************/
214c5491eaSAndrew Rist 
224c5491eaSAndrew Rist 
23cdf0e10cSrcweir #ifndef _TEXTCONV_HXX
24cdf0e10cSrcweir #define _TEXTCONV_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <editeng/splwrap.hxx>
27cdf0e10cSrcweir #include <editeng/svxacorr.hxx>
28cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
30cdf0e10cSrcweir #include <editeng/hangulhanja.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class EditView;
33cdf0e10cSrcweir class ImpEditEngine;
34cdf0e10cSrcweir class ContentNode;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class TextConvWrapper : public editeng::HangulHanjaConversion
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     rtl::OUString   aConvText;      // convertible text part found last time
39cdf0e10cSrcweir     LanguageType    nConvTextLang;  // language of aConvText
40cdf0e10cSrcweir     sal_uInt16          nLastPos;       // starting position of the last found text portion (word)
41cdf0e10cSrcweir     sal_uInt16          nUnitOffset;    // offset of current unit in the current text portion (word)
42cdf0e10cSrcweir 
43cdf0e10cSrcweir     ESelection      aConvSel;       // selection to be converted if
44cdf0e10cSrcweir                                     // 'HasRange' is true, other conversion
45cdf0e10cSrcweir                                     // starts from the cursor position
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     EditView *      pEditView;
48cdf0e10cSrcweir     Window *        pWin;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     sal_Bool        bStartChk;
51cdf0e10cSrcweir     sal_Bool        bStartDone;
52cdf0e10cSrcweir     sal_Bool        bEndDone;
53cdf0e10cSrcweir     sal_Bool        bAllowChange;   // storage for _bAllowImplicitChangesForNotConvertibleText
54*07a3d7f1SPedro Giffuni                                     // parameters value of function GetNextPortion.
55cdf0e10cSrcweir                                     // used to transport the value to where it is needed.
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     // from SvxSpellWrapper copied and modified
59cdf0e10cSrcweir     sal_Bool    ConvNext_impl();        // former SpellNext
60cdf0e10cSrcweir     sal_Bool    FindConvText_impl();    // former FindSpellError
61cdf0e10cSrcweir     sal_Bool    ConvMore_impl();        // former SpellMore
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     // from EditSpellWrapper copied and modified
64cdf0e10cSrcweir     void        ConvStart_impl( SvxSpellArea eSpell );   // former SpellStart
65cdf0e10cSrcweir     void        ConvEnd_impl();                          // former SpellEnd
66cdf0e10cSrcweir     sal_Bool    ConvContinue_impl();                     // former SpellContinue
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     void        SelectNewUnit_impl( const sal_Int32 nUnitStart,
69cdf0e10cSrcweir                                     const sal_Int32 nUnitEnd );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     void        ChangeText( const String &rNewText,
72cdf0e10cSrcweir                             const ::rtl::OUString& rOrigText,
73cdf0e10cSrcweir                             const ::com::sun::star::uno::Sequence< sal_Int32 > *pOffsets,
74cdf0e10cSrcweir                             ESelection *pESelection );
75cdf0e10cSrcweir     void        ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	// Forbidden and not implemented.
78cdf0e10cSrcweir     TextConvWrapper (const TextConvWrapper &);
79cdf0e10cSrcweir     TextConvWrapper & operator= (const TextConvWrapper &);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir protected:
82cdf0e10cSrcweir     virtual void    GetNextPortion( ::rtl::OUString& /* [out] */ rNextPortion,
83cdf0e10cSrcweir                         LanguageType& /* [out] */ rLangOfPortion,
84cdf0e10cSrcweir                         sal_Bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText );
85cdf0e10cSrcweir     virtual void    HandleNewUnit( const sal_Int32 nUnitStart,
86cdf0e10cSrcweir                                    const sal_Int32 nUnitEnd );
87cdf0e10cSrcweir     virtual void    ReplaceUnit(
88cdf0e10cSrcweir                         const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
89cdf0e10cSrcweir                         const ::rtl::OUString& rOrigText,
90cdf0e10cSrcweir                         const ::rtl::OUString& rReplaceWith,
91cdf0e10cSrcweir                         const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets,
92cdf0e10cSrcweir                         ReplacementAction eAction,
93cdf0e10cSrcweir                         LanguageType *pNewUnitLanguage );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     virtual sal_Bool    HasRubySupport() const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     void SetLanguageAndFont( const ESelection &rESel,
98cdf0e10cSrcweir                             LanguageType nLang, sal_uInt16 nLangWhichId,
99cdf0e10cSrcweir                             const Font *pFont,  sal_uInt16 nFontWhichId );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 
102cdf0e10cSrcweir public:
103cdf0e10cSrcweir     TextConvWrapper( Window* pWindow,
104cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF,
105cdf0e10cSrcweir             const ::com::sun::star::lang::Locale& rSourceLocale,
106cdf0e10cSrcweir             const ::com::sun::star::lang::Locale& rTargetLocale,
107cdf0e10cSrcweir             const Font* pTargetFont,
108cdf0e10cSrcweir             sal_Int32 nOptions,
109cdf0e10cSrcweir             sal_Bool bIsInteractive,
110cdf0e10cSrcweir             sal_Bool bIsStart, EditView* pView );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     virtual ~TextConvWrapper();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     void    Convert();
115cdf0e10cSrcweir };
116cdf0e10cSrcweir 
117cdf0e10cSrcweir #endif
118cdf0e10cSrcweir 
119