1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #if ! defined INCLUDED_DP_COMMANDENVIRONMENTS_HXX 25*b1cdbd2cSJim Jagielski #define INCLUDED_DP_COMMANDENVIRONMENTS_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski #include "cppuhelper/compbase3.hxx" 29*b1cdbd2cSJim Jagielski //#include "cppuhelper/implbase2.hxx" 30*b1cdbd2cSJim Jagielski #include "ucbhelper/content.hxx" 31*b1cdbd2cSJim Jagielski #include "com/sun/star/uno/Type.hxx" 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski 34*b1cdbd2cSJim Jagielski namespace css = ::com::sun::star; 35*b1cdbd2cSJim Jagielski 36*b1cdbd2cSJim Jagielski namespace dp_manager { 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski /** 41*b1cdbd2cSJim Jagielski This command environment is to be used when an extension is temporarily 42*b1cdbd2cSJim Jagielski stored in the "tmp" repository. It prevents all kind of user interaction. 43*b1cdbd2cSJim Jagielski */ 44*b1cdbd2cSJim Jagielski class BaseCommandEnv 45*b1cdbd2cSJim Jagielski : public ::cppu::WeakImplHelper3< css::ucb::XCommandEnvironment, 46*b1cdbd2cSJim Jagielski css::task::XInteractionHandler, 47*b1cdbd2cSJim Jagielski css::ucb::XProgressHandler > 48*b1cdbd2cSJim Jagielski { 49*b1cdbd2cSJim Jagielski protected: 50*b1cdbd2cSJim Jagielski css::uno::Reference< css::uno::XComponentContext > m_xContext; 51*b1cdbd2cSJim Jagielski css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler; 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski void handle_(bool approve, bool abort, 54*b1cdbd2cSJim Jagielski css::uno::Reference< css::task::XInteractionRequest> const & xRequest ); 55*b1cdbd2cSJim Jagielski public: 56*b1cdbd2cSJim Jagielski virtual ~BaseCommandEnv(); 57*b1cdbd2cSJim Jagielski BaseCommandEnv(); 58*b1cdbd2cSJim Jagielski BaseCommandEnv( 59*b1cdbd2cSJim Jagielski css::uno::Reference< css::task::XInteractionHandler> const & handler); 60*b1cdbd2cSJim Jagielski 61*b1cdbd2cSJim Jagielski // XCommandEnvironment 62*b1cdbd2cSJim Jagielski virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL 63*b1cdbd2cSJim Jagielski getInteractionHandler() throw (css::uno::RuntimeException); 64*b1cdbd2cSJim Jagielski virtual css::uno::Reference<css::ucb::XProgressHandler > 65*b1cdbd2cSJim Jagielski SAL_CALL getProgressHandler() throw (css::uno::RuntimeException); 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski // XInteractionHandler 68*b1cdbd2cSJim Jagielski virtual void SAL_CALL handle( 69*b1cdbd2cSJim Jagielski css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) 70*b1cdbd2cSJim Jagielski throw (css::uno::RuntimeException); 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski // XProgressHandler 73*b1cdbd2cSJim Jagielski virtual void SAL_CALL push( css::uno::Any const & Status ) 74*b1cdbd2cSJim Jagielski throw (css::uno::RuntimeException); 75*b1cdbd2cSJim Jagielski virtual void SAL_CALL update( css::uno::Any const & Status ) 76*b1cdbd2cSJim Jagielski throw (css::uno::RuntimeException); 77*b1cdbd2cSJim Jagielski virtual void SAL_CALL pop() throw (css::uno::RuntimeException); 78*b1cdbd2cSJim Jagielski }; 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski class TmpRepositoryCommandEnv : public BaseCommandEnv 81*b1cdbd2cSJim Jagielski { 82*b1cdbd2cSJim Jagielski public: 83*b1cdbd2cSJim Jagielski TmpRepositoryCommandEnv(); 84*b1cdbd2cSJim Jagielski TmpRepositoryCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler); 85*b1cdbd2cSJim Jagielski 86*b1cdbd2cSJim Jagielski // XInteractionHandler 87*b1cdbd2cSJim Jagielski virtual void SAL_CALL handle( 88*b1cdbd2cSJim Jagielski css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) 89*b1cdbd2cSJim Jagielski throw (css::uno::RuntimeException); 90*b1cdbd2cSJim Jagielski 91*b1cdbd2cSJim Jagielski }; 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski /** this class is for use in XPackageManager::synchronize. 94*b1cdbd2cSJim Jagielski 95*b1cdbd2cSJim Jagielski It handles particular license cases. 96*b1cdbd2cSJim Jagielski */ 97*b1cdbd2cSJim Jagielski class LicenseCommandEnv : public BaseCommandEnv 98*b1cdbd2cSJim Jagielski { 99*b1cdbd2cSJim Jagielski private: 100*b1cdbd2cSJim Jagielski ::rtl::OUString m_repository; 101*b1cdbd2cSJim Jagielski bool m_bSuppressLicense; 102*b1cdbd2cSJim Jagielski public: LicenseCommandEnv()103*b1cdbd2cSJim Jagielski LicenseCommandEnv(){}; 104*b1cdbd2cSJim Jagielski LicenseCommandEnv( 105*b1cdbd2cSJim Jagielski css::uno::Reference< css::task::XInteractionHandler> const & handler, 106*b1cdbd2cSJim Jagielski bool bSuppressLicense, 107*b1cdbd2cSJim Jagielski ::rtl::OUString const & repository); 108*b1cdbd2cSJim Jagielski 109*b1cdbd2cSJim Jagielski // XInteractionHandler 110*b1cdbd2cSJim Jagielski virtual void SAL_CALL handle( 111*b1cdbd2cSJim Jagielski css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) 112*b1cdbd2cSJim Jagielski throw (css::uno::RuntimeException); 113*b1cdbd2cSJim Jagielski 114*b1cdbd2cSJim Jagielski }; 115*b1cdbd2cSJim Jagielski 116*b1cdbd2cSJim Jagielski /** this class is for use in XPackageManager::checkPrerequisites 117*b1cdbd2cSJim Jagielski 118*b1cdbd2cSJim Jagielski It always prohibits a license interaction 119*b1cdbd2cSJim Jagielski */ 120*b1cdbd2cSJim Jagielski class NoLicenseCommandEnv : public BaseCommandEnv 121*b1cdbd2cSJim Jagielski { 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski public: NoLicenseCommandEnv()124*b1cdbd2cSJim Jagielski NoLicenseCommandEnv(){}; 125*b1cdbd2cSJim Jagielski NoLicenseCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler); 126*b1cdbd2cSJim Jagielski 127*b1cdbd2cSJim Jagielski // XInteractionHandler 128*b1cdbd2cSJim Jagielski virtual void SAL_CALL handle( 129*b1cdbd2cSJim Jagielski css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) 130*b1cdbd2cSJim Jagielski throw (css::uno::RuntimeException); 131*b1cdbd2cSJim Jagielski 132*b1cdbd2cSJim Jagielski }; 133*b1cdbd2cSJim Jagielski 134*b1cdbd2cSJim Jagielski /* For use in XExtensionManager::addExtension in the call to 135*b1cdbd2cSJim Jagielski XPackage::checkPrerequisites 136*b1cdbd2cSJim Jagielski It prevents all user interactions. The license is always accepted. 137*b1cdbd2cSJim Jagielski It remembers if there was a platform or a dependency exception in 138*b1cdbd2cSJim Jagielski the member m_bException. if there was any other exception then m_bUnknownException 139*b1cdbd2cSJim Jagielski is set. 140*b1cdbd2cSJim Jagielski 141*b1cdbd2cSJim Jagielski */ 142*b1cdbd2cSJim Jagielski class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv 143*b1cdbd2cSJim Jagielski { 144*b1cdbd2cSJim Jagielski public: 145*b1cdbd2cSJim Jagielski SilentCheckPrerequisitesCommandEnv(); 146*b1cdbd2cSJim Jagielski // XInteractionHandler 147*b1cdbd2cSJim Jagielski virtual void SAL_CALL handle( 148*b1cdbd2cSJim Jagielski css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) 149*b1cdbd2cSJim Jagielski throw (css::uno::RuntimeException); 150*b1cdbd2cSJim Jagielski 151*b1cdbd2cSJim Jagielski // Set to true if a PlatformException or a DependencyException were handled. 152*b1cdbd2cSJim Jagielski css::uno::Any m_Exception; 153*b1cdbd2cSJim Jagielski // Set to true if an unknown exception was handled. 154*b1cdbd2cSJim Jagielski css::uno::Any m_UnknownException; 155*b1cdbd2cSJim Jagielski }; 156*b1cdbd2cSJim Jagielski 157*b1cdbd2cSJim Jagielski // class NoExceptionCommandEnv : public BaseCommandEnv 158*b1cdbd2cSJim Jagielski // { 159*b1cdbd2cSJim Jagielski // css::uno::Type m_type; 160*b1cdbd2cSJim Jagielski // public: 161*b1cdbd2cSJim Jagielski // NoExceptionCommandEnv::NoExceptionCommandEnv(){}; 162*b1cdbd2cSJim Jagielski // NoExceptionCommandEnv::NoExceptionCommandEnv( 163*b1cdbd2cSJim Jagielski // css::uno::Reference< css::task::XInteractionHandler> const & handler, 164*b1cdbd2cSJim Jagielski // css::uno::Type const & type); 165*b1cdbd2cSJim Jagielski 166*b1cdbd2cSJim Jagielski // // XInteractionHandler 167*b1cdbd2cSJim Jagielski // virtual void SAL_CALL handle( 168*b1cdbd2cSJim Jagielski // css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) 169*b1cdbd2cSJim Jagielski // throw (css::uno::RuntimeException); 170*b1cdbd2cSJim Jagielski 171*b1cdbd2cSJim Jagielski // }; 172*b1cdbd2cSJim Jagielski 173*b1cdbd2cSJim Jagielski } 174*b1cdbd2cSJim Jagielski 175*b1cdbd2cSJim Jagielski 176*b1cdbd2cSJim Jagielski 177*b1cdbd2cSJim Jagielski 178*b1cdbd2cSJim Jagielski #endif 179*b1cdbd2cSJim Jagielski 180