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 .
23 #include <vcl/textdata.hxx>
24 #include <vcl/txtattr.hxx>
26 #include <tools/string.hxx>
29 class TextCharAttribs
: public std::vector
<TextCharAttrib
*> {
33 for( iterator it
= begin(); it
!= end(); ++it
)
38 class TextCharAttribList
: private TextCharAttribs
41 sal_Bool mbHasEmptyAttribs
;
43 TextCharAttribList( const TextCharAttribList
& ) : TextCharAttribs() {}
47 ~TextCharAttribList();
49 void Clear( sal_Bool bDestroyAttribs
);
50 sal_uInt16
Count() const { return TextCharAttribs::size(); }
52 TextCharAttrib
* GetAttrib( sal_uInt16 n
) const { return TextCharAttribs::operator[]( n
); }
53 void RemoveAttrib( sal_uInt16 n
) { TextCharAttribs::erase( begin() + n
); }
55 void InsertAttrib( TextCharAttrib
* pAttrib
);
57 void DeleteEmptyAttribs();
60 sal_Bool
HasEmptyAttribs() const { return mbHasEmptyAttribs
; }
61 sal_Bool
& HasEmptyAttribs() { return mbHasEmptyAttribs
; }
63 TextCharAttrib
* FindAttrib( sal_uInt16 nWhich
, sal_uInt16 nPos
);
64 TextCharAttrib
* FindNextAttrib( sal_uInt16 nWhich
, sal_uInt16 nFromPos
, sal_uInt16 nMaxPos
= 0xFFFF ) const;
65 TextCharAttrib
* FindEmptyAttrib( sal_uInt16 nWhich
, sal_uInt16 nPos
);
66 sal_Bool
HasAttrib( sal_uInt16 nWhich
) const;
67 sal_Bool
HasBoundingAttrib( sal_uInt16 nBound
);
75 TextCharAttribList maCharAttribs
;
77 TextNode( const TextNode
& ) {;}
79 void ExpandAttribs( sal_uInt16 nIndex
, sal_uInt16 nNewChars
);
80 void CollapsAttribs( sal_uInt16 nIndex
, sal_uInt16 nDelChars
);
83 TextNode( const String
& rText
);
86 const String
& GetText() const { return maText
; }
88 const TextCharAttribList
& GetCharAttribs() const { return maCharAttribs
; }
89 TextCharAttribList
& GetCharAttribs() { return maCharAttribs
; }
91 void InsertText( sal_uInt16 nPos
, const String
& rText
);
92 void InsertText( sal_uInt16 nPos
, sal_Unicode c
);
93 void RemoveText( sal_uInt16 nPos
, sal_uInt16 nChars
);
95 TextNode
* Split( sal_uInt16 nPos
, sal_Bool bKeepEndigAttribs
);
96 void Append( const TextNode
& rNode
);
102 ToolsList
<TextNode
*> maTextNodes
;
103 sal_uInt16 mnLeftMargin
;
106 void DestroyTextNodes();
114 ToolsList
<TextNode
*>& GetNodes() { return maTextNodes
; }
115 const ToolsList
<TextNode
*>& GetNodes() const { return maTextNodes
; }
117 TextPaM
RemoveChars( const TextPaM
& rPaM
, sal_uInt16 nChars
);
118 TextPaM
InsertText( const TextPaM
& rPaM
, sal_Unicode c
);
119 TextPaM
InsertText( const TextPaM
& rPaM
, const String
& rStr
);
121 TextPaM
InsertParaBreak( const TextPaM
& rPaM
, sal_Bool bKeepEndingAttribs
);
122 TextPaM
ConnectParagraphs( TextNode
* pLeft
, TextNode
* pRight
);
124 sal_uLong
GetTextLen( const sal_Unicode
* pSep
, const TextSelection
* pSel
= NULL
) const;
125 String
GetText( const sal_Unicode
* pSep
) const;
126 String
GetText( sal_uLong nPara
) const;
128 void SetLeftMargin( sal_uInt16 n
) { mnLeftMargin
= n
; }
129 sal_uInt16
GetLeftMargin() const { return mnLeftMargin
; }
131 sal_Bool
IsValidPaM( const TextPaM
& rPaM
);
134 #endif // _TEXTDOC_HXX
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */