fdo#46808, Adapt form::control::FilterControl UNO service to new style
The service already existed, it just did not have an IDL file Change-Id: I1ca7ab09491057c1e9c91b5bb6763b84be10b47b
This commit is contained in:
@@ -763,8 +763,16 @@ namespace frm
|
||||
NamedValue aValue;
|
||||
const ::rtl::OUString* pName = NULL;
|
||||
const Any* pValue = NULL;
|
||||
Reference< XPropertySet > xControlModel;
|
||||
|
||||
for ( ; pArguments != pArgumentsEnd; ++pArguments )
|
||||
if (aArguments.getLength() == 3
|
||||
&& (aArguments[0] >>= m_xMessageParent)
|
||||
&& (aArguments[1] >>= m_xFormatter)
|
||||
&& (aArguments[2] >>= xControlModel))
|
||||
{
|
||||
initControlModel(xControlModel);
|
||||
}
|
||||
else for ( ; pArguments != pArgumentsEnd; ++pArguments )
|
||||
{
|
||||
// we recognize PropertyValues and NamedValues
|
||||
if ( *pArguments >>= aProp )
|
||||
@@ -798,13 +806,23 @@ namespace frm
|
||||
else if ( 0 == pName->compareToAscii( "ControlModel" ) )
|
||||
{
|
||||
// the control model for which we act as filter control
|
||||
Reference< XPropertySet > xControlModel;
|
||||
if ( !(*pValue >>= xControlModel ) || !xControlModel.is() )
|
||||
if ( !(*pValue >>= xControlModel ) )
|
||||
{
|
||||
OSL_FAIL( "OFilterControl::initialize: invalid control model argument!" );
|
||||
continue;
|
||||
}
|
||||
initControlModel(xControlModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OFilterControl::initControlModel(Reference< XPropertySet >& xControlModel)
|
||||
{
|
||||
if ( !xControlModel.is() )
|
||||
{
|
||||
OSL_FAIL( "OFilterControl::initialize: invalid control model argument!" );
|
||||
return;
|
||||
}
|
||||
// some properties which are "derived" from the control model we're working for
|
||||
// ...................................................
|
||||
// the field
|
||||
@@ -854,8 +872,6 @@ namespace frm
|
||||
m_xConnection = ::dbtools::getConnection( xForm );
|
||||
OSL_ENSURE( m_xConnection.is(), "OFilterControl::initialize: unable to determine the form's connection!" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
::rtl::OUString SAL_CALL OFilterControl::getImplementationName( ) throw (RuntimeException)
|
||||
|
@@ -79,6 +79,7 @@ namespace frm
|
||||
|
||||
private:
|
||||
void implInitFilterList();
|
||||
void initControlModel(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xControlModel);
|
||||
|
||||
public:
|
||||
OFilterControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB );
|
||||
|
@@ -129,6 +129,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/embed,\
|
||||
OOoEmbeddedObjectFactory \
|
||||
StorageFactory \
|
||||
))
|
||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/control,\
|
||||
FilterControl \
|
||||
))
|
||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/inspection,\
|
||||
DefaultFormComponentInspectorModel \
|
||||
))
|
||||
|
53
offapi/com/sun/star/form/control/FilterControl.idl
Normal file
53
offapi/com/sun/star/form/control/FilterControl.idl
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef __com_sun_star_form_control_FilterControl_idl__
|
||||
#define __com_sun_star_form_control_FilterControl_idl__
|
||||
|
||||
#include <com/sun/star/awt/XControl.idl>
|
||||
#include <com/sun/star/awt/XWindow.idl>
|
||||
#include <com/sun/star/util/XNumberFormatter.idl>
|
||||
#include <com/sun/star/beans/XPropertySet.idl>
|
||||
|
||||
|
||||
module com { module sun { module star { module form { module control {
|
||||
|
||||
|
||||
/** describes a check box control which can (but not necessarily has to) be bound to a database field.
|
||||
|
||||
<p>The model of the control has to support the <type scope="com::sun::star::form::component">CheckBox</type>
|
||||
service.</p>
|
||||
|
||||
@see com::sun::star::awt::UnoControl
|
||||
@see com::sun::star::awt::UnoControlModel
|
||||
*/
|
||||
service FilterControl : com::sun::star::awt::XControl
|
||||
{
|
||||
createWithFormat([in] com::sun::star::awt::XWindow MessageParent,
|
||||
[in] com::sun::star::util::XNumberFormatter NumberFormatter,
|
||||
[in] com::sun::star::beans::XPropertySet ControlModel);
|
||||
};
|
||||
|
||||
|
||||
}; }; }; }; };
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -47,6 +47,7 @@
|
||||
#include <com/sun/star/form/XGridControl.hpp>
|
||||
#include <com/sun/star/form/XLoadable.hpp>
|
||||
#include <com/sun/star/form/XReset.hpp>
|
||||
#include <com/sun/star/form/control/FilterControl.hpp>
|
||||
#include <com/sun/star/frame/XController.hpp>
|
||||
#include <com/sun/star/sdb/ParametersRequest.hpp>
|
||||
#include <com/sun/star/sdb/RowChangeAction.hpp>
|
||||
@@ -3377,15 +3378,11 @@ void FormController::startFiltering()
|
||||
)
|
||||
{
|
||||
// create a filter control
|
||||
Sequence< Any > aCreationArgs( 3 );
|
||||
aCreationArgs[ 0 ] <<= NamedValue( ::rtl::OUString("MessageParent"), makeAny( VCLUnoHelper::GetInterface( getDialogParentWindow() ) ) );
|
||||
aCreationArgs[ 1 ] <<= NamedValue( ::rtl::OUString("NumberFormatter"), makeAny( xFormatter ) );
|
||||
aCreationArgs[ 2 ] <<= NamedValue( ::rtl::OUString("ControlModel"), makeAny( xModel ) );
|
||||
Reference< XControl > xFilterControl(
|
||||
m_aContext.createComponentWithArguments( "com.sun.star.form.control.FilterControl", aCreationArgs ),
|
||||
UNO_QUERY
|
||||
);
|
||||
DBG_ASSERT( xFilterControl.is(), "FormController::startFiltering: could not create a filter control!" );
|
||||
Reference< XControl > xFilterControl = form::control::FilterControl::createWithFormat(
|
||||
m_aContext.getUNOContext(),
|
||||
VCLUnoHelper::GetInterface( getDialogParentWindow() ),
|
||||
xFormatter,
|
||||
xModel);
|
||||
|
||||
if ( replaceControl( xControl, xFilterControl ) )
|
||||
{
|
||||
|
Reference in New Issue
Block a user