xref: /aoo41x/main/svx/source/unodraw/unoshtxt.cxx (revision 4d7c9de0)
1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp>
27cdf0e10cSrcweir #include <vcl/svapp.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <svx/unoshtxt.hxx>
30cdf0e10cSrcweir #include <editeng/unoedhlp.hxx>
31cdf0e10cSrcweir #include <svl/lstner.hxx>
32cdf0e10cSrcweir #include <rtl/ref.hxx>
33cdf0e10cSrcweir #include <osl/mutex.hxx>
34cdf0e10cSrcweir #include <svl/hint.hxx>
35cdf0e10cSrcweir #include <svl/style.hxx>
36cdf0e10cSrcweir #include <svx/svdmodel.hxx>
37cdf0e10cSrcweir #include <svx/svdoutl.hxx>
38cdf0e10cSrcweir #include <svx/svdobj.hxx>
39cdf0e10cSrcweir #include <svx/svdview.hxx>
40cdf0e10cSrcweir #include <svx/svdetc.hxx>
41cdf0e10cSrcweir #include <editeng/outliner.hxx>
42cdf0e10cSrcweir #include <editeng/unoforou.hxx>
43cdf0e10cSrcweir #include <editeng/unoviwou.hxx>
44cdf0e10cSrcweir #include <editeng/outlobj.hxx>
45cdf0e10cSrcweir #include <svx/svdotext.hxx>
46cdf0e10cSrcweir #include <svx/svdpage.hxx>
47cdf0e10cSrcweir #include <editeng/editeng.hxx>
48cdf0e10cSrcweir #include <editeng/editobj.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir #include <editeng/unotext.hxx>
51cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
52cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
53cdf0e10cSrcweir #include <vos/mutex.hxx>
54*9b8096d0SSteve Yin 
55*9b8096d0SSteve Yin #include <svx/svdotable.hxx>
56*9b8096d0SSteve Yin #include <../table/cell.hxx>
57*9b8096d0SSteve Yin 
58cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir using namespace ::osl;
61cdf0e10cSrcweir using namespace ::vos;
62cdf0e10cSrcweir using namespace ::rtl;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir using ::com::sun::star::uno::XInterface;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir namespace css = ::com::sun::star;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir //------------------------------------------------------------------------
70cdf0e10cSrcweir // SvxTextEditSourceImpl
71cdf0e10cSrcweir //------------------------------------------------------------------------
72cdf0e10cSrcweir 
73cdf0e10cSrcweir /** @descr
74cdf0e10cSrcweir     <p>This class essentially provides the text and view forwarders. If
75cdf0e10cSrcweir     no SdrView is given, this class handles the UNO objects, which are
76cdf0e10cSrcweir     currently not concerned with view issues. In this case,
77cdf0e10cSrcweir     GetViewForwarder() always returns NULL and the underlying
78cdf0e10cSrcweir     EditEngine of the SvxTextForwarder is a background one (i.e. not
79cdf0e10cSrcweir     the official DrawOutliner, but one created exclusively for this
80cdf0e10cSrcweir     object, with no relation to a view).
81cdf0e10cSrcweir     </p>
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     <p>If a SdrView is given at construction time, the caller is
84cdf0e10cSrcweir     responsible for destroying this object when the view becomes
85cdf0e10cSrcweir     invalid (the views cannot notify). If GetViewForwarder(sal_True)
86cdf0e10cSrcweir     is called, the underlying shape is put into edit mode, the view
87cdf0e10cSrcweir     forwarder returned encapsulates the OutlinerView and the next call
88cdf0e10cSrcweir     to GetTextForwarder() yields a forwarder encapsulating the actual
89cdf0e10cSrcweir     DrawOutliner. Thus, changes on that Outliner are immediately
90cdf0e10cSrcweir     reflected on the screen. If the object leaves edit mode, the old
91cdf0e10cSrcweir     behaviour is restored.</p>
92cdf0e10cSrcweir  */
93cdf0e10cSrcweir class SvxTextEditSourceImpl : public SfxListener, public SfxBroadcaster, public sdr::ObjectUser
94cdf0e10cSrcweir {
95cdf0e10cSrcweir private:
96cdf0e10cSrcweir 	oslInterlockedCount	maRefCount;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	SdrObject*						mpObject;
99cdf0e10cSrcweir 	SdrText*						mpText;
100cdf0e10cSrcweir 	SdrView*						mpView;
101cdf0e10cSrcweir     const Window*					mpWindow;
102cdf0e10cSrcweir 	SdrModel*						mpModel;
103cdf0e10cSrcweir 	SdrOutliner*					mpOutliner;
104cdf0e10cSrcweir 	SvxOutlinerForwarder*			mpTextForwarder;
105cdf0e10cSrcweir 	SvxDrawOutlinerViewForwarder*	mpViewForwarder;	// if non-NULL, use GetViewModeTextForwarder text forwarder
106cdf0e10cSrcweir 	css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLinguServiceManager;
107cdf0e10cSrcweir     Point							maTextOffset;
108cdf0e10cSrcweir 	sal_Bool							mbDataValid;
109cdf0e10cSrcweir 	sal_Bool							mbDestroyed;
110cdf0e10cSrcweir 	sal_Bool							mbIsLocked;
111cdf0e10cSrcweir 	sal_Bool							mbNeedsUpdate;
112cdf0e10cSrcweir 	sal_Bool							mbOldUndoMode;
113cdf0e10cSrcweir     sal_Bool							mbForwarderIsEditMode;		// have to reflect that, since ENDEDIT can happen more often
114cdf0e10cSrcweir     sal_Bool							mbShapeIsEditMode;			// #104157# only true, if HINT_BEGEDIT was received
115cdf0e10cSrcweir     sal_Bool							mbNotificationsDisabled;	// prevent EditEngine/Outliner notifications (e.g. when setting up forwarder)
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	XInterface*						mpOwner;
118cdf0e10cSrcweir 	SvxUnoTextRangeBaseList			maTextRanges;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     SvxTextForwarder*				GetBackgroundTextForwarder();
121cdf0e10cSrcweir     SvxTextForwarder*				GetEditModeTextForwarder();
122cdf0e10cSrcweir     SvxDrawOutlinerViewForwarder*	CreateViewForwarder();
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     void 							SetupOutliner();
125cdf0e10cSrcweir 
HasView() const126cdf0e10cSrcweir     sal_Bool						HasView() const { return mpView ? sal_True : sal_False; }
IsEditMode() const127cdf0e10cSrcweir     sal_Bool						IsEditMode() const
128cdf0e10cSrcweir     								{
129cdf0e10cSrcweir                                         SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
130cdf0e10cSrcweir                                         return mbShapeIsEditMode && pTextObj && pTextObj->IsTextEditActive() ? sal_True : sal_False;
131cdf0e10cSrcweir                                     }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	void							dispose();
134cdf0e10cSrcweir 
135cdf0e10cSrcweir public:
136cdf0e10cSrcweir 	SvxTextEditSourceImpl( SdrObject* pObject, SdrText* pText, XInterface* pOwner );
137cdf0e10cSrcweir 	SvxTextEditSourceImpl( SdrObject& rObject, SdrText* pText, SdrView& rView, const Window& rWindow );
138cdf0e10cSrcweir 	~SvxTextEditSourceImpl();
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	void SAL_CALL acquire();
141cdf0e10cSrcweir 	void SAL_CALL release();
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	SvxEditSource*			Clone() const;
146cdf0e10cSrcweir 	SvxTextForwarder*		GetTextForwarder();
147cdf0e10cSrcweir     SvxEditViewForwarder* 	GetEditViewForwarder( sal_Bool );
148cdf0e10cSrcweir 	void					UpdateData();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	void addRange( SvxUnoTextRangeBase* pNewRange );
151cdf0e10cSrcweir 	void removeRange( SvxUnoTextRangeBase* pOldRange );
152cdf0e10cSrcweir 	const SvxUnoTextRangeBaseList& getRanges() const;
153cdf0e10cSrcweir 
GetSdrObject() const154cdf0e10cSrcweir 	SdrObject* 				GetSdrObject() const { return mpObject; }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	void 					lock();
157cdf0e10cSrcweir 	void 					unlock();
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	sal_Bool					IsValid() const;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     Rectangle				GetVisArea();
162cdf0e10cSrcweir     Point					LogicToPixel( const Point&, const MapMode& rMapMode );
163cdf0e10cSrcweir     Point 					PixelToLogic( const Point&, const MapMode& rMapMode );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     DECL_LINK( NotifyHdl, EENotify* );
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	virtual void ObjectInDestruction(const SdrObject& rObject);
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	void ChangeModel( SdrModel* pNewModel );
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     void                    UpdateOutliner();
172cdf0e10cSrcweir };
173cdf0e10cSrcweir 
174cdf0e10cSrcweir //------------------------------------------------------------------------
175cdf0e10cSrcweir 
SvxTextEditSourceImpl(SdrObject * pObject,SdrText * pText,XInterface * pOwner)176cdf0e10cSrcweir SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject* pObject, SdrText* pText, XInterface* pOwner )
177cdf0e10cSrcweir   :	maRefCount		( 0 ),
178cdf0e10cSrcweir     mpObject		( pObject ),
179cdf0e10cSrcweir 	mpText			( pText ),
180cdf0e10cSrcweir 	mpView			( NULL ),
181cdf0e10cSrcweir 	mpWindow		( NULL ),
182cdf0e10cSrcweir 	mpModel			( pObject ? pObject->GetModel() : NULL ),
183cdf0e10cSrcweir 	mpOutliner		( NULL ),
184cdf0e10cSrcweir 	mpTextForwarder	( NULL ),
185cdf0e10cSrcweir 	mpViewForwarder	( NULL ),
186cdf0e10cSrcweir 	mbDataValid		( sal_False ),
187cdf0e10cSrcweir 	mbDestroyed		( sal_False ),
188cdf0e10cSrcweir 	mbIsLocked		( sal_False ),
189cdf0e10cSrcweir 	mbNeedsUpdate	( sal_False ),
190cdf0e10cSrcweir 	mbOldUndoMode	( sal_False ),
191cdf0e10cSrcweir 	mbForwarderIsEditMode ( sal_False ),
192cdf0e10cSrcweir 	mbShapeIsEditMode	  ( sal_False ),
193cdf0e10cSrcweir 	mbNotificationsDisabled ( sal_False ),
194cdf0e10cSrcweir 	mpOwner( pOwner )
195cdf0e10cSrcweir {
196cdf0e10cSrcweir 	DBG_ASSERT( mpObject, "invalid pObject!" );
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 	if( !mpText )
199cdf0e10cSrcweir 	{
200cdf0e10cSrcweir 		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
201cdf0e10cSrcweir 		if( pTextObj )
202cdf0e10cSrcweir 			mpText = pTextObj->getText( 0 );
203cdf0e10cSrcweir 	}
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	if( mpModel )
206cdf0e10cSrcweir 		StartListening( *mpModel );
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 	if( mpObject )
209cdf0e10cSrcweir 		mpObject->AddObjectUser( *this );
210cdf0e10cSrcweir }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir //------------------------------------------------------------------------
213cdf0e10cSrcweir 
SvxTextEditSourceImpl(SdrObject & rObject,SdrText * pText,SdrView & rView,const Window & rWindow)214cdf0e10cSrcweir SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject& rObject, SdrText* pText, SdrView& rView, const Window& rWindow )
215cdf0e10cSrcweir   :	maRefCount		( 0 ),
216cdf0e10cSrcweir     mpObject		( &rObject ),
217cdf0e10cSrcweir 	mpText			( pText ),
218cdf0e10cSrcweir     mpView			( &rView ),
219cdf0e10cSrcweir     mpWindow		( &rWindow ),
220cdf0e10cSrcweir 	mpModel			( rObject.GetModel() ),
221cdf0e10cSrcweir 	mpOutliner		( NULL ),
222cdf0e10cSrcweir 	mpTextForwarder	( NULL ),
223cdf0e10cSrcweir 	mpViewForwarder	( NULL ),
224cdf0e10cSrcweir 	mbDataValid		( sal_False ),
225cdf0e10cSrcweir 	mbDestroyed		( sal_False ),
226cdf0e10cSrcweir 	mbIsLocked		( sal_False ),
227cdf0e10cSrcweir 	mbNeedsUpdate	( sal_False ),
228cdf0e10cSrcweir 	mbOldUndoMode	( sal_False ),
229cdf0e10cSrcweir 	mbForwarderIsEditMode ( sal_False ),
230cdf0e10cSrcweir     mbShapeIsEditMode	  ( sal_True ),
231cdf0e10cSrcweir 	mbNotificationsDisabled ( sal_False ),
232cdf0e10cSrcweir 	mpOwner(0)
233cdf0e10cSrcweir {
234cdf0e10cSrcweir 	if( !mpText )
235cdf0e10cSrcweir 	{
236cdf0e10cSrcweir 		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
237cdf0e10cSrcweir 		if( pTextObj )
238cdf0e10cSrcweir 			mpText = pTextObj->getText( 0 );
239cdf0e10cSrcweir 	}
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	if( mpModel )
242cdf0e10cSrcweir 		StartListening( *mpModel );
243cdf0e10cSrcweir 	if( mpView )
244cdf0e10cSrcweir 		StartListening( *mpView );
245cdf0e10cSrcweir 	if( mpObject )
246cdf0e10cSrcweir 		mpObject->AddObjectUser( *this );
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     // #104157# Init edit mode state from shape info (IsTextEditActive())
249cdf0e10cSrcweir     mbShapeIsEditMode = IsEditMode();
250cdf0e10cSrcweir }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir //------------------------------------------------------------------------
253cdf0e10cSrcweir 
~SvxTextEditSourceImpl()254cdf0e10cSrcweir SvxTextEditSourceImpl::~SvxTextEditSourceImpl()
255cdf0e10cSrcweir {
256cdf0e10cSrcweir 	DBG_ASSERT( mbIsLocked == sal_False, "text edit source was not unlocked before dispose!" );
257cdf0e10cSrcweir 	if( mpObject )
258cdf0e10cSrcweir 		mpObject->RemoveObjectUser( *this );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	dispose();
261cdf0e10cSrcweir }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir //------------------------------------------------------------------------
264cdf0e10cSrcweir 
addRange(SvxUnoTextRangeBase * pNewRange)265cdf0e10cSrcweir void SvxTextEditSourceImpl::addRange( SvxUnoTextRangeBase* pNewRange )
266cdf0e10cSrcweir {
267cdf0e10cSrcweir 	if( pNewRange )
268cdf0e10cSrcweir 		if( std::find( maTextRanges.begin(), maTextRanges.end(), pNewRange ) == maTextRanges.end() )
269cdf0e10cSrcweir 			maTextRanges.push_back( pNewRange );
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir //------------------------------------------------------------------------
273cdf0e10cSrcweir 
removeRange(SvxUnoTextRangeBase * pOldRange)274cdf0e10cSrcweir void SvxTextEditSourceImpl::removeRange( SvxUnoTextRangeBase* pOldRange )
275cdf0e10cSrcweir {
276cdf0e10cSrcweir 	if( pOldRange )
277cdf0e10cSrcweir 		maTextRanges.remove( pOldRange );
278cdf0e10cSrcweir }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir //------------------------------------------------------------------------
281cdf0e10cSrcweir 
getRanges() const282cdf0e10cSrcweir const SvxUnoTextRangeBaseList& SvxTextEditSourceImpl::getRanges() const
283cdf0e10cSrcweir {
284cdf0e10cSrcweir 	return maTextRanges;
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir //------------------------------------------------------------------------
288cdf0e10cSrcweir 
acquire()289cdf0e10cSrcweir void SAL_CALL SvxTextEditSourceImpl::acquire()
290cdf0e10cSrcweir {
291cdf0e10cSrcweir 	osl_incrementInterlockedCount( &maRefCount );
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir //------------------------------------------------------------------------
295cdf0e10cSrcweir 
release()296cdf0e10cSrcweir void SAL_CALL SvxTextEditSourceImpl::release()
297cdf0e10cSrcweir {
298cdf0e10cSrcweir 	if( ! osl_decrementInterlockedCount( &maRefCount ) )
299cdf0e10cSrcweir 		delete this;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
ChangeModel(SdrModel * pNewModel)302cdf0e10cSrcweir void SvxTextEditSourceImpl::ChangeModel( SdrModel* pNewModel )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir 	if( mpModel != pNewModel )
305cdf0e10cSrcweir 	{
306cdf0e10cSrcweir 		if( mpModel )
307cdf0e10cSrcweir 			EndListening( *mpModel );
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 		if( mpOutliner )
310cdf0e10cSrcweir 		{
311cdf0e10cSrcweir 			if( mpModel )
312cdf0e10cSrcweir 				mpModel->disposeOutliner( mpOutliner );
313cdf0e10cSrcweir 			else
314cdf0e10cSrcweir 				delete mpOutliner;
315cdf0e10cSrcweir 			mpOutliner = 0;
316cdf0e10cSrcweir 		}
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 		if( mpView )
319cdf0e10cSrcweir 		{
320cdf0e10cSrcweir 			EndListening( *mpView );
321cdf0e10cSrcweir 			mpView = 0;
322cdf0e10cSrcweir 		}
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 		mpWindow = 0;
325cdf0e10cSrcweir 		m_xLinguServiceManager.clear();
326cdf0e10cSrcweir 		mpOwner = 0;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 		mpModel = pNewModel;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 		if( mpTextForwarder )
331cdf0e10cSrcweir 		{
332cdf0e10cSrcweir 	        delete mpTextForwarder;
333cdf0e10cSrcweir 		    mpTextForwarder = 0;
334cdf0e10cSrcweir 		}
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 		if( mpViewForwarder )
337cdf0e10cSrcweir 		{
338cdf0e10cSrcweir 			delete mpViewForwarder;
339cdf0e10cSrcweir 			mpViewForwarder = 0;
340cdf0e10cSrcweir 		}
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 		if( mpModel )
343cdf0e10cSrcweir 			StartListening( *mpModel );
344cdf0e10cSrcweir 	}
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir //------------------------------------------------------------------------
348cdf0e10cSrcweir 
Notify(SfxBroadcaster &,const SfxHint & rHint)349cdf0e10cSrcweir void SvxTextEditSourceImpl::Notify( SfxBroadcaster&, const SfxHint& rHint )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir     // #i105988 keep reference to this object
352cdf0e10cSrcweir     rtl::Reference< SvxTextEditSourceImpl > xThis( this );
353cdf0e10cSrcweir 
354cdf0e10cSrcweir 	const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
355cdf0e10cSrcweir 	const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     if( pViewHint )
358cdf0e10cSrcweir     {
359cdf0e10cSrcweir         switch( pViewHint->GetHintType() )
360cdf0e10cSrcweir         {
361cdf0e10cSrcweir             case SvxViewHint::SVX_HINT_VIEWCHANGED:
362cdf0e10cSrcweir                 Broadcast( *pViewHint );
363cdf0e10cSrcweir                 break;
364cdf0e10cSrcweir         }
365cdf0e10cSrcweir     }
366cdf0e10cSrcweir 	else if( pSdrHint )
367cdf0e10cSrcweir 	{
368cdf0e10cSrcweir         switch( pSdrHint->GetKind() )
369cdf0e10cSrcweir         {
370cdf0e10cSrcweir             case HINT_OBJCHG:
371cdf0e10cSrcweir             {
372cdf0e10cSrcweir                 mbDataValid = sal_False;						// Text muss neu geholt werden
373cdf0e10cSrcweir 
374cdf0e10cSrcweir                 if( HasView() )
375cdf0e10cSrcweir                 {
376cdf0e10cSrcweir                     // #104157# Update maTextOffset, object has changed
377cdf0e10cSrcweir 					// #105196#, #105203#: Cannot call that // here,
378cdf0e10cSrcweir 					// since TakeTextRect() (called from there) //
379cdf0e10cSrcweir 					// changes outliner content.
380cdf0e10cSrcweir 					// UpdateOutliner();
381cdf0e10cSrcweir 
382cdf0e10cSrcweir                     // #101029# Broadcast object changes, as they might change visible attributes
383cdf0e10cSrcweir                     SvxViewHint aHint(SvxViewHint::SVX_HINT_VIEWCHANGED);
384cdf0e10cSrcweir                     Broadcast( aHint );
385cdf0e10cSrcweir                 }
386cdf0e10cSrcweir                 break;
387cdf0e10cSrcweir             }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir             case HINT_BEGEDIT:
390cdf0e10cSrcweir                 if( mpObject == pSdrHint->GetObject() )
391cdf0e10cSrcweir                 {
392*9b8096d0SSteve Yin 					//IAccessibility2 Implementation 2009-----, one EditSource object is created for each AccessibleCell, and it will monitor the hint.
393*9b8096d0SSteve Yin 					// Once HINT_BEGEDIT is broadcast, each EditSource of AccessibleCell will handle it here and
394*9b8096d0SSteve Yin 					// call below: mpView->GetTextEditOutliner()->SetNotifyHdl(), which will replace the Notifer for current
395*9b8096d0SSteve Yin 					// editable cell. It is totally wrong. So add check here to avoid the incorrect replacement of notifer.
396*9b8096d0SSteve Yin 					// To be safe, add accessibility check here because currently it only happen on the editsource of AccessibleCell
397*9b8096d0SSteve Yin 					if (Application::IsAccessibilityEnabled())
398*9b8096d0SSteve Yin 					{
399*9b8096d0SSteve Yin 						if (mpObject && mpText)
400*9b8096d0SSteve Yin 						{
401*9b8096d0SSteve Yin 							sdr::table::SdrTableObj* pTableObj = PTR_CAST( sdr::table::SdrTableObj, mpObject );
402*9b8096d0SSteve Yin 							if(pTableObj)
403*9b8096d0SSteve Yin 							{
404*9b8096d0SSteve Yin 								sdr::table::CellRef xCell = pTableObj->getActiveCell();
405*9b8096d0SSteve Yin 								if (xCell.is())
406*9b8096d0SSteve Yin 								{
407*9b8096d0SSteve Yin 									sdr::table::Cell* pCellObj = dynamic_cast< sdr::table::Cell* >( mpText );
408*9b8096d0SSteve Yin 									if (pCellObj && xCell.get() != pCellObj)
409*9b8096d0SSteve Yin 											break;
410*9b8096d0SSteve Yin 								}
411*9b8096d0SSteve Yin 							}
412*9b8096d0SSteve Yin 						}
413*9b8096d0SSteve Yin 					}
414cdf0e10cSrcweir                     // invalidate old forwarder
415cdf0e10cSrcweir                     if( !mbForwarderIsEditMode )
416cdf0e10cSrcweir                     {
417cdf0e10cSrcweir                         delete mpTextForwarder;
418cdf0e10cSrcweir                         mpTextForwarder = NULL;
419cdf0e10cSrcweir                     }
420cdf0e10cSrcweir 
421cdf0e10cSrcweir                     // register as listener - need to broadcast state change messages
422cdf0e10cSrcweir                     if( mpView && mpView->GetTextEditOutliner() )
423cdf0e10cSrcweir                         mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) );
424cdf0e10cSrcweir 
425cdf0e10cSrcweir                     // #104157# Only now we're really in edit mode
426cdf0e10cSrcweir                     mbShapeIsEditMode = sal_True;
427cdf0e10cSrcweir 
428cdf0e10cSrcweir                     Broadcast( *pSdrHint );
429cdf0e10cSrcweir                 }
430cdf0e10cSrcweir                 break;
431cdf0e10cSrcweir 
432cdf0e10cSrcweir             case HINT_ENDEDIT:
433cdf0e10cSrcweir                 if( mpObject == pSdrHint->GetObject() )
434cdf0e10cSrcweir                 {
435cdf0e10cSrcweir                     Broadcast( *pSdrHint );
436cdf0e10cSrcweir 
437cdf0e10cSrcweir                     // #104157# We're no longer in edit mode
438cdf0e10cSrcweir                     mbShapeIsEditMode = sal_False;
439cdf0e10cSrcweir 
440cdf0e10cSrcweir                     // remove as listener - outliner might outlive ourselves
441cdf0e10cSrcweir                     if( mpView && mpView->GetTextEditOutliner() )
442cdf0e10cSrcweir                         mpView->GetTextEditOutliner()->SetNotifyHdl( Link() );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir                     // destroy view forwarder, OutlinerView no longer
445cdf0e10cSrcweir                     // valid (no need for UpdateData(), it's been
446cdf0e10cSrcweir                     // synched on SdrEndTextEdit)
447cdf0e10cSrcweir                     delete mpViewForwarder;
448cdf0e10cSrcweir                     mpViewForwarder = NULL;
449cdf0e10cSrcweir 
450cdf0e10cSrcweir                     // #100424# Invalidate text forwarder, we might
451cdf0e10cSrcweir                     // not be called again before entering edit mode a
452cdf0e10cSrcweir                     // second time! Then, the old outliner might be
453cdf0e10cSrcweir                     // invalid.
454cdf0e10cSrcweir                     if( mbForwarderIsEditMode )
455cdf0e10cSrcweir                     {
456cdf0e10cSrcweir                         mbForwarderIsEditMode = sal_False;
457cdf0e10cSrcweir                         delete mpTextForwarder;
458cdf0e10cSrcweir                         mpTextForwarder = NULL;
459cdf0e10cSrcweir                     }
460cdf0e10cSrcweir                 }
461cdf0e10cSrcweir                 break;
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 			case HINT_MODELCLEARED:
464cdf0e10cSrcweir 				dispose();
465cdf0e10cSrcweir 				break;
466cdf0e10cSrcweir 			default:
467cdf0e10cSrcweir 				break;
468cdf0e10cSrcweir         }
469cdf0e10cSrcweir     }
470cdf0e10cSrcweir }
471cdf0e10cSrcweir 
472cdf0e10cSrcweir /* this is a callback from the attached SdrObject when it is actually deleted */
ObjectInDestruction(const SdrObject &)473cdf0e10cSrcweir void SvxTextEditSourceImpl::ObjectInDestruction(const SdrObject&)
474cdf0e10cSrcweir {
475cdf0e10cSrcweir 	mpObject = 0;
476cdf0e10cSrcweir 	dispose();
477cdf0e10cSrcweir     Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
478cdf0e10cSrcweir }
479cdf0e10cSrcweir 
480cdf0e10cSrcweir /* unregister at all objects and set all references to 0 */
dispose()481cdf0e10cSrcweir void SvxTextEditSourceImpl::dispose()
482cdf0e10cSrcweir {
483cdf0e10cSrcweir 	if( mpTextForwarder )
484cdf0e10cSrcweir 	{
485cdf0e10cSrcweir 	    delete mpTextForwarder;
486cdf0e10cSrcweir 		mpTextForwarder = 0;
487cdf0e10cSrcweir 	}
488cdf0e10cSrcweir 
489cdf0e10cSrcweir 	if( mpViewForwarder )
490cdf0e10cSrcweir 	{
491cdf0e10cSrcweir 	    delete mpViewForwarder;
492cdf0e10cSrcweir 		mpViewForwarder = 0;
493cdf0e10cSrcweir 	}
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 	if( mpOutliner )
496cdf0e10cSrcweir 	{
497cdf0e10cSrcweir 		if( mpModel )
498cdf0e10cSrcweir 		{
499cdf0e10cSrcweir 			mpModel->disposeOutliner( mpOutliner );
500cdf0e10cSrcweir 		}
501cdf0e10cSrcweir 		else
502cdf0e10cSrcweir 		{
503cdf0e10cSrcweir 			delete mpOutliner;
504cdf0e10cSrcweir 		}
505cdf0e10cSrcweir 		mpOutliner = 0;
506cdf0e10cSrcweir 	}
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 	if( mpModel )
509cdf0e10cSrcweir 	{
510cdf0e10cSrcweir 		EndListening( *mpModel );
511cdf0e10cSrcweir 		mpModel = 0;
512cdf0e10cSrcweir 	}
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 	if( mpView )
515cdf0e10cSrcweir 	{
516cdf0e10cSrcweir 		EndListening( *mpView );
517cdf0e10cSrcweir         mpView = 0;
518cdf0e10cSrcweir 	}
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 	if( mpObject )
521cdf0e10cSrcweir 	{
522cdf0e10cSrcweir 		mpObject->RemoveObjectUser( *this );
523cdf0e10cSrcweir 		mpObject = 0;
524cdf0e10cSrcweir 	}
525cdf0e10cSrcweir 	mpWindow = 0;
526cdf0e10cSrcweir }
527cdf0e10cSrcweir 
528cdf0e10cSrcweir //------------------------------------------------------------------------
529cdf0e10cSrcweir 
SetupOutliner()530cdf0e10cSrcweir void SvxTextEditSourceImpl::SetupOutliner()
531cdf0e10cSrcweir {
532cdf0e10cSrcweir     // #101029#
533cdf0e10cSrcweir     // only for UAA edit source: setup outliner equivalently as in
534cdf0e10cSrcweir     // SdrTextObj::Paint(), such that formatting equals screen
535cdf0e10cSrcweir     // layout
536cdf0e10cSrcweir     if( mpObject && mpOutliner )
537cdf0e10cSrcweir     {
538cdf0e10cSrcweir         SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
539cdf0e10cSrcweir         Rectangle aPaintRect;
540cdf0e10cSrcweir         if( pTextObj )
541cdf0e10cSrcweir         {
542cdf0e10cSrcweir             Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
543cdf0e10cSrcweir             pTextObj->SetupOutlinerFormatting( *mpOutliner, aPaintRect );
544cdf0e10cSrcweir 
545cdf0e10cSrcweir             // #101029# calc text offset from shape anchor
546cdf0e10cSrcweir             maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft();
547cdf0e10cSrcweir         }
548cdf0e10cSrcweir     }
549cdf0e10cSrcweir }
550cdf0e10cSrcweir 
551cdf0e10cSrcweir //------------------------------------------------------------------------
552cdf0e10cSrcweir 
UpdateOutliner()553cdf0e10cSrcweir void SvxTextEditSourceImpl::UpdateOutliner()
554cdf0e10cSrcweir {
555cdf0e10cSrcweir     // #104157#
556cdf0e10cSrcweir     // only for UAA edit source: update outliner equivalently as in
557cdf0e10cSrcweir     // SdrTextObj::Paint(), such that formatting equals screen
558cdf0e10cSrcweir     // layout
559cdf0e10cSrcweir     if( mpObject && mpOutliner )
560cdf0e10cSrcweir     {
561cdf0e10cSrcweir         SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
562cdf0e10cSrcweir         Rectangle aPaintRect;
563cdf0e10cSrcweir         if( pTextObj )
564cdf0e10cSrcweir         {
565cdf0e10cSrcweir             Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
566cdf0e10cSrcweir             pTextObj->UpdateOutlinerFormatting( *mpOutliner, aPaintRect );
567cdf0e10cSrcweir 
568cdf0e10cSrcweir             // #101029# calc text offset from shape anchor
569cdf0e10cSrcweir             maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft();
570cdf0e10cSrcweir         }
571cdf0e10cSrcweir     }
572cdf0e10cSrcweir }
573cdf0e10cSrcweir 
574cdf0e10cSrcweir //------------------------------------------------------------------------
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 
GetBackgroundTextForwarder()578cdf0e10cSrcweir SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
579cdf0e10cSrcweir {
580cdf0e10cSrcweir     sal_Bool bCreated = sal_False;
581cdf0e10cSrcweir 
582cdf0e10cSrcweir     // #99840#: prevent EE/Outliner notifications during setup
583cdf0e10cSrcweir     mbNotificationsDisabled = sal_True;
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 	if (!mpTextForwarder)
586cdf0e10cSrcweir 	{
587cdf0e10cSrcweir 		if( mpOutliner == NULL )
588cdf0e10cSrcweir 		{
589cdf0e10cSrcweir 			SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
590cdf0e10cSrcweir 			sal_uInt16 nOutlMode = OUTLINERMODE_TEXTOBJECT;
591cdf0e10cSrcweir 			if( pTextObj && pTextObj->IsTextFrame() && pTextObj->GetTextKind() == OBJ_OUTLINETEXT )
592cdf0e10cSrcweir 				nOutlMode = OUTLINERMODE_OUTLINEOBJECT;
593cdf0e10cSrcweir 
594cdf0e10cSrcweir 			mpOutliner = mpModel->createOutliner( nOutlMode );
595cdf0e10cSrcweir 
596cdf0e10cSrcweir             // #109151# Do the setup after outliner creation, would be useless otherwise
597cdf0e10cSrcweir             if( HasView() )
598cdf0e10cSrcweir             {
599cdf0e10cSrcweir                 // #101029#, #104157# Setup outliner _before_ filling it
600cdf0e10cSrcweir                 SetupOutliner();
601cdf0e10cSrcweir             }
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 			mpOutliner->SetTextObjNoInit( pTextObj );
604cdf0e10cSrcweir /*
605cdf0e10cSrcweir 			mpOutliner = SdrMakeOutliner( nOutlMode, pModel );
606cdf0e10cSrcweir 			Outliner& aDrawOutliner = pModel->GetDrawOutliner();
607cdf0e10cSrcweir 			mpOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() );
608cdf0e10cSrcweir */
609cdf0e10cSrcweir 			if( mbIsLocked )
610cdf0e10cSrcweir 			{
611cdf0e10cSrcweir 				((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False );
612cdf0e10cSrcweir 				mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled();
613cdf0e10cSrcweir 				((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False );
614cdf0e10cSrcweir 			}
615cdf0e10cSrcweir 
616cdf0e10cSrcweir // -
617cdf0e10cSrcweir 			if ( !m_xLinguServiceManager.is() )
618cdf0e10cSrcweir 			{
619cdf0e10cSrcweir 				css::uno::Reference< css::lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
620cdf0e10cSrcweir 				m_xLinguServiceManager = css::uno::Reference< css::linguistic2::XLinguServiceManager >(
621cdf0e10cSrcweir 					xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.linguistic2.LinguServiceManager" ))), css::uno::UNO_QUERY );
622cdf0e10cSrcweir 			}
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 			if ( m_xLinguServiceManager.is() )
625cdf0e10cSrcweir 			{
626cdf0e10cSrcweir 				css::uno::Reference< css::linguistic2::XHyphenator > xHyphenator( m_xLinguServiceManager->getHyphenator(), css::uno::UNO_QUERY );
627cdf0e10cSrcweir 				if( xHyphenator.is() )
628cdf0e10cSrcweir 					mpOutliner->SetHyphenator( xHyphenator );
629cdf0e10cSrcweir 			}
630cdf0e10cSrcweir // -
631cdf0e10cSrcweir 		}
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 		mpTextForwarder = new SvxOutlinerForwarder( *mpOutliner, (mpObject->GetObjInventor() == SdrInventor) && (mpObject->GetObjIdentifier() == OBJ_OUTLINETEXT) );
635cdf0e10cSrcweir         // delay listener subscription and UAA initialization until Outliner is fully setup
636cdf0e10cSrcweir         bCreated = sal_True;
637cdf0e10cSrcweir 
638cdf0e10cSrcweir         mbForwarderIsEditMode = sal_False;
639cdf0e10cSrcweir 	}
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 	if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->GetPage() )
642cdf0e10cSrcweir 	{
643cdf0e10cSrcweir 		mpTextForwarder->flushCache();
644cdf0e10cSrcweir 
645cdf0e10cSrcweir 		OutlinerParaObject* pOutlinerParaObject = NULL;
646cdf0e10cSrcweir 		SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
647cdf0e10cSrcweir 		if( pTextObj && pTextObj->getActiveText() == mpText )
648cdf0e10cSrcweir 			pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
649cdf0e10cSrcweir 		bool bOwnParaObj(false);
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 		if( pOutlinerParaObject )
652cdf0e10cSrcweir 			bOwnParaObj = true;	// text edit active
653cdf0e10cSrcweir 		else
654cdf0e10cSrcweir 			pOutlinerParaObject = mpText->GetOutlinerParaObject();
655cdf0e10cSrcweir 
656cdf0e10cSrcweir 		if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) )
657cdf0e10cSrcweir 		{
658cdf0e10cSrcweir 			mpOutliner->SetText( *pOutlinerParaObject );
659cdf0e10cSrcweir 
660cdf0e10cSrcweir 			// #91254# put text to object and set EmptyPresObj to FALSE
661cdf0e10cSrcweir 			if( mpText && bOwnParaObj && pOutlinerParaObject && mpObject->IsEmptyPresObj() && pTextObj->IsRealyEdited() )
662cdf0e10cSrcweir 			{
663cdf0e10cSrcweir 				mpObject->SetEmptyPresObj( sal_False );
664cdf0e10cSrcweir 				static_cast< SdrTextObj* >( mpObject)->NbcSetOutlinerParaObjectForText( pOutlinerParaObject, mpText );
665cdf0e10cSrcweir 
666cdf0e10cSrcweir                 // #i103982# Here, due to mpObject->NbcSetOutlinerParaObjectForText, we LOSE ownership of the
667cdf0e10cSrcweir                 // OPO, so do NOT delete it when leaving this method (!)
668cdf0e10cSrcweir                 bOwnParaObj = false;
669cdf0e10cSrcweir 			}
670cdf0e10cSrcweir 		}
671cdf0e10cSrcweir 		else
672cdf0e10cSrcweir 		{
673cdf0e10cSrcweir 			sal_Bool bVertical = pOutlinerParaObject ? pOutlinerParaObject->IsVertical() : sal_False;
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 			// set objects style sheet on empty outliner
676cdf0e10cSrcweir 			SfxStyleSheetPool* pPool = (SfxStyleSheetPool*)mpObject->GetModel()->GetStyleSheetPool();
677cdf0e10cSrcweir 			if( pPool )
678cdf0e10cSrcweir 				mpOutliner->SetStyleSheetPool( pPool );
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 			SfxStyleSheet* pStyleSheet = mpObject->GetPage()->GetTextStyleSheetForObject( mpObject );
681cdf0e10cSrcweir 			if( pStyleSheet )
682cdf0e10cSrcweir 				mpOutliner->SetStyleSheet( 0, pStyleSheet );
683cdf0e10cSrcweir 
684cdf0e10cSrcweir 			if( bVertical )
685cdf0e10cSrcweir 				mpOutliner->SetVertical( sal_True );
686cdf0e10cSrcweir 		}
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 		// evtually we have to set the border attributes
689cdf0e10cSrcweir 		if (mpOutliner->GetParagraphCount()==1)
690cdf0e10cSrcweir 		{
691cdf0e10cSrcweir 			// if we only have one paragraph we check if it is empty
692cdf0e10cSrcweir 			XubString aStr( mpOutliner->GetText( mpOutliner->GetParagraph( 0 ) ) );
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 			if(!aStr.Len())
695cdf0e10cSrcweir 			{
696cdf0e10cSrcweir 				// its empty, so we have to force the outliner to initialise itself
697cdf0e10cSrcweir 				mpOutliner->SetText( String(), mpOutliner->GetParagraph( 0 ) );
698cdf0e10cSrcweir 
699cdf0e10cSrcweir 				if(mpObject->GetStyleSheet())
700cdf0e10cSrcweir 					mpOutliner->SetStyleSheet( 0, mpObject->GetStyleSheet());
701cdf0e10cSrcweir 			}
702cdf0e10cSrcweir 		}
703cdf0e10cSrcweir 
704cdf0e10cSrcweir 		mbDataValid = sal_True;
705cdf0e10cSrcweir 
706cdf0e10cSrcweir         if( bOwnParaObj )
707cdf0e10cSrcweir             delete pOutlinerParaObject;
708cdf0e10cSrcweir 	}
709cdf0e10cSrcweir 
710cdf0e10cSrcweir     if( bCreated && mpOutliner && HasView() )
711cdf0e10cSrcweir     {
712cdf0e10cSrcweir         // register as listener - need to broadcast state change messages
713cdf0e10cSrcweir         // registration delayed until outliner is completely set up
714cdf0e10cSrcweir         mpOutliner->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) );
715cdf0e10cSrcweir     }
716cdf0e10cSrcweir 
717cdf0e10cSrcweir     // #99840#: prevent EE/Outliner notifications during setup
718cdf0e10cSrcweir     mbNotificationsDisabled = sal_False;
719cdf0e10cSrcweir 
720cdf0e10cSrcweir 	return mpTextForwarder;
721cdf0e10cSrcweir }
722cdf0e10cSrcweir 
723cdf0e10cSrcweir //------------------------------------------------------------------------
724cdf0e10cSrcweir 
GetEditModeTextForwarder()725cdf0e10cSrcweir SvxTextForwarder* SvxTextEditSourceImpl::GetEditModeTextForwarder()
726cdf0e10cSrcweir {
727cdf0e10cSrcweir     if( !mpTextForwarder && HasView() )
728cdf0e10cSrcweir     {
729cdf0e10cSrcweir         SdrOutliner* pEditOutliner = mpView->GetTextEditOutliner();
730cdf0e10cSrcweir 
731cdf0e10cSrcweir         if( pEditOutliner )
732cdf0e10cSrcweir         {
733cdf0e10cSrcweir 			mpTextForwarder = new SvxOutlinerForwarder( *pEditOutliner, (mpObject->GetObjInventor() == SdrInventor) && (mpObject->GetObjIdentifier() == OBJ_OUTLINETEXT) );
734cdf0e10cSrcweir             mbForwarderIsEditMode = sal_True;
735cdf0e10cSrcweir         }
736cdf0e10cSrcweir     }
737cdf0e10cSrcweir 
738cdf0e10cSrcweir     return mpTextForwarder;
739cdf0e10cSrcweir }
740cdf0e10cSrcweir 
741cdf0e10cSrcweir //------------------------------------------------------------------------
742cdf0e10cSrcweir 
GetTextForwarder()743cdf0e10cSrcweir SvxTextForwarder* SvxTextEditSourceImpl::GetTextForwarder()
744cdf0e10cSrcweir {
745cdf0e10cSrcweir 	if( mbDestroyed || mpObject == NULL )
746cdf0e10cSrcweir 		return NULL;
747cdf0e10cSrcweir 
748cdf0e10cSrcweir 	if( mpModel == NULL )
749cdf0e10cSrcweir 		mpModel = mpObject->GetModel();
750cdf0e10cSrcweir 
751cdf0e10cSrcweir 	if( mpModel == NULL )
752cdf0e10cSrcweir 		return NULL;
753cdf0e10cSrcweir 
754cdf0e10cSrcweir     // distinguish the cases
755cdf0e10cSrcweir     // a) connected to view, maybe edit mode is active, can work directly on the EditOutliner
756cdf0e10cSrcweir     // b) background Outliner, reflect changes into ParaOutlinerObject (this is exactly the old UNO code)
757cdf0e10cSrcweir     if( HasView() )
758cdf0e10cSrcweir     {
759cdf0e10cSrcweir         if( IsEditMode() != mbForwarderIsEditMode )
760cdf0e10cSrcweir         {
761cdf0e10cSrcweir             // forwarder mismatch - create new
762cdf0e10cSrcweir             delete mpTextForwarder;
763cdf0e10cSrcweir             mpTextForwarder = NULL;
764cdf0e10cSrcweir         }
765cdf0e10cSrcweir 
766cdf0e10cSrcweir         if( IsEditMode() )
767cdf0e10cSrcweir             return GetEditModeTextForwarder();
768cdf0e10cSrcweir         else
769cdf0e10cSrcweir             return GetBackgroundTextForwarder();
770cdf0e10cSrcweir     }
771cdf0e10cSrcweir     else
772cdf0e10cSrcweir         return GetBackgroundTextForwarder();
773cdf0e10cSrcweir }
774cdf0e10cSrcweir 
775cdf0e10cSrcweir //------------------------------------------------------------------------
776cdf0e10cSrcweir 
CreateViewForwarder()777cdf0e10cSrcweir SvxDrawOutlinerViewForwarder* SvxTextEditSourceImpl::CreateViewForwarder()
778cdf0e10cSrcweir {
779cdf0e10cSrcweir     if( mpView->GetTextEditOutlinerView() && mpObject )
780cdf0e10cSrcweir     {
781cdf0e10cSrcweir         // register as listener - need to broadcast state change messages
782cdf0e10cSrcweir         mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) );
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 		SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
785cdf0e10cSrcweir 		if( pTextObj )
786cdf0e10cSrcweir         {
787cdf0e10cSrcweir             Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
788cdf0e10cSrcweir             OutlinerView& rOutlView = *mpView->GetTextEditOutlinerView();
789cdf0e10cSrcweir 
790cdf0e10cSrcweir             return new SvxDrawOutlinerViewForwarder( rOutlView, aBoundRect.TopLeft() );
791cdf0e10cSrcweir         }
792cdf0e10cSrcweir     }
793cdf0e10cSrcweir 
794cdf0e10cSrcweir     return NULL;
795cdf0e10cSrcweir }
796cdf0e10cSrcweir 
GetEditViewForwarder(sal_Bool bCreate)797cdf0e10cSrcweir SvxEditViewForwarder* SvxTextEditSourceImpl::GetEditViewForwarder( sal_Bool bCreate )
798cdf0e10cSrcweir {
799cdf0e10cSrcweir 	if( mbDestroyed || mpObject == NULL )
800cdf0e10cSrcweir 		return NULL;
801cdf0e10cSrcweir 
802cdf0e10cSrcweir 	if( mpModel == NULL )
803cdf0e10cSrcweir 		mpModel = mpObject->GetModel();
804cdf0e10cSrcweir 
805cdf0e10cSrcweir 	if( mpModel == NULL )
806cdf0e10cSrcweir 		return NULL;
807cdf0e10cSrcweir 
808cdf0e10cSrcweir     // shall we delete?
809cdf0e10cSrcweir     if( mpViewForwarder )
810cdf0e10cSrcweir     {
811cdf0e10cSrcweir         if( !IsEditMode() )
812cdf0e10cSrcweir         {
813cdf0e10cSrcweir             // destroy all forwarders (no need for UpdateData(),
814cdf0e10cSrcweir             // it's been synched on SdrEndTextEdit)
815cdf0e10cSrcweir 			delete mpViewForwarder;
816cdf0e10cSrcweir 			mpViewForwarder = NULL;
817cdf0e10cSrcweir         }
818cdf0e10cSrcweir     }
819cdf0e10cSrcweir     // which to create? Directly in edit mode, create new, or none?
820cdf0e10cSrcweir     else if( mpView )
821cdf0e10cSrcweir     {
822cdf0e10cSrcweir         if( IsEditMode() )
823cdf0e10cSrcweir         {
824cdf0e10cSrcweir             // create new view forwarder
825cdf0e10cSrcweir             mpViewForwarder = CreateViewForwarder();
826cdf0e10cSrcweir         }
827cdf0e10cSrcweir         else if( bCreate )
828cdf0e10cSrcweir         {
829cdf0e10cSrcweir             // dispose old text forwarder
830cdf0e10cSrcweir             UpdateData();
831cdf0e10cSrcweir 
832cdf0e10cSrcweir             delete mpTextForwarder;
833cdf0e10cSrcweir             mpTextForwarder = NULL;
834cdf0e10cSrcweir 
835cdf0e10cSrcweir             // enter edit mode
836cdf0e10cSrcweir             mpView->SdrEndTextEdit();
837cdf0e10cSrcweir 
838cdf0e10cSrcweir 			if(mpView->SdrBeginTextEdit(mpObject, 0L, 0L, sal_False, (SdrOutliner*)0L, 0L, sal_False, sal_False))
839cdf0e10cSrcweir             {
840cdf0e10cSrcweir                 SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
841cdf0e10cSrcweir                 if( pTextObj->IsTextEditActive() )
842cdf0e10cSrcweir                 {
843cdf0e10cSrcweir                     // create new view forwarder
844cdf0e10cSrcweir                     mpViewForwarder = CreateViewForwarder();
845cdf0e10cSrcweir                 }
846cdf0e10cSrcweir                 else
847cdf0e10cSrcweir                 {
848cdf0e10cSrcweir                     // failure. Somehow, SdrBeginTextEdit did not set
849cdf0e10cSrcweir                     // our SdrTextObj into edit mode
850cdf0e10cSrcweir                     mpView->SdrEndTextEdit();
851cdf0e10cSrcweir                 }
852cdf0e10cSrcweir             }
853cdf0e10cSrcweir         }
854cdf0e10cSrcweir     }
855cdf0e10cSrcweir 
856cdf0e10cSrcweir 	return mpViewForwarder;
857cdf0e10cSrcweir }
858cdf0e10cSrcweir 
859cdf0e10cSrcweir //------------------------------------------------------------------------
860cdf0e10cSrcweir 
UpdateData()861cdf0e10cSrcweir void SvxTextEditSourceImpl::UpdateData()
862cdf0e10cSrcweir {
863cdf0e10cSrcweir     // if we have a view and in edit mode, we're working with the
864cdf0e10cSrcweir     // DrawOutliner. Thus, all changes made on the text forwarder are
865cdf0e10cSrcweir     // reflected on the view and committed to the model on
866cdf0e10cSrcweir     // SdrEndTextEdit(). Thus, no need for explicit updates here.
867cdf0e10cSrcweir     if( !HasView() || !IsEditMode() )
868cdf0e10cSrcweir     {
869cdf0e10cSrcweir         if( mbIsLocked  )
870cdf0e10cSrcweir         {
871cdf0e10cSrcweir             mbNeedsUpdate = sal_True;
872cdf0e10cSrcweir         }
873cdf0e10cSrcweir         else
874cdf0e10cSrcweir         {
875cdf0e10cSrcweir             if( mpOutliner && mpObject && mpText && !mbDestroyed )
876cdf0e10cSrcweir             {
877cdf0e10cSrcweir                 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
878cdf0e10cSrcweir                 if( pTextObj )
879cdf0e10cSrcweir                 {
880cdf0e10cSrcweir                     if( mpOutliner->GetParagraphCount() != 1 || mpOutliner->GetEditEngine().GetTextLen( 0 ) )
881cdf0e10cSrcweir 				    {
882cdf0e10cSrcweir 					    if( mpOutliner->GetParagraphCount() > 1 )
883cdf0e10cSrcweir 					    {
884cdf0e10cSrcweir 						    if( pTextObj && pTextObj->IsTextFrame() && pTextObj->GetTextKind() == OBJ_TITLETEXT )
885cdf0e10cSrcweir 						    {
886cdf0e10cSrcweir 							    while( mpOutliner->GetParagraphCount() > 1 )
887cdf0e10cSrcweir 							    {
888cdf0e10cSrcweir 								    ESelection aSel( 0,mpOutliner->GetEditEngine().GetTextLen( 0 ), 1,0 );
889cdf0e10cSrcweir 								    mpOutliner->QuickInsertLineBreak( aSel );
890cdf0e10cSrcweir 							    }
891cdf0e10cSrcweir 						    }
892cdf0e10cSrcweir 					    }
893cdf0e10cSrcweir 
894cdf0e10cSrcweir                         pTextObj->NbcSetOutlinerParaObjectForText( mpOutliner->CreateParaObject(), mpText );
895cdf0e10cSrcweir 				    }
896cdf0e10cSrcweir                     else
897cdf0e10cSrcweir                     {
898cdf0e10cSrcweir                         pTextObj->NbcSetOutlinerParaObjectForText( NULL,mpText );
899cdf0e10cSrcweir                     }
900cdf0e10cSrcweir                 }
901cdf0e10cSrcweir 
902cdf0e10cSrcweir                 if( mpObject->IsEmptyPresObj() )
903cdf0e10cSrcweir                     mpObject->SetEmptyPresObj(sal_False);
904cdf0e10cSrcweir             }
905cdf0e10cSrcweir         }
906cdf0e10cSrcweir     }
907cdf0e10cSrcweir }
908cdf0e10cSrcweir 
lock()909cdf0e10cSrcweir void SvxTextEditSourceImpl::lock()
910cdf0e10cSrcweir {
911cdf0e10cSrcweir 	mbIsLocked = sal_True;
912cdf0e10cSrcweir 	if( mpOutliner )
913cdf0e10cSrcweir 	{
914cdf0e10cSrcweir 		((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False );
915cdf0e10cSrcweir 		mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled();
916cdf0e10cSrcweir 		((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False );
917cdf0e10cSrcweir 	}
918cdf0e10cSrcweir }
919cdf0e10cSrcweir 
unlock()920cdf0e10cSrcweir void SvxTextEditSourceImpl::unlock()
921cdf0e10cSrcweir {
922cdf0e10cSrcweir 	mbIsLocked = sal_False;
923cdf0e10cSrcweir 
924cdf0e10cSrcweir 	if( mbNeedsUpdate )
925cdf0e10cSrcweir 	{
926cdf0e10cSrcweir 		UpdateData();
927cdf0e10cSrcweir 		mbNeedsUpdate = sal_False;
928cdf0e10cSrcweir 	}
929cdf0e10cSrcweir 
930cdf0e10cSrcweir 	if( mpOutliner )
931cdf0e10cSrcweir 	{
932cdf0e10cSrcweir 		((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_True );
933cdf0e10cSrcweir 		((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( mbOldUndoMode );
934cdf0e10cSrcweir 	}
935cdf0e10cSrcweir }
936cdf0e10cSrcweir 
IsValid() const937cdf0e10cSrcweir sal_Bool SvxTextEditSourceImpl::IsValid() const
938cdf0e10cSrcweir {
939cdf0e10cSrcweir     return mpView && mpWindow ? sal_True : sal_False;
940cdf0e10cSrcweir }
941cdf0e10cSrcweir 
GetVisArea()942cdf0e10cSrcweir Rectangle SvxTextEditSourceImpl::GetVisArea()
943cdf0e10cSrcweir {
944cdf0e10cSrcweir     if( IsValid() )
945cdf0e10cSrcweir     {
946cdf0e10cSrcweir 		SdrPaintWindow* pPaintWindow = mpView->FindPaintWindow(*mpWindow);
947cdf0e10cSrcweir 		Rectangle aVisArea;
948cdf0e10cSrcweir 
949cdf0e10cSrcweir 		if(pPaintWindow)
950cdf0e10cSrcweir 		{
951cdf0e10cSrcweir 			aVisArea = pPaintWindow->GetVisibleArea();
952cdf0e10cSrcweir 		}
953cdf0e10cSrcweir 
954cdf0e10cSrcweir         // offset vis area by edit engine left-top position
955cdf0e10cSrcweir         SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
956cdf0e10cSrcweir         if( pTextObj )
957cdf0e10cSrcweir         {
958cdf0e10cSrcweir             Rectangle aAnchorRect;
959cdf0e10cSrcweir             pTextObj->TakeTextAnchorRect( aAnchorRect );
960cdf0e10cSrcweir             aVisArea.Move( -aAnchorRect.Left(), -aAnchorRect.Top() );
961cdf0e10cSrcweir 
962cdf0e10cSrcweir             MapMode aMapMode(mpWindow->GetMapMode());
963cdf0e10cSrcweir             aMapMode.SetOrigin(Point());
964cdf0e10cSrcweir             return mpWindow->LogicToPixel( aVisArea, aMapMode );
965cdf0e10cSrcweir         }
966cdf0e10cSrcweir     }
967cdf0e10cSrcweir 
968cdf0e10cSrcweir     return Rectangle();
969cdf0e10cSrcweir }
970cdf0e10cSrcweir 
LogicToPixel(const Point & rPoint,const MapMode & rMapMode)971cdf0e10cSrcweir Point SvxTextEditSourceImpl::LogicToPixel( const Point& rPoint, const MapMode& rMapMode )
972cdf0e10cSrcweir {
973cdf0e10cSrcweir     // #101029#: The responsibilities of ViewForwarder happen to be
974cdf0e10cSrcweir     // somewhat mixed in this case. On the one hand, we need the
975cdf0e10cSrcweir     // different interface queries on the SvxEditSource interface,
976cdf0e10cSrcweir     // since we need both VisAreas. On the other hand, if an
977cdf0e10cSrcweir     // EditViewForwarder exists, maTextOffset does not remain static,
978cdf0e10cSrcweir     // but may change with every key press.
979cdf0e10cSrcweir     if( IsEditMode() )
980cdf0e10cSrcweir     {
981cdf0e10cSrcweir         SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False);
982cdf0e10cSrcweir 
983cdf0e10cSrcweir         if( pForwarder )
984cdf0e10cSrcweir             return pForwarder->LogicToPixel( rPoint, rMapMode );
985cdf0e10cSrcweir     }
986cdf0e10cSrcweir     else if( IsValid() && mpModel )
987cdf0e10cSrcweir     {
988cdf0e10cSrcweir         // #101029#
989cdf0e10cSrcweir         Point aPoint1( rPoint );
990cdf0e10cSrcweir         aPoint1.X() += maTextOffset.X();
991cdf0e10cSrcweir         aPoint1.Y() += maTextOffset.Y();
992cdf0e10cSrcweir 
993cdf0e10cSrcweir         Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode,
994cdf0e10cSrcweir                                                    MapMode(mpModel->GetScaleUnit()) ) );
995cdf0e10cSrcweir         MapMode aMapMode(mpWindow->GetMapMode());
996cdf0e10cSrcweir         aMapMode.SetOrigin(Point());
997cdf0e10cSrcweir         return mpWindow->LogicToPixel( aPoint2, aMapMode );
998cdf0e10cSrcweir     }
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir     return Point();
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir 
PixelToLogic(const Point & rPoint,const MapMode & rMapMode)1003cdf0e10cSrcweir Point SvxTextEditSourceImpl::PixelToLogic( const Point& rPoint, const MapMode& rMapMode )
1004cdf0e10cSrcweir {
1005cdf0e10cSrcweir     // #101029#: The responsibilities of ViewForwarder happen to be
1006cdf0e10cSrcweir     // somewhat mixed in this case. On the one hand, we need the
1007cdf0e10cSrcweir     // different interface queries on the SvxEditSource interface,
1008cdf0e10cSrcweir     // since we need both VisAreas. On the other hand, if an
1009cdf0e10cSrcweir     // EditViewForwarder exists, maTextOffset does not remain static,
1010cdf0e10cSrcweir     // but may change with every key press.
1011cdf0e10cSrcweir     if( IsEditMode() )
1012cdf0e10cSrcweir     {
1013cdf0e10cSrcweir         SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False);
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir         if( pForwarder )
1016cdf0e10cSrcweir             return pForwarder->PixelToLogic( rPoint, rMapMode );
1017cdf0e10cSrcweir     }
1018cdf0e10cSrcweir     else if( IsValid() && mpModel )
1019cdf0e10cSrcweir     {
1020cdf0e10cSrcweir         MapMode aMapMode(mpWindow->GetMapMode());
1021cdf0e10cSrcweir         aMapMode.SetOrigin(Point());
1022cdf0e10cSrcweir         Point aPoint1( mpWindow->PixelToLogic( rPoint, aMapMode ) );
1023cdf0e10cSrcweir         Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
1024cdf0e10cSrcweir                                                    MapMode(mpModel->GetScaleUnit()),
1025cdf0e10cSrcweir                                                    rMapMode ) );
1026cdf0e10cSrcweir         // #101029#
1027cdf0e10cSrcweir         aPoint2.X() -= maTextOffset.X();
1028cdf0e10cSrcweir         aPoint2.Y() -= maTextOffset.Y();
1029cdf0e10cSrcweir 
1030cdf0e10cSrcweir         return aPoint2;
1031cdf0e10cSrcweir     }
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir     return Point();
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir 
IMPL_LINK(SvxTextEditSourceImpl,NotifyHdl,EENotify *,aNotify)1036cdf0e10cSrcweir IMPL_LINK(SvxTextEditSourceImpl, NotifyHdl, EENotify*, aNotify)
1037cdf0e10cSrcweir {
1038cdf0e10cSrcweir     if( aNotify && !mbNotificationsDisabled )
1039cdf0e10cSrcweir     {
1040cdf0e10cSrcweir         ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( aNotify) );
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir         if( aHint.get() )
1043cdf0e10cSrcweir             Broadcast( *aHint.get() );
1044cdf0e10cSrcweir     }
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir     return 0;
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir //------------------------------------------------------------------------
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir // --------------------------------------------------------------------
1052cdf0e10cSrcweir // SvxTextEditSource
1053cdf0e10cSrcweir // --------------------------------------------------------------------
1054cdf0e10cSrcweir 
SvxTextEditSource(SdrObject * pObject,SdrText * pText,XInterface * pOwner)1055cdf0e10cSrcweir SvxTextEditSource::SvxTextEditSource( SdrObject* pObject, SdrText* pText, XInterface* pOwner )
1056cdf0e10cSrcweir {
1057cdf0e10cSrcweir 	mpImpl = new SvxTextEditSourceImpl( pObject, pText, pOwner );
1058cdf0e10cSrcweir 	mpImpl->acquire();
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir 
1061cdf0e10cSrcweir // --------------------------------------------------------------------
SvxTextEditSource(SdrObject & rObj,SdrText * pText,SdrView & rView,const Window & rWindow)1062cdf0e10cSrcweir SvxTextEditSource::SvxTextEditSource( SdrObject& rObj, SdrText* pText, SdrView& rView, const Window& rWindow )
1063cdf0e10cSrcweir {
1064cdf0e10cSrcweir 	mpImpl = new SvxTextEditSourceImpl( rObj, pText, rView, rWindow );
1065cdf0e10cSrcweir 	mpImpl->acquire();
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir // --------------------------------------------------------------------
1069cdf0e10cSrcweir 
SvxTextEditSource(SvxTextEditSourceImpl * pImpl)1070cdf0e10cSrcweir SvxTextEditSource::SvxTextEditSource( SvxTextEditSourceImpl* pImpl )
1071cdf0e10cSrcweir {
1072cdf0e10cSrcweir 	mpImpl = pImpl;
1073cdf0e10cSrcweir 	mpImpl->acquire();
1074cdf0e10cSrcweir }
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir //------------------------------------------------------------------------
~SvxTextEditSource()1077cdf0e10cSrcweir SvxTextEditSource::~SvxTextEditSource()
1078cdf0e10cSrcweir {
1079cdf0e10cSrcweir 	OGuard aGuard( Application::GetSolarMutex() );
1080cdf0e10cSrcweir 
1081cdf0e10cSrcweir 	mpImpl->release();
1082cdf0e10cSrcweir }
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir //------------------------------------------------------------------------
Clone() const1085cdf0e10cSrcweir SvxEditSource* SvxTextEditSource::Clone() const
1086cdf0e10cSrcweir {
1087cdf0e10cSrcweir 	return new SvxTextEditSource( mpImpl );
1088cdf0e10cSrcweir }
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir //------------------------------------------------------------------------
GetTextForwarder()1091cdf0e10cSrcweir SvxTextForwarder* SvxTextEditSource::GetTextForwarder()
1092cdf0e10cSrcweir {
1093cdf0e10cSrcweir     return mpImpl->GetTextForwarder();
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir //------------------------------------------------------------------------
GetEditViewForwarder(sal_Bool bCreate)1097cdf0e10cSrcweir SvxEditViewForwarder* SvxTextEditSource::GetEditViewForwarder( sal_Bool bCreate )
1098cdf0e10cSrcweir {
1099cdf0e10cSrcweir     return mpImpl->GetEditViewForwarder( bCreate );
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir //------------------------------------------------------------------------
GetViewForwarder()1103cdf0e10cSrcweir SvxViewForwarder* SvxTextEditSource::GetViewForwarder()
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir     return this;
1106cdf0e10cSrcweir }
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir //------------------------------------------------------------------------
UpdateData()1109cdf0e10cSrcweir void SvxTextEditSource::UpdateData()
1110cdf0e10cSrcweir {
1111cdf0e10cSrcweir     mpImpl->UpdateData();
1112cdf0e10cSrcweir }
1113cdf0e10cSrcweir 
GetBroadcaster() const1114cdf0e10cSrcweir SfxBroadcaster& SvxTextEditSource::GetBroadcaster() const
1115cdf0e10cSrcweir {
1116cdf0e10cSrcweir     return *mpImpl;
1117cdf0e10cSrcweir }
1118cdf0e10cSrcweir 
GetSdrObject() const1119cdf0e10cSrcweir SdrObject* SvxTextEditSource::GetSdrObject() const
1120cdf0e10cSrcweir {
1121cdf0e10cSrcweir     return mpImpl->GetSdrObject();
1122cdf0e10cSrcweir }
1123cdf0e10cSrcweir 
lock()1124cdf0e10cSrcweir void SvxTextEditSource::lock()
1125cdf0e10cSrcweir {
1126cdf0e10cSrcweir     mpImpl->lock();
1127cdf0e10cSrcweir }
1128cdf0e10cSrcweir 
unlock()1129cdf0e10cSrcweir void SvxTextEditSource::unlock()
1130cdf0e10cSrcweir {
1131cdf0e10cSrcweir     mpImpl->unlock();
1132cdf0e10cSrcweir }
1133cdf0e10cSrcweir 
IsValid() const1134cdf0e10cSrcweir sal_Bool SvxTextEditSource::IsValid() const
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir     return mpImpl->IsValid();
1137cdf0e10cSrcweir }
1138cdf0e10cSrcweir 
GetVisArea() const1139cdf0e10cSrcweir Rectangle SvxTextEditSource::GetVisArea() const
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir     return mpImpl->GetVisArea();
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir 
LogicToPixel(const Point & rPoint,const MapMode & rMapMode) const1144cdf0e10cSrcweir Point SvxTextEditSource::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
1145cdf0e10cSrcweir {
1146cdf0e10cSrcweir     return mpImpl->LogicToPixel( rPoint, rMapMode );
1147cdf0e10cSrcweir }
1148cdf0e10cSrcweir 
PixelToLogic(const Point & rPoint,const MapMode & rMapMode) const1149cdf0e10cSrcweir Point SvxTextEditSource::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir     return mpImpl->PixelToLogic( rPoint, rMapMode );
1152cdf0e10cSrcweir }
1153cdf0e10cSrcweir 
addRange(SvxUnoTextRangeBase * pNewRange)1154cdf0e10cSrcweir void SvxTextEditSource::addRange( SvxUnoTextRangeBase* pNewRange )
1155cdf0e10cSrcweir {
1156cdf0e10cSrcweir 	mpImpl->addRange( pNewRange );
1157cdf0e10cSrcweir }
1158cdf0e10cSrcweir 
removeRange(SvxUnoTextRangeBase * pOldRange)1159cdf0e10cSrcweir void SvxTextEditSource::removeRange( SvxUnoTextRangeBase* pOldRange )
1160cdf0e10cSrcweir {
1161cdf0e10cSrcweir 	mpImpl->removeRange( pOldRange );
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir 
getRanges() const1164cdf0e10cSrcweir const SvxUnoTextRangeBaseList& SvxTextEditSource::getRanges() const
1165cdf0e10cSrcweir {
1166cdf0e10cSrcweir 	return mpImpl->getRanges();
1167cdf0e10cSrcweir }
1168cdf0e10cSrcweir 
ChangeModel(SdrModel * pNewModel)1169cdf0e10cSrcweir void SvxTextEditSource::ChangeModel( SdrModel* pNewModel )
1170cdf0e10cSrcweir {
1171cdf0e10cSrcweir 	mpImpl->ChangeModel( pNewModel );
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir 
UpdateOutliner()1174cdf0e10cSrcweir void SvxTextEditSource::UpdateOutliner()
1175cdf0e10cSrcweir {
1176cdf0e10cSrcweir     mpImpl->UpdateOutliner();
1177cdf0e10cSrcweir }
1178