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 #ifndef SC_TEXTSUNO_HXX 29*cdf0e10cSrcweir #define SC_TEXTSUNO_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "global.hxx" // ScRange, ScAddress 32*cdf0e10cSrcweir #include "address.hxx" 33*cdf0e10cSrcweir #include <editeng/unotext.hxx> 34*cdf0e10cSrcweir #include <svl/brdcst.hxx> 35*cdf0e10cSrcweir #include <svl/lstner.hxx> 36*cdf0e10cSrcweir #include <com/sun/star/text/XTextFieldsSupplier.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/sheet/XHeaderFooterContent.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 40*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 41*cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 42*cdf0e10cSrcweir #include "scdllapi.h" 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir class EditEngine; 45*cdf0e10cSrcweir class EditTextObject; 46*cdf0e10cSrcweir class SvxEditEngineForwarder; 47*cdf0e10cSrcweir class ScDocShell; 48*cdf0e10cSrcweir class ScAddress; 49*cdf0e10cSrcweir class ScCellObj; 50*cdf0e10cSrcweir class ScSimpleEditSource; 51*cdf0e10cSrcweir class ScSharedCellEditSource; 52*cdf0e10cSrcweir class ScEditEngineDefaulter; 53*cdf0e10cSrcweir class ScFieldEditEngine; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir struct ScHeaderFieldData; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #define SC_HDFT_LEFT 0 59*cdf0e10cSrcweir #define SC_HDFT_CENTER 1 60*cdf0e10cSrcweir #define SC_HDFT_RIGHT 2 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir // ScHeaderFooterContentObj ist ein dummer Container, der per setPropertyValue 64*cdf0e10cSrcweir // wieder in die Seitenvorlage geschrieben werden muss 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir class ScHeaderFooterContentObj : public cppu::WeakImplHelper3< 67*cdf0e10cSrcweir com::sun::star::sheet::XHeaderFooterContent, 68*cdf0e10cSrcweir com::sun::star::lang::XUnoTunnel, 69*cdf0e10cSrcweir com::sun::star::lang::XServiceInfo > 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir private: 72*cdf0e10cSrcweir EditTextObject* pLeftText; 73*cdf0e10cSrcweir EditTextObject* pCenterText; 74*cdf0e10cSrcweir EditTextObject* pRightText; 75*cdf0e10cSrcweir SfxBroadcaster aBC; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir ScHeaderFooterContentObj(); // disabled 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir public: 80*cdf0e10cSrcweir ScHeaderFooterContentObj( const EditTextObject* pLeft, 81*cdf0e10cSrcweir const EditTextObject* pCenter, 82*cdf0e10cSrcweir const EditTextObject* pRight ); 83*cdf0e10cSrcweir virtual ~ScHeaderFooterContentObj(); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir // fuer ScPageHFItem (per getImplementation) 86*cdf0e10cSrcweir const EditTextObject* GetLeftEditObject() const { return pLeftText; } 87*cdf0e10cSrcweir const EditTextObject* GetCenterEditObject() const { return pCenterText; } 88*cdf0e10cSrcweir const EditTextObject* GetRightEditObject() const { return pRightText; } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir void AddListener( SfxListener& rListener ); 91*cdf0e10cSrcweir void RemoveListener( SfxListener& rListener ); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir void UpdateText( sal_uInt16 nPart, EditEngine& rSource ); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir // XHeaderFooterContent 96*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 97*cdf0e10cSrcweir getLeftText() throw(::com::sun::star::uno::RuntimeException); 98*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 99*cdf0e10cSrcweir getCenterText() throw(::com::sun::star::uno::RuntimeException); 100*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 101*cdf0e10cSrcweir getRightText() throw(::com::sun::star::uno::RuntimeException); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir // XUnoTunnel 104*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< 105*cdf0e10cSrcweir sal_Int8 >& aIdentifier ) 106*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); 109*cdf0e10cSrcweir static ScHeaderFooterContentObj* getImplementation( const com::sun::star::uno::Reference< 110*cdf0e10cSrcweir com::sun::star::sheet::XHeaderFooterContent> xObj ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir // XServiceInfo 113*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 114*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 115*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 116*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 117*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 118*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir }; 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir // ScHeaderFooterTextData: shared data between sub objects of a ScHeaderFooterTextObj 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir class ScHeaderFooterTextData : public SfxListener 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir private: 127*cdf0e10cSrcweir ScHeaderFooterContentObj& rContentObj; 128*cdf0e10cSrcweir sal_uInt16 nPart; 129*cdf0e10cSrcweir ScEditEngineDefaulter* pEditEngine; 130*cdf0e10cSrcweir SvxEditEngineForwarder* pForwarder; 131*cdf0e10cSrcweir sal_Bool bDataValid; 132*cdf0e10cSrcweir sal_Bool bInUpdate; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir public: 135*cdf0e10cSrcweir ScHeaderFooterTextData( ScHeaderFooterContentObj& rContent, 136*cdf0e10cSrcweir sal_uInt16 nP ); 137*cdf0e10cSrcweir ~ScHeaderFooterTextData(); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir // helper functions 142*cdf0e10cSrcweir SvxTextForwarder* GetTextForwarder(); 143*cdf0e10cSrcweir void UpdateData(); 144*cdf0e10cSrcweir ScEditEngineDefaulter* GetEditEngine() { GetTextForwarder(); return pEditEngine; } 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir sal_uInt16 GetPart() const { return nPart; } 147*cdf0e10cSrcweir ScHeaderFooterContentObj& GetContentObj() const { return rContentObj; } 148*cdf0e10cSrcweir }; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // ScHeaderFooterTextObj veraendert den Text in einem ScHeaderFooterContentObj 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir class ScHeaderFooterTextObj : public cppu::WeakImplHelper5< 153*cdf0e10cSrcweir com::sun::star::text::XText, 154*cdf0e10cSrcweir com::sun::star::text::XTextRangeMover, 155*cdf0e10cSrcweir com::sun::star::container::XEnumerationAccess, 156*cdf0e10cSrcweir com::sun::star::text::XTextFieldsSupplier, 157*cdf0e10cSrcweir com::sun::star::lang::XServiceInfo > 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir private: 160*cdf0e10cSrcweir ScHeaderFooterTextData aTextData; 161*cdf0e10cSrcweir SvxUnoText* pUnoText; 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir void CreateUnoText_Impl(); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir public: 166*cdf0e10cSrcweir ScHeaderFooterTextObj( ScHeaderFooterContentObj& rContent, 167*cdf0e10cSrcweir sal_uInt16 nP ); 168*cdf0e10cSrcweir virtual ~ScHeaderFooterTextObj(); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir const SvxUnoText& GetUnoText(); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir static void FillDummyFieldData( ScHeaderFieldData& rData ); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir // XText 175*cdf0e10cSrcweir virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< 176*cdf0e10cSrcweir ::com::sun::star::text::XTextRange >& xRange, 177*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 178*cdf0e10cSrcweir ::com::sun::star::text::XTextContent >& xContent, 179*cdf0e10cSrcweir sal_Bool bAbsorb ) 180*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 181*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 182*cdf0e10cSrcweir virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< 183*cdf0e10cSrcweir ::com::sun::star::text::XTextContent >& xContent ) 184*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 185*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir // XSimpleText 188*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL 189*cdf0e10cSrcweir createTextCursor() throw(::com::sun::star::uno::RuntimeException); 190*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL 191*cdf0e10cSrcweir createTextCursorByRange( const ::com::sun::star::uno::Reference< 192*cdf0e10cSrcweir ::com::sun::star::text::XTextRange >& aTextPosition ) 193*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 194*cdf0e10cSrcweir virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< 195*cdf0e10cSrcweir ::com::sun::star::text::XTextRange >& xRange, 196*cdf0e10cSrcweir const ::rtl::OUString& aString, sal_Bool bAbsorb ) 197*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 198*cdf0e10cSrcweir virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< 199*cdf0e10cSrcweir ::com::sun::star::text::XTextRange >& xRange, 200*cdf0e10cSrcweir sal_Int16 nControlCharacter, sal_Bool bAbsorb ) 201*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 202*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // XTextRange 205*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 206*cdf0e10cSrcweir getText() throw(::com::sun::star::uno::RuntimeException); 207*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 208*cdf0e10cSrcweir getStart() throw(::com::sun::star::uno::RuntimeException); 209*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 210*cdf0e10cSrcweir getEnd() throw(::com::sun::star::uno::RuntimeException); 211*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); 212*cdf0e10cSrcweir virtual void SAL_CALL setString( const ::rtl::OUString& aString ) 213*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir // XTextRangeMover 216*cdf0e10cSrcweir virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< 217*cdf0e10cSrcweir ::com::sun::star::text::XTextRange >& xRange, 218*cdf0e10cSrcweir sal_Int16 nParagraphs ) 219*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir // XEnumerationAccess 222*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL 223*cdf0e10cSrcweir createEnumeration() throw(::com::sun::star::uno::RuntimeException); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir // XElementAccess 226*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() 227*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 228*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir // XTextFieldsSupplier 231*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL 232*cdf0e10cSrcweir getTextFields() throw(::com::sun::star::uno::RuntimeException); 233*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL 234*cdf0e10cSrcweir getTextFieldMasters() throw(::com::sun::star::uno::RuntimeException); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir // XServiceInfo 237*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 238*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 239*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 240*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 241*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 242*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 243*cdf0e10cSrcweir }; 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // derived cursor objects for getImplementation and getText/getStart/getEnd 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir //! uno3: SvxUnoTextCursor is not derived from XUnoTunnel, but should be (?) 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir class ScCellTextCursor : public SvxUnoTextCursor 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir ScCellObj& rTextObj; 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir public: 255*cdf0e10cSrcweir ScCellTextCursor(const ScCellTextCursor& rOther); 256*cdf0e10cSrcweir ScCellTextCursor(ScCellObj& rText); 257*cdf0e10cSrcweir virtual ~ScCellTextCursor() throw(); 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir ScCellObj& GetCellObj() const { return rTextObj; } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir // SvxUnoTextCursor methods reimplemented here: 262*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 263*cdf0e10cSrcweir getText() throw(::com::sun::star::uno::RuntimeException); 264*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 265*cdf0e10cSrcweir getStart() throw(::com::sun::star::uno::RuntimeException); 266*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 267*cdf0e10cSrcweir getEnd() throw(::com::sun::star::uno::RuntimeException); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir // XUnoTunnel 270*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< 271*cdf0e10cSrcweir sal_Int8 >& aIdentifier ) 272*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); 275*cdf0e10cSrcweir static ScCellTextCursor* getImplementation( const com::sun::star::uno::Reference< 276*cdf0e10cSrcweir com::sun::star::uno::XInterface> xObj ); 277*cdf0e10cSrcweir }; 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir class ScHeaderFooterTextCursor : public SvxUnoTextCursor 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir private: 282*cdf0e10cSrcweir ScHeaderFooterTextObj& rTextObj; 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir public: 285*cdf0e10cSrcweir ScHeaderFooterTextCursor(const ScHeaderFooterTextCursor& rOther); 286*cdf0e10cSrcweir ScHeaderFooterTextCursor(ScHeaderFooterTextObj& rText); 287*cdf0e10cSrcweir virtual ~ScHeaderFooterTextCursor() throw(); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir // SvxUnoTextCursor methods reimplemented here: 290*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 291*cdf0e10cSrcweir getText() throw(::com::sun::star::uno::RuntimeException); 292*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 293*cdf0e10cSrcweir getStart() throw(::com::sun::star::uno::RuntimeException); 294*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 295*cdf0e10cSrcweir getEnd() throw(::com::sun::star::uno::RuntimeException); 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir // XUnoTunnel 298*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< 299*cdf0e10cSrcweir sal_Int8 >& aIdentifier ) 300*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); 303*cdf0e10cSrcweir static ScHeaderFooterTextCursor* getImplementation( const com::sun::star::uno::Reference< 304*cdf0e10cSrcweir com::sun::star::uno::XInterface> xObj ); 305*cdf0e10cSrcweir }; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir class ScDrawTextCursor : public SvxUnoTextCursor 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir private: 310*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::text::XText > xParentText; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir public: 313*cdf0e10cSrcweir ScDrawTextCursor(const ScDrawTextCursor& rOther); 314*cdf0e10cSrcweir ScDrawTextCursor( const com::sun::star::uno::Reference< 315*cdf0e10cSrcweir com::sun::star::text::XText >& xParent, 316*cdf0e10cSrcweir const SvxUnoTextBase& rText ); 317*cdf0e10cSrcweir virtual ~ScDrawTextCursor() throw(); 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir // SvxUnoTextCursor methods reimplemented here: 320*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 321*cdf0e10cSrcweir getText() throw(::com::sun::star::uno::RuntimeException); 322*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 323*cdf0e10cSrcweir getStart() throw(::com::sun::star::uno::RuntimeException); 324*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 325*cdf0e10cSrcweir getEnd() throw(::com::sun::star::uno::RuntimeException); 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir // XUnoTunnel 328*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< 329*cdf0e10cSrcweir sal_Int8 >& aIdentifier ) 330*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); 333*cdf0e10cSrcweir static ScDrawTextCursor* getImplementation( const com::sun::star::uno::Reference< 334*cdf0e10cSrcweir com::sun::star::uno::XInterface> xObj ); 335*cdf0e10cSrcweir }; 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir // ScAnnotationTextCursor isn't needed anymore - SvxUnoTextCursor is used instead 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir // ScEditEngineTextObj for formatted cell content that is not inserted in a cell or header/footer 342*cdf0e10cSrcweir // (used for XML export of change tracking contents) 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir class ScSimpleEditSourceHelper 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir ScEditEngineDefaulter* pEditEngine; 347*cdf0e10cSrcweir SvxEditEngineForwarder* pForwarder; 348*cdf0e10cSrcweir ScSimpleEditSource* pOriginalSource; 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir public: 351*cdf0e10cSrcweir ScSimpleEditSourceHelper(); 352*cdf0e10cSrcweir ~ScSimpleEditSourceHelper(); 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir ScSimpleEditSource* GetOriginalSource() const { return pOriginalSource; } 355*cdf0e10cSrcweir ScEditEngineDefaulter* GetEditEngine() const { return pEditEngine; } 356*cdf0e10cSrcweir }; 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir class ScEditEngineTextObj : public ScSimpleEditSourceHelper, public SvxUnoText 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir public: 361*cdf0e10cSrcweir ScEditEngineTextObj(); 362*cdf0e10cSrcweir virtual ~ScEditEngineTextObj() throw(); 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir void SetText( const EditTextObject& rTextObject ); 365*cdf0e10cSrcweir EditTextObject* CreateTextObject(); 366*cdf0e10cSrcweir }; 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir // ScCellTextData: shared data between sub objects of a cell text object 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir class ScCellTextData : public SfxListener 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir protected: 374*cdf0e10cSrcweir ScDocShell* pDocShell; 375*cdf0e10cSrcweir ScAddress aCellPos; 376*cdf0e10cSrcweir ScFieldEditEngine* pEditEngine; 377*cdf0e10cSrcweir SvxEditEngineForwarder* pForwarder; 378*cdf0e10cSrcweir ScSharedCellEditSource* pOriginalSource; 379*cdf0e10cSrcweir sal_Bool bDataValid; 380*cdf0e10cSrcweir sal_Bool bInUpdate; 381*cdf0e10cSrcweir sal_Bool bDirty; 382*cdf0e10cSrcweir sal_Bool bDoUpdate; 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir protected: 385*cdf0e10cSrcweir virtual void GetCellText(const ScAddress& rCellPos, String& rText); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir public: 388*cdf0e10cSrcweir ScCellTextData(ScDocShell* pDocSh, const ScAddress& rP); 389*cdf0e10cSrcweir virtual ~ScCellTextData(); 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir // helper functions for ScSharedCellEditSource: 394*cdf0e10cSrcweir virtual SvxTextForwarder* GetTextForwarder(); 395*cdf0e10cSrcweir void UpdateData(); 396*cdf0e10cSrcweir ScFieldEditEngine* GetEditEngine() { GetTextForwarder(); return pEditEngine; } 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir ScSharedCellEditSource* GetOriginalSource(); // used as argument for SvxUnoText ctor 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir // used for ScCellEditSource: 401*cdf0e10cSrcweir ScDocShell* GetDocShell() const { return pDocShell; } 402*cdf0e10cSrcweir const ScAddress& GetCellPos() const { return aCellPos; } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir void SetDirty(sal_Bool bValue) { bDirty = bValue; } 405*cdf0e10cSrcweir sal_Bool IsDirty() const { return bDirty; } 406*cdf0e10cSrcweir void SetDoUpdate(sal_Bool bValue) { bDoUpdate = bValue; } 407*cdf0e10cSrcweir }; 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir class ScCellTextObj : public ScCellTextData, public SvxUnoText 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir public: 412*cdf0e10cSrcweir ScCellTextObj(ScDocShell* pDocSh, const ScAddress& rP); 413*cdf0e10cSrcweir virtual ~ScCellTextObj() throw(); 414*cdf0e10cSrcweir }; 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir #endif 418*cdf0e10cSrcweir 419