LCOV - code coverage report
Current view: top level - sd/source/core - pglink.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 42 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 62 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                 :            : 
      30                 :            : #include <sfx2/linkmgr.hxx>
      31                 :            : 
      32                 :            : #include "pglink.hxx"
      33                 :            : #include "sdpage.hxx"
      34                 :            : #include "drawdoc.hxx"
      35                 :            : 
      36                 :            : 
      37                 :            : /*************************************************************************
      38                 :            : |*
      39                 :            : |*      Ctor
      40                 :            : |*
      41                 :            : \************************************************************************/
      42                 :            : 
      43                 :          0 : SdPageLink::SdPageLink(SdPage* pPg, const String& rFileName,
      44                 :            :                        const String& rBookmarkName) :
      45                 :            :     ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE),
      46                 :          0 :     pPage(pPg)
      47                 :            : {
      48         [ #  # ]:          0 :     pPage->SetFileName(rFileName);
      49         [ #  # ]:          0 :     pPage->SetBookmarkName(rBookmarkName);
      50                 :          0 : }
      51                 :            : 
      52                 :            : 
      53                 :            : /*************************************************************************
      54                 :            : |*
      55                 :            : |* Dtor
      56                 :            : |*
      57                 :            : \************************************************************************/
      58                 :            : 
      59                 :            : 
      60                 :          0 : SdPageLink::~SdPageLink()
      61                 :            : {
      62         [ #  # ]:          0 : }
      63                 :            : 
      64                 :            : /*************************************************************************
      65                 :            : |*
      66                 :            : |* Daten haben sich geaendert
      67                 :            : |*
      68                 :            : \************************************************************************/
      69                 :            : 
      70                 :          0 : ::sfx2::SvBaseLink::UpdateResult SdPageLink::DataChanged(
      71                 :            :     const String&, const ::com::sun::star::uno::Any& )
      72                 :            : {
      73                 :          0 :     SdDrawDocument* pDoc = (SdDrawDocument*) pPage->GetModel();
      74         [ #  # ]:          0 :     sfx2::LinkManager* pLinkManager = pDoc!=NULL ? pDoc->GetLinkManager() : NULL;
      75                 :            : 
      76         [ #  # ]:          0 :     if (pLinkManager)
      77                 :            :     {
      78                 :            :         /**********************************************************************
      79                 :            :         * Nur Standardseiten duerfen gelinkt sein
      80                 :            :         * Die entsprechenden Notizseiten werden automatisch aktualisiert
      81                 :            :         **********************************************************************/
      82         [ #  # ]:          0 :         String aFileName;
      83         [ #  # ]:          0 :         String aBookmarkName;
      84         [ #  # ]:          0 :         String aFilterName;
      85                 :            :         pLinkManager->GetDisplayNames( this,0, &aFileName, &aBookmarkName,
      86         [ #  # ]:          0 :                                       &aFilterName);
      87         [ #  # ]:          0 :         pPage->SetFileName(aFileName);
      88         [ #  # ]:          0 :         pPage->SetBookmarkName(aBookmarkName);
      89                 :            : 
      90         [ #  # ]:          0 :         SdDrawDocument* pBookmarkDoc = pDoc->OpenBookmarkDoc(aFileName);
      91                 :            : 
      92         [ #  # ]:          0 :         if (pBookmarkDoc)
      93                 :            :         {
      94                 :            :             /******************************************************************
      95                 :            :             * Die gelinkte Seite wird im Model replaced
      96                 :            :             ******************************************************************/
      97         [ #  # ]:          0 :             if (aBookmarkName.Len() == 0)
      98                 :            :             {
      99                 :            :                 // Kein Seitenname angegeben: es wird die erste Seite genommen
     100 [ #  # ][ #  # ]:          0 :                 aBookmarkName = pBookmarkDoc->GetSdPage(0, PK_STANDARD)->GetName();
                 [ #  # ]
     101         [ #  # ]:          0 :                 pPage->SetBookmarkName(aBookmarkName);
     102                 :            :             }
     103                 :            : 
     104         [ #  # ]:          0 :             std::vector<rtl::OUString> aBookmarkList;
     105 [ #  # ][ #  # ]:          0 :             aBookmarkList.push_back(aBookmarkName);
     106         [ #  # ]:          0 :             sal_uInt16 nInsertPos = pPage->GetPageNum();
     107                 :          0 :             sal_Bool bLink = sal_True;
     108                 :          0 :             sal_Bool bReplace = sal_True;
     109                 :          0 :             sal_Bool bNoDialogs = sal_False;
     110                 :          0 :             sal_Bool bCopy = sal_False;
     111                 :            : 
     112         [ #  # ]:          0 :             if( pDoc->pDocLockedInsertingLinks )
     113                 :            :             {
     114                 :            :                 // resolving links while loading pDoc
     115                 :          0 :                 bNoDialogs = sal_True;
     116                 :          0 :                 bCopy = sal_True;
     117                 :            :             }
     118                 :            : 
     119                 :            :             pDoc->InsertBookmarkAsPage(aBookmarkList, NULL, bLink, bReplace,
     120         [ #  # ]:          0 :                                        nInsertPos, bNoDialogs, NULL, bCopy, sal_True, sal_True);
     121                 :            : 
     122         [ #  # ]:          0 :             if( !pDoc->pDocLockedInsertingLinks )
     123         [ #  # ]:          0 :                 pDoc->CloseBookmarkDoc();
     124 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
     125                 :            :     }
     126                 :          0 :     return SUCCESS;
     127                 :            : }
     128                 :            : 
     129                 :            : /*************************************************************************
     130                 :            : |*
     131                 :            : |* Link an oder abmelden
     132                 :            : |*
     133                 :            : \************************************************************************/
     134                 :            : 
     135                 :          0 : void SdPageLink::Closed()
     136                 :            : {
     137                 :            :     // Die Verbindung wird aufgehoben
     138         [ #  # ]:          0 :     pPage->SetFileName(String());
     139         [ #  # ]:          0 :     pPage->SetBookmarkName(String());
     140                 :            : 
     141                 :          0 :     SvBaseLink::Closed();
     142                 :          0 : }
     143                 :            : 
     144                 :            : 
     145                 :            : 
     146                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10