LCOV - code coverage report
Current view: top level - forms/source/xforms/submission - submission.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 30 0.0 %
Date: 2014-04-14 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             : namespace CSS = com::sun::star;
      52             : 
      53             : class CSubmissionPut;
      54             : class CSubmissionPost;
      55             : class CSubmissionGet;
      56             : 
      57           0 : class CCommandEnvironmentHelper : public cppu::WeakImplHelper1< CSS::ucb::XCommandEnvironment >
      58             : {
      59             :     friend class CSubmissionPut;
      60             :     friend class CSubmissionPost;
      61             :     friend class CSubmissionGet;
      62             :     friend class CSubmission;
      63             : 
      64             : protected:
      65             :     CSS::uno::Reference< CSS::task::XInteractionHandler >   m_aInteractionHandler;
      66             :     CSS::uno::Reference< CSS::ucb::XProgressHandler >       m_aProgressHandler;
      67             : 
      68             : public:
      69           0 :     virtual CSS::uno::Reference< CSS::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (CSS::uno::RuntimeException, std::exception) SAL_OVERRIDE
      70             :     {
      71           0 :         return m_aInteractionHandler;
      72             :     }
      73           0 :     virtual CSS::uno::Reference< CSS::ucb::XProgressHandler > SAL_CALL getProgressHandler() throw (CSS::uno::RuntimeException, std::exception) SAL_OVERRIDE
      74             :     {
      75           0 :         return m_aProgressHandler;
      76             :     }
      77             : };
      78             : 
      79           0 : class CProgressHandlerHelper : public cppu::WeakImplHelper1< CSS::ucb::XProgressHandler >
      80             : {
      81             :     friend class CSubmissionPut;
      82             :     friend class CSubmissionPost;
      83             :     friend class CSubmissionGet;
      84             : protected:
      85             :     osl::Condition m_cFinished;
      86             :     osl::Mutex m_mLock;
      87             :     sal_Int32 m_count;
      88             : public:
      89           0 :     CProgressHandlerHelper()
      90           0 :         : m_count(0)
      91           0 :     {}
      92           0 :     virtual void SAL_CALL push( const com::sun::star::uno::Any& /*aStatus*/) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      93             :     {
      94           0 :         m_mLock.acquire();
      95           0 :         m_count++;
      96           0 :         m_mLock.release();
      97           0 :     }
      98           0 :     virtual void SAL_CALL update(const com::sun::star::uno::Any& /*aStatus*/) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      99             :     {
     100           0 :     }
     101           0 :     virtual void SAL_CALL pop() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     102             :     {
     103           0 :         m_mLock.acquire();
     104           0 :         m_count--;
     105           0 :         if (m_count == 0)
     106           0 :             m_cFinished.set();
     107           0 :         m_mLock.release();
     108           0 :     }
     109             : };
     110             : 
     111             : class CSubmission
     112             : {
     113             : 
     114             : protected:
     115             :     INetURLObject m_aURLObj;
     116             :     CSS::uno::Reference< CSS::xml::xpath::XXPathObject >    m_aXPathObject;
     117             :     CSS::uno::Reference< CSS::xml::dom::XDocumentFragment > m_aFragment;
     118             :     CSS::uno::Reference< CSS::io::XInputStream >            m_aResultStream;
     119             :     CSS::uno::Reference< CSS::uno::XComponentContext >      m_xContext;
     120             :     OUString m_aEncoding;
     121             : 
     122             :     ::std::auto_ptr< CSerialization > createSerialization(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler
     123             :                                                   ,com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment>& _rOutEnv);
     124             : 
     125             : public:
     126             :     enum SubmissionResult {
     127             :         SUCCESS,
     128             :         INVALID_METHOD,
     129             :         INVALID_URL,
     130             :         INVALID_ENCODING,
     131             :         E_TRANSMISSION,
     132             :         UNKNOWN_ERROR
     133             :     };
     134             : 
     135           0 :     CSubmission(const OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment)
     136             :         : m_aURLObj(aURL)
     137             :         , m_aFragment(aFragment)
     138           0 :         , m_xContext(::comphelper::getProcessComponentContext())
     139           0 :     {}
     140             : 
     141           0 :     virtual ~CSubmission() {}
     142             : 
     143           0 :     virtual void setEncoding(const OUString& aEncoding)
     144             :     {
     145           0 :         m_aEncoding = aEncoding;
     146           0 :     }
     147             :     virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& ) = 0;
     148             : 
     149             :     virtual SubmissionResult replace(const OUString&, const CSS::uno::Reference< CSS::xml::dom::XDocument >&, const CSS::uno::Reference< CSS::frame::XFrame>&);
     150             : 
     151             : };
     152             : 
     153             : #endif
     154             : 
     155             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10