xref: /aoo42x/main/sc/inc/editsrc.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_EDITSRC_HXX
25 #define SC_EDITSRC_HXX
26 
27 #include "address.hxx"
28 #include <editeng/unoedsrc.hxx>
29 #include <svl/lstner.hxx>
30 
31 #include <memory>
32 
33 class ScEditEngineDefaulter;
34 class SvxEditEngineForwarder;
35 
36 class ScDocShell;
37 class ScHeaderFooterContentObj;
38 class ScCellTextData;
39 class ScHeaderFooterTextData;
40 class ScAccessibleTextData;
41 class SdrObject;
42 
43 
44 class ScHeaderFooterChangedHint : public SfxHint
45 {
46 	sal_uInt16 nPart;
47 
48 public:
49 					TYPEINFO();
50 					ScHeaderFooterChangedHint(sal_uInt16 nP);
51 					~ScHeaderFooterChangedHint();
52 
GetPart() const53 	sal_uInt16			GetPart() const			{ return nPart; }
54 };
55 
56 
57 //	all ScSharedHeaderFooterEditSource objects for a single text share the same data
58 
59 class ScSharedHeaderFooterEditSource : public SvxEditSource
60 {
61 private:
62 	ScHeaderFooterTextData*		pTextData;
63 
64 protected:
GetTextData() const65 	ScHeaderFooterTextData*		GetTextData() const	{ return pTextData; }	// for ScHeaderFooterEditSource
66 
67 public:
68 								ScSharedHeaderFooterEditSource( ScHeaderFooterTextData* pData );
69 	virtual						~ScSharedHeaderFooterEditSource();
70 
71 	//	GetEditEngine is needed because the forwarder doesn't have field functions
72 	ScEditEngineDefaulter*		GetEditEngine();
73 
74 	virtual SvxEditSource*		Clone() const ;
75 	virtual SvxTextForwarder*	GetTextForwarder();
76 
77 	virtual void				UpdateData();
78 
79 };
80 
81 //	ScHeaderFooterEditSource with local copy of ScHeaderFooterTextData is used by field objects
82 
83 class ScHeaderFooterEditSource : public ScSharedHeaderFooterEditSource
84 {
85 public:
86 								ScHeaderFooterEditSource( ScHeaderFooterContentObj* pContent, sal_uInt16 nP );
87 								ScHeaderFooterEditSource( ScHeaderFooterContentObj& rContent, sal_uInt16 nP );
88 	virtual						~ScHeaderFooterEditSource();
89 
90 	virtual SvxEditSource*		Clone() const;
91 };
92 
93 
94 //	Data (incl. EditEngine) for cell EditSource is now shared in ScCellTextData
95 
96 class ScSharedCellEditSource : public SvxEditSource
97 {
98 private:
99 	ScCellTextData*			pCellTextData;
100 
101 protected:
GetCellTextData() const102 	ScCellTextData*			GetCellTextData() const	{ return pCellTextData; }	// for ScCellEditSource
103 
104 public:
105 								ScSharedCellEditSource( ScCellTextData* pData );
106 	virtual						~ScSharedCellEditSource();
107 
108 	//	GetEditEngine is needed because the forwarder doesn't have field functions
109 	ScEditEngineDefaulter*		GetEditEngine();
110 
111 	virtual SvxEditSource*		Clone() const;
112 	virtual SvxTextForwarder*	GetTextForwarder();
113 
114 	virtual void				UpdateData();
115 
116 	void						SetDoUpdateData(sal_Bool bValue);
117 	sal_Bool					IsDirty() const;
118 };
119 
120 //	ScCellEditSource with local copy of ScCellTextData is used by ScCellFieldsObj, ScCellFieldObj
121 
122 class ScCellEditSource : public ScSharedCellEditSource
123 {
124 public:
125 								ScCellEditSource( ScDocShell* pDocSh, const ScAddress& rP );
126 	virtual						~ScCellEditSource();
127 
128 	virtual SvxEditSource*		Clone() const;
129 };
130 
131 
132 class ScAnnotationEditSource : public SvxEditSource, public SfxListener
133 {
134 private:
135 	ScDocShell*				pDocShell;
136 	ScAddress				aCellPos;
137 	ScEditEngineDefaulter*  pEditEngine;
138 	SvxEditEngineForwarder*	pForwarder;
139 	sal_Bool					bDataValid;
140 
141     SdrObject*                  GetCaptionObj();
142 public:
143 								ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddress& rP);
144 	virtual						~ScAnnotationEditSource();
145 
146 	virtual SvxEditSource*		Clone() const ;
147 	virtual SvxTextForwarder*	GetTextForwarder();
148 	virtual void				UpdateData();
149 
150 	virtual void				Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
151 };
152 
153 
154 //	EditSource with a shared forwarder for all children of one text object
155 
156 class ScSimpleEditSource : public SvxEditSource
157 {
158 private:
159 	SvxTextForwarder*	pForwarder;
160 
161 public:
162 						ScSimpleEditSource( SvxTextForwarder* pForw );
163 	virtual				~ScSimpleEditSource();
164 
165 	virtual SvxEditSource*		Clone() const ;
166 	virtual SvxTextForwarder*	GetTextForwarder();
167 	virtual void				UpdateData();
168 
169 };
170 
171 class ScAccessibilityEditSource : public SvxEditSource
172 {
173 private:
174 	::std::auto_ptr < ScAccessibleTextData > mpAccessibleTextData;
175 
176 public:
177 						ScAccessibilityEditSource( ::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData );
178 	virtual				~ScAccessibilityEditSource();
179 
180 	virtual SvxEditSource*		Clone() const;
181 	virtual SvxTextForwarder*	GetTextForwarder();
182 	virtual SvxViewForwarder*	GetViewForwarder();
183 	virtual SvxEditViewForwarder*	GetEditViewForwarder( sal_Bool bCreate = sal_False );
184 	virtual void				UpdateData();
185 	virtual SfxBroadcaster&		GetBroadcaster() const;
186 };
187 
188 #endif
189 
190