LibreOffice Module vcl (master) 1
textdata.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_VCL_TEXTDATA_HXX
21#define INCLUDED_VCL_TEXTDATA_HXX
22
23#include <sal/types.h>
24#include <rtl/ustring.hxx>
25#include <svl/hint.hxx>
26#include <vcl/dllapi.h>
27#include <memory>
28
29enum class ExtTextInputAttr;
30
31// for Notify, if all paragraphs were deleted
32#define TEXT_PARA_ALL SAL_MAX_UINT32
33#define TEXT_INDEX_ALL SAL_MAX_INT32
34
36{
37private:
38 sal_uInt32 mnPara;
39 sal_Int32 mnIndex;
40
41public:
42 TextPaM() : mnPara(0), mnIndex(0) {}
43 TextPaM( sal_uInt32 nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {}
44
45 sal_uInt32 GetPara() const { return mnPara; }
46 sal_uInt32& GetPara() { return mnPara; }
47
48 sal_Int32 GetIndex() const { return mnIndex; }
49 sal_Int32& GetIndex() { return mnIndex; }
50
51 inline bool operator == ( const TextPaM& rPaM ) const;
52 inline bool operator != ( const TextPaM& rPaM ) const;
53 inline bool operator < ( const TextPaM& rPaM ) const;
54 inline bool operator > ( const TextPaM& rPaM ) const;
55};
56
57inline bool TextPaM::operator == ( const TextPaM& rPaM ) const
58{
59 return ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex );
60}
61
62inline bool TextPaM::operator != ( const TextPaM& rPaM ) const
63{
64 return !( *this == rPaM );
65}
66
67inline bool TextPaM::operator < ( const TextPaM& rPaM ) const
68{
69 return ( mnPara < rPaM.mnPara ) ||
70 ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex );
71}
72
73inline bool TextPaM::operator > ( const TextPaM& rPaM ) const
74{
75 return ( mnPara > rPaM.mnPara ) ||
76 ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex );
77}
78
80{
81private:
84
85public:
87 TextSelection( const TextPaM& rPaM );
88 TextSelection( const TextPaM& rStart, const TextPaM& rEnd );
89
90 const TextPaM& GetStart() const { return maStartPaM; }
91 TextPaM& GetStart() { return maStartPaM; }
92
93 const TextPaM& GetEnd() const { return maEndPaM; }
94 TextPaM& GetEnd() { return maEndPaM; }
95
96 void Justify();
97
98 bool HasRange() const { return maStartPaM != maEndPaM; }
99
100 inline bool operator == ( const TextSelection& rSel ) const;
101 inline bool operator != ( const TextSelection& rSel ) const;
102};
103
104inline bool TextSelection::operator == ( const TextSelection& rSel ) const
105{
106 return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
107}
108
109inline bool TextSelection::operator != ( const TextSelection& rSel ) const
110{
111 return !( *this == rSel );
112}
113
115{
116private:
117 sal_Int32 mnValue;
118
119public:
120 TextHint( SfxHintId nId );
121 TextHint( SfxHintId nId, sal_Int32 nValue );
122
123 sal_Int32 GetValue() const { return mnValue; }
124};
125
127{
129 std::unique_ptr<ExtTextInputAttr[]> pAttribs;
131 sal_Int32 nLen;
133
134 TEIMEInfos(const TextPaM& rPos, OUString aOldTextAfterStartPos);
135 ~TEIMEInfos();
136
137 void CopyAttribs(const ExtTextInputAttr* pA, sal_Int32 nL);
138 void DestroyAttribs();
139};
140
141#endif // INCLUDED_VCL_TEXTDATA_HXX
142
143/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 mnValue
Definition: textdata.hxx:117
sal_Int32 GetValue() const
Definition: textdata.hxx:123
sal_uInt32 GetPara() const
Definition: textdata.hxx:45
TextPaM(sal_uInt32 nPara, sal_Int32 nIndex)
Definition: textdata.hxx:43
bool operator<(const TextPaM &rPaM) const
Definition: textdata.hxx:67
bool operator!=(const TextPaM &rPaM) const
Definition: textdata.hxx:62
sal_uInt32 & GetPara()
Definition: textdata.hxx:46
sal_uInt32 mnPara
Definition: textdata.hxx:38
sal_Int32 & GetIndex()
Definition: textdata.hxx:49
sal_Int32 GetIndex() const
Definition: textdata.hxx:48
bool operator>(const TextPaM &rPaM) const
Definition: textdata.hxx:73
sal_Int32 mnIndex
Definition: textdata.hxx:39
TextPaM()
Definition: textdata.hxx:42
bool operator==(const TextPaM &rPaM) const
Definition: textdata.hxx:57
TextPaM maEndPaM
Definition: textdata.hxx:83
bool operator!=(const TextSelection &rSel) const
Definition: textdata.hxx:109
bool operator==(const TextSelection &rSel) const
Definition: textdata.hxx:104
TextPaM maStartPaM
Definition: textdata.hxx:82
const TextPaM & GetStart() const
Definition: textdata.hxx:90
TextPaM & GetEnd()
Definition: textdata.hxx:94
const TextPaM & GetEnd() const
Definition: textdata.hxx:93
bool HasRange() const
Definition: textdata.hxx:98
TextPaM & GetStart()
Definition: textdata.hxx:91
ExtTextInputAttr
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
SfxHintId
sal_Int32 nIndex
const double mnValue
OUString aOldTextAfterStartPos
Definition: textdata.hxx:128
sal_Int32 nLen
Definition: textdata.hxx:131
TextPaM aPos
Definition: textdata.hxx:130
void CopyAttribs(const ExtTextInputAttr *pA, sal_Int32 nL)
Definition: textdata.cxx:332
std::unique_ptr< ExtTextInputAttr[]> pAttribs
Definition: textdata.hxx:129
bool bWasCursorOverwrite
Definition: textdata.hxx:132
TEIMEInfos(const TextPaM &rPos, OUString aOldTextAfterStartPos)
Definition: textdata.cxx:320
void DestroyAttribs()
Definition: textdata.cxx:339
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:175
bool operator!=(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:180