1*b3f79822SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*b3f79822SAndrew Rist * distributed with this work for additional information 6*b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*b3f79822SAndrew Rist * "License"); you may not use this file except in compliance 9*b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*b3f79822SAndrew Rist * software distributed under the License is distributed on an 15*b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b3f79822SAndrew Rist * KIND, either express or implied. See the License for the 17*b3f79822SAndrew Rist * specific language governing permissions and limitations 18*b3f79822SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*b3f79822SAndrew Rist *************************************************************/ 21*b3f79822SAndrew Rist 22*b3f79822SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sc.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "scitems.hxx" 30cdf0e10cSrcweir #include <editeng/eeitem.hxx> 31cdf0e10cSrcweir #include <svx/svdpool.hxx> 32cdf0e10cSrcweir #include <svx/svdobj.hxx> 33cdf0e10cSrcweir #include <editeng/editeng.hxx> 34cdf0e10cSrcweir #include <editeng/editobj.hxx> 35cdf0e10cSrcweir #include <editeng/flditem.hxx> 36cdf0e10cSrcweir #include <svx/unomid.hxx> 37cdf0e10cSrcweir #include <editeng/unoprnms.hxx> 38cdf0e10cSrcweir #include <editeng/unofored.hxx> 39cdf0e10cSrcweir #include <rtl/uuid.h> 40cdf0e10cSrcweir #include <vcl/virdev.hxx> 41cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 44cdf0e10cSrcweir #include <editeng/unoipset.hxx> 45cdf0e10cSrcweir #include "textuno.hxx" 46cdf0e10cSrcweir #include "fielduno.hxx" 47cdf0e10cSrcweir #include "servuno.hxx" 48cdf0e10cSrcweir #include "editsrc.hxx" 49cdf0e10cSrcweir #include "docsh.hxx" 50cdf0e10cSrcweir #include "editutil.hxx" 51cdf0e10cSrcweir #include "unoguard.hxx" 52cdf0e10cSrcweir #include "miscuno.hxx" 53cdf0e10cSrcweir #include "cellsuno.hxx" 54cdf0e10cSrcweir #include "hints.hxx" 55cdf0e10cSrcweir #include "patattr.hxx" 56cdf0e10cSrcweir #include "cell.hxx" 57cdf0e10cSrcweir #include "docfunc.hxx" 58cdf0e10cSrcweir #include "scmod.hxx" 59cdf0e10cSrcweir 60cdf0e10cSrcweir using namespace com::sun::star; 61cdf0e10cSrcweir 62cdf0e10cSrcweir //------------------------------------------------------------------------ 63cdf0e10cSrcweir 64cdf0e10cSrcweir const SvxItemPropertySet * lcl_GetHdFtPropertySet() 65cdf0e10cSrcweir { 66cdf0e10cSrcweir static SfxItemPropertyMapEntry aHdFtPropertyMap_Impl[] = 67cdf0e10cSrcweir { 68cdf0e10cSrcweir SVX_UNOEDIT_CHAR_PROPERTIES, 69cdf0e10cSrcweir SVX_UNOEDIT_FONT_PROPERTIES, 70cdf0e10cSrcweir SVX_UNOEDIT_PARA_PROPERTIES, 71cdf0e10cSrcweir SVX_UNOEDIT_NUMBERING_PROPERTIE, // for completeness of service ParagraphProperties 72cdf0e10cSrcweir {0,0,0,0,0,0} 73cdf0e10cSrcweir }; 74cdf0e10cSrcweir static sal_Bool bTwipsSet = sal_False; 75cdf0e10cSrcweir 76cdf0e10cSrcweir if (!bTwipsSet) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir // modify PropertyMap to include CONVERT_TWIPS flag for font height 79cdf0e10cSrcweir // (headers/footers are in twips) 80cdf0e10cSrcweir 81cdf0e10cSrcweir SfxItemPropertyMapEntry* pEntry = aHdFtPropertyMap_Impl; 82cdf0e10cSrcweir while (pEntry->pName) 83cdf0e10cSrcweir { 84cdf0e10cSrcweir if ( ( pEntry->nWID == EE_CHAR_FONTHEIGHT || 85cdf0e10cSrcweir pEntry->nWID == EE_CHAR_FONTHEIGHT_CJK || 86cdf0e10cSrcweir pEntry->nWID == EE_CHAR_FONTHEIGHT_CTL ) && 87cdf0e10cSrcweir pEntry->nMemberId == MID_FONTHEIGHT ) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir pEntry->nMemberId |= CONVERT_TWIPS; 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir ++pEntry; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir bTwipsSet = sal_True; 95cdf0e10cSrcweir } 96cdf0e10cSrcweir static SvxItemPropertySet aHdFtPropertySet_Impl( aHdFtPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() ); 97cdf0e10cSrcweir return &aHdFtPropertySet_Impl; 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir //------------------------------------------------------------------------ 101cdf0e10cSrcweir 102cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScHeaderFooterContentObj, "ScHeaderFooterContentObj", "com.sun.star.sheet.HeaderFooterContent" ) 103cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScHeaderFooterTextObj, "ScHeaderFooterTextObj", "stardiv.one.Text.Text" ) 104cdf0e10cSrcweir 105cdf0e10cSrcweir //------------------------------------------------------------------------ 106cdf0e10cSrcweir 107cdf0e10cSrcweir ScHeaderFooterContentObj::ScHeaderFooterContentObj( const EditTextObject* pLeft, 108cdf0e10cSrcweir const EditTextObject* pCenter, 109cdf0e10cSrcweir const EditTextObject* pRight ) : 110cdf0e10cSrcweir pLeftText ( NULL ), 111cdf0e10cSrcweir pCenterText ( NULL ), 112cdf0e10cSrcweir pRightText ( NULL ) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir if ( pLeft ) 115cdf0e10cSrcweir pLeftText = pLeft->Clone(); 116cdf0e10cSrcweir if ( pCenter ) 117cdf0e10cSrcweir pCenterText = pCenter->Clone(); 118cdf0e10cSrcweir if ( pRight ) 119cdf0e10cSrcweir pRightText = pRight->Clone(); 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir ScHeaderFooterContentObj::~ScHeaderFooterContentObj() 123cdf0e10cSrcweir { 124cdf0e10cSrcweir delete pLeftText; 125cdf0e10cSrcweir delete pCenterText; 126cdf0e10cSrcweir delete pRightText; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir void ScHeaderFooterContentObj::AddListener( SfxListener& rListener ) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir rListener.StartListening( aBC ); 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir void ScHeaderFooterContentObj::RemoveListener( SfxListener& rListener ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir rListener.EndListening( aBC ); 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir void ScHeaderFooterContentObj::UpdateText( sal_uInt16 nPart, EditEngine& rSource ) 140cdf0e10cSrcweir { 141cdf0e10cSrcweir EditTextObject* pNew = rSource.CreateTextObject(); 142cdf0e10cSrcweir switch (nPart) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir case SC_HDFT_LEFT: 145cdf0e10cSrcweir delete pLeftText; 146cdf0e10cSrcweir pLeftText = pNew; 147cdf0e10cSrcweir break; 148cdf0e10cSrcweir case SC_HDFT_CENTER: 149cdf0e10cSrcweir delete pCenterText; 150cdf0e10cSrcweir pCenterText = pNew; 151cdf0e10cSrcweir break; 152cdf0e10cSrcweir default: // SC_HDFT_RIGHT 153cdf0e10cSrcweir delete pRightText; 154cdf0e10cSrcweir pRightText = pNew; 155cdf0e10cSrcweir break; 156cdf0e10cSrcweir } 157cdf0e10cSrcweir 158cdf0e10cSrcweir aBC.Broadcast( ScHeaderFooterChangedHint( nPart ) ); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir // XHeaderFooterContent 162cdf0e10cSrcweir 163cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getLeftText() 164cdf0e10cSrcweir throw(uno::RuntimeException) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir ScUnoGuard aGuard; 167cdf0e10cSrcweir return new ScHeaderFooterTextObj( *this, SC_HDFT_LEFT ); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getCenterText() 171cdf0e10cSrcweir throw(uno::RuntimeException) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir ScUnoGuard aGuard; 174cdf0e10cSrcweir return new ScHeaderFooterTextObj( *this, SC_HDFT_CENTER ); 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getRightText() 178cdf0e10cSrcweir throw(uno::RuntimeException) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir ScUnoGuard aGuard; 181cdf0e10cSrcweir return new ScHeaderFooterTextObj( *this, SC_HDFT_RIGHT ); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir // XUnoTunnel 185cdf0e10cSrcweir 186cdf0e10cSrcweir sal_Int64 SAL_CALL ScHeaderFooterContentObj::getSomething( 187cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir if ( rId.getLength() == 16 && 190cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 191cdf0e10cSrcweir rId.getConstArray(), 16 ) ) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir return 0; 196cdf0e10cSrcweir } 197cdf0e10cSrcweir 198cdf0e10cSrcweir // static 199cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScHeaderFooterContentObj::getUnoTunnelId() 200cdf0e10cSrcweir { 201cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0; 202cdf0e10cSrcweir if( !pSeq ) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); 205cdf0e10cSrcweir if( !pSeq ) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 ); 208cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); 209cdf0e10cSrcweir pSeq = &aSeq; 210cdf0e10cSrcweir } 211cdf0e10cSrcweir } 212cdf0e10cSrcweir return *pSeq; 213cdf0e10cSrcweir } 214cdf0e10cSrcweir 215cdf0e10cSrcweir // static 216cdf0e10cSrcweir ScHeaderFooterContentObj* ScHeaderFooterContentObj::getImplementation( 217cdf0e10cSrcweir const uno::Reference<sheet::XHeaderFooterContent> xObj ) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir ScHeaderFooterContentObj* pRet = NULL; 220cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY ); 221cdf0e10cSrcweir if (xUT.is()) 222cdf0e10cSrcweir pRet = reinterpret_cast<ScHeaderFooterContentObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId()))); 223cdf0e10cSrcweir return pRet; 224cdf0e10cSrcweir } 225cdf0e10cSrcweir 226cdf0e10cSrcweir 227cdf0e10cSrcweir //------------------------------------------------------------------------ 228cdf0e10cSrcweir 229cdf0e10cSrcweir ScHeaderFooterTextData::ScHeaderFooterTextData( ScHeaderFooterContentObj& rContent, 230cdf0e10cSrcweir sal_uInt16 nP ) : 231cdf0e10cSrcweir rContentObj( rContent ), 232cdf0e10cSrcweir nPart( nP ), 233cdf0e10cSrcweir pEditEngine( NULL ), 234cdf0e10cSrcweir pForwarder( NULL ), 235cdf0e10cSrcweir bDataValid( sal_False ), 236cdf0e10cSrcweir bInUpdate( sal_False ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir rContentObj.acquire(); // must not go away 239cdf0e10cSrcweir rContentObj.AddListener( *this ); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir ScHeaderFooterTextData::~ScHeaderFooterTextData() 243cdf0e10cSrcweir { 244cdf0e10cSrcweir ScUnoGuard aGuard; // needed for EditEngine dtor 245cdf0e10cSrcweir 246cdf0e10cSrcweir rContentObj.RemoveListener( *this ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir delete pForwarder; 249cdf0e10cSrcweir delete pEditEngine; 250cdf0e10cSrcweir 251cdf0e10cSrcweir rContentObj.release(); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir 254cdf0e10cSrcweir void ScHeaderFooterTextData::Notify( SfxBroadcaster&, const SfxHint& rHint ) 255cdf0e10cSrcweir { 256cdf0e10cSrcweir if ( rHint.ISA( ScHeaderFooterChangedHint ) ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir if ( ((const ScHeaderFooterChangedHint&)rHint).GetPart() == nPart ) 259cdf0e10cSrcweir { 260cdf0e10cSrcweir if (!bInUpdate) // not for own updates 261cdf0e10cSrcweir bDataValid = sal_False; // text has to be fetched again 262cdf0e10cSrcweir } 263cdf0e10cSrcweir } 264cdf0e10cSrcweir } 265cdf0e10cSrcweir 266cdf0e10cSrcweir SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() 267cdf0e10cSrcweir { 268cdf0e10cSrcweir if (!pEditEngine) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir SfxItemPool* pEnginePool = EditEngine::CreatePool(); 271cdf0e10cSrcweir pEnginePool->FreezeIdRanges(); 272cdf0e10cSrcweir ScHeaderEditEngine* pHdrEngine = new ScHeaderEditEngine( pEnginePool, sal_True ); 273cdf0e10cSrcweir 274cdf0e10cSrcweir pHdrEngine->EnableUndo( sal_False ); 275cdf0e10cSrcweir pHdrEngine->SetRefMapMode( MAP_TWIP ); 276cdf0e10cSrcweir 277cdf0e10cSrcweir // default font must be set, independently of document 278cdf0e10cSrcweir // -> use global pool from module 279cdf0e10cSrcweir 280cdf0e10cSrcweir SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); 281cdf0e10cSrcweir const ScPatternAttr& rPattern = (const ScPatternAttr&)SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN); 282cdf0e10cSrcweir rPattern.FillEditItemSet( &aDefaults ); 283cdf0e10cSrcweir // FillEditItemSet adjusts font height to 1/100th mm, 284cdf0e10cSrcweir // but for header/footer twips is needed, as in the PatternAttr: 285cdf0e10cSrcweir aDefaults.Put( rPattern.GetItem(ATTR_FONT_HEIGHT), EE_CHAR_FONTHEIGHT ); 286cdf0e10cSrcweir aDefaults.Put( rPattern.GetItem(ATTR_CJK_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CJK ); 287cdf0e10cSrcweir aDefaults.Put( rPattern.GetItem(ATTR_CTL_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CTL ); 288cdf0e10cSrcweir pHdrEngine->SetDefaults( aDefaults ); 289cdf0e10cSrcweir 290cdf0e10cSrcweir ScHeaderFieldData aData; 291cdf0e10cSrcweir ScHeaderFooterTextObj::FillDummyFieldData( aData ); 292cdf0e10cSrcweir pHdrEngine->SetData( aData ); 293cdf0e10cSrcweir 294cdf0e10cSrcweir pEditEngine = pHdrEngine; 295cdf0e10cSrcweir pForwarder = new SvxEditEngineForwarder(*pEditEngine); 296cdf0e10cSrcweir } 297cdf0e10cSrcweir 298cdf0e10cSrcweir if (bDataValid) 299cdf0e10cSrcweir return pForwarder; 300cdf0e10cSrcweir 301cdf0e10cSrcweir const EditTextObject* pData; 302cdf0e10cSrcweir if (nPart == SC_HDFT_LEFT) 303cdf0e10cSrcweir pData = rContentObj.GetLeftEditObject(); 304cdf0e10cSrcweir else if (nPart == SC_HDFT_CENTER) 305cdf0e10cSrcweir pData = rContentObj.GetCenterEditObject(); 306cdf0e10cSrcweir else 307cdf0e10cSrcweir pData = rContentObj.GetRightEditObject(); 308cdf0e10cSrcweir 309cdf0e10cSrcweir if (pData) 310cdf0e10cSrcweir pEditEngine->SetText(*pData); 311cdf0e10cSrcweir 312cdf0e10cSrcweir bDataValid = sal_True; 313cdf0e10cSrcweir return pForwarder; 314cdf0e10cSrcweir } 315cdf0e10cSrcweir 316cdf0e10cSrcweir void ScHeaderFooterTextData::UpdateData() 317cdf0e10cSrcweir { 318cdf0e10cSrcweir if ( pEditEngine ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir bInUpdate = sal_True; // don't reset bDataValid during UpdateText 321cdf0e10cSrcweir 322cdf0e10cSrcweir rContentObj.UpdateText( nPart, *pEditEngine ); 323cdf0e10cSrcweir 324cdf0e10cSrcweir bInUpdate = sal_False; 325cdf0e10cSrcweir } 326cdf0e10cSrcweir } 327cdf0e10cSrcweir 328cdf0e10cSrcweir //------------------------------------------------------------------------ 329cdf0e10cSrcweir 330cdf0e10cSrcweir ScHeaderFooterTextObj::ScHeaderFooterTextObj( ScHeaderFooterContentObj& rContent, 331cdf0e10cSrcweir sal_uInt16 nP ) : 332cdf0e10cSrcweir aTextData( rContent, nP ), 333cdf0e10cSrcweir pUnoText( NULL ) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir // ScHeaderFooterTextData acquires rContent 336cdf0e10cSrcweir // pUnoText is created on demand (getString/setString work without it) 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir void ScHeaderFooterTextObj::CreateUnoText_Impl() 340cdf0e10cSrcweir { 341cdf0e10cSrcweir if ( !pUnoText ) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir // can't be aggregated because getString/setString is handled here 344cdf0e10cSrcweir ScSharedHeaderFooterEditSource aEditSource( &aTextData ); 345cdf0e10cSrcweir pUnoText = new SvxUnoText( &aEditSource, lcl_GetHdFtPropertySet(), uno::Reference<text::XText>() ); 346cdf0e10cSrcweir pUnoText->acquire(); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir ScHeaderFooterTextObj::~ScHeaderFooterTextObj() 351cdf0e10cSrcweir { 352cdf0e10cSrcweir if (pUnoText) 353cdf0e10cSrcweir pUnoText->release(); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir const SvxUnoText& ScHeaderFooterTextObj::GetUnoText() 357cdf0e10cSrcweir { 358cdf0e10cSrcweir if (!pUnoText) 359cdf0e10cSrcweir CreateUnoText_Impl(); 360cdf0e10cSrcweir return *pUnoText; 361cdf0e10cSrcweir } 362cdf0e10cSrcweir 363cdf0e10cSrcweir // XText 364cdf0e10cSrcweir 365cdf0e10cSrcweir uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCursor() 366cdf0e10cSrcweir throw(uno::RuntimeException) 367cdf0e10cSrcweir { 368cdf0e10cSrcweir ScUnoGuard aGuard; 369cdf0e10cSrcweir return new ScHeaderFooterTextCursor( *this ); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCursorByRange( 373cdf0e10cSrcweir const uno::Reference<text::XTextRange>& aTextPosition ) 374cdf0e10cSrcweir throw(uno::RuntimeException) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir ScUnoGuard aGuard; 377cdf0e10cSrcweir if (!pUnoText) 378cdf0e10cSrcweir CreateUnoText_Impl(); 379cdf0e10cSrcweir return pUnoText->createTextCursorByRange(aTextPosition); 380cdf0e10cSrcweir //! wie ScCellObj::createTextCursorByRange, wenn SvxUnoTextRange_getReflection verfuegbar 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir void ScHeaderFooterTextObj::FillDummyFieldData( ScHeaderFieldData& rData ) // static 384cdf0e10cSrcweir { 385cdf0e10cSrcweir String aDummy(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "???" ))); 386cdf0e10cSrcweir rData.aTitle = aDummy; 387cdf0e10cSrcweir rData.aLongDocName = aDummy; 388cdf0e10cSrcweir rData.aShortDocName = aDummy; 389cdf0e10cSrcweir rData.aTabName = aDummy; 390cdf0e10cSrcweir rData.nPageNo = 1; 391cdf0e10cSrcweir rData.nTotalPages = 99; 392cdf0e10cSrcweir } 393cdf0e10cSrcweir 394cdf0e10cSrcweir rtl::OUString SAL_CALL ScHeaderFooterTextObj::getString() throw(uno::RuntimeException) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir ScUnoGuard aGuard; 397cdf0e10cSrcweir rtl::OUString aRet; 398cdf0e10cSrcweir const EditTextObject* pData; 399cdf0e10cSrcweir 400cdf0e10cSrcweir sal_uInt16 nPart = aTextData.GetPart(); 401cdf0e10cSrcweir ScHeaderFooterContentObj& rContentObj = aTextData.GetContentObj(); 402cdf0e10cSrcweir 403cdf0e10cSrcweir if (nPart == SC_HDFT_LEFT) 404cdf0e10cSrcweir pData = rContentObj.GetLeftEditObject(); 405cdf0e10cSrcweir else if (nPart == SC_HDFT_CENTER) 406cdf0e10cSrcweir pData = rContentObj.GetCenterEditObject(); 407cdf0e10cSrcweir else 408cdf0e10cSrcweir pData = rContentObj.GetRightEditObject(); 409cdf0e10cSrcweir if (pData) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir // for pure text, no font info is needed in pool defaults 412cdf0e10cSrcweir ScHeaderEditEngine aEditEngine( EditEngine::CreatePool(), sal_True ); 413cdf0e10cSrcweir 414cdf0e10cSrcweir ScHeaderFieldData aData; 415cdf0e10cSrcweir FillDummyFieldData( aData ); 416cdf0e10cSrcweir aEditEngine.SetData( aData ); 417cdf0e10cSrcweir 418cdf0e10cSrcweir aEditEngine.SetText(*pData); 419cdf0e10cSrcweir aRet = ScEditUtil::GetSpaceDelimitedString( aEditEngine ); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir return aRet; 422cdf0e10cSrcweir } 423cdf0e10cSrcweir 424cdf0e10cSrcweir void SAL_CALL ScHeaderFooterTextObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir ScUnoGuard aGuard; 427cdf0e10cSrcweir String aString(aText); 428cdf0e10cSrcweir 429cdf0e10cSrcweir // for pure text, no font info is needed in pool defaults 430cdf0e10cSrcweir ScHeaderEditEngine aEditEngine( EditEngine::CreatePool(), sal_True ); 431cdf0e10cSrcweir aEditEngine.SetText( aString ); 432cdf0e10cSrcweir 433cdf0e10cSrcweir aTextData.GetContentObj().UpdateText( aTextData.GetPart(), aEditEngine ); 434cdf0e10cSrcweir } 435cdf0e10cSrcweir 436cdf0e10cSrcweir void SAL_CALL ScHeaderFooterTextObj::insertString( const uno::Reference<text::XTextRange>& xRange, 437cdf0e10cSrcweir const rtl::OUString& aString, sal_Bool bAbsorb ) 438cdf0e10cSrcweir throw(uno::RuntimeException) 439cdf0e10cSrcweir { 440cdf0e10cSrcweir ScUnoGuard aGuard; 441cdf0e10cSrcweir if (!pUnoText) 442cdf0e10cSrcweir CreateUnoText_Impl(); 443cdf0e10cSrcweir pUnoText->insertString( xRange, aString, bAbsorb ); 444cdf0e10cSrcweir } 445cdf0e10cSrcweir 446cdf0e10cSrcweir void SAL_CALL ScHeaderFooterTextObj::insertControlCharacter( 447cdf0e10cSrcweir const uno::Reference<text::XTextRange>& xRange, 448cdf0e10cSrcweir sal_Int16 nControlCharacter, sal_Bool bAbsorb ) 449cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir ScUnoGuard aGuard; 452cdf0e10cSrcweir if (!pUnoText) 453cdf0e10cSrcweir CreateUnoText_Impl(); 454cdf0e10cSrcweir pUnoText->insertControlCharacter( xRange, nControlCharacter, bAbsorb ); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir void SAL_CALL ScHeaderFooterTextObj::insertTextContent( 458cdf0e10cSrcweir const uno::Reference<text::XTextRange >& xRange, 459cdf0e10cSrcweir const uno::Reference<text::XTextContent >& xContent, 460cdf0e10cSrcweir sal_Bool bAbsorb ) 461cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException) 462cdf0e10cSrcweir { 463cdf0e10cSrcweir ScUnoGuard aGuard; 464cdf0e10cSrcweir if ( xContent.is() && xRange.is() ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir ScHeaderFieldObj* pHeaderField = ScHeaderFieldObj::getImplementation( xContent ); 467cdf0e10cSrcweir 468cdf0e10cSrcweir SvxUnoTextRangeBase* pTextRange = 469cdf0e10cSrcweir ScHeaderFooterTextCursor::getImplementation( xRange ); 470cdf0e10cSrcweir 471cdf0e10cSrcweir #if 0 472cdf0e10cSrcweir if (!pTextRange) 473cdf0e10cSrcweir pTextRange = (SvxUnoTextRange*)xRange->getImplementation( 474cdf0e10cSrcweir SvxUnoTextRange_getReflection() ); 475cdf0e10cSrcweir //! bei SvxUnoTextRange testen, ob in passendem Objekt !!! 476cdf0e10cSrcweir #endif 477cdf0e10cSrcweir 478cdf0e10cSrcweir if ( pHeaderField && !pHeaderField->IsInserted() && pTextRange ) 479cdf0e10cSrcweir { 480cdf0e10cSrcweir SvxEditSource* pEditSource = pTextRange->GetEditSource(); 481cdf0e10cSrcweir ESelection aSelection(pTextRange->GetSelection()); 482cdf0e10cSrcweir 483cdf0e10cSrcweir if (!bAbsorb) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir // don't replace -> append at end 486cdf0e10cSrcweir aSelection.Adjust(); 487cdf0e10cSrcweir aSelection.nStartPara = aSelection.nEndPara; 488cdf0e10cSrcweir aSelection.nStartPos = aSelection.nEndPos; 489cdf0e10cSrcweir } 490cdf0e10cSrcweir 491cdf0e10cSrcweir SvxFieldItem aItem(pHeaderField->CreateFieldItem()); 492cdf0e10cSrcweir 493cdf0e10cSrcweir SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder(); 494cdf0e10cSrcweir pForwarder->QuickInsertField( aItem, aSelection ); 495cdf0e10cSrcweir pEditSource->UpdateData(); 496cdf0e10cSrcweir 497cdf0e10cSrcweir // neue Selektion: ein Zeichen 498cdf0e10cSrcweir aSelection.Adjust(); 499cdf0e10cSrcweir aSelection.nEndPara = aSelection.nStartPara; 500cdf0e10cSrcweir aSelection.nEndPos = aSelection.nStartPos + 1; 501cdf0e10cSrcweir pHeaderField->InitDoc( &aTextData.GetContentObj(), aTextData.GetPart(), aSelection ); 502cdf0e10cSrcweir 503cdf0e10cSrcweir // #91431# for bAbsorb=sal_False, the new selection must be behind the inserted content 504cdf0e10cSrcweir // (the xml filter relies on this) 505cdf0e10cSrcweir if (!bAbsorb) 506cdf0e10cSrcweir aSelection.nStartPos = aSelection.nEndPos; 507cdf0e10cSrcweir 508cdf0e10cSrcweir pTextRange->SetSelection( aSelection ); 509cdf0e10cSrcweir 510cdf0e10cSrcweir return; 511cdf0e10cSrcweir } 512cdf0e10cSrcweir } 513cdf0e10cSrcweir 514cdf0e10cSrcweir if (!pUnoText) 515cdf0e10cSrcweir CreateUnoText_Impl(); 516cdf0e10cSrcweir pUnoText->insertTextContent( xRange, xContent, bAbsorb ); 517cdf0e10cSrcweir } 518cdf0e10cSrcweir 519cdf0e10cSrcweir void SAL_CALL ScHeaderFooterTextObj::removeTextContent( 520cdf0e10cSrcweir const uno::Reference<text::XTextContent>& xContent ) 521cdf0e10cSrcweir throw(container::NoSuchElementException, uno::RuntimeException) 522cdf0e10cSrcweir { 523cdf0e10cSrcweir ScUnoGuard aGuard; 524cdf0e10cSrcweir if ( xContent.is() ) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir ScHeaderFieldObj* pHeaderField = ScHeaderFieldObj::getImplementation( xContent ); 527cdf0e10cSrcweir if ( pHeaderField && pHeaderField->IsInserted() ) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir //! Testen, ob das Feld in dieser Zelle ist 530cdf0e10cSrcweir pHeaderField->DeleteField(); 531cdf0e10cSrcweir return; 532cdf0e10cSrcweir } 533cdf0e10cSrcweir } 534cdf0e10cSrcweir if (!pUnoText) 535cdf0e10cSrcweir CreateUnoText_Impl(); 536cdf0e10cSrcweir pUnoText->removeTextContent( xContent ); 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScHeaderFooterTextObj::getText() throw(uno::RuntimeException) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir ScUnoGuard aGuard; 542cdf0e10cSrcweir if (!pUnoText) 543cdf0e10cSrcweir CreateUnoText_Impl(); 544cdf0e10cSrcweir return pUnoText->getText(); 545cdf0e10cSrcweir } 546cdf0e10cSrcweir 547cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextObj::getStart() throw(uno::RuntimeException) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir ScUnoGuard aGuard; 550cdf0e10cSrcweir if (!pUnoText) 551cdf0e10cSrcweir CreateUnoText_Impl(); 552cdf0e10cSrcweir return pUnoText->getStart(); 553cdf0e10cSrcweir } 554cdf0e10cSrcweir 555cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextObj::getEnd() throw(uno::RuntimeException) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir ScUnoGuard aGuard; 558cdf0e10cSrcweir if (!pUnoText) 559cdf0e10cSrcweir CreateUnoText_Impl(); 560cdf0e10cSrcweir return pUnoText->getEnd(); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir 563cdf0e10cSrcweir // XTextFieldsSupplier 564cdf0e10cSrcweir 565cdf0e10cSrcweir uno::Reference<container::XEnumerationAccess> SAL_CALL ScHeaderFooterTextObj::getTextFields() 566cdf0e10cSrcweir throw(uno::RuntimeException) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir ScUnoGuard aGuard; 569cdf0e10cSrcweir // all fields 570cdf0e10cSrcweir return new ScHeaderFieldsObj( &aTextData.GetContentObj(), aTextData.GetPart(), SC_SERVICE_INVALID ); 571cdf0e10cSrcweir } 572cdf0e10cSrcweir 573cdf0e10cSrcweir uno::Reference<container::XNameAccess> SAL_CALL ScHeaderFooterTextObj::getTextFieldMasters() 574cdf0e10cSrcweir throw(uno::RuntimeException) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir // sowas gibts nicht im Calc (?) 577cdf0e10cSrcweir return NULL; 578cdf0e10cSrcweir } 579cdf0e10cSrcweir 580cdf0e10cSrcweir // XTextRangeMover 581cdf0e10cSrcweir 582cdf0e10cSrcweir void SAL_CALL ScHeaderFooterTextObj::moveTextRange( 583cdf0e10cSrcweir const uno::Reference<text::XTextRange>& xRange, 584cdf0e10cSrcweir sal_Int16 nParagraphs ) 585cdf0e10cSrcweir throw(uno::RuntimeException) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir ScUnoGuard aGuard; 588cdf0e10cSrcweir if (!pUnoText) 589cdf0e10cSrcweir CreateUnoText_Impl(); 590cdf0e10cSrcweir pUnoText->moveTextRange( xRange, nParagraphs ); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir 593cdf0e10cSrcweir // XEnumerationAccess 594cdf0e10cSrcweir 595cdf0e10cSrcweir uno::Reference<container::XEnumeration> SAL_CALL ScHeaderFooterTextObj::createEnumeration() 596cdf0e10cSrcweir throw(uno::RuntimeException) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir ScUnoGuard aGuard; 599cdf0e10cSrcweir if (!pUnoText) 600cdf0e10cSrcweir CreateUnoText_Impl(); 601cdf0e10cSrcweir return pUnoText->createEnumeration(); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir 604cdf0e10cSrcweir // XElementAccess 605cdf0e10cSrcweir 606cdf0e10cSrcweir uno::Type SAL_CALL ScHeaderFooterTextObj::getElementType() throw(uno::RuntimeException) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir ScUnoGuard aGuard; 609cdf0e10cSrcweir if (!pUnoText) 610cdf0e10cSrcweir CreateUnoText_Impl(); 611cdf0e10cSrcweir return pUnoText->getElementType(); 612cdf0e10cSrcweir } 613cdf0e10cSrcweir 614cdf0e10cSrcweir sal_Bool SAL_CALL ScHeaderFooterTextObj::hasElements() throw(uno::RuntimeException) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir ScUnoGuard aGuard; 617cdf0e10cSrcweir if (!pUnoText) 618cdf0e10cSrcweir CreateUnoText_Impl(); 619cdf0e10cSrcweir return pUnoText->hasElements(); 620cdf0e10cSrcweir } 621cdf0e10cSrcweir 622cdf0e10cSrcweir //------------------------------------------------------------------------ 623cdf0e10cSrcweir 624cdf0e10cSrcweir ScCellTextCursor::ScCellTextCursor(const ScCellTextCursor& rOther) : 625cdf0e10cSrcweir SvxUnoTextCursor( rOther ), 626cdf0e10cSrcweir rTextObj( rOther.rTextObj ) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir rTextObj.acquire(); 629cdf0e10cSrcweir } 630cdf0e10cSrcweir 631cdf0e10cSrcweir ScCellTextCursor::ScCellTextCursor(ScCellObj& rText) : 632cdf0e10cSrcweir SvxUnoTextCursor( rText.GetUnoText() ), 633cdf0e10cSrcweir rTextObj( rText ) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir rTextObj.acquire(); 636cdf0e10cSrcweir } 637cdf0e10cSrcweir 638cdf0e10cSrcweir ScCellTextCursor::~ScCellTextCursor() throw() 639cdf0e10cSrcweir { 640cdf0e10cSrcweir rTextObj.release(); 641cdf0e10cSrcweir } 642cdf0e10cSrcweir 643cdf0e10cSrcweir // SvxUnoTextCursor methods reimplemented here to return the right objects: 644cdf0e10cSrcweir 645cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScCellTextCursor::getText() throw(uno::RuntimeException) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir ScUnoGuard aGuard; 648cdf0e10cSrcweir return &rTextObj; 649cdf0e10cSrcweir } 650cdf0e10cSrcweir 651cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScCellTextCursor::getStart() throw(uno::RuntimeException) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir ScUnoGuard aGuard; 654cdf0e10cSrcweir 655cdf0e10cSrcweir //! use other object for range than cursor? 656cdf0e10cSrcweir 657cdf0e10cSrcweir ScCellTextCursor* pNew = new ScCellTextCursor( *this ); 658cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); 659cdf0e10cSrcweir 660cdf0e10cSrcweir ESelection aNewSel(GetSelection()); 661cdf0e10cSrcweir aNewSel.nEndPara = aNewSel.nStartPara; 662cdf0e10cSrcweir aNewSel.nEndPos = aNewSel.nStartPos; 663cdf0e10cSrcweir pNew->SetSelection( aNewSel ); 664cdf0e10cSrcweir 665cdf0e10cSrcweir return xRange; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir 668cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScCellTextCursor::getEnd() throw(uno::RuntimeException) 669cdf0e10cSrcweir { 670cdf0e10cSrcweir ScUnoGuard aGuard; 671cdf0e10cSrcweir 672cdf0e10cSrcweir //! use other object for range than cursor? 673cdf0e10cSrcweir 674cdf0e10cSrcweir ScCellTextCursor* pNew = new ScCellTextCursor( *this ); 675cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); 676cdf0e10cSrcweir 677cdf0e10cSrcweir ESelection aNewSel(GetSelection()); 678cdf0e10cSrcweir aNewSel.nStartPara = aNewSel.nEndPara; 679cdf0e10cSrcweir aNewSel.nStartPos = aNewSel.nEndPos; 680cdf0e10cSrcweir pNew->SetSelection( aNewSel ); 681cdf0e10cSrcweir 682cdf0e10cSrcweir return xRange; 683cdf0e10cSrcweir } 684cdf0e10cSrcweir 685cdf0e10cSrcweir // XUnoTunnel 686cdf0e10cSrcweir 687cdf0e10cSrcweir sal_Int64 SAL_CALL ScCellTextCursor::getSomething( 688cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException) 689cdf0e10cSrcweir { 690cdf0e10cSrcweir if ( rId.getLength() == 16 && 691cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 692cdf0e10cSrcweir rId.getConstArray(), 16 ) ) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); 695cdf0e10cSrcweir } 696cdf0e10cSrcweir return SvxUnoTextCursor::getSomething( rId ); 697cdf0e10cSrcweir } 698cdf0e10cSrcweir 699cdf0e10cSrcweir // static 700cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScCellTextCursor::getUnoTunnelId() 701cdf0e10cSrcweir { 702cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0; 703cdf0e10cSrcweir if( !pSeq ) 704cdf0e10cSrcweir { 705cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); 706cdf0e10cSrcweir if( !pSeq ) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 ); 709cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); 710cdf0e10cSrcweir pSeq = &aSeq; 711cdf0e10cSrcweir } 712cdf0e10cSrcweir } 713cdf0e10cSrcweir return *pSeq; 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir // static 717cdf0e10cSrcweir ScCellTextCursor* ScCellTextCursor::getImplementation( const uno::Reference<uno::XInterface> xObj ) 718cdf0e10cSrcweir { 719cdf0e10cSrcweir ScCellTextCursor* pRet = NULL; 720cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY ); 721cdf0e10cSrcweir if (xUT.is()) 722cdf0e10cSrcweir pRet = reinterpret_cast<ScCellTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId()))); 723cdf0e10cSrcweir return pRet; 724cdf0e10cSrcweir } 725cdf0e10cSrcweir 726cdf0e10cSrcweir //------------------------------------------------------------------------ 727cdf0e10cSrcweir 728cdf0e10cSrcweir ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(const ScHeaderFooterTextCursor& rOther) : 729cdf0e10cSrcweir SvxUnoTextCursor( rOther ), 730cdf0e10cSrcweir rTextObj( rOther.rTextObj ) 731cdf0e10cSrcweir { 732cdf0e10cSrcweir rTextObj.acquire(); 733cdf0e10cSrcweir } 734cdf0e10cSrcweir 735cdf0e10cSrcweir ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(ScHeaderFooterTextObj& rText) : 736cdf0e10cSrcweir SvxUnoTextCursor( rText.GetUnoText() ), 737cdf0e10cSrcweir rTextObj( rText ) 738cdf0e10cSrcweir { 739cdf0e10cSrcweir rTextObj.acquire(); 740cdf0e10cSrcweir } 741cdf0e10cSrcweir 742cdf0e10cSrcweir ScHeaderFooterTextCursor::~ScHeaderFooterTextCursor() throw() 743cdf0e10cSrcweir { 744cdf0e10cSrcweir rTextObj.release(); 745cdf0e10cSrcweir } 746cdf0e10cSrcweir 747cdf0e10cSrcweir // SvxUnoTextCursor methods reimplemented here to return the right objects: 748cdf0e10cSrcweir 749cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScHeaderFooterTextCursor::getText() throw(uno::RuntimeException) 750cdf0e10cSrcweir { 751cdf0e10cSrcweir ScUnoGuard aGuard; 752cdf0e10cSrcweir return &rTextObj; 753cdf0e10cSrcweir } 754cdf0e10cSrcweir 755cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getStart() throw(uno::RuntimeException) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir ScUnoGuard aGuard; 758cdf0e10cSrcweir 759cdf0e10cSrcweir //! use other object for range than cursor? 760cdf0e10cSrcweir 761cdf0e10cSrcweir ScHeaderFooterTextCursor* pNew = new ScHeaderFooterTextCursor( *this ); 762cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); 763cdf0e10cSrcweir 764cdf0e10cSrcweir ESelection aNewSel(GetSelection()); 765cdf0e10cSrcweir aNewSel.nEndPara = aNewSel.nStartPara; 766cdf0e10cSrcweir aNewSel.nEndPos = aNewSel.nStartPos; 767cdf0e10cSrcweir pNew->SetSelection( aNewSel ); 768cdf0e10cSrcweir 769cdf0e10cSrcweir return xRange; 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getEnd() throw(uno::RuntimeException) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir ScUnoGuard aGuard; 775cdf0e10cSrcweir 776cdf0e10cSrcweir //! use other object for range than cursor? 777cdf0e10cSrcweir 778cdf0e10cSrcweir ScHeaderFooterTextCursor* pNew = new ScHeaderFooterTextCursor( *this ); 779cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); 780cdf0e10cSrcweir 781cdf0e10cSrcweir ESelection aNewSel(GetSelection()); 782cdf0e10cSrcweir aNewSel.nStartPara = aNewSel.nEndPara; 783cdf0e10cSrcweir aNewSel.nStartPos = aNewSel.nEndPos; 784cdf0e10cSrcweir pNew->SetSelection( aNewSel ); 785cdf0e10cSrcweir 786cdf0e10cSrcweir return xRange; 787cdf0e10cSrcweir } 788cdf0e10cSrcweir 789cdf0e10cSrcweir // XUnoTunnel 790cdf0e10cSrcweir 791cdf0e10cSrcweir sal_Int64 SAL_CALL ScHeaderFooterTextCursor::getSomething( 792cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException) 793cdf0e10cSrcweir { 794cdf0e10cSrcweir if ( rId.getLength() == 16 && 795cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 796cdf0e10cSrcweir rId.getConstArray(), 16 ) ) 797cdf0e10cSrcweir { 798cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); 799cdf0e10cSrcweir } 800cdf0e10cSrcweir return SvxUnoTextCursor::getSomething( rId ); 801cdf0e10cSrcweir } 802cdf0e10cSrcweir 803cdf0e10cSrcweir // static 804cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScHeaderFooterTextCursor::getUnoTunnelId() 805cdf0e10cSrcweir { 806cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0; 807cdf0e10cSrcweir if( !pSeq ) 808cdf0e10cSrcweir { 809cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); 810cdf0e10cSrcweir if( !pSeq ) 811cdf0e10cSrcweir { 812cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 ); 813cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); 814cdf0e10cSrcweir pSeq = &aSeq; 815cdf0e10cSrcweir } 816cdf0e10cSrcweir } 817cdf0e10cSrcweir return *pSeq; 818cdf0e10cSrcweir } 819cdf0e10cSrcweir 820cdf0e10cSrcweir // static 821cdf0e10cSrcweir ScHeaderFooterTextCursor* ScHeaderFooterTextCursor::getImplementation( 822cdf0e10cSrcweir const uno::Reference<uno::XInterface> xObj ) 823cdf0e10cSrcweir { 824cdf0e10cSrcweir ScHeaderFooterTextCursor* pRet = NULL; 825cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY ); 826cdf0e10cSrcweir if (xUT.is()) 827cdf0e10cSrcweir pRet = reinterpret_cast<ScHeaderFooterTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId()))); 828cdf0e10cSrcweir return pRet; 829cdf0e10cSrcweir } 830cdf0e10cSrcweir 831cdf0e10cSrcweir //------------------------------------------------------------------------ 832cdf0e10cSrcweir 833cdf0e10cSrcweir ScDrawTextCursor::ScDrawTextCursor(const ScDrawTextCursor& rOther) : 834cdf0e10cSrcweir SvxUnoTextCursor( rOther ), 835cdf0e10cSrcweir xParentText( rOther.xParentText ) 836cdf0e10cSrcweir { 837cdf0e10cSrcweir } 838cdf0e10cSrcweir 839cdf0e10cSrcweir ScDrawTextCursor::ScDrawTextCursor( const uno::Reference<text::XText>& xParent, 840cdf0e10cSrcweir const SvxUnoTextBase& rText ) : 841cdf0e10cSrcweir SvxUnoTextCursor( rText ), 842cdf0e10cSrcweir xParentText( xParent ) 843cdf0e10cSrcweir 844cdf0e10cSrcweir { 845cdf0e10cSrcweir } 846cdf0e10cSrcweir 847cdf0e10cSrcweir ScDrawTextCursor::~ScDrawTextCursor() throw() 848cdf0e10cSrcweir { 849cdf0e10cSrcweir } 850cdf0e10cSrcweir 851cdf0e10cSrcweir // SvxUnoTextCursor methods reimplemented here to return the right objects: 852cdf0e10cSrcweir 853cdf0e10cSrcweir uno::Reference<text::XText> SAL_CALL ScDrawTextCursor::getText() throw(uno::RuntimeException) 854cdf0e10cSrcweir { 855cdf0e10cSrcweir ScUnoGuard aGuard; 856cdf0e10cSrcweir return xParentText; 857cdf0e10cSrcweir } 858cdf0e10cSrcweir 859cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getStart() throw(uno::RuntimeException) 860cdf0e10cSrcweir { 861cdf0e10cSrcweir ScUnoGuard aGuard; 862cdf0e10cSrcweir 863cdf0e10cSrcweir //! use other object for range than cursor? 864cdf0e10cSrcweir 865cdf0e10cSrcweir ScDrawTextCursor* pNew = new ScDrawTextCursor( *this ); 866cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); 867cdf0e10cSrcweir 868cdf0e10cSrcweir ESelection aNewSel(GetSelection()); 869cdf0e10cSrcweir aNewSel.nEndPara = aNewSel.nStartPara; 870cdf0e10cSrcweir aNewSel.nEndPos = aNewSel.nStartPos; 871cdf0e10cSrcweir pNew->SetSelection( aNewSel ); 872cdf0e10cSrcweir 873cdf0e10cSrcweir return xRange; 874cdf0e10cSrcweir } 875cdf0e10cSrcweir 876cdf0e10cSrcweir uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getEnd() throw(uno::RuntimeException) 877cdf0e10cSrcweir { 878cdf0e10cSrcweir ScUnoGuard aGuard; 879cdf0e10cSrcweir 880cdf0e10cSrcweir //! use other object for range than cursor? 881cdf0e10cSrcweir 882cdf0e10cSrcweir ScDrawTextCursor* pNew = new ScDrawTextCursor( *this ); 883cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); 884cdf0e10cSrcweir 885cdf0e10cSrcweir ESelection aNewSel(GetSelection()); 886cdf0e10cSrcweir aNewSel.nStartPara = aNewSel.nEndPara; 887cdf0e10cSrcweir aNewSel.nStartPos = aNewSel.nEndPos; 888cdf0e10cSrcweir pNew->SetSelection( aNewSel ); 889cdf0e10cSrcweir 890cdf0e10cSrcweir return xRange; 891cdf0e10cSrcweir } 892cdf0e10cSrcweir 893cdf0e10cSrcweir // XUnoTunnel 894cdf0e10cSrcweir 895cdf0e10cSrcweir sal_Int64 SAL_CALL ScDrawTextCursor::getSomething( 896cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException) 897cdf0e10cSrcweir { 898cdf0e10cSrcweir if ( rId.getLength() == 16 && 899cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 900cdf0e10cSrcweir rId.getConstArray(), 16 ) ) 901cdf0e10cSrcweir { 902cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); 903cdf0e10cSrcweir } 904cdf0e10cSrcweir return SvxUnoTextCursor::getSomething( rId ); 905cdf0e10cSrcweir } 906cdf0e10cSrcweir 907cdf0e10cSrcweir // static 908cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScDrawTextCursor::getUnoTunnelId() 909cdf0e10cSrcweir { 910cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0; 911cdf0e10cSrcweir if( !pSeq ) 912cdf0e10cSrcweir { 913cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); 914cdf0e10cSrcweir if( !pSeq ) 915cdf0e10cSrcweir { 916cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 ); 917cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); 918cdf0e10cSrcweir pSeq = &aSeq; 919cdf0e10cSrcweir } 920cdf0e10cSrcweir } 921cdf0e10cSrcweir return *pSeq; 922cdf0e10cSrcweir } 923cdf0e10cSrcweir 924cdf0e10cSrcweir // static 925cdf0e10cSrcweir ScDrawTextCursor* ScDrawTextCursor::getImplementation( const uno::Reference<uno::XInterface> xObj ) 926cdf0e10cSrcweir { 927cdf0e10cSrcweir ScDrawTextCursor* pRet = NULL; 928cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY ); 929cdf0e10cSrcweir if (xUT.is()) 930cdf0e10cSrcweir pRet = reinterpret_cast<ScDrawTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId()))); 931cdf0e10cSrcweir return pRet; 932cdf0e10cSrcweir } 933cdf0e10cSrcweir 934cdf0e10cSrcweir //------------------------------------------------------------------------ 935cdf0e10cSrcweir 936cdf0e10cSrcweir ScSimpleEditSourceHelper::ScSimpleEditSourceHelper() 937cdf0e10cSrcweir { 938cdf0e10cSrcweir SfxItemPool* pEnginePool = EditEngine::CreatePool(); 939cdf0e10cSrcweir pEnginePool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); 940cdf0e10cSrcweir pEnginePool->FreezeIdRanges(); 941cdf0e10cSrcweir 942cdf0e10cSrcweir pEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); // TRUE: become owner of pool 943cdf0e10cSrcweir pForwarder = new SvxEditEngineForwarder( *pEditEngine ); 944cdf0e10cSrcweir pOriginalSource = new ScSimpleEditSource( pForwarder ); 945cdf0e10cSrcweir } 946cdf0e10cSrcweir 947cdf0e10cSrcweir ScSimpleEditSourceHelper::~ScSimpleEditSourceHelper() 948cdf0e10cSrcweir { 949cdf0e10cSrcweir ScUnoGuard aGuard; // needed for EditEngine dtor 950cdf0e10cSrcweir 951cdf0e10cSrcweir delete pOriginalSource; 952cdf0e10cSrcweir delete pForwarder; 953cdf0e10cSrcweir delete pEditEngine; 954cdf0e10cSrcweir } 955cdf0e10cSrcweir 956cdf0e10cSrcweir ScEditEngineTextObj::ScEditEngineTextObj() : 957cdf0e10cSrcweir SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertySet(), uno::Reference<text::XText>() ) 958cdf0e10cSrcweir { 959cdf0e10cSrcweir } 960cdf0e10cSrcweir 961cdf0e10cSrcweir ScEditEngineTextObj::~ScEditEngineTextObj() throw() 962cdf0e10cSrcweir { 963cdf0e10cSrcweir } 964cdf0e10cSrcweir 965cdf0e10cSrcweir void ScEditEngineTextObj::SetText( const EditTextObject& rTextObject ) 966cdf0e10cSrcweir { 967cdf0e10cSrcweir GetEditEngine()->SetText( rTextObject ); 968cdf0e10cSrcweir 969cdf0e10cSrcweir ESelection aSel; 970cdf0e10cSrcweir ::GetSelection( aSel, GetEditSource()->GetTextForwarder() ); 971cdf0e10cSrcweir SetSelection( aSel ); 972cdf0e10cSrcweir } 973cdf0e10cSrcweir 974cdf0e10cSrcweir EditTextObject* ScEditEngineTextObj::CreateTextObject() 975cdf0e10cSrcweir { 976cdf0e10cSrcweir return GetEditEngine()->CreateTextObject(); 977cdf0e10cSrcweir } 978cdf0e10cSrcweir 979cdf0e10cSrcweir //------------------------------------------------------------------------ 980cdf0e10cSrcweir 981cdf0e10cSrcweir ScCellTextData::ScCellTextData(ScDocShell* pDocSh, const ScAddress& rP) : 982cdf0e10cSrcweir pDocShell( pDocSh ), 983cdf0e10cSrcweir aCellPos( rP ), 984cdf0e10cSrcweir pEditEngine( NULL ), 985cdf0e10cSrcweir pForwarder( NULL ), 986cdf0e10cSrcweir pOriginalSource( NULL ), 987cdf0e10cSrcweir bDataValid( sal_False ), 988cdf0e10cSrcweir bInUpdate( sal_False ), 989cdf0e10cSrcweir bDirty( sal_False ), 990cdf0e10cSrcweir bDoUpdate( sal_True ) 991cdf0e10cSrcweir { 992cdf0e10cSrcweir if (pDocShell) 993cdf0e10cSrcweir pDocShell->GetDocument()->AddUnoObject(*this); 994cdf0e10cSrcweir } 995cdf0e10cSrcweir 996cdf0e10cSrcweir ScCellTextData::~ScCellTextData() 997cdf0e10cSrcweir { 998cdf0e10cSrcweir ScUnoGuard aGuard; // needed for EditEngine dtor 999cdf0e10cSrcweir 1000cdf0e10cSrcweir if (pDocShell) 1001cdf0e10cSrcweir { 1002cdf0e10cSrcweir pDocShell->GetDocument()->RemoveUnoObject(*this); 1003cdf0e10cSrcweir pDocShell->GetDocument()->DisposeFieldEditEngine(pEditEngine); 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir else 1006cdf0e10cSrcweir delete pEditEngine; 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir delete pForwarder; 1009cdf0e10cSrcweir 1010cdf0e10cSrcweir delete pOriginalSource; 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir ScSharedCellEditSource* ScCellTextData::GetOriginalSource() 1014cdf0e10cSrcweir { 1015cdf0e10cSrcweir if (!pOriginalSource) 1016cdf0e10cSrcweir pOriginalSource = new ScSharedCellEditSource( this ); 1017cdf0e10cSrcweir return pOriginalSource; 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir 1020cdf0e10cSrcweir void ScCellTextData::GetCellText(const ScAddress& rCellPos, String& rText) 1021cdf0e10cSrcweir { 1022cdf0e10cSrcweir if (pDocShell) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument(); 1025cdf0e10cSrcweir pDoc->GetInputString( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText ); 1026cdf0e10cSrcweir } 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir SvxTextForwarder* ScCellTextData::GetTextForwarder() 1030cdf0e10cSrcweir { 1031cdf0e10cSrcweir if (!pEditEngine) 1032cdf0e10cSrcweir { 1033cdf0e10cSrcweir if ( pDocShell ) 1034cdf0e10cSrcweir { 1035cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument(); 1036cdf0e10cSrcweir pEditEngine = pDoc->CreateFieldEditEngine(); 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir else 1039cdf0e10cSrcweir { 1040cdf0e10cSrcweir SfxItemPool* pEnginePool = EditEngine::CreatePool(); 1041cdf0e10cSrcweir pEnginePool->FreezeIdRanges(); 1042cdf0e10cSrcweir pEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); 1043cdf0e10cSrcweir } 1044cdf0e10cSrcweir // currently, GetPortions doesn't work if UpdateMode is sal_False, 1045cdf0e10cSrcweir // this will be fixed (in EditEngine) by src600 1046cdf0e10cSrcweir // pEditEngine->SetUpdateMode( sal_False ); 1047cdf0e10cSrcweir pEditEngine->EnableUndo( sal_False ); 1048cdf0e10cSrcweir if (pDocShell) 1049cdf0e10cSrcweir pEditEngine->SetRefDevice(pDocShell->GetRefDevice()); 1050cdf0e10cSrcweir else 1051cdf0e10cSrcweir pEditEngine->SetRefMapMode( MAP_100TH_MM ); 1052cdf0e10cSrcweir pForwarder = new SvxEditEngineForwarder(*pEditEngine); 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir if (bDataValid) 1056cdf0e10cSrcweir return pForwarder; 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir String aText; 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir if (pDocShell) 1061cdf0e10cSrcweir { 1062cdf0e10cSrcweir ScDocument* pDoc = pDocShell->GetDocument(); 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir SfxItemSet aDefaults( pEditEngine->GetEmptyItemSet() ); 1065cdf0e10cSrcweir if( const ScPatternAttr* pPattern = 1066cdf0e10cSrcweir pDoc->GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) 1067cdf0e10cSrcweir { 1068cdf0e10cSrcweir pPattern->FillEditItemSet( &aDefaults ); 1069cdf0e10cSrcweir pPattern->FillEditParaItems( &aDefaults ); // including alignment etc. (for reading) 1070cdf0e10cSrcweir } 1071cdf0e10cSrcweir 1072cdf0e10cSrcweir const ScBaseCell* pCell = pDoc->GetCell( aCellPos ); 1073cdf0e10cSrcweir if ( pCell && pCell->GetCellType() == CELLTYPE_EDIT ) 1074cdf0e10cSrcweir pEditEngine->SetTextNewDefaults( *((const ScEditCell*)pCell)->GetData(), aDefaults ); 1075cdf0e10cSrcweir else 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir GetCellText( aCellPos, aText ); 1078cdf0e10cSrcweir if (aText.Len()) 1079cdf0e10cSrcweir pEditEngine->SetTextNewDefaults( aText, aDefaults ); 1080cdf0e10cSrcweir else 1081cdf0e10cSrcweir pEditEngine->SetDefaults(aDefaults); 1082cdf0e10cSrcweir } 1083cdf0e10cSrcweir } 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir bDataValid = sal_True; 1086cdf0e10cSrcweir return pForwarder; 1087cdf0e10cSrcweir } 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir void ScCellTextData::UpdateData() 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir if ( bDoUpdate ) 1092cdf0e10cSrcweir { 1093cdf0e10cSrcweir DBG_ASSERT(pEditEngine != NULL, "no EditEngine for UpdateData()"); 1094cdf0e10cSrcweir if ( pDocShell && pEditEngine ) 1095cdf0e10cSrcweir { 1096cdf0e10cSrcweir // during the own UpdateData call, bDataValid must not be reset, 1097cdf0e10cSrcweir // or things like attributes after the text would be lost 1098cdf0e10cSrcweir // (are not stored in the cell) 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir bInUpdate = sal_True; // prevents bDataValid from being reset 1101cdf0e10cSrcweir 1102cdf0e10cSrcweir ScDocFunc aFunc(*pDocShell); 1103cdf0e10cSrcweir aFunc.PutData( aCellPos, *pEditEngine, sal_False, sal_True ); // always as text 1104cdf0e10cSrcweir 1105cdf0e10cSrcweir bInUpdate = sal_False; 1106cdf0e10cSrcweir bDirty = sal_False; 1107cdf0e10cSrcweir } 1108cdf0e10cSrcweir } 1109cdf0e10cSrcweir else 1110cdf0e10cSrcweir bDirty = sal_True; 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir 1113cdf0e10cSrcweir void ScCellTextData::Notify( SfxBroadcaster&, const SfxHint& rHint ) 1114cdf0e10cSrcweir { 1115cdf0e10cSrcweir if ( rHint.ISA( ScUpdateRefHint ) ) 1116cdf0e10cSrcweir { 1117cdf0e10cSrcweir // const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint; 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir //! Ref-Update 1120cdf0e10cSrcweir } 1121cdf0e10cSrcweir else if ( rHint.ISA( SfxSimpleHint ) ) 1122cdf0e10cSrcweir { 1123cdf0e10cSrcweir sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId(); 1124cdf0e10cSrcweir if ( nId == SFX_HINT_DYING ) 1125cdf0e10cSrcweir { 1126cdf0e10cSrcweir pDocShell = NULL; // invalid now 1127cdf0e10cSrcweir 1128cdf0e10cSrcweir DELETEZ( pForwarder ); 1129cdf0e10cSrcweir DELETEZ( pEditEngine ); // EditEngine uses document's pool 1130cdf0e10cSrcweir } 1131cdf0e10cSrcweir else if ( nId == SFX_HINT_DATACHANGED ) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir if (!bInUpdate) // not for own UpdateData calls 1134cdf0e10cSrcweir bDataValid = sal_False; // text has to be read from the cell again 1135cdf0e10cSrcweir } 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir } 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir ScCellTextObj::ScCellTextObj(ScDocShell* pDocSh, const ScAddress& rP) : 1140cdf0e10cSrcweir ScCellTextData( pDocSh, rP ), 1141cdf0e10cSrcweir SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertySet(), uno::Reference<text::XText>() ) 1142cdf0e10cSrcweir { 1143cdf0e10cSrcweir } 1144cdf0e10cSrcweir 1145cdf0e10cSrcweir ScCellTextObj::~ScCellTextObj() throw() 1146cdf0e10cSrcweir { 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir 1149