fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / vcl / textdata.hxx
blob476ba00279dfdd6ccd2e23fd3e92f4d2b52af748
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _TEXTDATA_HXX
21 #define _TEXTDATA_HXX
23 #include <vcl/dllapi.h>
24 #include <svl/brdcst.hxx>
25 #include <svl/smplhint.hxx>
26 #include <tools/string.hxx>
28 // for Notify, if all paragraphs were deleted
29 #define TEXT_PARA_ALL 0xFFFFFFFF
31 class TextPaM
33 private:
34 sal_uLong mnPara;
35 sal_uInt16 mnIndex;
37 public:
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 sal_Bool operator == ( const TextPaM& rPaM ) const;
48 inline sal_Bool operator != ( const TextPaM& rPaM ) const;
49 inline sal_Bool operator < ( const TextPaM& rPaM ) const;
50 inline sal_Bool operator > ( const TextPaM& rPaM ) const;
53 inline sal_Bool TextPaM::operator == ( const TextPaM& rPaM ) const
55 return ( ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex ) ) ? sal_True : sal_False;
58 inline sal_Bool TextPaM::operator != ( const TextPaM& rPaM ) const
60 return !( *this == rPaM );
63 inline sal_Bool TextPaM::operator < ( const TextPaM& rPaM ) const
65 return ( ( mnPara < rPaM.mnPara ) ||
66 ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex ) ) ? sal_True : sal_False;
69 inline sal_Bool TextPaM::operator > ( const TextPaM& rPaM ) const
71 return ( ( mnPara > rPaM.mnPara ) ||
72 ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex ) ) ? sal_True : sal_False;
75 class VCL_DLLPUBLIC TextSelection
77 private:
78 TextPaM maStartPaM;
79 TextPaM maEndPaM;
81 public:
82 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; }
92 void Justify();
94 sal_Bool HasRange() const { return maStartPaM != maEndPaM; }
96 inline sal_Bool operator == ( const TextSelection& rSel ) const;
97 inline sal_Bool operator != ( const TextSelection& rSel ) const;
100 inline sal_Bool TextSelection::operator == ( const TextSelection& rSel ) const
102 return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
105 inline sal_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
125 class VCL_DLLPUBLIC TextHint : public SfxSimpleHint
127 private:
128 sal_uLong mnValue;
130 public:
131 TYPEINFO();
132 TextHint( sal_uLong nId );
133 TextHint( sal_uLong nId, sal_uLong nValue );
135 sal_uLong GetValue() const { return mnValue; }
136 void SetValue( sal_uLong n ) { mnValue = n; }
139 struct TEIMEInfos
141 String aOldTextAfterStartPos;
142 sal_uInt16* pAttribs;
143 TextPaM aPos;
144 sal_uInt16 nLen;
145 sal_Bool bCursor;
146 sal_Bool bWasCursorOverwrite;
148 TEIMEInfos( const TextPaM& rPos, const String& rOldTextAfterStartPos );
149 ~TEIMEInfos();
151 void CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL );
152 void DestroyAttribs();
155 // ----------------- Wrapper for old Tools List -------------------
157 #include <vector>
158 #include <algorithm>
160 template <class T> class ToolsList : public ::std::vector< T >
162 public:
163 sal_uLong Count() const { return static_cast<sal_uLong>(::std::vector< T >::size()); }
164 sal_uLong GetPos( T pObject ) const { return ( ::std::find( this->begin(), this->end(), pObject ) ) - this->begin(); }
165 T GetObject( sal_uLong nIndex ) const { return (*this)[nIndex]; }
166 void Insert( T pObject, sal_uLong nPos ) { ::std::vector< T >::insert( this->begin()+nPos, pObject ); }
167 void Remove( sal_uLong nPos ) { ::std::vector< T >::erase( this->begin()+nPos ); }
170 #endif // _TEXTDATA_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */