LCOV - code coverage report
Current view: top level - sw/source/uibase/wrtsh - wrtsh3.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 27 88 30.7 %
Date: 2015-06-13 12:38:46 Functions: 6 13 46.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <svx/svxids.hrc>
      21             : #include <sfx2/app.hxx>
      22             : #include <sfx2/childwin.hxx>
      23             : #include <sfx2/bindings.hxx>
      24             : #include <svx/svdmark.hxx>
      25             : #include <svx/svdview.hxx>
      26             : #include <svx/fmglob.hxx>
      27             : #include <svx/svdouno.hxx>
      28             : #include <com/sun/star/form/FormButtonType.hpp>
      29             : #include <com/sun/star/beans/XPropertySet.hpp>
      30             : #include <sfx2/htmlmode.hxx>
      31             : #include "wrtsh.hxx"
      32             : #include "view.hxx"
      33             : #include "IMark.hxx"
      34             : #include "doc.hxx"
      35             : #include "wrtsh.hrc"
      36             : 
      37             : #include <unomid.h>
      38             : 
      39             : using namespace ::com::sun::star;
      40             : 
      41             : extern bool g_bNoInterrupt;       // in swmodule.cxx
      42             : 
      43          20 : bool SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark)
      44             : {
      45          20 :     addCurrentPosition();
      46          20 :     (this->*m_fnKillSel)( 0, false );
      47             : 
      48          20 :     bool bRet = true;
      49          20 :     switch(eFuncId)
      50             :     {
      51          20 :         case BOOKMARK_INDEX:bRet = SwCrsrShell::GotoMark( pMark );break;
      52           0 :         case BOOKMARK_NEXT: bRet = SwCrsrShell::GoNextBookmark();break;
      53           0 :         case BOOKMARK_PREV: bRet = SwCrsrShell::GoPrevBookmark();break;
      54             :         default:;//prevent warning
      55             :     }
      56             : 
      57          20 :     if( bRet && IsSelFrmMode() )
      58             :     {
      59           0 :         UnSelectFrm();
      60           0 :         LeaveSelFrmMode();
      61             :     }
      62          20 :     if( IsSelection() )
      63             :     {
      64           0 :         m_fnKillSel = &SwWrtShell::ResetSelect;
      65           0 :         m_fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
      66             :     }
      67          20 :     return bRet;
      68             : }
      69             : 
      70           0 : bool SwWrtShell::GotoField( const SwFormatField& rField )
      71             : {
      72           0 :     (this->*m_fnKillSel)( 0, false );
      73             : 
      74           0 :     bool bRet = SwCrsrShell::GotoFormatField( rField );
      75           0 :     if( bRet && IsSelFrmMode() )
      76             :     {
      77           0 :         UnSelectFrm();
      78           0 :         LeaveSelFrmMode();
      79             :     }
      80             : 
      81           0 :     if( IsSelection() )
      82             :     {
      83           0 :         m_fnKillSel = &SwWrtShell::ResetSelect;
      84           0 :         m_fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
      85             :     }
      86             : 
      87           0 :     return bRet;
      88             : }
      89             : 
      90           1 : bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark)
      91             : {
      92           1 :     (this->*m_fnKillSel)( 0, false );
      93           1 :     bool bRet = SwCrsrShell::GotoFieldmark(pMark);
      94           1 :     if( bRet && IsSelFrmMode() )
      95             :     {
      96           0 :         UnSelectFrm();
      97           0 :         LeaveSelFrmMode();
      98             :     }
      99           1 :     if( IsSelection() )
     100             :     {
     101           1 :         m_fnKillSel = &SwWrtShell::ResetSelect;
     102           1 :         m_fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
     103             :     }
     104           1 :     return bRet;
     105             : }
     106             : 
     107             : // Invalidate FontWork-Slots
     108             : 
     109          27 : void SwWrtShell::DrawSelChanged( )
     110             : {
     111             :     static sal_uInt16 const aInval[] =
     112             :     {
     113             :         SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE,
     114             :         SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR,
     115             :         /*AF: these may be needed for the sidebar.
     116             :         SID_SVX_AREA_TRANSPARENCY, SID_SVX_AREA_TRANSP_GRADIENT,
     117             :         SID_SVX_AREA_TRANS_TYPE,
     118             :         */
     119             :         0
     120             :     };
     121             : 
     122          27 :     GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
     123             : 
     124          27 :     bool bOldVal = g_bNoInterrupt;
     125          27 :     g_bNoInterrupt = true;    // Trick to run AttrChangedNotify by timer.
     126          27 :     GetView().AttrChangedNotify(this);
     127          27 :     g_bNoInterrupt = bOldVal;
     128          27 : }
     129             : 
     130           0 : bool SwWrtShell::GotoMark( const OUString& rName )
     131             : {
     132           0 :     IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark( rName );
     133           0 :     if(ppMark == getIDocumentMarkAccess()->getAllMarksEnd()) return false;
     134           0 :     return MoveBookMark( BOOKMARK_INDEX, ppMark->get() );
     135             : }
     136             : 
     137          20 : bool SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark )
     138             : {
     139          20 :     return MoveBookMark( BOOKMARK_INDEX, pMark );
     140             : }
     141             : 
     142           0 : bool SwWrtShell::GoNextBookmark()
     143             : {
     144           0 :     return MoveBookMark( BOOKMARK_NEXT );
     145             : }
     146             : 
     147           0 : bool SwWrtShell::GoPrevBookmark()
     148             : {
     149           0 :     return MoveBookMark( BOOKMARK_PREV );
     150             : }
     151             : 
     152           0 : void SwWrtShell::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs )
     153             : {
     154             :     // OD 11.02.2003 #100556# - execute macro, if it is allowed.
     155           0 :     if ( IsMacroExecAllowed() )
     156             :     {
     157           0 :         GetDoc()->ExecMacro( rMacro, pRet, pArgs );
     158             :     }
     159           0 : }
     160             : 
     161           0 : sal_uInt16 SwWrtShell::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
     162             :                                 bool bChkPtr, SbxArray* pArgs,
     163             :                                 const Link<>* pCallBack )
     164             : {
     165           0 :     return GetDoc()->CallEvent( nEvent, rCallEvent, bChkPtr, pArgs, pCallBack );
     166             : }
     167             : 
     168             :     // If a util::URL-Button is selected, return its util::URL
     169             :     // otherwise an emtpy string.
     170           0 : bool SwWrtShell::GetURLFromButton( OUString& rURL, OUString& rDescr ) const
     171             : {
     172           0 :     bool bRet = false;
     173           0 :     const SdrView *pDView = GetDrawView();
     174           0 :     if( pDView )
     175             :     {
     176             :         // A fly is precisely achievable if it is selected.
     177           0 :         const SdrMarkList &rMarkList = pDView->GetMarkedObjectList();
     178             : 
     179           0 :         if (rMarkList.GetMark(0))
     180             :         {
     181           0 :             SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
     182           0 :             if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
     183             :             {
     184           0 :                 uno::Reference< awt::XControlModel >  xControlModel = pUnoCtrl->GetUnoControlModel();
     185             : 
     186             :                 OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
     187           0 :                 if( !xControlModel.is() )
     188           0 :                     return bRet;
     189             : 
     190           0 :                 uno::Reference< beans::XPropertySet >  xPropSet(xControlModel, uno::UNO_QUERY);
     191             : 
     192           0 :                 uno::Any aTmp;
     193             : 
     194           0 :                 form::FormButtonType eButtonType = form::FormButtonType_URL;
     195           0 :                 uno::Reference< beans::XPropertySetInfo >   xInfo = xPropSet->getPropertySetInfo();
     196           0 :                 if(xInfo->hasPropertyByName( "ButtonType" ))
     197             :                 {
     198           0 :                     aTmp = xPropSet->getPropertyValue( "ButtonType" );
     199             :                     form::FormButtonType eTmpButtonType;
     200           0 :                     aTmp >>= eTmpButtonType;
     201           0 :                     if( eButtonType == eTmpButtonType)
     202             :                     {
     203             :                         // Label
     204           0 :                         aTmp = xPropSet->getPropertyValue( "Label" );
     205           0 :                         OUString uTmp;
     206           0 :                         if( (aTmp >>= uTmp) && !uTmp.isEmpty())
     207             :                         {
     208           0 :                             rDescr = uTmp;
     209             :                         }
     210             : 
     211             :                         // util::URL
     212           0 :                         aTmp = xPropSet->getPropertyValue( "TargetURL" );
     213           0 :                         if( (aTmp >>= uTmp) && !uTmp.isEmpty())
     214             :                         {
     215           0 :                             rURL = uTmp;
     216             :                         }
     217           0 :                         bRet = true;
     218             :                     }
     219           0 :                 }
     220             :             }
     221             :         }
     222             :     }
     223             : 
     224           0 :     return bRet;
     225         177 : }
     226             : 
     227             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11