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 enum class TextRotation;
34 
35 /**
36  * This is the guts of OutlinerParaObject, refcounted and shared among
37  * multiple instances of OutlinerParaObject.
38  */
39 struct OutlinerParaObjData
40 {
41     // data members
42     std::unique_ptr<EditTextObject>  mpEditTextObject;
43     ParagraphDataVector              maParagraphDataVector;
44     bool                             mbIsEditDoc;
45 
46     // constructor
47     OutlinerParaObjData( std::unique_ptr<EditTextObject> pEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc );
48 
49     OutlinerParaObjData( const OutlinerParaObjData& r );
50 
51     OutlinerParaObjData( OutlinerParaObjData&& r ) = default;
52 
53     // assignment operator
54     OutlinerParaObjData& operator=(const OutlinerParaObjData& rCandidate) = delete;
55 
56     // destructor
57     ~OutlinerParaObjData();
58 
59     bool operator==(const OutlinerParaObjData& rCandidate) const;
60 
61     // #i102062#
62     bool isWrongListEqual(const OutlinerParaObjData& rCompare) const;
63 };
64 
65 class EDITENG_DLLPUBLIC OutlinerParaObject
66 {
67     ::o3tl::cow_wrapper< OutlinerParaObjData > mpImpl;
68 
69 public:
70     // constructors/destructor
71     OutlinerParaObject(std::unique_ptr<EditTextObject>, const ParagraphDataVector&, bool bIsEditDoc);
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 GetDirectVertical() const;
92     bool IsTopToBottom() const;
93     void SetVertical(bool bNew);
94     void SetRotation(TextRotation nRotation);
95     TextRotation GetRotation() const;
96 
97     // data read access
98     sal_Int32 Count() const;
99     sal_Int16 GetDepth(sal_Int32 nPara) const;
100     const EditTextObject& GetTextObject() const;
101     const ParagraphData& GetParagraphData(sal_Int32 nIndex) const;
102 
103     // portion info support
104     void ClearPortionInfo();
105 
106     // StyleSheet support
107     bool ChangeStyleSheets(std::u16string_view rOldName, SfxStyleFamily eOldFamily,
108         const OUString& rNewName, SfxStyleFamily eNewFamily);
109     void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName,
110         const OUString& rNewName);
111     void SetStyleSheets(sal_uInt16 nLevel, const OUString& rNewName,
112         const SfxStyleFamily& rNewFamily);
113 
114     void dumpAsXml(xmlTextWriterPtr pWriter) const;
115 };
116 
117 #endif
118 
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
120