1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "viscrs.hxx" 32*cdf0e10cSrcweir #include <sfx2/frame.hxx> 33*cdf0e10cSrcweir #include <sfx2/printer.hxx> 34*cdf0e10cSrcweir #include <cmdid.h> 35*cdf0e10cSrcweir #include <hintids.hxx> 36*cdf0e10cSrcweir #include <docsh.hxx> 37*cdf0e10cSrcweir #include <rubylist.hxx> 38*cdf0e10cSrcweir #include <doc.hxx> 39*cdf0e10cSrcweir #include <unotxvw.hxx> 40*cdf0e10cSrcweir #include <unodispatch.hxx> 41*cdf0e10cSrcweir #include <unomap.hxx> 42*cdf0e10cSrcweir #include <unostyle.hxx> 43*cdf0e10cSrcweir #include <unoprnms.hxx> 44*cdf0e10cSrcweir #include <view.hxx> 45*cdf0e10cSrcweir #include <viewopt.hxx> 46*cdf0e10cSrcweir #include <unomod.hxx> 47*cdf0e10cSrcweir #include <unoframe.hxx> 48*cdf0e10cSrcweir #include <unocrsr.hxx> 49*cdf0e10cSrcweir #include <wrtsh.hxx> 50*cdf0e10cSrcweir #include <unotbl.hxx> 51*cdf0e10cSrcweir #include <svx/fmshell.hxx> 52*cdf0e10cSrcweir #include <svx/svdview.hxx> 53*cdf0e10cSrcweir #include <svx/svdpage.hxx> 54*cdf0e10cSrcweir #include <svx/svdouno.hxx> 55*cdf0e10cSrcweir #include <svx/svdogrp.hxx> 56*cdf0e10cSrcweir #include <editeng/pbinitem.hxx> 57*cdf0e10cSrcweir #include <pagedesc.hxx> 58*cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 59*cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 60*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 61*cdf0e10cSrcweir #include <sfx2/request.hxx> 62*cdf0e10cSrcweir #include <frmatr.hxx> 63*cdf0e10cSrcweir #include <vos/mutex.hxx> 64*cdf0e10cSrcweir #include <IMark.hxx> 65*cdf0e10cSrcweir #include <unotxdoc.hxx> 66*cdf0e10cSrcweir #include <unodraw.hxx> 67*cdf0e10cSrcweir #include <svx/unoshcol.hxx> 68*cdf0e10cSrcweir #include <svx/unoshape.hxx> 69*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 70*cdf0e10cSrcweir #include <swerror.h> 71*cdf0e10cSrcweir #include <tools/cachestr.hxx> 72*cdf0e10cSrcweir #include <shellio.hxx> 73*cdf0e10cSrcweir #include <ndtxt.hxx> 74*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 75*cdf0e10cSrcweir #include <crsskip.hxx> 76*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 77*cdf0e10cSrcweir #include <editeng/outliner.hxx> 78*cdf0e10cSrcweir #include <editeng/editview.hxx> 79*cdf0e10cSrcweir #include <unobookmark.hxx> 80*cdf0e10cSrcweir #include <unoparagraph.hxx> 81*cdf0e10cSrcweir #include <unocrsrhelper.hxx> 82*cdf0e10cSrcweir #include <unotextrange.hxx> 83*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 84*cdf0e10cSrcweir #include <switerator.hxx> 85*cdf0e10cSrcweir #include "swdtflvr.hxx" 86*cdf0e10cSrcweir #include <vcl/svapp.hxx> 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir using namespace ::com::sun::star; 90*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 91*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 92*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 93*cdf0e10cSrcweir using namespace ::com::sun::star::text; 94*cdf0e10cSrcweir using namespace ::com::sun::star::view; 95*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 96*cdf0e10cSrcweir using namespace rtl; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir using ::com::sun::star::util::URL; 99*cdf0e10cSrcweir using comphelper::HelperBaseNoState; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir SV_IMPL_PTRARR( SelectionChangeListenerArr, XSelectionChangeListenerPtr ); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir /* -----------------22.05.98 12:20------------------- 104*cdf0e10cSrcweir * 105*cdf0e10cSrcweir * --------------------------------------------------*/ 106*cdf0e10cSrcweir SwPaM* lcl_createPamCopy(const SwPaM& rPam) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir SwPaM *const pRet = new SwPaM(*rPam.GetPoint()); 109*cdf0e10cSrcweir ::sw::DeepCopyPaM(rPam, *pRet); 110*cdf0e10cSrcweir return pRet; 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir /****************************************************************** 113*cdf0e10cSrcweir * SwXTextView 114*cdf0e10cSrcweir ******************************************************************/ 115*cdf0e10cSrcweir /*-- 17.12.98 09:34:25--------------------------------------------------- 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 118*cdf0e10cSrcweir SwXTextView::SwXTextView(SwView* pSwView) : 119*cdf0e10cSrcweir SfxBaseController(pSwView), 120*cdf0e10cSrcweir m_pView(pSwView), 121*cdf0e10cSrcweir m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_VIEW ) ), 122*cdf0e10cSrcweir pxViewSettings(0), 123*cdf0e10cSrcweir pxTextViewCursor(0) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir /*-- 17.12.98 09:34:25--------------------------------------------------- 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 130*cdf0e10cSrcweir SwXTextView::~SwXTextView() 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir Invalidate(); 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir /* -----------------------------09.03.01 15:47-------------------------------- 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 137*cdf0e10cSrcweir void SwXTextView::Invalidate() 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir if(pxViewSettings) 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir HelperBaseNoState *pSettings = static_cast < HelperBaseNoState * > ( pxViewSettings->get() ); 142*cdf0e10cSrcweir static_cast < SwXViewSettings* > ( pSettings )->Invalidate(); 143*cdf0e10cSrcweir DELETEZ(pxViewSettings); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir if(pxTextViewCursor) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir text::XTextViewCursor* pCrsr = pxTextViewCursor->get(); 148*cdf0e10cSrcweir ((SwXTextViewCursor*)pCrsr)->Invalidate(); 149*cdf0e10cSrcweir DELETEZ(pxTextViewCursor); 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir m_refCount++; //prevent second d'tor call 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_uInt16 nCount = aSelChangedListeners.Count(); 155*cdf0e10cSrcweir if(nCount) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir uno::Reference< uno::XInterface > xInt = (cppu::OWeakObject*)(SfxBaseController*)this; 158*cdf0e10cSrcweir lang::EventObject aEvent(xInt); 159*cdf0e10cSrcweir for ( sal_uInt16 i = nCount; i--; ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir uno::Reference< view::XSelectionChangeListener > *pObj = aSelChangedListeners[i]; 162*cdf0e10cSrcweir (*pObj)->disposing(aEvent); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // #i85580: now clean up any possibly remaining entries in the array... 167*cdf0e10cSrcweir // (i.e. listeners that did not call removeSelectionChangeListener in their disposing.) 168*cdf0e10cSrcweir while ((nCount = aSelChangedListeners.Count()) != 0) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir removeSelectionChangeListener( *aSelChangedListeners[0] ); 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir m_refCount--; 174*cdf0e10cSrcweir m_pView = 0; 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir /* -----------------------------18.05.00 10:18-------------------------------- 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 180*cdf0e10cSrcweir Sequence< uno::Type > SAL_CALL SwXTextView::getTypes( ) throw(uno::RuntimeException) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir // uno::Sequence< uno::Type > aViewTypes = SwXTextViewBaseClass::getTypes(); 183*cdf0e10cSrcweir uno::Sequence< uno::Type > aBaseTypes = SfxBaseController::getTypes(); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir long nIndex = aBaseTypes.getLength(); 186*cdf0e10cSrcweir aBaseTypes.realloc( 187*cdf0e10cSrcweir aBaseTypes.getLength() + 8 ); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir uno::Type* pBaseTypes = aBaseTypes.getArray(); 190*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XSelectionSupplier >*)0); 191*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XServiceInfo >*)0); 192*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XFormLayerAccess >*)0); 193*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XTextViewCursorSupplier>*)0); 194*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XViewSettingsSupplier >*)0); 195*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XRubySelection >*)0); 196*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XPropertySet >*)0); 197*cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier >*)0); 198*cdf0e10cSrcweir return aBaseTypes; 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir /* -----------------------------18.05.00 10:18-------------------------------- 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 203*cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL SwXTextView::getImplementationId( ) throw(uno::RuntimeException) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex()); 206*cdf0e10cSrcweir static Sequence< sal_Int8 > aId( 16 ); 207*cdf0e10cSrcweir static sal_Bool bInit = sal_False; 208*cdf0e10cSrcweir if(!bInit) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True ); 211*cdf0e10cSrcweir bInit = sal_True; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir return aId; 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir /* -----------------------------18.05.00 10:18-------------------------------- 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 218*cdf0e10cSrcweir void SAL_CALL SwXTextView::acquire( )throw() 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir SfxBaseController::acquire(); 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir /* -----------------------------18.05.00 10:18-------------------------------- 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 225*cdf0e10cSrcweir void SAL_CALL SwXTextView::release( )throw() 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir SfxBaseController::release(); 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir /* -----------------------------18.05.00 10:23-------------------------------- 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 232*cdf0e10cSrcweir uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType ) 233*cdf0e10cSrcweir throw (RuntimeException) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir uno::Any aRet; 236*cdf0e10cSrcweir if(aType == ::getCppuType((uno::Reference<view::XSelectionSupplier >*)0)) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir uno::Reference<view::XSelectionSupplier> xRet = this; 239*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<lang::XServiceInfo >*)0)) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir uno::Reference<lang::XServiceInfo> xRet = this; 244*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<view::XControlAccess >*)0)) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir uno::Reference<view::XControlAccess> xRet = this; 249*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<view::XFormLayerAccess >*)0)) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir uno::Reference<view::XFormLayerAccess> xRet = this; 254*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<text::XTextViewCursorSupplier>*)0)) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir uno::Reference<text::XTextViewCursorSupplier> xRet = this; 259*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<view::XViewSettingsSupplier >*)0)) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir uno::Reference<view::XViewSettingsSupplier> xRet = this; 264*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<XRubySelection>*)0)) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir uno::Reference<XRubySelection> xRet = this; 269*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<XPropertySet>*)0)) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir uno::Reference<XPropertySet> xRet = this; 274*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir else if(aType == ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier >*)0)) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferableSupplier> xRet = this; 279*cdf0e10cSrcweir aRet.setValue(&xRet, aType); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir else 282*cdf0e10cSrcweir aRet = SfxBaseController::queryInterface(aType); 283*cdf0e10cSrcweir return aRet; 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir /*-- 17.12.98 09:34:26--------------------------------------------------- 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 288*cdf0e10cSrcweir sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArgumentException, uno::RuntimeException ) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 291*cdf0e10cSrcweir uno::Reference< uno::XInterface > xInterface; 292*cdf0e10cSrcweir if(GetView() && (aInterface >>= xInterface)) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir SwWrtShell& rSh = GetView()->GetWrtShell(); 295*cdf0e10cSrcweir SwDoc* pDoc = GetView()->GetDocShell()->GetDoc(); 296*cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xIfcTunnel(xInterface, uno::UNO_QUERY); 297*cdf0e10cSrcweir uno::Reference< text::XTextCursor > xCrsr(xInterface, uno::UNO_QUERY); 298*cdf0e10cSrcweir uno::Reference< container::XIndexAccess > xPosN(xInterface, uno::UNO_QUERY); 299*cdf0e10cSrcweir uno::Reference< text::XTextRange > xPos(xInterface, uno::UNO_QUERY); 300*cdf0e10cSrcweir SwXFrame* pFrame = xIfcTunnel.is() ? reinterpret_cast<SwXFrame*>( 301*cdf0e10cSrcweir xIfcTunnel->getSomething(SwXFrame::getUnoTunnelId())) : 0; 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir SwXCell* pCell = xIfcTunnel.is() ? reinterpret_cast<SwXCell*>( 304*cdf0e10cSrcweir xIfcTunnel->getSomething(SwXCell::getUnoTunnelId())) : 0; 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir SwPaM * pPam = 0; 307*cdf0e10cSrcweir SwXTextRanges* pPosN = 0; 308*cdf0e10cSrcweir if(xCrsr.is()) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir // 311*cdf0e10cSrcweir OTextCursorHelper* pCursor = 312*cdf0e10cSrcweir xIfcTunnel.is() ? 313*cdf0e10cSrcweir reinterpret_cast<OTextCursorHelper*>(xIfcTunnel->getSomething(OTextCursorHelper::getUnoTunnelId())) 314*cdf0e10cSrcweir : 0; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir if(pCursor && pCursor->GetDoc() == GetView()->GetDocShell()->GetDoc()) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir pPam = lcl_createPamCopy(*pCursor->GetPaM()); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir else if(xPosN.is() && 322*cdf0e10cSrcweir xIfcTunnel.is() && 323*cdf0e10cSrcweir 0 != (pPosN = reinterpret_cast<SwXTextRanges*>(xIfcTunnel->getSomething(SwXTextRanges::getUnoTunnelId())))) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir const SwUnoCrsr* pUnoCrsr = pPosN->GetCursor(); 326*cdf0e10cSrcweir if(pUnoCrsr) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir pPam = lcl_createPamCopy(*pUnoCrsr); 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir // prevent misinterpretation of text frames that provide a XTextRange interface, too 332*cdf0e10cSrcweir else if(!pFrame && !pCell && xPos.is()) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir SwUnoInternalPaM aPam(*pDoc); 335*cdf0e10cSrcweir if (::sw::XTextRangeToSwPaM(aPam, xPos)) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir pPam = lcl_createPamCopy(aPam); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir if(pPam) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir rSh.EnterStdMode(); 343*cdf0e10cSrcweir rSh.SetSelection(*pPam); 344*cdf0e10cSrcweir while( pPam->GetNext() != pPam ) 345*cdf0e10cSrcweir delete pPam->GetNext(); 346*cdf0e10cSrcweir delete pPam; 347*cdf0e10cSrcweir return sal_True; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir if(pFrame) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir SwFrmFmt* pFrmFmt = pFrame->GetFrmFmt(); 353*cdf0e10cSrcweir if(pFrmFmt && pFrmFmt->GetDoc() == pDoc) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir sal_Bool bSuccess = rSh.GotoFly( pFrmFmt->GetName(), pFrame->GetFlyCntType()); 356*cdf0e10cSrcweir if (bSuccess) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir rSh.HideCrsr(); 359*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir return sal_True; 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir uno::Reference< text::XTextTable > xTbl(xInterface, uno::UNO_QUERY);; 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir if(xTbl.is() && xIfcTunnel.is()) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir SwXTextTable* pTable = reinterpret_cast<SwXTextTable*>( 370*cdf0e10cSrcweir xIfcTunnel->getSomething(SwXTextTable::getUnoTunnelId())); 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir SwFrmFmt* pTblFrmFmt = pTable ? ((SwXTextTable*)pTable)->GetFrmFmt() : 0; 373*cdf0e10cSrcweir if(pTblFrmFmt &&pTblFrmFmt->GetDoc() == pDoc) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir rSh.EnterStdMode(); 376*cdf0e10cSrcweir rSh.GotoTable(pTblFrmFmt->GetName()); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir return sal_True; 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir if(pCell) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir SwFrmFmt* pTblFrmFmt = pCell->GetFrmFmt(); 384*cdf0e10cSrcweir if(pTblFrmFmt && pTblFrmFmt->GetDoc() == pDoc) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir SwTableBox* pBox = pCell->GetTblBox(); 387*cdf0e10cSrcweir SwTable* pTable = SwTable::FindTable( pTblFrmFmt ); 388*cdf0e10cSrcweir pBox = pCell->FindBox(pTable, pBox); 389*cdf0e10cSrcweir if(pBox) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir const SwStartNode* pSttNd = pBox->GetSttNd(); 392*cdf0e10cSrcweir SwPosition aPos(*pSttNd); 393*cdf0e10cSrcweir SwPaM aPam(aPos); 394*cdf0e10cSrcweir aPam.Move(fnMoveForward, fnGoNode); 395*cdf0e10cSrcweir rSh.EnterStdMode(); 396*cdf0e10cSrcweir rSh.SetSelection(aPam); 397*cdf0e10cSrcweir return sal_True; 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir SwXCellRange* pRange = xIfcTunnel.is() ? reinterpret_cast<SwXCellRange*>( 402*cdf0e10cSrcweir xIfcTunnel->getSomething(SwXCellRange::getUnoTunnelId())) : 0; 403*cdf0e10cSrcweir if(pRange) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir const SwUnoCrsr* pUnoCrsr = pRange->GetTblCrsr(); 406*cdf0e10cSrcweir if(pUnoCrsr) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir UnoActionRemoveContext aContext(pDoc); 409*cdf0e10cSrcweir rSh.EnterStdMode(); 410*cdf0e10cSrcweir rSh.SetSelection(*pUnoCrsr); 411*cdf0e10cSrcweir return sal_True; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir uno::Reference< text::XTextContent > xBkm(xInterface, uno::UNO_QUERY);; 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir if(xBkm.is() && xIfcTunnel.is()) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir ::sw::mark::IMark const*const pMark( 419*cdf0e10cSrcweir SwXBookmark::GetBookmarkInDoc(pDoc, xIfcTunnel) ); 420*cdf0e10cSrcweir if (pMark) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir rSh.EnterStdMode(); 423*cdf0e10cSrcweir rSh.GotoMark(pMark); 424*cdf0e10cSrcweir return sal_True; 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir // IndexMark, Index, TextField, Draw, Section, Footnote, Paragraph 428*cdf0e10cSrcweir // 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir // detect controls 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir uno::Reference< awt::XControlModel > xCtrlModel(xInterface, UNO_QUERY); 433*cdf0e10cSrcweir if(xCtrlModel.is()) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir uno::Reference<awt::XControl> XControl; 436*cdf0e10cSrcweir SdrObject* pObj = GetControl(xCtrlModel, XControl); 437*cdf0e10cSrcweir if(pObj) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir SdrView* pDrawView = rSh.GetDrawView(); 440*cdf0e10cSrcweir SdrPageView* pPV = pDrawView->GetSdrPageView(); 441*cdf0e10cSrcweir if ( pPV && pObj->GetPage() == pPV->GetPage() ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir pDrawView->SdrEndTextEdit(); 444*cdf0e10cSrcweir pDrawView->UnmarkAll(); 445*cdf0e10cSrcweir pDrawView->MarkObj( pObj, pPV ); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir return sal_True; 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapeColl( xInterface, uno::UNO_QUERY ); 452*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xTmpProp(xInterface, uno::UNO_QUERY); 453*cdf0e10cSrcweir SwXShape* pSwXShape = 0; 454*cdf0e10cSrcweir if(xIfcTunnel.is()) 455*cdf0e10cSrcweir pSwXShape = reinterpret_cast<SwXShape*>(xIfcTunnel->getSomething(SwXShape::getUnoTunnelId())); 456*cdf0e10cSrcweir SvxShape* pSvxShape = 0; 457*cdf0e10cSrcweir if(pSwXShape) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir uno::Reference< uno::XAggregation > xAgg = pSwXShape->GetAggregationInterface(); 460*cdf0e10cSrcweir if(xAgg.is()) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir pSvxShape = reinterpret_cast<SvxShape*>(xIfcTunnel->getSomething(SvxShape::getUnoTunnelId())); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir } 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir if ( pSvxShape || xShapeColl.is() ) // Drawing drawing::Layer 467*cdf0e10cSrcweir { 468*cdf0e10cSrcweir SdrView* pDrawView = rSh.GetDrawView(); 469*cdf0e10cSrcweir if (pDrawView) 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir pDrawView->SdrEndTextEdit(); 472*cdf0e10cSrcweir pDrawView->UnmarkAll(); 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir if (pSvxShape) // einzelnes Shape 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir SdrObject *pObj = pSvxShape->GetSdrObject(); 477*cdf0e10cSrcweir if (pObj) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir // lcl_ShowObject( *m_pViewSh, *pDrawView, pObj ); 480*cdf0e10cSrcweir SdrPageView* pPV = pDrawView->GetSdrPageView(); 481*cdf0e10cSrcweir if ( pPV && pObj->GetPage() == pPV->GetPage() ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir pDrawView->MarkObj( pObj, pPV ); 484*cdf0e10cSrcweir return sal_True; 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir else // Shape Collection 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir sal_Bool bSelected = sal_False; 491*cdf0e10cSrcweir SdrPageView* pPV = NULL; 492*cdf0e10cSrcweir long nCount = xShapeColl->getCount(); 493*cdf0e10cSrcweir for ( long i = 0; i < nCount; i++ ) 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir uno::Reference< drawing::XShape > xShapeInt; 496*cdf0e10cSrcweir uno::Any aAny = xShapeColl->getByIndex(i); 497*cdf0e10cSrcweir aAny >>= xShapeInt; 498*cdf0e10cSrcweir if (xShapeInt.is()) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel> xShapeTunnel(xShapeInt, uno::UNO_QUERY); 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir SvxShape* pShape = xShapeTunnel.is() ? 503*cdf0e10cSrcweir reinterpret_cast<SvxShape*>(xShapeTunnel->getSomething(SvxShape::getUnoTunnelId())) : 0; 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir if (pShape) 506*cdf0e10cSrcweir { 507*cdf0e10cSrcweir SdrObject *pObj = pShape->GetSdrObject(); 508*cdf0e10cSrcweir if (pObj) 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir if (!pPV) // erstes Objekt 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir // lcl_ShowObject( *m_pViewSh, *pDrawView, pObj ); 513*cdf0e10cSrcweir pPV = pDrawView->GetSdrPageView(); 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir if ( pPV && pObj->GetPage() == pPV->GetPage() ) 516*cdf0e10cSrcweir { 517*cdf0e10cSrcweir pDrawView->MarkObj( pObj, pPV ); 518*cdf0e10cSrcweir bSelected = sal_True; 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir return bSelected; 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir return sal_False; 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir /*-- 17.12.98 09:34:26--------------------------------------------------- 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 535*cdf0e10cSrcweir uno::Any SwXTextView::getSelection(void) throw( uno::RuntimeException ) 536*cdf0e10cSrcweir { 537*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 538*cdf0e10cSrcweir uno::Reference< uno::XInterface > aRef; 539*cdf0e10cSrcweir if(GetView()) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir //force immediat shell update 542*cdf0e10cSrcweir m_pView->StopShellTimer(); 543*cdf0e10cSrcweir // ein interface aus der aktuellen Selektion erzeugen 544*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 545*cdf0e10cSrcweir ShellModes eSelMode = m_pView->GetShellMode(); 546*cdf0e10cSrcweir switch(eSelMode) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir case SHELL_MODE_TABLE_TEXT : 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir if(rSh.GetTableCrsr()) 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir DBG_ASSERT(rSh.GetTableFmt(), "kein Tabellenformat?"); 553*cdf0e10cSrcweir uno::Reference< text::XTextTableCursor > xCrsr = new SwXTextTableCursor(*rSh.GetTableFmt(), 554*cdf0e10cSrcweir rSh.GetTableCrsr()); 555*cdf0e10cSrcweir aRef = uno::Reference< uno::XInterface > (xCrsr, uno::UNO_QUERY);; 556*cdf0e10cSrcweir break; 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir // ohne Tabellenselektion wird der Text geliefert 561*cdf0e10cSrcweir //break; 562*cdf0e10cSrcweir case SHELL_MODE_LIST_TEXT : 563*cdf0e10cSrcweir case SHELL_MODE_TABLE_LIST_TEXT: 564*cdf0e10cSrcweir case SHELL_MODE_TEXT : 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir uno::Reference< container::XIndexAccess > xPos = new SwXTextRanges(rSh.GetCrsr()); 567*cdf0e10cSrcweir aRef = uno::Reference< uno::XInterface >(xPos, uno::UNO_QUERY); 568*cdf0e10cSrcweir } 569*cdf0e10cSrcweir break; 570*cdf0e10cSrcweir case SHELL_MODE_FRAME : 571*cdf0e10cSrcweir case SHELL_MODE_GRAPHIC : 572*cdf0e10cSrcweir case SHELL_MODE_OBJECT : 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir //Get FlyFrameFormat; fuer UI Macro Anbindung an Flys 575*cdf0e10cSrcweir const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt(); 576*cdf0e10cSrcweir if (pFmt) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir SwXFrame* pxFrame = SwIterator<SwXFrame,SwFmt>::FirstElement(*pFmt); 579*cdf0e10cSrcweir if(pxFrame) //das einzige gemeinsame interface fuer alle Frames 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir aRef = uno::Reference< uno::XInterface >((cppu::OWeakObject*)pxFrame, uno::UNO_QUERY); 582*cdf0e10cSrcweir } 583*cdf0e10cSrcweir else 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir if(SHELL_MODE_FRAME == eSelMode) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir uno::Reference< text::XTextFrame > xFrm = new SwXTextFrame((SwFrmFmt&)*pFmt); 588*cdf0e10cSrcweir aRef = uno::Reference< uno::XInterface >(xFrm, uno::UNO_QUERY); 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir else if(SHELL_MODE_GRAPHIC == eSelMode) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir uno::Reference< text::XTextContent > xFrm = new SwXTextGraphicObject((SwFrmFmt&)*pFmt); 593*cdf0e10cSrcweir aRef = xFrm; 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir else 596*cdf0e10cSrcweir { 597*cdf0e10cSrcweir uno::Reference< text::XTextContent > xFrm = new SwXTextEmbeddedObject((SwFrmFmt&)*pFmt); 598*cdf0e10cSrcweir aRef = xFrm; 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir } 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir break; 604*cdf0e10cSrcweir case SHELL_MODE_DRAW : 605*cdf0e10cSrcweir case SHELL_MODE_DRAW_CTRL : 606*cdf0e10cSrcweir case SHELL_MODE_DRAW_FORM : 607*cdf0e10cSrcweir case SHELL_MODE_DRAWTEXT : 608*cdf0e10cSrcweir case SHELL_MODE_BEZIER : 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir uno::Reference< drawing::XDrawPageSupplier > xPageSupp; 611*cdf0e10cSrcweir uno::Reference< frame::XModel > xModel = m_pView->GetDocShell()->GetBaseModel(); 612*cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xModelTunnel(xModel, uno::UNO_QUERY); 613*cdf0e10cSrcweir SwXTextDocument* pTextDoc = reinterpret_cast<SwXTextDocument*>(xModelTunnel-> 614*cdf0e10cSrcweir getSomething(SwXTextDocument::getUnoTunnelId())); 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir SwFmDrawPage* pSvxDrawPage = pTextDoc->GetDrawPage()->GetSvxPage(); 617*cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShCol = new SvxShapeCollection(); 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir const SdrMarkList& rMarkList = rSh.GetDrawView()->GetMarkedObjectList(); 620*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < rMarkList.GetMarkCount(); i++) 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 623*cdf0e10cSrcweir uno::Reference< uno::XInterface > xInt = pSvxDrawPage->GetInterface( pObj ); 624*cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape(xInt, uno::UNO_QUERY);; 625*cdf0e10cSrcweir xShCol->add(xShape); 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir aRef = uno::Reference< uno::XInterface >(xShCol, uno::UNO_QUERY); 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir break; 630*cdf0e10cSrcweir default:;//prevent warning 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir } 633*cdf0e10cSrcweir uno::Any aRet(&aRef, ::getCppuType((uno::Reference<uno::XInterface>*)0)); 634*cdf0e10cSrcweir return aRet; 635*cdf0e10cSrcweir } 636*cdf0e10cSrcweir /*-- 17.12.98 09:34:27--------------------------------------------------- 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 639*cdf0e10cSrcweir void SwXTextView::addSelectionChangeListener( 640*cdf0e10cSrcweir const uno::Reference< view::XSelectionChangeListener > & rxListener) 641*cdf0e10cSrcweir throw( uno::RuntimeException ) 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 644*cdf0e10cSrcweir uno::Reference< view::XSelectionChangeListener > * pInsert = new uno::Reference< view::XSelectionChangeListener > ; 645*cdf0e10cSrcweir *pInsert = rxListener; 646*cdf0e10cSrcweir aSelChangedListeners.Insert(pInsert, aSelChangedListeners.Count()); 647*cdf0e10cSrcweir } 648*cdf0e10cSrcweir /*-- 17.12.98 09:34:27--------------------------------------------------- 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 651*cdf0e10cSrcweir void SwXTextView::removeSelectionChangeListener( 652*cdf0e10cSrcweir const uno::Reference< view::XSelectionChangeListener > & rxListener) 653*cdf0e10cSrcweir throw( uno::RuntimeException ) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 656*cdf0e10cSrcweir view::XSelectionChangeListener* pLeft = rxListener.get(); 657*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aSelChangedListeners.Count(); i++) 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir uno::Reference< view::XSelectionChangeListener > * pElem = aSelChangedListeners.GetObject(i); 660*cdf0e10cSrcweir view::XSelectionChangeListener* pRight = pElem->get(); 661*cdf0e10cSrcweir if(pLeft == pRight) 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir aSelChangedListeners.Remove(i); 664*cdf0e10cSrcweir delete pElem; 665*cdf0e10cSrcweir break; 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir } 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir /* -----------------------------01.06.01 14:41-------------------------------- 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 672*cdf0e10cSrcweir SdrObject* SwXTextView::GetControl( 673*cdf0e10cSrcweir const uno::Reference< awt::XControlModel > & xModel, 674*cdf0e10cSrcweir uno::Reference< awt::XControl >& xToFill ) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir SwView* pView2 = GetView(); 677*cdf0e10cSrcweir FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL; 678*cdf0e10cSrcweir SdrView* pDrawView = pView2 ? pView2->GetDrawView() : NULL; 679*cdf0e10cSrcweir Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL; 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" ); 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir SdrObject* pControl = NULL; 684*cdf0e10cSrcweir if ( pFormShell && pDrawView && pWindow ) 685*cdf0e10cSrcweir pControl = pFormShell->GetFormControl( xModel, *pDrawView, *pWindow, xToFill ); 686*cdf0e10cSrcweir return pControl; 687*cdf0e10cSrcweir } 688*cdf0e10cSrcweir /*-- 17.12.98 09:34:27--------------------------------------------------- 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 691*cdf0e10cSrcweir uno::Reference< awt::XControl > SwXTextView::getControl(const uno::Reference< awt::XControlModel > & xModel) 692*cdf0e10cSrcweir throw( container::NoSuchElementException, uno::RuntimeException ) 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 695*cdf0e10cSrcweir uno::Reference< awt::XControl > xRet; 696*cdf0e10cSrcweir GetControl(xModel, xRet); 697*cdf0e10cSrcweir return xRet; 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir /*-- 08.03.07 13:55------------------------------------------------------ 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 703*cdf0e10cSrcweir uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& _Form ) throw (RuntimeException) 704*cdf0e10cSrcweir { 705*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir SwView* pView2 = GetView(); 708*cdf0e10cSrcweir FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL; 709*cdf0e10cSrcweir SdrView* pDrawView = pView2 ? pView2->GetDrawView() : NULL; 710*cdf0e10cSrcweir Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL; 711*cdf0e10cSrcweir DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::getFormController: how could I?" ); 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir uno::Reference< form::runtime::XFormController > xController; 714*cdf0e10cSrcweir if ( pFormShell && pDrawView && pWindow ) 715*cdf0e10cSrcweir xController = pFormShell->GetFormController( _Form, *pDrawView, *pWindow ); 716*cdf0e10cSrcweir return xController; 717*cdf0e10cSrcweir } 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir /*-- 08.03.07 13:55------------------------------------------------------ 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 722*cdf0e10cSrcweir ::sal_Bool SAL_CALL SwXTextView::isFormDesignMode( ) throw (uno::RuntimeException) 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 725*cdf0e10cSrcweir SwView* pView2 = GetView(); 726*cdf0e10cSrcweir FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL; 727*cdf0e10cSrcweir return pFormShell ? pFormShell->IsDesignMode() : sal_True; 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir /*-- 08.03.07 13:55------------------------------------------------------ 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 733*cdf0e10cSrcweir void SAL_CALL SwXTextView::setFormDesignMode( ::sal_Bool _DesignMode ) throw (RuntimeException) 734*cdf0e10cSrcweir { 735*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 736*cdf0e10cSrcweir SwView* pView2 = GetView(); 737*cdf0e10cSrcweir FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL; 738*cdf0e10cSrcweir if ( pFormShell ) 739*cdf0e10cSrcweir pFormShell->SetDesignMode( _DesignMode ); 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir /*-- 17.12.98 09:34:28--------------------------------------------------- 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 745*cdf0e10cSrcweir uno::Reference< text::XTextViewCursor > SwXTextView::getViewCursor(void) throw( uno::RuntimeException ) 746*cdf0e10cSrcweir { 747*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 748*cdf0e10cSrcweir if(GetView()) 749*cdf0e10cSrcweir { 750*cdf0e10cSrcweir if(!pxTextViewCursor) 751*cdf0e10cSrcweir { 752*cdf0e10cSrcweir ((SwXTextView*)this)->pxTextViewCursor = new uno::Reference< text::XTextViewCursor > ; 753*cdf0e10cSrcweir *pxTextViewCursor = new SwXTextViewCursor(GetView()); 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir return *pxTextViewCursor; 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir else 758*cdf0e10cSrcweir throw uno::RuntimeException(); 759*cdf0e10cSrcweir } 760*cdf0e10cSrcweir /*-- 17.12.98 09:34:28--------------------------------------------------- 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 763*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > SwXTextView::getViewSettings(void) throw( uno::RuntimeException ) 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 766*cdf0e10cSrcweir if(m_pView) 767*cdf0e10cSrcweir { 768*cdf0e10cSrcweir if(!pxViewSettings) 769*cdf0e10cSrcweir { 770*cdf0e10cSrcweir ((SwXTextView*)this)->pxViewSettings = new uno::Reference< beans::XPropertySet > ; 771*cdf0e10cSrcweir *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, m_pView ) ); 772*cdf0e10cSrcweir } 773*cdf0e10cSrcweir } 774*cdf0e10cSrcweir else 775*cdf0e10cSrcweir throw uno::RuntimeException(); 776*cdf0e10cSrcweir return *pxViewSettings; 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir /* -----------------------------30.01.01 15:01-------------------------------- 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 781*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAutomatic*/ ) throw(RuntimeException) 782*cdf0e10cSrcweir { 783*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 784*cdf0e10cSrcweir 785*cdf0e10cSrcweir if(!GetView()) 786*cdf0e10cSrcweir throw RuntimeException(); 787*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 788*cdf0e10cSrcweir ShellModes eSelMode = m_pView->GetShellMode(); 789*cdf0e10cSrcweir if (eSelMode != SHELL_MODE_LIST_TEXT && 790*cdf0e10cSrcweir eSelMode != SHELL_MODE_TABLE_LIST_TEXT && 791*cdf0e10cSrcweir eSelMode != SHELL_MODE_TABLE_TEXT && 792*cdf0e10cSrcweir eSelMode != SHELL_MODE_TEXT ) 793*cdf0e10cSrcweir return Sequence< Sequence< PropertyValue > > (); 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); 796*cdf0e10cSrcweir SwRubyList aList; 797*cdf0e10cSrcweir 798*cdf0e10cSrcweir sal_uInt16 nCount = pDoc->FillRubyList( *rSh.GetCrsr(), aList, 0 ); 799*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > aRet(nCount); 800*cdf0e10cSrcweir Sequence< PropertyValue >* pRet = aRet.getArray(); 801*cdf0e10cSrcweir String aString; 802*cdf0e10cSrcweir for(sal_uInt16 n = 0; n < nCount; n++) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir const SwRubyListEntryPtr pEntry = aList[n]; 805*cdf0e10cSrcweir 806*cdf0e10cSrcweir const String& rEntryText = pEntry->GetText(); 807*cdf0e10cSrcweir const SwFmtRuby& rAttr = pEntry->GetRubyAttr(); 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir pRet[n].realloc(5); 810*cdf0e10cSrcweir PropertyValue* pValues = pRet[n].getArray(); 811*cdf0e10cSrcweir pValues[0].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_BASE_TEXT)); 812*cdf0e10cSrcweir pValues[0].Value <<= OUString(rEntryText); 813*cdf0e10cSrcweir pValues[1].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_TEXT)); 814*cdf0e10cSrcweir pValues[1].Value <<= OUString(rAttr.GetText()); 815*cdf0e10cSrcweir pValues[2].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_CHAR_STYLE_NAME)); 816*cdf0e10cSrcweir SwStyleNameMapper::FillProgName(rAttr.GetCharFmtName(), aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True ); 817*cdf0e10cSrcweir pValues[2].Value <<= OUString( aString ); 818*cdf0e10cSrcweir pValues[3].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_ADJUST)); 819*cdf0e10cSrcweir pValues[3].Value <<= (sal_Int16)rAttr.GetAdjustment(); 820*cdf0e10cSrcweir pValues[4].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_IS_ABOVE)); 821*cdf0e10cSrcweir sal_Bool bVal = !rAttr.GetPosition(); 822*cdf0e10cSrcweir pValues[4].Value.setValue(&bVal, ::getBooleanCppuType()); 823*cdf0e10cSrcweir } 824*cdf0e10cSrcweir return aRet; 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir /* -----------------------------30.01.01 15:02-------------------------------- 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 829*cdf0e10cSrcweir void SAL_CALL SwXTextView::setRubyList( 830*cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& rRubyList, sal_Bool /*bAutomatic*/ ) 831*cdf0e10cSrcweir throw(RuntimeException) 832*cdf0e10cSrcweir { 833*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir if(!GetView() || !rRubyList.getLength()) 836*cdf0e10cSrcweir throw RuntimeException(); 837*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 838*cdf0e10cSrcweir ShellModes eSelMode = m_pView->GetShellMode(); 839*cdf0e10cSrcweir if (eSelMode != SHELL_MODE_LIST_TEXT && 840*cdf0e10cSrcweir eSelMode != SHELL_MODE_TABLE_LIST_TEXT && 841*cdf0e10cSrcweir eSelMode != SHELL_MODE_TABLE_TEXT && 842*cdf0e10cSrcweir eSelMode != SHELL_MODE_TEXT ) 843*cdf0e10cSrcweir throw RuntimeException(); 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir SwRubyList aList; 846*cdf0e10cSrcweir 847*cdf0e10cSrcweir const Sequence<PropertyValue>* pRubyList = rRubyList.getConstArray(); 848*cdf0e10cSrcweir for(sal_Int32 nPos = 0; nPos < rRubyList.getLength(); nPos++) 849*cdf0e10cSrcweir { 850*cdf0e10cSrcweir SwRubyListEntryPtr pEntry = new SwRubyListEntry; 851*cdf0e10cSrcweir const PropertyValue* pProperties = pRubyList[nPos].getConstArray(); 852*cdf0e10cSrcweir OUString sTmp; 853*cdf0e10cSrcweir for(sal_Int32 nProp = 0; nProp < pRubyList[nPos].getLength(); nProp++) 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir if(pProperties[nProp].Name.equalsAsciiL( 856*cdf0e10cSrcweir SW_PROP_NAME(UNO_NAME_RUBY_BASE_TEXT))) 857*cdf0e10cSrcweir { 858*cdf0e10cSrcweir pProperties[nProp].Value >>= sTmp; 859*cdf0e10cSrcweir pEntry->SetText(sTmp); 860*cdf0e10cSrcweir } 861*cdf0e10cSrcweir else if(pProperties[nProp].Name.equalsAsciiL( 862*cdf0e10cSrcweir SW_PROP_NAME(UNO_NAME_RUBY_TEXT))) 863*cdf0e10cSrcweir { 864*cdf0e10cSrcweir pProperties[nProp].Value >>= sTmp; 865*cdf0e10cSrcweir pEntry->GetRubyAttr().SetText(sTmp); 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir else if(pProperties[nProp].Name.equalsAsciiL( 868*cdf0e10cSrcweir SW_PROP_NAME(UNO_NAME_RUBY_CHAR_STYLE_NAME))) 869*cdf0e10cSrcweir { 870*cdf0e10cSrcweir if((pProperties[nProp].Value >>= sTmp)) 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir String sName; 873*cdf0e10cSrcweir SwStyleNameMapper::FillUIName(sTmp, sName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True ); 874*cdf0e10cSrcweir sal_uInt16 nPoolId = sName.Len() ? 875*cdf0e10cSrcweir SwStyleNameMapper::GetPoolIdFromUIName( sName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) : 0; 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir pEntry->GetRubyAttr().SetCharFmtName( sName ); 878*cdf0e10cSrcweir pEntry->GetRubyAttr().SetCharFmtId( nPoolId ); 879*cdf0e10cSrcweir } 880*cdf0e10cSrcweir } 881*cdf0e10cSrcweir else if(pProperties[nProp].Name.equalsAsciiL( 882*cdf0e10cSrcweir SW_PROP_NAME(UNO_NAME_RUBY_ADJUST))) 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir sal_Int16 nTmp = 0; 885*cdf0e10cSrcweir if((pProperties[nProp].Value >>= nTmp)) 886*cdf0e10cSrcweir pEntry->GetRubyAttr().SetAdjustment(nTmp); 887*cdf0e10cSrcweir } 888*cdf0e10cSrcweir else if(pProperties[nProp].Name.equalsAsciiL( 889*cdf0e10cSrcweir SW_PROP_NAME(UNO_NAME_RUBY_IS_ABOVE))) 890*cdf0e10cSrcweir { 891*cdf0e10cSrcweir sal_Bool bValue = pProperties[nProp].Value.hasValue() ? 892*cdf0e10cSrcweir *(sal_Bool*)pProperties[nProp].Value.getValue() : sal_True; 893*cdf0e10cSrcweir pEntry->GetRubyAttr().SetPosition(bValue ? 0 : 1); 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir } 896*cdf0e10cSrcweir aList.Insert(pEntry, (sal_uInt16)nPos); 897*cdf0e10cSrcweir } 898*cdf0e10cSrcweir SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); 899*cdf0e10cSrcweir pDoc->SetRubyList( *rSh.GetCrsr(), aList, 0 ); 900*cdf0e10cSrcweir } 901*cdf0e10cSrcweir /*-- 29.12.02 15:45:29--------------------------------------------------- 902*cdf0e10cSrcweir 903*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 904*cdf0e10cSrcweir SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc() 905*cdf0e10cSrcweir { 906*cdf0e10cSrcweir SwWrtShell& rOldSh = m_pView->GetWrtShell(); 907*cdf0e10cSrcweir SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false ); 908*cdf0e10cSrcweir SwDocShell* pDocSh; 909*cdf0e10cSrcweir SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) ); 910*cdf0e10cSrcweir xDocSh->DoInitNew( 0 ); 911*cdf0e10cSrcweir SwDoc *const pTempDoc( pDocSh->GetDoc() ); 912*cdf0e10cSrcweir // #i103634#, #i112425#: do not expand numbering and fields on PDF export 913*cdf0e10cSrcweir pTempDoc->SetClipBoard(true); 914*cdf0e10cSrcweir rOldSh.FillPrtDoc(pTempDoc, pPrt); 915*cdf0e10cSrcweir SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); 916*cdf0e10cSrcweir SwView* pDocView = (SwView*) pDocFrame->GetViewShell(); 917*cdf0e10cSrcweir pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird. 918*cdf0e10cSrcweir SwWrtShell* pSh = pDocView->GetWrtShellPtr(); 919*cdf0e10cSrcweir 920*cdf0e10cSrcweir IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); 921*cdf0e10cSrcweir SfxPrinter* pTempPrinter = pIDDA->getPrinter( true ); 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc()); 924*cdf0e10cSrcweir 925*cdf0e10cSrcweir IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess(); 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir if( pIDDA_old->getPrinter( false ) ) 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); 930*cdf0e10cSrcweir //#69563# if it isn't the same printer then the pointer has been invalidated! 931*cdf0e10cSrcweir pTempPrinter = pIDDA->getPrinter( true ); 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir return xDocSh; 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir /*-- 17.12.98 09:34:29--------------------------------------------------- 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 942*cdf0e10cSrcweir void SwXTextView::NotifySelChanged() 943*cdf0e10cSrcweir { 944*cdf0e10cSrcweir DBG_ASSERT( m_pView, "view is missing" ); 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir // destroy temporary document with selected text that is used 947*cdf0e10cSrcweir // in PDF export of (multi-)selections. 948*cdf0e10cSrcweir if (m_pView && m_pView->GetTmpSelectionDoc().Is()) 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir m_pView->GetTmpSelectionDoc()->DoClose(); 951*cdf0e10cSrcweir m_pView->GetTmpSelectionDoc() = 0; 952*cdf0e10cSrcweir } 953*cdf0e10cSrcweir 954*cdf0e10cSrcweir uno::Reference< uno::XInterface > xInt = (cppu::OWeakObject*)(SfxBaseController*)this; 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir lang::EventObject aEvent(xInt); 957*cdf0e10cSrcweir 958*cdf0e10cSrcweir sal_uInt16 nCount = aSelChangedListeners.Count(); 959*cdf0e10cSrcweir for ( sal_uInt16 i = nCount; i--; ) 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir uno::Reference< view::XSelectionChangeListener > *pObj = aSelChangedListeners[i]; 962*cdf0e10cSrcweir (*pObj)->selectionChanged(aEvent); 963*cdf0e10cSrcweir } 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir /* -----------------------------12.07.01 13:26-------------------------------- 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 968*cdf0e10cSrcweir void SwXTextView::NotifyDBChanged() 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir URL aURL; 971*cdf0e10cSrcweir aURL.Complete = C2U(SwXDispatch::GetDBChangeURL()); 972*cdf0e10cSrcweir 973*cdf0e10cSrcweir sal_uInt16 nCount = aSelChangedListeners.Count(); 974*cdf0e10cSrcweir for ( sal_uInt16 i = nCount; i--; ) 975*cdf0e10cSrcweir { 976*cdf0e10cSrcweir uno::Reference< view::XSelectionChangeListener > *pObj = aSelChangedListeners[i]; 977*cdf0e10cSrcweir uno::Reference<XDispatch> xDispatch((*pObj), UNO_QUERY); 978*cdf0e10cSrcweir if(xDispatch.is()) 979*cdf0e10cSrcweir xDispatch->dispatch(aURL, Sequence<PropertyValue>(0)); 980*cdf0e10cSrcweir } 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir /* -----------------------------10.12.04 11:07-------------------------------- 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 986*cdf0e10cSrcweir 987*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo( ) 988*cdf0e10cSrcweir throw (uno::RuntimeException) 989*cdf0e10cSrcweir { 990*cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 991*cdf0e10cSrcweir static uno::Reference< XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); 992*cdf0e10cSrcweir return aRef; 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir 995*cdf0e10cSrcweir 996*cdf0e10cSrcweir void SAL_CALL SwXTextView::setPropertyValue( 997*cdf0e10cSrcweir const OUString& rPropertyName, const uno::Any& rValue ) 998*cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 999*cdf0e10cSrcweir { 1000*cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 1001*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); 1002*cdf0e10cSrcweir if (!pEntry) 1003*cdf0e10cSrcweir throw UnknownPropertyException(); 1004*cdf0e10cSrcweir else if (pEntry->nFlags & PropertyAttribute::READONLY) 1005*cdf0e10cSrcweir throw PropertyVetoException(); 1006*cdf0e10cSrcweir else 1007*cdf0e10cSrcweir { 1008*cdf0e10cSrcweir switch (pEntry->nWID) 1009*cdf0e10cSrcweir { 1010*cdf0e10cSrcweir case WID_IS_HIDE_SPELL_MARKS : 1011*cdf0e10cSrcweir // deprecated #i91949 1012*cdf0e10cSrcweir break; 1013*cdf0e10cSrcweir case WID_IS_CONSTANT_SPELLCHECK : 1014*cdf0e10cSrcweir { 1015*cdf0e10cSrcweir sal_Bool bVal = sal_False; 1016*cdf0e10cSrcweir const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions(); 1017*cdf0e10cSrcweir if (!pOpt || !(rValue >>= bVal)) 1018*cdf0e10cSrcweir throw RuntimeException(); 1019*cdf0e10cSrcweir SwViewOption aNewOpt( *pOpt ); 1020*cdf0e10cSrcweir if (pEntry->nWID == WID_IS_CONSTANT_SPELLCHECK) 1021*cdf0e10cSrcweir aNewOpt.SetOnlineSpell(bVal); 1022*cdf0e10cSrcweir m_pView->GetWrtShell().ApplyViewOptions( aNewOpt ); 1023*cdf0e10cSrcweir } 1024*cdf0e10cSrcweir break; 1025*cdf0e10cSrcweir default : 1026*cdf0e10cSrcweir DBG_ERROR("unknown WID"); 1027*cdf0e10cSrcweir } 1028*cdf0e10cSrcweir } 1029*cdf0e10cSrcweir } 1030*cdf0e10cSrcweir 1031*cdf0e10cSrcweir 1032*cdf0e10cSrcweir uno::Any SAL_CALL SwXTextView::getPropertyValue( 1033*cdf0e10cSrcweir const OUString& rPropertyName ) 1034*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1035*cdf0e10cSrcweir { 1036*cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 1037*cdf0e10cSrcweir 1038*cdf0e10cSrcweir Any aRet; 1039*cdf0e10cSrcweir 1040*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); 1041*cdf0e10cSrcweir if (!pEntry) 1042*cdf0e10cSrcweir throw UnknownPropertyException(); 1043*cdf0e10cSrcweir else 1044*cdf0e10cSrcweir { 1045*cdf0e10cSrcweir sal_Int16 nWID = pEntry->nWID; 1046*cdf0e10cSrcweir switch (nWID) 1047*cdf0e10cSrcweir { 1048*cdf0e10cSrcweir case WID_PAGE_COUNT : 1049*cdf0e10cSrcweir case WID_LINE_COUNT : 1050*cdf0e10cSrcweir { 1051*cdf0e10cSrcweir // format document completely in order to get meaningful 1052*cdf0e10cSrcweir // values for page count and line count 1053*cdf0e10cSrcweir m_pView->GetWrtShell().CalcLayout(); 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir sal_Int32 nCount = -1; 1056*cdf0e10cSrcweir if (nWID == WID_PAGE_COUNT) 1057*cdf0e10cSrcweir nCount = m_pView->GetWrtShell().GetPageCount(); 1058*cdf0e10cSrcweir else // WID_LINE_COUNT 1059*cdf0e10cSrcweir nCount = m_pView->GetWrtShell().GetLineCount( sal_False /*of whole document*/ ); 1060*cdf0e10cSrcweir aRet <<= nCount; 1061*cdf0e10cSrcweir } 1062*cdf0e10cSrcweir break; 1063*cdf0e10cSrcweir case WID_IS_HIDE_SPELL_MARKS : 1064*cdf0e10cSrcweir // deprecated #i91949 1065*cdf0e10cSrcweir break; 1066*cdf0e10cSrcweir case WID_IS_CONSTANT_SPELLCHECK : 1067*cdf0e10cSrcweir { 1068*cdf0e10cSrcweir const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions(); 1069*cdf0e10cSrcweir if (!pOpt) 1070*cdf0e10cSrcweir throw RuntimeException(); 1071*cdf0e10cSrcweir sal_uInt32 nFlag = VIEWOPT_1_ONLINESPELL; 1072*cdf0e10cSrcweir sal_Bool bVal = 0 != (pOpt->GetCoreOptions() & nFlag); 1073*cdf0e10cSrcweir aRet <<= bVal; 1074*cdf0e10cSrcweir } 1075*cdf0e10cSrcweir break; 1076*cdf0e10cSrcweir default : 1077*cdf0e10cSrcweir DBG_ERROR("unknown WID"); 1078*cdf0e10cSrcweir } 1079*cdf0e10cSrcweir } 1080*cdf0e10cSrcweir 1081*cdf0e10cSrcweir return aRet; 1082*cdf0e10cSrcweir } 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir void SAL_CALL SwXTextView::addPropertyChangeListener( 1086*cdf0e10cSrcweir const OUString& /*rPropertyName*/, 1087*cdf0e10cSrcweir const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ ) 1088*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1089*cdf0e10cSrcweir { 1090*cdf0e10cSrcweir DBG_WARNING("not implemented"); 1091*cdf0e10cSrcweir } 1092*cdf0e10cSrcweir 1093*cdf0e10cSrcweir 1094*cdf0e10cSrcweir void SAL_CALL SwXTextView::removePropertyChangeListener( 1095*cdf0e10cSrcweir const OUString& /*rPropertyName*/, 1096*cdf0e10cSrcweir const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ ) 1097*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1098*cdf0e10cSrcweir { 1099*cdf0e10cSrcweir DBG_WARNING("not implemented"); 1100*cdf0e10cSrcweir } 1101*cdf0e10cSrcweir 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir void SAL_CALL SwXTextView::addVetoableChangeListener( 1104*cdf0e10cSrcweir const OUString& /*rPropertyName*/, 1105*cdf0e10cSrcweir const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ ) 1106*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1107*cdf0e10cSrcweir { 1108*cdf0e10cSrcweir DBG_WARNING("not implemented"); 1109*cdf0e10cSrcweir } 1110*cdf0e10cSrcweir 1111*cdf0e10cSrcweir 1112*cdf0e10cSrcweir void SAL_CALL SwXTextView::removeVetoableChangeListener( 1113*cdf0e10cSrcweir const OUString& /*rPropertyName*/, 1114*cdf0e10cSrcweir const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ ) 1115*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1116*cdf0e10cSrcweir { 1117*cdf0e10cSrcweir DBG_WARNING("not implemented"); 1118*cdf0e10cSrcweir } 1119*cdf0e10cSrcweir 1120*cdf0e10cSrcweir /* -----------------------------06.04.00 11:07-------------------------------- 1121*cdf0e10cSrcweir 1122*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1123*cdf0e10cSrcweir OUString SwXTextView::getImplementationName(void) throw( RuntimeException ) 1124*cdf0e10cSrcweir { 1125*cdf0e10cSrcweir return C2U("SwXTextView"); 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir /* -----------------------------06.04.00 11:07-------------------------------- 1128*cdf0e10cSrcweir 1129*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1130*cdf0e10cSrcweir sal_Bool SwXTextView::supportsService(const OUString& rServiceName) throw( RuntimeException ) 1131*cdf0e10cSrcweir { 1132*cdf0e10cSrcweir return rServiceName.equalsAscii("com.sun.star.text.TextDocumentView") || 1133*cdf0e10cSrcweir rServiceName.equalsAscii("com.sun.star.view.OfficeDocumentView"); 1134*cdf0e10cSrcweir } 1135*cdf0e10cSrcweir /* -----------------------------06.04.00 11:07-------------------------------- 1136*cdf0e10cSrcweir 1137*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1138*cdf0e10cSrcweir Sequence< OUString > SwXTextView::getSupportedServiceNames(void) throw( RuntimeException ) 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir Sequence< OUString > aRet(2); 1141*cdf0e10cSrcweir OUString* pArray = aRet.getArray(); 1142*cdf0e10cSrcweir pArray[0] = C2U("com.sun.star.text.TextDocumentView"); 1143*cdf0e10cSrcweir pArray[1] = C2U("com.sun.star.view.OfficeDocumentView"); 1144*cdf0e10cSrcweir return aRet; 1145*cdf0e10cSrcweir } 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir /****************************************************************** 1148*cdf0e10cSrcweir * SwXTextViewCursor 1149*cdf0e10cSrcweir ******************************************************************/ 1150*cdf0e10cSrcweir /*-- 17.12.98 09:36:23--------------------------------------------------- 1151*cdf0e10cSrcweir 1152*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1153*cdf0e10cSrcweir SwXTextViewCursor::SwXTextViewCursor(SwView* pVw) : 1154*cdf0e10cSrcweir m_pView(pVw), 1155*cdf0e10cSrcweir m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)) 1156*cdf0e10cSrcweir { 1157*cdf0e10cSrcweir } 1158*cdf0e10cSrcweir /*-- 17.12.98 09:36:24--------------------------------------------------- 1159*cdf0e10cSrcweir 1160*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1161*cdf0e10cSrcweir SwXTextViewCursor::~SwXTextViewCursor() 1162*cdf0e10cSrcweir { 1163*cdf0e10cSrcweir } 1164*cdf0e10cSrcweir /*-- 06.10.04 09:36:25--------------------------------------------------- 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1167*cdf0e10cSrcweir 1168*cdf0e10cSrcweir // used to determine if there is a text selction or not. 1169*cdf0e10cSrcweir // If there is no text selection the functions that need a working 1170*cdf0e10cSrcweir // cursor will be disabled (throw RuntimeException). This will be the case 1171*cdf0e10cSrcweir // for the following interfaces: 1172*cdf0e10cSrcweir // - XViewCursor 1173*cdf0e10cSrcweir // - XTextCursor 1174*cdf0e10cSrcweir // - XTextRange 1175*cdf0e10cSrcweir // - XLineCursor 1176*cdf0e10cSrcweir 1177*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::IsTextSelection( sal_Bool bAllowTables ) const 1178*cdf0e10cSrcweir { 1179*cdf0e10cSrcweir 1180*cdf0e10cSrcweir sal_Bool bRes = sal_False; 1181*cdf0e10cSrcweir DBG_ASSERT(m_pView, "m_pView is NULL ???"); 1182*cdf0e10cSrcweir if(m_pView) 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir //! m_pView->GetShellMode() will only work after the shell 1185*cdf0e10cSrcweir //! has already changed and thus can not be used here! 1186*cdf0e10cSrcweir SelectionType eSelType = m_pView->GetWrtShell().GetSelectionType(); 1187*cdf0e10cSrcweir bRes = ( (nsSelectionType::SEL_TXT & eSelType) || 1188*cdf0e10cSrcweir (nsSelectionType::SEL_NUM & eSelType) ) && 1189*cdf0e10cSrcweir (!(nsSelectionType::SEL_TBL_CELLS & eSelType) || bAllowTables); 1190*cdf0e10cSrcweir } 1191*cdf0e10cSrcweir return bRes; 1192*cdf0e10cSrcweir } 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir /*-- 17.12.98 09:36:25--------------------------------------------------- 1195*cdf0e10cSrcweir 1196*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1197*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isVisible(void) throw( uno::RuntimeException ) 1198*cdf0e10cSrcweir { 1199*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1200*cdf0e10cSrcweir DBG_WARNING("not implemented"); 1201*cdf0e10cSrcweir return sal_True; 1202*cdf0e10cSrcweir } 1203*cdf0e10cSrcweir /*-- 17.12.98 09:36:25--------------------------------------------------- 1204*cdf0e10cSrcweir 1205*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1206*cdf0e10cSrcweir void SwXTextViewCursor::setVisible(sal_Bool /*bVisible*/) throw( uno::RuntimeException ) 1207*cdf0e10cSrcweir { 1208*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1209*cdf0e10cSrcweir DBG_WARNING("not implemented"); 1210*cdf0e10cSrcweir } 1211*cdf0e10cSrcweir /*-- 17.12.98 09:36:26--------------------------------------------------- 1212*cdf0e10cSrcweir 1213*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1214*cdf0e10cSrcweir awt::Point SwXTextViewCursor::getPosition(void) throw( uno::RuntimeException ) 1215*cdf0e10cSrcweir { 1216*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1217*cdf0e10cSrcweir awt::Point aRet; 1218*cdf0e10cSrcweir if(m_pView) 1219*cdf0e10cSrcweir { 1220*cdf0e10cSrcweir const SwWrtShell& rSh = m_pView->GetWrtShell(); 1221*cdf0e10cSrcweir const SwRect aCharRect(rSh.GetCharRect()); 1222*cdf0e10cSrcweir 1223*cdf0e10cSrcweir const SwFrmFmt& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster(); 1224*cdf0e10cSrcweir 1225*cdf0e10cSrcweir const SvxULSpaceItem& rUL = rMaster.GetULSpace(); 1226*cdf0e10cSrcweir const long nY = aCharRect.Top() - (rUL.GetUpper() + DOCUMENTBORDER); 1227*cdf0e10cSrcweir aRet.Y = TWIP_TO_MM100(nY); 1228*cdf0e10cSrcweir 1229*cdf0e10cSrcweir const SvxLRSpaceItem& rLR = rMaster.GetLRSpace(); 1230*cdf0e10cSrcweir const long nX = aCharRect.Left() - (rLR.GetLeft() + DOCUMENTBORDER); 1231*cdf0e10cSrcweir aRet.X = TWIP_TO_MM100(nX); 1232*cdf0e10cSrcweir } 1233*cdf0e10cSrcweir else 1234*cdf0e10cSrcweir throw uno::RuntimeException(); 1235*cdf0e10cSrcweir return aRet; 1236*cdf0e10cSrcweir } 1237*cdf0e10cSrcweir /*-- 17.12.98 09:36:26--------------------------------------------------- 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1240*cdf0e10cSrcweir void SwXTextViewCursor::collapseToStart(void) throw( uno::RuntimeException ) 1241*cdf0e10cSrcweir { 1242*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1243*cdf0e10cSrcweir if(m_pView) 1244*cdf0e10cSrcweir { 1245*cdf0e10cSrcweir if (!IsTextSelection()) 1246*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1249*cdf0e10cSrcweir if(rSh.HasSelection()) 1250*cdf0e10cSrcweir { 1251*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1252*cdf0e10cSrcweir if(*pShellCrsr->GetPoint() > *pShellCrsr->GetMark()) 1253*cdf0e10cSrcweir pShellCrsr->Exchange(); 1254*cdf0e10cSrcweir pShellCrsr->DeleteMark(); 1255*cdf0e10cSrcweir rSh.EnterStdMode(); 1256*cdf0e10cSrcweir rSh.SetSelection(*pShellCrsr); 1257*cdf0e10cSrcweir } 1258*cdf0e10cSrcweir } 1259*cdf0e10cSrcweir else 1260*cdf0e10cSrcweir throw uno::RuntimeException(); 1261*cdf0e10cSrcweir } 1262*cdf0e10cSrcweir /*-- 17.12.98 09:36:26--------------------------------------------------- 1263*cdf0e10cSrcweir 1264*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1265*cdf0e10cSrcweir void SwXTextViewCursor::collapseToEnd(void) throw( uno::RuntimeException ) 1266*cdf0e10cSrcweir { 1267*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1268*cdf0e10cSrcweir if(m_pView) 1269*cdf0e10cSrcweir { 1270*cdf0e10cSrcweir if (!IsTextSelection()) 1271*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1272*cdf0e10cSrcweir 1273*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1274*cdf0e10cSrcweir if(rSh.HasSelection()) 1275*cdf0e10cSrcweir { 1276*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1277*cdf0e10cSrcweir if(*pShellCrsr->GetPoint() < *pShellCrsr->GetMark()) 1278*cdf0e10cSrcweir pShellCrsr->Exchange(); 1279*cdf0e10cSrcweir pShellCrsr->DeleteMark(); 1280*cdf0e10cSrcweir rSh.EnterStdMode(); 1281*cdf0e10cSrcweir rSh.SetSelection(*pShellCrsr); 1282*cdf0e10cSrcweir } 1283*cdf0e10cSrcweir } 1284*cdf0e10cSrcweir else 1285*cdf0e10cSrcweir throw uno::RuntimeException(); 1286*cdf0e10cSrcweir } 1287*cdf0e10cSrcweir /*-- 17.12.98 09:36:27--------------------------------------------------- 1288*cdf0e10cSrcweir 1289*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1290*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isCollapsed(void) throw( uno::RuntimeException ) 1291*cdf0e10cSrcweir { 1292*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1293*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1294*cdf0e10cSrcweir if(m_pView) 1295*cdf0e10cSrcweir { 1296*cdf0e10cSrcweir if (!IsTextSelection()) 1297*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1298*cdf0e10cSrcweir 1299*cdf0e10cSrcweir const SwWrtShell& rSh = m_pView->GetWrtShell(); 1300*cdf0e10cSrcweir bRet = !rSh.HasSelection(); 1301*cdf0e10cSrcweir } 1302*cdf0e10cSrcweir else 1303*cdf0e10cSrcweir throw uno::RuntimeException(); 1304*cdf0e10cSrcweir return bRet; 1305*cdf0e10cSrcweir 1306*cdf0e10cSrcweir } 1307*cdf0e10cSrcweir /*-- 17.12.98 09:36:27--------------------------------------------------- 1308*cdf0e10cSrcweir 1309*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1310*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException ) 1311*cdf0e10cSrcweir { 1312*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1313*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1314*cdf0e10cSrcweir if(m_pView) 1315*cdf0e10cSrcweir { 1316*cdf0e10cSrcweir if (!IsTextSelection()) 1317*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1318*cdf0e10cSrcweir 1319*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCount; i++ ) 1320*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, 1, sal_True ); 1321*cdf0e10cSrcweir } 1322*cdf0e10cSrcweir else 1323*cdf0e10cSrcweir throw uno::RuntimeException(); 1324*cdf0e10cSrcweir return bRet; 1325*cdf0e10cSrcweir } 1326*cdf0e10cSrcweir /*-- 17.12.98 09:36:27--------------------------------------------------- 1327*cdf0e10cSrcweir 1328*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1329*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goRight(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException ) 1330*cdf0e10cSrcweir { 1331*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1332*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1333*cdf0e10cSrcweir if(m_pView) 1334*cdf0e10cSrcweir { 1335*cdf0e10cSrcweir if (!IsTextSelection()) 1336*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1337*cdf0e10cSrcweir 1338*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCount; i++ ) 1339*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, 1, sal_True ); 1340*cdf0e10cSrcweir } 1341*cdf0e10cSrcweir else 1342*cdf0e10cSrcweir throw uno::RuntimeException(); 1343*cdf0e10cSrcweir return bRet; 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir } 1346*cdf0e10cSrcweir /* -----------------08.03.99 11:18------------------- 1347*cdf0e10cSrcweir * 1348*cdf0e10cSrcweir * --------------------------------------------------*/ 1349*cdf0e10cSrcweir void SwXTextViewCursor::gotoRange( 1350*cdf0e10cSrcweir const uno::Reference< text::XTextRange > & xRange, 1351*cdf0e10cSrcweir sal_Bool bExpand) 1352*cdf0e10cSrcweir throw(RuntimeException) 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1355*cdf0e10cSrcweir if(m_pView && xRange.is()) 1356*cdf0e10cSrcweir { 1357*cdf0e10cSrcweir if (!IsTextSelection()) 1358*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1359*cdf0e10cSrcweir 1360*cdf0e10cSrcweir SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc()); 1361*cdf0e10cSrcweir if (!::sw::XTextRangeToSwPaM(rDestPam, xRange)) 1362*cdf0e10cSrcweir { 1363*cdf0e10cSrcweir throw uno::RuntimeException(); 1364*cdf0e10cSrcweir } 1365*cdf0e10cSrcweir 1366*cdf0e10cSrcweir ShellModes eSelMode = m_pView->GetShellMode(); 1367*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1368*cdf0e10cSrcweir // call EnterStdMode in non-text selections only 1369*cdf0e10cSrcweir if(!bExpand || 1370*cdf0e10cSrcweir (eSelMode != SHELL_MODE_TABLE_TEXT && 1371*cdf0e10cSrcweir eSelMode != SHELL_MODE_LIST_TEXT && 1372*cdf0e10cSrcweir eSelMode != SHELL_MODE_TABLE_LIST_TEXT && 1373*cdf0e10cSrcweir eSelMode != SHELL_MODE_TEXT )) 1374*cdf0e10cSrcweir rSh.EnterStdMode(); 1375*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1376*cdf0e10cSrcweir SwPaM aOwnPaM(*pShellCrsr->GetPoint()); 1377*cdf0e10cSrcweir if(pShellCrsr->HasMark()) 1378*cdf0e10cSrcweir { 1379*cdf0e10cSrcweir aOwnPaM.SetMark(); 1380*cdf0e10cSrcweir *aOwnPaM.GetMark() = *pShellCrsr->GetMark(); 1381*cdf0e10cSrcweir } 1382*cdf0e10cSrcweir 1383*cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY); 1384*cdf0e10cSrcweir SwXTextRange* pRange = 0; 1385*cdf0e10cSrcweir SwXParagraph* pPara = 0; 1386*cdf0e10cSrcweir OTextCursorHelper* pCursor = 0; 1387*cdf0e10cSrcweir if(xRangeTunnel.is()) 1388*cdf0e10cSrcweir { 1389*cdf0e10cSrcweir pRange = reinterpret_cast<SwXTextRange*>(xRangeTunnel->getSomething( 1390*cdf0e10cSrcweir SwXTextRange::getUnoTunnelId())); 1391*cdf0e10cSrcweir pCursor = reinterpret_cast<OTextCursorHelper*>(xRangeTunnel->getSomething( 1392*cdf0e10cSrcweir OTextCursorHelper::getUnoTunnelId())); 1393*cdf0e10cSrcweir pPara = reinterpret_cast<SwXParagraph*>(xRangeTunnel->getSomething( 1394*cdf0e10cSrcweir SwXParagraph::getUnoTunnelId())); 1395*cdf0e10cSrcweir } 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir const sal_uInt16 nFrmType = rSh.GetFrmType(0,sal_True); 1398*cdf0e10cSrcweir 1399*cdf0e10cSrcweir SwStartNodeType eSearchNodeType = SwNormalStartNode; 1400*cdf0e10cSrcweir if(nFrmType & FRMTYPE_FLY_ANY) 1401*cdf0e10cSrcweir eSearchNodeType = SwFlyStartNode; 1402*cdf0e10cSrcweir else if(nFrmType &FRMTYPE_HEADER) 1403*cdf0e10cSrcweir eSearchNodeType = SwHeaderStartNode; 1404*cdf0e10cSrcweir else if(nFrmType & FRMTYPE_FOOTER) 1405*cdf0e10cSrcweir eSearchNodeType = SwFooterStartNode; 1406*cdf0e10cSrcweir else if(nFrmType & FRMTYPE_TABLE) 1407*cdf0e10cSrcweir eSearchNodeType = SwTableBoxStartNode; 1408*cdf0e10cSrcweir else if(nFrmType & FRMTYPE_FOOTNOTE) 1409*cdf0e10cSrcweir eSearchNodeType = SwFootnoteStartNode; 1410*cdf0e10cSrcweir 1411*cdf0e10cSrcweir const SwStartNode* pOwnStartNode = aOwnPaM.GetNode()-> 1412*cdf0e10cSrcweir FindSttNodeByType(eSearchNodeType); 1413*cdf0e10cSrcweir 1414*cdf0e10cSrcweir const SwNode* pSrcNode = 0; 1415*cdf0e10cSrcweir if(pCursor && pCursor->GetPaM()) 1416*cdf0e10cSrcweir { 1417*cdf0e10cSrcweir pSrcNode = pCursor->GetPaM()->GetNode(); 1418*cdf0e10cSrcweir } 1419*cdf0e10cSrcweir else if (pRange) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir SwPaM aPam(pRange->GetDoc()->GetNodes()); 1422*cdf0e10cSrcweir if (pRange->GetPositions(aPam)) 1423*cdf0e10cSrcweir { 1424*cdf0e10cSrcweir pSrcNode = aPam.GetNode(); 1425*cdf0e10cSrcweir } 1426*cdf0e10cSrcweir } 1427*cdf0e10cSrcweir else if (pPara && pPara->GetTxtNode()) 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir pSrcNode = pPara->GetTxtNode(); 1430*cdf0e10cSrcweir } 1431*cdf0e10cSrcweir const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : 0; 1432*cdf0e10cSrcweir 1433*cdf0e10cSrcweir //SectionNodes ueberspringen 1434*cdf0e10cSrcweir while(pTmp && pTmp->IsSectionNode()) 1435*cdf0e10cSrcweir { 1436*cdf0e10cSrcweir pTmp = pTmp->StartOfSectionNode(); 1437*cdf0e10cSrcweir } 1438*cdf0e10cSrcweir while(pOwnStartNode && pOwnStartNode->IsSectionNode()) 1439*cdf0e10cSrcweir { 1440*cdf0e10cSrcweir pOwnStartNode = pOwnStartNode->StartOfSectionNode(); 1441*cdf0e10cSrcweir } 1442*cdf0e10cSrcweir //ohne Expand darf mit dem ViewCursor ueberall hingesprungen werden 1443*cdf0e10cSrcweir //mit Expand nur in der gleichen Umgebung 1444*cdf0e10cSrcweir if(bExpand && 1445*cdf0e10cSrcweir (pOwnStartNode != pTmp || 1446*cdf0e10cSrcweir (eSelMode != SHELL_MODE_TABLE_TEXT && 1447*cdf0e10cSrcweir eSelMode != SHELL_MODE_LIST_TEXT && 1448*cdf0e10cSrcweir eSelMode != SHELL_MODE_TABLE_LIST_TEXT && 1449*cdf0e10cSrcweir eSelMode != SHELL_MODE_TEXT))) 1450*cdf0e10cSrcweir throw uno::RuntimeException(); 1451*cdf0e10cSrcweir 1452*cdf0e10cSrcweir //jetzt muss die Selektion erweitert werden 1453*cdf0e10cSrcweir if(bExpand) 1454*cdf0e10cSrcweir { 1455*cdf0e10cSrcweir // der Cursor soll alles einschliessen, was bisher von ihm und dem uebergebenen 1456*cdf0e10cSrcweir // Range eingeschlossen wurde 1457*cdf0e10cSrcweir SwPosition aOwnLeft(*aOwnPaM.Start()); 1458*cdf0e10cSrcweir SwPosition aOwnRight(*aOwnPaM.End()); 1459*cdf0e10cSrcweir SwPosition* pParamLeft = rDestPam.Start(); 1460*cdf0e10cSrcweir SwPosition* pParamRight = rDestPam.End(); 1461*cdf0e10cSrcweir // jetzt sind vier SwPositions da, zwei davon werden gebraucht, also welche? 1462*cdf0e10cSrcweir if(aOwnRight > *pParamRight) 1463*cdf0e10cSrcweir *aOwnPaM.GetPoint() = aOwnRight; 1464*cdf0e10cSrcweir else 1465*cdf0e10cSrcweir *aOwnPaM.GetPoint() = *pParamRight; 1466*cdf0e10cSrcweir aOwnPaM.SetMark(); 1467*cdf0e10cSrcweir if(aOwnLeft < *pParamLeft) 1468*cdf0e10cSrcweir *aOwnPaM.GetMark() = aOwnLeft; 1469*cdf0e10cSrcweir else 1470*cdf0e10cSrcweir *aOwnPaM.GetMark() = *pParamLeft; 1471*cdf0e10cSrcweir } 1472*cdf0e10cSrcweir else 1473*cdf0e10cSrcweir { 1474*cdf0e10cSrcweir //der Cursor soll dem uebergebenen Range entsprechen 1475*cdf0e10cSrcweir *aOwnPaM.GetPoint() = *rDestPam.GetPoint(); 1476*cdf0e10cSrcweir if(rDestPam.HasMark()) 1477*cdf0e10cSrcweir { 1478*cdf0e10cSrcweir aOwnPaM.SetMark(); 1479*cdf0e10cSrcweir *aOwnPaM.GetMark() = *rDestPam.GetMark(); 1480*cdf0e10cSrcweir } 1481*cdf0e10cSrcweir else 1482*cdf0e10cSrcweir aOwnPaM.DeleteMark(); 1483*cdf0e10cSrcweir } 1484*cdf0e10cSrcweir rSh.SetSelection(aOwnPaM); 1485*cdf0e10cSrcweir } 1486*cdf0e10cSrcweir else 1487*cdf0e10cSrcweir throw uno::RuntimeException(); 1488*cdf0e10cSrcweir 1489*cdf0e10cSrcweir } 1490*cdf0e10cSrcweir /*-- 17.12.98 09:36:28--------------------------------------------------- 1491*cdf0e10cSrcweir 1492*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1493*cdf0e10cSrcweir void SwXTextViewCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeException ) 1494*cdf0e10cSrcweir { 1495*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1496*cdf0e10cSrcweir if(m_pView) 1497*cdf0e10cSrcweir { 1498*cdf0e10cSrcweir if (!IsTextSelection()) 1499*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1500*cdf0e10cSrcweir 1501*cdf0e10cSrcweir m_pView->GetWrtShell().SttDoc( bExpand ); 1502*cdf0e10cSrcweir } 1503*cdf0e10cSrcweir else 1504*cdf0e10cSrcweir throw uno::RuntimeException(); 1505*cdf0e10cSrcweir } 1506*cdf0e10cSrcweir /*-- 17.12.98 09:36:28--------------------------------------------------- 1507*cdf0e10cSrcweir 1508*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1509*cdf0e10cSrcweir void SwXTextViewCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException ) 1510*cdf0e10cSrcweir { 1511*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1512*cdf0e10cSrcweir if(m_pView) 1513*cdf0e10cSrcweir { 1514*cdf0e10cSrcweir if (!IsTextSelection()) 1515*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1516*cdf0e10cSrcweir 1517*cdf0e10cSrcweir m_pView->GetWrtShell().EndDoc( bExpand ); 1518*cdf0e10cSrcweir } 1519*cdf0e10cSrcweir else 1520*cdf0e10cSrcweir throw uno::RuntimeException(); 1521*cdf0e10cSrcweir } 1522*cdf0e10cSrcweir /*-- 17.12.98 09:36:28--------------------------------------------------- 1523*cdf0e10cSrcweir 1524*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1525*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToFirstPage(void) throw( uno::RuntimeException ) 1526*cdf0e10cSrcweir { 1527*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1528*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1529*cdf0e10cSrcweir if(m_pView) 1530*cdf0e10cSrcweir { 1531*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1532*cdf0e10cSrcweir if (rSh.IsSelFrmMode()) 1533*cdf0e10cSrcweir { 1534*cdf0e10cSrcweir rSh.UnSelectFrm(); 1535*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 1536*cdf0e10cSrcweir } 1537*cdf0e10cSrcweir rSh.EnterStdMode(); 1538*cdf0e10cSrcweir bRet = rSh.SttEndDoc(sal_True); 1539*cdf0e10cSrcweir } 1540*cdf0e10cSrcweir else 1541*cdf0e10cSrcweir throw uno::RuntimeException(); 1542*cdf0e10cSrcweir return bRet; 1543*cdf0e10cSrcweir } 1544*cdf0e10cSrcweir /*-- 17.12.98 09:36:29--------------------------------------------------- 1545*cdf0e10cSrcweir 1546*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1547*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToLastPage(void) throw( uno::RuntimeException ) 1548*cdf0e10cSrcweir { 1549*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1550*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1551*cdf0e10cSrcweir if(m_pView) 1552*cdf0e10cSrcweir { 1553*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1554*cdf0e10cSrcweir if (rSh.IsSelFrmMode()) 1555*cdf0e10cSrcweir { 1556*cdf0e10cSrcweir rSh.UnSelectFrm(); 1557*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 1558*cdf0e10cSrcweir } 1559*cdf0e10cSrcweir rSh.EnterStdMode(); 1560*cdf0e10cSrcweir bRet = rSh.SttEndDoc(sal_False); 1561*cdf0e10cSrcweir rSh.SttPg(); 1562*cdf0e10cSrcweir } 1563*cdf0e10cSrcweir else 1564*cdf0e10cSrcweir throw uno::RuntimeException(); 1565*cdf0e10cSrcweir return bRet; 1566*cdf0e10cSrcweir } 1567*cdf0e10cSrcweir /*-- 17.12.98 09:36:30--------------------------------------------------- 1568*cdf0e10cSrcweir 1569*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1570*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToPage(sal_Int16 nPage) throw( uno::RuntimeException ) 1571*cdf0e10cSrcweir { 1572*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1573*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1574*cdf0e10cSrcweir if(m_pView) 1575*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().GotoPage(nPage, sal_True); 1576*cdf0e10cSrcweir else 1577*cdf0e10cSrcweir throw uno::RuntimeException(); 1578*cdf0e10cSrcweir return bRet; 1579*cdf0e10cSrcweir } 1580*cdf0e10cSrcweir /*-- 17.12.98 09:36:30--------------------------------------------------- 1581*cdf0e10cSrcweir 1582*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1583*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToNextPage(void) throw( uno::RuntimeException ) 1584*cdf0e10cSrcweir { 1585*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1586*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1587*cdf0e10cSrcweir if(m_pView) 1588*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().SttNxtPg(); 1589*cdf0e10cSrcweir else 1590*cdf0e10cSrcweir throw uno::RuntimeException(); 1591*cdf0e10cSrcweir return bRet; 1592*cdf0e10cSrcweir } 1593*cdf0e10cSrcweir /*-- 17.12.98 09:36:31--------------------------------------------------- 1594*cdf0e10cSrcweir 1595*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1596*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToPreviousPage(void) throw( uno::RuntimeException ) 1597*cdf0e10cSrcweir { 1598*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1599*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1600*cdf0e10cSrcweir if(m_pView) 1601*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().EndPrvPg(); 1602*cdf0e10cSrcweir else 1603*cdf0e10cSrcweir throw uno::RuntimeException(); 1604*cdf0e10cSrcweir return bRet; 1605*cdf0e10cSrcweir } 1606*cdf0e10cSrcweir /*-- 17.12.98 09:36:32--------------------------------------------------- 1607*cdf0e10cSrcweir 1608*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1609*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToEndOfPage(void) throw( uno::RuntimeException ) 1610*cdf0e10cSrcweir { 1611*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1612*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1613*cdf0e10cSrcweir if(m_pView) 1614*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().EndPg(); 1615*cdf0e10cSrcweir else 1616*cdf0e10cSrcweir throw uno::RuntimeException(); 1617*cdf0e10cSrcweir return bRet; 1618*cdf0e10cSrcweir } 1619*cdf0e10cSrcweir /*-- 17.12.98 09:36:32--------------------------------------------------- 1620*cdf0e10cSrcweir 1621*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1622*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToStartOfPage(void) throw( uno::RuntimeException ) 1623*cdf0e10cSrcweir { 1624*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1625*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1626*cdf0e10cSrcweir if(m_pView) 1627*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().SttPg(); 1628*cdf0e10cSrcweir else 1629*cdf0e10cSrcweir throw uno::RuntimeException(); 1630*cdf0e10cSrcweir return bRet; 1631*cdf0e10cSrcweir } 1632*cdf0e10cSrcweir /* -----------------04.10.99 14:21------------------- 1633*cdf0e10cSrcweir 1634*cdf0e10cSrcweir --------------------------------------------------*/ 1635*cdf0e10cSrcweir sal_Int16 SwXTextViewCursor::getPage(void) throw( uno::RuntimeException ) 1636*cdf0e10cSrcweir { 1637*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1638*cdf0e10cSrcweir short nRet = 0; 1639*cdf0e10cSrcweir if(m_pView) 1640*cdf0e10cSrcweir { 1641*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1642*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1643*cdf0e10cSrcweir nRet = (short)pShellCrsr->GetPageNum( sal_True, 0 ); 1644*cdf0e10cSrcweir } 1645*cdf0e10cSrcweir else 1646*cdf0e10cSrcweir throw uno::RuntimeException(); 1647*cdf0e10cSrcweir return nRet; 1648*cdf0e10cSrcweir } 1649*cdf0e10cSrcweir /*-- 17.12.98 09:36:33--------------------------------------------------- 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1652*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::screenDown(void) throw( uno::RuntimeException ) 1653*cdf0e10cSrcweir { 1654*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1655*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1656*cdf0e10cSrcweir if(m_pView) 1657*cdf0e10cSrcweir { 1658*cdf0e10cSrcweir SfxRequest aReq(FN_PAGEDOWN, SFX_CALLMODE_SLOT, m_pView->GetPool()); 1659*cdf0e10cSrcweir m_pView->Execute(aReq); 1660*cdf0e10cSrcweir const SfxPoolItem* pRet = aReq.GetReturnValue(); 1661*cdf0e10cSrcweir bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue(); 1662*cdf0e10cSrcweir } 1663*cdf0e10cSrcweir else 1664*cdf0e10cSrcweir throw uno::RuntimeException(); 1665*cdf0e10cSrcweir return bRet; 1666*cdf0e10cSrcweir } 1667*cdf0e10cSrcweir /*-- 17.12.98 09:36:33--------------------------------------------------- 1668*cdf0e10cSrcweir 1669*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1670*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::screenUp(void) throw( uno::RuntimeException ) 1671*cdf0e10cSrcweir { 1672*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1673*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1674*cdf0e10cSrcweir if(m_pView) 1675*cdf0e10cSrcweir { 1676*cdf0e10cSrcweir SfxRequest aReq(FN_PAGEUP, SFX_CALLMODE_SLOT, m_pView->GetPool()); 1677*cdf0e10cSrcweir m_pView->Execute(aReq); 1678*cdf0e10cSrcweir const SfxPoolItem* pRet = aReq.GetReturnValue(); 1679*cdf0e10cSrcweir bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue(); 1680*cdf0e10cSrcweir } 1681*cdf0e10cSrcweir else 1682*cdf0e10cSrcweir throw uno::RuntimeException(); 1683*cdf0e10cSrcweir return bRet; 1684*cdf0e10cSrcweir } 1685*cdf0e10cSrcweir /*-- 17.12.98 11:59:05--------------------------------------------------- 1686*cdf0e10cSrcweir 1687*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1688*cdf0e10cSrcweir uno::Reference< text::XText > SwXTextViewCursor::getText(void) throw( uno::RuntimeException ) 1689*cdf0e10cSrcweir { 1690*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1691*cdf0e10cSrcweir uno::Reference< text::XText > xRet; 1692*cdf0e10cSrcweir if(m_pView) 1693*cdf0e10cSrcweir { 1694*cdf0e10cSrcweir if (!IsTextSelection( sal_False )) 1695*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1696*cdf0e10cSrcweir 1697*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1698*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1699*cdf0e10cSrcweir SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); 1700*cdf0e10cSrcweir xRet = ::sw::CreateParentXText(*pDoc, *pShellCrsr->Start()); 1701*cdf0e10cSrcweir } 1702*cdf0e10cSrcweir else 1703*cdf0e10cSrcweir throw uno::RuntimeException(); 1704*cdf0e10cSrcweir return xRet; 1705*cdf0e10cSrcweir } 1706*cdf0e10cSrcweir /*-- 17.12.98 11:59:05--------------------------------------------------- 1707*cdf0e10cSrcweir 1708*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1709*cdf0e10cSrcweir uno::Reference< text::XTextRange > SwXTextViewCursor::getStart(void) throw( uno::RuntimeException ) 1710*cdf0e10cSrcweir { 1711*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1712*cdf0e10cSrcweir uno::Reference< text::XTextRange > xRet; 1713*cdf0e10cSrcweir if(m_pView) 1714*cdf0e10cSrcweir { 1715*cdf0e10cSrcweir if (!IsTextSelection()) 1716*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1717*cdf0e10cSrcweir 1718*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1719*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1720*cdf0e10cSrcweir SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); 1721*cdf0e10cSrcweir xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->Start(), 0); 1722*cdf0e10cSrcweir } 1723*cdf0e10cSrcweir else 1724*cdf0e10cSrcweir throw uno::RuntimeException(); 1725*cdf0e10cSrcweir return xRet; 1726*cdf0e10cSrcweir } 1727*cdf0e10cSrcweir /*-- 17.12.98 11:59:06--------------------------------------------------- 1728*cdf0e10cSrcweir 1729*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1730*cdf0e10cSrcweir uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd(void) throw( uno::RuntimeException ) 1731*cdf0e10cSrcweir { 1732*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1733*cdf0e10cSrcweir uno::Reference< text::XTextRange > xRet; 1734*cdf0e10cSrcweir if(m_pView) 1735*cdf0e10cSrcweir { 1736*cdf0e10cSrcweir if (!IsTextSelection()) 1737*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1738*cdf0e10cSrcweir 1739*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1740*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1741*cdf0e10cSrcweir SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); 1742*cdf0e10cSrcweir xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->End(), 0); 1743*cdf0e10cSrcweir } 1744*cdf0e10cSrcweir else 1745*cdf0e10cSrcweir throw uno::RuntimeException(); 1746*cdf0e10cSrcweir return xRet; 1747*cdf0e10cSrcweir } 1748*cdf0e10cSrcweir /* -----------------12.10.99 09:03------------------- 1749*cdf0e10cSrcweir 1750*cdf0e10cSrcweir --------------------------------------------------*/ 1751*cdf0e10cSrcweir OUString SwXTextViewCursor::getString(void) throw( uno::RuntimeException ) 1752*cdf0e10cSrcweir { 1753*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1754*cdf0e10cSrcweir OUString uRet; 1755*cdf0e10cSrcweir if(m_pView) 1756*cdf0e10cSrcweir { 1757*cdf0e10cSrcweir if (!IsTextSelection( sal_False )) 1758*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir ShellModes eSelMode = m_pView->GetShellMode(); 1761*cdf0e10cSrcweir switch(eSelMode) 1762*cdf0e10cSrcweir { 1763*cdf0e10cSrcweir //! since setString for SEL_TABLE_TEXT (with possible 1764*cdf0e10cSrcweir //! multi selection of cells) would not work properly we 1765*cdf0e10cSrcweir //! will ignore this case for both 1766*cdf0e10cSrcweir //! functions (setString AND getString) because of symmetrie. 1767*cdf0e10cSrcweir 1768*cdf0e10cSrcweir case SHELL_MODE_LIST_TEXT : 1769*cdf0e10cSrcweir case SHELL_MODE_TABLE_LIST_TEXT: 1770*cdf0e10cSrcweir case SHELL_MODE_TEXT : 1771*cdf0e10cSrcweir { 1772*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1773*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1774*cdf0e10cSrcweir SwUnoCursorHelper::GetTextFromPam(*pShellCrsr, uRet); 1775*cdf0e10cSrcweir } 1776*cdf0e10cSrcweir default:;//prevent warning 1777*cdf0e10cSrcweir } 1778*cdf0e10cSrcweir } 1779*cdf0e10cSrcweir return uRet; 1780*cdf0e10cSrcweir } 1781*cdf0e10cSrcweir /*-- 17.12.98 11:59:06--------------------------------------------------- 1782*cdf0e10cSrcweir 1783*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1784*cdf0e10cSrcweir void SwXTextViewCursor::setString(const OUString& aString) throw( uno::RuntimeException ) 1785*cdf0e10cSrcweir { 1786*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1787*cdf0e10cSrcweir if(m_pView) 1788*cdf0e10cSrcweir { 1789*cdf0e10cSrcweir if (!IsTextSelection( sal_False )) 1790*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1791*cdf0e10cSrcweir 1792*cdf0e10cSrcweir ShellModes eSelMode = m_pView->GetShellMode(); 1793*cdf0e10cSrcweir switch(eSelMode) 1794*cdf0e10cSrcweir { 1795*cdf0e10cSrcweir //! since setString for SEL_TABLE_TEXT (with possible 1796*cdf0e10cSrcweir //! multi selection of cells) would not work properly we 1797*cdf0e10cSrcweir //! will ignore this case for both 1798*cdf0e10cSrcweir //! functions (setString AND getString) because of symmetrie. 1799*cdf0e10cSrcweir 1800*cdf0e10cSrcweir case SHELL_MODE_LIST_TEXT : 1801*cdf0e10cSrcweir case SHELL_MODE_TABLE_LIST_TEXT : 1802*cdf0e10cSrcweir case SHELL_MODE_TEXT : 1803*cdf0e10cSrcweir { 1804*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1805*cdf0e10cSrcweir SwCursor* pShellCrsr = rSh.GetSwCrsr(); 1806*cdf0e10cSrcweir SwUnoCursorHelper::SetString(*pShellCrsr, aString); 1807*cdf0e10cSrcweir } 1808*cdf0e10cSrcweir default:;//prevent warning 1809*cdf0e10cSrcweir } 1810*cdf0e10cSrcweir } 1811*cdf0e10cSrcweir } 1812*cdf0e10cSrcweir 1813*cdf0e10cSrcweir /*-- 29.06.00 17:33:38--------------------------------------------------- 1814*cdf0e10cSrcweir 1815*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1816*cdf0e10cSrcweir uno::Reference< XPropertySetInfo > SwXTextViewCursor::getPropertySetInfo( ) throw(RuntimeException) 1817*cdf0e10cSrcweir { 1818*cdf0e10cSrcweir static uno::Reference< XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); 1819*cdf0e10cSrcweir return xRef; 1820*cdf0e10cSrcweir } 1821*cdf0e10cSrcweir /*-- 29.06.00 17:33:39--------------------------------------------------- 1822*cdf0e10cSrcweir 1823*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1824*cdf0e10cSrcweir void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const Any& aValue ) 1825*cdf0e10cSrcweir throw(UnknownPropertyException, PropertyVetoException, 1826*cdf0e10cSrcweir IllegalArgumentException, WrappedTargetException, RuntimeException) 1827*cdf0e10cSrcweir { 1828*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1829*cdf0e10cSrcweir if(m_pView) 1830*cdf0e10cSrcweir { 1831*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1832*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1833*cdf0e10cSrcweir SwNode *pNode = pShellCrsr->GetNode(); 1834*cdf0e10cSrcweir if (pNode && pNode->IsTxtNode()) 1835*cdf0e10cSrcweir { 1836*cdf0e10cSrcweir SwUnoCursorHelper::SetPropertyValue( 1837*cdf0e10cSrcweir *pShellCrsr, *m_pPropSet, rPropertyName, aValue ); 1838*cdf0e10cSrcweir } 1839*cdf0e10cSrcweir else 1840*cdf0e10cSrcweir throw RuntimeException(); 1841*cdf0e10cSrcweir } 1842*cdf0e10cSrcweir else 1843*cdf0e10cSrcweir throw RuntimeException(); 1844*cdf0e10cSrcweir } 1845*cdf0e10cSrcweir /*-- 29.06.00 17:33:39--------------------------------------------------- 1846*cdf0e10cSrcweir 1847*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1848*cdf0e10cSrcweir Any SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName ) 1849*cdf0e10cSrcweir throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1850*cdf0e10cSrcweir { 1851*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1852*cdf0e10cSrcweir Any aRet; 1853*cdf0e10cSrcweir if(m_pView) 1854*cdf0e10cSrcweir { 1855*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1856*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1857*cdf0e10cSrcweir aRet = SwUnoCursorHelper::GetPropertyValue( 1858*cdf0e10cSrcweir *pShellCrsr, *m_pPropSet, rPropertyName); 1859*cdf0e10cSrcweir } 1860*cdf0e10cSrcweir else 1861*cdf0e10cSrcweir throw RuntimeException(); 1862*cdf0e10cSrcweir return aRet; 1863*cdf0e10cSrcweir } 1864*cdf0e10cSrcweir /*-- 29.06.00 17:33:40--------------------------------------------------- 1865*cdf0e10cSrcweir 1866*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1867*cdf0e10cSrcweir void SwXTextViewCursor::addPropertyChangeListener( 1868*cdf0e10cSrcweir const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) 1869*cdf0e10cSrcweir throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1870*cdf0e10cSrcweir { 1871*cdf0e10cSrcweir } 1872*cdf0e10cSrcweir /*-- 29.06.00 17:33:40--------------------------------------------------- 1873*cdf0e10cSrcweir 1874*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1875*cdf0e10cSrcweir void SwXTextViewCursor::removePropertyChangeListener( 1876*cdf0e10cSrcweir const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ ) 1877*cdf0e10cSrcweir throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1878*cdf0e10cSrcweir { 1879*cdf0e10cSrcweir } 1880*cdf0e10cSrcweir /*-- 29.06.00 17:33:41--------------------------------------------------- 1881*cdf0e10cSrcweir 1882*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1883*cdf0e10cSrcweir void SwXTextViewCursor::addVetoableChangeListener( 1884*cdf0e10cSrcweir const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ ) 1885*cdf0e10cSrcweir throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1886*cdf0e10cSrcweir { 1887*cdf0e10cSrcweir } 1888*cdf0e10cSrcweir /*-- 29.06.00 17:33:41--------------------------------------------------- 1889*cdf0e10cSrcweir 1890*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1891*cdf0e10cSrcweir void SwXTextViewCursor::removeVetoableChangeListener( 1892*cdf0e10cSrcweir const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1893*cdf0e10cSrcweir { 1894*cdf0e10cSrcweir } 1895*cdf0e10cSrcweir /*-- 29.06.00 17:33:41--------------------------------------------------- 1896*cdf0e10cSrcweir 1897*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1898*cdf0e10cSrcweir PropertyState SwXTextViewCursor::getPropertyState( const OUString& rPropertyName ) 1899*cdf0e10cSrcweir throw(UnknownPropertyException, RuntimeException) 1900*cdf0e10cSrcweir { 1901*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1902*cdf0e10cSrcweir PropertyState eState; 1903*cdf0e10cSrcweir if(m_pView) 1904*cdf0e10cSrcweir { 1905*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1906*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1907*cdf0e10cSrcweir eState = SwUnoCursorHelper::GetPropertyState( 1908*cdf0e10cSrcweir *pShellCrsr, *m_pPropSet, rPropertyName); 1909*cdf0e10cSrcweir } 1910*cdf0e10cSrcweir else 1911*cdf0e10cSrcweir throw RuntimeException(); 1912*cdf0e10cSrcweir return eState; 1913*cdf0e10cSrcweir } 1914*cdf0e10cSrcweir /*-- 29.06.00 17:33:42--------------------------------------------------- 1915*cdf0e10cSrcweir 1916*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1917*cdf0e10cSrcweir Sequence< PropertyState > SwXTextViewCursor::getPropertyStates( 1918*cdf0e10cSrcweir const Sequence< OUString >& rPropertyNames ) throw(UnknownPropertyException, RuntimeException) 1919*cdf0e10cSrcweir { 1920*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1921*cdf0e10cSrcweir Sequence< PropertyState > aRet; 1922*cdf0e10cSrcweir if(m_pView) 1923*cdf0e10cSrcweir { 1924*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1925*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1926*cdf0e10cSrcweir aRet = SwUnoCursorHelper::GetPropertyStates( 1927*cdf0e10cSrcweir *pShellCrsr, *m_pPropSet, rPropertyNames); 1928*cdf0e10cSrcweir } 1929*cdf0e10cSrcweir return aRet; 1930*cdf0e10cSrcweir } 1931*cdf0e10cSrcweir /*-- 29.06.00 17:33:42--------------------------------------------------- 1932*cdf0e10cSrcweir 1933*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1934*cdf0e10cSrcweir void SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName ) 1935*cdf0e10cSrcweir throw(UnknownPropertyException, RuntimeException) 1936*cdf0e10cSrcweir { 1937*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1938*cdf0e10cSrcweir if(m_pView) 1939*cdf0e10cSrcweir { 1940*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1941*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1942*cdf0e10cSrcweir SwUnoCursorHelper::SetPropertyToDefault( 1943*cdf0e10cSrcweir *pShellCrsr, *m_pPropSet, rPropertyName); 1944*cdf0e10cSrcweir } 1945*cdf0e10cSrcweir } 1946*cdf0e10cSrcweir /*-- 29.06.00 17:33:43--------------------------------------------------- 1947*cdf0e10cSrcweir 1948*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1949*cdf0e10cSrcweir Any SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName ) 1950*cdf0e10cSrcweir throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1951*cdf0e10cSrcweir { 1952*cdf0e10cSrcweir Any aRet; 1953*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1954*cdf0e10cSrcweir if(m_pView) 1955*cdf0e10cSrcweir { 1956*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 1957*cdf0e10cSrcweir SwPaM* pShellCrsr = rSh.GetCrsr(); 1958*cdf0e10cSrcweir aRet = SwUnoCursorHelper::GetPropertyDefault( 1959*cdf0e10cSrcweir *pShellCrsr, *m_pPropSet, rPropertyName); 1960*cdf0e10cSrcweir } 1961*cdf0e10cSrcweir return aRet; 1962*cdf0e10cSrcweir } 1963*cdf0e10cSrcweir /*-- 28.09.99 08:31:19--------------------------------------------------- 1964*cdf0e10cSrcweir 1965*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1966*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException ) 1967*cdf0e10cSrcweir { 1968*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1969*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1970*cdf0e10cSrcweir if(m_pView) 1971*cdf0e10cSrcweir { 1972*cdf0e10cSrcweir if (!IsTextSelection()) 1973*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1974*cdf0e10cSrcweir 1975*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCount; i++ ) 1976*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().Down( bExpand, 1, sal_True ); 1977*cdf0e10cSrcweir } 1978*cdf0e10cSrcweir else 1979*cdf0e10cSrcweir throw uno::RuntimeException(); 1980*cdf0e10cSrcweir return bRet; 1981*cdf0e10cSrcweir } 1982*cdf0e10cSrcweir /*-- 28.09.99 08:31:20--------------------------------------------------- 1983*cdf0e10cSrcweir 1984*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1985*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException ) 1986*cdf0e10cSrcweir { 1987*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1988*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1989*cdf0e10cSrcweir if(m_pView) 1990*cdf0e10cSrcweir { 1991*cdf0e10cSrcweir if (!IsTextSelection()) 1992*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 1993*cdf0e10cSrcweir 1994*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCount; i++ ) 1995*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().Up( bExpand, 1, sal_True ); 1996*cdf0e10cSrcweir } 1997*cdf0e10cSrcweir else 1998*cdf0e10cSrcweir throw uno::RuntimeException(); 1999*cdf0e10cSrcweir return bRet; 2000*cdf0e10cSrcweir } 2001*cdf0e10cSrcweir /*-- 28.09.99 08:31:20--------------------------------------------------- 2002*cdf0e10cSrcweir 2003*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2004*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isAtStartOfLine(void) throw( uno::RuntimeException ) 2005*cdf0e10cSrcweir { 2006*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2007*cdf0e10cSrcweir sal_Bool bRet = sal_False; 2008*cdf0e10cSrcweir if(m_pView) 2009*cdf0e10cSrcweir { 2010*cdf0e10cSrcweir if (!IsTextSelection( sal_False )) 2011*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 2012*cdf0e10cSrcweir 2013*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().IsAtLeftMargin(); 2014*cdf0e10cSrcweir } 2015*cdf0e10cSrcweir else 2016*cdf0e10cSrcweir throw uno::RuntimeException(); 2017*cdf0e10cSrcweir return bRet; 2018*cdf0e10cSrcweir } 2019*cdf0e10cSrcweir /*-- 28.09.99 08:31:21--------------------------------------------------- 2020*cdf0e10cSrcweir 2021*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2022*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isAtEndOfLine(void) throw( uno::RuntimeException ) 2023*cdf0e10cSrcweir { 2024*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2025*cdf0e10cSrcweir sal_Bool bRet = sal_False; 2026*cdf0e10cSrcweir if(m_pView) 2027*cdf0e10cSrcweir { 2028*cdf0e10cSrcweir if (!IsTextSelection( sal_False )) 2029*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 2030*cdf0e10cSrcweir 2031*cdf0e10cSrcweir bRet = m_pView->GetWrtShell().IsAtRightMargin(sal_True); 2032*cdf0e10cSrcweir } 2033*cdf0e10cSrcweir else 2034*cdf0e10cSrcweir throw uno::RuntimeException(); 2035*cdf0e10cSrcweir return bRet; 2036*cdf0e10cSrcweir } 2037*cdf0e10cSrcweir /*-- 28.09.99 08:31:21--------------------------------------------------- 2038*cdf0e10cSrcweir 2039*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2040*cdf0e10cSrcweir void SwXTextViewCursor::gotoEndOfLine(sal_Bool bExpand) throw( uno::RuntimeException ) 2041*cdf0e10cSrcweir { 2042*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2043*cdf0e10cSrcweir if(m_pView) 2044*cdf0e10cSrcweir { 2045*cdf0e10cSrcweir if (!IsTextSelection( sal_False )) 2046*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 2047*cdf0e10cSrcweir 2048*cdf0e10cSrcweir m_pView->GetWrtShell().RightMargin(bExpand, sal_True); 2049*cdf0e10cSrcweir } 2050*cdf0e10cSrcweir else 2051*cdf0e10cSrcweir throw uno::RuntimeException(); 2052*cdf0e10cSrcweir } 2053*cdf0e10cSrcweir /*-- 28.09.99 08:31:22--------------------------------------------------- 2054*cdf0e10cSrcweir 2055*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2056*cdf0e10cSrcweir void SwXTextViewCursor::gotoStartOfLine(sal_Bool bExpand) throw( uno::RuntimeException ) 2057*cdf0e10cSrcweir { 2058*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2059*cdf0e10cSrcweir if(m_pView) 2060*cdf0e10cSrcweir { 2061*cdf0e10cSrcweir if (!IsTextSelection( sal_False )) 2062*cdf0e10cSrcweir throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); 2063*cdf0e10cSrcweir 2064*cdf0e10cSrcweir m_pView->GetWrtShell().LeftMargin(bExpand, sal_True); 2065*cdf0e10cSrcweir } 2066*cdf0e10cSrcweir else 2067*cdf0e10cSrcweir throw uno::RuntimeException(); 2068*cdf0e10cSrcweir } 2069*cdf0e10cSrcweir /* -----------------------------06.04.00 11:07-------------------------------- 2070*cdf0e10cSrcweir 2071*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2072*cdf0e10cSrcweir OUString SwXTextViewCursor::getImplementationName(void) throw( RuntimeException ) 2073*cdf0e10cSrcweir { 2074*cdf0e10cSrcweir return C2U("SwXTextViewCursor"); 2075*cdf0e10cSrcweir } 2076*cdf0e10cSrcweir /* -----------------------------06.04.00 11:07-------------------------------- 2077*cdf0e10cSrcweir 2078*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2079*cdf0e10cSrcweir sal_Bool SwXTextViewCursor::supportsService(const OUString& rServiceName) throw( RuntimeException ) 2080*cdf0e10cSrcweir { 2081*cdf0e10cSrcweir return !rServiceName.compareToAscii("com.sun.star.text.TextViewCursor") || 2082*cdf0e10cSrcweir !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") || 2083*cdf0e10cSrcweir !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") || 2084*cdf0e10cSrcweir !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") || 2085*cdf0e10cSrcweir !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") || 2086*cdf0e10cSrcweir !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") || 2087*cdf0e10cSrcweir !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex"); 2088*cdf0e10cSrcweir } 2089*cdf0e10cSrcweir /* -----------------------------06.04.00 11:07-------------------------------- 2090*cdf0e10cSrcweir 2091*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2092*cdf0e10cSrcweir Sequence< OUString > SwXTextViewCursor::getSupportedServiceNames(void) throw( RuntimeException ) 2093*cdf0e10cSrcweir { 2094*cdf0e10cSrcweir Sequence< OUString > aRet(7); 2095*cdf0e10cSrcweir OUString* pArray = aRet.getArray(); 2096*cdf0e10cSrcweir pArray[0] = C2U("com.sun.star.text.TextViewCursor"); 2097*cdf0e10cSrcweir pArray[1] = C2U("com.sun.star.style.CharacterProperties"); 2098*cdf0e10cSrcweir pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian"); 2099*cdf0e10cSrcweir pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex"); 2100*cdf0e10cSrcweir pArray[4] = C2U("com.sun.star.style.ParagraphProperties"); 2101*cdf0e10cSrcweir pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian"); 2102*cdf0e10cSrcweir pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex"); 2103*cdf0e10cSrcweir return aRet; 2104*cdf0e10cSrcweir } 2105*cdf0e10cSrcweir /* -----------------------------03.03.03 11:07-------------------------------- 2106*cdf0e10cSrcweir 2107*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2108*cdf0e10cSrcweir const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId() 2109*cdf0e10cSrcweir { 2110*cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); 2111*cdf0e10cSrcweir return aSeq; 2112*cdf0e10cSrcweir } 2113*cdf0e10cSrcweir /* -----------------------------03.03.03 11:07-------------------------------- 2114*cdf0e10cSrcweir 2115*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2116*cdf0e10cSrcweir //XUnoTunnel 2117*cdf0e10cSrcweir sal_Int64 SAL_CALL SwXTextViewCursor::getSomething( 2118*cdf0e10cSrcweir const uno::Sequence< sal_Int8 >& rId ) 2119*cdf0e10cSrcweir throw(uno::RuntimeException) 2120*cdf0e10cSrcweir { 2121*cdf0e10cSrcweir if( rId.getLength() == 16 2122*cdf0e10cSrcweir && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 2123*cdf0e10cSrcweir rId.getConstArray(), 16 ) ) 2124*cdf0e10cSrcweir { 2125*cdf0e10cSrcweir return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); 2126*cdf0e10cSrcweir } 2127*cdf0e10cSrcweir return OTextCursorHelper::getSomething(rId);; 2128*cdf0e10cSrcweir } 2129*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 2130*cdf0e10cSrcweir 2131*cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2(SwXTextViewCursor,SwXTextViewCursor_Base,OTextCursorHelper) 2132*cdf0e10cSrcweir const SwDoc* SwXTextViewCursor::GetDoc() const 2133*cdf0e10cSrcweir { 2134*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 2135*cdf0e10cSrcweir return rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0; 2136*cdf0e10cSrcweir } 2137*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 2138*cdf0e10cSrcweir SwDoc* SwXTextViewCursor::GetDoc() 2139*cdf0e10cSrcweir { 2140*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 2141*cdf0e10cSrcweir return rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0; 2142*cdf0e10cSrcweir } 2143*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 2144*cdf0e10cSrcweir const SwPaM* SwXTextViewCursor::GetPaM() const 2145*cdf0e10cSrcweir { 2146*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 2147*cdf0e10cSrcweir return rSh.GetCrsr(); 2148*cdf0e10cSrcweir } 2149*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 2150*cdf0e10cSrcweir SwPaM* SwXTextViewCursor::GetPaM() 2151*cdf0e10cSrcweir { 2152*cdf0e10cSrcweir SwWrtShell& rSh = m_pView->GetWrtShell(); 2153*cdf0e10cSrcweir return rSh.GetCrsr(); 2154*cdf0e10cSrcweir } 2155*cdf0e10cSrcweir 2156*cdf0e10cSrcweir uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable( ) throw (uno::RuntimeException) 2157*cdf0e10cSrcweir { 2158*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2159*cdf0e10cSrcweir 2160*cdf0e10cSrcweir //force immediat shell update 2161*cdf0e10cSrcweir GetView()->StopShellTimer(); 2162*cdf0e10cSrcweir SwWrtShell& rSh = GetView()->GetWrtShell(); 2163*cdf0e10cSrcweir if ( GetView()->GetShellMode() == SHELL_MODE_DRAWTEXT ) 2164*cdf0e10cSrcweir { 2165*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 2166*cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 2167*cdf0e10cSrcweir return pOLV->GetEditView().GetTransferable(); 2168*cdf0e10cSrcweir } 2169*cdf0e10cSrcweir else 2170*cdf0e10cSrcweir { 2171*cdf0e10cSrcweir SwTransferable* pTransfer = new SwTransferable( rSh ); 2172*cdf0e10cSrcweir const sal_Bool bLockedView = rSh.IsViewLocked(); 2173*cdf0e10cSrcweir rSh.LockView( sal_True ); //lock visible section 2174*cdf0e10cSrcweir pTransfer->PrepareForCopy(); 2175*cdf0e10cSrcweir rSh.LockView( bLockedView ); 2176*cdf0e10cSrcweir return uno::Reference< datatransfer::XTransferable >( pTransfer ); 2177*cdf0e10cSrcweir } 2178*cdf0e10cSrcweir } 2179*cdf0e10cSrcweir 2180*cdf0e10cSrcweir void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfer::XTransferable >& xTrans ) throw (datatransfer::UnsupportedFlavorException, uno::RuntimeException) 2181*cdf0e10cSrcweir { 2182*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2183*cdf0e10cSrcweir 2184*cdf0e10cSrcweir //force immediat shell update 2185*cdf0e10cSrcweir GetView()->StopShellTimer(); 2186*cdf0e10cSrcweir SwWrtShell& rSh = GetView()->GetWrtShell(); 2187*cdf0e10cSrcweir if ( GetView()->GetShellMode() == SHELL_MODE_DRAWTEXT ) 2188*cdf0e10cSrcweir { 2189*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 2190*cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 2191*cdf0e10cSrcweir pOLV->GetEditView().InsertText( xTrans, GetView()->GetDocShell()->GetMedium()->GetBaseURL(), sal_False ); 2192*cdf0e10cSrcweir } 2193*cdf0e10cSrcweir else 2194*cdf0e10cSrcweir { 2195*cdf0e10cSrcweir TransferableDataHelper aDataHelper( xTrans ); 2196*cdf0e10cSrcweir if ( SwTransferable::IsPaste( rSh, aDataHelper ) ) 2197*cdf0e10cSrcweir { 2198*cdf0e10cSrcweir SwTransferable::Paste( rSh, aDataHelper ); 2199*cdf0e10cSrcweir if( rSh.IsFrmSelected() || rSh.IsObjSelected() ) 2200*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 2201*cdf0e10cSrcweir GetView()->AttrChangedNotify( &rSh ); 2202*cdf0e10cSrcweir } 2203*cdf0e10cSrcweir } 2204*cdf0e10cSrcweir } 2205*cdf0e10cSrcweir 2206*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 2207*cdf0e10cSrcweir 2208