1*d1766043SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d1766043SAndrew Rist * distributed with this work for additional information 6*d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9*d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10*d1766043SAndrew Rist * 11*d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d1766043SAndrew Rist * 13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d1766043SAndrew Rist * software distributed under the License is distributed on an 15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17*d1766043SAndrew Rist * specific language governing permissions and limitations 18*d1766043SAndrew Rist * under the License. 19*d1766043SAndrew Rist * 20*d1766043SAndrew Rist *************************************************************/ 21*d1766043SAndrew Rist 22*d1766043SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_embed_InstanceLocker_idl__ 25cdf0e10cSrcweir#define __com_sun_star_embed_InstanceLocker_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#ifndef __com_sun_star_lang_XComponent_idl__ 28cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl> 29cdf0e10cSrcweir#endif 30cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__ 31cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl> 32cdf0e10cSrcweir#endif 33cdf0e10cSrcweir#ifndef __com_sun_star_embed_XActionsApproval_idl__ 34cdf0e10cSrcweir#include <com/sun/star/embed/XActionsApproval.idl> 35cdf0e10cSrcweir#endif 36cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ 37cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl> 38cdf0e10cSrcweir#endif 39cdf0e10cSrcweir#ifndef __com_sun_star_frame_DoubleInitializationException_idl__ 40cdf0e10cSrcweir#include <com/sun/star/frame/DoubleInitializationException.idl> 41cdf0e10cSrcweir#endif 42cdf0e10cSrcweir 43cdf0e10cSrcweir//============================================================================= 44cdf0e10cSrcweirmodule com { module sun { module star { module embed { 45cdf0e10cSrcweir 46cdf0e10cSrcweir//----------------------------------------------------------------------------- 47cdf0e10cSrcweir/** The main task of this service is to prevent closing, terminating and/or 48cdf0e10cSrcweir etc. of controlled object. 49cdf0e10cSrcweir 50cdf0e10cSrcweir <p> 51cdf0e10cSrcweir After creation the service adds a listener of requested type 52cdf0e10cSrcweir ( close, terminate and/or etc. ) to the controlled object and let 53cdf0e10cSrcweir the listener throw related veto exception until the service is disposed. 54cdf0e10cSrcweir </p> 55cdf0e10cSrcweir*/ 56cdf0e10cSrcweirpublished service InstanceLocker : com::sun::star::lang::XComponent 57cdf0e10cSrcweir{ 58cdf0e10cSrcweir /** is used to initialize the object on it's creation. 59cdf0e10cSrcweir 60cdf0e10cSrcweir @param xInstance 61cdf0e10cSrcweir the controlled object. Must implement the related to the 62cdf0e10cSrcweir requested actions broadcaster interface. 63cdf0e10cSrcweir 64cdf0e10cSrcweir @param nActions 65cdf0e10cSrcweir specifies the actions that should be done ( prevent closing, 66cdf0e10cSrcweir prevent termination and/or etc. ). It must not be empty and can 67cdf0e10cSrcweir currently contain following values or their combination: 68cdf0e10cSrcweir <type>Actions</type>::PREVENT_CLOSE and 69cdf0e10cSrcweir <type>Actions</type>::PREVENT_TERMINATION. 70cdf0e10cSrcweir */ 71cdf0e10cSrcweir InstanceLockerCtor1( [in] com::sun::star::uno::XInterface xInstance, 72cdf0e10cSrcweir [in] long nActions ) 73cdf0e10cSrcweir raises( ::com::sun::star::lang::IllegalArgumentException, 74cdf0e10cSrcweir ::com::sun::star::frame::DoubleInitializationException, 75cdf0e10cSrcweir ::com::sun::star::uno::Exception ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir /** is used to initialize the object on it's creation. 78cdf0e10cSrcweir 79cdf0e10cSrcweir @param xInstance 80cdf0e10cSrcweir the controlled object. Must implement the related to the 81cdf0e10cSrcweir requested actions broadcaster interface. 82cdf0e10cSrcweir 83cdf0e10cSrcweir @param nActions 84cdf0e10cSrcweir specifies the actions that should be done ( prevent closing, 85cdf0e10cSrcweir prevent termination and/or etc. ). It must not be empty and can 86cdf0e10cSrcweir currently contain following values or their combination: 87cdf0e10cSrcweir <type>Actions</type>::PREVENT_CLOSE and 88cdf0e10cSrcweir <type>Actions</type>::PREVENT_TERMINATION. 89cdf0e10cSrcweir 90cdf0e10cSrcweir @param xApprove 91cdf0e10cSrcweir The object implementing <type>XActionsApproval</type> interface. 92cdf0e10cSrcweir If this parameter is an empty reference the object will proceed 93cdf0e10cSrcweir with the specified in the first parameter action until it is 94cdf0e10cSrcweir disposed ( just like in the case of the first constructor ). 95cdf0e10cSrcweir If the instance is provided, it will be asked for approval each 96cdf0e10cSrcweir time before proceeding with the action ( the action is 97cdf0e10cSrcweir specified using <type>string</type> and can take following 98cdf0e10cSrcweir values in this case: "PreventClose", "PreventTermination" ). 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir InstanceLockerCtor2( [in] com::sun::star::uno::XInterface xInstance, 101cdf0e10cSrcweir [in] long aActions, 102cdf0e10cSrcweir [in] XActionsApproval xApprove ) 103cdf0e10cSrcweir raises( ::com::sun::star::lang::IllegalArgumentException, 104cdf0e10cSrcweir ::com::sun::star::frame::DoubleInitializationException, 105cdf0e10cSrcweir ::com::sun::star::uno::Exception ); 106cdf0e10cSrcweir}; 107cdf0e10cSrcweir 108cdf0e10cSrcweir//============================================================================= 109cdf0e10cSrcweir 110cdf0e10cSrcweir}; }; }; }; 111cdf0e10cSrcweir 112cdf0e10cSrcweir#endif 113cdf0e10cSrcweir 114