LibreOffice Module sw (master)  1
swscanner.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SW_INC_SWSCANNER_HXX
21 #define INCLUDED_SW_INC_SWSCANNER_HXX
22 
23 #include <i18nlangtag/lang.h>
24 #include "modeltoviewhelper.hxx"
25 
26 #include <functional>
27 
28 class SwTextNode;
29 
30 // Helper class that provides consecutively the words of a selected area
31 // during spell check
32 class SwScanner
33 {
34  std::function<LanguageType (sal_Int32, sal_Int32, bool)> const m_pGetLangOfChar;
35  OUString m_aWord;
36  const OUString m_aPreDashReplacementText;
37  OUString m_aText;
40  sal_Int32 m_nStartPos;
41  sal_Int32 m_nEndPos;
42  sal_Int32 m_nBegin;
43  sal_Int32 m_nLength;
46  sal_uInt16 const m_nWordType;
47  bool const m_bClip;
48 
49 public:
50  SwScanner(const std::function<LanguageType(sal_Int32, sal_Int32, bool)>& pGetLangOfChar,
51  const OUString& rText, const LanguageType* pLang, const ModelToViewHelper& rConvMap,
52  sal_uInt16 nWordType, sal_Int32 nStart, sal_Int32 nEnde, bool bClip = false);
53  SwScanner( const SwTextNode& rNd, const OUString& rText,
54  const LanguageType* pLang,
55  const ModelToViewHelper& rConvMap,
56  sal_uInt16 nWordType,
57  sal_Int32 nStart, sal_Int32 nEnde, bool bClip = false );
58 
59  // This next word function tries to find the language for the next word
60  // It should currently _not_ be used for spell checking, and works only for
61  // ! bReverse
62  bool NextWord();
63 
64  const OUString& GetWord() const { return m_aWord; }
65 
66  sal_Int32 GetBegin() const { return m_nBegin; }
67  sal_Int32 GetEnd() const { return m_nBegin + m_nLength; }
68  sal_Int32 GetLen() const { return m_nLength; }
69 
71 
72  sal_Int32 getOverriddenDashCount() const {return m_nOverriddenDashCount; }
73 };
74 
75 #endif
76 
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString m_aWord
Definition: swscanner.hxx:35
sal_Int32 GetLen() const
Definition: swscanner.hxx:68
LanguageType GetCurrentLanguage() const
Definition: swscanner.hxx:70
sal_Int32 m_nStartPos
Definition: swscanner.hxx:40
sal_Int32 m_nEndPos
Definition: swscanner.hxx:41
sal_Int32 m_nOverriddenDashCount
Definition: swscanner.hxx:44
bool const m_bClip
Definition: swscanner.hxx:47
sal_Int32 m_nBegin
Definition: swscanner.hxx:42
std::function< LanguageType(sal_Int32, sal_Int32, bool)> const m_pGetLangOfChar
Definition: swscanner.hxx:34
SwScanner(const std::function< LanguageType(sal_Int32, sal_Int32, bool)> &pGetLangOfChar, const OUString &rText, const LanguageType *pLang, const ModelToViewHelper &rConvMap, sal_uInt16 nWordType, sal_Int32 nStart, sal_Int32 nEnde, bool bClip=false)
const ModelToViewHelper m_ModelToView
Definition: swscanner.hxx:39
const OUString m_aPreDashReplacementText
Definition: swscanner.hxx:36
const OUString & GetWord() const
Definition: swscanner.hxx:64
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
sal_uInt16 const m_nWordType
Definition: swscanner.hxx:46
sal_Int32 m_nLength
Definition: swscanner.hxx:43
sal_Int32 GetBegin() const
Definition: swscanner.hxx:66
const LanguageType * m_pLanguage
Definition: swscanner.hxx:38
LanguageType m_aCurrentLang
Definition: swscanner.hxx:45
sal_Int32 getOverriddenDashCount() const
Definition: swscanner.hxx:72
bool NextWord()
Definition: txtedt.cxx:809
OUString m_aText
Definition: swscanner.hxx:37
sal_Int32 GetEnd() const
Definition: swscanner.hxx:67