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