LCOV - code coverage report
Current view: top level - forms/source/xforms/submission - submission.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 30 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 15 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             : #ifndef INCLUDED_FORMS_SOURCE_XFORMS_SUBMISSION_SUBMISSION_HXX
      21             : #define INCLUDED_FORMS_SOURCE_XFORMS_SUBMISSION_SUBMISSION_HXX
      22             : 
      23             : #include <tools/urlobj.hxx>
      24             : #include <rtl/ustring.h>
      25             : #include <osl/conditn.hxx>
      26             : #include <osl/mutex.hxx>
      27             : #include <comphelper/processfactory.hxx>
      28             : #include <com/sun/star/uno/Reference.hxx>
      29             : #include <com/sun/star/uno/Any.hxx>
      30             : #include <com/sun/star/uno/Exception.hpp>
      31             : #include <com/sun/star/uno/RuntimeException.hpp>
      32             : #include <com/sun/star/xml/xpath/XXPathObject.hpp>
      33             : #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
      34             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      35             : 
      36             : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
      37             : #include <com/sun/star/ucb/XProgressHandler.hpp>
      38             : 
      39             : #include <com/sun/star/task/XInteractionHandler.hpp>
      40             : 
      41             : #include <com/sun/star/frame/XFrame.hpp>
      42             : 
      43             : #include <cppuhelper/implbase1.hxx>
      44             : #include <cppuhelper/implbase2.hxx>
      45             : #include <cppuhelper/implbase3.hxx>
      46             : 
      47             : #include "serialization.hxx"
      48             : 
      49             : #include <memory>
      50             : 
      51             : class CSubmissionPut;
      52             : class CSubmissionPost;
      53             : class CSubmissionGet;
      54             : 
      55           0 : class CCommandEnvironmentHelper : public cppu::WeakImplHelper1< css::ucb::XCommandEnvironment >
      56             : {
      57             :     friend class CSubmissionPut;
      58             :     friend class CSubmissionPost;
      59             :     friend class CSubmissionGet;
      60             :     friend class CSubmission;
      61             : 
      62             : protected:
      63             :     css::uno::Reference< css::task::XInteractionHandler >   m_aInteractionHandler;
      64             :     css::uno::Reference< css::ucb::XProgressHandler >       m_aProgressHandler;
      65             : 
      66             : public:
      67           0 :     virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      68             :     {
      69           0 :         return m_aInteractionHandler;
      70             :     }
      71           0 :     virtual css::uno::Reference< css::ucb::XProgressHandler > SAL_CALL getProgressHandler() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      72             :     {
      73           0 :         return m_aProgressHandler;
      74             :     }
      75             : };
      76             : 
      77           0 : class CProgressHandlerHelper : public cppu::WeakImplHelper1< css::ucb::XProgressHandler >
      78             : {
      79             :     friend class CSubmissionPut;
      80             :     friend class CSubmissionPost;
      81             :     friend class CSubmissionGet;
      82             : protected:
      83             :     osl::Condition m_cFinished;
      84             :     osl::Mutex m_mLock;
      85             :     sal_Int32 m_count;
      86             : public:
      87           0 :     CProgressHandlerHelper()
      88           0 :         : m_count(0)
      89           0 :     {}
      90           0 :     virtual void SAL_CALL push( const com::sun::star::uno::Any& /*aStatus*/) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      91             :     {
      92           0 :         m_mLock.acquire();
      93           0 :         m_count++;
      94           0 :         m_mLock.release();
      95           0 :     }
      96           0 :     virtual void SAL_CALL update(const com::sun::star::uno::Any& /*aStatus*/) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      97             :     {
      98           0 :     }
      99           0 :     virtual void SAL_CALL pop() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     100             :     {
     101           0 :         m_mLock.acquire();
     102           0 :         m_count--;
     103           0 :         if (m_count == 0)
     104           0 :             m_cFinished.set();
     105           0 :         m_mLock.release();
     106           0 :     }
     107             : };
     108             : 
     109             : class CSubmission
     110             : {
     111             : 
     112             : protected:
     113             :     INetURLObject m_aURLObj;
     114             :     css::uno::Reference< css::xml::xpath::XXPathObject >    m_aXPathObject;
     115             :     css::uno::Reference< css::xml::dom::XDocumentFragment > m_aFragment;
     116             :     css::uno::Reference< css::io::XInputStream >            m_aResultStream;
     117             :     css::uno::Reference< css::uno::XComponentContext >      m_xContext;
     118             :     OUString m_aEncoding;
     119             : 
     120             :     ::std::unique_ptr< CSerialization > createSerialization(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler
     121             :                                                   ,com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment>& _rOutEnv);
     122             : 
     123             : public:
     124             :     enum SubmissionResult {
     125             :         SUCCESS,
     126             :         INVALID_METHOD,
     127             :         INVALID_URL,
     128             :         INVALID_ENCODING,
     129             :         E_TRANSMISSION,
     130             :         UNKNOWN_ERROR
     131             :     };
     132             : 
     133           0 :     CSubmission(const OUString& aURL, const css::uno::Reference< css::xml::dom::XDocumentFragment >& aFragment)
     134             :         : m_aURLObj(aURL)
     135             :         , m_aFragment(aFragment)
     136           0 :         , m_xContext(::comphelper::getProcessComponentContext())
     137           0 :     {}
     138             : 
     139           0 :     virtual ~CSubmission() {}
     140             : 
     141           0 :     void setEncoding(const OUString& aEncoding)
     142             :     {
     143           0 :         m_aEncoding = aEncoding;
     144           0 :     }
     145             :     virtual SubmissionResult submit(const css::uno::Reference< css::task::XInteractionHandler >& ) = 0;
     146             : 
     147             :     SubmissionResult replace(const OUString&, const css::uno::Reference< css::xml::dom::XDocument >&, const css::uno::Reference< css::frame::XFrame>&);
     148             : 
     149             : };
     150             : 
     151             : #endif
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11