LibreOffice Module editeng (master) 1
unoforou.hxx
Go to the documentation of this file.
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_UNOFOROU_HXX
21#define INCLUDED_EDITENG_UNOFOROU_HXX
22
23#include <editeng/unoedsrc.hxx>
25#include <editeng/editdata.hxx>
26#include <svl/itemset.hxx>
27#include <optional>
28
29class Outliner;
30
31// SvxOutlinerForwarder - SvxTextForwarder for Outliner
32
34{
35private:
38
41 mutable std::optional<SfxItemSet> moAttribsCache;
42
45
48 mutable std::optional<SfxItemSet> moParaAttribsCache;
49
51 mutable sal_Int32 mnParaAttribsCache;
52
53public:
54 SvxOutlinerForwarder( Outliner& rOutl, bool bOutlText );
55 virtual ~SvxOutlinerForwarder() override;
56
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;
65
66 virtual OUString GetStyleSheet(sal_Int32 nPara) const override;
67 virtual void SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName) override;
68
69 virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override;
70 virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override;
71
72 virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override;
73 virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override;
74 virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override;
75 virtual void QuickInsertLineBreak( const ESelection& rSel ) override;
76
77 virtual SfxItemPool* GetPool() const override;
78
79 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;
80 virtual void FieldClicked( const SvxFieldItem& rField ) override;
81
82 virtual bool IsValid() const override;
83
84 virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override;
85 virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override;
86 virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override;
87 virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override;
88 virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override;
89 virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override;
90 virtual MapMode GetMapMode() const override;
91 virtual OutputDevice* GetRefDevice() const override;
92 virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override;
93 virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override;
94 virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override;
95 virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override;
96 virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override;
97 virtual void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nPara, sal_Int32 nLine ) const override;
98 virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override;
99 virtual bool Delete( const ESelection& ) override;
100 virtual bool InsertText( const OUString&, const ESelection& ) override;
101 virtual bool QuickFormatDoc( bool bFull = false ) override;
102 virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override;
103 virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override;
104 virtual sal_Int32 GetNumberingStartValue( sal_Int32 nPara ) override;
105 virtual void SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue ) override;
106
107 virtual bool IsParaIsNumberingRestart( sal_Int32 nPara ) override;
108 virtual void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart ) override;
109
110 /* this method flushes internal caches for this forwarder */
111 void flushCache();
112
113 virtual const SfxItemSet* GetEmptyItemSetPtr() override;
114
115 // implementation functions for XParagraphAppend and XTextPortionAppend
116 virtual void AppendParagraph() override;
117 virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override;
118 //XTextCopy
119 virtual void CopyText(const SvxTextForwarder& rSource) override;
120};
121
122#endif
123
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This item stores a field (SvxFieldData).
Definition: flditem.hxx:70
ESelection maAttribCacheSelection
if we have a cached attribute item set, this is the selection of it
Definition: unoforou.hxx:44
std::optional< SfxItemSet > moAttribsCache
this pointer may be null or point to an item set for the attribs of the selection maAttribsSelection
Definition: unoforou.hxx:41
Outliner & rOutliner
Definition: unoforou.hxx:36
std::optional< SfxItemSet > moParaAttribsCache
this pointer may be null or point to an item set for the paragraph mnParaAttribsCache
Definition: unoforou.hxx:48
sal_Int32 mnParaAttribsCache
if we have a cached para attribute item set, this is the paragraph of it
Definition: unoforou.hxx:51
Contains an EditEngine or an Outliner and unifies access to them.
Definition: unoedsrc.hxx:142
virtual bool IsValid() const =0
Query state of forwarder.
virtual void QuickInsertText(const OUString &rText, const ESelection &rSel)=0
virtual void SetNumberingStartValue(sal_Int32 nPara, sal_Int32 nNumberingStartValue)
Definition: unoforou.cxx:568
virtual MapMode GetMapMode() const =0
Query the map mode of the underlying EditEngine/Outliner.
virtual void QuickInsertLineBreak(const ESelection &rSel)=0
virtual void SetStyleSheet(sal_Int32 nPara, const OUString &rStyleName)=0
virtual void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)=0
virtual bool GetAttributeRun(sal_Int32 &nStartIndex, sal_Int32 &nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell=false) const =0
Query range of similar attributes.
virtual OutputDevice * GetRefDevice() const =0
Query the reference output device of the underlying EditEngine/Outliner.
virtual LanguageType GetLanguage(sal_Int32 nPara, sal_Int32 nIndex) const =0
Query language of character at given position on the underlying edit engine.
virtual OUString GetStyleSheet(sal_Int32 nPara) const =0
virtual bool SetDepth(sal_Int32 nPara, sal_Int16 nNewDepth)=0
Set the outline depth of given paragraph.
virtual const SfxItemSet * GetEmptyItemSetPtr()=0
virtual SfxItemSet GetAttribs(const ESelection &rSel, EditEngineAttribs nOnlyHardAttrib=EditEngineAttribs::All) const =0
virtual sal_Int32 GetNumberingStartValue(sal_Int32 nPara)
Definition: unoforou.cxx:563
virtual void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList) const =0
virtual void CopyText(const SvxTextForwarder &rSource)=0
virtual sal_Int32 GetFieldCount(sal_Int32 nPara) const =0
Query number of fields in the underlying edit engine.
virtual bool QuickFormatDoc(bool bFull=false)=0
Updates the formatting.
virtual void FieldClicked(const SvxFieldItem &rField)=0
virtual void RemoveAttribs(const ESelection &rSelection)=0
virtual sal_Int16 GetDepth(sal_Int32 nPara) const =0
Get the outline depth of given paragraph.
virtual bool Delete(const ESelection &rSelection)=0
Delete given text range and reformat text.
virtual SfxItemSet GetParaAttribs(sal_Int32 nPara) const =0
virtual EBulletInfo GetBulletInfo(sal_Int32 nPara) const =0
Query information regarding bullets for given paragraph on the underlying edit engine.
virtual void AppendParagraph()=0
virtual EFieldInfo GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const =0
Query information for given field number in the underlying edit engine.
virtual SfxItemPool * GetPool() const =0
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, std::optional< FontLineStyle > &rpFldLineStyle)=0
virtual tools::Rectangle GetParaBounds(sal_Int32 nPara) const =0
Query the bounding rectangle of the given paragraph.
virtual tools::Rectangle GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const =0
Query the bounding rectangle of the given character.
virtual sal_Int32 AppendTextPortion(sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet)=0
virtual sal_Int32 GetTextLen(sal_Int32 nParagraph) const =0
virtual sal_Int32 GetLineCount(sal_Int32 nPara) const =0
Query number of lines in the formatted paragraph.
virtual OUString GetText(const ESelection &rSel) const =0
virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &rSet)=0
virtual bool GetIndexAtPoint(const Point &rPoint, sal_Int32 &rPara, sal_Int32 &rIndex) const =0
Query paragraph and character index of the character at the given point.
virtual void GetLineBoundaries(sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine) const =0
Query bounds of line in paragraph.
virtual sal_Int32 GetParagraphCount() const =0
virtual bool IsParaIsNumberingRestart(sal_Int32 nPara)
Definition: unoforou.cxx:572
virtual void SetParaIsNumberingRestart(sal_Int32 nPara, bool bParaIsNumberingRestart)
Definition: unoforou.cxx:577
virtual bool GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32 &rStart, sal_Int32 &rEnd) const =0
Get the start and the end index of the word at the given index.
virtual sal_Int32 GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const =0
Query line length.
virtual sal_Int32 GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nIndex) const =0
Query the line number for an index in the paragraphs text.
virtual void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)=0
virtual bool InsertText(const OUString &rText, const ESelection &rSel)=0
Insert/Replace given text in given range and reformat text.
virtual SfxItemState GetItemState(const ESelection &rSel, sal_uInt16 nWhich) const =0
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
EditEngineAttribs
values for: SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEn...
SfxItemState