LCOV - code coverage report
Current view: top level - libreoffice/forms/source/xforms/submission - submission.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-12-27 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 __SUBMISSION_HXX
      21             : #define __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             : namespace CSS = com::sun::star;
      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)
      68             :     {
      69           0 :         return m_aInteractionHandler;
      70             :     }
      71           0 :     virtual CSS::uno::Reference< CSS::ucb::XProgressHandler > SAL_CALL getProgressHandler() throw (CSS::uno::RuntimeException)
      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)
      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)
      97             :     {
      98           0 :     }
      99           0 :     virtual void SAL_CALL pop() throw(com::sun::star::uno::RuntimeException)
     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             :     rtl::OUString m_aEncoding;
     119             : 
     120             :     ::std::auto_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 rtl::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             :     //    virtual CSS::uno::Sequence< rtl::OUString > getSupportedEncodings() = 0;
     142           0 :     virtual void setEncoding(const rtl::OUString& aEncoding)
     143             :     {
     144           0 :         m_aEncoding = aEncoding;
     145           0 :     }
     146             :     virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& ) = 0;
     147             : 
     148             :     virtual SubmissionResult replace(const rtl::OUString&, const CSS::uno::Reference< CSS::xml::dom::XDocument >&, const CSS::uno::Reference< CSS::frame::XFrame>&);
     149             : 
     150             : };
     151             : 
     152             : #endif
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10