1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_TEXTDATA_HXX
21 #define INCLUDED_VCL_TEXTDATA_HXX
23 #include <rtl/ustring.hxx>
24 #include <svl/brdcst.hxx>
25 #include <svl/smplhint.hxx>
26 #include <vcl/dllapi.h>
28 // for Notify, if all paragraphs were deleted
29 #define TEXT_PARA_ALL 0xFFFFFFFF
38 TextPaM() { mnPara
= 0, mnIndex
= 0; }
39 TextPaM( sal_uLong nPara
, sal_uInt16 nIndex
) { mnPara
= nPara
, mnIndex
= nIndex
; }
41 sal_uLong
GetPara() const { return mnPara
; }
42 sal_uLong
& GetPara() { return mnPara
; }
44 sal_uInt16
GetIndex() const { return mnIndex
; }
45 sal_uInt16
& GetIndex() { return mnIndex
; }
47 inline bool operator == ( const TextPaM
& rPaM
) const;
48 inline bool operator != ( const TextPaM
& rPaM
) const;
49 inline bool operator < ( const TextPaM
& rPaM
) const;
50 inline bool operator > ( const TextPaM
& rPaM
) const;
53 inline bool TextPaM::operator == ( const TextPaM
& rPaM
) const
55 return ( mnPara
== rPaM
.mnPara
) && ( mnIndex
== rPaM
.mnIndex
);
58 inline bool TextPaM::operator != ( const TextPaM
& rPaM
) const
60 return !( *this == rPaM
);
63 inline bool TextPaM::operator < ( const TextPaM
& rPaM
) const
65 return ( mnPara
< rPaM
.mnPara
) ||
66 ( ( mnPara
== rPaM
.mnPara
) && mnIndex
< rPaM
.mnIndex
);
69 inline bool TextPaM::operator > ( const TextPaM
& rPaM
) const
71 return ( mnPara
> rPaM
.mnPara
) ||
72 ( ( mnPara
== rPaM
.mnPara
) && mnIndex
> rPaM
.mnIndex
);
75 class VCL_DLLPUBLIC TextSelection
83 TextSelection( const TextPaM
& rPaM
);
84 TextSelection( const TextPaM
& rStart
, const TextPaM
& rEnd
);
86 const TextPaM
& GetStart() const { return maStartPaM
; }
87 TextPaM
& GetStart() { return maStartPaM
; }
89 const TextPaM
& GetEnd() const { return maEndPaM
; }
90 TextPaM
& GetEnd() { return maEndPaM
; }
94 bool HasRange() const { return maStartPaM
!= maEndPaM
; }
96 inline bool operator == ( const TextSelection
& rSel
) const;
97 inline bool operator != ( const TextSelection
& rSel
) const;
100 inline bool TextSelection::operator == ( const TextSelection
& rSel
) const
102 return ( ( maStartPaM
== rSel
.maStartPaM
) && ( maEndPaM
== rSel
.maEndPaM
) );
105 inline bool TextSelection::operator != ( const TextSelection
& rSel
) const
107 return !( *this == rSel
);
110 #define TEXT_HINT_PARAINSERTED 1
111 #define TEXT_HINT_PARAREMOVED 2
112 #define TEXT_HINT_PARACONTENTCHANGED 3
113 #define TEXT_HINT_TEXTHEIGHTCHANGED 4
114 #define TEXT_HINT_FORMATPARA 5
115 #define TEXT_HINT_TEXTFORMATTED 6
116 #define TEXT_HINT_MODIFIED 7
117 #define TEXT_HINT_BLOCKNOTIFICATION_START 8
118 #define TEXT_HINT_BLOCKNOTIFICATION_END 9
119 #define TEXT_HINT_INPUT_START 10
120 #define TEXT_HINT_INPUT_END 11
122 #define TEXT_HINT_VIEWSCROLLED 100
123 #define TEXT_HINT_VIEWSELECTIONCHANGED 101
124 #define TEXT_HINT_VIEWCARETCHANGED 102
126 class VCL_DLLPUBLIC TextHint
: public SfxSimpleHint
133 TextHint( sal_uLong nId
);
134 TextHint( sal_uLong nId
, sal_uLong nValue
);
136 sal_uLong
GetValue() const { return mnValue
; }
137 void SetValue( sal_uLong n
) { mnValue
= n
; }
142 OUString aOldTextAfterStartPos
;
143 sal_uInt16
* pAttribs
;
147 bool bWasCursorOverwrite
;
149 TEIMEInfos(const TextPaM
& rPos
, const OUString
& rOldTextAfterStartPos
);
152 void CopyAttribs(const sal_uInt16
* pA
, sal_Int32 nL
);
153 void DestroyAttribs();
156 // ----------------- Wrapper for old Tools List -------------------
161 template <class T
> class ToolsList
: public ::std::vector
< T
>
164 size_t Count() const { return ::std::vector
< T
>::size(); }
165 size_t GetPos( T pObject
) const { return ( ::std::find( this->begin(), this->end(), pObject
) ) - this->begin(); }
166 T
GetObject( size_t nIndex
) const { return (*this)[nIndex
]; }
167 void Insert( T pObject
, size_t nPos
) { ::std::vector
< T
>::insert( this->begin()+nPos
, pObject
); }
168 void Remove( size_t nPos
) { ::std::vector
< T
>::erase( this->begin()+nPos
); }
171 #endif // INCLUDED_VCL_TEXTDATA_HXX
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */