Bump version to 6.4-15
[LibreOffice.git] / svx / source / form / xfm_addcondition.cxx
blob398623cf94600e93aa47a5789b9ff9c5b4863c96
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <com/sun/star/beans/PropertyAttribute.hpp>
24 #include <comphelper/processfactory.hxx>
25 #include <cppuhelper/typeprovider.hxx>
26 #include <toolkit/helper/vclunohelper.hxx>
27 #include <datanavi.hxx>
28 #include <fmservs.hxx>
30 namespace svxform
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
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;
44 //= OAddConditionDialog
47 Reference< XInterface > OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB )
49 return OAddConditionDialog::Create( _rxORB );
53 Sequence< OUString > OAddConditionDialog_GetSupportedServiceNames()
55 return { "com.sun.star.xforms.ui.dialogs.AddCondition" };
59 OUString OAddConditionDialog_GetImplementationName()
61 return "org.openoffice.comp.svx.OAddConditionDialog";
64 OAddConditionDialog::OAddConditionDialog( const Reference< XComponentContext >& _rxORB )
65 :OAddConditionDialogBase( _rxORB )
67 registerProperty(
68 "Binding",
69 PROPERTY_ID_BINDING,
70 PropertyAttribute::TRANSIENT,
71 &m_xBinding,
72 cppu::UnoType<decltype(m_xBinding)>::get()
75 registerProperty(
76 "FacetName",
77 PROPERTY_ID_FACET_NAME,
78 PropertyAttribute::TRANSIENT,
79 &m_sFacetName,
80 cppu::UnoType<decltype(m_sFacetName)>::get()
83 registerProperty(
84 "ConditionValue",
85 PROPERTY_ID_CONDITION_VALUE,
86 PropertyAttribute::TRANSIENT,
87 &m_sConditionValue,
88 cppu::UnoType<decltype(m_sConditionValue)>::get()
91 registerProperty(
92 "FormModel",
93 PROPERTY_ID_FORM_MODEL,
94 PropertyAttribute::TRANSIENT,
95 &m_xWorkModel,
96 cppu::UnoType<decltype(m_xWorkModel)>::get()
101 Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( )
103 return css::uno::Sequence<sal_Int8>();
107 Reference< XInterface > OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
109 return *( new OAddConditionDialog( comphelper::getComponentContext(_rxFactory) ) );
113 OUString SAL_CALL OAddConditionDialog::getImplementationName()
115 return OAddConditionDialog_GetImplementationName();
119 Sequence< OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames()
121 return OAddConditionDialog_GetSupportedServiceNames();
125 Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo()
127 return createPropertySetInfo( getInfoHelper() );
130 ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
132 return *getArrayHelper();
135 ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
137 Sequence< Property > aProperties;
138 describeProperties( aProperties );
139 return new ::cppu::OPropertyArrayHelper( aProperties );
142 std::unique_ptr<weld::DialogController> OAddConditionDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
144 if ( !m_xBinding.is() || m_sFacetName.isEmpty() )
145 throw RuntimeException( OUString(), *this );
147 return std::make_unique<AddConditionDialog>(Application::GetFrameWeld(rParent), m_sFacetName, m_xBinding);
150 void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
152 OAddConditionDialogBase::executedDialog( _nExecutionResult );
153 if ( _nExecutionResult == RET_OK )
154 m_sConditionValue = static_cast<AddConditionDialog*>(m_xDialog.get())->GetCondition();
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */