LCOV - code coverage report
Current view: top level - basctl/source/basicide - docsignature.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 25 0.0 %
Date: 2014-11-03 Functions: 0 8 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 "docsignature.hxx"
      21             : #include "scriptdocument.hxx"
      22             : 
      23             : #include <sfx2/objsh.hxx>
      24             : #include <sfx2/signaturestate.hxx>
      25             : 
      26             : namespace basctl
      27             : {
      28             :     using ::com::sun::star::uno::Reference;
      29             :     using ::com::sun::star::uno::UNO_QUERY;
      30             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      31             :     using ::com::sun::star::uno::Exception;
      32             :     using ::com::sun::star::uno::RuntimeException;
      33             :     using ::com::sun::star::frame::XModel;
      34             : 
      35             :     // DocumentSignature::Impl
      36             : 
      37             :     struct DocumentSignature::Impl
      38             :     {
      39             :         SfxObjectShell* pShell;
      40             : 
      41           0 :         Impl () : pShell(0) { }
      42             :     };
      43             : 
      44             :     // DocumentSignature
      45             : 
      46           0 :     DocumentSignature::DocumentSignature (ScriptDocument const& rDocument) :
      47           0 :         m_pImpl(new Impl)
      48             :     {
      49           0 :         if (rDocument.isDocument())
      50             :         {
      51           0 :             Reference<XModel> xDocument(rDocument.getDocument());
      52             :             // find object shell for document
      53           0 :             SfxObjectShell* pShell = SfxObjectShell::GetFirst();
      54           0 :             while ( pShell )
      55             :             {
      56           0 :                 if ( pShell->GetModel() == xDocument )
      57           0 :                     break;
      58           0 :                 pShell = SfxObjectShell::GetNext( *pShell );
      59             :             }
      60           0 :             m_pImpl->pShell = pShell;
      61             :         }
      62           0 :     }
      63             : 
      64           0 :     DocumentSignature::~DocumentSignature()
      65             :     {
      66           0 :     }
      67             : 
      68           0 :     bool DocumentSignature::supportsSignatures() const
      69             :     {
      70           0 :         return ( m_pImpl->pShell != NULL );
      71             :     }
      72             : 
      73           0 :     void DocumentSignature::signScriptingContent() const
      74             :     {
      75             :         OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" );
      76           0 :         if ( m_pImpl->pShell )
      77           0 :             m_pImpl->pShell->SignScriptingContent();
      78           0 :     }
      79             : 
      80           0 :     sal_uInt16 DocumentSignature::getScriptingSignatureState() const
      81             :     {
      82           0 :         if ( m_pImpl->pShell )
      83           0 :             return m_pImpl->pShell->GetScriptingSignatureState();
      84           0 :         return SIGNATURESTATE_NOSIGNATURES;
      85             :     }
      86             : 
      87           0 : } // namespace basctl
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10