LCOV - code coverage report
Current view: top level - sw/source/ui/uno - unotxvw.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 453 1043 43.4 %
Date: 2012-08-25 Functions: 53 99 53.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 417 2064 20.2 %

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

Generated by: LCOV version 1.10