xref: /aoo41x/main/editeng/inc/editeng/unoforou.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SVX_UNOFOROU_HXX
29 #define _SVX_UNOFOROU_HXX
30 
31 #include <editeng/unoedsrc.hxx>
32 #include "editeng/editengdllapi.h"
33 
34 #include <editeng/editdata.hxx>
35 
36 class Outliner;
37 
38 //	SvxOutlinerForwarder - SvxTextForwarder fuer Outliner
39 
40 class EDITENG_DLLPUBLIC SvxOutlinerForwarder : public SvxTextForwarder
41 {
42 private:
43 	Outliner&			rOutliner;
44     sal_Bool				bOutlinerText;
45 
46 	/** this pointer may be null or point to an item set for the attribs of
47 		the selection maAttribsSelection */
48 	mutable SfxItemSet* mpAttribsCache;
49 
50 	/** if we have a chached attribute item set, this is the selection of it */
51 	mutable ESelection	maAttribCacheSelection;
52 
53 	/** this pointer may be null or point to an item set for the paragraph
54 		mnParaAttribsCache */
55 	mutable SfxItemSet*	mpParaAttribsCache;
56 
57 	/** if we have a cached para attribute item set, this is the paragraph of it */
58 	mutable sal_uInt16		mnParaAttribsCache;
59 
60 public:
61 						SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText = sal_False );
62 	virtual				~SvxOutlinerForwarder();
63 
64 	virtual sal_uInt16		GetParagraphCount() const;
65 	virtual sal_uInt16		GetTextLen( sal_uInt16 nParagraph ) const;
66 	virtual String		GetText( const ESelection& rSel ) const;
67 	virtual SfxItemSet	GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
68 	virtual	SfxItemSet	GetParaAttribs( sal_uInt16 nPara ) const;
69 	virtual void		SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
70     virtual void        RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
71 	virtual void		GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const;
72 
73 	virtual sal_uInt16		GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
74 	virtual sal_uInt16		GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
75 
76 	virtual void		QuickInsertText( const String& rText, const ESelection& rSel );
77 	virtual void		QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
78 	virtual void		QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
79 	virtual void		QuickInsertLineBreak( const ESelection& rSel );
80 
81 	virtual SfxItemPool* GetPool() const;
82 
83 	virtual XubString    CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
84 	virtual void 	     FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
85 
86 	virtual sal_Bool		IsValid() const;
87 
88 	Outliner&			GetOutliner() const { return rOutliner; }
89 
90     virtual LanguageType 	GetLanguage( sal_uInt16, sal_uInt16 ) const;
91     virtual sal_uInt16			GetFieldCount( sal_uInt16 nPara ) const;
92     virtual EFieldInfo		GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
93     virtual EBulletInfo     GetBulletInfo( sal_uInt16 nPara ) const;
94     virtual Rectangle		GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
95     virtual Rectangle		GetParaBounds( sal_uInt16 nPara ) const;
96     virtual MapMode			GetMapMode() const;
97 	virtual OutputDevice*	GetRefDevice() const;
98     virtual sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
99     virtual sal_Bool		GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
100     virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
101     virtual sal_uInt16			GetLineCount( sal_uInt16 nPara ) const;
102     virtual sal_uInt16			GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
103     virtual void            GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const;
104     virtual sal_uInt16          GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
105     virtual sal_Bool		Delete( const ESelection& );
106     virtual sal_Bool		InsertText( const String&, const ESelection& );
107     virtual sal_Bool		QuickFormatDoc( sal_Bool bFull=sal_False );
108     virtual sal_Int16		GetDepth( sal_uInt16 nPara ) const;
109     virtual sal_Bool		SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
110     virtual sal_Int16       GetNumberingStartValue( sal_uInt16 nPara );
111     virtual void            SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
112 
113     virtual sal_Bool        IsParaIsNumberingRestart( sal_uInt16 nPara );
114     virtual void            SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
115 
116 	/* this method flushes internal caches for this forwarder */
117 	void				flushCache();
118 
119     virtual const SfxItemSet*   GetEmptyItemSetPtr();
120 
121     // implementation functions for XParagraphAppend and XTextPortionAppend
122     virtual void        AppendParagraph();
123     virtual xub_StrLen  AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
124     //XTextCopy
125     virtual void        CopyText(const SvxTextForwarder& rSource);
126 };
127 
128 #endif
129 
130