Bump version to 24.04.3.4
[LibreOffice.git] / editeng / source / outliner / paralist.hxx
blob47413ff5ff6c0f9d72e23db9521e9e01c6ac3c43
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 #pragma once
22 #include <sal/config.h>
23 #include <sal/log.hxx>
25 #include <memory>
26 #include <vector>
28 #include <editeng/outliner.hxx>
29 #include <o3tl/safeint.hxx>
30 #include <tools/link.hxx>
32 class Paragraph;
33 typedef struct _xmlTextWriter* xmlTextWriterPtr;
35 class ParagraphList
37 public:
38 void Clear();
40 sal_Int32 GetParagraphCount() const
42 size_t nSize = maEntries.size();
43 if (nSize > SAL_MAX_INT32)
45 SAL_WARN( "editeng", "ParagraphList::GetParagraphCount - overflow " << nSize);
46 return SAL_MAX_INT32;
48 return nSize;
51 Paragraph* GetParagraph( sal_Int32 nPos ) const
53 return 0 <= nPos && o3tl::make_unsigned(nPos) < maEntries.size() ? maEntries[nPos].get() : nullptr;
56 sal_Int32 GetAbsPos( Paragraph const * pParent ) const;
58 void Append( std::unique_ptr<Paragraph> pPara);
59 void Insert( std::unique_ptr<Paragraph> pPara, sal_Int32 nAbsPos);
60 void Remove( sal_Int32 nPara );
61 void MoveParagraphs( sal_Int32 nStart, sal_Int32 nDest, sal_Int32 nCount );
63 Paragraph* GetParent( Paragraph const * pParagraph ) const;
64 bool HasChildren( Paragraph const * pParagraph ) const;
65 bool HasHiddenChildren( Paragraph const * pParagraph ) const;
66 bool HasVisibleChildren( Paragraph const * pParagraph ) const;
67 sal_Int32 GetChildCount( Paragraph const * pParagraph ) const;
69 void Expand( Paragraph const * pParent );
70 void Collapse( Paragraph const * pParent );
72 void SetVisibleStateChangedHdl( const Link<Paragraph&,void>& rLink ) { aVisibleStateChangedHdl = rLink; }
74 void dumpAsXml(xmlTextWriterPtr pWriter) const;
76 private:
78 Link<Paragraph&,void> aVisibleStateChangedHdl;
79 std::vector<std::unique_ptr<Paragraph>> maEntries;
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */