LibreOffice Module sw (master) 1
autofmt.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
22#include <osl/diagnose.h>
24
25#include <editeng/boxitem.hxx>
26#include <editeng/lrspitem.hxx>
29#include <editeng/tstpitem.hxx>
30#include <editeng/fontitem.hxx>
31#include <editeng/langitem.hxx>
32#include <editeng/acorrcfg.hxx>
33#include <o3tl/string_view.hxx>
34
35#include <swwait.hxx>
36#include <fmtpdsc.hxx>
37#include <doc.hxx>
38#include <IDocumentUndoRedo.hxx>
41#include <redline.hxx>
42#include <unocrsr.hxx>
43#include <docary.hxx>
44#include <editsh.hxx>
45#include <contentindex.hxx>
46#include <pam.hxx>
47#include <swundo.hxx>
48#include <poolfmt.hxx>
49#include <ndtxt.hxx>
50#include <rootfrm.hxx>
51#include <txtfrm.hxx>
52#include <frminf.hxx>
53#include <pagedesc.hxx>
54#include <paratr.hxx>
55#include <acorrect.hxx>
56#include <shellres.hxx>
57#include <section.hxx>
58#include <frmatr.hxx>
59#include <charatr.hxx>
60#include <mdiexp.hxx>
61#include <strings.hrc>
62#include <comcore.hxx>
63#include <numrule.hxx>
64#include <itabenum.hxx>
65
66#include <memory>
67#include <utility>
68
69using namespace ::com::sun::star;
70
71//JP 16.12.99: definition:
72// from pos cPosEnDash to cPosEmDash all chars changed to em dashes,
73// from pos cPosEmDash to cPosEnd all chars changed to em dashes
74// all other chars are changed to the user configuration
75
76const sal_Unicode pBulletChar[6] = { '+', '*', '-', 0x2013, 0x2014, 0 };
77const int cnPosEnDash = 2, cnPosEmDash = 4;
78
81
83
84// Number of num-/bullet-paragraph templates. MAXLEVEL will soon be raised
85// to x, but not the number of templates. (Artifact from <= 4.0)
86const sal_uInt16 cnNumBullColls = 4;
87
89{
91 SwPaM m_aDelPam; // a Pam that can be used
92 SwNodeIndex m_aNdIdx; // the index on the current TextNode
93 SwNodeIndex m_aEndNdIdx; // index on the end of the area
94
97 SwTextNode* m_pCurTextNd; // the current TextNode
98 SwTextFrame* m_pCurTextFrame; // frame of the current TextNode
99 bool m_bIsRightToLeft; // text direction of the current frame
100 SwNodeOffset m_nEndNdIdx; // for the percentage-display
101 mutable std::unique_ptr<CharClass> m_pCharClass; // Character classification
103
105
106 enum
107 {
108 NONE = 0,
109 DELIM = 1,
110 DIGIT = 2,
111 CHG = 4,
117 };
118
119 bool m_bEnd : 1;
120 bool m_bMoreLines : 1;
121
123 {
124 if( !m_pCharClass || eLang != m_eCharClassLang )
125 {
126 m_pCharClass.reset( new CharClass( LanguageTag( eLang ) ) );
127 m_eCharClassLang = eLang;
128 }
129 return *m_pCharClass;
130 }
131
132 static bool IsSpace( const sal_Unicode c )
133 { return (' ' == c || '\t' == c || 0x0a == c|| 0x3000 == c /* Jap. space */); }
134
135 void SetColl( sal_uInt16 nId, bool bHdLineOrText = false );
136 void GoNextPara();
137 static bool HasObjects(const SwTextFrame &);
138
139 // TextNode methods
140 const SwTextFrame * GetNextNode(bool isCheckEnd = true) const;
141 static bool IsEmptyLine(const SwTextFrame & rFrame)
142 {
143 return rFrame.GetText().isEmpty()
144 || rFrame.GetText().getLength() == GetLeadingBlanks(rFrame.GetText());
145 }
146
147 bool IsOneLine(const SwTextFrame &) const;
148 bool IsFastFullLine(const SwTextFrame &) const;
149 bool IsNoAlphaLine(const SwTextFrame &) const;
150 bool IsEnumericChar(const SwTextFrame &) const;
151 static bool IsBlanksInString(const SwTextFrame&);
152 sal_uInt16 CalcLevel(const SwTextFrame&, sal_uInt16 *pDigitLvl = nullptr) const;
153 sal_Int32 GetBigIndent(TextFrameIndex & rCurrentSpacePos) const;
154
155 static OUString DelLeadingBlanks(const OUString& rStr);
156 static OUString DelTrailingBlanks( const OUString& rStr );
157 static sal_Int32 GetLeadingBlanks( std::u16string_view aStr );
158 static sal_Int32 GetTrailingBlanks( std::u16string_view aStr );
159
160 bool IsFirstCharCapital(const SwTextFrame & rNd) const;
161 sal_uInt16 GetDigitLevel(const SwTextFrame& rFrame, TextFrameIndex& rPos,
162 OUString* pPrefix = nullptr, OUString* pPostfix = nullptr,
163 OUString* pNumTypes = nullptr ) const;
165 SwTextFrame* GetFrame( const SwTextNode& rTextNd ) const;
167
168 void BuildIndent();
169 void BuildText();
170 void BuildTextIndent();
171 void BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel );
172 void BuildNegIndent( SwTwips nSpaces );
173 void BuildHeadLine( sal_uInt16 nLvl );
174
175 static bool HasBreakAttr(const SwTextFrame &);
176 void DeleteSel( SwPaM& rPam );
177 void DeleteSelImpl(SwPaM & rDelPam, SwPaM & rPamToCorrect);
178 bool DeleteJoinCurNextPara(SwTextFrame const* pNextFrame, bool bIgnoreLeadingBlanks = false);
180 void DeleteLeadingTrailingBlanks( bool bStart = true, bool bEnd = true );
181 void DelEmptyLine( bool bTstNextPara = true );
184 void DelMoreLinesBlanks( bool bWithLineBreaks = false );
186 void JoinPrevPara();
188 void AutoCorrect(TextFrameIndex nSttPos = TextFrameIndex(0));
189
190 bool CanJoin(const SwTextFrame * pNextFrame) const
191 {
192 return !m_bEnd && pNextFrame
193 && !IsEmptyLine(*pNextFrame)
194 && !IsNoAlphaLine(*pNextFrame)
195 && !IsEnumericChar(*pNextFrame)
196 // check the last / first nodes here...
197 && ((COMPLETE_STRING - 50 - pNextFrame->GetTextNodeFirst()->GetText().getLength())
200 : m_pCurTextNd)->GetText().getLength())
201 && !HasBreakAttr(*pNextFrame);
202 }
203
205 static bool IsSentenceAtEnd(const SwTextFrame & rTextFrame);
206
207 bool DoUnderline();
208 bool DoTable();
209
210 void SetRedlineText_( sal_uInt16 nId );
211 bool SetRedlineText( sal_uInt16 nId ) {
214 return true;
215 }
219 }
220
221public:
223 SwNode const * pSttNd = nullptr, SwNode const * pEndNd = nullptr );
224};
225
226static const sal_Unicode* StrChr( const sal_Unicode* pSrc, sal_Unicode c )
227{
228 while( *pSrc && *pSrc != c )
229 ++pSrc;
230 return *pSrc ? pSrc : nullptr;
231}
232
234{
235 // get the Frame
236 const SwContentFrame *pFrame = rTextNd.getLayoutFrame( m_pEditShell->GetLayout() );
237 assert(pFrame && "For Autoformat a Layout is needed");
238 return EnsureFormatted(*static_cast<SwTextFrame const*>(pFrame));
239}
240
242{
243 SwTextFrame *const pFrame(const_cast<SwTextFrame*>(&rFrame));
245 {
247 SwRect aTmpFrame( pFrame->getFrameArea() );
248 SwRect aTmpPrt( pFrame->getFramePrintArea() );
249 pFrame->Calc(pFrame->getRootFrame()->GetCurrShell()->GetOut());
250
251 if( pFrame->getFrameArea() != aTmpFrame || pFrame->getFramePrintArea() != aTmpPrt ||
252 !pFrame->GetPaintSwRect().IsEmpty())
253 {
254 pFrame->SetCompletePaint();
255 }
256 }
257
258 return pFrame->GetFormatted();
259}
260
261void SwAutoFormat::SetRedlineText_( sal_uInt16 nActionId )
262{
263 OUString sText;
264 sal_uInt16 nSeqNo = 0;
265 if( STR_AUTOFMTREDL_END > nActionId )
266 {
267 sText = SwViewShell::GetShellRes()->GetAutoFormatNameLst()[ nActionId ];
268 switch( nActionId )
269 {
272
273 // AutoCorrect actions
285 nSeqNo = ++m_nRedlAutoFormatSeqId;
286 break;
287 }
288 }
289#if OSL_DEBUG_LEVEL > 0
290 else
291 sText = "Action text is missing";
292#endif
293
295}
296
298{
299 SwNode* pNewNd = nullptr;
300 do {
301 // has to be checked twice before and after incrementation
303 {
304 m_bEnd = true;
305 return;
306 }
307
310 {
311 m_bEnd = true;
312 return;
313 }
314 else
315 pNewNd = &m_aNdIdx.GetNode();
316
317 // not a TextNode ->
318 // TableNode : skip table
319 // NoTextNode : skip nodes
320 // EndNode : at the end, terminate
321 if( pNewNd->IsEndNode() )
322 {
323 m_bEnd = true;
324 return;
325 }
326 else if( pNewNd->IsTableNode() )
327 m_aNdIdx = *pNewNd->EndOfSectionNode();
328 else if( pNewNd->IsSectionNode() )
329 {
330 const SwSection& rSect = pNewNd->GetSectionNode()->GetSection();
331 if( rSect.IsHiddenFlag() || rSect.IsProtectFlag() )
332 m_aNdIdx = *pNewNd->EndOfSectionNode();
333 }
334 } while( !pNewNd->IsTextNode() );
335
338 m_pDoc->GetDocShell() );
339
340 m_pCurTextNd = static_cast<SwTextNode*>(pNewNd);
343}
344
346{
347 // Is there something bound to the paragraph in the paragraph
348 // like Frames, DrawObjects, ...
349 SwNodeIndex node(*rFrame.GetTextNodeFirst());
350 do
351 {
352 if (!node.GetNode().GetAnchoredFlys().empty())
353 return true;
354 ++node;
355 }
356 while (sw::FrameContainsNode(rFrame, node.GetIndex()));
357 return false;
358}
359
360const SwTextFrame* SwAutoFormat::GetNextNode(bool const isCheckEnd) const
361{
364 if ((isCheckEnd && m_aEndNdIdx <= tmp) || !tmp.GetNode().IsTextNode())
365 return nullptr;
366 // note: the returned frame is not necessarily formatted, have to call
367 // EnsureFormatted for that
368 return static_cast<SwTextFrame*>(tmp.GetNode().GetTextNode()->getLayoutFrame(m_pEditShell->GetLayout()));
369}
370
371bool SwAutoFormat::IsOneLine(const SwTextFrame & rFrame) const
372{
373 SwTextFrameInfo aFInfo( EnsureFormatted(rFrame) );
374 return aFInfo.IsOneLine();
375}
376
378{
379 bool bRet = m_aFlags.bRightMargin;
380 if( bRet )
381 {
382 SwTextFrameInfo aFInfo( EnsureFormatted(rFrame) );
383 bRet = aFInfo.IsFilled( m_aFlags.nRightMargin );
384 }
385 return bRet;
386}
387
389{
390 const OUString& rText = rFrame.GetText();
391 TextFrameIndex nBlanks(GetLeadingBlanks(rText));
392 const TextFrameIndex nLen = TextFrameIndex(rText.getLength()) - nBlanks;
393 if( !nLen )
394 return false;
395
396 // -, +, * separated by blank ??
397 if (TextFrameIndex(2) < nLen && IsSpace(rText[sal_Int32(nBlanks) + 1]))
398 {
399 if (StrChr(pBulletChar, rText[sal_Int32(nBlanks)]))
400 return true;
401 // Should there be a symbol font at the position?
402 SwTextFrameInfo aFInfo( EnsureFormatted(rFrame) );
403 if (aFInfo.IsBullet(nBlanks))
404 return true;
405 }
406
407 // 1.) / 1. / 1.1.1 / (1). / (1) / ...
408 return USHRT_MAX != GetDigitLevel(rFrame, nBlanks);
409}
410
412{
413 // Search more than 5 consecutive blanks/tabs in the string.
414 OUString sTmp( DelLeadingBlanks(rFrame.GetText()) );
415 const sal_Int32 nLen = sTmp.getLength();
416 sal_Int32 nIdx = 0;
417 while (nIdx < nLen)
418 {
419 // Skip non-blanks
420 while (nIdx < nLen && !IsSpace(sTmp[nIdx])) ++nIdx;
421 if (nIdx == nLen)
422 return false;
423 // Then count consecutive blanks
424 const sal_Int32 nFirst = nIdx;
425 while (nIdx < nLen && IsSpace(sTmp[nIdx])) ++nIdx;
426 // And exit if enough consecutive blanks were found
427 if (nIdx-nFirst > 5)
428 return true;
429 }
430 return false;
431}
432
433sal_uInt16 SwAutoFormat::CalcLevel(const SwTextFrame & rFrame,
434 sal_uInt16 *const pDigitLvl) const
435{
436 sal_uInt16 nLvl = 0, nBlnk = 0;
437 const OUString& rText = rFrame.GetText();
438 if( pDigitLvl )
439 *pDigitLvl = USHRT_MAX;
440
442 {
444 {
445 // this is very non-obvious: on the *first* invocation of
446 // AutoFormat, the node will have the tabs (any number) converted
447 // to a fixed indent in BuildTextIndent(), and the number of tabs
448 // is stored in the node;
449 // on the *second* invocation of AutoFormat, CalcLevel() will
450 // retrieve the stored number, and it will be used by
451 // BuildHeadLine() to select the corresponding heading style.
452 nLvl = rFrame.GetTextNodeForParaProps()->GetAutoFormatLvl();
453 const_cast<SwTextNode *>(rFrame.GetTextNodeForParaProps())->SetAutoFormatLvl(0);
454 if( nLvl )
455 return nLvl;
456 }
457 ++nLvl;
458 }
459
460 for (TextFrameIndex n(0),
461 nEnd(rText.getLength()); n < nEnd; ++n)
462 {
463 switch (rText[sal_Int32(n)])
464 {
465 case ' ': if( 3 == ++nBlnk )
466 {
467 ++nLvl;
468 nBlnk = 0;
469 }
470 break;
471 case '\t': ++nLvl;
472 nBlnk = 0;
473 break;
474 default:
475 if( pDigitLvl )
476 // test 1.) / 1. / 1.1.1 / (1). / (1) / ...
477 *pDigitLvl = GetDigitLevel(rFrame, n);
478 return nLvl;
479 }
480 }
481 return nLvl;
482}
483
484sal_Int32 SwAutoFormat::GetBigIndent(TextFrameIndex & rCurrentSpacePos) const
485{
487 const SwTextFrame* pNextFrame = nullptr;
488
489 if( !m_bMoreLines )
490 {
491 pNextFrame = GetNextNode();
492 if (!CanJoin(pNextFrame) || !IsOneLine(*pNextFrame))
493 return 0;
494
495 pNextFrame = EnsureFormatted(*pNextFrame);
496 }
497
498 return aFInfo.GetBigIndent( rCurrentSpacePos, pNextFrame );
499}
500
501bool SwAutoFormat::IsNoAlphaLine(const SwTextFrame & rFrame) const
502{
503 const OUString& rStr = rFrame.GetText();
504 if( rStr.isEmpty() )
505 return false;
506 // or better: determine via number of AlphaNum and !AlphaNum characters
507 sal_Int32 nANChar = 0, nBlnk = 0;
508
509 for (TextFrameIndex n(0),
510 nEnd(rStr.getLength()); n < nEnd; ++n)
511 if (IsSpace(rStr[sal_Int32(n)]))
512 ++nBlnk;
513 else
514 {
515 auto const pair = rFrame.MapViewToModel(n);
516 CharClass& rCC = GetCharClass(pair.first->GetSwAttrSet().GetLanguage().GetLanguage());
517 if (rCC.isLetterNumeric(rStr, sal_Int32(n)))
518 ++nANChar;
519 }
520
521 // If there are 75% of non-alphanumeric characters, then true
522 sal_uLong nLen = rStr.getLength() - nBlnk;
523 nLen = ( nLen * 3 ) / 4; // long overflow, if the strlen > sal_uInt16
524 return sal_Int32(nLen) < (rStr.getLength() - nANChar - nBlnk);
525}
526
528{
529 if( !m_aFlags.bSetBorder )
530 return false;
531
532 OUString const& rText(m_pCurTextFrame->GetText());
533 int eState = 0;
534 sal_Int32 nCnt = 0;
535 while (nCnt < rText.getLength())
536 {
537 int eTmp = 0;
538 switch (rText[nCnt])
539 {
540 case '-': eTmp = 1; break;
541 case '_': eTmp = 2; break;
542 case '=': eTmp = 3; break;
543 case '*': eTmp = 4; break;
544 case '~': eTmp = 5; break;
545 case '#': eTmp = 6; break;
546 default:
547 return false;
548 }
549 if( 0 == eState )
550 eState = eTmp;
551 else if( eState != eTmp )
552 return false;
553 ++nCnt;
554 }
555
556 if( 2 < nCnt )
557 {
558 // then underline the previous paragraph if one exists
559 DelEmptyLine( false ); // -> point will be on end of current paragraph
560 // WARNING: rText may be deleted now, m_pCurTextFrame may be nullptr
562 // apply to last node & rely on InsertItemSet to apply it to props-node
563
565 switch( eState )
566 {
567 case 1: // single, hairline
568 aLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
570 break;
571 case 2: // single, thin
572 aLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
574 break;
575 case 3: // double, thin
576 aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
578 break;
579 case 4: // double, thick/thin
580 aLine.SetBorderLineStyle(SvxBorderLineStyle::THICKTHIN_SMALLGAP);
582 break;
583 case 5: // double, thin/thick
584 aLine.SetBorderLineStyle(SvxBorderLineStyle::THINTHICK_SMALLGAP);
586 break;
587 case 6: // double, medium
588 aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
590 break;
591 }
594 aSet.Put( SwParaConnectBorderItem( false ) );
595 SvxBoxItem aBox( RES_BOX );
596 aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM );
597 aBox.SetDistance(42, SvxBoxItemLine::BOTTOM ); // ~0,75 mm
598 aSet.Put(aBox);
601
603 }
604 return 2 < nCnt;
605}
606
608{
611 return false;
612
613 const OUString& rTmp = m_pCurTextFrame->GetText();
614 TextFrameIndex nSttPlus(GetLeadingBlanks(rTmp));
615 TextFrameIndex nEndPlus(GetTrailingBlanks(rTmp));
616 sal_Unicode cChar;
617
618 if (TextFrameIndex(2) > nEndPlus - nSttPlus
619 || ('+' != (cChar = rTmp[sal_Int32(nSttPlus)]) && '|' != cChar)
620 || ('+' != (cChar = rTmp[sal_Int32(nEndPlus) - 1]) && '|' != cChar))
621 return false;
622
624
625 TextFrameIndex n = nSttPlus;
626 std::vector<sal_uInt16> aPosArr;
627
628 while (n < TextFrameIndex(rTmp.getLength()))
629 {
630 switch (rTmp[sal_Int32(n)])
631 {
632 case '-':
633 case '_':
634 case '=':
635 case ' ':
636 case '\t':
637 break;
638
639 case '+':
640 case '|':
641 aPosArr.push_back( o3tl::narrowing<sal_uInt16>(aInfo.GetCharPos(n)) );
642 break;
643
644 default:
645 return false;
646 }
647 if( ++n == nEndPlus )
648 break;
649 }
650
651 if( 1 < aPosArr.size() )
652 {
653 // get the text node's alignment
654 sal_uInt16 nColCnt = aPosArr.size() - 1;
655 SwTwips nSttPos = aPosArr[ 0 ];
656 sal_Int16 eHori;
658 {
659 case SvxAdjust::Center: eHori = text::HoriOrientation::CENTER; break;
660 case SvxAdjust::Right: eHori = text::HoriOrientation::RIGHT; break;
661
662 default:
663 if( nSttPos )
664 {
666 // then - as last - we need to add the current frame width into the array
667 aPosArr.push_back( o3tl::narrowing<sal_uInt16>(m_pCurTextFrame->getFrameArea().Width()) );
668 }
669 else
670 eHori = text::HoriOrientation::LEFT;
671 break;
672 }
673
674 // then create a table that matches the character
675 DelEmptyLine();
676 // WARNING: rTmp may be deleted now, m_pCurTextFrame may be nullptr
680 *m_aDelPam.GetPoint(), 1, nColCnt, eHori,
681 nullptr, &aPosArr );
682 m_aDelPam.GetPoint()->Assign(aIdx);
683 }
684 return 1 < aPosArr.size();
685}
686
687OUString SwAutoFormat::DelLeadingBlanks( const OUString& rStr )
688{
689 sal_Int32 nL, n;
690 for( nL = rStr.getLength(), n = 0; n < nL && IsSpace( rStr[n] ); ++n )
691 ;
692 if( n ) // no Spaces
693 return rStr.copy(n);
694 return rStr;
695}
696
697OUString SwAutoFormat::DelTrailingBlanks( const OUString& rStr )
698{
699 sal_Int32 nL = rStr.getLength(), n = nL;
700 if( !nL )
701 return rStr;
702
703 while( --n && IsSpace( rStr[ n ] ) )
704 ;
705 if( n+1 != nL ) // no Spaces
706 return rStr.copy( 0, n+1 );
707 return rStr;
708}
709
710sal_Int32 SwAutoFormat::GetLeadingBlanks( std::u16string_view aStr )
711{
712 size_t nL;
713 size_t n;
714
715 for( nL = aStr.size(), n = 0; n < nL && IsSpace( aStr[ n ] ); ++n )
716 ;
717 return n;
718}
719
720sal_Int32 SwAutoFormat::GetTrailingBlanks( std::u16string_view aStr )
721{
722 size_t nL = aStr.size(), n = nL;
723 if( !nL )
724 return 0;
725
726 while( --n && IsSpace( aStr[ n ] ) )
727 ;
728 return ++n;
729}
730
732{
733 const OUString& rText = rFrame.GetText();
734 for (TextFrameIndex n(0),
735 nEnd(rText.getLength()); n < nEnd; ++n)
736 if (!IsSpace(rText[sal_Int32(n)]))
737 {
738 auto const pair = rFrame.MapViewToModel(n);
739 CharClass& rCC = GetCharClass( pair.first->GetSwAttrSet().
741 sal_Int32 nCharType = rCC.getCharacterType(rText, sal_Int32(n));
742 return CharClass::isLetterType( nCharType ) &&
743 0 != ( i18n::KCharacterType::UPPER &
744 nCharType );
745 }
746 return false;
747}
748
749sal_uInt16
751 OUString* pPrefix, OUString* pPostfix, OUString* pNumTypes ) const
752{
753
754 // check for 1.) / 1. / 1.1.1 / (1). / (1) / ...
755 const OUString& rText = rFrame.GetText();
756 sal_Int32 nPos(rPos);
757 int eScan = NONE;
758
759 sal_uInt16 nStart = 0;
760 sal_uInt8 nDigitLvl = 0, nDigitCnt = 0;
761 // count number of parenthesis to assure a sensible order is found
762 sal_uInt16 nOpeningParentheses = 0;
763 sal_uInt16 nClosingParentheses = 0;
764
765 while (nPos < rText.getLength() && nDigitLvl < MAXLEVEL - 1)
766 {
767 auto const pair = rFrame.MapViewToModel(TextFrameIndex(nPos));
768 CharClass& rCC = GetCharClass(pair.first->GetSwAttrSet().GetLanguage().GetLanguage());
769 const sal_Unicode cCurrentChar = rText[nPos];
770 if( ('0' <= cCurrentChar && '9' >= cCurrentChar) ||
771 (0xff10 <= cCurrentChar && 0xff19 >= cCurrentChar) )
772 {
773 if( eScan & DELIM )
774 {
775 if( eScan & CHG ) // not if it starts with a number
776 {
777 ++nDigitLvl;
778 if( pPostfix )
779 *pPostfix += "\x01";
780 }
781
782 if( pNumTypes )
783 *pNumTypes += OUStringChar(sal_Unicode('0' + SVX_NUM_ARABIC));
784
785 eScan = eScan | CHG;
786 }
787 else if( pNumTypes && !(eScan & DIGIT) )
788 *pNumTypes += OUStringChar(sal_Unicode('0' + SVX_NUM_ARABIC));
789
790 eScan &= ~DELIM; // remove Delim
791 if( 0 != (eScan & ~CHG) && DIGIT != (eScan & ~CHG))
792 return USHRT_MAX;
793
794 eScan |= DIGIT; // add Digit
795 if( 3 == ++nDigitCnt ) // more than 2 numbers are not an enum anymore
796 return USHRT_MAX;
797
798 nStart *= 10;
799 nStart += cCurrentChar <= '9' ? cCurrentChar - '0' : cCurrentChar - 0xff10;
800 }
801 else if( rCC.isAlpha( rText, nPos ) )
802 {
803 bool bIsUpper =
804 0 != ( i18n::KCharacterType::UPPER &
805 rCC.getCharacterType( rText, nPos ));
806 sal_Unicode cLow = rCC.lowercase(rText, nPos, 1)[0], cNumTyp;
807 int eTmpScan;
808
809 // Roman numbers are "mdclxvi". Since we want to start numbering with c or d more often,
810 // convert first to characters and later to roman numbers if needed.
811 if( 256 > cLow && strchr( "mdclxvi", cLow ) )
812 {
813 if( bIsUpper )
814 {
815 cNumTyp = '0' + SVX_NUM_ROMAN_UPPER;
816 eTmpScan = UPPER_ROMAN;
817 }
818 else
819 {
820 cNumTyp = '0' + SVX_NUM_ROMAN_LOWER;
821 eTmpScan = LOWER_ROMAN;
822 }
823 }
824 else if( bIsUpper )
825 {
826 cNumTyp = '0' + SVX_NUM_CHARS_UPPER_LETTER;
827 eTmpScan = UPPER_ALPHA;
828 }
829 else
830 {
831 cNumTyp = '0' + SVX_NUM_CHARS_LOWER_LETTER;
832 eTmpScan = LOWER_ALPHA;
833 }
834
835 // Switch to roman numbers (only for c/d!)
836 if( 1 == nDigitCnt && ( eScan & (UPPER_ALPHA|LOWER_ALPHA) ) &&
837 ( 3 == nStart || 4 == nStart) && 256 > cLow &&
838 strchr( "mdclxvi", cLow ) &&
839 (( eScan & UPPER_ALPHA ) ? (eTmpScan & (UPPER_ALPHA|UPPER_ROMAN))
840 : (eTmpScan & (LOWER_ALPHA|LOWER_ROMAN))) )
841 {
842 sal_Unicode c = '0';
843 nStart = 3 == nStart ? 100 : 500;
844 if( UPPER_ALPHA == eTmpScan )
845 {
846 eTmpScan = UPPER_ROMAN;
848 }
849 else
850 {
851 eTmpScan = LOWER_ROMAN;
853 }
854
855 eScan = (eScan & ~(UPPER_ALPHA|LOWER_ALPHA)) | eTmpScan;
856 if( pNumTypes )
857 (*pNumTypes) = pNumTypes->replaceAt( pNumTypes->getLength() - 1, 1, rtl::OUStringChar(c) );
858 }
859
860 if( eScan & DELIM )
861 {
862 if( eScan & CHG ) // not if it starts with a number
863 {
864 ++nDigitLvl;
865 if( pPostfix )
866 *pPostfix += "\x01";
867 }
868
869 if( pNumTypes )
870 *pNumTypes += OUStringChar(cNumTyp);
871 eScan = eScan | CHG;
872 }
873 else if( pNumTypes && !(eScan & eTmpScan) )
874 *pNumTypes += OUStringChar(cNumTyp);
875
876 eScan &= ~DELIM; // remove Delim
877
878 // if another type is set, stop here
879 if( 0 != ( eScan & ~CHG ) && eTmpScan != ( eScan & ~CHG ))
880 return USHRT_MAX;
881
882 if( eTmpScan & (UPPER_ALPHA | LOWER_ALPHA) )
883 {
884 // allow characters only if they appear once
885 return USHRT_MAX;
886 }
887 else
888 {
889 // roman numbers, check if valid characters
890 sal_uInt16 nVal;
891 bool bError = false;
892 switch( cLow )
893 {
894 case 'm': nVal = 1000; goto CHECK_ROMAN_1;
895 case 'd': nVal = 500; goto CHECK_ROMAN_5;
896 case 'c': nVal = 100; goto CHECK_ROMAN_1;
897 case 'l': nVal = 50; goto CHECK_ROMAN_5;
898 case 'x': nVal = 10; goto CHECK_ROMAN_1;
899 case 'v': nVal = 5; goto CHECK_ROMAN_5;
900
901CHECK_ROMAN_1:
902 {
903 int nMod5 = nStart % (nVal * 5);
904 int nLast = nStart % nVal;
905 int n10 = nVal / 10;
906
907 if( nMod5 == ((3 * nVal) + n10 ) ||
908 nMod5 == ((4 * nVal) + n10 ) ||
909 nLast == n10 )
910 nStart = o3tl::narrowing<sal_uInt16>(nStart + (n10 * 8));
911 else if( nMod5 == 0 ||
912 nMod5 == (1 * nVal) ||
913 nMod5 == (2 * nVal) )
914 nStart = nStart + nVal;
915 else
916 bError = true;
917 }
918 break;
919
920CHECK_ROMAN_5:
921 {
922 if( ( nStart / nVal ) & 1 )
923 bError = true;
924 else
925 {
926 int nMod = nStart % nVal;
927 int n10 = nVal / 5;
928 if( n10 == nMod )
929 nStart = o3tl::narrowing<sal_uInt16>(nStart + (3 * n10));
930 else if( 0 == nMod )
931 nStart = nStart + nVal;
932 else
933 bError = true;
934 }
935 }
936 break;
937
938 case 'i':
939 if( nStart % 5 >= 3 )
940 bError = true;
941 else
942 nStart += 1;
943 break;
944
945 default:
946 bError = true;
947 }
948
949 if( bError )
950 return USHRT_MAX;
951 }
952 eScan |= eTmpScan; // add Digit
953 ++nDigitCnt;
954 }
955 else if( (256 > cCurrentChar &&
956 strchr( ".)(", cCurrentChar )) ||
957 0x3002 == cCurrentChar /* Chinese trad. dot */||
958 0xff0e == cCurrentChar /* Japanese dot */||
959 0xFF08 == cCurrentChar /* opening bracket Chin./Jap.*/||
960 0xFF09 == cCurrentChar )/* closing bracket Chin./Jap. */
961 {
962 if(cCurrentChar == '(' || cCurrentChar == 0xFF09)
963 nOpeningParentheses++;
964 else if(cCurrentChar == ')'|| cCurrentChar == 0xFF08)
965 nClosingParentheses++;
966 // only if no numbers were read until here
967 if( pPrefix && !( eScan & ( NO_DELIM | CHG )) )
968 *pPrefix += OUStringChar(rText[nPos]);
969 else if( pPostfix )
970 *pPostfix += OUStringChar(rText[nPos]);
971
972 if( NO_DELIM & eScan )
973 {
974 eScan |= CHG;
975 if( pPrefix )
976 *pPrefix += "\x01" + OUString::number( nStart );
977 }
978 eScan &= ~NO_DELIM; // remove Delim
979 eScan |= DELIM; // add Digit
980 nDigitCnt = 0;
981 nStart = 0;
982 }
983 else
984 break;
985 ++nPos;
986 }
987 if (!( CHG & eScan ) || rPos == TextFrameIndex(nPos) ||
988 nPos == rText.getLength() || !IsSpace(rText[nPos]) ||
989 (nOpeningParentheses > nClosingParentheses))
990 return USHRT_MAX;
991
992 if( (NO_DELIM & eScan) && pPrefix ) // do not forget the last one
993 *pPrefix += "\x01" + OUString::number( nStart );
994
995 rPos = TextFrameIndex(nPos);
996 return nDigitLvl; // 0 .. 9 (MAXLEVEL - 1)
997}
998
999void SwAutoFormat::SetColl( sal_uInt16 nId, bool bHdLineOrText )
1000{
1003
1004 // keep hard tabs, alignment, language, hyphenation, DropCaps and nearly all frame attributes
1010
1012 {
1013 aSet.Put(*m_aDelPam.GetPoint()->GetNode().GetTextNode()->GetpSwAttrSet());
1014 // take HeaderLine/TextBody only if centered or right aligned, otherwise only justification
1015 if( SvxAdjustItem const * pAdj = aSet.GetItemIfSet( RES_PARATR_ADJUST, false) )
1016 {
1017 SvxAdjust eAdj = pAdj->GetAdjust();
1018 if( bHdLineOrText ? (SvxAdjust::Right != eAdj &&
1019 SvxAdjust::Center != eAdj)
1020 : SvxAdjust::Block != eAdj )
1021 aSet.ClearItem( RES_PARATR_ADJUST );
1022 }
1023 }
1024
1026}
1027
1028static bool HasSelBlanks(
1029 SwTextFrame const*const pStartFrame, TextFrameIndex & rStartIndex,
1030 SwTextFrame const*const pEndFrame, TextFrameIndex & rEndIndex)
1031{
1032 if (TextFrameIndex(0) < rEndIndex
1033 && rEndIndex < TextFrameIndex(pEndFrame->GetText().getLength())
1034 && ' ' == pEndFrame->GetText()[sal_Int32(rEndIndex) - 1])
1035 {
1036 --rEndIndex;
1037 return true;
1038 }
1039 if (rStartIndex < TextFrameIndex(pStartFrame->GetText().getLength())
1040 && ' ' == pStartFrame->GetText()[sal_Int32(rStartIndex)])
1041 {
1042 ++rStartIndex;
1043 return true;
1044 }
1045 return false;
1046}
1047
1049{
1050 const SfxItemSet *const pSet = rTextFrame.GetTextNodeFirst()->GetpSwAttrSet();
1051 if( !pSet )
1052 return false;
1053
1054 const SvxFormatBreakItem* pBreakItem = pSet->GetItemIfSet( RES_BREAK, false );
1055 if( pBreakItem && SvxBreak::NONE != pBreakItem->GetBreak() )
1056 return true;
1057
1058 const SwFormatPageDesc* pItem = pSet->GetItemIfSet( RES_PAGEDESC, false );
1059 if( pItem && pItem->GetPageDesc()
1060 && UseOnPage::NONE != pItem->GetPageDesc()->GetUseOn() )
1061 return true;
1062 return false;
1063}
1064
1067{
1068 const OUString& rStr = rTextFrame.GetText();
1069 sal_Int32 n = rStr.getLength();
1070 if( !n )
1071 return true;
1072
1073 while( --n && IsSpace( rStr[ n ] ) )
1074 ;
1075 return '.' == rStr[ n ];
1076}
1077
1080{
1084 return;
1085
1086 // delete blanks at the end of the current and at the beginning of the next one
1089 if (bStart && TextFrameIndex(0) != nPos)
1090 {
1096 }
1098 if (bEnd && TextFrameIndex(m_pCurTextFrame->GetText().getLength()) != nPos)
1099 {
1101 TextFrameIndex(m_pCurTextFrame->GetText().getLength()));
1106 }
1107}
1108
1109namespace sw {
1110
1111bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges,
1112 SwDoc & rDoc, SwPaM const& rDelPam)
1113{
1114 bool isNoRedline(true);
1118 {
1119 return isNoRedline;
1120 }
1121 rIDRA.GetRedline(*rDelPam.Start(), &tmp);
1122 SwPosition const* pCurrent(rDelPam.Start());
1123 for ( ; tmp < rIDRA.GetRedlineTable().size(); ++tmp)
1124 {
1125 SwRangeRedline const*const pRedline(rIDRA.GetRedlineTable()[tmp]);
1126 if (*rDelPam.End() <= *pRedline->Start())
1127 {
1128 break;
1129 }
1130 if (*pRedline->End() <= *rDelPam.Start())
1131 {
1132 continue;
1133 }
1134 if (pRedline->GetType() == RedlineType::Delete)
1135 {
1136 assert(*pRedline->Start() != *pRedline->End());
1137 isNoRedline = false;
1138 if (*pCurrent < *pRedline->Start())
1139 {
1140 rRanges.push_back(rDoc.CreateUnoCursor(*pCurrent));
1141 rRanges.back()->SetMark();
1142 *rRanges.back()->GetPoint() = *pRedline->Start();
1143 }
1144 pCurrent = pRedline->End();
1145 }
1146 }
1147 if (!isNoRedline && *pCurrent < *rDelPam.End())
1148 {
1149 rRanges.push_back(rDoc.CreateUnoCursor(*pCurrent));
1150 rRanges.back()->SetMark();
1151 *rRanges.back()->GetPoint() = *rDelPam.End();
1152 }
1153 return isNoRedline;
1154}
1155
1156} // namespace sw
1157
1159{
1160 std::vector<std::shared_ptr<SwUnoCursor>> ranges; // need correcting cursor
1161 if (GetRanges(ranges, *m_pDoc, rDelPam))
1162 {
1163 DeleteSelImpl(rDelPam, rDelPam);
1164 }
1165 else
1166 {
1167 for (auto const& pCursor : ranges)
1168 {
1169 DeleteSelImpl(*pCursor, rDelPam);
1170 }
1171 }
1172}
1173
1174void SwAutoFormat::DeleteSelImpl(SwPaM & rDelPam, SwPaM & rPamToCorrect)
1175{
1176 if (m_aFlags.bWithRedlining || &rDelPam != &rPamToCorrect)
1177 {
1178 // Add to Shell-Cursor-Ring so that DelPam will be moved as well!
1179 SwPaM* pShCursor = m_pEditShell->GetCursor_();
1180 SwPaM aTmp( *m_pCurTextNd, 0, pShCursor );
1181
1182 SwPaM* pPrev = rPamToCorrect.GetPrev();
1183 rPamToCorrect.GetRingContainer().merge( pShCursor->GetRingContainer() );
1184
1185 m_pEditShell->DeleteSel(rDelPam, true);
1186
1187 // and remove Pam again:
1188 SwPaM* p;
1189 SwPaM* pNext = &rPamToCorrect;
1190 do {
1191 p = pNext;
1192 pNext = p->GetNext();
1193 p->MoveTo( &rPamToCorrect );
1194 } while( p != pPrev );
1195
1196 m_aNdIdx = aTmp.GetPoint()->GetNode();
1198 m_pCurTextFrame = GetFrame(*m_pCurTextNd); // keep it up to date
1199 }
1200 else
1201 m_pEditShell->DeleteSel(rDelPam, true);
1202}
1203
1205 bool const bIgnoreLeadingBlanks)
1206{
1207 // delete blanks at the end of the current and at the beginning of the next one
1210
1211 SwTextFrame const*const pEndFrame(pNextFrame ? pNextFrame : m_pCurTextFrame);
1212 TextFrameIndex nLeadingPos(0);
1213 if (pNextFrame)
1214 {
1215 nLeadingPos = TextFrameIndex(
1216 bIgnoreLeadingBlanks ? 0 : GetLeadingBlanks(pNextFrame->GetText()));
1217 }
1218 else
1219 {
1220 nLeadingPos = TextFrameIndex(m_pCurTextFrame->GetText().getLength());
1221 }
1222
1223 // Is there a Blank at the beginning or end?
1224 // Do not delete it, it will be inserted again.
1225 bool bHasBlnks = HasSelBlanks(m_pCurTextFrame, nTrailingPos, pEndFrame, nLeadingPos);
1226
1229 *m_aDelPam.GetPoint() = pEndFrame->MapViewToModelPos(nLeadingPos);
1230
1231 if( *m_aDelPam.GetPoint() != *m_aDelPam.GetMark() )
1234 // note: keep m_aDelPam point at insert pos. for clients
1235
1236 return !bHasBlnks;
1237}
1238
1239void SwAutoFormat::DelEmptyLine( bool bTstNextPara )
1240{
1242 // delete blanks in empty paragraph
1245 TextFrameIndex(0));
1247
1250 if( pTNd )
1251 // first use the previous text node
1252 m_aDelPam.GetMark()->SetContent(pTNd->GetText().getLength());
1253 else if( bTstNextPara )
1254 {
1255 // then try the next (at the beginning of a Doc, table cells, frames, ...)
1256 const SwTextNode* pNext = m_pCurTextFrame->GetMergedPara()
1258 : m_pCurTextNd;
1259 m_aDelPam.GetMark()->Assign(pNext->GetIndex() + 1);
1261 if( pTNd )
1262 {
1264 TextFrameIndex(m_pCurTextFrame->GetText().getLength()));
1265 }
1266 }
1267 if( pTNd )
1268 { // join with previous or next paragraph
1270 }
1271 assert(m_aDelPam.GetPointNode().IsTextNode());
1272 assert(!m_aDelPam.HasMark());
1273 m_aDelPam.SetMark(); // mark remains at join position
1275 // replace until the end of the merged paragraph
1277 TextFrameIndex(m_pCurTextFrame->GetText().getLength()));
1278 if (*m_aDelPam.GetPoint() != *m_aDelPam.GetMark())
1279 { // tdf#137245 replace (not delete) to preserve any flys
1281 }
1282
1285 // note: this likely has deleted m_pCurTextFrame - update it...
1288}
1289
1290void SwAutoFormat::DelMoreLinesBlanks( bool bWithLineBreaks )
1291{
1295 return;
1296
1297 // delete all blanks on the left and right of the indentation
1299
1301 std::vector<std::pair<TextFrameIndex, TextFrameIndex>> spaces;
1302 aFInfo.GetSpaces(spaces, !m_aFlags.bAFormatByInput || bWithLineBreaks);
1303
1304 // tdf#123285 iterate backwards - delete invalidates following indexes
1305 for (auto iter = spaces.rbegin(); iter != spaces.rend(); ++iter)
1306 {
1307 auto & rSpaceRange(*iter);
1308 assert(rSpaceRange.first != rSpaceRange.second);
1309 bool const bHasBlanks = HasSelBlanks(
1310 m_pCurTextFrame, rSpaceRange.first,
1311 m_pCurTextFrame, rSpaceRange.second);
1312 if (rSpaceRange.first != rSpaceRange.second)
1313 {
1314 *m_aDelPam.GetPoint() = m_pCurTextFrame->MapViewToModelPos(rSpaceRange.first);
1316 *m_aDelPam.GetPoint() = m_pCurTextFrame->MapViewToModelPos(rSpaceRange.second);
1318 if (!bHasBlanks)
1319 {
1321 }
1323 }
1324 }
1325}
1326
1328{
1332
1335 if( pTNd )
1336 {
1337 // use the previous text node first
1338 m_aDelPam.GetPoint()->SetContent(pTNd->GetText().getLength());
1340 }
1342}
1343
1345{
1347
1348 // read all succeeding paragraphs that belong to this indentation
1349 bool bBreak = true;
1350 if( m_bMoreLines )
1351 DelMoreLinesBlanks( true );
1352 else
1357 if( !bBreak )
1358 {
1360 const SwTextFrame * pNextFrame = GetNextNode();
1361 if (pNextFrame && !m_bEnd)
1362 {
1363 do {
1364 bBreak = !IsFastFullLine(*pNextFrame)
1365 || IsBlanksInString(*pNextFrame)
1366 || IsSentenceAtEnd(*pNextFrame);
1367 if (DeleteJoinCurNextPara(pNextFrame))
1368 {
1370 }
1371 if( bBreak )
1372 break;
1373 pNextFrame = GetNextNode();
1374 }
1375 while (CanJoin(pNextFrame)
1376 && !CalcLevel(*pNextFrame));
1377 }
1378 }
1380 AutoCorrect();
1381}
1382
1384{
1386 // read all succeeding paragraphs that belong to this indentation
1387 bool bBreak = true;
1388 if( m_bMoreLines )
1389 DelMoreLinesBlanks( true );
1390 else
1394
1396 {
1397 const_cast<SwTextNode*>(m_pCurTextFrame->GetTextNodeForParaProps())->SetAutoFormatLvl(
1398 static_cast<sal_uInt8>(CalcLevel(*m_pCurTextFrame)));
1399 }
1400
1402 if( !bBreak )
1403 {
1405 const SwTextFrame * pNextFrame = GetNextNode();
1406 while (CanJoin(pNextFrame) &&
1407 CalcLevel(*pNextFrame))
1408 {
1409 bBreak = !IsFastFullLine(*pNextFrame)
1410 || IsBlanksInString(*pNextFrame)
1411 || IsSentenceAtEnd(*pNextFrame);
1412 if (DeleteJoinCurNextPara(pNextFrame))
1413 {
1415 }
1416 if( bBreak )
1417 break;
1418 pNextFrame = GetNextNode();
1419 }
1420 }
1422 AutoCorrect();
1423}
1424
1426{
1428 // read all succeeding paragraphs that belong to this text without indentation
1429 bool bBreak = true;
1430 if( m_bMoreLines )
1432 else
1436 SetColl( RES_POOLCOLL_TEXT, true );
1437 if( !bBreak )
1438 {
1440 const SwTextFrame * pNextFrame = GetNextNode();
1441 while (CanJoin(pNextFrame) &&
1442 !CalcLevel(*pNextFrame))
1443 {
1444 bBreak = !IsFastFullLine(*pNextFrame)
1445 || IsBlanksInString(*pNextFrame)
1446 || IsSentenceAtEnd(*pNextFrame);
1447 if (DeleteJoinCurNextPara(pNextFrame))
1448 {
1450 }
1451 if( bBreak )
1452 break;
1453 const SwTextFrame *const pCurrNode = pNextFrame;
1454 pNextFrame = GetNextNode();
1455 if (!pNextFrame || pCurrNode == pNextFrame)
1456 break;
1457 }
1458 }
1460 AutoCorrect();
1461}
1462
1463void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
1464{
1466
1467 bool bBreak = true;
1468
1469 // first, determine current indentation and frame width
1471 SwTwips nLeftTextPos;
1472 {
1474 while (nPos < TextFrameIndex(m_pCurTextFrame->GetText().getLength())
1475 && IsSpace(m_pCurTextFrame->GetText()[sal_Int32(nPos)]))
1476 {
1477 ++nPos;
1478 }
1479
1481 nLeftTextPos = aInfo.GetCharPos(nPos);
1483 }
1484
1485 if( m_bMoreLines )
1487 else
1491 bool bRTL = m_pEditShell->IsInRightToLeftText();
1493
1494 bool bChgBullet = false, bChgEnum = false;
1495 TextFrameIndex nAutoCorrPos(0);
1496
1497 // if numbering is set, get the current one
1499 // #i89178#
1501
1502 const SwNumRule* pCur = nullptr;
1504 {
1506 if (pCur)
1507 {
1508 aRule = *pCur;
1509 }
1510 }
1511
1512 // replace bullet character with defined one
1513 const OUString& rStr = m_pCurTextFrame->GetText();
1514 TextFrameIndex nTextStt(0);
1515 const sal_Unicode* pFndBulletChr = nullptr;
1516 if (m_aFlags.bChgEnumNum && 2 < rStr.getLength())
1517 pFndBulletChr = StrChr(pBulletChar, rStr[sal_Int32(nTextStt)]);
1518 if (nullptr != pFndBulletChr && IsSpace(rStr[sal_Int32(nTextStt) + 1]))
1519 {
1521 {
1522 if( m_aFlags.bSetNumRule )
1523 {
1526 bChgBullet = true;
1527 // Was the format already somewhere adjusted?
1528 if( !aRule.GetNumFormat( nLvl ) )
1529 {
1530 int nBulletPos = pFndBulletChr - pBulletChar;
1531 sal_UCS4 cBullChar;
1532 const vcl::Font* pBullFnt( nullptr );
1533 if( nBulletPos < cnPosEnDash )
1534 {
1535 cBullChar = m_aFlags.cBullet;
1536 pBullFnt = &m_aFlags.aBulletFont;
1537 }
1538 else
1539 {
1540 cBullChar = nBulletPos < cnPosEmDash
1543 // #i63395#
1544 // Only apply user defined default bullet font
1546 {
1547 pBullFnt = &numfunc::GetDefBulletFont();
1548 }
1549 }
1550
1551 sal_Int32 nAbsPos = lBulletIndent;
1552 SwTwips nSpaceSteps = nLvl
1553 ? nLeftTextPos / nLvl
1554 : lBulletIndent;
1555 for( sal_uInt8 n = 0; n < MAXLEVEL; ++n, nAbsPos = nAbsPos + nSpaceSteps )
1556 {
1557 SwNumFormat aFormat( aRule.Get( n ) );
1558 aFormat.SetBulletFont( pBullFnt );
1559 aFormat.SetBulletChar( cBullChar );
1561 // #i93908# clear suffix for bullet lists
1562 aFormat.SetListFormat("", "", n);
1564 aFormat.SetAbsLSpace( nAbsPos );
1565 if( !aFormat.GetCharFormat() )
1566 aFormat.SetCharFormat( pCFormat );
1567 if( bRTL )
1568 aFormat.SetNumAdjust( SvxAdjust::Right );
1569
1570 aRule.Set( n, aFormat );
1571
1572 if( n == nLvl &&
1573 nFrameWidth < ( nSpaceSteps * MAXLEVEL ) )
1574 nSpaceSteps = ( nFrameWidth - nLeftTextPos ) /
1575 ( MAXLEVEL - nLvl );
1576 }
1577 }
1578 }
1579 }
1580 else
1581 {
1582 bChgBullet = true;
1583 SetColl( o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_BULLET_LEVEL1 + ( std::min( nLvl, cnNumBullColls ) * 4 )) );
1584 }
1585 }
1586 else
1587 {
1588 // Then it is a numbering
1589
1590 //JP 21.11.97: The NumLevel is either the DigitLevel or, if the latter is not existent or 0,
1591 // it is determined by the indentation level.
1592
1593 OUString aPostfix, aPrefix, aNumTypes;
1594 nDigitLevel = GetDigitLevel(*m_pCurTextFrame, nTextStt,
1595 &aPrefix, &aPostfix, &aNumTypes);
1596 if (USHRT_MAX != nDigitLevel)
1597 {
1598 bChgEnum = true;
1599
1600 // Level 0 and Indentation, determine level by left indentation and default NumIndent
1601 if( !nDigitLevel && nLeftTextPos )
1602 nLvl = std::min( sal_uInt16( nLeftTextPos / lNumberIndent ),
1603 sal_uInt16( MAXLEVEL - 1 ) );
1604 else
1605 nLvl = nDigitLevel;
1606 }
1607
1608 if( bChgEnum && m_aFlags.bSetNumRule )
1609 {
1610 if( !pCur ) // adjust NumRule if it is new
1611 {
1614
1615 sal_Int32 nPrefixIdx{ 0 };
1616 if( !nDigitLevel )
1617 {
1618 SwNumFormat aFormat( aRule.Get( nLvl ) );
1619 aFormat.SetStart( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx ))));
1620 aFormat.SetListFormat(aPrefix.getToken(0, u'\x0001', nPrefixIdx), aPostfix.getToken(0, u'\x0001'), nLvl);
1621 aFormat.SetIncludeUpperLevels( 0 );
1622
1623 if( !aFormat.GetCharFormat() )
1624 aFormat.SetCharFormat( pCFormat );
1625
1626 if( !aNumTypes.isEmpty() )
1627 aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ 0 ] - '0'));
1628
1629 if( bRTL )
1630 aFormat.SetNumAdjust( SvxAdjust::Right );
1631 aRule.Set( nLvl, aFormat );
1632 }
1633 else
1634 {
1635 auto const nSpaceSteps = nLvl ? nLeftTextPos / nLvl : 0;
1636 sal_uInt16 n;
1637 sal_Int32 nPostfixIdx{ 0 };
1638 for( n = 0; n <= nLvl; ++n )
1639 {
1640 SwNumFormat aFormat( aRule.Get( n ) );
1641
1642 aFormat.SetStart( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx )) ));
1643 const OUString sPrefix = n ? "" : aPrefix.getToken(0, u'\x0001', nPrefixIdx);
1644 aFormat.SetListFormat(sPrefix, aPostfix.getToken(0, u'\x0001', nPostfixIdx), n);
1646 if( n < aNumTypes.getLength() )
1647 aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ n ] - '0'));
1648
1649 aFormat.SetAbsLSpace( nSpaceSteps * n
1650 + lNumberIndent );
1651
1652 if( !aFormat.GetCharFormat() )
1653 aFormat.SetCharFormat( pCFormat );
1654 if( bRTL )
1655 aFormat.SetNumAdjust( SvxAdjust::Right );
1656
1657 aRule.Set( n, aFormat );
1658 }
1659
1660 // Does it fit completely into the frame?
1661 bool bDefStep = nFrameWidth < (nSpaceSteps * MAXLEVEL);
1662 for( ; n < MAXLEVEL; ++n )
1663 {
1664 SwNumFormat aFormat( aRule.Get( n ) );
1666 if( bDefStep )
1667 aFormat.SetAbsLSpace( nLeftTextPos +
1668 SwNumRule::GetNumIndent(static_cast<sal_uInt8>(n-nLvl)));
1669 else
1670 aFormat.SetAbsLSpace( nSpaceSteps * n
1671 + lNumberIndent );
1672 aRule.Set( n, aFormat );
1673 }
1674 }
1675 }
1676 }
1677 else if( !m_aFlags.bAFormatByInput )
1678 SetColl( o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_NUM_LEVEL1 + ( std::min( nLvl, cnNumBullColls ) * 4 ) ));
1679 else
1680 bChgEnum = false;
1681 }
1682
1683 if ( bChgEnum || bChgBullet )
1684 {
1687
1688 if( m_aFlags.bSetNumRule )
1689 {
1691 {
1693 SwTextFrame const*const pNextFrame = GetNextNode(false);
1694 assert(pNextFrame);
1695 m_aDelPam.GetMark()->Assign( *pNextFrame->GetTextNodeForParaProps() );
1697 }
1698
1699 const_cast<SwTextNode*>(m_pCurTextFrame->GetTextNodeForParaProps())->SetAttrListLevel(nLvl);
1700
1701 // start new list
1704
1706 }
1707 else
1708 {
1710 bChgEnum ? nTextStt : TextFrameIndex(0));
1711 }
1713
1714 if ( bChgBullet )
1715 nTextStt += TextFrameIndex(2);
1716
1717 while (nTextStt < TextFrameIndex(rStr.getLength()) && IsSpace(rStr[sal_Int32(nTextStt)]))
1718 nTextStt++;
1719
1722
1723 if( !m_aFlags.bSetNumRule )
1724 {
1725 OUString sChgStr('\t');
1726 if( bChgBullet )
1727 sChgStr = OUString(&m_aFlags.cBullet, 1) + sChgStr;
1729
1733 if( bChgBullet )
1734 {
1737 SetAllScriptItem( aSet,
1743 RES_CHRATR_FONT ) );
1746 nAutoCorrPos = TextFrameIndex(2);
1747 aSet.ClearItem();
1748 }
1750 aTStops.Insert( SvxTabStop( 0 ) );
1751 aSet.Put( aTStops );
1754 }
1755 }
1756
1757 if( bBreak )
1758 {
1759 AutoCorrect( nAutoCorrPos ); /* Offset due to Bullet + Tab */
1760 return;
1761 }
1762
1763 const SwTextFrame * pNextFrame = GetNextNode();
1764 while (CanJoin(pNextFrame)
1765 && nLvl == CalcLevel(*pNextFrame))
1766 {
1768 bBreak = !IsFastFullLine(*pNextFrame)
1769 || IsBlanksInString(*pNextFrame)
1770 || IsSentenceAtEnd(*pNextFrame);
1771 if (DeleteJoinCurNextPara(pNextFrame))
1772 {
1774 }
1775 if( bBreak )
1776 break;
1777 const SwTextFrame *const pCurrNode = pNextFrame;
1778 pNextFrame = GetNextNode();
1779 if (!pNextFrame || pCurrNode == pNextFrame)
1780 break;
1781 }
1783 AutoCorrect( nAutoCorrPos );
1784}
1785
1787{
1789 // Test of contraposition (n words, divided by spaces/tabs, with same indentation in 2nd line)
1790
1791 // read all succeeding paragraphs that belong to this enumeration
1792 bool bBreak = true;
1793 TextFrameIndex nSpacePos(0);
1794 const sal_Int32 nTextPos = GetBigIndent( nSpacePos );
1795 if( m_bMoreLines )
1796 DelMoreLinesBlanks( true );
1797 else
1799 || (!nTextPos && IsBlanksInString(*m_pCurTextFrame))
1801
1802 SetColl( o3tl::narrowing<sal_uInt16>( nTextPos
1805
1806 if( nTextPos )
1807 {
1808 const OUString& rStr = m_pCurTextFrame->GetText();
1809 bool bInsTab = true;
1810
1811 if ('\t' == rStr[sal_Int32(nSpacePos) + 1]) // leave tab alone
1812 {
1813 --nSpacePos;
1814 bInsTab = false;
1815 }
1816
1817 TextFrameIndex nSpaceStt = nSpacePos;
1818 while (nSpaceStt && IsSpace(rStr[sal_Int32(--nSpaceStt)]))
1819 ;
1820 ++nSpaceStt;
1821
1822 if (bInsTab && '\t' == rStr[sal_Int32(nSpaceStt)]) // leave tab alone
1823 {
1824 ++nSpaceStt;
1825 bInsTab = false;
1826 }
1827
1830
1831 // delete old Spaces, etc.
1832 if( nSpaceStt < nSpacePos )
1833 {
1837 if( bInsTab )
1838 {
1840 }
1841 }
1842 }
1843
1844 if( !bBreak )
1845 {
1848 const SwTextFrame * pNextFrame = GetNextNode();
1849 while (CanJoin(pNextFrame) &&
1850 20 < std::abs( static_cast<tools::Long>(nSpaces - aFInfo.SetFrame(
1851 EnsureFormatted(*pNextFrame)).GetLineStart()) )
1852 )
1853 {
1854 bBreak = !IsFastFullLine(*pNextFrame)
1855 || IsBlanksInString(*pNextFrame)
1856 || IsSentenceAtEnd(*pNextFrame);
1857 if (DeleteJoinCurNextPara(pNextFrame))
1858 {
1860 }
1861 if( bBreak )
1862 break;
1863 pNextFrame = GetNextNode();
1864 }
1865 }
1867 AutoCorrect();
1868}
1869
1870void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl )
1871{
1873 {
1874 OUString sText(SwViewShell::GetShellRes()->GetAutoFormatNameLst()[
1876 sText = sText.replaceAll( "$(ARG1)", OUString::number( nLvl + 1 ) );
1878 }
1879
1880 SetColl( o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + nLvl ), true );
1882 {
1884
1885 JoinPrevPara();
1886
1887 DeleteLeadingTrailingBlanks( true, false );
1888 const SwTextFrame* pNextFrame = GetNextNode(false);
1889 if (pNextFrame->GetNext())
1890 {
1891 (void)DeleteJoinCurNextPara(pNextFrame, true);
1892 pNextFrame = GetNextNode(false);
1893 }
1895 m_aDelPam.GetPoint()->Assign( *pNextFrame->GetTextNodeForParaProps() );
1896 m_pDoc->SetTextFormatColl( m_aDelPam, &rNxtColl );
1897 }
1898 else
1899 {
1901 AutoCorrect();
1902 }
1903}
1904
1907{
1909 ACFlags aSvxFlags = pATst->GetFlags( );
1910 bool bReplaceQuote( aSvxFlags & ACFlags::ChgQuotes );
1911 bool bReplaceSglQuote( aSvxFlags & ACFlags::ChgSglQuotes );
1912
1914 (!m_aFlags.bAutoCorrect && !bReplaceQuote && !bReplaceSglQuote &&
1919 return;
1920
1921 const OUString* pText = &m_pCurTextFrame->GetText();
1922 if (TextFrameIndex(pText->getLength()) <= nPos)
1923 return;
1924
1925 bool bGetLanguage = m_aFlags.bChgOrdinalNumber || m_aFlags.bTransliterateRTL ||
1929
1932
1933 SwAutoCorrDoc aACorrDoc( *m_pEditShell, m_aDelPam );
1934
1935 SwTextFrameInfo aFInfo( nullptr );
1936
1937 TextFrameIndex nSttPos, nLastBlank = nPos;
1938 bool bFirst = m_aFlags.bCapitalStartSentence, bFirstSent = bFirst;
1939 sal_Unicode cChar = 0;
1940 bool bNbspRunNext = false;
1941
1942 CharClass& rAppCC = GetAppCharClass();
1943
1944 do {
1945 while (nPos < TextFrameIndex(pText->getLength())
1946 && IsSpace(cChar = (*pText)[sal_Int32(nPos)]))
1947 ++nPos;
1948 if (nPos == TextFrameIndex(pText->getLength()))
1949 break; // that's it
1950
1951 if( ( ( bReplaceQuote && '\"' == cChar ) ||
1952 ( bReplaceSglQuote && '\'' == cChar ) ) &&
1953 (!nPos || ' ' == (*pText)[sal_Int32(nPos)-1]))
1954 {
1955
1956 // note: special case symbol fonts !!!
1957 if( !aFInfo.GetFrame() )
1958 aFInfo.SetFrame( GetFrame( *m_pCurTextNd ) );
1959 if( !aFInfo.IsBullet( nPos ))
1960 {
1963 bool bSetHardBlank = false;
1964
1965 OUString sReplace( pATst->GetQuote( aACorrDoc,
1966 sal_Int32(nPos), cChar, true ));
1967
1970 if( 2 == sReplace.getLength() && ' ' == sReplace[ 1 ])
1971 {
1972 sReplace = sReplace.copy( 0, 1 );
1973 bSetHardBlank = true;
1974 }
1976
1978 {
1982 pText = &m_pCurTextFrame->GetText();
1984 aFInfo.SetFrame( nullptr );
1985 }
1986
1987 nPos += TextFrameIndex(sReplace.getLength() - 1);
1989 if( bSetHardBlank )
1990 {
1992 ++nPos;
1993 }
1994 }
1995 }
1996
1997 bool bCallACorr = false;
1998 int bBreak = 0;
1999 if (nPos && IsSpace((*pText)[sal_Int32(nPos) - 1]))
2000 nLastBlank = nPos;
2001 for (nSttPos = nPos; !bBreak && nPos < TextFrameIndex(pText->getLength()); ++nPos)
2002 {
2003 cChar = (*pText)[sal_Int32(nPos)];
2004 switch (cChar)
2005 {
2006 case '\"':
2007 case '\'':
2008 if( ( cChar == '\"' && bReplaceQuote ) || ( cChar == '\'' && bReplaceSglQuote ) )
2009 {
2010 // consider Symbolfonts!
2011 if( !aFInfo.GetFrame() )
2012 aFInfo.SetFrame( GetFrame( *m_pCurTextNd ) );
2013 if( !aFInfo.IsBullet( nPos ))
2014 {
2016 bool bSetHardBlank = false;
2018 OUString sReplace( pATst->GetQuote( aACorrDoc,
2019 sal_Int32(nPos), cChar, false) );
2020
2021 if( 2 == sReplace.getLength() && ' ' == sReplace[ 0 ])
2022 {
2023 sReplace = sReplace.copy( 1 );
2024 bSetHardBlank = true;
2025 }
2026
2030
2032 {
2036 pText = &m_pCurTextFrame->GetText();
2039 aFInfo.SetFrame( nullptr );
2040 }
2041
2042 nPos += TextFrameIndex(sReplace.getLength() - 1);
2044
2045 if( bSetHardBlank )
2046 {
2049 ++nPos;
2051 }
2052 }
2053 }
2054 break;
2055 case '*':
2056 case '_':
2058 {
2059 // consider Symbolfonts!
2060 if( !aFInfo.GetFrame() )
2061 aFInfo.SetFrame( GetFrame( *m_pCurTextNd ) );
2062 if( !aFInfo.IsBullet( nPos ))
2063 {
2064 SetRedlineText( '*' == cChar
2067
2068 sal_Unicode cBlank = nSttPos ? (*pText)[sal_Int32(nSttPos) - 1] : 0;
2070
2071 if (pATst->FnChgWeightUnderl(aACorrDoc, *pText, sal_Int32(nPos)))
2072 {
2074 {
2078 pText = &m_pCurTextFrame->GetText();
2081 aFInfo.SetFrame( nullptr );
2082 }
2083 //#125102# in case of the mode RedlineFlags::ShowDelete the ** are still contained in pText
2086 // Was a character deleted before starting?
2087 if (cBlank && cBlank != (*pText)[sal_Int32(nSttPos) - 1])
2088 --nSttPos;
2089 }
2090 }
2091 }
2092 break;
2093 case '/':
2095 {
2096 LanguageType eLang = bGetLanguage
2097 ? m_pCurTextFrame->GetLangOfChar(nSttPos, 0, true)
2099
2101 if (pATst->FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext))
2102 --nPos;
2103 }
2104 break;
2105
2106 case '.':
2107 case '!':
2108 case '?':
2110 bFirstSent = true;
2111 [[fallthrough]];
2112 default:
2113 if (!(rAppCC.isLetterNumeric(*pText, sal_Int32(nPos))
2114 || '/' == cChar )) // '/' should not be a word separator (e.g. '1/2' needs to be handled as one word for replacement)
2115 {
2116 --nPos; // revert ++nPos which was decremented in for loop
2117 ++bBreak;
2118 }
2119 break;
2120 }
2121 }
2122
2123 if( nPos == nSttPos )
2124 {
2125 if (++nPos == TextFrameIndex(pText->getLength()))
2126 bCallACorr = true;
2127 }
2128 else
2129 bCallACorr = true;
2130
2131 if( bCallACorr )
2132 {
2135
2136 LanguageType eLang = bGetLanguage
2137 ? m_pCurTextFrame->GetLangOfChar(nSttPos, 0, true)
2139
2142 aACorrDoc.TransliterateRTLWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos), /*bApply=*/true))
2143 {
2145
2147 {
2151 pText = &m_pCurTextFrame->GetText();
2154 }
2155
2156 continue; // do not check further
2157 }
2158
2159 if( m_aFlags.bAutoCorrect &&
2160 aACorrDoc.ChgAutoCorrWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos), *pATst, nullptr) )
2161 {
2164 {
2168 pText = &m_pCurTextFrame->GetText();
2171 }
2172
2173 continue; // do not check further
2174 }
2175
2176 if ( m_aFlags.bAddNonBrkSpace && nPos < TextFrameIndex(pText->getLength()) )
2177 {
2179 pATst->FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext);
2180 }
2181
2184 pATst->FnChgOrdinalNumber(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang)) ||
2187 pATst->FnChgToEnEmDash(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang)) ||
2189 (nPos == TextFrameIndex(pText->getLength()) || IsSpace((*pText)[sal_Int32(nPos)])) &&
2191 pATst->FnSetINetAttr(aACorrDoc, *pText, sal_Int32(nLastBlank), sal_Int32(nPos), eLang)))
2192 {
2194 }
2195 else
2196 {
2197 // two capital letters at the beginning of a word?
2199 {
2201 pATst->FnCapitalStartWord(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang);
2202 }
2203 // capital letter at the beginning of a sentence?
2204 if( m_aFlags.bCapitalStartSentence && bFirst )
2205 {
2207 pATst->FnCapitalStartSentence(aACorrDoc, *pText, true, sal_Int32(nSttPos), sal_Int32(nPos), eLang);
2208 }
2209
2210 bFirst = bFirstSent;
2211 bFirstSent = false;
2212
2214 {
2218 pText = &m_pCurTextFrame->GetText();
2221 }
2222 }
2223 }
2224 }
2225 while (nPos < TextFrameIndex(pText->getLength()));
2227}
2228
2230 SwNode const * pSttNd, SwNode const * pEndNd )
2231 : m_aFlags(std::move( aFlags )),
2232 m_aDelPam( pEdShell->GetDoc()->GetNodes().GetEndOfExtras() ),
2233 m_aNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfExtras(), SwNodeOffset(+1) ),
2234 m_aEndNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfContent() ),
2235 m_pEditShell( pEdShell ),
2236 m_pDoc( pEdShell->GetDoc() ),
2237 m_pCurTextNd( nullptr ), m_pCurTextFrame( nullptr ),
2238 m_nRedlAutoFormatSeqId( 0 )
2239{
2240 OSL_ENSURE( (pSttNd && pEndNd) || (!pSttNd && !pEndNd),
2241 "Got no area" );
2242
2244 m_aFlags.bSetNumRule = false;
2245
2246 bool bReplaceStyles = !m_aFlags.bAFormatByInput || m_aFlags.bReplaceStyles;
2247
2248 const SwTextFrame * pNextFrame = nullptr;
2249 bool bNxtEmpty = false;
2250 bool bNxtAlpha = false;
2251 sal_uInt16 nNxtLevel = 0;
2252 bool bEmptyLine;
2253
2254 // set area for autoformatting
2255 if( pSttNd )
2256 {
2257 m_aNdIdx = *pSttNd;
2258 // for GoNextPara, one paragraph prior to that
2260 m_aEndNdIdx = *pEndNd;
2262
2263 // check the previous TextNode
2264 SwTextFrame const*const pPrevFrame = m_aNdIdx.GetNode().GetTextNode()
2266 : nullptr;
2267 bEmptyLine = !pPrevFrame
2268 || IsEmptyLine(*pPrevFrame)
2269 || IsNoAlphaLine(*pPrevFrame);
2270 }
2271 else
2272 bEmptyLine = true; // at document beginning
2273
2274 m_bEnd = false;
2275
2276 // set value for percentage display
2278
2280 {
2282 ::StartProgress( STR_STATSTR_AUTOFORMAT, sal_Int32(m_aNdIdx.GetIndex()),
2283 sal_Int32(m_nEndNdIdx),
2284 m_pDoc->GetDocShell() );
2285 }
2286
2287 RedlineFlags eRedlMode = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode;
2289 {
2291 eRedlMode = RedlineFlags::On | (eOldMode & RedlineFlags::ShowMask);
2292 }
2293 else
2294 eRedlMode = RedlineFlags::Ignore | (eOldMode & RedlineFlags::ShowMask);
2296
2297 // save undo state (might be turned off)
2298 bool const bUndoState = m_pDoc->GetIDocumentUndoRedo().DoesUndo();
2299
2300 // If multiple lines, then do not merge with next paragraph
2301 m_bMoreLines = false;
2302
2303 sal_uInt16 nLastCalcHeadLvl = 0;
2304 sal_uInt16 nLastHeadLvl = USHRT_MAX;
2305 sal_uInt16 nLevel = 0;
2306 sal_uInt16 nDigitLvl = 0;
2307
2308 // set defaults
2309 SwTextFrameInfo aFInfo( nullptr );
2310
2311 enum Format_Status
2312 {
2313 READ_NEXT_PARA, // -> ISEND, TST_EMPTY_LINE
2314 TST_EMPTY_LINE, // -> READ_NEXT_PARA, TST_ALPHA_LINE
2315 TST_ALPHA_LINE, // -> READ_NEXT_PARA, GET_ALL_INFO, IS_END
2316 GET_ALL_INFO, // -> READ_NEXT_PARA, IS_ONE_LINE, TST_ENUMERIC, HAS_FMTCOLL
2317 IS_ONE_LINE, // -> READ_NEXT_PARA, TST_ENUMERIC
2318 TST_ENUMERIC, // -> READ_NEXT_PARA, TST_IDENT, TST_NEG_IDENT
2319 TST_IDENT, // -> READ_NEXT_PARA, TST_TXT_BODY
2320 TST_NEG_IDENT, // -> READ_NEXT_PARA, TST_TXT_BODY
2321 TST_TXT_BODY, // -> READ_NEXT_PARA
2322 HAS_FMTCOLL, // -> READ_NEXT_PARA
2323 IS_END
2324 } eStat;
2325
2326 // This is the automat for autoformatting
2327 eStat = READ_NEXT_PARA;
2328 while( !m_bEnd )
2329 {
2330 switch( eStat )
2331 {
2332 case READ_NEXT_PARA:
2333 {
2334 GoNextPara();
2335 eStat = m_bEnd ? IS_END : TST_EMPTY_LINE;
2336 }
2337 break;
2338
2339 case TST_EMPTY_LINE:
2341 {
2343 {
2344 bEmptyLine = true;
2345 SwNodeOffset nOldCnt = m_pDoc->GetNodes().Count();
2346 DelEmptyLine();
2347 // Was there really a deletion of a node?
2348 if( nOldCnt != m_pDoc->GetNodes().Count() )
2349 {
2350 // do not skip the next paragraph
2352 }
2353 }
2354 eStat = READ_NEXT_PARA;
2355 }
2356 else
2357 eStat = TST_ALPHA_LINE;
2358 break;
2359
2360 case TST_ALPHA_LINE:
2362 {
2363 // recognize a table definition +---+---+
2365 {
2366 //JP 30.09.96: DoTable() builds on PopCursor and MoveCursor after AutoFormat!
2368 static_cast<SwPaM&>(*pEdShell->GetCursor()) = m_aDelPam;
2369 pEdShell->Push();
2370
2371 eStat = IS_END;
2372 break;
2373 }
2374
2375 // Check for 3 "---" or "===". In this case, the previous paragraph should be
2376 // underlined and the current be deleted!
2377 if( !DoUnderline() && bReplaceStyles )
2378 {
2380 bEmptyLine = true;
2381 }
2382 eStat = READ_NEXT_PARA;
2383 }
2384 else
2385 eStat = GET_ALL_INFO;
2386 break;
2387
2388 case GET_ALL_INFO:
2389 {
2391 {
2392 // do nothing in numbering, go to next
2393 bEmptyLine = false;
2394 eStat = READ_NEXT_PARA;
2395 // delete all blanks at beginning/end and in between
2396 //JP 29.04.98: first only "all in between"
2398 break;
2399 }
2400
2401 aFInfo.SetFrame( m_pCurTextFrame );
2402
2403 // so far: if there were templates assigned, keep these and go to next node
2405 if( IsPoolUserFormat( nPoolId )
2407 : ( RES_POOLCOLL_STANDARD != nPoolId &&
2409 (RES_POOLCOLL_TEXT_MOVE != nPoolId &&
2410 RES_POOLCOLL_TEXT != nPoolId )) ))
2411 {
2412 eStat = HAS_FMTCOLL;
2413 break;
2414 }
2415
2416 // check for hard spaces or LRSpaces set by the template
2417 if( IsPoolUserFormat( nPoolId ) ||
2418 RES_POOLCOLL_STANDARD == nPoolId )
2419 {
2420 short nSz;
2422 GetItemIfSet( RES_LR_SPACE );
2423 if (pLRSpace &&
2424 ( 0 != (nSz = pLRSpace->GetTextFirstLineOffset()) ||
2425 0 != pLRSpace->GetTextLeft() ) )
2426 {
2427 // exception: numbering/enumeration can have an indentation
2429 {
2430 nLevel = CalcLevel(*m_pCurTextFrame, &nDigitLvl);
2431 if( nLevel >= MAXLEVEL )
2432 nLevel = MAXLEVEL-1;
2433 BuildEnum( nLevel, nDigitLvl );
2434 eStat = READ_NEXT_PARA;
2435 break;
2436 }
2437
2438 // never merge (maybe only indent as exception)
2439 m_bMoreLines = true;
2440
2441 if( bReplaceStyles )
2442 {
2443 // then use one of our templates
2444 if( 0 < nSz ) // positive 1st line indentation
2445 BuildIndent();
2446 else if( 0 > nSz ) // negative 1st line indentation
2447 BuildNegIndent( aFInfo.GetLineStart() );
2448 else if( pLRSpace->GetTextLeft() ) // is indentation
2450 }
2451 eStat = READ_NEXT_PARA;
2452 break;
2453 }
2454 }
2455
2456 nLevel = CalcLevel( *m_pCurTextFrame, &nDigitLvl );
2458 // note: every use of pNextFrame in following states, until the
2459 // next READ_NEXT_PARA, relies on this update
2460 pNextFrame = GetNextNode();
2461 if (pNextFrame)
2462 {
2463 bNxtEmpty = IsEmptyLine(*pNextFrame);
2464 bNxtAlpha = IsNoAlphaLine(*pNextFrame);
2465 nNxtLevel = CalcLevel(*pNextFrame);
2466
2467 if (!bEmptyLine && HasBreakAttr(*m_pCurTextFrame))
2468 bEmptyLine = true;
2469 if (!bNxtEmpty && HasBreakAttr(*pNextFrame))
2470 bNxtEmpty = true;
2471
2472 }
2473 else
2474 {
2475 bNxtEmpty = false;
2476 bNxtAlpha = false;
2477 nNxtLevel = 0;
2478 }
2479 eStat = !m_bMoreLines ? IS_ONE_LINE : TST_ENUMERIC;
2480 }
2481 break;
2482
2483 case IS_ONE_LINE:
2484 {
2485 eStat = TST_ENUMERIC;
2486 if( !bReplaceStyles )
2487 break;
2488
2489 const OUString sClrStr( DelLeadingBlanks(m_pCurTextFrame->GetText()) );
2490
2491 if( sClrStr.isEmpty() )
2492 {
2493 bEmptyLine = true;
2494 eStat = READ_NEXT_PARA;
2495 break; // read next paragraph
2496 }
2497
2498 // check if headline
2499 if (!bEmptyLine || !IsFirstCharCapital(*m_pCurTextFrame)
2501 break;
2502
2503 bEmptyLine = false;
2504 const OUString sEndClrStr( DelTrailingBlanks(sClrStr) );
2505 const sal_Unicode cLast = sEndClrStr[sEndClrStr.getLength() - 1];
2506
2507 // not, then check if headline
2508 if( ':' == cLast )
2509 {
2510 BuildHeadLine( 2 );
2511 eStat = READ_NEXT_PARA;
2512 break;
2513 }
2514 else if( 256 <= cLast || !strchr( ",.;", cLast ) )
2515 {
2516 if( bNxtEmpty || bNxtAlpha
2517 || (pNextFrame && IsEnumericChar(*pNextFrame)))
2518 {
2519
2520 // one level below?
2521 if( nLevel >= MAXLEVEL )
2522 nLevel = MAXLEVEL-1;
2523
2524 if( USHRT_MAX == nLastHeadLvl )
2525 nLastHeadLvl = 0;
2526 else if( nLastCalcHeadLvl < nLevel )
2527 {
2528 if( nLastHeadLvl+1 < MAXLEVEL )
2529 ++nLastHeadLvl;
2530 }
2531 // one level above?
2532 else if( nLastCalcHeadLvl > nLevel )
2533 {
2534 if( nLastHeadLvl )
2535 --nLastHeadLvl;
2536 }
2537 nLastCalcHeadLvl = nLevel;
2538
2540 BuildHeadLine( nLevel );
2541 else
2542 BuildHeadLine( nLastHeadLvl );
2543 eStat = READ_NEXT_PARA;
2544 break;
2545 }
2546 }
2547 }
2548 break;
2549
2550 case TST_ENUMERIC:
2551 {
2552 bEmptyLine = false;
2554 {
2555 if( nLevel >= MAXLEVEL )
2556 nLevel = MAXLEVEL-1;
2557 BuildEnum( nLevel, nDigitLvl );
2558 eStat = READ_NEXT_PARA;
2559 }
2560 else if( bReplaceStyles )
2561 eStat = nLevel ? TST_IDENT : TST_NEG_IDENT;
2562 else
2563 eStat = READ_NEXT_PARA;
2564 }
2565 break;
2566
2567 case TST_IDENT:
2568 // Spaces at the beginning, check again for indentation
2569 if( m_bMoreLines && nLevel )
2570 {
2571 SwTwips nSz = aFInfo.GetFirstIndent();
2572 if( 0 < nSz ) // positive 1st line indentation
2573 BuildIndent();
2574 else if( 0 > nSz ) // negative 1st line indentation
2575 BuildNegIndent( aFInfo.GetLineStart() );
2576 else // is indentation
2578 eStat = READ_NEXT_PARA;
2579 }
2580 else if (nLevel && pNextFrame &&
2581 !bNxtEmpty && !bNxtAlpha && !nNxtLevel &&
2582 !IsEnumericChar(*pNextFrame))
2583 {
2584 // is an indentation
2585 BuildIndent();
2586 eStat = READ_NEXT_PARA;
2587 }
2588 else
2589 eStat = TST_TXT_BODY;
2590 break;
2591
2592 case TST_NEG_IDENT:
2593 // no spaces at the beginning, check again for negative indentation
2594 {
2595 if( m_bMoreLines && !nLevel )
2596 {
2597 SwTwips nSz = aFInfo.GetFirstIndent();
2598 if( 0 < nSz ) // positive 1st line indentation
2599 BuildIndent();
2600 else if( 0 > nSz ) // negative 1st line indentation
2601 BuildNegIndent( aFInfo.GetLineStart() );
2602 else // is _no_ indentation
2603 BuildText();
2604 eStat = READ_NEXT_PARA;
2605 }
2606 else if (!nLevel && pNextFrame &&
2607 !bNxtEmpty && !bNxtAlpha && nNxtLevel &&
2608 !IsEnumericChar(*pNextFrame))
2609 {
2610 // is a negative indentation
2611 BuildNegIndent( aFInfo.GetLineStart() );
2612 eStat = READ_NEXT_PARA;
2613 }
2614 else
2615 eStat = TST_TXT_BODY;
2616 }
2617 break;
2618
2619 case TST_TXT_BODY:
2620 {
2621 if( m_bMoreLines )
2622 {
2623 SwTwips nSz = aFInfo.GetFirstIndent();
2624 if( 0 < nSz ) // positive 1st line indentation
2625 BuildIndent();
2626 else if( 0 > nSz ) // negative 1st line indentation
2627 BuildNegIndent( aFInfo.GetLineStart() );
2628 else if( nLevel ) // is indentation
2630 else
2631 BuildText();
2632 }
2633 else if( nLevel )
2635 else
2636 BuildText();
2637 eStat = READ_NEXT_PARA;
2638 }
2639 break;
2640
2641 case HAS_FMTCOLL:
2642 {
2643 // so far: if there were templates assigned, keep these and go to next node
2644 bEmptyLine = false;
2645 eStat = READ_NEXT_PARA;
2646 // delete all blanks at beginning/end and in between
2647 //JP 29.04.98: first only "all in between"
2649
2650 // handle hard attributes
2652 {
2653 short nSz;
2654 SvxLRSpaceItem const * pLRSpace;
2655 if( bReplaceStyles &&
2657 GetItemIfSet( RES_LR_SPACE, false )) &&
2658 ( 0 != (nSz = pLRSpace->GetTextFirstLineOffset()) ||
2659 0 != pLRSpace->GetTextLeft() ) )
2660 {
2661 // then use one of our templates
2662 if( 0 < nSz ) // positive 1st line indentation
2663 BuildIndent();
2664 else if( 0 > nSz ) // negative 1st line indentation
2665 {
2666 BuildNegIndent( aFInfo.GetLineStart() );
2667 }
2668 else if( pLRSpace->GetTextLeft() ) // is indentation
2670 else
2671 BuildText();
2672 }
2673 }
2674 }
2675 break;
2676
2677 case IS_END:
2678 m_bEnd = true;
2679 break;
2680 }
2681 }
2682
2684 m_pDoc->SetAutoFormatRedline( false );
2686
2687 // restore undo (in case it has been changed)
2688 m_pDoc->GetIDocumentUndoRedo().DoUndo(bUndoState);
2689
2690 // disable display of percentage again
2693}
2694
2696{
2697 std::optional<SwWait> oWait;
2698
2699 CurrShell aCurr( this );
2702
2703 SvxSwAutoFormatFlags aAFFlags; // use default values or add params?
2704 if( pAFlags )
2705 {
2706 aAFFlags = *pAFlags;
2707 if( !aAFFlags.bAFormatByInput )
2708 oWait.emplace( *GetDoc()->GetDocShell(), true );
2709 }
2710
2711 SwPaM* pCursor = GetCursor();
2712 // There are more than one or a selection is open
2713 if( pCursor->GetNext() != pCursor || pCursor->HasMark() )
2714 {
2715 for(SwPaM& rPaM : GetCursor()->GetRingContainer())
2716 {
2717 if( rPaM.HasMark() )
2718 {
2719 SwAutoFormat aFormat( this, aAFFlags, &rPaM.Start()->GetNode(),
2720 &rPaM.End()->GetNode() );
2721 }
2722 }
2723 }
2724 else
2725 {
2726 SwAutoFormat aFormat( this, std::move(aAFFlags) );
2727 }
2728
2730 EndAllAction();
2731}
2732
2734{
2735 CurrShell aCurr( this );
2736 SwPaM* pCursor = GetCursor();
2737 if( pCursor->IsMultiSelection() || !pCursor->Move( fnMoveBackward, GoInNode ) )
2738 return;
2739
2742
2743 bool bRange = false;
2744 pCursor->SetMark();
2745 SwPosition* pMarkPos = pCursor->GetMark();
2746 if( pMarkPos->GetContentIndex() )
2747 {
2748 pMarkPos->SetContent(0);
2749 bRange = true;
2750 }
2751 else
2752 {
2753 // then go one node backwards
2754 SwNodeIndex aNdIdx(pCursor->GetMark()->GetNode());
2756 SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode();
2757 if (pTextNd && !pTextNd->GetText().isEmpty())
2758 {
2759 pCursor->GetMark()->Assign( aNdIdx );
2760 bRange = true;
2761 }
2762 }
2763
2764 if( bRange )
2765 {
2766 Push(); // save cursor
2767
2768 SvxSwAutoFormatFlags aAFFlags = *GetAutoFormatFlags(); // use default values so far
2769
2770 SwAutoFormat aFormat( this, std::move(aAFFlags), &pCursor->GetMark()->GetNode(),
2771 &pCursor->GetPoint()->GetNode() );
2773 if( pACorr && !pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
2774 ACFlags::AddNonBrkSpace | ACFlags::ChgOrdinalNumber | ACFlags::TransliterateRTL |
2775 ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr | ACFlags::Autocorrect ))
2776 pACorr = nullptr;
2777
2778 if( pACorr )
2779 AutoCorrect( *pACorr,false, u'\0' );
2780
2781 //JP 30.09.96: DoTable() builds on PopCursor and MoveCursor!
2783 pCursor = GetCursor();
2784 }
2785 pCursor->DeleteMark();
2786 pCursor->Move( fnMoveForward, GoInNode );
2787
2789 EndAllAction();
2790
2791}
2792
2794{
2795 if (!s_pAutoFormatFlags)
2797
2798 return s_pAutoFormatFlags;
2799}
2800
2802{
2804
2805 pEditFlags->bSetNumRule = pFlags->bSetNumRule;
2806 pEditFlags->bChgEnumNum = pFlags->bChgEnumNum;
2807 pEditFlags->bSetBorder = pFlags->bSetBorder;
2808 pEditFlags->bCreateTable = pFlags->bCreateTable;
2809 pEditFlags->bReplaceStyles = pFlags->bReplaceStyles;
2810 pEditFlags->bAFormatByInpDelSpacesAtSttEnd =
2814
2815 //JP 15.12.98: copy BulletChar and Font into "normal" ones
2816 // because AutoFormat can only work with the latter!
2817 pEditFlags->cBullet = pFlags->cByInputBullet;
2818 pEditFlags->aBulletFont = pFlags->aByInputBulletFont;
2819 pEditFlags->cByInputBullet = pFlags->cByInputBullet;
2820 pEditFlags->aByInputBulletFont = pFlags->aByInputBulletFont;
2821}
2822
2823/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ ShowDelete
show all deletes
@ On
RedlineFlags on.
@ Ignore
ignore Redlines
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
const sal_Unicode cStarSymbolEnDash
Definition: autofmt.cxx:79
static const sal_Unicode * StrChr(const sal_Unicode *pSrc, sal_Unicode c)
Definition: autofmt.cxx:226
const sal_Unicode pBulletChar[6]
Definition: autofmt.cxx:76
const int cnPosEmDash
Definition: autofmt.cxx:77
const sal_Unicode cStarSymbolEmDash
Definition: autofmt.cxx:80
const int cnPosEnDash
Definition: autofmt.cxx:77
static bool HasSelBlanks(SwTextFrame const *const pStartFrame, TextFrameIndex &rStartIndex, SwTextFrame const *const pEndFrame, TextFrameIndex &rEndIndex)
Definition: autofmt.cxx:1028
const sal_uInt16 cnNumBullColls
Definition: autofmt.cxx:86
sal_Int32 getCharacterType(const OUString &rStr, sal_Int32 nPos) const
bool isAlpha(const OUString &rStr, sal_Int32 nPos) const
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
static bool isLetterType(sal_Int32 nType)
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
helper class to disable creation of an action by a callback event in particular, change event from a ...
Definition: rootfrm.hxx:451
virtual bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace)=0
Replace selected range in a TextNode with string.
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SvxAdjust GetAdjust() const
SvxAutoCorrect * GetAutoCorrect()
static SvxAutoCorrCfg & Get()
sal_Unicode GetQuote(sal_Unicode cInsChar, bool bSttQuote, LanguageType eLang) const
ACFlags GetFlags() const
void FnCapitalStartWord(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
void FnCapitalStartSentence(SvxAutoCorrDoc &, const OUString &, bool bNormalPos, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool IsAutoCorrFlag(ACFlags nFlag) const
bool FnChgToEnEmDash(SvxAutoCorrDoc &, std::u16string_view, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool FnSetINetAttr(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool FnChgOrdinalNumber(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool FnChgWeightUnderl(SvxAutoCorrDoc &, const OUString &, sal_Int32 nEndPos)
bool FnAddNonBrkSpace(SvxAutoCorrDoc &, std::u16string_view, sal_Int32 nEndPos, LanguageType eLang, bool &io_bNbspRunNext)
static const sal_Int16 Thin
static const sal_Int16 Medium
static const sal_Int16 Hairline
static const sal_Int16 Thick
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
void SetDistance(sal_Int16 nNew, SvxBoxItemLine nLine)
SvxBreak GetBreak() const
short GetTextFirstLineOffset() const
tools::Long GetTextLeft() const
tools::Long GetLeft() const
void SetStart(sal_uInt16 nSet)
void SetAbsLSpace(sal_Int32 nSet)
void SetBulletFont(const vcl::Font *pFont)
void SetListFormat(const OUString &rPrefix, const OUString &rSuffix, int nLevel)
void SetNumAdjust(SvxAdjust eSet)
void SetIncludeUpperLevels(sal_uInt8 nSet)
void SetFirstLineOffset(sal_Int32 nSet)
void SetBulletChar(sal_UCS4 cSet)
void SetNumberingType(SvxNumType nSet)
bool Insert(const SvxTabStop &rTab)
const SvxAdjustItem & GetAdjust(bool=true) const
Definition: paratr.hxx:194
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:44
virtual bool TransliterateRTLWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, bool bApply=false) override
Definition: acorrect.cxx:512
virtual bool ChgAutoCorrWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, SvxAutoCorrect &rACorrect, OUString *pPara) override
Definition: acorrect.cxx:371
void BuildTextIndent()
Definition: autofmt.cxx:1383
void DeleteSel(SwPaM &rPam)
Definition: autofmt.cxx:1158
SwNodeOffset m_nEndNdIdx
Definition: autofmt.cxx:100
CharClass & GetCharClass(LanguageType eLang) const
Definition: autofmt.cxx:122
static OUString DelTrailingBlanks(const OUString &rStr)
Definition: autofmt.cxx:697
void BuildEnum(sal_uInt16 nLvl, sal_uInt16 nDigitLevel)
Definition: autofmt.cxx:1463
SwEditShell * m_pEditShell
Definition: autofmt.cxx:95
bool CanJoin(const SwTextFrame *pNextFrame) const
Definition: autofmt.cxx:190
static bool IsEmptyLine(const SwTextFrame &rFrame)
Definition: autofmt.cxx:141
void GoNextPara()
Definition: autofmt.cxx:297
static sal_Int32 GetLeadingBlanks(std::u16string_view aStr)
Definition: autofmt.cxx:710
sal_uInt16 GetDigitLevel(const SwTextFrame &rFrame, TextFrameIndex &rPos, OUString *pPrefix=nullptr, OUString *pPostfix=nullptr, OUString *pNumTypes=nullptr) const
Definition: autofmt.cxx:750
bool IsFirstCharCapital(const SwTextFrame &rNd) const
Definition: autofmt.cxx:731
SwTextFrame * m_pCurTextFrame
Definition: autofmt.cxx:98
SwPaM m_aDelPam
Definition: autofmt.cxx:91
SwNodeIndex m_aEndNdIdx
Definition: autofmt.cxx:93
LanguageType m_eCharClassLang
Definition: autofmt.cxx:102
void DelMoreLinesBlanks(bool bWithLineBreaks=false)
when using multiline paragraphs delete the "left" and/or "right" margins
Definition: autofmt.cxx:1290
SvxSwAutoFormatFlags m_aFlags
Definition: autofmt.cxx:90
sal_Int32 GetBigIndent(TextFrameIndex &rCurrentSpacePos) const
Definition: autofmt.cxx:484
bool IsNoAlphaLine(const SwTextFrame &) const
Definition: autofmt.cxx:501
bool IsEnumericChar(const SwTextFrame &) const
Definition: autofmt.cxx:388
static bool HasObjects(const SwTextFrame &)
Definition: autofmt.cxx:345
SwTextFrame * GetFrame(const SwTextNode &rTextNd) const
get the FORMATTED TextFrame
Definition: autofmt.cxx:233
SwNodeIndex m_aNdIdx
Definition: autofmt.cxx:92
void BuildIndent()
Definition: autofmt.cxx:1344
static bool IsSpace(const sal_Unicode c)
Definition: autofmt.cxx:132
void ClearRedlineText()
Definition: autofmt.cxx:216
void AutoCorrect(TextFrameIndex nSttPos=TextFrameIndex(0))
execute AutoCorrect on current TextNode
Definition: autofmt.cxx:1906
static bool HasBreakAttr(const SwTextFrame &)
Definition: autofmt.cxx:1048
void DelEmptyLine(bool bTstNextPara=true)
Definition: autofmt.cxx:1239
bool DeleteJoinCurNextPara(SwTextFrame const *pNextFrame, bool bIgnoreLeadingBlanks=false)
Definition: autofmt.cxx:1204
static sal_Int32 GetTrailingBlanks(std::u16string_view aStr)
Definition: autofmt.cxx:720
bool m_bMoreLines
Definition: autofmt.cxx:120
const SwTextFrame * GetNextNode(bool isCheckEnd=true) const
Definition: autofmt.cxx:360
bool DoUnderline()
Definition: autofmt.cxx:527
bool SetRedlineText(sal_uInt16 nId)
Definition: autofmt.cxx:211
bool m_bIsRightToLeft
Definition: autofmt.cxx:99
void DeleteSelImpl(SwPaM &rDelPam, SwPaM &rPamToCorrect)
Definition: autofmt.cxx:1174
SwAutoFormat(SwEditShell *pEdShell, SvxSwAutoFormatFlags aFlags, SwNode const *pSttNd=nullptr, SwNode const *pEndNd=nullptr)
Definition: autofmt.cxx:2229
void BuildText()
Definition: autofmt.cxx:1425
static bool IsSentenceAtEnd(const SwTextFrame &rTextFrame)
is a dot at the end ??
Definition: autofmt.cxx:1066
SwTextFrame * EnsureFormatted(SwTextFrame const &) const
Definition: autofmt.cxx:241
void BuildHeadLine(sal_uInt16 nLvl)
Definition: autofmt.cxx:1870
SwDoc * m_pDoc
Definition: autofmt.cxx:96
void JoinPrevPara()
join with the previous paragraph
Definition: autofmt.cxx:1327
SwTextNode * m_pCurTextNd
Definition: autofmt.cxx:97
static OUString DelLeadingBlanks(const OUString &rStr)
Definition: autofmt.cxx:687
static bool IsBlanksInString(const SwTextFrame &)
Definition: autofmt.cxx:411
void SetRedlineText_(sal_uInt16 nId)
Definition: autofmt.cxx:261
bool IsOneLine(const SwTextFrame &) const
Definition: autofmt.cxx:371
bool IsFastFullLine(const SwTextFrame &) const
Definition: autofmt.cxx:377
std::unique_ptr< CharClass > m_pCharClass
Definition: autofmt.cxx:101
bool DoTable()
Definition: autofmt.cxx:607
void BuildNegIndent(SwTwips nSpaces)
Definition: autofmt.cxx:1786
void SetColl(sal_uInt16 nId, bool bHdLineOrText=false)
Definition: autofmt.cxx:999
sal_uInt16 CalcLevel(const SwTextFrame &, sal_uInt16 *pDigitLvl=nullptr) const
Definition: autofmt.cxx:433
void DeleteLeadingTrailingBlanks(bool bStart=true, bool bEnd=true)
delete in the node start and/or end
Definition: autofmt.cxx:1079
sal_uInt16 m_nRedlAutoFormatSeqId
Definition: autofmt.cxx:104
Represents the style of a text portion.
Definition: charfmt.hxx:27
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
bool HasSwAttrSet() const
Definition: node.hxx:494
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1230
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:763
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2251
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:340
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3434
Definition: doc.hxx:194
void SetTextFormatCollByAutoFormat(const SwPosition &rPos, sal_uInt16 nPoolId, const SfxItemSet *pSet)
Definition: docfmt.cxx:1763
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Definition: docnum.cxx:2519
const SwTable * InsertTable(const SwInsertTableOptions &rInsTableOpts, const SwPosition &rPos, sal_uInt16 nRows, sal_uInt16 nCols, sal_Int16 eAdjust, const SwTableAutoFormat *pTAFormat=nullptr, const std::vector< sal_uInt16 > *pColArr=nullptr, bool bCalledFromShell=false, bool bNewModel=true)
Insert new table at position.
Definition: ndtbl.cxx:337
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:321
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:150
SwNodes & GetNodes()
Definition: doc.hxx:417
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:341
OUString SetNumRule(const SwPaM &, const SwNumRule &, bool bCreateNewList, SwRootFrame const *pLayout=nullptr, const OUString &sContinuedListId=OUString(), bool bSetItem=true, const bool bResetIndentAttrs=false)
Accept changes of outline styles for OutlineRule.
Definition: docnum.cxx:861
::sw::DocumentRedlineManager const & GetDocumentRedlineManager() const
Definition: doc.cxx:351
void SetAutoFormatRedline(bool bFlag)
Definition: doc.hxx:1455
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:432
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
Definition: doc.cxx:1779
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1326
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter <bResetListAttrs>.
Definition: docfmt.cxx:1081
SwDocShell * GetDocShell()
Definition: doc.hxx:1359
void SetFormatItemByAutoFormat(const SwPaM &rPam, const SfxItemSet &)
Definition: docfmt.cxx:1811
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void AutoFormat(const SvxSwAutoFormatFlags *pAFlags)
Set our styles according to the respective rules.
Definition: autofmt.cxx:2695
SAL_DLLPRIVATE void DeleteSel(SwPaM &rPam, bool isArtificialSelection, bool *pUndo=nullptr)
Definition: eddel.cxx:34
static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *)
Definition: autofmt.cxx:2801
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
void AutoFormatBySplitNode()
Definition: autofmt.cxx:2733
static SvxSwAutoFormatFlags * GetAutoFormatFlags()
Definition: autofmt.cxx:2793
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
static SvxSwAutoFormatFlags * s_pAutoFormatFlags
Definition: editsh.hxx:141
void AutoCorrect(SvxAutoCorrect &rACorr, bool bInsertMode, sal_Unicode cChar)
Call AutoCorrect.
Definition: edws.cxx:255
void EndAllAction()
Definition: edws.cxx:97
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:163
const SwRect & getFrameArea() const
Definition: frame.hxx:179
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:171
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
SwFrame * GetNext()
Definition: frame.hxx:676
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1799
bool IsRightToLeft() const
Definition: frame.hxx:987
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
void SetCompletePaint() const
Definition: frame.hxx:994
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:136
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:171
Base class of the Writer document model elements.
Definition: node.hxx:98
sal_uInt8 GetAutoFormatLvl() const
Definition: node.hxx:160
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:897
SwSectionNode * GetSectionNode()
Definition: node.hxx:656
SwNodeOffset GetIndex() const
Definition: node.hxx:312
bool IsEndNode() const
Definition: node.hxx:681
bool IsSectionNode() const
Definition: node.hxx:693
bool IsTableNode() const
Definition: node.hxx:689
bool IsTextNode() const
Definition: node.hxx:685
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
std::vector< SwFrameFormat * > const & GetAnchoredFlys() const
Definition: node.hxx:318
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:731
SwNodeOffset Count() const
Definition: ndarr.hxx:142
SwCharFormat * GetCharFormat() const
Definition: numrule.hxx:74
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:281
const SwNumFormat * GetNumFormat(sal_uInt16 i) const
Definition: number.cxx:97
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:87
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:618
static sal_uInt16 GetNumIndent(sal_uInt8 nLvl)
Definition: number.cxx:169
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
SwNode & GetPointNode() const
Definition: pam.hxx:283
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:642
SwPaM * GetPrev()
Definition: pam.hxx:324
bool IsMultiSelection() const
Definition: pam.hxx:328
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:668
const SwPosition * End() const
Definition: pam.hxx:271
SwPaM * GetNext()
Definition: pam.hxx:320
void DeleteMark()
Definition: pam.hxx:231
SwNode & GetMarkNode() const
Definition: pam.hxx:284
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:353
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1940
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool IsEmpty() const
Definition: swrect.hxx:304
void Width(tools::Long nNew)
Definition: swrect.hxx:189
vector_type::size_type size_type
Definition: docary.hxx:222
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
const SwSection & GetSection() const
Definition: node.hxx:588
bool IsProtectFlag() const
Definition: section.hxx:189
bool IsHiddenFlag() const
Definition: section.hxx:188
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:104
const SwTextFrame * GetFrame() const
Definition: frminf.hxx:64
static SwTwips GetLineStart(const SwTextCursor &rLine)
Definition: frminf.cxx:87
bool IsFilled(const sal_uInt8 nPercent) const
Definition: frminf.cxx:74
bool IsOneLine() const
Definition: frminf.cxx:53
SwTwips GetFirstIndent() const
Definition: frminf.cxx:205
void GetSpaces(std::vector< std::pair< TextFrameIndex, TextFrameIndex > > &, bool bWithLineBreak) const
Definition: frminf.cxx:154
SwTextFrameInfo & SetFrame(const SwTextFrame *pNew)
Definition: frminf.hxx:65
sal_Int32 GetBigIndent(TextFrameIndex &rFndPos, const SwTextFrame *pNextFrame) const
Definition: frminf.cxx:237
SwTwips GetCharPos(TextFrameIndex nChar, bool bCenter=true) const
Definition: frminf.cxx:107
bool IsBullet(TextFrameIndex nTextPos) const
Definition: frminf.cxx:193
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:165
SwTextFrame * GetFormatted(bool bForceQuickFormat=false)
In case the SwLineLayout was cleared out of the s_pTextCache, recreate it.
Definition: txtfrm.cxx:3396
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1246
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
Definition: txtfrm.cxx:1343
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
Definition: txtfrm.cxx:1231
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:456
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
Definition: txtfrm.cxx:1267
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:463
SwRect GetPaintSwRect()
Page number etc.
Definition: frmpaint.cxx:456
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1293
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1303
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
void SetAttrListLevel(int nLevel)
Sets the list level of this text node.
Definition: ndtxt.cxx:4198
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2907
const OUString & GetText() const
Definition: ndtxt.hxx:242
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:891
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:347
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2650
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2160
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void SetWidth(tools::Long nWidth)
void SetBorderLineStyle(SvxBorderLineStyle nNew)
void SetAutoFormatRedlineComment(const OUString *pText, sal_uInt16 nSeqNo=0)
Set comment-text for Redline.
void merge(RingContainer< value_type > aDestRing)
Merges two ring containers.
Definition: ring.hxx:182
ring_container GetRingContainer()
Definition: ring.hxx:240
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
FontPitch GetPitch()
rtl_TextEncoding GetCharSet() const
#define STR_AUTOFMTREDL_CPTL_STT_SENT
Definition: comcore.hxx:26
#define STR_AUTOFMTREDL_BOLD
Definition: comcore.hxx:31
#define STR_AUTOFMTREDL_USE_REPLACE
Definition: comcore.hxx:24
#define STR_AUTOFMTREDL_DEL_MORELINES
Definition: comcore.hxx:43
#define STR_AUTOFMTREDL_TRANSLITERATE_RTL
Definition: comcore.hxx:45
#define STR_AUTOFMTREDL_ORDINAL
Definition: comcore.hxx:35
#define STR_AUTOFMTREDL_DASH
Definition: comcore.hxx:34
#define STR_AUTOFMTREDL_NON_BREAK_SPACE
Definition: comcore.hxx:44
#define STR_AUTOFMTREDL_DETECT_URL
Definition: comcore.hxx:33
#define STR_AUTOFMTREDL_SET_NUMBER_BULLET
Definition: comcore.hxx:42
#define STR_AUTOFMTREDL_CPTL_STT_WORD
Definition: comcore.hxx:25
#define STR_AUTOFMTREDL_UNDER
Definition: comcore.hxx:30
#define STR_AUTOFMTREDL_SET_TMPL_TEXT
Definition: comcore.hxx:37
#define STR_AUTOFMTREDL_SET_TMPL_HEADLINE
Definition: comcore.hxx:41
#define STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT
Definition: comcore.hxx:40
#define STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT
Definition: comcore.hxx:39
#define STR_AUTOFMTREDL_END
Definition: comcore.hxx:47
#define STR_AUTOFMTREDL_SET_TMPL_INDENT
Definition: comcore.hxx:38
#define STR_AUTOFMTREDL_FRACTION
Definition: comcore.hxx:32
#define STR_AUTOFMTREDL_TYPO
Definition: comcore.hxx:27
#define STR_AUTOFMTREDL_DEL_EMPTY_PARA
Definition: comcore.hxx:23
float u
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SwFormatDrop > RES_PARATR_DROP(70)
constexpr TypedWhichId< SwParaConnectBorderItem > RES_PARATR_CONNECT_BORDER(78)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
CharClass & GetAppCharClass()
Definition: init.cxx:705
WhichRangesContainer const aTextNodeSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
void * p
sal_Int64 n
uno_Any a
#define LANGUAGE_SYSTEM
#define LANGUAGE_HUNGARIAN
sal_uInt16 nPos
OUString sPrefix
void StartProgress(TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
Definition: mainwn.cxx:52
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
aStr
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:390
size
bool IsDefBulletFontUserDefined()
determine if default bullet font is user defined
Definition: number.cxx:1390
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1561
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1395
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
Dialog to specify the properties of date form field.
void GotoNextLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
Definition: docnum.cxx:1466
void GotoPrevLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
Definition: docnum.cxx:1436
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
Definition: txtfrm.cxx:290
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor > > &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
Definition: autofmt.cxx:1111
long Long
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
sal_Int16 nId
@ NONE
For internal use only.
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1170
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:61
void SetAllScriptItem(SfxItemSet &rSet, const SfxPoolItem &rItem)
Definition: poolfmt.cxx:41
@ RES_POOLCOLL_TEXT
Text body.
Definition: poolfmt.hxx:251
@ RES_POOLCOLL_STANDARD
Standard.
Definition: poolfmt.hxx:250
@ RES_POOLCOLL_BULLET_LEVEL1
1st level.
Definition: poolfmt.hxx:304
@ RES_POOLCOLL_TEXT_NEGIDENT
Text body hanging indent.
Definition: poolfmt.hxx:253
@ RES_POOLCOLL_CONFRONTATION
List indent.
Definition: poolfmt.hxx:257
@ RES_POOLCOLL_TEXT_MOVE
Text body indent.
Definition: poolfmt.hxx:254
@ RES_POOLCOLL_NUM_LEVEL1
1st level.
Definition: poolfmt.hxx:282
@ RES_POOLCOLL_HEADLINE1
Heading 1.
Definition: poolfmt.hxx:262
@ RES_POOLCOLL_TEXT_IDENT
Text body first line indent.
Definition: poolfmt.hxx:252
@ RES_POOLCHR_BULLET_LEVEL
Bullets.
Definition: poolfmt.hxx:118
@ RES_POOLCHR_NUM_LEVEL
Numbering symbols.
Definition: poolfmt.hxx:117
bool IsPoolUserFormat(sal_uInt16 nId)
Definition: poolfmt.hxx:86
sal_uIntPtr sal_uLong
const std::vector< OUString > & GetAutoFormatNameLst() const
Definition: shellres.hxx:88
bool bAFormatDelSpacesBetweenLines
vcl::Font aByInputBulletFont
bool bAFormatByInpDelSpacesBetweenLines
bool bAFormatByInpDelSpacesAtSttEnd
Marks a position in the document model.
Definition: pam.hxx:37
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
Definition: pam.cxx:256
SwNode & GetNode() const
Definition: pam.hxx:80
void SetMark(const sw::mark::IMark *pMark)
Definition: pam.hxx:85
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:266
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
SwTextNode const * pLastNode
mainly for sanity checks
Definition: txtfrm.hxx:974
ACFlags
SvxNumType
SVX_NUM_CHARS_LOWER_LETTER
SVX_NUM_CHARS_UPPER_LETTER
SVX_NUM_ROMAN_UPPER
SVX_NUM_ROMAN_LOWER
SVX_NUM_ARABIC
SVX_NUM_CHAR_SPECIAL
SvxAdjust
#define CHAR_HARDBLANK
Definition: swtypes.hxx:171
constexpr sal_uInt16 lNumberIndent
Definition: swtypes.hxx:100
tools::Long SwTwips
Definition: swtypes.hxx:51
constexpr short lBulletIndent
Definition: swtypes.hxx:98
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
constexpr short lBulletFirstLineOffset
Definition: swtypes.hxx:99
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
sal_uInt32 sal_UCS4