LibreOffice Module sw (master) 1
hhcwrp.cxx
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
20#include <hintids.hxx>
21#include <view.hxx>
22#include <wrtsh.hxx>
23#include <swundo.hxx>
24#include <splargs.hxx>
25
26#include <editeng/langitem.hxx>
27#include <editeng/fontitem.hxx>
28#include <rtl/ustring.hxx>
29#include <com/sun/star/text/RubyAdjust.hpp>
30#include <com/sun/star/i18n/XBreakIterator.hpp>
31#include <osl/diagnose.h>
32#include <hhcwrp.hxx>
33#include "sdrhhcwrap.hxx"
34#include <doc.hxx>
35#include <docsh.hxx>
36#include <mdiexp.hxx>
37#include <edtwin.hxx>
38#include <contentindex.hxx>
39#include <pam.hxx>
40#include <swcrsr.hxx>
41#include <ndtxt.hxx>
42#include <fmtruby.hxx>
43#include <breakit.hxx>
44
45using namespace ::com::sun::star;
46using namespace ::com::sun::star::text;
47using namespace ::com::sun::star::uno;
48using namespace ::com::sun::star::linguistic2;
49using namespace ::com::sun::star::i18n;
50
51// Description: Turn off frame/object shell if applicable
52
53static void lcl_ActivateTextShell( SwWrtShell & rWrtSh )
54{
55 if( rWrtSh.IsSelFrameMode() || rWrtSh.IsObjSelected() )
56 rWrtSh.EnterStdMode();
57}
58
59namespace {
60
61class SwKeepConversionDirectionStateContext
62{
63public:
64 SwKeepConversionDirectionStateContext()
65 {
70 }
71
72 ~SwKeepConversionDirectionStateContext()
73 {
75 }
76};
77
78}
79
81 SwView* pSwView,
82 const uno::Reference< uno::XComponentContext >& rxContext,
83 LanguageType nSourceLanguage,
84 LanguageType nTargetLanguage,
85 const vcl::Font *pTargetFont,
86 sal_Int32 nConvOptions,
87 bool bIsInteractive,
88 bool bStart, bool bOther, bool bSelection )
89 : editeng::HangulHanjaConversion(pSwView->GetEditWin().GetFrameWeld(), rxContext,
90 LanguageTag::convertToLocale( nSourceLanguage ),
91 LanguageTag::convertToLocale( nTargetLanguage ),
92 pTargetFont,
93 nConvOptions,
94 bIsInteractive )
95 , m_pView( pSwView )
96 , m_rWrtShell( pSwView->GetWrtShell() )
97 , m_nLastPos( 0 )
98 , m_nUnitOffset( 0 )
99 , m_nPageCount( 0 )
100 , m_nPageStart( 0 )
101 , m_bIsDrawObj( false )
102 , m_bIsOtherContent( bOther )
103 , m_bStartChk( bOther )
104 , m_bIsSelection( bSelection )
105 , m_bStartDone( bOther || bStart )
106 , m_bEndDone( false )
107{
108}
109
110SwHHCWrapper::~SwHHCWrapper() COVERITY_NOEXCEPT_FALSE
111{
112 m_pConvArgs.reset();
113
115
116 // check for existence of a draw view which means that there are
117 // (or previously were) draw objects present in the document.
118 // I.e. we like to check those too.
119 if ( m_bIsDrawObj /*&& bLastRet*/ && m_pView->GetWrtShell().HasDrawView() )
120 {
121 vcl::Cursor *pSave = m_pView->GetWindow()->GetCursor();
122 {
123 SwKeepConversionDirectionStateContext aContext;
124
125 SdrHHCWrapper aSdrConvWrap( m_pView, GetSourceLanguage(),
128 aSdrConvWrap.StartTextConversion();
129 }
130 m_pView->GetWindow()->SetCursor( pSave );
131 }
132
133 if( m_nPageCount )
135
136 // finally for chinese translation we need to change the documents
137 // default language and font to the new ones to be used.
138 LanguageType nTargetLang = GetTargetLanguage();
139 if (!IsChinese( nTargetLang ))
140 return;
141
142 SwDoc *pDoc = m_pView->GetDocShell()->GetDoc();
143
145 pDoc->SetDefault( SvxLanguageItem( nTargetLang, RES_CHRATR_CJK_LANGUAGE ) );
146
147 const vcl::Font *pFont = GetTargetFont();
148 if (pFont)
149 {
150 SvxFontItem aFontItem( pFont->GetFamilyType(), pFont->GetFamilyName(),
151 pFont->GetStyleName(), pFont->GetPitch(),
153 pDoc->SetDefault( aFontItem );
154 }
155}
156
158 OUString& rNextPortion,
159 LanguageType& rLangOfPortion,
160 bool bAllowChanges )
161{
162 m_pConvArgs->bAllowImplicitChangesForNotConvertibleText = bAllowChanges;
163
165 rNextPortion = m_pConvArgs->aConvText;
166 rLangOfPortion = m_pConvArgs->nConvTextLang;
167
168 m_nUnitOffset = 0;
169
170 // build last pos from currently selected text
171 SwPaM* pCursor = m_rWrtShell.GetCursor();
172 m_nLastPos = pCursor->Start()->GetContentIndex();
173}
174
175void SwHHCWrapper::SelectNewUnit_impl( sal_Int32 nUnitStart, sal_Int32 nUnitEnd )
176{
177 SwPaM *pCursor = m_rWrtShell.GetCursor();
178 pCursor->GetPoint()->SetContent( m_nLastPos );
179 pCursor->DeleteMark();
180
181 m_rWrtShell.Right( SwCursorSkipMode::Chars, /*bExpand*/ false,
182 o3tl::narrowing<sal_uInt16>(m_nUnitOffset + nUnitStart), true );
183 pCursor->SetMark();
184 m_rWrtShell.Right( SwCursorSkipMode::Chars, /*bExpand*/ true,
185 o3tl::narrowing<sal_uInt16>(nUnitEnd - nUnitStart), true );
186 // end selection now. Otherwise SHIFT+HOME (extending the selection)
187 // won't work when the dialog is closed without any replacement.
188 // (see #116346#)
190}
191
193 const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd )
194{
195 OSL_ENSURE( nUnitStart >= 0 && nUnitEnd >= nUnitStart, "wrong arguments" );
196 if (0 > nUnitStart || nUnitStart > nUnitEnd)
197 return;
198
200
202
203 // select current unit
204 SelectNewUnit_impl( nUnitStart, nUnitEnd );
205
207}
208
209void SwHHCWrapper::ChangeText( const OUString &rNewText,
210 std::u16string_view aOrigText,
211 const uno::Sequence< sal_Int32 > *pOffsets,
212 SwPaM *pCursor )
213{
216
217 OSL_ENSURE( !rNewText.isEmpty(), "unexpected empty string" );
218 if (rNewText.isEmpty())
219 return;
220
221 if (pOffsets && pCursor) // try to keep as much attributation as possible ?
222 {
223 // remember cursor start position for later setting of the cursor
224 const SwPosition *pStart = pCursor->Start();
225 const sal_Int32 nStartIndex = pStart->GetContentIndex();
226 SwTextNode *pStartTextNode = pStart->GetNode().GetTextNode();
227
228 const sal_Int32 nIndices = pOffsets->getLength();
229 const sal_Int32 *pIndices = pOffsets->getConstArray();
230 sal_Int32 nConvTextLen = rNewText.getLength();
231 sal_Int32 nPos = 0;
232 sal_Int32 nChgPos = -1;
233 sal_Int32 nChgLen = 0;
234 sal_Int32 nConvChgPos = -1;
235 sal_Int32 nConvChgLen = 0;
236
237 // offset to calculate the position in the text taking into
238 // account that text may have been replaced with new text of
239 // different length. Negative values allowed!
240 tools::Long nCorrectionOffset = 0;
241
242 OSL_ENSURE(nIndices == 0 || nIndices == nConvTextLen,
243 "mismatch between string length and sequence length!" );
244
245 // find all substrings that need to be replaced (and only those)
246 while (true)
247 {
248 // get index in original text that matches nPos in new text
249 sal_Int32 nIndex;
250 if (nPos < nConvTextLen)
251 nIndex = nPos < nIndices ? pIndices[nPos] : nPos;
252 else
253 {
254 nPos = nConvTextLen;
255 nIndex = aOrigText.size();
256 }
257
258 if (nPos == nConvTextLen || /* end of string also terminates non-matching char sequence */
259 aOrigText[nIndex] == rNewText[nPos])
260 {
261 // substring that needs to be replaced found?
262 if (nChgPos != -1 && nConvChgPos != -1)
263 {
264 nChgLen = nIndex - nChgPos;
265 nConvChgLen = nPos - nConvChgPos;
266 OUString aInNew( rNewText.copy( nConvChgPos, nConvChgLen ) );
267
268 // set selection to sub string to be replaced in original text
269 sal_Int32 nChgInNodeStartIndex = nStartIndex + nCorrectionOffset + nChgPos;
270 OSL_ENSURE( m_rWrtShell.GetCursor()->HasMark(), "cursor misplaced (nothing selected)" );
271 m_rWrtShell.GetCursor()->GetMark()->Assign( *pStartTextNode, nChgInNodeStartIndex );
272 m_rWrtShell.GetCursor()->GetPoint()->Assign( *pStartTextNode, nChgInNodeStartIndex + nChgLen );
273
274 // replace selected sub string with the corresponding
275 // sub string from the new text while keeping as
276 // much from the attributes as possible
277 ChangeText_impl( aInNew, true );
278
279 nCorrectionOffset += nConvChgLen - nChgLen;
280
281 nChgPos = -1;
282 nConvChgPos = -1;
283 }
284 }
285 else
286 {
287 // begin of non-matching char sequence found ?
288 if (nChgPos == -1 && nConvChgPos == -1)
289 {
290 nChgPos = nIndex;
291 nConvChgPos = nPos;
292 }
293 }
294 if (nPos >= nConvTextLen)
295 break;
296 ++nPos;
297 }
298
299 // set cursor to the end of all the new text
300 // (as it would happen after ChangeText_impl (Delete and Insert)
301 // of the whole text in the 'else' branch below)
303 m_rWrtShell.GetCursor()->Start()->Assign( *pStartTextNode, nStartIndex + nConvTextLen );
304 }
305 else
306 {
307 ChangeText_impl( rNewText, false );
308 }
309}
310
311void SwHHCWrapper::ChangeText_impl( const OUString &rNewText, bool bKeepAttributes )
312{
313 if (bKeepAttributes)
314 {
315 // get item set with all relevant attributes
317 // get all attributes spanning the whole selection in order to
318 // restore those for the new text
319 m_rWrtShell.GetCurAttr( aItemSet );
320
321 m_rWrtShell.Delete(true);
322 m_rWrtShell.Insert( rNewText );
323
324 // select new inserted text (currently the Point is right after the new text)
325 if (!m_rWrtShell.GetCursor()->HasMark())
328 pMark->SetContent( pMark->GetContentIndex() - rNewText.getLength() );
329
330 // since 'SetAttr' below functions like merging with the attributes
331 // from the itemset with any existing ones we have to get rid of all
332 // all attributes now. (Those attributes that may take effect left
333 // to the position where the new text gets inserted after the old text
334 // was deleted)
336 // apply previously saved attributes to new text
337 m_rWrtShell.SetAttrSet( aItemSet );
338 }
339 else
340 {
341 m_rWrtShell.Delete(true);
342 m_rWrtShell.Insert( rNewText );
343 }
344}
345
347 const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
348 const OUString& rOrigText,
349 const OUString& rReplaceWith,
350 const uno::Sequence< sal_Int32 > &rOffsets,
351 ReplacementAction eAction,
352 LanguageType *pNewUnitLanguage )
353{
354 OSL_ENSURE( nUnitStart >= 0 && nUnitEnd >= nUnitStart, "wrong arguments" );
355 if (nUnitStart < 0 || nUnitEnd < nUnitStart)
356 return;
357
359
360 // replace the current word
362
363 // select current unit
364 SelectNewUnit_impl( nUnitStart, nUnitEnd );
365
366 OUString aOrigText( m_rWrtShell.GetSelText() );
367 OUString aNewText( rReplaceWith );
368 OSL_ENSURE( aOrigText == rOrigText, "!! text mismatch !!" );
369 std::unique_ptr<SwFormatRuby> pRuby;
370 bool bRubyBelow = false;
371 OUString aNewOrigText;
372 switch (eAction)
373 {
374 case eExchange :
375 break;
377 {
378 aNewText = aOrigText + "(" + rReplaceWith + ")";
379 }
380 break;
381 case eOriginalBracketed :
382 {
383 aNewText = rReplaceWith + "(" + aOrigText + ")";
384 }
385 break;
386 case eReplacementAbove :
387 {
388 pRuby.reset(new SwFormatRuby( rReplaceWith ));
389 }
390 break;
391 case eOriginalAbove :
392 {
393 pRuby.reset(new SwFormatRuby( aOrigText ));
394 aNewOrigText = rReplaceWith;
395 }
396 break;
397 case eReplacementBelow :
398 {
399 pRuby.reset(new SwFormatRuby( rReplaceWith ));
400 bRubyBelow = true;
401 }
402 break;
403 case eOriginalBelow :
404 {
405 pRuby.reset(new SwFormatRuby( aOrigText ));
406 aNewOrigText = rReplaceWith;
407 bRubyBelow = true;
408 }
409 break;
410 default:
411 OSL_FAIL("unexpected case" );
412 }
413 m_nUnitOffset += nUnitStart + aNewText.getLength();
414
415 if (pRuby)
416 {
418 if (!aNewOrigText.isEmpty())
419 {
420 // according to FT we currently should not bother about keeping
421 // attributes in Hangul/Hanja conversion
422 ChangeText( aNewOrigText, rOrigText, nullptr, nullptr );
423
428 // We didn't fix it in Delete and Insert since it is currently
429 // unclear if someone depends on this incorrect behaviour
430 // of the flag.
432
433 m_rWrtShell.Left( SwCursorSkipMode::Chars, true, aNewOrigText.getLength(), true, true );
434 }
435
436 pRuby->SetPosition( o3tl::narrowing<sal_uInt16>(bRubyBelow) );
437 pRuby->SetAdjustment( RubyAdjust_CENTER );
438
439 m_rWrtShell.SetAttrItem(*pRuby);
440 pRuby.reset();
442 }
443 else
444 {
446
447 // according to FT we should currently not bother about keeping
448 // attributes in Hangul/Hanja conversion and leave that untouched.
449 // Thus we do this only for Chinese translation...
450 const bool bIsChineseConversion = IsChinese( GetSourceLanguage() );
451 if (bIsChineseConversion)
452 ChangeText( aNewText, rOrigText, &rOffsets, m_rWrtShell.GetCursor() );
453 else
454 ChangeText( aNewText, rOrigText, nullptr, nullptr );
455
456 // change language and font if necessary
457 if (bIsChineseConversion)
458 {
460 m_rWrtShell.GetCursor()->GetMark()->AdjustContent( -aNewText.getLength() );
461
463 "SwHHCWrapper::ReplaceUnit : unexpected target language" );
464
468 aSet( m_rWrtShell.GetAttrPool() );
469 if (pNewUnitLanguage)
470 {
471 aSet.Put( SvxLanguageItem( *pNewUnitLanguage, RES_CHRATR_CJK_LANGUAGE ) );
472 }
473
474 const vcl::Font *pTargetFont = GetTargetFont();
475 OSL_ENSURE( pTargetFont, "target font missing?" );
476 if (pTargetFont && pNewUnitLanguage)
477 {
478 SvxFontItem aFontItem( aSet.Get( RES_CHRATR_CJK_FONT ) );
479 aFontItem.SetFamilyName( pTargetFont->GetFamilyName());
480 aFontItem.SetFamily( pTargetFont->GetFamilyType());
481 aFontItem.SetStyleName( pTargetFont->GetStyleName());
482 aFontItem.SetPitch( pTargetFont->GetPitch());
483 aFontItem.SetCharSet( pTargetFont->GetCharSet() );
484 aSet.Put( aFontItem );
485 }
486
487 m_rWrtShell.SetAttrSet( aSet );
488
490 }
491
493 }
494
496}
497
499{
500 return true;
501}
502
504{
505 OSL_ENSURE( m_pConvArgs == nullptr, "NULL pointer expected" );
506 {
507 SwPaM *pCursor = m_pView->GetWrtShell().GetCursor();
508 auto [pSttPos, pEndPos] = pCursor->StartEnd(); // SwPosition*
509
510 if (pSttPos->GetNode().IsTextNode() &&
511 pEndPos->GetNode().IsTextNode())
512 {
513 m_pConvArgs.reset( new SwConversionArgs( GetSourceLanguage(), *pSttPos, *pEndPos ) );
514 }
515 else // we are not in the text (maybe a graphic or OLE object is selected) let's start from the top
516 {
517 // get PaM that points to the start of the document
519 SwPaM aPam(rNode);
520 aPam.Move( fnMoveBackward, GoInDoc ); // move to start of document
521
522 pSttPos = aPam.GetPoint();
523 SwTextNode *pTextNode = pSttPos->GetNode().GetTextNode();
524 // just in case we check anyway...
525 if (!pTextNode || !pTextNode->IsTextNode())
526 return;
527 m_pConvArgs.reset( new SwConversionArgs( GetSourceLanguage(), *pSttPos, *pSttPos ) );
528 }
529 OSL_ENSURE( m_pConvArgs->pStartPos && m_pConvArgs->pStartPos->GetNode().IsTextNode(),
530 "failed to get proper start text node" );
531 OSL_ENSURE( m_pConvArgs->pEndPos && m_pConvArgs->pEndPos->GetNode().IsTextNode(),
532 "failed to get proper end text node" );
533
534 // chinese conversion specific settings
536 "source and target language mismatch?" );
538 {
539 m_pConvArgs->nConvTargetLang = GetTargetLanguage();
540 m_pConvArgs->pTargetFont = GetTargetFont();
541 m_pConvArgs->bAllowImplicitChangesForNotConvertibleText = true;
542 }
543
544 // if it is not just a selection and we are about to begin
545 // with the current conversion for the very first time
546 // we need to find the start of the current (initial)
547 // convertible unit in order for the text conversion to give
548 // the correct result for that. Since it is easier to obtain
549 // the start of the word we use that though.
550 if (!pCursor->HasMark()) // is not a selection?
551 {
552 // since #118246 / #117803 still occurs if the cursor is placed
553 // between the two chinese characters to be converted (because both
554 // of them are words on their own!) using the word boundary here does
555 // not work. Thus since chinese conversion is not interactive we start
556 // at the begin of the paragraph to solve the problem, i.e. have the
557 // TextConversion service get those characters together in the same call.
558 sal_Int32 nStartIdx = -1;
560 nStartIdx = 0;
561 else
562 {
563 OUString aText( m_pConvArgs->pStartPos->GetNode().GetTextNode()->GetText() );
564 const sal_Int32 nPos = m_pConvArgs->pStartPos->GetContentIndex();
565 Boundary aBoundary( g_pBreakIt->GetBreakIter()->
566 getWordBoundary( aText, nPos, g_pBreakIt->GetLocale( m_pConvArgs->nConvSrcLang ),
567 WordType::DICTIONARY_WORD, true ) );
568
569 // valid result found?
570 if (aBoundary.startPos < aText.getLength() &&
571 aBoundary.startPos != aBoundary.endPos)
572 {
573 nStartIdx = aBoundary.startPos;
574 }
575 }
576
577 if (nStartIdx != -1)
578 m_pConvArgs->pStartPos->SetContent( nStartIdx );
579 }
580 }
581
582 if ( m_bIsOtherContent )
583 ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::Other );
584 else
585 {
586 m_bStartChk = false;
587 ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::BodyEnd );
588 }
589
591
592 ConvEnd_impl( m_pConvArgs.get() );
593}
594
596{
598
599 // no change of direction so the desired region is fully processed
600 if( m_bStartChk )
601 m_bStartDone = true;
602 else
603 m_bEndDone = true;
604
605 if( m_bIsOtherContent && m_bStartDone && m_bEndDone ) // document completely checked?
606 {
607 return false;
608 }
609
610 bool bGoOn = false;
611
612 if ( m_bIsOtherContent )
613 {
614 m_bStartChk = false;
615 ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::Body );
616 bGoOn = true;
617 }
618 else if ( m_bStartDone && m_bEndDone )
619 {
620 // body region done, ask about special region
622 {
623 ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::Other );
624 m_bIsOtherContent = bGoOn = true;
625 }
626 }
627 else
628 {
630 ConvStart_impl( m_pConvArgs.get(), m_bStartChk ? SvxSpellArea::BodyStart : SvxSpellArea::BodyEnd );
631 bGoOn = true;
632 }
633 return bGoOn;
634}
635
637{
639
640 bool bFound = false;
641
643 bool bConv = true;
644
645 while ( bConv )
646 {
647 bFound = ConvContinue_impl( m_pConvArgs.get() );
648 if (bFound)
649 {
650 bConv = false;
651 }
652 else
653 {
654 ConvEnd_impl( m_pConvArgs.get() );
655 bConv = ConvNext_impl();
656 }
657 }
658}
659
660void SwHHCWrapper::ConvStart_impl( SwConversionArgs /* [out] */ *pConversionArgs, SvxSpellArea eArea )
661{
662 m_bIsDrawObj = SvxSpellArea::Other == eArea;
663 m_pView->SpellStart( eArea, m_bStartDone, m_bEndDone, /* [out] */ pConversionArgs );
664}
665
666void SwHHCWrapper::ConvEnd_impl( SwConversionArgs const *pConversionArgs )
667{
668 m_pView->SpellEnd( pConversionArgs );
669}
670
672{
673 bool bProgress = !m_bIsDrawObj && !m_bIsSelection;
674 pConversionArgs->aConvText.clear();
675 pConversionArgs->nConvTextLang = LANGUAGE_NONE;
676 m_pView->GetWrtShell().SpellContinue( &m_nPageCount, bProgress ? &m_nPageStart : nullptr, pConversionArgs );
677 return !pConversionArgs->aConvText.isEmpty();
678}
679
680/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
void StartTextConversion()
Definition: sdrhhcwrap.cxx:91
vcl::Window * GetWindow() const
void SetStyleName(const OUString &rStyleName)
void SetFamily(FontFamily _eFamily)
void SetPitch(FontPitch _ePitch)
void SetFamilyName(const OUString &rFamilyName)
void SetCharSet(rtl_TextEncoding _eEncoding)
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:63
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:68
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2862
void ClearMark()
Definition: crsrsh.cxx:1225
void SetMark()
Definition: crsrsh.hxx:906
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:197
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:548
SwNodes & GetNodes()
Definition: doc.hxx:422
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
bool Delete(bool isArtificialSelection=false)
Delete content of all ranges.
Definition: eddel.cxx:134
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:129
css::uno::Any SpellContinue(sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt, SwConversionArgs const *pConvArgs)
Definition: edlingu.cxx:687
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
bool HasOtherCnt() const
Are there frames, footnotes, etc.
Definition: edws.cxx:144
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
void EndAllAction()
Definition: edws.cxx:97
size_t IsObjSelected() const
Definition: feshview.cxx:1125
void ChangeText_impl(const OUString &rNewText, bool bKeepAttributes)
Definition: hhcwrp.cxx:311
SwView * m_pView
Definition: hhcwrp.hxx:33
virtual bool HasRubySupport() const override
Definition: hhcwrp.cxx:498
sal_uInt16 m_nPageCount
page count for progress bar
Definition: hhcwrp.hxx:44
bool m_bIsDrawObj
Definition: hhcwrp.hxx:47
void SelectNewUnit_impl(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd)
Definition: hhcwrp.cxx:175
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
Definition: hhcwrp.cxx:346
virtual void HandleNewUnit(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd) override
Definition: hhcwrp.cxx:192
virtual void GetNextPortion(OUString &rNextPortion, LanguageType &rLangOfPortion, bool bAllowImplicitChangesForNotConvertibleText) override
Definition: hhcwrp.cxx:157
void Convert()
Definition: hhcwrp.cxx:503
void ConvEnd_impl(SwConversionArgs const *pConvArgs)
former SpellEnd
Definition: hhcwrp.cxx:666
SwHHCWrapper(SwView *pView, const css::uno::Reference< css::uno::XComponentContext > &rxContext, LanguageType nSourceLanguage, LanguageType nTargetLanguage, const vcl::Font *pTargetFont, sal_Int32 nConvOptions, bool bIsInteractive, bool bStart, bool bOther, bool bSelection)
Definition: hhcwrp.cxx:80
bool m_bStartChk
Definition: hhcwrp.hxx:49
bool m_bIsSelection
true if only the selected text should be converted
Definition: hhcwrp.hxx:50
bool ConvContinue_impl(SwConversionArgs *pConvArgs)
former SpellContinue
Definition: hhcwrp.cxx:671
void ChangeText(const OUString &rNewText, std::u16string_view aOrigText, const css::uno::Sequence< sal_Int32 > *pOffsets, SwPaM *pCursor)
Definition: hhcwrp.cxx:209
sal_Int32 m_nLastPos
starting position of the last found text part (needs to be sth that gets not moved like SwPaM or SwPo...
Definition: hhcwrp.hxx:39
bool m_bIsOtherContent
Definition: hhcwrp.hxx:48
void ConvStart_impl(SwConversionArgs *pConvArgs, SvxSpellArea eSpell)
former SpellStart
Definition: hhcwrp.cxx:660
sal_Int32 m_nUnitOffset
Definition: hhcwrp.hxx:42
bool m_bStartDone
Definition: hhcwrp.hxx:51
bool m_bEndDone
Definition: hhcwrp.hxx:52
SwWrtShell & m_rWrtShell
Definition: hhcwrp.hxx:34
void FindConvText_impl()
former FindSpellError
Definition: hhcwrp.cxx:636
bool ConvNext_impl()
from SvxSpellWrapper copied and modified
Definition: hhcwrp.cxx:595
std::unique_ptr< SwConversionArgs > m_pConvArgs
object for arguments (and results) needed to find of next convertible text portion
Definition: hhcwrp.hxx:36
virtual ~SwHHCWrapper() COVERITY_NOEXCEPT_FALSE override
Definition: hhcwrp.cxx:110
sal_uInt16 m_nPageStart
first checked page
Definition: hhcwrp.hxx:45
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
bool IsTextNode() const
Definition: node.hxx:190
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:269
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:657
void DeleteMark()
Definition: pam.hxx:232
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool HasDrawView() const
Definition: vnew.cxx:371
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2669
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
SAL_DLLPRIVATE void SpellStart(SvxSpellArea eSpell, bool bStartDone, bool bEndDone, SwConversionArgs *pConvArgs)
Definition: viewling.cxx:263
SwDocShell * GetDocShell()
Definition: view.cxx:1193
SAL_DLLPRIVATE void SpellEnd(SwConversionArgs const *pConvArgs)
Definition: viewling.cxx:369
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
bool IsSelFrameMode() const
Definition: wrtsh.hxx:177
bool Right(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:127
void EndSelect()
Definition: select.cxx:434
bool Left(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
void Insert(const OUString &)
Definition: wrtsh1.cxx:226
void EnterStdMode()
Definition: select.cxx:560
const vcl::Font * GetTargetFont() const
weld::Widget * GetUIParent() const
static void SetUseSavedConversionDirectionState(bool bVal)
LanguageType GetSourceLanguage() const
static bool IsChinese(LanguageType nLang)
sal_Int32 GetConversionOptions() const
LanguageType GetTargetLanguage() const
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
FontPitch GetPitch()
rtl_TextEncoding GetCharSet() const
void SetCursor(vcl::Cursor *pCursor)
vcl::Cursor * GetCursor() const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
static void lcl_ActivateTextShell(SwWrtShell &rWrtSh)
Definition: hhcwrp.cxx:53
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
sal_Int32 nIndex
#define LANGUAGE_CHINESE_TRADITIONAL
#define LANGUAGE_NONE
#define LANGUAGE_CHINESE_SIMPLIFIED
sal_uInt16 nPos
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
long Long
bool GoInDoc(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1182
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
OUString aConvText
Definition: splargs.hxx:61
LanguageType nConvTextLang
Definition: splargs.hxx:63
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:267
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:262
SvxSpellArea