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_UNOFOROU_HXX
21 #define INCLUDED_EDITENG_UNOFOROU_HXX
23 #include <editeng/unoedsrc.hxx>
24 #include <editeng/editengdllapi.h>
25 #include <editeng/editdata.hxx>
26 #include <svl/itemset.hxx>
31 // SvxOutlinerForwarder - SvxTextForwarder for Outliner
33 class EDITENG_DLLPUBLIC SvxOutlinerForwarder final
: public SvxTextForwarder
39 /** this pointer may be null or point to an item set for the attribs of
40 the selection maAttribsSelection */
41 mutable std::optional
<SfxItemSet
> moAttribsCache
;
43 /** if we have a cached attribute item set, this is the selection of it */
44 mutable ESelection maAttribCacheSelection
;
46 /** this pointer may be null or point to an item set for the paragraph
48 mutable std::optional
<SfxItemSet
> moParaAttribsCache
;
50 /** if we have a cached para attribute item set, this is the paragraph of it */
51 mutable sal_Int32 mnParaAttribsCache
;
54 SvxOutlinerForwarder( Outliner
& rOutl
, bool bOutlText
);
55 virtual ~SvxOutlinerForwarder() override
;
57 virtual sal_Int32
GetParagraphCount() const override
;
58 virtual sal_Int32
GetTextLen( sal_Int32 nParagraph
) const override
;
59 virtual OUString
GetText( const ESelection
& rSel
) const override
;
60 virtual SfxItemSet
GetAttribs( const ESelection
& rSel
, EditEngineAttribs nOnlyHardAttrib
= EditEngineAttribs::All
) const override
;
61 virtual SfxItemSet
GetParaAttribs( sal_Int32 nPara
) const override
;
62 virtual void SetParaAttribs( sal_Int32 nPara
, const SfxItemSet
& rSet
) override
;
63 virtual void RemoveAttribs( const ESelection
& rSelection
) override
;
64 virtual void GetPortions( sal_Int32 nPara
, std::vector
<sal_Int32
>& rList
) const override
;
66 virtual SfxItemState
GetItemState( const ESelection
& rSel
, sal_uInt16 nWhich
) const override
;
67 virtual SfxItemState
GetItemState( sal_Int32 nPara
, sal_uInt16 nWhich
) const override
;
69 virtual void QuickInsertText( const OUString
& rText
, const ESelection
& rSel
) override
;
70 virtual void QuickInsertField( const SvxFieldItem
& rFld
, const ESelection
& rSel
) override
;
71 virtual void QuickSetAttribs( const SfxItemSet
& rSet
, const ESelection
& rSel
) override
;
72 virtual void QuickInsertLineBreak( const ESelection
& rSel
) override
;
74 virtual SfxItemPool
* GetPool() const override
;
76 virtual OUString
CalcFieldValue( const SvxFieldItem
& rField
, sal_Int32 nPara
, sal_Int32 nPos
, std::optional
<Color
>& rpTxtColor
, std::optional
<Color
>& rpFldColor
, std::optional
<FontLineStyle
>& rpFldLineStyle
) override
;
77 virtual void FieldClicked( const SvxFieldItem
& rField
) override
;
79 virtual bool IsValid() const override
;
81 virtual LanguageType
GetLanguage( sal_Int32
, sal_Int32
) const override
;
82 virtual sal_Int32
GetFieldCount( sal_Int32 nPara
) const override
;
83 virtual EFieldInfo
GetFieldInfo( sal_Int32 nPara
, sal_uInt16 nField
) const override
;
84 virtual EBulletInfo
GetBulletInfo( sal_Int32 nPara
) const override
;
85 virtual tools::Rectangle
GetCharBounds( sal_Int32 nPara
, sal_Int32 nIndex
) const override
;
86 virtual tools::Rectangle
GetParaBounds( sal_Int32 nPara
) const override
;
87 virtual MapMode
GetMapMode() const override
;
88 virtual OutputDevice
* GetRefDevice() const override
;
89 virtual bool GetIndexAtPoint( const Point
&, sal_Int32
& nPara
, sal_Int32
& nIndex
) const override
;
90 virtual bool GetWordIndices( sal_Int32 nPara
, sal_Int32 nIndex
, sal_Int32
& nStart
, sal_Int32
& nEnd
) const override
;
91 virtual bool GetAttributeRun( sal_Int32
& nStartIndex
, sal_Int32
& nEndIndex
, sal_Int32 nPara
, sal_Int32 nIndex
, bool bInCell
= false ) const override
;
92 virtual sal_Int32
GetLineCount( sal_Int32 nPara
) const override
;
93 virtual sal_Int32
GetLineLen( sal_Int32 nPara
, sal_Int32 nLine
) const override
;
94 virtual void GetLineBoundaries( /*out*/sal_Int32
& rStart
, /*out*/sal_Int32
& rEnd
, sal_Int32 nPara
, sal_Int32 nLine
) const override
;
95 virtual sal_Int32
GetLineNumberAtIndex( sal_Int32 nPara
, sal_Int32 nIndex
) const override
;
96 virtual bool Delete( const ESelection
& ) override
;
97 virtual bool InsertText( const OUString
&, const ESelection
& ) override
;
98 virtual bool QuickFormatDoc( bool bFull
= false ) override
;
99 virtual sal_Int16
GetDepth( sal_Int32 nPara
) const override
;
100 virtual bool SetDepth( sal_Int32 nPara
, sal_Int16 nNewDepth
) override
;
101 virtual sal_Int32
GetNumberingStartValue( sal_Int32 nPara
) override
;
102 virtual void SetNumberingStartValue( sal_Int32 nPara
, sal_Int32 nNumberingStartValue
) override
;
104 virtual bool IsParaIsNumberingRestart( sal_Int32 nPara
) override
;
105 virtual void SetParaIsNumberingRestart( sal_Int32 nPara
, bool bParaIsNumberingRestart
) override
;
107 /* this method flushes internal caches for this forwarder */
110 virtual const SfxItemSet
* GetEmptyItemSetPtr() override
;
112 // implementation functions for XParagraphAppend and XTextPortionAppend
113 virtual void AppendParagraph() override
;
114 virtual sal_Int32
AppendTextPortion( sal_Int32 nPara
, const OUString
&rText
, const SfxItemSet
&rSet
) override
;
116 virtual void CopyText(const SvxTextForwarder
& rSource
) override
;
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */