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_EDITENG_OUTLOBJ_HXX
21 #define INCLUDED_EDITENG_OUTLOBJ_HXX
22 
23 #include <editeng/paragraphdata.hxx>
24 #include <editeng/editengdllapi.h>
25 #include <rtl/ustring.hxx>
26 #include <svl/poolitem.hxx>
27 #include <svl/style.hxx>
28 #include <o3tl/cow_wrapper.hxx>
29 #include <memory>
30 
31 class EditTextObject;
32 enum class OutlinerMode;
33 
34 /**
35  * This is the guts of OutlinerParaObject, refcounted and shared among
36  * multiple instances of OutlinerParaObject.
37  */
38 struct OutlinerParaObjData
39 {
40     // data members
41     std::unique_ptr<EditTextObject>  mpEditTextObject;
42     ParagraphDataVector              maParagraphDataVector;
43     bool                             mbIsEditDoc;
44 
45     // constructor
46     OutlinerParaObjData( std::unique_ptr<EditTextObject> pEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc );
47 
48     OutlinerParaObjData( const OutlinerParaObjData& r );
49 
50     OutlinerParaObjData( OutlinerParaObjData&& r ) = default;
51 
52     // assignment operator
53     OutlinerParaObjData& operator=(const OutlinerParaObjData& rCandidate) = delete;
54 
55     // destructor
56     ~OutlinerParaObjData();
57 
58     bool operator==(const OutlinerParaObjData& rCandidate) const;
59 
60     // #i102062#
61     bool isWrongListEqual(const OutlinerParaObjData& rCompare) const;
62 };
63 
64 class EDITENG_DLLPUBLIC OutlinerParaObject
65 {
66     ::o3tl::cow_wrapper< OutlinerParaObjData > mpImpl;
67 
68 public:
69     // constructors/destructor
70     OutlinerParaObject( const EditTextObject&, const ParagraphDataVector&, bool bIsEditDoc);
71     OutlinerParaObject( const EditTextObject&);
72     OutlinerParaObject( std::unique_ptr<EditTextObject> );
73     OutlinerParaObject( const OutlinerParaObject&);
74     ~OutlinerParaObject();
75 
76     // assignment operator
77     OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate);
78 
79     // compare operator
80     bool operator==(const OutlinerParaObject& rCandidate) const;
81 
82     // #i102062#
83     bool isWrongListEqual(const OutlinerParaObject& rCompare) const;
84 
85     // outliner mode access
86     OutlinerMode GetOutlinerMode() const;
87     void SetOutlinerMode(OutlinerMode nNew);
88 
89     // vertical access
90     bool IsVertical() const;
91     bool IsTopToBottom() const;
92     void SetVertical(bool bNew, bool bTopToBottom = true);
93 
94     // data read access
95     sal_Int32 Count() const;
96     sal_Int16 GetDepth(sal_Int32 nPara) const;
97     const EditTextObject& GetTextObject() const;
98     const ParagraphData& GetParagraphData(sal_Int32 nIndex) const;
99 
100     // portion info support
101     void ClearPortionInfo();
102 
103     // StyleSheet support
104     bool ChangeStyleSheets(const OUString& rOldName, SfxStyleFamily eOldFamily,
105         const OUString& rNewName, SfxStyleFamily eNewFamily);
106     void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName,
107         const OUString& rNewName);
108     void SetStyleSheets(sal_uInt16 nLevel, const OUString& rNewName,
109         const SfxStyleFamily& rNewFamily);
110 
111     void dumpAsXml(xmlTextWriterPtr pWriter) const;
112 };
113 
114 #endif
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
117