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