LibreOffice Module sw (master) 1
splargs.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#ifndef INCLUDED_SW_INC_SPLARGS_HXX
20#define INCLUDED_SW_INC_SPLARGS_HXX
21
22#include <i18nlangtag/lang.h>
23#include <tools/gen.hxx>
24
25#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
26#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
27
28#include <functional>
29#include <utility>
30
31struct SwPosition;
32class SwTextFrame;
33class SwTextNode;
34class SwContentIndex;
35namespace vcl { class Font; }
36namespace com::sun::star::linguistic2 { class XHyphenatedWord; }
37
38struct SwArgsBase // used for text conversion (Hangul/Hanja, ...)
39{
40 SwPosition *pStartPos; // these both point to SwTextNode
42
44 : pStartPos( &rStart ), pEndPos( &rEnd )
45 {}
46
47 void SetStart(SwPosition& rStart )
48 {
49 pStartPos = &rStart;
50 }
51
52 void SetEnd( SwPosition& rEnd )
53 {
54 pEndPos = &rEnd ;
55 }
56};
57
58// used for text conversion (Hangul/Hanja, Simplified/Traditional Chinese, ...)
60{
61 OUString aConvText; // convertible text found
62 LanguageType nConvSrcLang; // (source) language to look for
63 LanguageType nConvTextLang; // language of aConvText (if the latter one was found)
64
65 // used for chinese translation
66 LanguageType nConvTargetLang; // target language of text to be changed
67 const vcl::Font *pTargetFont; // target font of text to be changed
68 // explicitly enables or disables application of the above two
70
72 SwPosition& rStart,
73 SwPosition& rEnd )
74 : SwArgsBase( rStart, rEnd ),
78 pTargetFont( nullptr ),
80 {}
81};
82
84{
85 css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller;
86
87 css::uno::Reference< css::linguistic2::XSpellAlternatives > xSpellAlt;
88
90
91 SwSpellArgs(css::uno::Reference< css::linguistic2::XSpellChecker1 > xSplChk,
92 SwPosition& rStart,
93 SwPosition& rEnd,
94 bool bGrammar )
95 : SwArgsBase( rStart, rEnd ),
96 xSpeller(std::move( xSplChk )),
97 bIsGrammarCheck( bGrammar )
98 {}
99};
100
101// Parameter-class for Hyphenate.
102// docedt.cxx: SwDoc::Hyphenate()
103// txtedt.cxx: SwTextNode::Hyphenate()
104// txthyph.cxx: SwTextFrame::Hyphenate()
105
107{
109 css::uno::Reference<css::linguistic2::XHyphenatedWord> m_xHyphWord;
112public:
114 sal_Int32 m_nStart;
115 sal_Int32 m_nEnd;
117 sal_Int32 m_nWordStart;
118 sal_Int32 m_nWordLen;
119
120 SwInterHyphInfo( const Point &rCursorPos )
121 : m_aCursorPos(rCursorPos)
122 , m_nStart(0)
124 , m_nWordStart(0), m_nWordLen(0)
125 {
126 }
127 const Point *GetCursorPos() const
128 {
129 return m_aCursorPos.X() || m_aCursorPos.Y() ? &m_aCursorPos : nullptr;
130 }
131 void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rxHW)
132 {
133 m_xHyphWord = rxHW;
134 }
135 const css::uno::Reference< css::linguistic2::XHyphenatedWord >& GetHyphWord() const
136 {
137 return m_xHyphWord;
138 }
139};
140
141
142namespace sw {
143
144typedef std::function<SwTextFrame*()> Creator;
145
147SwHyphIterCacheLastTextFrame(SwTextNode const *, const Creator& rCreator);
148
149}
150
151#endif
152
153/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr tools::Long Y() const
constexpr tools::Long X() const
Marks a character position inside a document model content node (SwContentNode)
void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rxHW)
Definition: splargs.hxx:131
const Point m_aCursorPos
input: cursor point to locate the frame
Definition: splargs.hxx:111
sal_Int32 m_nEnd
Definition: splargs.hxx:115
sal_Int32 m_nWordStart
output: found word
Definition: splargs.hxx:117
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & GetHyphWord() const
Definition: splargs.hxx:135
SwInterHyphInfo(const Point &rCursorPos)
Definition: splargs.hxx:120
const Point * GetCursorPos() const
Definition: splargs.hxx:127
sal_Int32 m_nWordLen
Definition: splargs.hxx:118
css::uno::Reference< css::linguistic2::XHyphenatedWord > m_xHyphWord
output: hyphenated word
Definition: splargs.hxx:109
sal_Int32 m_nStart
input: requested range to hyphenate
Definition: splargs.hxx:114
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
#define LANGUAGE_NONE
Dialog to specify the properties of date form field.
SwTextFrame * SwHyphIterCacheLastTextFrame(SwTextNode const *pNode, const sw::Creator &create)
Definition: edlingu.cxx:584
std::function< SwTextFrame *()> Creator
Definition: splargs.hxx:144
static LanguageType nLang
Definition: srtdlg.cxx:51
SwArgsBase(SwPosition &rStart, SwPosition &rEnd)
Definition: splargs.hxx:43
void SetEnd(SwPosition &rEnd)
Definition: splargs.hxx:52
SwPosition * pStartPos
Definition: splargs.hxx:40
void SetStart(SwPosition &rStart)
Definition: splargs.hxx:47
SwPosition * pEndPos
Definition: splargs.hxx:41
OUString aConvText
Definition: splargs.hxx:61
bool bAllowImplicitChangesForNotConvertibleText
Definition: splargs.hxx:69
LanguageType nConvSrcLang
Definition: splargs.hxx:62
LanguageType nConvTargetLang
Definition: splargs.hxx:66
const vcl::Font * pTargetFont
Definition: splargs.hxx:67
LanguageType nConvTextLang
Definition: splargs.hxx:63
SwConversionArgs(LanguageType nLang, SwPosition &rStart, SwPosition &rEnd)
Definition: splargs.hxx:71
Marks a position in the document model.
Definition: pam.hxx:38
bool bIsGrammarCheck
Definition: splargs.hxx:89
css::uno::Reference< css::linguistic2::XSpellAlternatives > xSpellAlt
Definition: splargs.hxx:87
SwSpellArgs(css::uno::Reference< css::linguistic2::XSpellChecker1 > xSplChk, SwPosition &rStart, SwPosition &rEnd, bool bGrammar)
Definition: splargs.hxx:91
css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller
Definition: splargs.hxx:85
#define SAL_MAX_INT32