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

Generated by: LCOV version 1.10