1*10ce8018SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*10ce8018SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*10ce8018SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*10ce8018SAndrew Rist * distributed with this work for additional information 6*10ce8018SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*10ce8018SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*10ce8018SAndrew Rist * "License"); you may not use this file except in compliance 9*10ce8018SAndrew Rist * with the License. You may obtain a copy of the License at 10*10ce8018SAndrew Rist * 11*10ce8018SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*10ce8018SAndrew Rist * 13*10ce8018SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*10ce8018SAndrew Rist * software distributed under the License is distributed on an 15*10ce8018SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*10ce8018SAndrew Rist * KIND, either express or implied. See the License for the 17*10ce8018SAndrew Rist * specific language governing permissions and limitations 18*10ce8018SAndrew Rist * under the License. 19*10ce8018SAndrew Rist * 20*10ce8018SAndrew Rist *************************************************************/ 21*10ce8018SAndrew Rist 22*10ce8018SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _CONTROLCOMMAND_HXX_ 25cdf0e10cSrcweir #define _CONTROLCOMMAND_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //------------------------------------------------------------------------ 28cdf0e10cSrcweir // includes 29cdf0e10cSrcweir //------------------------------------------------------------------------ 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <sal/types.h> 32cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 33cdf0e10cSrcweir #include <rtl/ustring.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir //--------------------------------------------- 36cdf0e10cSrcweir // 37cdf0e10cSrcweir //--------------------------------------------- 38cdf0e10cSrcweir 39cdf0e10cSrcweir class CFilePickerState; 40cdf0e10cSrcweir class CControlCommandRequest; 41cdf0e10cSrcweir class CControlCommandResult; 42cdf0e10cSrcweir 43cdf0e10cSrcweir //--------------------------------------------- 44cdf0e10cSrcweir // 45cdf0e10cSrcweir //--------------------------------------------- 46cdf0e10cSrcweir 47cdf0e10cSrcweir class CControlCommand 48cdf0e10cSrcweir { 49cdf0e10cSrcweir public: 50cdf0e10cSrcweir CControlCommand( sal_Int16 aControlId ); 51cdf0e10cSrcweir virtual ~CControlCommand( ); 52cdf0e10cSrcweir 53cdf0e10cSrcweir virtual void SAL_CALL exec( CFilePickerState* aFilePickerState ) = 0; 54cdf0e10cSrcweir 55cdf0e10cSrcweir // the client inherits the ownership of the returned 56cdf0e10cSrcweir // CControlCommandResult and has to delete it or he may 57cdf0e10cSrcweir // use the auto_ptr template for automatic deletion 58cdf0e10cSrcweir virtual CControlCommandResult* SAL_CALL handleRequest( CControlCommandRequest* aRequest ); 59cdf0e10cSrcweir 60cdf0e10cSrcweir // clients of this method should use the returned 61cdf0e10cSrcweir // pointer only temporary because it's not ref-counted 62cdf0e10cSrcweir // and the ownerhsip belongs to this instance 63cdf0e10cSrcweir CControlCommand* SAL_CALL getNextCommand( ) const; 64cdf0e10cSrcweir 65cdf0e10cSrcweir // transfers the ownership to this class 66cdf0e10cSrcweir void SAL_CALL setNextCommand( CControlCommand* nextCommand ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir protected: 69cdf0e10cSrcweir sal_Int16 SAL_CALL getControlId( ) const; 70cdf0e10cSrcweir 71cdf0e10cSrcweir private: 72cdf0e10cSrcweir CControlCommand* m_NextCommand; 73cdf0e10cSrcweir sal_Int16 m_aControlId; 74cdf0e10cSrcweir }; 75cdf0e10cSrcweir 76cdf0e10cSrcweir //--------------------------------------------- 77cdf0e10cSrcweir // 78cdf0e10cSrcweir //--------------------------------------------- 79cdf0e10cSrcweir 80cdf0e10cSrcweir class CValueControlCommand : public CControlCommand 81cdf0e10cSrcweir { 82cdf0e10cSrcweir public: 83cdf0e10cSrcweir CValueControlCommand( 84cdf0e10cSrcweir sal_Int16 aControlId, 85cdf0e10cSrcweir sal_Int16 aControlAction, 86cdf0e10cSrcweir const ::com::sun::star::uno::Any& aValue ); 87cdf0e10cSrcweir 88cdf0e10cSrcweir virtual void SAL_CALL exec( CFilePickerState* aFilePickerState ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir virtual CControlCommandResult* SAL_CALL handleRequest( CControlCommandRequest* aRequest ); 91cdf0e10cSrcweir 92cdf0e10cSrcweir sal_Int16 SAL_CALL getControlAction( ) const; 93cdf0e10cSrcweir 94cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL getValue( ) const; 95cdf0e10cSrcweir 96cdf0e10cSrcweir private: 97cdf0e10cSrcweir sal_Int16 m_aControlAction; 98cdf0e10cSrcweir ::com::sun::star::uno::Any m_aValue; 99cdf0e10cSrcweir }; 100cdf0e10cSrcweir 101cdf0e10cSrcweir //--------------------------------------------- 102cdf0e10cSrcweir // 103cdf0e10cSrcweir //--------------------------------------------- 104cdf0e10cSrcweir 105cdf0e10cSrcweir class CLabelControlCommand : public CControlCommand 106cdf0e10cSrcweir { 107cdf0e10cSrcweir public: 108cdf0e10cSrcweir CLabelControlCommand( 109cdf0e10cSrcweir sal_Int16 aControlId, 110cdf0e10cSrcweir const rtl::OUString& aLabel ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir virtual void SAL_CALL exec( CFilePickerState* aFilePickerState ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir virtual CControlCommandResult* SAL_CALL handleRequest( CControlCommandRequest* aRequest ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir rtl::OUString SAL_CALL getLabel( ) const; 117cdf0e10cSrcweir 118cdf0e10cSrcweir private: 119cdf0e10cSrcweir rtl::OUString m_aLabel; 120cdf0e10cSrcweir }; 121cdf0e10cSrcweir 122cdf0e10cSrcweir //--------------------------------------------- 123cdf0e10cSrcweir // 124cdf0e10cSrcweir //--------------------------------------------- 125cdf0e10cSrcweir 126cdf0e10cSrcweir class CEnableControlCommand : public CControlCommand 127cdf0e10cSrcweir { 128cdf0e10cSrcweir public: 129cdf0e10cSrcweir CEnableControlCommand( 130cdf0e10cSrcweir sal_Int16 controlId, 131cdf0e10cSrcweir sal_Bool bEnable ); 132cdf0e10cSrcweir 133cdf0e10cSrcweir virtual void SAL_CALL exec( CFilePickerState* aFilePickerState ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir private: 136cdf0e10cSrcweir sal_Bool m_bEnable; 137cdf0e10cSrcweir }; 138cdf0e10cSrcweir 139cdf0e10cSrcweir #endif 140