LibreOffice Module editeng (master) 1
textconv.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <editeng/editdata.hxx>
22#include <editeng/svxenum.hxx>
23#include <com/sun/star/uno/Reference.h>
24#include <com/sun/star/uno/Sequence.hxx>
26
27class EditView;
28
30{
31 OUString m_aConvText; // convertible text part found last time
32 LanguageType m_nConvTextLang; // language of aConvText
33 sal_uInt16 m_nUnitOffset; // offset of current unit in the current text portion (word)
34 sal_uInt16 m_nLastPos; // starting position of the last found text portion (word)
35
36 ESelection m_aConvSel; // selection to be converted if
37 // 'HasRange' is true, other conversion
38 // starts from the cursor position
39
42
46 bool m_bAllowChange; // storage for _bAllowImplicitChangesForNotConvertibleText
47 // parameters value of function GetNextPortion.
48 // used to transport the value to where it is needed.
49
50
51 // from SvxSpellWrapper copied and modified
52 bool ConvNext_impl(); // former SpellNext
53 void FindConvText_impl(); // former FindSpellError
54 bool ConvMore_impl(); // former SpellMore
55
56 // from EditSpellWrapper copied and modified
57 void ConvStart_impl( SvxSpellArea eSpell ); // former SpellStart
58 bool ConvContinue_impl(); // former SpellContinue
59
60 void SelectNewUnit_impl( const sal_Int32 nUnitStart,
61 const sal_Int32 nUnitEnd );
62
63 void ChangeText( const OUString &rNewText,
64 std::u16string_view rOrigText,
65 const css::uno::Sequence< sal_Int32 > *pOffsets,
66 ESelection *pESelection );
67 void ChangeText_impl( const OUString &rNewText, bool bKeepAttributes );
68
69 TextConvWrapper (const TextConvWrapper &) = delete;
71
72 virtual void GetNextPortion( OUString& /* [out] */ rNextPortion,
73 LanguageType& /* [out] */ rLangOfPortion,
74 bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText ) override;
75 virtual void HandleNewUnit( const sal_Int32 nUnitStart,
76 const sal_Int32 nUnitEnd ) override;
77 virtual void ReplaceUnit(
78 const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
79 const OUString& rOrigText,
80 const OUString& rReplaceWith,
81 const css::uno::Sequence< sal_Int32 > &rOffsets,
82 ReplacementAction eAction,
83 LanguageType *pNewUnitLanguage ) override;
84
85 virtual bool HasRubySupport() const override;
86
87 void SetLanguageAndFont( const ESelection &rESel,
88 LanguageType nLang, sal_uInt16 nLangWhichId,
89 const vcl::Font *pFont, sal_uInt16 nFontWhichId );
90
91
92public:
94 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
95 const css::lang::Locale& rSourceLocale,
96 const css::lang::Locale& rTargetLocale,
97 const vcl::Font* pTargetFont,
98 sal_Int32 nOptions,
99 bool bIsInteractive,
100 bool bIsStart, EditView* pView );
101
102 virtual ~TextConvWrapper() override;
103
104 void Convert();
105};
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ConvContinue_impl()
Definition: textconv.cxx:200
sal_uInt16 m_nUnitOffset
Definition: textconv.hxx:33
void FindConvText_impl()
Definition: textconv.cxx:109
OUString m_aConvText
Definition: textconv.hxx:31
TextConvWrapper & operator=(const TextConvWrapper &)=delete
EditView * m_pEditView
Definition: textconv.hxx:40
virtual ~TextConvWrapper() override
Definition: textconv.cxx:62
virtual void ReplaceUnit(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd, const OUString &rOrigText, const OUString &rReplaceWith, const css::uno::Sequence< sal_Int32 > &rOffsets, ReplacementAction eAction, LanguageType *pNewUnitLanguage) override
replaces a text unit within a text portion with a new text
Definition: textconv.cxx:304
virtual bool HasRubySupport() const override
specifies if rubies are supported by the document implementing this class.
Definition: textconv.cxx:537
TextConvWrapper(const TextConvWrapper &)=delete
bool ConvNext_impl()
Definition: textconv.cxx:67
void ConvStart_impl(SvxSpellArea eSpell)
Definition: textconv.cxx:142
void SetLanguageAndFont(const ESelection &rESel, LanguageType nLang, sal_uInt16 nLangWhichId, const vcl::Font *pFont, sal_uInt16 nFontWhichId)
Definition: textconv.cxx:214
weld::Widget * m_pWin
Definition: textconv.hxx:41
void SelectNewUnit_impl(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd)
Definition: textconv.cxx:246
ESelection m_aConvSel
Definition: textconv.hxx:36
virtual void GetNextPortion(OUString &rNextPortion, LanguageType &rLangOfPortion, bool _bAllowImplicitChangesForNotConvertibleText) override
retrieves the next text portion which is to be analyzed
Definition: textconv.cxx:264
bool ConvMore_impl()
Definition: textconv.cxx:120
sal_uInt16 m_nLastPos
Definition: textconv.hxx:34
virtual void HandleNewUnit(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd) override
announces a new "current unit"
Definition: textconv.cxx:285
void ChangeText_impl(const OUString &rNewText, bool bKeepAttributes)
Definition: textconv.cxx:503
LanguageType m_nConvTextLang
Definition: textconv.hxx:32
TextConvWrapper(weld::Widget *pWindow, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::lang::Locale &rSourceLocale, const css::lang::Locale &rTargetLocale, const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive, bool bIsStart, EditView *pView)
bool m_bAllowChange
Definition: textconv.hxx:46
void ChangeText(const OUString &rNewText, std::u16string_view rOrigText, const css::uno::Sequence< sal_Int32 > *pOffsets, ESelection *pESelection)
Definition: textconv.cxx:403
encapsulates Hangul-Hanja conversion functionality
Definition: hangulhanja.hxx:56
SvxSpellArea
Definition: svxenum.hxx:133