LCOV - code coverage report
Current view: top level - sd/source/core - pglink.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 42 0.0 %
Date: 2014-04-14 Functions: 0 5 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             : 
      21             : #include <sfx2/linkmgr.hxx>
      22             : 
      23             : #include "pglink.hxx"
      24             : #include "sdpage.hxx"
      25             : #include "drawdoc.hxx"
      26             : 
      27             : 
      28             : /*************************************************************************
      29             : |*
      30             : |*      Ctor
      31             : |*
      32             : \************************************************************************/
      33             : 
      34           0 : SdPageLink::SdPageLink(SdPage* pPg, const OUString& rFileName,
      35             :                        const OUString& rBookmarkName) :
      36             :     ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE),
      37           0 :     pPage(pPg)
      38             : {
      39           0 :     pPage->SetFileName(rFileName);
      40           0 :     pPage->SetBookmarkName(rBookmarkName);
      41           0 : }
      42             : 
      43             : 
      44             : /*************************************************************************
      45             : |*
      46             : |* Dtor
      47             : |*
      48             : \************************************************************************/
      49             : 
      50             : 
      51           0 : SdPageLink::~SdPageLink()
      52             : {
      53           0 : }
      54             : 
      55             : /*************************************************************************
      56             : |*
      57             : |* Date have changed
      58             : |*
      59             : \************************************************************************/
      60             : 
      61           0 : ::sfx2::SvBaseLink::UpdateResult SdPageLink::DataChanged(
      62             :     const OUString&, const ::com::sun::star::uno::Any& )
      63             : {
      64           0 :     SdDrawDocument* pDoc = (SdDrawDocument*) pPage->GetModel();
      65           0 :     sfx2::LinkManager* pLinkManager = pDoc!=NULL ? pDoc->GetLinkManager() : NULL;
      66             : 
      67           0 :     if (pLinkManager)
      68             :     {
      69             :         /**********************************************************************
      70             :         * Only standard pages are allowed to be linked
      71             :         * The corresponding note pages are updated automaticly
      72             :         **********************************************************************/
      73           0 :         OUString aFileName;
      74           0 :         OUString aBookmarkName;
      75           0 :         OUString aFilterName;
      76             :         pLinkManager->GetDisplayNames( this,0, &aFileName, &aBookmarkName,
      77           0 :                                       &aFilterName);
      78           0 :         pPage->SetFileName(aFileName);
      79           0 :         pPage->SetBookmarkName(aBookmarkName);
      80             : 
      81           0 :         SdDrawDocument* pBookmarkDoc = pDoc->OpenBookmarkDoc(aFileName);
      82             : 
      83           0 :         if (pBookmarkDoc)
      84             :         {
      85             :             /******************************************************************
      86             :             * the linked page is replaced in the model
      87             :             ******************************************************************/
      88           0 :             if (aBookmarkName.isEmpty())
      89             :             {
      90             :                 // no page name specified: we assume it is the first page
      91           0 :                 aBookmarkName = pBookmarkDoc->GetSdPage(0, PK_STANDARD)->GetName();
      92           0 :                 pPage->SetBookmarkName(aBookmarkName);
      93             :             }
      94             : 
      95           0 :             std::vector<OUString> aBookmarkList;
      96           0 :             aBookmarkList.push_back(aBookmarkName);
      97           0 :             sal_uInt16 nInsertPos = pPage->GetPageNum();
      98           0 :             sal_Bool bLink = sal_True;
      99           0 :             sal_Bool bReplace = sal_True;
     100           0 :             sal_Bool bNoDialogs = sal_False;
     101           0 :             sal_Bool bCopy = sal_False;
     102             : 
     103           0 :             if( pDoc->pDocLockedInsertingLinks )
     104             :             {
     105             :                 // resolving links while loading pDoc
     106           0 :                 bNoDialogs = sal_True;
     107           0 :                 bCopy = sal_True;
     108             :             }
     109             : 
     110             :             pDoc->InsertBookmarkAsPage(aBookmarkList, NULL, bLink, bReplace,
     111           0 :                                        nInsertPos, bNoDialogs, NULL, bCopy, sal_True, sal_True);
     112             : 
     113           0 :             if( !pDoc->pDocLockedInsertingLinks )
     114           0 :                 pDoc->CloseBookmarkDoc();
     115           0 :         }
     116             :     }
     117           0 :     return SUCCESS;
     118             : }
     119             : 
     120             : /*************************************************************************
     121             : |*
     122             : |* Connect or disconnect link
     123             : |*
     124             : \************************************************************************/
     125             : 
     126           0 : void SdPageLink::Closed()
     127             : {
     128             :     // the connection is closed
     129           0 :     pPage->SetFileName(OUString());
     130           0 :     pPage->SetBookmarkName(OUString());
     131             : 
     132           0 :     SvBaseLink::Closed();
     133           0 : }
     134             : 
     135             : 
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10