merge the formfield patch from ooo-build
[ooovba.git] / fpicker / source / win32 / filepicker / controlcommand.hxx
bloba280c61cc90089dd39dde1b12c12e3a6d152bd24
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: controlcommand.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CONTROLCOMMAND_HXX_
32 #define _CONTROLCOMMAND_HXX_
34 //------------------------------------------------------------------------
35 // includes
36 //------------------------------------------------------------------------
38 #include <sal/types.h>
39 #include <com/sun/star/uno/Any.hxx>
40 #include <rtl/ustring.hxx>
42 //---------------------------------------------
44 //---------------------------------------------
46 class CFilePickerState;
47 class CControlCommandRequest;
48 class CControlCommandResult;
50 //---------------------------------------------
52 //---------------------------------------------
54 class CControlCommand
56 public:
57 CControlCommand( sal_Int16 aControlId );
58 virtual ~CControlCommand( );
60 virtual void SAL_CALL exec( CFilePickerState* aFilePickerState ) = 0;
62 // the client inherits the ownership of the returned
63 // CControlCommandResult and has to delete it or he may
64 // use the auto_ptr template for automatic deletion
65 virtual CControlCommandResult* SAL_CALL handleRequest( CControlCommandRequest* aRequest );
67 // clients of this method should use the returned
68 // pointer only temporary because it's not ref-counted
69 // and the ownerhsip belongs to this instance
70 CControlCommand* SAL_CALL getNextCommand( ) const;
72 // transfers the ownership to this class
73 void SAL_CALL setNextCommand( CControlCommand* nextCommand );
75 protected:
76 sal_Int16 SAL_CALL getControlId( ) const;
78 private:
79 CControlCommand* m_NextCommand;
80 sal_Int16 m_aControlId;
83 //---------------------------------------------
85 //---------------------------------------------
87 class CValueControlCommand : public CControlCommand
89 public:
90 CValueControlCommand(
91 sal_Int16 aControlId,
92 sal_Int16 aControlAction,
93 const ::com::sun::star::uno::Any& aValue );
95 virtual void SAL_CALL exec( CFilePickerState* aFilePickerState );
97 virtual CControlCommandResult* SAL_CALL handleRequest( CControlCommandRequest* aRequest );
99 sal_Int16 SAL_CALL getControlAction( ) const;
101 ::com::sun::star::uno::Any SAL_CALL getValue( ) const;
103 private:
104 sal_Int16 m_aControlAction;
105 ::com::sun::star::uno::Any m_aValue;
108 //---------------------------------------------
110 //---------------------------------------------
112 class CLabelControlCommand : public CControlCommand
114 public:
115 CLabelControlCommand(
116 sal_Int16 aControlId,
117 const rtl::OUString& aLabel );
119 virtual void SAL_CALL exec( CFilePickerState* aFilePickerState );
121 virtual CControlCommandResult* SAL_CALL handleRequest( CControlCommandRequest* aRequest );
123 rtl::OUString SAL_CALL getLabel( ) const;
125 private:
126 rtl::OUString m_aLabel;
129 //---------------------------------------------
131 //---------------------------------------------
133 class CEnableControlCommand : public CControlCommand
135 public:
136 CEnableControlCommand(
137 sal_Int16 controlId,
138 sal_Bool bEnable );
140 virtual void SAL_CALL exec( CFilePickerState* aFilePickerState );
142 private:
143 sal_Bool m_bEnable;
146 #endif