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 <comphelper/processfactory.hxx>
24 : #include <cppuhelper/typeprovider.hxx>
25 : #include "datanavi.hxx"
26 : #include "fmservs.hxx"
27 : #include <vcl/msgbox.hxx>
28 :
29 :
30 : namespace svxform
31 : {
32 :
33 :
34 : #define PROPERTY_ID_BINDING 5724
35 : #define PROPERTY_ID_FORM_MODEL 5725
36 : #define PROPERTY_ID_FACET_NAME 5726
37 : #define PROPERTY_ID_CONDITION_VALUE 5727
38 :
39 : using namespace ::com::sun::star::uno;
40 : using namespace ::com::sun::star::lang;
41 : using namespace ::com::sun::star::beans;
42 : using namespace ::com::sun::star::xforms;
43 :
44 :
45 : //= OAddConditionDialog
46 :
47 :
48 0 : Reference< XInterface > SAL_CALL OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB )
49 : {
50 0 : return OAddConditionDialog::Create( _rxORB );
51 : }
52 :
53 :
54 0 : Sequence< OUString > SAL_CALL OAddConditionDialog_GetSupportedServiceNames()
55 : {
56 0 : ::comphelper::StringSequence aSupported( 1 );
57 0 : aSupported.getArray()[0] = "com.sun.star.xforms.ui.dialogs.AddCondition";
58 0 : return aSupported;
59 : }
60 :
61 :
62 0 : OUString SAL_CALL OAddConditionDialog_GetImplementationName()
63 : {
64 0 : return OUString("org.openoffice.comp.svx.OAddConditionDialog");
65 : }
66 :
67 :
68 : //= OAddConditionDialog
69 :
70 :
71 0 : OAddConditionDialog::OAddConditionDialog( const Reference< XComponentContext >& _rxORB )
72 0 : :OAddConditionDialogBase( _rxORB )
73 : {
74 : registerProperty(
75 : OUString( "Binding" ),
76 : PROPERTY_ID_BINDING,
77 : PropertyAttribute::TRANSIENT,
78 : &m_xBinding,
79 0 : ::getCppuType( &m_xBinding )
80 0 : );
81 :
82 : registerProperty(
83 : OUString( "FacetName" ),
84 : PROPERTY_ID_FACET_NAME,
85 : PropertyAttribute::TRANSIENT,
86 : &m_sFacetName,
87 0 : ::getCppuType( &m_sFacetName )
88 0 : );
89 :
90 : registerProperty(
91 : OUString( "ConditionValue" ),
92 : PROPERTY_ID_CONDITION_VALUE,
93 : PropertyAttribute::TRANSIENT,
94 : &m_sConditionValue,
95 0 : ::getCppuType( &m_sConditionValue )
96 0 : );
97 :
98 : registerProperty(
99 : OUString( "FormModel" ),
100 : PROPERTY_ID_FORM_MODEL,
101 : PropertyAttribute::TRANSIENT,
102 : &m_xWorkModel,
103 0 : ::getCppuType( &m_xWorkModel )
104 0 : );
105 0 : }
106 :
107 :
108 0 : Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( ) throw(RuntimeException, std::exception)
109 : {
110 0 : return css::uno::Sequence<sal_Int8>();
111 : }
112 :
113 :
114 0 : Reference< XInterface > SAL_CALL OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
115 : {
116 0 : return *( new OAddConditionDialog( comphelper::getComponentContext(_rxFactory) ) );
117 : }
118 :
119 :
120 0 : OUString SAL_CALL OAddConditionDialog::getImplementationName() throw(RuntimeException, std::exception)
121 : {
122 0 : return OAddConditionDialog_GetImplementationName();
123 : }
124 :
125 :
126 0 : Sequence< OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException, std::exception)
127 : {
128 0 : return OAddConditionDialog_GetSupportedServiceNames();
129 : }
130 :
131 :
132 0 : Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo() throw(RuntimeException, std::exception)
133 : {
134 0 : return createPropertySetInfo( getInfoHelper() );
135 : }
136 :
137 :
138 0 : ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
139 : {
140 0 : return *const_cast< OAddConditionDialog* >( this )->getArrayHelper();
141 : }
142 :
143 :
144 0 : ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
145 : {
146 0 : Sequence< Property > aProperties;
147 0 : describeProperties( aProperties );
148 0 : return new ::cppu::OPropertyArrayHelper( aProperties );
149 : }
150 :
151 :
152 0 : Dialog* OAddConditionDialog::createDialog(Window* _pParent)
153 : {
154 0 : if ( !m_xBinding.is() || m_sFacetName.isEmpty() )
155 0 : throw RuntimeException( OUString(), *this );
156 :
157 0 : return new AddConditionDialog( _pParent, m_sFacetName, m_xBinding );
158 : }
159 :
160 :
161 0 : void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
162 : {
163 0 : OAddConditionDialogBase::executedDialog( _nExecutionResult );
164 0 : if ( _nExecutionResult == RET_OK )
165 0 : m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog )->GetCondition();
166 0 : }
167 :
168 :
169 0 : } // namespace svxformv
170 :
171 :
172 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|