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
30class SwTextFrame;
31class SwTextNode;
32class SwIndex;
33namespace vcl { class Font; }
34namespace com::sun::star::linguistic2 { class XHyphenatedWord; }
35
36struct SwArgsBase // used for text conversion (Hangul/Hanja, ...)
37{
42
44 SwTextNode* pStart, SwIndex& rStart,
45 SwTextNode* pEnd, SwIndex& rEnd )
46 : pStartNode( pStart ), pStartIdx( &rStart ),
47 pEndNode( pEnd ), pEndIdx( &rEnd )
48 {}
49
50 void SetStart(SwTextNode* pStart, SwIndex& rStart )
51 {
52 pStartNode = pStart; pStartIdx = &rStart ;
53 }
54
55 void SetEnd( SwTextNode* pEnd, SwIndex& rEnd )
56 {
57 pEndNode = pEnd; pEndIdx = &rEnd ;
58 }
59};
60
61// used for text conversion (Hangul/Hanja, Simplified/Traditional Chinese, ...)
63{
64 OUString aConvText; // convertible text found
65 LanguageType nConvSrcLang; // (source) language to look for
66 LanguageType nConvTextLang; // language of aConvText (if the latter one was found)
67
68 // used for chinese translation
69 LanguageType nConvTargetLang; // target language of text to be changed
70 const vcl::Font *pTargetFont; // target font of text to be changed
71 // explicitly enables or disables application of the above two
73
75 SwTextNode* pStart, SwIndex& rStart,
76 SwTextNode* pEnd, SwIndex& rEnd )
77 : SwArgsBase( pStart, rStart, pEnd, rEnd ),
81 pTargetFont( nullptr ),
83 {}
84};
85
87{
88 css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller;
89
90 css::uno::Reference< css::linguistic2::XSpellAlternatives > xSpellAlt;
91
93
94 SwSpellArgs(css::uno::Reference<
95 css::linguistic2::XSpellChecker1 > const &rxSplChk,
96 SwTextNode* pStart, SwIndex& rStart,
97 SwTextNode* pEnd, SwIndex& rEnd,
98 bool bGrammar )
99 : SwArgsBase( pStart, rStart, pEnd, rEnd ),
100 xSpeller( rxSplChk ),
101 bIsGrammarCheck( bGrammar )
102 {}
103};
104
105// Parameter-class for Hyphenate.
106// docedt.cxx: SwDoc::Hyphenate()
107// txtedt.cxx: SwTextNode::Hyphenate()
108// txthyph.cxx: SwTextFrame::Hyphenate()
109
111{
113 css::uno::Reference<css::linguistic2::XHyphenatedWord> m_xHyphWord;
116public:
118 sal_Int32 m_nStart;
119 sal_Int32 m_nEnd;
121 sal_Int32 m_nWordStart;
122 sal_Int32 m_nWordLen;
123
124 SwInterHyphInfo( const Point &rCursorPos )
125 : m_aCursorPos(rCursorPos)
126 , m_nStart(0)
128 , m_nWordStart(0), m_nWordLen(0)
129 {
130 }
131 const Point *GetCursorPos() const
132 {
133 return m_aCursorPos.X() || m_aCursorPos.Y() ? &m_aCursorPos : nullptr;
134 }
135 void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rxHW)
136 {
137 m_xHyphWord = rxHW;
138 }
139 const css::uno::Reference< css::linguistic2::XHyphenatedWord >& GetHyphWord() const
140 {
141 return m_xHyphWord;
142 }
143};
144
145
146namespace sw {
147
148typedef std::function<SwTextFrame*()> Creator;
149
151SwHyphIterCacheLastTextFrame(SwTextNode const *, const Creator& rCreator);
152
153}
154
155#endif
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Marks a character position inside a document model node.
Definition: index.hxx:34
void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rxHW)
Definition: splargs.hxx:135
const Point m_aCursorPos
input: cursor point to locate the frame
Definition: splargs.hxx:115
sal_Int32 m_nEnd
Definition: splargs.hxx:119
sal_Int32 m_nWordStart
output: found word
Definition: splargs.hxx:121
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & GetHyphWord() const
Definition: splargs.hxx:139
SwInterHyphInfo(const Point &rCursorPos)
Definition: splargs.hxx:124
const Point * GetCursorPos() const
Definition: splargs.hxx:131
sal_Int32 m_nWordLen
Definition: splargs.hxx:122
css::uno::Reference< css::linguistic2::XHyphenatedWord > m_xHyphWord
output: hyphenated word
Definition: splargs.hxx:113
sal_Int32 m_nStart
input: requested range to hyphenate
Definition: splargs.hxx:118
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:163
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:84
#define LANGUAGE_NONE
Dialog to specify the properties of date form field.
SwTextFrame * SwHyphIterCacheLastTextFrame(SwTextNode const *pNode, const sw::Creator &create)
Definition: edlingu.cxx:585
std::function< SwTextFrame *()> Creator
Definition: splargs.hxx:148
static LanguageType nLang
Definition: srtdlg.cxx:51
SwIndex * pStartIdx
Definition: splargs.hxx:39
void SetStart(SwTextNode *pStart, SwIndex &rStart)
Definition: splargs.hxx:50
SwArgsBase(SwTextNode *pStart, SwIndex &rStart, SwTextNode *pEnd, SwIndex &rEnd)
Definition: splargs.hxx:43
SwTextNode * pEndNode
Definition: splargs.hxx:40
SwIndex * pEndIdx
Definition: splargs.hxx:41
void SetEnd(SwTextNode *pEnd, SwIndex &rEnd)
Definition: splargs.hxx:55
SwTextNode * pStartNode
Definition: splargs.hxx:38
OUString aConvText
Definition: splargs.hxx:64
bool bAllowImplicitChangesForNotConvertibleText
Definition: splargs.hxx:72
LanguageType nConvSrcLang
Definition: splargs.hxx:65
LanguageType nConvTargetLang
Definition: splargs.hxx:69
const vcl::Font * pTargetFont
Definition: splargs.hxx:70
LanguageType nConvTextLang
Definition: splargs.hxx:66
SwConversionArgs(LanguageType nLang, SwTextNode *pStart, SwIndex &rStart, SwTextNode *pEnd, SwIndex &rEnd)
Definition: splargs.hxx:74
bool bIsGrammarCheck
Definition: splargs.hxx:92
css::uno::Reference< css::linguistic2::XSpellAlternatives > xSpellAlt
Definition: splargs.hxx:90
css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller
Definition: splargs.hxx:88
SwSpellArgs(css::uno::Reference< css::linguistic2::XSpellChecker1 > const &rxSplChk, SwTextNode *pStart, SwIndex &rStart, SwTextNode *pEnd, SwIndex &rEnd, bool bGrammar)
Definition: splargs.hxx:94
#define SAL_MAX_INT32