LCOV - code coverage report
Current view: top level - sc/source/ui/view - tabvwshg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 39 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 96 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 <tools/urlobj.hxx>
      30                 :            : #include <svx/fmglob.hxx>
      31                 :            : #include <svx/svdouno.hxx>
      32                 :            : #include <svx/svdpagv.hxx>
      33                 :            : #include <sfx2/objsh.hxx>
      34                 :            : #include <sfx2/docfile.hxx>
      35                 :            : 
      36                 :            : #include <com/sun/star/form/FormButtonType.hpp>
      37                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      38                 :            : #include <com/sun/star/awt/XControlModel.hpp>
      39                 :            : 
      40                 :            : using namespace com::sun::star;
      41                 :            : 
      42                 :            : #include "tabvwsh.hxx"
      43                 :            : #include "document.hxx"
      44                 :            : #include "drawview.hxx"
      45                 :            : #include "globstr.hrc"
      46                 :            : #include <avmedia/mediawindow.hxx>
      47                 :            : 
      48                 :            : //------------------------------------------------------------------------
      49                 :            : 
      50                 :          0 : void ScTabViewShell::InsertURLButton( const String& rName, const String& rURL,
      51                 :            :                                         const String& rTarget,
      52                 :            :                                         const Point* pInsPos )
      53                 :            : {
      54                 :            :     //  Tabelle geschuetzt ?
      55                 :            : 
      56                 :          0 :     ScViewData* pViewData = GetViewData();
      57         [ #  # ]:          0 :     ScDocument* pDoc = pViewData->GetDocument();
      58                 :          0 :     SCTAB nTab = pViewData->GetTabNo();
      59 [ #  # ][ #  # ]:          0 :     if ( pDoc->IsTabProtected(nTab) )
      60                 :            :     {
      61         [ #  # ]:          0 :         ErrorMessage(STR_PROTECTIONERR);
      62                 :            :         return;
      63                 :            :     }
      64                 :            : 
      65         [ #  # ]:          0 :     MakeDrawLayer();
      66                 :            : 
      67         [ #  # ]:          0 :     ScTabView*  pView   = pViewData->GetView();
      68                 :          0 :     ScDrawView* pDrView = pView->GetScDrawView();
      69                 :          0 :     SdrModel*   pModel  = pDrView->GetModel();
      70                 :            : 
      71                 :            :     SdrObject* pObj = SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON,
      72         [ #  # ]:          0 :                                pDrView->GetSdrPageView()->GetPage(), pModel);
      73 [ #  # ][ #  # ]:          0 :     SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj);
         [ #  # ][ #  # ]
      74                 :            : 
      75         [ #  # ]:          0 :     uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel();
      76                 :            :     OSL_ENSURE( xControlModel.is(), "UNO-Control ohne Model" );
      77         [ #  # ]:          0 :     if( !xControlModel.is() )
      78                 :            :         return;
      79                 :            : 
      80         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
      81                 :          0 :     uno::Any aAny;
      82                 :            : 
      83 [ #  # ][ #  # ]:          0 :     aAny <<= rtl::OUString(rName);
      84 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue( rtl::OUString( "Label" ), aAny );
      85                 :            : 
      86 [ #  # ][ #  # ]:          0 :     ::rtl::OUString aTmp = INetURLObject::GetAbsURL( pDoc->GetDocumentShell()->GetMedium()->GetBaseURL(), rURL );
                 [ #  # ]
      87         [ #  # ]:          0 :     aAny <<= aTmp;
      88 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue( rtl::OUString( "TargetURL" ), aAny );
      89                 :            : 
      90         [ #  # ]:          0 :     if( rTarget.Len() )
      91                 :            :     {
      92 [ #  # ][ #  # ]:          0 :         aAny <<= rtl::OUString(rTarget);
      93 [ #  # ][ #  # ]:          0 :         xPropSet->setPropertyValue( rtl::OUString( "TargetFrame" ), aAny );
      94                 :            :     }
      95                 :            : 
      96                 :          0 :     form::FormButtonType eButtonType = form::FormButtonType_URL;
      97         [ #  # ]:          0 :     aAny <<= eButtonType;
      98 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue( rtl::OUString( "ButtonType" ), aAny );
      99                 :            : 
     100 [ #  # ][ #  # ]:          0 :         if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
                 [ #  # ]
     101                 :            :     {
     102         [ #  # ]:          0 :         aAny <<= sal_True;
     103 [ #  # ][ #  # ]:          0 :         xPropSet->setPropertyValue( rtl::OUString(  "DispatchURLInternal" ), aAny );
     104                 :            :     }
     105                 :            : 
     106                 :          0 :     Point aPos;
     107         [ #  # ]:          0 :     if (pInsPos)
     108                 :          0 :         aPos = *pInsPos;
     109                 :            :     else
     110         [ #  # ]:          0 :         aPos = GetInsertPos();
     111                 :            : 
     112                 :            :     // Groesse wie in 3.1:
     113 [ #  # ][ #  # ]:          0 :     Size aSize = GetActiveWin()->PixelToLogic(Size(140, 20));
     114                 :            : 
     115 [ #  # ][ #  # ]:          0 :     if ( pDoc->IsNegativePage(nTab) )
     116                 :          0 :         aPos.X() -= aSize.Width();
     117                 :            : 
     118 [ #  # ][ #  # ]:          0 :     pObj->SetLogicRect(Rectangle(aPos, aSize));
     119                 :            : 
     120                 :            :     //  am alten VC-Button musste die Position/Groesse nochmal explizit
     121                 :            :     //  gesetzt werden - das scheint mit UnoControls nicht noetig zu sein
     122                 :            : 
     123                 :            :     //  nicht markieren wenn Ole
     124 [ #  # ][ #  # ]:          0 :     pDrView->InsertObjectSafe( pObj, *pDrView->GetSdrPageView() );
     125                 :            : }
     126                 :            : 
     127                 :            : 
     128                 :            : 
     129                 :            : 
     130                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10