bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / form / xfm_addcondition.cxx
blobc16e67ed5d14a15d24127bf711e05f7ff7e0907c
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 <comphelper/processfactory.hxx>
24 #include <cppuhelper/typeprovider.hxx>
25 #include "datanavi.hxx"
26 #include <vcl/msgbox.hxx>
28 //........................................................................
29 namespace svxform
31 //........................................................................
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;
43 //====================================================================
44 //= OAddConditionDialog
45 //====================================================================
46 //--------------------------------------------------------------------
47 Reference< XInterface > SAL_CALL OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB )
49 return OAddConditionDialog::Create( _rxORB );
52 //--------------------------------------------------------------------
53 Sequence< OUString > SAL_CALL OAddConditionDialog_GetSupportedServiceNames()
55 ::comphelper::StringSequence aSupported( 1 );
56 aSupported.getArray()[0] = OUString( "com.sun.star.xforms.ui.dialogs.AddCondition" );
57 return aSupported;
60 //--------------------------------------------------------------------
61 OUString SAL_CALL OAddConditionDialog_GetImplementationName()
63 return OUString("org.openoffice.comp.svx.OAddConditionDialog");
66 //====================================================================
67 //= OAddConditionDialog
68 //====================================================================
69 //--------------------------------------------------------------------
70 OAddConditionDialog::OAddConditionDialog( const Reference< XComponentContext >& _rxORB )
71 :OAddConditionDialogBase( _rxORB )
73 registerProperty(
74 OUString( "Binding" ),
75 PROPERTY_ID_BINDING,
76 PropertyAttribute::TRANSIENT,
77 &m_xBinding,
78 ::getCppuType( &m_xBinding )
81 registerProperty(
82 OUString( "FacetName" ),
83 PROPERTY_ID_FACET_NAME,
84 PropertyAttribute::TRANSIENT,
85 &m_sFacetName,
86 ::getCppuType( &m_sFacetName )
89 registerProperty(
90 OUString( "ConditionValue" ),
91 PROPERTY_ID_CONDITION_VALUE,
92 PropertyAttribute::TRANSIENT,
93 &m_sConditionValue,
94 ::getCppuType( &m_sConditionValue )
97 registerProperty(
98 OUString( "FormModel" ),
99 PROPERTY_ID_FORM_MODEL,
100 PropertyAttribute::TRANSIENT,
101 &m_xWorkModel,
102 ::getCppuType( &m_xWorkModel )
106 //-------------------------------------------------------------------------
107 Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( ) throw(RuntimeException)
109 static ::cppu::OImplementationId * pId = 0;
110 if (! pId)
112 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
113 if (! pId)
115 static ::cppu::OImplementationId aId;
116 pId = &aId;
119 return pId->getImplementationId();
122 //-------------------------------------------------------------------------
123 Reference< XInterface > SAL_CALL OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
125 return *( new OAddConditionDialog( comphelper::getComponentContext(_rxFactory) ) );
128 //-------------------------------------------------------------------------
129 OUString SAL_CALL OAddConditionDialog::getImplementationName() throw(RuntimeException)
131 return OAddConditionDialog_GetImplementationName();
134 //-------------------------------------------------------------------------
135 Sequence< OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException)
137 return OAddConditionDialog_GetSupportedServiceNames();
140 //-------------------------------------------------------------------------
141 Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo() throw(RuntimeException)
143 return createPropertySetInfo( getInfoHelper() );
146 //-------------------------------------------------------------------------
147 ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
149 return *const_cast< OAddConditionDialog* >( this )->getArrayHelper();
152 //------------------------------------------------------------------------------
153 ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
155 Sequence< Property > aProperties;
156 describeProperties( aProperties );
157 return new ::cppu::OPropertyArrayHelper( aProperties );
160 //------------------------------------------------------------------------------
161 Dialog* OAddConditionDialog::createDialog(Window* _pParent)
163 if ( !m_xBinding.is() || m_sFacetName.isEmpty() )
164 throw RuntimeException( OUString(), *this );
166 return new AddConditionDialog( _pParent, m_sFacetName, m_xBinding );
169 //------------------------------------------------------------------------------
170 void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
172 OAddConditionDialogBase::executedDialog( _nExecutionResult );
173 if ( _nExecutionResult == RET_OK )
174 m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog )->GetCondition();
177 //........................................................................
178 } // namespace svxformv
179 //........................................................................
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */