LibreOffice Module svx (master)  1
xfm_addcondition.cxx
Go to the documentation of this file.
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>
25 #include <vcl/svapp.hxx>
26 #include <datanavi.hxx>
27 #include <fmservs.hxx>
28 
29 namespace svxform
30 {
31 
32 #define PROPERTY_ID_BINDING 5724
33 #define PROPERTY_ID_FORM_MODEL 5725
34 #define PROPERTY_ID_FACET_NAME 5726
35 #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  {
48  return OAddConditionDialog::Create( _rxORB );
49  }
50 
51 
53  {
54  return { "com.sun.star.xforms.ui.dialogs.AddCondition" };
55  }
56 
57 
59  {
60  return "org.openoffice.comp.svx.OAddConditionDialog";
61  }
62 
64  :OAddConditionDialogBase( _rxORB )
65  {
66  registerProperty(
67  "Binding",
69  PropertyAttribute::TRANSIENT,
70  &m_xBinding,
71  cppu::UnoType<decltype(m_xBinding)>::get()
72  );
73 
74  registerProperty(
75  "FacetName",
77  PropertyAttribute::TRANSIENT,
78  &m_sFacetName,
79  cppu::UnoType<decltype(m_sFacetName)>::get()
80  );
81 
82  registerProperty(
83  "ConditionValue",
85  PropertyAttribute::TRANSIENT,
87  cppu::UnoType<decltype(m_sConditionValue)>::get()
88  );
89 
90  registerProperty(
91  "FormModel",
93  PropertyAttribute::TRANSIENT,
94  &m_xWorkModel,
95  cppu::UnoType<decltype(m_xWorkModel)>::get()
96  );
97  }
98 
99 
100  Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( )
101  {
102  return css::uno::Sequence<sal_Int8>();
103  }
104 
105 
106  Reference< XInterface > OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
107  {
108  return *( new OAddConditionDialog( comphelper::getComponentContext(_rxFactory) ) );
109  }
110 
111 
113  {
115  }
116 
117 
119  {
121  }
122 
123 
124  Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo()
125  {
126  return createPropertySetInfo( getInfoHelper() );
127  }
128 
130  {
131  return *getArrayHelper();
132  }
133 
135  {
136  Sequence< Property > aProperties;
137  describeProperties( aProperties );
138  return new ::cppu::OPropertyArrayHelper( aProperties );
139  }
140 
141  std::unique_ptr<weld::DialogController> OAddConditionDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
142  {
143  if ( !m_xBinding.is() || m_sFacetName.isEmpty() )
144  throw RuntimeException( OUString(), *this );
145 
146  return std::make_unique<AddConditionDialog>(Application::GetFrameWeld(rParent), m_sFacetName, m_xBinding);
147  }
148 
149  void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
150  {
151  OAddConditionDialogBase::executedDialog( _nExecutionResult );
152  if ( _nExecutionResult == RET_OK )
153  m_sConditionValue = static_cast<AddConditionDialog*>(m_xDialog.get())->GetCondition();
154  }
155 }
156 
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
#define PROPERTY_ID_BINDING
virtual void executedDialog(sal_Int16)
#define PROPERTY_ID_CONDITION_VALUE
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual OUString SAL_CALL getImplementationName() override
OAddConditionDialog(const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
std::unique_ptr< weld::DialogController > m_xDialog
PropertiesInfo aProperties
virtual std::unique_ptr< weld::DialogController > createDialog(const css::uno::Reference< css::awt::XWindow > &rParent) override
#define PROPERTY_ID_FORM_MODEL
Sequence< OUString > OAddConditionDialog_GetSupportedServiceNames()
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
css::uno::Reference< css::beans::XPropertySet > m_xBinding
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void executedDialog(sal_Int16 _nExecutionResult) override
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
#define PROPERTY_ID_FACET_NAME
OUString OAddConditionDialog_GetImplementationName()
RET_OK
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
class FmSearchEngine - Impl class for FmSearchDialog
css::uno::Reference< css::xforms::XModel > m_xWorkModel
static css::uno::Reference< css::uno::XInterface > Create(const css::uno::Reference< css::lang::XMultiServiceFactory > &)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Reference< XInterface > OAddConditionDialog_Create(const Reference< XMultiServiceFactory > &_rxORB)