summaryrefslogtreecommitdiff
path: root/svx/source/form/formcontroller.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/form/formcontroller.cxx')
-rw-r--r--svx/source/form/formcontroller.cxx79
1 files changed, 38 insertions, 41 deletions
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 94dd18139c27..5efd2607b49d 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -71,12 +71,13 @@
#include <comphelper/propagg.hxx>
#include <comphelper/property.hxx>
#include <comphelper/sequence.hxx>
-#include <comphelper/uno3.hxx>
#include <comphelper/flagguard.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <connectivity/IParseContext.hxx>
+#include <connectivity/dbtools.hxx>
+#include <connectivity/sqlparse.hxx>
#include <toolkit/controls/unocontrol.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/debug.hxx>
@@ -93,7 +94,7 @@
using namespace ::com::sun::star;
using namespace ::comphelper;
using namespace ::connectivity;
-using namespace ::connectivity::simple;
+using namespace ::dbtools;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
@@ -568,13 +569,13 @@ FormController::FormController(const Reference< css::uno::XComponentContext > &
,m_bSuspendFilterTextListening( false )
{
- ::comphelper::increment(m_refCount);
+ osl_atomic_increment(&m_refCount);
{
m_xTabController = TabController::create( m_xComponentContext );
m_xAggregate = Reference< XAggregation >( m_xTabController, UNO_QUERY_THROW );
m_xAggregate->setDelegator( *this );
}
- ::comphelper::decrement(m_refCount);
+ osl_atomic_decrement(&m_refCount);
m_aTabActivationIdle.SetPriority( SchedulerPriority::LOWEST );
m_aTabActivationIdle.SetIdleHdl( LINK( this, FormController, OnActivateTabOrder ) );
@@ -666,7 +667,7 @@ OUString SAL_CALL FormController::getImplementationName() throw( RuntimeExceptio
return OUString("org.openoffice.comp.svx.FormController");
}
-Sequence< OUString> SAL_CALL FormController::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
+Sequence< OUString> SAL_CALL FormController::getSupportedServiceNames() throw( RuntimeException, std::exception )
{
// service names which are supported only, but cannot be used to created an
// instance at a service factory
@@ -693,7 +694,7 @@ void SAL_CALL FormController::resetted(const EventObject& rEvent) throw( Runtime
}
-Sequence< OUString> FormController::getSupportedServiceNames_Static(void)
+Sequence< OUString> FormController::getSupportedServiceNames_Static()
{
static Sequence< OUString> aServices;
if (!aServices.getLength())
@@ -788,12 +789,11 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons
case FM_ATTR_FILTER:
{
OUStringBuffer aFilter;
- OStaticDataAccessTools aStaticTools;
- Reference<XConnection> xConnection(aStaticTools.getRowSetConnection(Reference< XRowSet>(m_xModelAsIndex, UNO_QUERY)));
+ Reference<XConnection> xConnection(getConnection(Reference< XRowSet>(m_xModelAsIndex, UNO_QUERY)));
if (xConnection.is())
{
Reference< XDatabaseMetaData> xMetaData(xConnection->getMetaData());
- Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats( xConnection, true ) );
+ Reference< XNumberFormatsSupplier> xFormatSupplier( getNumberFormats( xConnection, true ) );
Reference< XNumberFormatter> xFormatter = NumberFormatter::create(m_xComponentContext);
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
@@ -821,13 +821,13 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons
OUString sFilterValue( condition->second );
OUString sErrorMsg, sCriteria;
- const ::rtl::Reference< ISQLParseNode > xParseNode =
+ const std::shared_ptr< OSQLParseNode > pParseNode =
predicateTree( sErrorMsg, sFilterValue, xFormatter, xField );
- OSL_ENSURE( xParseNode.is(), "FormController::getFastPropertyValue: could not parse the field value predicate!" );
- if ( xParseNode.is() )
+ OSL_ENSURE( pParseNode != nullptr, "FormController::getFastPropertyValue: could not parse the field value predicate!" );
+ if ( pParseNode != nullptr )
{
// don't use a parse context here, we need it unlocalized
- xParseNode->parseNodeToStr( sCriteria, xConnection, NULL );
+ pParseNode->parseNodeToStr( sCriteria, xConnection, NULL );
if ( condition != rRow.begin() )
aRowFilter.appendAscii( " AND " );
aRowFilter.append( sCriteria );
@@ -1065,14 +1065,14 @@ void SAL_CALL FormController::setActiveTerm( ::sal_Int32 _ActiveTerm ) throw (In
// XElementAccess
-sal_Bool SAL_CALL FormController::hasElements(void) throw( RuntimeException, std::exception )
+sal_Bool SAL_CALL FormController::hasElements() throw( RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
return !m_aChildren.empty();
}
-Type SAL_CALL FormController::getElementType(void) throw( RuntimeException, std::exception )
+Type SAL_CALL FormController::getElementType() throw( RuntimeException, std::exception )
{
return cppu::UnoType<XFormController>::get();
@@ -1080,7 +1080,7 @@ Type SAL_CALL FormController::getElementType(void) throw( RuntimeException, std
// XEnumerationAccess
-Reference< XEnumeration > SAL_CALL FormController::createEnumeration(void) throw( RuntimeException, std::exception )
+Reference< XEnumeration > SAL_CALL FormController::createEnumeration() throw( RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
return new ::comphelper::OEnumerationByIndex(this);
@@ -1088,7 +1088,7 @@ Reference< XEnumeration > SAL_CALL FormController::createEnumeration(void) thro
// XIndexAccess
-sal_Int32 SAL_CALL FormController::getCount(void) throw( RuntimeException, std::exception )
+sal_Int32 SAL_CALL FormController::getCount() throw( RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
return m_aChildren.size();
@@ -1150,7 +1150,7 @@ void FormController::disposeAllFeaturesAndDispatchers()
}
-void FormController::disposing(void)
+void FormController::disposing()
{
EventObject aEvt( *this );
@@ -1616,8 +1616,8 @@ bool FormController::determineLockState() const
if (m_bFiltering || !xResultSet.is() || !isRowSetAlive(xResultSet))
return true;
else
- return (m_bCanInsert && m_bCurrentRecordNew) ? sal_False
- : xResultSet->isBeforeFirst() || xResultSet->isAfterLast() || xResultSet->rowDeleted() || !m_bCanUpdate;
+ return !(m_bCanInsert && m_bCurrentRecordNew)
+ && (xResultSet->isBeforeFirst() || xResultSet->isAfterLast() || xResultSet->rowDeleted() || !m_bCanUpdate);
}
// FocusListener
@@ -2108,7 +2108,7 @@ Reference< XControlContainer > FormController::getContainer() throw( RuntimeExc
}
-Sequence< Reference< XControl > > FormController::getControls(void) throw( RuntimeException, std::exception )
+Sequence< Reference< XControl > > FormController::getControls() throw( RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
impl_checkDisposed_throw();
@@ -2179,7 +2179,7 @@ void FormController::setControlLock(const Reference< XControl > & xControl)
// a.) wenn der ganze Datensatz gesperrt ist
// b.) wenn das zugehoerige Feld gespeert ist
Reference< XBoundControl > xBound(xControl, UNO_QUERY);
- if (xBound.is() && (( (bLocked && (bLocked ? 1 : 0) != xBound->getLock()) ||
+ if (xBound.is() && (( (bLocked && bLocked != bool(xBound->getLock())) ||
!bLocked))) // beim entlocken immer einzelne Felder ueberprüfen
{
// gibt es eine Datenquelle
@@ -2557,8 +2557,7 @@ void FormController::loaded(const EventObject& rEvent) throw( RuntimeException,
::osl::MutexGuard aGuard( m_aMutex );
Reference< XRowSet > xForm(rEvent.Source, UNO_QUERY);
// do we have a connected data source
- OStaticDataAccessTools aStaticTools;
- if (xForm.is() && aStaticTools.getRowSetConnection(xForm).is())
+ if (xForm.is() && getConnection(xForm).is())
{
Reference< XPropertySet > xSet(xForm, UNO_QUERY);
if (xSet.is())
@@ -2567,8 +2566,8 @@ void FormController::loaded(const EventObject& rEvent) throw( RuntimeException,
sal_Int32 aVal2 = 0;
::cppu::enum2int(aVal2,aVal);
m_bCycle = !aVal.hasValue() || aVal2 == TabulatorCycle_RECORDS;
- m_bCanUpdate = aStaticTools.canUpdate(xSet);
- m_bCanInsert = aStaticTools.canInsert(xSet);
+ m_bCanUpdate = canUpdate(xSet);
+ m_bCanInsert = canInsert(xSet);
m_bCurrentRecordModified = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISMODIFIED));
m_bCurrentRecordNew = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISNEW));
@@ -2957,7 +2956,7 @@ Reference< XFormOperations > SAL_CALL FormController::getFormOperations() throw
}
-Reference< XControl> SAL_CALL FormController::getCurrentControl(void) throw( RuntimeException, std::exception )
+Reference< XControl> SAL_CALL FormController::getCurrentControl() throw( RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
impl_checkDisposed_throw();
@@ -3054,7 +3053,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
// create the composer
Reference< XRowSet > xForm(m_xModelAsIndex, UNO_QUERY);
- Reference< XConnection > xConnection(OStaticDataAccessTools().getRowSetConnection(xForm));
+ Reference< XConnection > xConnection(getConnection(xForm));
if (xForm.is())
{
try
@@ -3103,15 +3102,14 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
::comphelper::UStringMixEqual aCompare(xMetaData->storesMixedCaseQuotedIdentifiers());
// need to parse criteria localized
- OStaticDataAccessTools aStaticTools;
- Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats(xConnection, true));
+ Reference< XNumberFormatsSupplier> xFormatSupplier( getNumberFormats(xConnection, true));
Reference< XNumberFormatter> xFormatter = NumberFormatter::create(m_xComponentContext);
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
Locale aAppLocale = Application::GetSettings().GetUILanguageTag().getLocale();
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetUILocaleDataWrapper() );
/* FIXME: casting this to sal_Char is plain wrong and of course only
* works for ASCII separators, but
- * xParseNode->parseNodeToPredicateStr() expects a sal_Char. Fix it
+ * pParseNode->parseNodeToPredicateStr() expects a sal_Char. Fix it
* there. */
sal_Char cDecimalSeparator = (sal_Char)rLocaleWrapper.getNumDecimalSep()[0];
SAL_WARN_IF( (sal_Unicode)cDecimalSeparator != rLocaleWrapper.getNumDecimalSep()[0],
@@ -3182,7 +3180,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
{
OUString aCompText = aRow[(*iter).xText];
aCompText += " ";
- OString aVal = m_xParser->getContext().getIntlKeywordAscii(IParseContext::KEY_AND);
+ OString aVal = m_pParser->getContext().getIntlKeywordAscii(IParseContext::KEY_AND);
aCompText += OUString(aVal.getStr(),aVal.getLength(),RTL_TEXTENCODING_ASCII_US);
aCompText += " ";
aCompText += ::comphelper::getString(pRefValues[j].Value);
@@ -3192,11 +3190,11 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
{
OUString sPredicate,sErrorMsg;
pRefValues[j].Value >>= sPredicate;
- ::rtl::Reference< ISQLParseNode > xParseNode = predicateTree(sErrorMsg, sPredicate, xFormatter, xField);
- if ( xParseNode.is() )
+ std::shared_ptr< OSQLParseNode > pParseNode = predicateTree(sErrorMsg, sPredicate, xFormatter, xField);
+ if ( pParseNode != nullptr )
{
OUString sCriteria;
- xParseNode->parseNodeToPredicateStr( sCriteria
+ pParseNode->parseNodeToPredicateStr( sCriteria
,xConnection
,xFormatter
,xField
@@ -3233,8 +3231,7 @@ void FormController::startFiltering()
{
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
- OStaticDataAccessTools aStaticTools;
- Reference< XConnection > xConnection( aStaticTools.getRowSetConnection( Reference< XRowSet >( m_xModelAsIndex, UNO_QUERY ) ) );
+ Reference< XConnection > xConnection( getConnection( Reference< XRowSet >( m_xModelAsIndex, UNO_QUERY ) ) );
if ( !xConnection.is() )
// nothing to do - can't filter a form which is not connected
return;
@@ -3256,7 +3253,7 @@ void FormController::startFiltering()
// the control we have to activate after replacement
Reference< XDatabaseMetaData > xMetaData(xConnection->getMetaData());
- Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats(xConnection, true);
+ Reference< XNumberFormatsSupplier > xFormatSupplier = getNumberFormats(xConnection, true);
Reference< XNumberFormatter > xFormatter = NumberFormatter::create(m_xComponentContext);
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
@@ -3481,7 +3478,7 @@ void FormController::setMode(const OUString& Mode) throw( NoSupportException, Ru
}
-OUString SAL_CALL FormController::getMode(void) throw( RuntimeException, std::exception )
+OUString SAL_CALL FormController::getMode() throw( RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
impl_checkDisposed_throw();
@@ -3490,7 +3487,7 @@ OUString SAL_CALL FormController::getMode(void) throw( RuntimeException, std::ex
}
-Sequence< OUString > SAL_CALL FormController::getSupportedModes(void) throw( RuntimeException, std::exception )
+Sequence< OUString > SAL_CALL FormController::getSupportedModes() throw( RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
impl_checkDisposed_throw();
@@ -3911,7 +3908,7 @@ sal_Bool SAL_CALL FormController::approveParameter(const DatabaseParameterEvent&
// the request
ParametersRequest aRequest;
aRequest.Parameters = aEvent.Parameters;
- aRequest.Connection = OStaticDataAccessTools().getRowSetConnection(Reference< XRowSet >(aEvent.Source, UNO_QUERY));
+ aRequest.Connection = getConnection(Reference< XRowSet >(aEvent.Source, UNO_QUERY));
OInteractionRequest* pParamRequest = new OInteractionRequest(makeAny(aRequest));
Reference< XInteractionRequest > xParamRequest(pParamRequest);
// some knittings