1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //------------------------------------------------------------------------
32*cdf0e10cSrcweir //
33*cdf0e10cSrcweir // Global header
34*cdf0e10cSrcweir //
35*cdf0e10cSrcweir //------------------------------------------------------------------------
36*cdf0e10cSrcweir #include <svl/itemset.hxx>
37*cdf0e10cSrcweir #include <editeng/editdata.hxx>
38*cdf0e10cSrcweir #include <editeng/outliner.hxx>
39*cdf0e10cSrcweir #include <svx/svdmodel.hxx>
40*cdf0e10cSrcweir #include <svx/svdobj.hxx>
41*cdf0e10cSrcweir #include <svx/svdpool.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir //------------------------------------------------------------------------
44*cdf0e10cSrcweir //
45*cdf0e10cSrcweir // Project-local header
46*cdf0e10cSrcweir //
47*cdf0e10cSrcweir //------------------------------------------------------------------------
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir #include "AccessibleEmptyEditSource.hxx"
50*cdf0e10cSrcweir #include <svx/unoshtxt.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir namespace accessibility
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir     /** This class simply wraps a SvxTextEditSource, forwarding all
56*cdf0e10cSrcweir         methods except the GetBroadcaster() call
57*cdf0e10cSrcweir      */
58*cdf0e10cSrcweir     class AccessibleProxyEditSource_Impl : public SvxEditSource
59*cdf0e10cSrcweir     {
60*cdf0e10cSrcweir     public:
61*cdf0e10cSrcweir         /** Construct AccessibleEmptyEditSource_Impl
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir         	@param rBrdCast
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir             Proxy broadcaster to allow seamless flipping of edit source implementations. ProxyEditSource and EmptyEditSource
66*cdf0e10cSrcweir          */
67*cdf0e10cSrcweir         AccessibleProxyEditSource_Impl( SdrObject& 		rObj,
68*cdf0e10cSrcweir                                         SdrView& 		rView,
69*cdf0e10cSrcweir                                         const Window& 	rViewWindow );
70*cdf0e10cSrcweir         ~AccessibleProxyEditSource_Impl();
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir         // from the SvxEditSource interface
73*cdf0e10cSrcweir         SvxTextForwarder*		GetTextForwarder();
74*cdf0e10cSrcweir         SvxViewForwarder*		GetViewForwarder();
75*cdf0e10cSrcweir         SvxEditViewForwarder*	GetEditViewForwarder( sal_Bool bCreate = sal_False );
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir         SvxEditSource*			Clone() const;
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir         void					UpdateData();
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir         SfxBroadcaster&			GetBroadcaster() const;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     private:
84*cdf0e10cSrcweir         SvxTextEditSource		maEditSource;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir     };
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     /** Dummy class, faking exactly one empty paragraph for EditEngine accessibility
89*cdf0e10cSrcweir      */
90*cdf0e10cSrcweir     class AccessibleEmptyEditSource_Impl : public SvxEditSource, public SvxViewForwarder, public SvxTextForwarder, public SfxBroadcaster
91*cdf0e10cSrcweir     {
92*cdf0e10cSrcweir     public:
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         AccessibleEmptyEditSource_Impl() {}
95*cdf0e10cSrcweir         ~AccessibleEmptyEditSource_Impl() {}
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir         // from the SfxListener interface
98*cdf0e10cSrcweir         void					Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir         // SvxEditSource
101*cdf0e10cSrcweir         SvxTextForwarder*		GetTextForwarder() { return this; }
102*cdf0e10cSrcweir         SvxViewForwarder*		GetViewForwarder() { return this; }
103*cdf0e10cSrcweir         SvxEditSource*			Clone() const { return NULL; }
104*cdf0e10cSrcweir         void					UpdateData() {}
105*cdf0e10cSrcweir         SfxBroadcaster&			GetBroadcaster() const { return *(const_cast<AccessibleEmptyEditSource_Impl*>(this)); }
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir         // SvxTextForwarder
108*cdf0e10cSrcweir         sal_uInt16			GetParagraphCount() const { return 1; }
109*cdf0e10cSrcweir         sal_uInt16			GetTextLen( sal_uInt16 /*nParagraph*/ ) const { return 0; }
110*cdf0e10cSrcweir         String			GetText( const ESelection& /*rSel*/ ) const { return String(); }
111*cdf0e10cSrcweir         SfxItemSet		GetAttribs( const ESelection& /*rSel*/, sal_Bool /*bOnlyHardAttrib*/ = 0 ) const
112*cdf0e10cSrcweir         {
113*cdf0e10cSrcweir             // AW: Very dangerous: The former implementation used a SfxItemPool created on the
114*cdf0e10cSrcweir             // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using
115*cdf0e10cSrcweir             // a deleted Pool by design.
116*cdf0e10cSrcweir             return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool());
117*cdf0e10cSrcweir         }
118*cdf0e10cSrcweir         SfxItemSet		GetParaAttribs( sal_uInt16 /*nPara*/ ) const { return GetAttribs(ESelection()); }
119*cdf0e10cSrcweir         void			SetParaAttribs( sal_uInt16 /*nPara*/, const SfxItemSet& /*rSet*/ ) {}
120*cdf0e10cSrcweir         void            RemoveAttribs( const ESelection& /*rSelection*/, sal_Bool /*bRemoveParaAttribs*/, sal_uInt16 /*nWhich*/ ){}
121*cdf0e10cSrcweir         void			GetPortions( sal_uInt16 /*nPara*/, SvUShorts& /*rList*/ ) const {}
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir         sal_uInt16			GetItemState( const ESelection& /*rSel*/, sal_uInt16 /*nWhich*/ ) const { return 0; }
124*cdf0e10cSrcweir         sal_uInt16			GetItemState( sal_uInt16 /*nPara*/, sal_uInt16 /*nWhich*/ ) const { return 0; }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir         SfxItemPool* 	GetPool() const { return NULL; }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir         void			QuickInsertText( const String& /*rText*/, const ESelection& /*rSel*/ ) {}
129*cdf0e10cSrcweir         void			QuickInsertField( const SvxFieldItem& /*rFld*/, const ESelection& /*rSel*/ ) {}
130*cdf0e10cSrcweir         void			QuickSetAttribs( const SfxItemSet& /*rSet*/, const ESelection& /*rSel*/ ) {}
131*cdf0e10cSrcweir         void			QuickInsertLineBreak( const ESelection& /*rSel*/ ) {}
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir         const SfxItemSet * GetEmptyItemSetPtr() { return 0; }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir         void        AppendParagraph() {}
136*cdf0e10cSrcweir         xub_StrLen  AppendTextPortion( sal_uInt16 /*nPara*/, const String & /*rText*/, const SfxItemSet & /*rSet*/ ) { return 0; }
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir         //XTextCopy
139*cdf0e10cSrcweir         void        CopyText(const SvxTextForwarder& ){}
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir         XubString		CalcFieldValue( const SvxFieldItem& /*rField*/, sal_uInt16 /*nPara*/, sal_uInt16 /*nPos*/, Color*& /*rpTxtColor*/, Color*& /*rpFldColor*/ )
142*cdf0e10cSrcweir         {
143*cdf0e10cSrcweir             return  XubString();
144*cdf0e10cSrcweir         }
145*cdf0e10cSrcweir 	    void            FieldClicked( const SvxFieldItem&, sal_uInt16, xub_StrLen ) {;}
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir         sal_Bool			IsValid() const { return sal_True; }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir         void 			SetNotifyHdl( const Link& ) {}
150*cdf0e10cSrcweir         LanguageType 	GetLanguage( sal_uInt16, sal_uInt16 ) const { return LANGUAGE_DONTKNOW; }
151*cdf0e10cSrcweir         sal_uInt16			GetFieldCount( sal_uInt16 ) const { return 0; }
152*cdf0e10cSrcweir         EFieldInfo		GetFieldInfo( sal_uInt16, sal_uInt16 ) const { return EFieldInfo(); }
153*cdf0e10cSrcweir         EBulletInfo     GetBulletInfo( sal_uInt16 ) const { return EBulletInfo(); }
154*cdf0e10cSrcweir         Rectangle		GetCharBounds( sal_uInt16, sal_uInt16 ) const { return Rectangle(); }
155*cdf0e10cSrcweir         Rectangle		GetParaBounds( sal_uInt16 ) const { return Rectangle(); }
156*cdf0e10cSrcweir         MapMode		 	GetMapMode() const { return MapMode(); }
157*cdf0e10cSrcweir         OutputDevice*	GetRefDevice() const { return NULL; }
158*cdf0e10cSrcweir         sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const { return sal_False; }
159*cdf0e10cSrcweir         sal_Bool		GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const { return sal_False; }
160*cdf0e10cSrcweir         sal_Bool 		GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const { return sal_False; }
161*cdf0e10cSrcweir         sal_uInt16			GetLineCount( sal_uInt16 nPara ) const { return nPara == 0 ? 1 : 0; }
162*cdf0e10cSrcweir         sal_uInt16			GetLineLen( sal_uInt16, sal_uInt16 ) const { return 0; }
163*cdf0e10cSrcweir         void            GetLineBoundaries( /*out*/sal_uInt16 & rStart, /*out*/sal_uInt16 & rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const  { rStart = rEnd = 0; }
164*cdf0e10cSrcweir         sal_uInt16          GetLineNumberAtIndex( sal_uInt16 /*nPara*/, sal_uInt16 /*nIndex*/ ) const   { return 0; }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir         // the following two methods would, strictly speaking, require
167*cdf0e10cSrcweir         // a switch to a real EditSource, too. Fortunately, the
168*cdf0e10cSrcweir         // AccessibleEditableTextPara implementation currently always
169*cdf0e10cSrcweir         // calls GetEditViewForwarder(true) before doing
170*cdf0e10cSrcweir         // changes. Thus, we rely on this behabviour here (problem
171*cdf0e10cSrcweir         // when that changes: via accessibility API, it would no
172*cdf0e10cSrcweir         // longer be possible to enter text in previously empty
173*cdf0e10cSrcweir         // shapes).
174*cdf0e10cSrcweir         sal_Bool		Delete( const ESelection& ) { return sal_False; }
175*cdf0e10cSrcweir         sal_Bool		InsertText( const String&, const ESelection& ) { return sal_False; }
176*cdf0e10cSrcweir         sal_Bool		QuickFormatDoc( sal_Bool ) { return sal_True; }
177*cdf0e10cSrcweir         sal_Int16		GetDepth( sal_uInt16 ) const { return -1; }
178*cdf0e10cSrcweir         sal_Bool		SetDepth( sal_uInt16, sal_Int16 ) { return sal_True; }
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir         Rectangle		GetVisArea() const { return Rectangle(); }
181*cdf0e10cSrcweir         Point			LogicToPixel( const Point& rPoint, const MapMode& /*rMapMode*/ ) const { return rPoint; }
182*cdf0e10cSrcweir         Point			PixelToLogic( const Point& rPoint, const MapMode& /*rMapMode*/ ) const { return rPoint; }
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     };
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     // -------------------------------------------------------------------------
187*cdf0e10cSrcweir     // Implementing AccessibleProxyEditSource_Impl
188*cdf0e10cSrcweir     // -------------------------------------------------------------------------
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     AccessibleProxyEditSource_Impl::AccessibleProxyEditSource_Impl( SdrObject& 		rObj,
191*cdf0e10cSrcweir                                                                     SdrView& 		rView,
192*cdf0e10cSrcweir                                                                     const Window& 	rViewWindow ) :
193*cdf0e10cSrcweir         maEditSource( rObj, 0, rView, rViewWindow )
194*cdf0e10cSrcweir     {
195*cdf0e10cSrcweir     }
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir     AccessibleProxyEditSource_Impl::~AccessibleProxyEditSource_Impl()
198*cdf0e10cSrcweir     {
199*cdf0e10cSrcweir     }
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     SvxTextForwarder* AccessibleProxyEditSource_Impl::GetTextForwarder()
202*cdf0e10cSrcweir     {
203*cdf0e10cSrcweir         return maEditSource.GetTextForwarder();
204*cdf0e10cSrcweir     }
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir     SvxViewForwarder* AccessibleProxyEditSource_Impl::GetViewForwarder()
207*cdf0e10cSrcweir     {
208*cdf0e10cSrcweir         return maEditSource.GetViewForwarder();
209*cdf0e10cSrcweir     }
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     SvxEditViewForwarder* AccessibleProxyEditSource_Impl::GetEditViewForwarder( sal_Bool bCreate )
212*cdf0e10cSrcweir     {
213*cdf0e10cSrcweir         return maEditSource.GetEditViewForwarder( bCreate );
214*cdf0e10cSrcweir     }
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     SvxEditSource* AccessibleProxyEditSource_Impl::Clone() const
217*cdf0e10cSrcweir     {
218*cdf0e10cSrcweir         return maEditSource.Clone();
219*cdf0e10cSrcweir     }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     void AccessibleProxyEditSource_Impl::UpdateData()
222*cdf0e10cSrcweir     {
223*cdf0e10cSrcweir         maEditSource.UpdateData();
224*cdf0e10cSrcweir     }
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir     SfxBroadcaster&	AccessibleProxyEditSource_Impl::GetBroadcaster() const
227*cdf0e10cSrcweir     {
228*cdf0e10cSrcweir         return maEditSource.GetBroadcaster();
229*cdf0e10cSrcweir     }
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir     // -------------------------------------------------------------------------
233*cdf0e10cSrcweir     // Implementing AccessibleEmptyEditSource
234*cdf0e10cSrcweir     // -------------------------------------------------------------------------
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir     AccessibleEmptyEditSource::AccessibleEmptyEditSource( SdrObject& 	rObj,
237*cdf0e10cSrcweir                                                           SdrView& 		rView,
238*cdf0e10cSrcweir                                                           const Window& rViewWindow ) :
239*cdf0e10cSrcweir         mpEditSource( new AccessibleEmptyEditSource_Impl() ),
240*cdf0e10cSrcweir         mrObj(rObj),
241*cdf0e10cSrcweir         mrView(rView),
242*cdf0e10cSrcweir         mrViewWindow(rViewWindow),
243*cdf0e10cSrcweir         mbEditSourceEmpty( true )
244*cdf0e10cSrcweir     {
245*cdf0e10cSrcweir         if( mrObj.GetModel() )
246*cdf0e10cSrcweir             StartListening( *mrObj.GetModel() );
247*cdf0e10cSrcweir     }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir     AccessibleEmptyEditSource::~AccessibleEmptyEditSource()
250*cdf0e10cSrcweir     {
251*cdf0e10cSrcweir         if( !mbEditSourceEmpty )
252*cdf0e10cSrcweir         {
253*cdf0e10cSrcweir             // deregister as listener
254*cdf0e10cSrcweir             if( mpEditSource.get() )
255*cdf0e10cSrcweir                 EndListening( mpEditSource->GetBroadcaster() );
256*cdf0e10cSrcweir         }
257*cdf0e10cSrcweir         else
258*cdf0e10cSrcweir         {
259*cdf0e10cSrcweir             if( mrObj.GetModel() )
260*cdf0e10cSrcweir                 EndListening( *mrObj.GetModel() );
261*cdf0e10cSrcweir         }
262*cdf0e10cSrcweir     }
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     SvxTextForwarder* AccessibleEmptyEditSource::GetTextForwarder()
265*cdf0e10cSrcweir     {
266*cdf0e10cSrcweir         if( !mpEditSource.get() )
267*cdf0e10cSrcweir             return NULL;
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir         return mpEditSource->GetTextForwarder();
270*cdf0e10cSrcweir     }
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir     SvxViewForwarder* AccessibleEmptyEditSource::GetViewForwarder()
273*cdf0e10cSrcweir     {
274*cdf0e10cSrcweir         if( !mpEditSource.get() )
275*cdf0e10cSrcweir             return NULL;
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir         return mpEditSource->GetViewForwarder();
278*cdf0e10cSrcweir     }
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir     void AccessibleEmptyEditSource::Switch2ProxyEditSource()
281*cdf0e10cSrcweir     {
282*cdf0e10cSrcweir         // deregister EmptyEditSource model listener
283*cdf0e10cSrcweir         if( mrObj.GetModel() )
284*cdf0e10cSrcweir             EndListening( *mrObj.GetModel() );
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir         ::std::auto_ptr< SvxEditSource > pProxySource( new AccessibleProxyEditSource_Impl(mrObj, mrView, mrViewWindow) );
287*cdf0e10cSrcweir         ::std::auto_ptr< SvxEditSource > tmp = mpEditSource;
288*cdf0e10cSrcweir         mpEditSource = pProxySource;
289*cdf0e10cSrcweir         pProxySource = tmp;
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir         // register as listener
292*cdf0e10cSrcweir         StartListening( mpEditSource->GetBroadcaster() );
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir         // we've irrevocably a full EditSource now.
295*cdf0e10cSrcweir         mbEditSourceEmpty = false;
296*cdf0e10cSrcweir     }
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir     SvxEditViewForwarder* AccessibleEmptyEditSource::GetEditViewForwarder( sal_Bool bCreate )
299*cdf0e10cSrcweir     {
300*cdf0e10cSrcweir         if( !mpEditSource.get() )
301*cdf0e10cSrcweir             return NULL;
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         // switch edit source, if not yet done
304*cdf0e10cSrcweir         if( mbEditSourceEmpty && bCreate )
305*cdf0e10cSrcweir             Switch2ProxyEditSource();
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir         return mpEditSource->GetEditViewForwarder( bCreate );
308*cdf0e10cSrcweir     }
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir     SvxEditSource* AccessibleEmptyEditSource::Clone() const
311*cdf0e10cSrcweir     {
312*cdf0e10cSrcweir         if( !mpEditSource.get() )
313*cdf0e10cSrcweir             return NULL;
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir         return mpEditSource->Clone();
316*cdf0e10cSrcweir     }
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir     void AccessibleEmptyEditSource::UpdateData()
319*cdf0e10cSrcweir     {
320*cdf0e10cSrcweir         if( mpEditSource.get() )
321*cdf0e10cSrcweir             mpEditSource->UpdateData();
322*cdf0e10cSrcweir     }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir     SfxBroadcaster&	AccessibleEmptyEditSource::GetBroadcaster() const
325*cdf0e10cSrcweir     {
326*cdf0e10cSrcweir         return *(const_cast<AccessibleEmptyEditSource*>(this));
327*cdf0e10cSrcweir     }
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir     void AccessibleEmptyEditSource::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
330*cdf0e10cSrcweir     {
331*cdf0e10cSrcweir         const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir         if( pSdrHint && pSdrHint->GetKind() == HINT_BEGEDIT &&
334*cdf0e10cSrcweir             &mrObj == pSdrHint->GetObject() && mpEditSource.get() )
335*cdf0e10cSrcweir         {
336*cdf0e10cSrcweir             // switch edit source, if not yet done. This is necessary
337*cdf0e10cSrcweir             // to become a full-fledged EditSource the first time a
338*cdf0e10cSrcweir             // user start entering text in a previously empty object.
339*cdf0e10cSrcweir             if( mbEditSourceEmpty )
340*cdf0e10cSrcweir                 Switch2ProxyEditSource();
341*cdf0e10cSrcweir         }
342*cdf0e10cSrcweir         else if (pSdrHint && pSdrHint->GetObject()!=NULL)
343*cdf0e10cSrcweir         {
344*cdf0e10cSrcweir             // When the SdrObject just got a para outliner object then
345*cdf0e10cSrcweir             // switch the edit source.
346*cdf0e10cSrcweir             if (pSdrHint->GetObject()->GetOutlinerParaObject() != NULL)
347*cdf0e10cSrcweir                 Switch2ProxyEditSource();
348*cdf0e10cSrcweir         }
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir         // forward messages
351*cdf0e10cSrcweir         Broadcast( rHint );
352*cdf0e10cSrcweir     }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir } // end of namespace accessibility
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir //------------------------------------------------------------------------
357