LCOV - code coverage report
Current view: top level - sw/source/ui/shells - textdrw.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 142 0.0 %

           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                 :            : #include <svx/svdview.hxx>
      30                 :            : #include <tools/urlobj.hxx>
      31                 :            : #include <svx/fmglob.hxx>
      32                 :            : #include <svx/svdouno.hxx>
      33                 :            : #include <com/sun/star/form/FormButtonType.hpp>
      34                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      35                 :            : 
      36                 :            : #include <view.hxx>
      37                 :            : #include <wrtsh.hxx>
      38                 :            : #include <edtwin.hxx>
      39                 :            : #include <swundo.hxx>
      40                 :            : #include <basesh.hxx>
      41                 :            : 
      42                 :            : #include <poolfmt.hrc>
      43                 :            : 
      44                 :            : #include <docsh.hxx>
      45                 :            : #include <sfx2/docfile.hxx>
      46                 :            : #include <svl/urihelper.hxx>
      47                 :            : #include <avmedia/mediawindow.hxx>
      48                 :            : 
      49                 :            : #include <unomid.h>
      50                 :            : 
      51                 :            : using namespace ::com::sun::star;
      52                 :            : using ::rtl::OUString;
      53                 :            : 
      54                 :          0 : void SwBaseShell::InsertURLButton(const String& rURL, const String& rTarget, const String& rTxt)
      55                 :            : {
      56         [ #  # ]:          0 :     SwWrtShell& rSh = GetShell();
      57                 :            : 
      58 [ #  # ][ #  # ]:          0 :     if (!rSh.HasDrawView())
      59         [ #  # ]:          0 :         rSh.MakeDrawView();
      60         [ #  # ]:          0 :     SdrView *pSdrView = rSh.GetDrawView();
      61                 :            : 
      62                 :            :     // OBJ_FM_BUTTON
      63         [ #  # ]:          0 :     pSdrView->SetDesignMode(sal_True);
      64         [ #  # ]:          0 :     pSdrView->SetCurrentObj(OBJ_FM_BUTTON);
      65         [ #  # ]:          0 :     pSdrView->SetEditMode(sal_False);
      66                 :            : 
      67                 :          0 :     Point aStartPos(rSh.GetCharRect().Pos() + Point(0, 1));
      68                 :            : 
      69         [ #  # ]:          0 :     rSh.StartAction();
      70         [ #  # ]:          0 :     rSh.StartUndo( UNDO_UI_INSERT_URLBTN );
      71 [ #  # ][ #  # ]:          0 :     if (rSh.BeginCreate(OBJ_FM_BUTTON, FmFormInventor, aStartPos))
      72                 :            :     {
      73                 :          0 :         pSdrView->SetOrtho(sal_False);
      74         [ #  # ]:          0 :          Size aSz(GetView().GetEditWin().PixelToLogic(Size(140, 20)));
      75                 :          0 :         Point aEndPos(aSz.Width(), aSz.Height());
      76                 :            : 
      77         [ #  # ]:          0 :         rSh.MoveCreate(aStartPos + aEndPos);
      78         [ #  # ]:          0 :         rSh.EndCreate(SDRCREATE_FORCEEND);
      79                 :            : 
      80                 :          0 :         const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
      81 [ #  # ][ #  # ]:          0 :         if (rMarkList.GetMark(0))
      82                 :            :         {
      83 [ #  # ][ #  # ]:          0 :             SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      84         [ #  # ]:          0 :             uno::Reference< awt::XControlModel >  xControlModel = pUnoCtrl->GetUnoControlModel();
      85                 :            : 
      86                 :            :             OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
      87         [ #  # ]:          0 :             if( !xControlModel.is() )
      88                 :          0 :                 return;
      89                 :            : 
      90         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet >  xPropSet(xControlModel, uno::UNO_QUERY);
      91                 :            : 
      92                 :            : 
      93                 :          0 :             uno::Any aTmp;
      94                 :            : 
      95 [ #  # ][ #  # ]:          0 :             aTmp <<= OUString(rTxt);
      96 [ #  # ][ #  # ]:          0 :             xPropSet->setPropertyValue( C2U("Label"), aTmp );
                 [ #  # ]
      97                 :            : 
      98         [ #  # ]:          0 :             SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
      99         [ #  # ]:          0 :             INetURLObject aAbs;
     100         [ #  # ]:          0 :             if( pMedium )
     101 [ #  # ][ #  # ]:          0 :                 aAbs = pMedium->GetURLObject();
     102                 :            : 
     103 [ #  # ][ #  # ]:          0 :             aTmp <<= OUString(URIHelper::SmartRel2Abs(aAbs, rURL));
         [ #  # ][ #  # ]
     104 [ #  # ][ #  # ]:          0 :             xPropSet->setPropertyValue( C2U("TargetURL"), aTmp );
                 [ #  # ]
     105                 :            : 
     106         [ #  # ]:          0 :             if( rTarget.Len() )
     107                 :            :             {
     108 [ #  # ][ #  # ]:          0 :                 aTmp <<= OUString(rTarget);
     109 [ #  # ][ #  # ]:          0 :                 xPropSet->setPropertyValue( C2U("TargetFrame"), aTmp );
                 [ #  # ]
     110                 :            :             }
     111                 :            : 
     112                 :            : 
     113                 :          0 :             form::FormButtonType eButtonType = form::FormButtonType_URL;
     114         [ #  # ]:          0 :             aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0));
     115 [ #  # ][ #  # ]:          0 :             xPropSet->setPropertyValue( C2U("ButtonType"), aTmp );
                 [ #  # ]
     116                 :            : 
     117 [ #  # ][ #  # ]:          0 :             if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
                 [ #  # ]
     118                 :            :             {
     119                 :            :                 // #105638# OJ
     120         [ #  # ]:          0 :                 aTmp <<= sal_True;
     121 [ #  # ][ #  # ]:          0 :                 xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aTmp );
                 [ #  # ]
     122 [ #  # ][ #  # ]:          0 :             }
     123                 :            :         }
     124                 :            : 
     125 [ #  # ][ #  # ]:          0 :         if (rSh.IsObjSelected())
     126                 :            :         {
     127         [ #  # ]:          0 :             rSh.UnSelectFrm();
     128                 :            :         }
     129                 :            :     }
     130         [ #  # ]:          0 :     rSh.EndUndo( UNDO_UI_INSERT_URLBTN );
     131         [ #  # ]:          0 :     rSh.EndAction();
     132                 :            : }
     133                 :            : 
     134                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10