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 .
20 #ifndef INCLUDED_EDITENG_EDITOBJ_HXX
21 #define INCLUDED_EDITENG_EDITOBJ_HXX
23 #include <svl/style.hxx>
24 #include <svl/itempool.hxx>
25 #include <editeng/editengdllapi.h>
26 #include <editeng/macros.hxx>
27 #include <svl/languageoptions.hxx>
29 #include <com/sun/star/text/textfield/Type.hpp>
37 enum class OutlinerMode
;
43 class FieldUpdaterImpl
;
51 class SharedStringPool
;
55 class EditTextObjectImpl
;
57 class EDITENG_DLLPUBLIC EditTextObject
: public SfxItemPoolUser
59 friend class EditTextObjectImpl
;
60 friend class editeng::FieldUpdaterImpl
;
61 friend class ImpEditEngine
;
63 std::unique_ptr
<EditTextObjectImpl
> mpImpl
;
65 EditTextObject( SfxItemPool
* pPool
);
68 EditTextObject( const EditTextObject
& r
);
69 virtual ~EditTextObject();
70 EditTextObject
& operator=( const EditTextObject
& ) = delete;
73 * Set paragraph strings to the shared string pool.
75 * @param rPool shared string pool.
77 void NormalizeString( svl::SharedStringPool
& rPool
);
79 std::vector
<svl::SharedString
> GetSharedStrings() const;
81 const SfxItemPool
* GetPool() const;
82 OutlinerMode
GetUserType() const; // For OutlinerMode, it can however not save in compatible format
83 void SetUserType( OutlinerMode n
);
85 bool IsVertical() const;
86 bool IsTopToBottom() const;
87 void SetVertical( bool bVertical
, bool bTopToBottom
= true);
89 SvtScriptType
GetScriptType() const;
91 std::unique_ptr
<EditTextObject
> Clone() const;
93 sal_Int32
GetParagraphCount() const;
95 OUString
GetText(sal_Int32 nPara
) const;
97 void ClearPortionInfo();
99 bool HasOnlineSpellErrors() const;
101 void GetCharAttribs( sal_Int32 nPara
, std::vector
<EECharAttrib
>& rLst
) const;
103 bool RemoveCharAttribs( sal_uInt16 nWhich
);
106 * Get all text sections in this content. Sections are non-overlapping
107 * segments of text split either by paragraph boundaries or format
108 * boundaries. Each section object contains all applied formats and/or a
111 void GetAllSections( std::vector
<editeng::Section
>& rAttrs
) const;
113 bool IsFieldObject() const;
114 const SvxFieldItem
* GetField() const;
115 const SvxFieldData
* GetFieldData(sal_Int32 nPara
, size_t nPos
, sal_Int32 nType
) const;
116 bool HasField( sal_Int32 nType
= css::text::textfield::Type::UNSPECIFIED
) const;
118 const SfxItemSet
& GetParaAttribs(sal_Int32 nPara
) const;
120 void GetStyleSheet(sal_Int32 nPara
, OUString
& rName
, SfxStyleFamily
& eFamily
) const;
121 void SetStyleSheet(sal_Int32 nPara
, const OUString
& rName
, const SfxStyleFamily
& eFamily
);
122 bool ChangeStyleSheets(
123 const OUString
& rOldName
, SfxStyleFamily eOldFamily
, const OUString
& rNewName
, SfxStyleFamily eNewFamily
);
124 void ChangeStyleSheetName(SfxStyleFamily eFamily
, const OUString
& rOldName
, const OUString
& rNewName
);
126 editeng::FieldUpdater
GetFieldUpdater();
128 bool operator==( const EditTextObject
& rCompare
) const;
130 /** Compare, ignoring SfxItemPool pointer.
132 bool Equals( const EditTextObject
& rCompare
) const;
135 bool isWrongListEqual(const EditTextObject
& rCompare
) const;
137 virtual void ObjectInDestruction(const SfxItemPool
& rSfxItemPool
) override
;
139 #if DEBUG_EDIT_ENGINE
142 void dumpAsXml(xmlTextWriterPtr pWriter
) const;
145 #endif // INCLUDED_EDITENG_EDITOBJ_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */