/src/libreoffice/svx/source/form/xfm_addcondition.cxx
Line | Count | Source |
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 <com/sun/star/beans/PropertyAttribute.hpp> |
24 | | #include <comphelper/processfactory.hxx> |
25 | | #include <vcl/svapp.hxx> |
26 | | #include <datanavi.hxx> |
27 | | #include <fmservs.hxx> |
28 | | |
29 | | namespace svxform |
30 | | { |
31 | | |
32 | 0 | #define PROPERTY_ID_BINDING 5724 |
33 | 0 | #define PROPERTY_ID_FORM_MODEL 5725 |
34 | 0 | #define PROPERTY_ID_FACET_NAME 5726 |
35 | 0 | #define PROPERTY_ID_CONDITION_VALUE 5727 |
36 | | |
37 | | using namespace ::com::sun::star::uno; |
38 | | using namespace ::com::sun::star::lang; |
39 | | using namespace ::com::sun::star::beans; |
40 | | using namespace ::com::sun::star::xforms; |
41 | | |
42 | | |
43 | | //= OAddConditionDialog |
44 | | |
45 | | |
46 | | Reference< XInterface > OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB ) |
47 | 0 | { |
48 | 0 | return OAddConditionDialog::Create( _rxORB ); |
49 | 0 | } |
50 | | |
51 | | |
52 | | Sequence< OUString > OAddConditionDialog_GetSupportedServiceNames() |
53 | 26 | { |
54 | 26 | return { u"com.sun.star.xforms.ui.dialogs.AddCondition"_ustr }; |
55 | 26 | } |
56 | | |
57 | | |
58 | | OUString OAddConditionDialog_GetImplementationName() |
59 | 26 | { |
60 | 26 | return u"org.openoffice.comp.svx.OAddConditionDialog"_ustr; |
61 | 26 | } |
62 | | |
63 | | OAddConditionDialog::OAddConditionDialog( const Reference< XComponentContext >& _rxORB ) |
64 | 0 | :OAddConditionDialogBase( _rxORB ) |
65 | 0 | { |
66 | 0 | registerProperty( |
67 | 0 | u"Binding"_ustr, |
68 | 0 | PROPERTY_ID_BINDING, |
69 | 0 | PropertyAttribute::TRANSIENT, |
70 | 0 | &m_xBinding, |
71 | 0 | cppu::UnoType<decltype(m_xBinding)>::get() |
72 | 0 | ); |
73 | |
|
74 | 0 | registerProperty( |
75 | 0 | u"FacetName"_ustr, |
76 | 0 | PROPERTY_ID_FACET_NAME, |
77 | 0 | PropertyAttribute::TRANSIENT, |
78 | 0 | &m_sFacetName, |
79 | 0 | cppu::UnoType<decltype(m_sFacetName)>::get() |
80 | 0 | ); |
81 | |
|
82 | 0 | registerProperty( |
83 | 0 | u"ConditionValue"_ustr, |
84 | 0 | PROPERTY_ID_CONDITION_VALUE, |
85 | 0 | PropertyAttribute::TRANSIENT, |
86 | 0 | &m_sConditionValue, |
87 | 0 | cppu::UnoType<decltype(m_sConditionValue)>::get() |
88 | 0 | ); |
89 | |
|
90 | 0 | registerProperty( |
91 | 0 | u"FormModel"_ustr, |
92 | 0 | PROPERTY_ID_FORM_MODEL, |
93 | 0 | PropertyAttribute::TRANSIENT, |
94 | 0 | &m_xWorkModel, |
95 | 0 | cppu::UnoType<decltype(m_xWorkModel)>::get() |
96 | 0 | ); |
97 | 0 | } |
98 | | |
99 | | |
100 | | Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( ) |
101 | 0 | { |
102 | 0 | return css::uno::Sequence<sal_Int8>(); |
103 | 0 | } |
104 | | |
105 | | |
106 | | Reference< XInterface > OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory ) |
107 | 0 | { |
108 | 0 | return *( new OAddConditionDialog( comphelper::getComponentContext(_rxFactory) ) ); |
109 | 0 | } |
110 | | |
111 | | |
112 | | OUString SAL_CALL OAddConditionDialog::getImplementationName() |
113 | 0 | { |
114 | 0 | return OAddConditionDialog_GetImplementationName(); |
115 | 0 | } |
116 | | |
117 | | |
118 | | Sequence< OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames() |
119 | 0 | { |
120 | 0 | return OAddConditionDialog_GetSupportedServiceNames(); |
121 | 0 | } |
122 | | |
123 | | |
124 | | Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo() |
125 | 0 | { |
126 | 0 | return createPropertySetInfo( getInfoHelper() ); |
127 | 0 | } |
128 | | |
129 | | ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper() |
130 | 0 | { |
131 | 0 | return *getArrayHelper(); |
132 | 0 | } |
133 | | |
134 | | ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const |
135 | 0 | { |
136 | 0 | Sequence< Property > aProperties; |
137 | 0 | describeProperties( aProperties ); |
138 | 0 | return new ::cppu::OPropertyArrayHelper( aProperties ); |
139 | 0 | } |
140 | | |
141 | | std::unique_ptr<weld::DialogController> OAddConditionDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) |
142 | 0 | { |
143 | 0 | if ( !m_xBinding.is() || m_sFacetName.isEmpty() ) |
144 | 0 | throw RuntimeException( OUString(), *this ); |
145 | | |
146 | 0 | return std::make_unique<AddConditionDialog>(Application::GetFrameWeld(rParent), m_sFacetName, m_xBinding); |
147 | 0 | } |
148 | | |
149 | | void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult ) |
150 | 0 | { |
151 | 0 | OAddConditionDialogBase::executedDialog( _nExecutionResult ); |
152 | 0 | if ( _nExecutionResult == RET_OK ) |
153 | 0 | m_sConditionValue = static_cast<AddConditionDialog*>(m_xDialog.get())->GetCondition(); |
154 | 0 | } |
155 | | } |
156 | | |
157 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |