LibreOffice Module editeng (master) 1
unoedsrc.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_UNOEDSRC_HXX
21#define INCLUDED_EDITENG_UNOEDSRC_HXX
22
23#include <i18nlangtag/lang.h>
24#include <rtl/ustring.hxx>
25#include <tools/gen.hxx>
26#include <tools/fontenum.hxx>
27#include <vcl/mapmod.hxx>
28#include <svl/poolitem.hxx>
30#include <editeng/editeng.hxx>
31
32#include <vector>
33
34struct ESelection;
35struct EFieldInfo;
36struct EBulletInfo;
37class Color;
38class OutputDevice;
39class SfxItemSet;
43class SvxFieldItem;
44class SfxBroadcaster;
45class SvxUnoTextRangeBase;
46
47typedef std::vector< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseVec;
48
56{
57public:
58 SvxEditSource() = default;
59 SvxEditSource(SvxEditSource const &) = default;
61 SvxEditSource & operator =(SvxEditSource const &) = default;
62 SvxEditSource & operator =(SvxEditSource &&) = default;
63
64 virtual ~SvxEditSource();
65
67 virtual std::unique_ptr<SvxEditSource> Clone() const = 0;
68
74
82 virtual SvxViewForwarder* GetViewForwarder();
83
103 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false );
104
106 virtual void UpdateData() = 0;
107
112 virtual SfxBroadcaster& GetBroadcaster() const;
113
120 virtual void addRange( SvxUnoTextRangeBase* pNewRange );
121
126 virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
127
130 virtual const SvxUnoTextRangeBaseVec& getRanges() const;
131};
132
133
142{
143public:
144 virtual ~SvxTextForwarder() COVERITY_NOEXCEPT_FALSE;
145
146 virtual sal_Int32 GetParagraphCount() const = 0;
147 virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const = 0;
148 virtual OUString GetText( const ESelection& rSel ) const = 0;
149 virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const = 0;
150 virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const = 0;
151 virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) = 0;
152 virtual void RemoveAttribs( const ESelection& rSelection ) = 0;
153 virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const = 0;
154
155 virtual OUString GetStyleSheet(sal_Int32 nPara) const = 0;
156 virtual void SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName) = 0;
157
158 virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0;
159 virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const = 0;
160
161 virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) = 0;
162 virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0;
163 virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0;
164 virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0;
165
166 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;
167 virtual void FieldClicked( const SvxFieldItem& rField ) = 0;
168
169 virtual SfxItemPool* GetPool() const = 0;
170
171 virtual const SfxItemSet* GetEmptyItemSetPtr() = 0;
172
173 // implementation functions for XParagraphAppend and XTextPortionAppend
174 virtual void AppendParagraph() = 0;
175 virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) = 0;
176
177 // XTextCopy
178 virtual void CopyText(const SvxTextForwarder& rSource) = 0;
179
184 virtual bool IsValid() const = 0;
185
194 virtual LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const = 0;
195
201 virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const = 0;
202
211 virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const = 0;
212
218 virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const = 0;
219
241 virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const = 0;
242
252 virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const = 0;
253
261 virtual MapMode GetMapMode() const = 0;
262
270 virtual OutputDevice* GetRefDevice() const = 0;
271
289 virtual bool GetIndexAtPoint( const Point& rPoint, sal_Int32& rPara, sal_Int32& rIndex ) const = 0;
290
314 virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& rStart, sal_Int32& rEnd ) const = 0;
315
331 virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const = 0;
332
341 virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const = 0;
342
352 virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const = 0;
353
369 virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const = 0;
370
382 virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const = 0;
383
391 virtual bool Delete( const ESelection& rSelection ) = 0;
392
403 virtual bool InsertText( const OUString& rText, const ESelection& rSel ) = 0;
404
411 virtual bool QuickFormatDoc( bool bFull = false ) = 0;
412
421 virtual sal_Int16 GetDepth( sal_Int32 nPara ) const = 0;
422
436 virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) = 0;
437
438 virtual sal_Int32 GetNumberingStartValue( sal_Int32 nPara );
439 virtual void SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue );
440
441 virtual bool IsParaIsNumberingRestart( sal_Int32 nPara );
442 virtual void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart );
443};
444
452{
453public:
454 virtual ~SvxViewForwarder();
455
460 virtual bool IsValid() const = 0;
461
472 virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const = 0;
473
484 virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const = 0;
485
486};
487
488
493{
494public:
495
504 virtual bool GetSelection( ESelection& rSelection ) const = 0;
505
513 virtual bool SetSelection( const ESelection& rSelection ) = 0;
514
519 virtual bool Copy() = 0;
520
525 virtual bool Cut() = 0;
526
531 virtual bool Paste() = 0;
532
533};
534
535#endif
536
537/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Wrapper class for unified EditEngine/Outliner access.
Definition: unoedsrc.hxx:56
virtual SvxTextForwarder * GetTextForwarder()=0
Query the text forwarder.
SvxEditSource()=default
virtual void UpdateData()=0
Write back data to model.
SvxEditSource(SvxEditSource &&)=default
virtual std::unique_ptr< SvxEditSource > Clone() const =0
Returns a new reference to the same object. This is a shallow copy.
SvxEditSource(SvxEditSource const &)=default
Encapsulates EditView and OutlinerView for the purpose of unified EditEngine/Outliner access.
Definition: unoedsrc.hxx:493
virtual bool Copy()=0
Copy current selection to clipboard.
virtual bool SetSelection(const ESelection &rSelection)=0
Set selection in view.
virtual bool Paste()=0
Paste clipboard into current selection.
virtual bool GetSelection(ESelection &rSelection) const =0
Query current selection.
virtual bool Cut()=0
Cut current selection to clipboard.
This item stores a field (SvxFieldData).
Definition: flditem.hxx:70
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 MapMode GetMapMode() const =0
Query the map mode of the underlying EditEngine/Outliner.
virtual SfxItemState GetItemState(sal_Int32 nPara, sal_uInt16 nWhich) const =0
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 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 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
Encapsulates the document view for the purpose of unified EditEngine/Outliner access.
Definition: unoedsrc.hxx:452
virtual Point LogicToPixel(const Point &rPoint, const MapMode &rMapMode) const =0
Convert from logical, EditEngine-relative coordinates to screen coordinates.
virtual bool IsValid() const =0
Query state of forwarder.
virtual Point PixelToLogic(const Point &rPoint, const MapMode &rMapMode) const =0
Convert from screen to logical, EditEngine-relative coordinates.
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
EditEngineAttribs
values for: SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEn...
SfxItemState
std::vector< SvxUnoTextRangeBase * > SvxUnoTextRangeBaseVec
Definition: unoedsrc.hxx:45