138d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 338d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 438d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 538d50f7bSAndrew Rist * distributed with this work for additional information 638d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 738d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 838d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 938d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 1038d50f7bSAndrew Rist * 1138d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1238d50f7bSAndrew Rist * 1338d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 1438d50f7bSAndrew Rist * software distributed under the License is distributed on an 1538d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1638d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 1738d50f7bSAndrew Rist * specific language governing permissions and limitations 1838d50f7bSAndrew Rist * under the License. 1938d50f7bSAndrew Rist * 2038d50f7bSAndrew Rist *************************************************************/ 2138d50f7bSAndrew Rist 2238d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SC_ACCESSIBLETEXT_HXX 25cdf0e10cSrcweir #define _SC_ACCESSIBLETEXT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "textuno.hxx" 28cdf0e10cSrcweir #include "global.hxx" 29cdf0e10cSrcweir #include "viewdata.hxx" 30cdf0e10cSrcweir #include <editeng/svxenum.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <memory> 33cdf0e10cSrcweir 34cdf0e10cSrcweir class ScDocShell; 35cdf0e10cSrcweir class ScViewForwarder; 36cdf0e10cSrcweir class ScEditObjectViewForwarder; 37cdf0e10cSrcweir class ScPreviewViewForwarder; 38cdf0e10cSrcweir class ScEditViewForwarder; 39cdf0e10cSrcweir class ScPreviewShell; 40cdf0e10cSrcweir class EditTextObject; 41cdf0e10cSrcweir class ScCsvViewForwarder; 42cdf0e10cSrcweir class ScAccessibleCell; 43cdf0e10cSrcweir 44cdf0e10cSrcweir 45cdf0e10cSrcweir // ============================================================================ 46cdf0e10cSrcweir 47cdf0e10cSrcweir class ScAccessibleTextData : public SfxListener 48cdf0e10cSrcweir { 49cdf0e10cSrcweir public: 50cdf0e10cSrcweir ScAccessibleTextData() {} 51cdf0e10cSrcweir virtual ~ScAccessibleTextData() {} 52cdf0e10cSrcweir 53cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const = 0; 54cdf0e10cSrcweir 55cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ ) {} 56cdf0e10cSrcweir 57cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder() = 0; 58cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder() = 0; 59cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate ) = 0; 60cdf0e10cSrcweir virtual SfxBroadcaster& GetBroadcaster() const { return maBroadcaster; } 61cdf0e10cSrcweir 62cdf0e10cSrcweir virtual void UpdateData() = 0; 63cdf0e10cSrcweir virtual void SetDoUpdate(sal_Bool bValue) = 0; 64cdf0e10cSrcweir virtual sal_Bool IsDirty() const = 0; 65cdf0e10cSrcweir 66cdf0e10cSrcweir private: 67cdf0e10cSrcweir mutable SfxBroadcaster maBroadcaster; 68cdf0e10cSrcweir 69cdf0e10cSrcweir // prevent the using of this method of the base class 70cdf0e10cSrcweir ScSharedCellEditSource* GetOriginalSource() { return NULL; } 71cdf0e10cSrcweir }; 72cdf0e10cSrcweir 73cdf0e10cSrcweir 74cdf0e10cSrcweir // ============================================================================ 75cdf0e10cSrcweir 76cdf0e10cSrcweir class ScAccessibleCellBaseTextData : public ScAccessibleTextData, 77cdf0e10cSrcweir public ScCellTextData 78cdf0e10cSrcweir { 79cdf0e10cSrcweir public: 80cdf0e10cSrcweir ScAccessibleCellBaseTextData(ScDocShell* pDocShellP, 81cdf0e10cSrcweir const ScAddress& rP) 82cdf0e10cSrcweir : ScCellTextData(pDocShellP, rP) {} 83cdf0e10cSrcweir virtual ~ScAccessibleCellBaseTextData() {} 84cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { ScCellTextData::Notify(rBC, rHint); } 85cdf0e10cSrcweir 86cdf0e10cSrcweir virtual void UpdateData() { ScCellTextData::UpdateData(); } 87cdf0e10cSrcweir virtual void SetDoUpdate(sal_Bool bValue) { ScCellTextData::SetDoUpdate(bValue); } 88cdf0e10cSrcweir virtual sal_Bool IsDirty() const { return ScCellTextData::IsDirty(); } 89cdf0e10cSrcweir }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir 92cdf0e10cSrcweir // ============================================================================ 93cdf0e10cSrcweir 94cdf0e10cSrcweir // ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object 95cdf0e10cSrcweir 96cdf0e10cSrcweir class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData 97cdf0e10cSrcweir { 98cdf0e10cSrcweir public: 99cdf0e10cSrcweir ScAccessibleCellTextData(ScTabViewShell* pViewShell, 100cdf0e10cSrcweir const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell); 101cdf0e10cSrcweir virtual ~ScAccessibleCellTextData(); 102cdf0e10cSrcweir 103cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 104cdf0e10cSrcweir 105cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 108cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 109cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir DECL_LINK( NotifyHdl, EENotify* ); 112cdf0e10cSrcweir protected: 113cdf0e10cSrcweir virtual void GetCellText(const ScAddress& rCellPos, String& rText); 114cdf0e10cSrcweir private: 115cdf0e10cSrcweir ScViewForwarder* mpViewForwarder; 116cdf0e10cSrcweir ScEditViewForwarder* mpEditViewForwarder; 117cdf0e10cSrcweir ScTabViewShell* mpViewShell; 118cdf0e10cSrcweir ScSplitPos meSplitPos; 119cdf0e10cSrcweir sal_Bool mbViewEditEngine; 120cdf0e10cSrcweir ScAccessibleCell* mpAccessibleCell; 121cdf0e10cSrcweir 122cdf0e10cSrcweir // prevent the using of this method of the base class 123cdf0e10cSrcweir ScSharedCellEditSource* GetOriginalSource() { return NULL; } 124cdf0e10cSrcweir 125cdf0e10cSrcweir using ScAccessibleCellBaseTextData::GetDocShell; 126cdf0e10cSrcweir ScDocShell* GetDocShell(ScTabViewShell* pViewShell); 127cdf0e10cSrcweir }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir 130cdf0e10cSrcweir // ============================================================================ 131cdf0e10cSrcweir 132cdf0e10cSrcweir class ScAccessibleEditObjectTextData : public ScAccessibleTextData 133cdf0e10cSrcweir { 134cdf0e10cSrcweir public: 135*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 136*0deba7fbSSteve Yin // Solution: Add a para to indicate whether the object is cloned 137*0deba7fbSSteve Yin //ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin); 138*0deba7fbSSteve Yin ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin, sal_Bool isClone=sal_False); 139*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 140cdf0e10cSrcweir virtual ~ScAccessibleEditObjectTextData(); 141cdf0e10cSrcweir 142cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 143cdf0e10cSrcweir 144cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 147cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 148cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir virtual void UpdateData() { } 151cdf0e10cSrcweir virtual void SetDoUpdate(sal_Bool /* bValue */) { } 152cdf0e10cSrcweir virtual sal_Bool IsDirty() const { return sal_False; } 153cdf0e10cSrcweir 154cdf0e10cSrcweir DECL_LINK( NotifyHdl, EENotify* ); 155cdf0e10cSrcweir protected: 156cdf0e10cSrcweir ScEditObjectViewForwarder* mpViewForwarder; 157cdf0e10cSrcweir ScEditViewForwarder* mpEditViewForwarder; 158cdf0e10cSrcweir EditView* mpEditView; 159cdf0e10cSrcweir EditEngine* mpEditEngine; 160cdf0e10cSrcweir SvxEditEngineForwarder* mpForwarder; 161cdf0e10cSrcweir Window* mpWindow; 162*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 163*0deba7fbSSteve Yin sal_Bool mbIsCloned; 164*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 165cdf0e10cSrcweir }; 166cdf0e10cSrcweir 167cdf0e10cSrcweir 168cdf0e10cSrcweir // ============================================================================ 169cdf0e10cSrcweir 170cdf0e10cSrcweir class ScAccessibleEditLineTextData : public ScAccessibleEditObjectTextData 171cdf0e10cSrcweir { 172cdf0e10cSrcweir public: 173cdf0e10cSrcweir ScAccessibleEditLineTextData(EditView* pEditView, Window* pWin); 174cdf0e10cSrcweir virtual ~ScAccessibleEditLineTextData(); 175cdf0e10cSrcweir 176cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 177cdf0e10cSrcweir 178cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 179cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate ); 180cdf0e10cSrcweir 181cdf0e10cSrcweir void Dispose(); 182cdf0e10cSrcweir void TextChanged(); 183cdf0e10cSrcweir void StartEdit(); 184cdf0e10cSrcweir void EndEdit(); 185cdf0e10cSrcweir private: 186cdf0e10cSrcweir void ResetEditMode(); 187cdf0e10cSrcweir 188cdf0e10cSrcweir sal_Bool mbEditEngineCreated; 189cdf0e10cSrcweir }; 190cdf0e10cSrcweir 191cdf0e10cSrcweir 192cdf0e10cSrcweir // ============================================================================ 193cdf0e10cSrcweir 194cdf0e10cSrcweir class ScAccessiblePreviewCellTextData : public ScAccessibleCellBaseTextData 195cdf0e10cSrcweir { 196cdf0e10cSrcweir public: 197cdf0e10cSrcweir ScAccessiblePreviewCellTextData(ScPreviewShell* pViewShell, 198cdf0e10cSrcweir const ScAddress& rP); 199cdf0e10cSrcweir virtual ~ScAccessiblePreviewCellTextData(); 200cdf0e10cSrcweir 201cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 202cdf0e10cSrcweir 203cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 204cdf0e10cSrcweir 205cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 206cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 207cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; } 208cdf0e10cSrcweir 209cdf0e10cSrcweir //UNUSED2008-05 DECL_LINK( NotifyHdl, EENotify* ); 210cdf0e10cSrcweir private: 211cdf0e10cSrcweir ScPreviewViewForwarder* mpViewForwarder; 212cdf0e10cSrcweir ScPreviewShell* mpViewShell; 213cdf0e10cSrcweir 214cdf0e10cSrcweir // prevent the using of this method of the base class 215cdf0e10cSrcweir ScSharedCellEditSource* GetOriginalSource() { return NULL; } 216cdf0e10cSrcweir 217cdf0e10cSrcweir using ScAccessibleCellBaseTextData::GetDocShell; 218cdf0e10cSrcweir ScDocShell* GetDocShell(ScPreviewShell* pViewShell); 219cdf0e10cSrcweir }; 220cdf0e10cSrcweir 221cdf0e10cSrcweir 222cdf0e10cSrcweir // ============================================================================ 223cdf0e10cSrcweir 224cdf0e10cSrcweir class ScAccessiblePreviewHeaderCellTextData : public ScAccessibleCellBaseTextData 225cdf0e10cSrcweir { 226cdf0e10cSrcweir public: 227cdf0e10cSrcweir ScAccessiblePreviewHeaderCellTextData(ScPreviewShell* pViewShell, 228cdf0e10cSrcweir const String& rText, const ScAddress& rP, sal_Bool bColHeader, sal_Bool bRowHeader); 229cdf0e10cSrcweir virtual ~ScAccessiblePreviewHeaderCellTextData(); 230cdf0e10cSrcweir 231cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 232cdf0e10cSrcweir 233cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 234cdf0e10cSrcweir 235cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 236cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 237cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; } 238cdf0e10cSrcweir 239cdf0e10cSrcweir //UNUSED2008-05 DECL_LINK( NotifyHdl, EENotify* ); 240cdf0e10cSrcweir private: 241cdf0e10cSrcweir ScPreviewViewForwarder* mpViewForwarder; 242cdf0e10cSrcweir ScPreviewShell* mpViewShell; 243cdf0e10cSrcweir String maText; 244cdf0e10cSrcweir sal_Bool mbColHeader; 245cdf0e10cSrcweir sal_Bool mbRowHeader; 246cdf0e10cSrcweir 247cdf0e10cSrcweir // prevent the using of this method of the base class 248cdf0e10cSrcweir ScSharedCellEditSource* GetOriginalSource() { return NULL; } 249cdf0e10cSrcweir 250cdf0e10cSrcweir using ScAccessibleCellBaseTextData::GetDocShell; 251cdf0e10cSrcweir ScDocShell* GetDocShell(ScPreviewShell* pViewShell); 252cdf0e10cSrcweir }; 253cdf0e10cSrcweir 254cdf0e10cSrcweir 255cdf0e10cSrcweir // ============================================================================ 256cdf0e10cSrcweir 257cdf0e10cSrcweir class ScAccessibleHeaderTextData : public ScAccessibleTextData 258cdf0e10cSrcweir { 259cdf0e10cSrcweir public: 260cdf0e10cSrcweir ScAccessibleHeaderTextData(ScPreviewShell* pViewShell, 261cdf0e10cSrcweir const EditTextObject* pEditObj, sal_Bool bHeader, SvxAdjust eAdjust); 262cdf0e10cSrcweir virtual ~ScAccessibleHeaderTextData(); 263cdf0e10cSrcweir 264cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 265cdf0e10cSrcweir 266cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 267cdf0e10cSrcweir 268cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 269cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 270cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; } 271cdf0e10cSrcweir 272cdf0e10cSrcweir virtual void UpdateData() { } 273cdf0e10cSrcweir virtual void SetDoUpdate(sal_Bool /* bValue */) { } 274cdf0e10cSrcweir virtual sal_Bool IsDirty() const { return sal_False; } 275cdf0e10cSrcweir private: 276cdf0e10cSrcweir ScPreviewViewForwarder* mpViewForwarder; 277cdf0e10cSrcweir ScPreviewShell* mpViewShell; 278cdf0e10cSrcweir ScEditEngineDefaulter* mpEditEngine; 279cdf0e10cSrcweir SvxEditEngineForwarder* mpForwarder; 280cdf0e10cSrcweir ScDocShell* mpDocSh; 281cdf0e10cSrcweir const EditTextObject* mpEditObj; 282cdf0e10cSrcweir sal_Bool mbHeader; 283cdf0e10cSrcweir sal_Bool mbDataValid; 284cdf0e10cSrcweir SvxAdjust meAdjust; 285cdf0e10cSrcweir }; 286cdf0e10cSrcweir 287cdf0e10cSrcweir 288cdf0e10cSrcweir // ============================================================================ 289cdf0e10cSrcweir 290cdf0e10cSrcweir class ScAccessibleNoteTextData : public ScAccessibleTextData 291cdf0e10cSrcweir { 292cdf0e10cSrcweir public: 293cdf0e10cSrcweir ScAccessibleNoteTextData(ScPreviewShell* pViewShell, 294cdf0e10cSrcweir const String& sText, const ScAddress& aCellPos, sal_Bool bMarkNote); 295cdf0e10cSrcweir virtual ~ScAccessibleNoteTextData(); 296cdf0e10cSrcweir 297cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 298cdf0e10cSrcweir 299cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 300cdf0e10cSrcweir 301cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 302cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 303cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; } 304cdf0e10cSrcweir 305cdf0e10cSrcweir virtual void UpdateData() { } 306cdf0e10cSrcweir virtual void SetDoUpdate(sal_Bool /* bValue */) { } 307cdf0e10cSrcweir virtual sal_Bool IsDirty() const { return sal_False; } 308cdf0e10cSrcweir private: 309cdf0e10cSrcweir ScPreviewViewForwarder* mpViewForwarder; 310cdf0e10cSrcweir ScPreviewShell* mpViewShell; 311cdf0e10cSrcweir ScEditEngineDefaulter* mpEditEngine; 312cdf0e10cSrcweir SvxEditEngineForwarder* mpForwarder; 313cdf0e10cSrcweir ScDocShell* mpDocSh; 314cdf0e10cSrcweir String msText; 315cdf0e10cSrcweir ScAddress maCellPos; 316cdf0e10cSrcweir sal_Bool mbMarkNote; 317cdf0e10cSrcweir sal_Bool mbDataValid; 318cdf0e10cSrcweir }; 319cdf0e10cSrcweir 320cdf0e10cSrcweir 321cdf0e10cSrcweir // ============================================================================ 322cdf0e10cSrcweir 323cdf0e10cSrcweir class ScAccessibleCsvTextData : public ScAccessibleTextData 324cdf0e10cSrcweir { 325cdf0e10cSrcweir private: 326cdf0e10cSrcweir typedef ::std::auto_ptr< SvxTextForwarder > TextForwarderPtr; 327cdf0e10cSrcweir typedef ::std::auto_ptr< ScCsvViewForwarder > ViewForwarderPtr; 328cdf0e10cSrcweir 329cdf0e10cSrcweir Window* mpWindow; 330cdf0e10cSrcweir EditEngine* mpEditEngine; 331cdf0e10cSrcweir TextForwarderPtr mpTextForwarder; 332cdf0e10cSrcweir ViewForwarderPtr mpViewForwarder; 333cdf0e10cSrcweir String maCellText; 334cdf0e10cSrcweir Rectangle maBoundBox; 335cdf0e10cSrcweir Size maCellSize; 336cdf0e10cSrcweir 337cdf0e10cSrcweir public: 338cdf0e10cSrcweir explicit ScAccessibleCsvTextData( 339cdf0e10cSrcweir Window* pWindow, 340cdf0e10cSrcweir EditEngine* pEditEngine, 341cdf0e10cSrcweir const String& rCellText, 342cdf0e10cSrcweir const Rectangle& rBoundBox, 343cdf0e10cSrcweir const Size& rCellSize ); 344cdf0e10cSrcweir virtual ~ScAccessibleCsvTextData(); 345cdf0e10cSrcweir 346cdf0e10cSrcweir virtual ScAccessibleTextData* Clone() const; 347cdf0e10cSrcweir 348cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 349cdf0e10cSrcweir 350cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 351cdf0e10cSrcweir virtual SvxViewForwarder* GetViewForwarder(); 352cdf0e10cSrcweir virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate ); 353cdf0e10cSrcweir 354cdf0e10cSrcweir virtual void UpdateData() {} 355cdf0e10cSrcweir virtual void SetDoUpdate( sal_Bool /* bValue */ ) {} 356cdf0e10cSrcweir virtual sal_Bool IsDirty() const { return sal_False; } 357cdf0e10cSrcweir }; 358cdf0e10cSrcweir 359cdf0e10cSrcweir 360cdf0e10cSrcweir // ============================================================================ 361cdf0e10cSrcweir 362cdf0e10cSrcweir #endif 363