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