1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f6e50924SAndrew Rist  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19*f6e50924SAndrew Rist  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef SVX_SOURCE_FORM_XFM_ADDCONDITION_HXX
28cdf0e10cSrcweir #include "xfm_addcondition.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /** === begin UNO includes === **/
32cdf0e10cSrcweir /** === end UNO includes === **/
33cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
34cdf0e10cSrcweir #include "datanavi.hxx"
35cdf0e10cSrcweir #include <vcl/msgbox.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //........................................................................
38cdf0e10cSrcweir namespace svxform
39cdf0e10cSrcweir {
40cdf0e10cSrcweir //........................................................................
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #define PROPERTY_ID_BINDING             5724
43cdf0e10cSrcweir #define PROPERTY_ID_FORM_MODEL          5725
44cdf0e10cSrcweir #define PROPERTY_ID_FACET_NAME          5726
45cdf0e10cSrcweir #define PROPERTY_ID_CONDITION_VALUE     5727
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
48cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
49cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
50cdf0e10cSrcweir 	using namespace ::com::sun::star::xforms;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     //====================================================================
53cdf0e10cSrcweir 	//= OAddConditionDialog
54cdf0e10cSrcweir 	//====================================================================
55cdf0e10cSrcweir 	//--------------------------------------------------------------------
OAddConditionDialog_Create(const Reference<XMultiServiceFactory> & _rxORB)56cdf0e10cSrcweir     Reference< XInterface > SAL_CALL OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB )
57cdf0e10cSrcweir     {
58cdf0e10cSrcweir         return OAddConditionDialog::Create( _rxORB );
59cdf0e10cSrcweir     }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	//--------------------------------------------------------------------
OAddConditionDialog_GetSupportedServiceNames()62cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog_GetSupportedServiceNames()
63cdf0e10cSrcweir     {
64cdf0e10cSrcweir 	    ::comphelper::StringSequence aSupported( 1 );
65cdf0e10cSrcweir 	    aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xforms.ui.dialogs.AddCondition" ) );
66cdf0e10cSrcweir 	    return aSupported;
67cdf0e10cSrcweir     }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	//--------------------------------------------------------------------
OAddConditionDialog_GetImplementationName()70cdf0e10cSrcweir     ::rtl::OUString SAL_CALL OAddConditionDialog_GetImplementationName()
71cdf0e10cSrcweir     {
72cdf0e10cSrcweir 	    return ::rtl::OUString::createFromAscii( "org.openoffice.comp.svx.OAddConditionDialog" );
73cdf0e10cSrcweir     }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     //====================================================================
76cdf0e10cSrcweir 	//= OAddConditionDialog
77cdf0e10cSrcweir 	//====================================================================
78cdf0e10cSrcweir 	//--------------------------------------------------------------------
OAddConditionDialog(const Reference<XMultiServiceFactory> & _rxORB)79cdf0e10cSrcweir     OAddConditionDialog::OAddConditionDialog( const Reference< XMultiServiceFactory >& _rxORB )
80cdf0e10cSrcweir 	    :OAddConditionDialogBase( _rxORB )
81cdf0e10cSrcweir     {
82cdf0e10cSrcweir 	    registerProperty(
83cdf0e10cSrcweir             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Binding" ) ),
84cdf0e10cSrcweir             PROPERTY_ID_BINDING,
85cdf0e10cSrcweir             PropertyAttribute::TRANSIENT,
86cdf0e10cSrcweir 		    &m_xBinding,
87cdf0e10cSrcweir             ::getCppuType( &m_xBinding )
88cdf0e10cSrcweir         );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	    registerProperty(
91cdf0e10cSrcweir             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FacetName" ) ),
92cdf0e10cSrcweir             PROPERTY_ID_FACET_NAME,
93cdf0e10cSrcweir             PropertyAttribute::TRANSIENT,
94cdf0e10cSrcweir 		    &m_sFacetName,
95cdf0e10cSrcweir             ::getCppuType( &m_sFacetName )
96cdf0e10cSrcweir         );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	    registerProperty(
99cdf0e10cSrcweir             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConditionValue" ) ),
100cdf0e10cSrcweir             PROPERTY_ID_CONDITION_VALUE,
101cdf0e10cSrcweir             PropertyAttribute::TRANSIENT,
102cdf0e10cSrcweir 		    &m_sConditionValue,
103cdf0e10cSrcweir             ::getCppuType( &m_sConditionValue )
104cdf0e10cSrcweir         );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         registerProperty(
107cdf0e10cSrcweir             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormModel" ) ),
108cdf0e10cSrcweir             PROPERTY_ID_FORM_MODEL,
109cdf0e10cSrcweir             PropertyAttribute::TRANSIENT,
110cdf0e10cSrcweir 		    &m_xWorkModel,
111cdf0e10cSrcweir             ::getCppuType( &m_xWorkModel )
112cdf0e10cSrcweir         );
113cdf0e10cSrcweir     }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     //-------------------------------------------------------------------------
getImplementationId()116cdf0e10cSrcweir     Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId(  ) throw(RuntimeException)
117cdf0e10cSrcweir     {
118cdf0e10cSrcweir         static ::cppu::OImplementationId * pId = 0;
119cdf0e10cSrcweir 	    if (! pId)
120cdf0e10cSrcweir 	    {
121cdf0e10cSrcweir             ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
122cdf0e10cSrcweir 		    if (! pId)
123cdf0e10cSrcweir 		    {
124cdf0e10cSrcweir                 static ::cppu::OImplementationId aId;
125cdf0e10cSrcweir 			    pId = &aId;
126cdf0e10cSrcweir 		    }
127cdf0e10cSrcweir 	    }
128cdf0e10cSrcweir 	    return pId->getImplementationId();
129cdf0e10cSrcweir     }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     //-------------------------------------------------------------------------
Create(const Reference<XMultiServiceFactory> & _rxFactory)132cdf0e10cSrcweir     Reference< XInterface > SAL_CALL OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
133cdf0e10cSrcweir     {
134cdf0e10cSrcweir 	    return *( new OAddConditionDialog( _rxFactory ) );
135cdf0e10cSrcweir     }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     //-------------------------------------------------------------------------
getImplementationName()138cdf0e10cSrcweir     ::rtl::OUString SAL_CALL OAddConditionDialog::getImplementationName() throw(RuntimeException)
139cdf0e10cSrcweir     {
140cdf0e10cSrcweir 	    return OAddConditionDialog_GetImplementationName();
141cdf0e10cSrcweir     }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     //-------------------------------------------------------------------------
getSupportedServiceNames()144cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException)
145cdf0e10cSrcweir     {
146cdf0e10cSrcweir         return OAddConditionDialog_GetSupportedServiceNames();
147cdf0e10cSrcweir     }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     //-------------------------------------------------------------------------
getPropertySetInfo()150cdf0e10cSrcweir     Reference<XPropertySetInfo>  SAL_CALL OAddConditionDialog::getPropertySetInfo() throw(RuntimeException)
151cdf0e10cSrcweir     {
152cdf0e10cSrcweir 	    return createPropertySetInfo( getInfoHelper() );
153cdf0e10cSrcweir     }
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     //-------------------------------------------------------------------------
getInfoHelper()156cdf0e10cSrcweir     ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
157cdf0e10cSrcweir     {
158cdf0e10cSrcweir 	    return *const_cast< OAddConditionDialog* >( this )->getArrayHelper();
159cdf0e10cSrcweir     }
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     //------------------------------------------------------------------------------
createArrayHelper() const162cdf0e10cSrcweir     ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
163cdf0e10cSrcweir     {
164cdf0e10cSrcweir 	    Sequence< Property > aProperties;
165cdf0e10cSrcweir 	    describeProperties( aProperties );
166cdf0e10cSrcweir 	    return new ::cppu::OPropertyArrayHelper( aProperties );
167cdf0e10cSrcweir     }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     //------------------------------------------------------------------------------
createDialog(Window * _pParent)170cdf0e10cSrcweir     Dialog*	OAddConditionDialog::createDialog(Window* _pParent)
171cdf0e10cSrcweir     {
172cdf0e10cSrcweir         if ( !m_xBinding.is() || !m_sFacetName.getLength() )
173cdf0e10cSrcweir             throw RuntimeException( ::rtl::OUString(), *this );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 		return new AddConditionDialog( _pParent, m_sFacetName, m_xBinding );
176cdf0e10cSrcweir     }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     //------------------------------------------------------------------------------
executedDialog(sal_Int16 _nExecutionResult)179cdf0e10cSrcweir     void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
180cdf0e10cSrcweir     {
181cdf0e10cSrcweir         OAddConditionDialogBase::executedDialog( _nExecutionResult );
182cdf0e10cSrcweir         if ( _nExecutionResult == RET_OK )
183cdf0e10cSrcweir             m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog )->GetCondition();
184cdf0e10cSrcweir     }
185cdf0e10cSrcweir 
186cdf0e10cSrcweir //........................................................................
187cdf0e10cSrcweir } // namespace svxformv
188cdf0e10cSrcweir //........................................................................
189cdf0e10cSrcweir 
190