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");
67 OAddConditionDialog::OAddConditionDialog( const Reference
< XComponentContext
>& _rxORB
)
68 :OAddConditionDialogBase( _rxORB
)
71 OUString( "Binding" ),
73 PropertyAttribute::TRANSIENT
,
75 cppu::UnoType
<decltype(m_xBinding
)>::get()
79 OUString( "FacetName" ),
80 PROPERTY_ID_FACET_NAME
,
81 PropertyAttribute::TRANSIENT
,
83 cppu::UnoType
<decltype(m_sFacetName
)>::get()
87 OUString( "ConditionValue" ),
88 PROPERTY_ID_CONDITION_VALUE
,
89 PropertyAttribute::TRANSIENT
,
91 cppu::UnoType
<decltype(m_sConditionValue
)>::get()
95 OUString( "FormModel" ),
96 PROPERTY_ID_FORM_MODEL
,
97 PropertyAttribute::TRANSIENT
,
99 cppu::UnoType
<decltype(m_xWorkModel
)>::get()
104 Sequence
<sal_Int8
> SAL_CALL
OAddConditionDialog::getImplementationId( ) throw(RuntimeException
, std::exception
)
106 return css::uno::Sequence
<sal_Int8
>();
110 Reference
< XInterface
> SAL_CALL
OAddConditionDialog::Create( const Reference
< XMultiServiceFactory
>& _rxFactory
)
112 return *( new OAddConditionDialog( comphelper::getComponentContext(_rxFactory
) ) );
116 OUString SAL_CALL
OAddConditionDialog::getImplementationName() throw(RuntimeException
, std::exception
)
118 return OAddConditionDialog_GetImplementationName();
122 Sequence
< OUString
> SAL_CALL
OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException
, std::exception
)
124 return OAddConditionDialog_GetSupportedServiceNames();
128 Reference
<XPropertySetInfo
> SAL_CALL
OAddConditionDialog::getPropertySetInfo() throw(RuntimeException
, std::exception
)
130 return createPropertySetInfo( getInfoHelper() );
134 ::cppu::IPropertyArrayHelper
& OAddConditionDialog::getInfoHelper()
136 return *getArrayHelper();
140 ::cppu::IPropertyArrayHelper
* OAddConditionDialog::createArrayHelper( ) const
142 Sequence
< Property
> aProperties
;
143 describeProperties( aProperties
);
144 return new ::cppu::OPropertyArrayHelper( aProperties
);
148 VclPtr
<Dialog
> OAddConditionDialog::createDialog(vcl::Window
* _pParent
)
150 if ( !m_xBinding
.is() || m_sFacetName
.isEmpty() )
151 throw RuntimeException( OUString(), *this );
153 return VclPtr
<AddConditionDialog
>::Create( _pParent
, m_sFacetName
, m_xBinding
);
157 void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult
)
159 OAddConditionDialogBase::executedDialog( _nExecutionResult
);
160 if ( _nExecutionResult
== RET_OK
)
161 m_sConditionValue
= static_cast< AddConditionDialog
* >( m_pDialog
.get() )->GetCondition();
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */