update dev300-m58
[ooovba.git] / svx / source / form / xfm_addcondition.cxx
blob003341454058e72e6c32dc0fd424ae617b3e4b57
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: xfm_addcondition.cxx,v $
10 * $Revision: 1.5 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifndef SVX_SOURCE_FORM_XFM_ADDCONDITION_HXX
35 #include "xfm_addcondition.hxx"
36 #endif
38 /** === begin UNO includes === **/
39 /** === end UNO includes === **/
40 #include <cppuhelper/typeprovider.hxx>
41 #include "datanavi.hxx"
42 #include <vcl/msgbox.hxx>
44 //........................................................................
45 namespace svxform
47 //........................................................................
49 #define PROPERTY_ID_BINDING 5724
50 #define PROPERTY_ID_FORM_MODEL 5725
51 #define PROPERTY_ID_FACET_NAME 5726
52 #define PROPERTY_ID_CONDITION_VALUE 5727
54 using namespace ::com::sun::star::uno;
55 using namespace ::com::sun::star::lang;
56 using namespace ::com::sun::star::beans;
57 using namespace ::com::sun::star::xforms;
59 //====================================================================
60 //= OAddConditionDialog
61 //====================================================================
62 //--------------------------------------------------------------------
63 Reference< XInterface > SAL_CALL OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB )
65 return OAddConditionDialog::Create( _rxORB );
68 //--------------------------------------------------------------------
69 Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog_GetSupportedServiceNames()
71 ::comphelper::StringSequence aSupported( 1 );
72 aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xforms.ui.dialogs.AddCondition" ) );
73 return aSupported;
76 //--------------------------------------------------------------------
77 ::rtl::OUString SAL_CALL OAddConditionDialog_GetImplementationName()
79 return ::rtl::OUString::createFromAscii( "org.openoffice.comp.svx.OAddConditionDialog" );
82 //====================================================================
83 //= OAddConditionDialog
84 //====================================================================
85 //--------------------------------------------------------------------
86 OAddConditionDialog::OAddConditionDialog( const Reference< XMultiServiceFactory >& _rxORB )
87 :OAddConditionDialogBase( _rxORB )
89 registerProperty(
90 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Binding" ) ),
91 PROPERTY_ID_BINDING,
92 PropertyAttribute::TRANSIENT,
93 &m_xBinding,
94 ::getCppuType( &m_xBinding )
97 registerProperty(
98 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FacetName" ) ),
99 PROPERTY_ID_FACET_NAME,
100 PropertyAttribute::TRANSIENT,
101 &m_sFacetName,
102 ::getCppuType( &m_sFacetName )
105 registerProperty(
106 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConditionValue" ) ),
107 PROPERTY_ID_CONDITION_VALUE,
108 PropertyAttribute::TRANSIENT,
109 &m_sConditionValue,
110 ::getCppuType( &m_sConditionValue )
113 registerProperty(
114 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormModel" ) ),
115 PROPERTY_ID_FORM_MODEL,
116 PropertyAttribute::TRANSIENT,
117 &m_xWorkModel,
118 ::getCppuType( &m_xWorkModel )
122 //-------------------------------------------------------------------------
123 Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( ) throw(RuntimeException)
125 static ::cppu::OImplementationId * pId = 0;
126 if (! pId)
128 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
129 if (! pId)
131 static ::cppu::OImplementationId aId;
132 pId = &aId;
135 return pId->getImplementationId();
138 //-------------------------------------------------------------------------
139 Reference< XInterface > SAL_CALL OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
141 return *( new OAddConditionDialog( _rxFactory ) );
144 //-------------------------------------------------------------------------
145 ::rtl::OUString SAL_CALL OAddConditionDialog::getImplementationName() throw(RuntimeException)
147 return OAddConditionDialog_GetImplementationName();
150 //-------------------------------------------------------------------------
151 Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException)
153 return OAddConditionDialog_GetSupportedServiceNames();
156 //-------------------------------------------------------------------------
157 Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo() throw(RuntimeException)
159 return createPropertySetInfo( getInfoHelper() );
162 //-------------------------------------------------------------------------
163 ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
165 return *const_cast< OAddConditionDialog* >( this )->getArrayHelper();
168 //------------------------------------------------------------------------------
169 ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
171 Sequence< Property > aProperties;
172 describeProperties( aProperties );
173 return new ::cppu::OPropertyArrayHelper( aProperties );
176 //------------------------------------------------------------------------------
177 Dialog* OAddConditionDialog::createDialog(Window* _pParent)
179 if ( !m_xBinding.is() || !m_sFacetName.getLength() )
180 throw RuntimeException( ::rtl::OUString(), *this );
182 return new AddConditionDialog( _pParent, m_sFacetName, m_xBinding );
185 //------------------------------------------------------------------------------
186 void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
188 OAddConditionDialogBase::executedDialog( _nExecutionResult );
189 if ( _nExecutionResult == RET_OK )
190 m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog )->GetCondition();
193 //........................................................................
194 } // namespace svxformv
195 //........................................................................