xref: /aoo41x/main/sc/inc/editsrc.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 SC_EDITSRC_HXX
29 #define SC_EDITSRC_HXX
30 
31 #include "address.hxx"
32 #include <editeng/unoedsrc.hxx>
33 #include <svl/lstner.hxx>
34 
35 #include <memory>
36 
37 class ScEditEngineDefaulter;
38 class SvxEditEngineForwarder;
39 
40 class ScDocShell;
41 class ScHeaderFooterContentObj;
42 class ScCellTextData;
43 class ScHeaderFooterTextData;
44 class ScAccessibleTextData;
45 class SdrObject;
46 
47 
48 class ScHeaderFooterChangedHint : public SfxHint
49 {
50 	sal_uInt16 nPart;
51 
52 public:
53 					TYPEINFO();
54 					ScHeaderFooterChangedHint(sal_uInt16 nP);
55 					~ScHeaderFooterChangedHint();
56 
57 	sal_uInt16			GetPart() const			{ return nPart; }
58 };
59 
60 
61 //	all ScSharedHeaderFooterEditSource objects for a single text share the same data
62 
63 class ScSharedHeaderFooterEditSource : public SvxEditSource
64 {
65 private:
66 	ScHeaderFooterTextData*		pTextData;
67 
68 protected:
69 	ScHeaderFooterTextData*		GetTextData() const	{ return pTextData; }	// for ScHeaderFooterEditSource
70 
71 public:
72 								ScSharedHeaderFooterEditSource( ScHeaderFooterTextData* pData );
73 	virtual						~ScSharedHeaderFooterEditSource();
74 
75 	//	GetEditEngine is needed because the forwarder doesn't have field functions
76 	ScEditEngineDefaulter*		GetEditEngine();
77 
78 	virtual SvxEditSource*		Clone() const ;
79 	virtual SvxTextForwarder*	GetTextForwarder();
80 
81 	virtual void				UpdateData();
82 
83 };
84 
85 //	ScHeaderFooterEditSource with local copy of ScHeaderFooterTextData is used by field objects
86 
87 class ScHeaderFooterEditSource : public ScSharedHeaderFooterEditSource
88 {
89 public:
90 								ScHeaderFooterEditSource( ScHeaderFooterContentObj* pContent, sal_uInt16 nP );
91 								ScHeaderFooterEditSource( ScHeaderFooterContentObj& rContent, sal_uInt16 nP );
92 	virtual						~ScHeaderFooterEditSource();
93 
94 	virtual SvxEditSource*		Clone() const;
95 };
96 
97 
98 //	Data (incl. EditEngine) for cell EditSource is now shared in ScCellTextData
99 
100 class ScSharedCellEditSource : public SvxEditSource
101 {
102 private:
103 	ScCellTextData*			pCellTextData;
104 
105 protected:
106 	ScCellTextData*			GetCellTextData() const	{ return pCellTextData; }	// for ScCellEditSource
107 
108 public:
109 								ScSharedCellEditSource( ScCellTextData* pData );
110 	virtual						~ScSharedCellEditSource();
111 
112 	//	GetEditEngine is needed because the forwarder doesn't have field functions
113 	ScEditEngineDefaulter*		GetEditEngine();
114 
115 	virtual SvxEditSource*		Clone() const;
116 	virtual SvxTextForwarder*	GetTextForwarder();
117 
118 	virtual void				UpdateData();
119 
120 	void						SetDoUpdateData(sal_Bool bValue);
121 	sal_Bool					IsDirty() const;
122 };
123 
124 //	ScCellEditSource with local copy of ScCellTextData is used by ScCellFieldsObj, ScCellFieldObj
125 
126 class ScCellEditSource : public ScSharedCellEditSource
127 {
128 public:
129 								ScCellEditSource( ScDocShell* pDocSh, const ScAddress& rP );
130 	virtual						~ScCellEditSource();
131 
132 	virtual SvxEditSource*		Clone() const;
133 };
134 
135 
136 class ScAnnotationEditSource : public SvxEditSource, public SfxListener
137 {
138 private:
139 	ScDocShell*				pDocShell;
140 	ScAddress				aCellPos;
141 	ScEditEngineDefaulter*  pEditEngine;
142 	SvxEditEngineForwarder*	pForwarder;
143 	sal_Bool					bDataValid;
144 
145     SdrObject*                  GetCaptionObj();
146 public:
147 								ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddress& rP);
148 	virtual						~ScAnnotationEditSource();
149 
150 	virtual SvxEditSource*		Clone() const ;
151 	virtual SvxTextForwarder*	GetTextForwarder();
152 	virtual void				UpdateData();
153 
154 	virtual void				Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
155 };
156 
157 
158 //	EditSource with a shared forwarder for all children of one text object
159 
160 class ScSimpleEditSource : public SvxEditSource
161 {
162 private:
163 	SvxTextForwarder*	pForwarder;
164 
165 public:
166 						ScSimpleEditSource( SvxTextForwarder* pForw );
167 	virtual				~ScSimpleEditSource();
168 
169 	virtual SvxEditSource*		Clone() const ;
170 	virtual SvxTextForwarder*	GetTextForwarder();
171 	virtual void				UpdateData();
172 
173 };
174 
175 class ScAccessibilityEditSource : public SvxEditSource
176 {
177 private:
178 	::std::auto_ptr < ScAccessibleTextData > mpAccessibleTextData;
179 
180 public:
181 						ScAccessibilityEditSource( ::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData );
182 	virtual				~ScAccessibilityEditSource();
183 
184 	virtual SvxEditSource*		Clone() const;
185 	virtual SvxTextForwarder*	GetTextForwarder();
186 	virtual SvxViewForwarder*	GetViewForwarder();
187 	virtual SvxEditViewForwarder*	GetEditViewForwarder( sal_Bool bCreate = sal_False );
188 	virtual void				UpdateData();
189 	virtual SfxBroadcaster&		GetBroadcaster() const;
190 };
191 
192 #endif
193 
194