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 27cdf0e10cSrcweir //------------------------------------------------------------------------ 28cdf0e10cSrcweir // 29cdf0e10cSrcweir // Global header 30cdf0e10cSrcweir // 31cdf0e10cSrcweir //------------------------------------------------------------------------ 32cdf0e10cSrcweir #include <svl/itemset.hxx> 33cdf0e10cSrcweir #include <editeng/editdata.hxx> 34cdf0e10cSrcweir #include <editeng/outliner.hxx> 35cdf0e10cSrcweir #include <svx/svdmodel.hxx> 36cdf0e10cSrcweir #include <svx/svdobj.hxx> 37cdf0e10cSrcweir #include <svx/svdpool.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir //------------------------------------------------------------------------ 40cdf0e10cSrcweir // 41cdf0e10cSrcweir // Project-local header 42cdf0e10cSrcweir // 43cdf0e10cSrcweir //------------------------------------------------------------------------ 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include "AccessibleEmptyEditSource.hxx" 46cdf0e10cSrcweir #include <svx/unoshtxt.hxx> 47cdf0e10cSrcweir 48cdf0e10cSrcweir namespace accessibility 49cdf0e10cSrcweir { 50cdf0e10cSrcweir 51cdf0e10cSrcweir /** This class simply wraps a SvxTextEditSource, forwarding all 52cdf0e10cSrcweir methods except the GetBroadcaster() call 53cdf0e10cSrcweir */ 54cdf0e10cSrcweir class AccessibleProxyEditSource_Impl : public SvxEditSource 55cdf0e10cSrcweir { 56cdf0e10cSrcweir public: 57cdf0e10cSrcweir /** Construct AccessibleEmptyEditSource_Impl 58cdf0e10cSrcweir 59cdf0e10cSrcweir @param rBrdCast 60cdf0e10cSrcweir 61cdf0e10cSrcweir Proxy broadcaster to allow seamless flipping of edit source implementations. ProxyEditSource and EmptyEditSource 62cdf0e10cSrcweir */ 63cdf0e10cSrcweir AccessibleProxyEditSource_Impl( SdrObject& rObj, 64cdf0e10cSrcweir SdrView& rView, 65cdf0e10cSrcweir const Window& rViewWindow ); 66cdf0e10cSrcweir ~AccessibleProxyEditSource_Impl(); 67cdf0e10cSrcweir 68cdf0e10cSrcweir // from the SvxEditSource interface 69cdf0e10cSrcweir SvxTextForwarder* GetTextForwarder(); 70cdf0e10cSrcweir SvxViewForwarder* GetViewForwarder(); 71cdf0e10cSrcweir SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False ); 72cdf0e10cSrcweir 73cdf0e10cSrcweir SvxEditSource* Clone() const; 74cdf0e10cSrcweir 75cdf0e10cSrcweir void UpdateData(); 76cdf0e10cSrcweir 77cdf0e10cSrcweir SfxBroadcaster& GetBroadcaster() const; 78cdf0e10cSrcweir 79cdf0e10cSrcweir private: 80cdf0e10cSrcweir SvxTextEditSource maEditSource; 81cdf0e10cSrcweir 82cdf0e10cSrcweir }; 83cdf0e10cSrcweir 84cdf0e10cSrcweir /** Dummy class, faking exactly one empty paragraph for EditEngine accessibility 85cdf0e10cSrcweir */ 86cdf0e10cSrcweir class AccessibleEmptyEditSource_Impl : public SvxEditSource, public SvxViewForwarder, public SvxTextForwarder, public SfxBroadcaster 87cdf0e10cSrcweir { 88cdf0e10cSrcweir public: 89cdf0e10cSrcweir AccessibleEmptyEditSource_Impl()90cdf0e10cSrcweir AccessibleEmptyEditSource_Impl() {} ~AccessibleEmptyEditSource_Impl()91cdf0e10cSrcweir ~AccessibleEmptyEditSource_Impl() {} 92cdf0e10cSrcweir 93cdf0e10cSrcweir // from the SfxListener interface 94cdf0e10cSrcweir void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir // SvxEditSource GetTextForwarder()97cdf0e10cSrcweir SvxTextForwarder* GetTextForwarder() { return this; } GetViewForwarder()98cdf0e10cSrcweir SvxViewForwarder* GetViewForwarder() { return this; } Clone() const99cdf0e10cSrcweir SvxEditSource* Clone() const { return NULL; } UpdateData()100cdf0e10cSrcweir void UpdateData() {} GetBroadcaster() const101cdf0e10cSrcweir SfxBroadcaster& GetBroadcaster() const { return *(const_cast<AccessibleEmptyEditSource_Impl*>(this)); } 102cdf0e10cSrcweir 103cdf0e10cSrcweir // SvxTextForwarder GetParagraphCount() const104cdf0e10cSrcweir sal_uInt16 GetParagraphCount() const { return 1; } GetTextLen(sal_uInt16) const105cdf0e10cSrcweir sal_uInt16 GetTextLen( sal_uInt16 /*nParagraph*/ ) const { return 0; } GetText(const ESelection &) const106cdf0e10cSrcweir String GetText( const ESelection& /*rSel*/ ) const { return String(); } GetAttribs(const ESelection &,sal_Bool=0) const107cdf0e10cSrcweir SfxItemSet GetAttribs( const ESelection& /*rSel*/, sal_Bool /*bOnlyHardAttrib*/ = 0 ) const 108cdf0e10cSrcweir { 109cdf0e10cSrcweir // AW: Very dangerous: The former implementation used a SfxItemPool created on the 110cdf0e10cSrcweir // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using 111cdf0e10cSrcweir // a deleted Pool by design. 112cdf0e10cSrcweir return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool()); 113cdf0e10cSrcweir } GetParaAttribs(sal_uInt16) const114cdf0e10cSrcweir SfxItemSet GetParaAttribs( sal_uInt16 /*nPara*/ ) const { return GetAttribs(ESelection()); } SetParaAttribs(sal_uInt16,const SfxItemSet &)115cdf0e10cSrcweir void SetParaAttribs( sal_uInt16 /*nPara*/, const SfxItemSet& /*rSet*/ ) {} RemoveAttribs(const ESelection &,sal_Bool,sal_uInt16)116cdf0e10cSrcweir void RemoveAttribs( const ESelection& /*rSelection*/, sal_Bool /*bRemoveParaAttribs*/, sal_uInt16 /*nWhich*/ ){} GetPortions(sal_uInt16,SvUShorts &) const117cdf0e10cSrcweir void GetPortions( sal_uInt16 /*nPara*/, SvUShorts& /*rList*/ ) const {} 118cdf0e10cSrcweir GetItemState(const ESelection &,sal_uInt16) const119cdf0e10cSrcweir sal_uInt16 GetItemState( const ESelection& /*rSel*/, sal_uInt16 /*nWhich*/ ) const { return 0; } GetItemState(sal_uInt16,sal_uInt16) const120cdf0e10cSrcweir sal_uInt16 GetItemState( sal_uInt16 /*nPara*/, sal_uInt16 /*nWhich*/ ) const { return 0; } 121cdf0e10cSrcweir GetPool() const122cdf0e10cSrcweir SfxItemPool* GetPool() const { return NULL; } 123cdf0e10cSrcweir QuickInsertText(const String &,const ESelection &)124cdf0e10cSrcweir void QuickInsertText( const String& /*rText*/, const ESelection& /*rSel*/ ) {} QuickInsertField(const SvxFieldItem &,const ESelection &)125cdf0e10cSrcweir void QuickInsertField( const SvxFieldItem& /*rFld*/, const ESelection& /*rSel*/ ) {} QuickSetAttribs(const SfxItemSet &,const ESelection &)126cdf0e10cSrcweir void QuickSetAttribs( const SfxItemSet& /*rSet*/, const ESelection& /*rSel*/ ) {} QuickInsertLineBreak(const ESelection &)127cdf0e10cSrcweir void QuickInsertLineBreak( const ESelection& /*rSel*/ ) {} 128cdf0e10cSrcweir GetEmptyItemSetPtr()129cdf0e10cSrcweir const SfxItemSet * GetEmptyItemSetPtr() { return 0; } 130cdf0e10cSrcweir AppendParagraph()131cdf0e10cSrcweir void AppendParagraph() {} AppendTextPortion(sal_uInt16,const String &,const SfxItemSet &)132cdf0e10cSrcweir xub_StrLen AppendTextPortion( sal_uInt16 /*nPara*/, const String & /*rText*/, const SfxItemSet & /*rSet*/ ) { return 0; } 133cdf0e10cSrcweir 134cdf0e10cSrcweir //XTextCopy CopyText(const SvxTextForwarder &)135cdf0e10cSrcweir void CopyText(const SvxTextForwarder& ){} 136cdf0e10cSrcweir CalcFieldValue(const SvxFieldItem &,sal_uInt16,sal_uInt16,Color * &,Color * &)137cdf0e10cSrcweir XubString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_uInt16 /*nPara*/, sal_uInt16 /*nPos*/, Color*& /*rpTxtColor*/, Color*& /*rpFldColor*/ ) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir return XubString(); 140cdf0e10cSrcweir } FieldClicked(const SvxFieldItem &,sal_uInt16,xub_StrLen)141cdf0e10cSrcweir void FieldClicked( const SvxFieldItem&, sal_uInt16, xub_StrLen ) {;} 142cdf0e10cSrcweir IsValid() const143cdf0e10cSrcweir sal_Bool IsValid() const { return sal_True; } 144cdf0e10cSrcweir SetNotifyHdl(const Link &)145cdf0e10cSrcweir void SetNotifyHdl( const Link& ) {} GetLanguage(sal_uInt16,sal_uInt16) const146cdf0e10cSrcweir LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const { return LANGUAGE_DONTKNOW; } GetFieldCount(sal_uInt16) const147cdf0e10cSrcweir sal_uInt16 GetFieldCount( sal_uInt16 ) const { return 0; } GetFieldInfo(sal_uInt16,sal_uInt16) const148cdf0e10cSrcweir EFieldInfo GetFieldInfo( sal_uInt16, sal_uInt16 ) const { return EFieldInfo(); } GetBulletInfo(sal_uInt16) const149cdf0e10cSrcweir EBulletInfo GetBulletInfo( sal_uInt16 ) const { return EBulletInfo(); } GetCharBounds(sal_uInt16,sal_uInt16) const150cdf0e10cSrcweir Rectangle GetCharBounds( sal_uInt16, sal_uInt16 ) const { return Rectangle(); } GetParaBounds(sal_uInt16) const151cdf0e10cSrcweir Rectangle GetParaBounds( sal_uInt16 ) const { return Rectangle(); } GetMapMode() const152cdf0e10cSrcweir MapMode GetMapMode() const { return MapMode(); } GetRefDevice() const153cdf0e10cSrcweir OutputDevice* GetRefDevice() const { return NULL; } GetIndexAtPoint(const Point &,sal_uInt16 &,sal_uInt16 &) const154cdf0e10cSrcweir sal_Bool GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const { return sal_False; } GetWordIndices(sal_uInt16,sal_uInt16,sal_uInt16 &,sal_uInt16 &) const155cdf0e10cSrcweir sal_Bool GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const { return sal_False; } GetAttributeRun(sal_uInt16 &,sal_uInt16 &,sal_uInt16,sal_uInt16,sal_Bool) const156*9b8096d0SSteve Yin sal_Bool GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16, sal_Bool) const { return sal_False; } GetLineCount(sal_uInt16 nPara) const157cdf0e10cSrcweir sal_uInt16 GetLineCount( sal_uInt16 nPara ) const { return nPara == 0 ? 1 : 0; } GetLineLen(sal_uInt16,sal_uInt16) const158cdf0e10cSrcweir sal_uInt16 GetLineLen( sal_uInt16, sal_uInt16 ) const { return 0; } GetLineBoundaries(sal_uInt16 & rStart,sal_uInt16 & rEnd,sal_uInt16,sal_uInt16) const159cdf0e10cSrcweir void GetLineBoundaries( /*out*/sal_uInt16 & rStart, /*out*/sal_uInt16 & rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const { rStart = rEnd = 0; } GetLineNumberAtIndex(sal_uInt16,sal_uInt16) const160cdf0e10cSrcweir sal_uInt16 GetLineNumberAtIndex( sal_uInt16 /*nPara*/, sal_uInt16 /*nIndex*/ ) const { return 0; } 161cdf0e10cSrcweir 162cdf0e10cSrcweir // the following two methods would, strictly speaking, require 163cdf0e10cSrcweir // a switch to a real EditSource, too. Fortunately, the 164cdf0e10cSrcweir // AccessibleEditableTextPara implementation currently always 165cdf0e10cSrcweir // calls GetEditViewForwarder(true) before doing 166cdf0e10cSrcweir // changes. Thus, we rely on this behabviour here (problem 167cdf0e10cSrcweir // when that changes: via accessibility API, it would no 168cdf0e10cSrcweir // longer be possible to enter text in previously empty 169cdf0e10cSrcweir // shapes). Delete(const ESelection &)170cdf0e10cSrcweir sal_Bool Delete( const ESelection& ) { return sal_False; } InsertText(const String &,const ESelection &)171cdf0e10cSrcweir sal_Bool InsertText( const String&, const ESelection& ) { return sal_False; } QuickFormatDoc(sal_Bool)172cdf0e10cSrcweir sal_Bool QuickFormatDoc( sal_Bool ) { return sal_True; } GetDepth(sal_uInt16) const173cdf0e10cSrcweir sal_Int16 GetDepth( sal_uInt16 ) const { return -1; } SetDepth(sal_uInt16,sal_Int16)174cdf0e10cSrcweir sal_Bool SetDepth( sal_uInt16, sal_Int16 ) { return sal_True; } 175cdf0e10cSrcweir GetVisArea() const176cdf0e10cSrcweir Rectangle GetVisArea() const { return Rectangle(); } LogicToPixel(const Point & rPoint,const MapMode &) const177cdf0e10cSrcweir Point LogicToPixel( const Point& rPoint, const MapMode& /*rMapMode*/ ) const { return rPoint; } PixelToLogic(const Point & rPoint,const MapMode &) const178cdf0e10cSrcweir Point PixelToLogic( const Point& rPoint, const MapMode& /*rMapMode*/ ) const { return rPoint; } 179cdf0e10cSrcweir 180cdf0e10cSrcweir }; 181cdf0e10cSrcweir 182cdf0e10cSrcweir // ------------------------------------------------------------------------- 183cdf0e10cSrcweir // Implementing AccessibleProxyEditSource_Impl 184cdf0e10cSrcweir // ------------------------------------------------------------------------- 185cdf0e10cSrcweir AccessibleProxyEditSource_Impl(SdrObject & rObj,SdrView & rView,const Window & rViewWindow)186cdf0e10cSrcweir AccessibleProxyEditSource_Impl::AccessibleProxyEditSource_Impl( SdrObject& rObj, 187cdf0e10cSrcweir SdrView& rView, 188cdf0e10cSrcweir const Window& rViewWindow ) : 189cdf0e10cSrcweir maEditSource( rObj, 0, rView, rViewWindow ) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir } 192cdf0e10cSrcweir ~AccessibleProxyEditSource_Impl()193cdf0e10cSrcweir AccessibleProxyEditSource_Impl::~AccessibleProxyEditSource_Impl() 194cdf0e10cSrcweir { 195cdf0e10cSrcweir } 196cdf0e10cSrcweir GetTextForwarder()197cdf0e10cSrcweir SvxTextForwarder* AccessibleProxyEditSource_Impl::GetTextForwarder() 198cdf0e10cSrcweir { 199cdf0e10cSrcweir return maEditSource.GetTextForwarder(); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir GetViewForwarder()202cdf0e10cSrcweir SvxViewForwarder* AccessibleProxyEditSource_Impl::GetViewForwarder() 203cdf0e10cSrcweir { 204cdf0e10cSrcweir return maEditSource.GetViewForwarder(); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir GetEditViewForwarder(sal_Bool bCreate)207cdf0e10cSrcweir SvxEditViewForwarder* AccessibleProxyEditSource_Impl::GetEditViewForwarder( sal_Bool bCreate ) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir return maEditSource.GetEditViewForwarder( bCreate ); 210cdf0e10cSrcweir } 211cdf0e10cSrcweir Clone() const212cdf0e10cSrcweir SvxEditSource* AccessibleProxyEditSource_Impl::Clone() const 213cdf0e10cSrcweir { 214cdf0e10cSrcweir return maEditSource.Clone(); 215cdf0e10cSrcweir } 216cdf0e10cSrcweir UpdateData()217cdf0e10cSrcweir void AccessibleProxyEditSource_Impl::UpdateData() 218cdf0e10cSrcweir { 219cdf0e10cSrcweir maEditSource.UpdateData(); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir GetBroadcaster() const222cdf0e10cSrcweir SfxBroadcaster& AccessibleProxyEditSource_Impl::GetBroadcaster() const 223cdf0e10cSrcweir { 224cdf0e10cSrcweir return maEditSource.GetBroadcaster(); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir 227cdf0e10cSrcweir 228cdf0e10cSrcweir // ------------------------------------------------------------------------- 229cdf0e10cSrcweir // Implementing AccessibleEmptyEditSource 230cdf0e10cSrcweir // ------------------------------------------------------------------------- 231cdf0e10cSrcweir AccessibleEmptyEditSource(SdrObject & rObj,SdrView & rView,const Window & rViewWindow)232cdf0e10cSrcweir AccessibleEmptyEditSource::AccessibleEmptyEditSource( SdrObject& rObj, 233cdf0e10cSrcweir SdrView& rView, 234cdf0e10cSrcweir const Window& rViewWindow ) : 235cdf0e10cSrcweir mpEditSource( new AccessibleEmptyEditSource_Impl() ), 236cdf0e10cSrcweir mrObj(rObj), 237cdf0e10cSrcweir mrView(rView), 238cdf0e10cSrcweir mrViewWindow(rViewWindow), 239cdf0e10cSrcweir mbEditSourceEmpty( true ) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir if( mrObj.GetModel() ) 242cdf0e10cSrcweir StartListening( *mrObj.GetModel() ); 243cdf0e10cSrcweir } 244cdf0e10cSrcweir ~AccessibleEmptyEditSource()245cdf0e10cSrcweir AccessibleEmptyEditSource::~AccessibleEmptyEditSource() 246cdf0e10cSrcweir { 247cdf0e10cSrcweir if( !mbEditSourceEmpty ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir // deregister as listener 250cdf0e10cSrcweir if( mpEditSource.get() ) 251cdf0e10cSrcweir EndListening( mpEditSource->GetBroadcaster() ); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir else 254cdf0e10cSrcweir { 255cdf0e10cSrcweir if( mrObj.GetModel() ) 256cdf0e10cSrcweir EndListening( *mrObj.GetModel() ); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir } 259cdf0e10cSrcweir GetTextForwarder()260cdf0e10cSrcweir SvxTextForwarder* AccessibleEmptyEditSource::GetTextForwarder() 261cdf0e10cSrcweir { 262cdf0e10cSrcweir if( !mpEditSource.get() ) 263cdf0e10cSrcweir return NULL; 264cdf0e10cSrcweir 265cdf0e10cSrcweir return mpEditSource->GetTextForwarder(); 266cdf0e10cSrcweir } 267cdf0e10cSrcweir GetViewForwarder()268cdf0e10cSrcweir SvxViewForwarder* AccessibleEmptyEditSource::GetViewForwarder() 269cdf0e10cSrcweir { 270cdf0e10cSrcweir if( !mpEditSource.get() ) 271cdf0e10cSrcweir return NULL; 272cdf0e10cSrcweir 273cdf0e10cSrcweir return mpEditSource->GetViewForwarder(); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir Switch2ProxyEditSource()276cdf0e10cSrcweir void AccessibleEmptyEditSource::Switch2ProxyEditSource() 277cdf0e10cSrcweir { 278cdf0e10cSrcweir // deregister EmptyEditSource model listener 279cdf0e10cSrcweir if( mrObj.GetModel() ) 280cdf0e10cSrcweir EndListening( *mrObj.GetModel() ); 281cdf0e10cSrcweir 282cdf0e10cSrcweir ::std::auto_ptr< SvxEditSource > pProxySource( new AccessibleProxyEditSource_Impl(mrObj, mrView, mrViewWindow) ); 283cdf0e10cSrcweir ::std::auto_ptr< SvxEditSource > tmp = mpEditSource; 284cdf0e10cSrcweir mpEditSource = pProxySource; 285cdf0e10cSrcweir pProxySource = tmp; 286cdf0e10cSrcweir 287cdf0e10cSrcweir // register as listener 288cdf0e10cSrcweir StartListening( mpEditSource->GetBroadcaster() ); 289cdf0e10cSrcweir 290cdf0e10cSrcweir // we've irrevocably a full EditSource now. 291cdf0e10cSrcweir mbEditSourceEmpty = false; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir GetEditViewForwarder(sal_Bool bCreate)294cdf0e10cSrcweir SvxEditViewForwarder* AccessibleEmptyEditSource::GetEditViewForwarder( sal_Bool bCreate ) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir if( !mpEditSource.get() ) 297cdf0e10cSrcweir return NULL; 298cdf0e10cSrcweir 299cdf0e10cSrcweir // switch edit source, if not yet done 300cdf0e10cSrcweir if( mbEditSourceEmpty && bCreate ) 301cdf0e10cSrcweir Switch2ProxyEditSource(); 302cdf0e10cSrcweir 303cdf0e10cSrcweir return mpEditSource->GetEditViewForwarder( bCreate ); 304cdf0e10cSrcweir } 305cdf0e10cSrcweir Clone() const306cdf0e10cSrcweir SvxEditSource* AccessibleEmptyEditSource::Clone() const 307cdf0e10cSrcweir { 308cdf0e10cSrcweir if( !mpEditSource.get() ) 309cdf0e10cSrcweir return NULL; 310cdf0e10cSrcweir 311cdf0e10cSrcweir return mpEditSource->Clone(); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir UpdateData()314cdf0e10cSrcweir void AccessibleEmptyEditSource::UpdateData() 315cdf0e10cSrcweir { 316cdf0e10cSrcweir if( mpEditSource.get() ) 317cdf0e10cSrcweir mpEditSource->UpdateData(); 318cdf0e10cSrcweir } 319cdf0e10cSrcweir GetBroadcaster() const320cdf0e10cSrcweir SfxBroadcaster& AccessibleEmptyEditSource::GetBroadcaster() const 321cdf0e10cSrcweir { 322cdf0e10cSrcweir return *(const_cast<AccessibleEmptyEditSource*>(this)); 323cdf0e10cSrcweir } 324cdf0e10cSrcweir Notify(SfxBroadcaster &,const SfxHint & rHint)325cdf0e10cSrcweir void AccessibleEmptyEditSource::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); 328cdf0e10cSrcweir 329cdf0e10cSrcweir if( pSdrHint && pSdrHint->GetKind() == HINT_BEGEDIT && 330cdf0e10cSrcweir &mrObj == pSdrHint->GetObject() && mpEditSource.get() ) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir // switch edit source, if not yet done. This is necessary 333cdf0e10cSrcweir // to become a full-fledged EditSource the first time a 334cdf0e10cSrcweir // user start entering text in a previously empty object. 335cdf0e10cSrcweir if( mbEditSourceEmpty ) 336cdf0e10cSrcweir Switch2ProxyEditSource(); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir else if (pSdrHint && pSdrHint->GetObject()!=NULL) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir // When the SdrObject just got a para outliner object then 341cdf0e10cSrcweir // switch the edit source. 342cdf0e10cSrcweir if (pSdrHint->GetObject()->GetOutlinerParaObject() != NULL) 343cdf0e10cSrcweir Switch2ProxyEditSource(); 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir // forward messages 347cdf0e10cSrcweir Broadcast( rHint ); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir } // end of namespace accessibility 351cdf0e10cSrcweir 352cdf0e10cSrcweir //------------------------------------------------------------------------ 353