Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "xfm_addcondition.hxx"
22 :
23 : #include <cppuhelper/typeprovider.hxx>
24 : #include "datanavi.hxx"
25 : #include <vcl/msgbox.hxx>
26 :
27 : //........................................................................
28 : namespace svxform
29 : {
30 : //........................................................................
31 :
32 : #define PROPERTY_ID_BINDING 5724
33 : #define PROPERTY_ID_FORM_MODEL 5725
34 : #define PROPERTY_ID_FACET_NAME 5726
35 : #define PROPERTY_ID_CONDITION_VALUE 5727
36 :
37 : using namespace ::com::sun::star::uno;
38 : using namespace ::com::sun::star::lang;
39 : using namespace ::com::sun::star::beans;
40 : using namespace ::com::sun::star::xforms;
41 :
42 : //====================================================================
43 : //= OAddConditionDialog
44 : //====================================================================
45 : //--------------------------------------------------------------------
46 0 : Reference< XInterface > SAL_CALL OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB )
47 : {
48 0 : return OAddConditionDialog::Create( _rxORB );
49 : }
50 :
51 : //--------------------------------------------------------------------
52 18 : Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog_GetSupportedServiceNames()
53 : {
54 18 : ::comphelper::StringSequence aSupported( 1 );
55 18 : aSupported.getArray()[0] = ::rtl::OUString( "com.sun.star.xforms.ui.dialogs.AddCondition" );
56 18 : return aSupported;
57 : }
58 :
59 : //--------------------------------------------------------------------
60 18 : ::rtl::OUString SAL_CALL OAddConditionDialog_GetImplementationName()
61 : {
62 18 : return ::rtl::OUString("org.openoffice.comp.svx.OAddConditionDialog");
63 : }
64 :
65 : //====================================================================
66 : //= OAddConditionDialog
67 : //====================================================================
68 : //--------------------------------------------------------------------
69 0 : OAddConditionDialog::OAddConditionDialog( const Reference< XMultiServiceFactory >& _rxORB )
70 0 : :OAddConditionDialogBase( _rxORB )
71 : {
72 : registerProperty(
73 : ::rtl::OUString( "Binding" ),
74 : PROPERTY_ID_BINDING,
75 : PropertyAttribute::TRANSIENT,
76 : &m_xBinding,
77 0 : ::getCppuType( &m_xBinding )
78 0 : );
79 :
80 : registerProperty(
81 : ::rtl::OUString( "FacetName" ),
82 : PROPERTY_ID_FACET_NAME,
83 : PropertyAttribute::TRANSIENT,
84 : &m_sFacetName,
85 0 : ::getCppuType( &m_sFacetName )
86 0 : );
87 :
88 : registerProperty(
89 : ::rtl::OUString( "ConditionValue" ),
90 : PROPERTY_ID_CONDITION_VALUE,
91 : PropertyAttribute::TRANSIENT,
92 : &m_sConditionValue,
93 0 : ::getCppuType( &m_sConditionValue )
94 0 : );
95 :
96 : registerProperty(
97 : ::rtl::OUString( "FormModel" ),
98 : PROPERTY_ID_FORM_MODEL,
99 : PropertyAttribute::TRANSIENT,
100 : &m_xWorkModel,
101 0 : ::getCppuType( &m_xWorkModel )
102 0 : );
103 0 : }
104 :
105 : //-------------------------------------------------------------------------
106 0 : Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( ) throw(RuntimeException)
107 : {
108 : static ::cppu::OImplementationId * pId = 0;
109 0 : if (! pId)
110 : {
111 0 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
112 0 : if (! pId)
113 : {
114 0 : static ::cppu::OImplementationId aId;
115 0 : pId = &aId;
116 0 : }
117 : }
118 0 : return pId->getImplementationId();
119 : }
120 :
121 : //-------------------------------------------------------------------------
122 0 : Reference< XInterface > SAL_CALL OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
123 : {
124 0 : return *( new OAddConditionDialog( _rxFactory ) );
125 : }
126 :
127 : //-------------------------------------------------------------------------
128 0 : ::rtl::OUString SAL_CALL OAddConditionDialog::getImplementationName() throw(RuntimeException)
129 : {
130 0 : return OAddConditionDialog_GetImplementationName();
131 : }
132 :
133 : //-------------------------------------------------------------------------
134 0 : Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException)
135 : {
136 0 : return OAddConditionDialog_GetSupportedServiceNames();
137 : }
138 :
139 : //-------------------------------------------------------------------------
140 0 : Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo() throw(RuntimeException)
141 : {
142 0 : return createPropertySetInfo( getInfoHelper() );
143 : }
144 :
145 : //-------------------------------------------------------------------------
146 0 : ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
147 : {
148 0 : return *const_cast< OAddConditionDialog* >( this )->getArrayHelper();
149 : }
150 :
151 : //------------------------------------------------------------------------------
152 0 : ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
153 : {
154 0 : Sequence< Property > aProperties;
155 0 : describeProperties( aProperties );
156 0 : return new ::cppu::OPropertyArrayHelper( aProperties );
157 : }
158 :
159 : //------------------------------------------------------------------------------
160 0 : Dialog* OAddConditionDialog::createDialog(Window* _pParent)
161 : {
162 0 : if ( !m_xBinding.is() || m_sFacetName.isEmpty() )
163 0 : throw RuntimeException( ::rtl::OUString(), *this );
164 :
165 0 : return new AddConditionDialog( _pParent, m_sFacetName, m_xBinding );
166 : }
167 :
168 : //------------------------------------------------------------------------------
169 0 : void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
170 : {
171 0 : OAddConditionDialogBase::executedDialog( _nExecutionResult );
172 0 : if ( _nExecutionResult == RET_OK )
173 0 : m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog )->GetCondition();
174 0 : }
175 :
176 : //........................................................................
177 : } // namespace svxformv
178 : //........................................................................
179 :
180 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|