1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "xfm_addcondition.hxx"
23 #include <comphelper/processfactory.hxx>
24 #include <cppuhelper/typeprovider.hxx>
25 #include "datanavi.hxx"
26 #include "fmservs.hxx"
27 #include <vcl/msgbox.hxx>
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
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
;
45 //= OAddConditionDialog
48 Reference
< XInterface
> SAL_CALL
OAddConditionDialog_Create( const Reference
< XMultiServiceFactory
> & _rxORB
)
50 return OAddConditionDialog::Create( _rxORB
);
54 Sequence
< OUString
> SAL_CALL
OAddConditionDialog_GetSupportedServiceNames()
56 ::comphelper::StringSequence
aSupported( 1 );
57 aSupported
.getArray()[0] = "com.sun.star.xforms.ui.dialogs.AddCondition";
62 OUString SAL_CALL
OAddConditionDialog_GetImplementationName()
64 return OUString("org.openoffice.comp.svx.OAddConditionDialog");
68 //= OAddConditionDialog
71 OAddConditionDialog::OAddConditionDialog( const Reference
< XComponentContext
>& _rxORB
)
72 :OAddConditionDialogBase( _rxORB
)
75 OUString( "Binding" ),
77 PropertyAttribute::TRANSIENT
,
79 ::getCppuType( &m_xBinding
)
83 OUString( "FacetName" ),
84 PROPERTY_ID_FACET_NAME
,
85 PropertyAttribute::TRANSIENT
,
87 ::getCppuType( &m_sFacetName
)
91 OUString( "ConditionValue" ),
92 PROPERTY_ID_CONDITION_VALUE
,
93 PropertyAttribute::TRANSIENT
,
95 ::getCppuType( &m_sConditionValue
)
99 OUString( "FormModel" ),
100 PROPERTY_ID_FORM_MODEL
,
101 PropertyAttribute::TRANSIENT
,
103 ::getCppuType( &m_xWorkModel
)
108 Sequence
<sal_Int8
> SAL_CALL
OAddConditionDialog::getImplementationId( ) throw(RuntimeException
, std::exception
)
110 return css::uno::Sequence
<sal_Int8
>();
114 Reference
< XInterface
> SAL_CALL
OAddConditionDialog::Create( const Reference
< XMultiServiceFactory
>& _rxFactory
)
116 return *( new OAddConditionDialog( comphelper::getComponentContext(_rxFactory
) ) );
120 OUString SAL_CALL
OAddConditionDialog::getImplementationName() throw(RuntimeException
, std::exception
)
122 return OAddConditionDialog_GetImplementationName();
126 Sequence
< OUString
> SAL_CALL
OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException
, std::exception
)
128 return OAddConditionDialog_GetSupportedServiceNames();
132 Reference
<XPropertySetInfo
> SAL_CALL
OAddConditionDialog::getPropertySetInfo() throw(RuntimeException
, std::exception
)
134 return createPropertySetInfo( getInfoHelper() );
138 ::cppu::IPropertyArrayHelper
& OAddConditionDialog::getInfoHelper()
140 return *const_cast< OAddConditionDialog
* >( this )->getArrayHelper();
144 ::cppu::IPropertyArrayHelper
* OAddConditionDialog::createArrayHelper( ) const
146 Sequence
< Property
> aProperties
;
147 describeProperties( aProperties
);
148 return new ::cppu::OPropertyArrayHelper( aProperties
);
152 Dialog
* OAddConditionDialog::createDialog(Window
* _pParent
)
154 if ( !m_xBinding
.is() || m_sFacetName
.isEmpty() )
155 throw RuntimeException( OUString(), *this );
157 return new AddConditionDialog( _pParent
, m_sFacetName
, m_xBinding
);
161 void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult
)
163 OAddConditionDialogBase::executedDialog( _nExecutionResult
);
164 if ( _nExecutionResult
== RET_OK
)
165 m_sConditionValue
= static_cast< AddConditionDialog
* >( m_pDialog
)->GetCondition();
169 } // namespace svxformv
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */